pollination-react-io 0.0.2 → 0.0.5

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.
@@ -1,68 +1,6 @@
1
- import { useState, useCallback, useEffect, useMemo } from 'react';
2
-
3
- /*! *****************************************************************************
4
- Copyright (c) Microsoft Corporation.
5
-
6
- Permission to use, copy, modify, and/or distribute this software for any
7
- purpose with or without fee is hereby granted.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
- PERFORMANCE OF THIS SOFTWARE.
16
- ***************************************************************************** */
17
-
18
- var __assign = function() {
19
- __assign = Object.assign || function __assign(t) {
20
- for (var s, i = 1, n = arguments.length; i < n; i++) {
21
- s = arguments[i];
22
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
-
29
- function __awaiter(thisArg, _arguments, P, generator) {
30
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
31
- return new (P || (P = Promise))(function (resolve, reject) {
32
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
33
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
34
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
35
- step((generator = generator.apply(thisArg, _arguments || [])).next());
36
- });
37
- }
38
-
39
- function __generator(thisArg, body) {
40
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
41
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
42
- function verb(n) { return function (v) { return step([n, v]); }; }
43
- function step(op) {
44
- if (f) throw new TypeError("Generator is already executing.");
45
- while (_) try {
46
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
47
- if (y = 0, t) op = [op[0] & 2, t.value];
48
- switch (op[0]) {
49
- case 0: case 1: t = op; break;
50
- case 4: _.label++; return { value: op[1], done: false };
51
- case 5: _.label++; y = op[1]; op = [0]; continue;
52
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
53
- default:
54
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
55
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
56
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
57
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
58
- if (t[2]) _.ops.pop();
59
- _.trys.pop(); continue;
60
- }
61
- op = body.call(thisArg, _);
62
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
63
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
64
- }
65
- }
1
+ import * as React from 'react';
2
+ import React__default, { useState, useRef, useCallback, useMemo, forwardRef, useEffect } from 'react';
3
+ import e$4 from 'react-dom';
66
4
 
67
5
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
68
6
 
@@ -1923,18 +1861,36 @@ module.exports = isEqual;
1923
1861
  });
1924
1862
 
1925
1863
  function checkDotNet() {
1926
- if (typeof window.parent.chrome === 'undefined') {
1864
+ try {
1865
+ if (typeof window.parent.chrome === 'undefined') {
1866
+ console.error('[POLLINATION-DEBUG]: chrome not found.');
1867
+ return false;
1868
+ }
1869
+ }
1870
+ catch (_a) {
1927
1871
  console.error('[POLLINATION-DEBUG]: chrome not found.');
1928
1872
  return false;
1929
1873
  }
1930
- if (typeof window.parent.chrome.webview === 'undefined') {
1874
+ try {
1875
+ if (typeof window.parent.chrome.webview === 'undefined') {
1876
+ console.error('[POLLINATION-DEBUG]: webview not found.');
1877
+ return false;
1878
+ }
1879
+ }
1880
+ catch (_b) {
1931
1881
  console.error('[POLLINATION-DEBUG]: webview not found.');
1932
1882
  return false;
1933
1883
  }
1934
1884
  return true;
1935
1885
  }
1936
1886
  function checkRuby() {
1937
- if (typeof window.sketchup === 'undefined') {
1887
+ try {
1888
+ if (typeof window.sketchup === 'undefined') {
1889
+ console.error('[POLLINATION-DEBUG]: sketchup not found.');
1890
+ return false;
1891
+ }
1892
+ }
1893
+ catch (_a) {
1938
1894
  console.error('[POLLINATION-DEBUG]: sketchup not found.');
1939
1895
  return false;
1940
1896
  }
@@ -1962,9 +1918,9 @@ function subscribeDotNet(interval) {
1962
1918
  if (interval === void 0) { interval = 1000; }
1963
1919
  if (!checkDotNet)
1964
1920
  return undefined;
1965
- if (!window.parent.chrome.webview.hostObjects ||
1966
- !window.parent.chrome.webview.hostObjects.sync ||
1967
- !window.parent.chrome.webview.hostObjects.PassHBJSON) {
1921
+ if (!window.parent.chrome.webview.hostObjects
1922
+ || !window.parent.chrome.webview.hostObjects.sync
1923
+ || !window.parent.chrome.webview.hostObjects.PassHBJSON) {
1968
1924
  console.error('[POLLINATION-DEBUG]: hostObjects.sync.PassHBJSON not configured correctly');
1969
1925
  return;
1970
1926
  }
@@ -1987,65 +1943,62 @@ function getHost(key, defaultValue) {
1987
1943
 
1988
1944
  var useGetHbjson = function () {
1989
1945
  var host = getHost();
1990
- var _a = useState(), messageResponse = _a[0], setMessageResponse = _a[1];
1991
- var _b = useState(undefined), hbjson = _b[0], setHbjson = _b[1];
1992
- var rubyGetHBJSON = useCallback(function (key, selection) {
1946
+ var _a = useState(undefined), hbjson = _a[0], setHbjson = _a[1];
1947
+ var hbjsonRef = useRef(undefined);
1948
+ var setReturnValue = useCallback(function (res, force) {
1949
+ var bytes = new TextEncoder().encode(res.Geometry);
1950
+ if (hbjsonRef.current) {
1951
+ if (force || !lodash_isequal(bytes, hbjsonRef.current)) {
1952
+ setHbjson(new Blob([bytes], {
1953
+ type: 'application/json;charset=utf-8',
1954
+ }));
1955
+ }
1956
+ }
1957
+ else {
1958
+ setHbjson(new Blob([bytes], {
1959
+ type: 'application/json;charset=utf-8',
1960
+ }));
1961
+ }
1962
+ hbjsonRef.current = bytes;
1963
+ }, []);
1964
+ var rubyGetHbjson = useCallback(function (key, selection, force) {
1993
1965
  if (key === void 0) { key = performance.now().toString(); }
1994
1966
  if (selection === void 0) { selection = false; }
1967
+ if (force === void 0) { force = false; }
1995
1968
  if (!checkRuby())
1996
1969
  return;
1997
- // TODO: why doesn't this function use the key?
1970
+ // TODO: why doesn't this function use the key?
1998
1971
  window.parent.sketchup.get_model(selection, {
1999
1972
  onCompleted: function (res) {
2000
1973
  var message = JSON.parse(res);
2001
- setMessageResponse(function (state) { return (__assign(__assign({}, state), { geometry: message.Geometry, identifier: message.Identifier })); });
2002
- }
1974
+ setReturnValue(message, force);
1975
+ },
2003
1976
  });
2004
- }, []);
2005
- var dotNetGetHBJSON = useCallback(function (key, selection) {
1977
+ }, [setReturnValue]);
1978
+ var dotNetGetHbjson = useCallback(function (key, selection, force) {
2006
1979
  if (key === void 0) { key = performance.now().toString(); }
2007
1980
  if (selection === void 0) { selection = false; }
1981
+ if (force === void 0) { force = false; }
2008
1982
  if (!checkDotNet())
2009
1983
  return;
2010
1984
  var res = {
2011
1985
  Geometry: null,
2012
- Identifier: null
1986
+ Identifier: null,
2013
1987
  };
2014
- // @ts-ignore
2015
1988
  res = window.parent.chrome.webview
2016
- .hostObjects.sync.hbjson.PassPollinationModel(selection);
2017
- setMessageResponse(function (state) { return (__assign(__assign({}, state), { geometry: res.Geometry, identifier: res.Identifier })); });
2018
- }, []);
2019
- useEffect(function () {
2020
- if (!messageResponse)
2021
- return;
2022
- // @ts-ignore
2023
- var bytes = new TextEncoder().encode(messageResponse.geometry);
2024
- if (hbjson) {
2025
- hbjson.arrayBuffer().then(function (data) {
2026
- if (!lodash_isequal(bytes, new Uint8Array(data))) {
2027
- setHbjson(new Blob([bytes], {
2028
- type: 'application/json;charset=utf-8',
2029
- }));
2030
- }
2031
- });
2032
- }
2033
- else {
2034
- setHbjson(new Blob([bytes], {
2035
- type: 'application/json;charset=utf-8',
2036
- }));
2037
- }
2038
- }, [messageResponse]);
1989
+ .hostObjects.sync.hbjson.PassPollinationModel(key, selection);
1990
+ setReturnValue(res, force);
1991
+ }, [setReturnValue]);
2039
1992
  var getHbjson = useMemo(function () {
2040
1993
  switch (host) {
2041
- case 'sketchup':
2042
- return rubyGetHBJSON;
2043
1994
  case 'rhino':
2044
- return dotNetGetHBJSON;
1995
+ return dotNetGetHbjson;
1996
+ case 'sketchup':
1997
+ return rubyGetHbjson;
2045
1998
  default:
2046
1999
  return undefined;
2047
2000
  }
2048
- }, [host, dotNetGetHBJSON, rubyGetHBJSON]);
2001
+ }, [dotNetGetHbjson, host, rubyGetHbjson]);
2049
2002
  return {
2050
2003
  host: host,
2051
2004
  hbjson: hbjson,
@@ -2055,64 +2008,61 @@ var useGetHbjson = function () {
2055
2008
 
2056
2009
  var useGetGeometry = function () {
2057
2010
  var host = getHost();
2058
- var _a = useState(), messageResponse = _a[0], setMessageResponse = _a[1];
2059
- var _b = useState(undefined), geometry = _b[0], setGeometry = _b[1];
2060
- var rubyGetGeometry = useCallback(function (key, selection) {
2011
+ var _a = useState(undefined), geometry = _a[0], setGeometry = _a[1];
2012
+ var geometryRef = useRef(undefined);
2013
+ var setReturnVal = useCallback(function (data, force) {
2014
+ var bytes = new TextEncoder().encode(data.Geometry);
2015
+ if (geometryRef.current) {
2016
+ if (force || !lodash_isequal(bytes, geometryRef.current)) {
2017
+ setGeometry(new Blob([bytes], {
2018
+ type: 'application/json;charset=utf-8',
2019
+ }));
2020
+ }
2021
+ }
2022
+ else {
2023
+ setGeometry(new Blob([bytes], {
2024
+ type: 'application/json;charset=utf-8',
2025
+ }));
2026
+ }
2027
+ geometryRef.current = bytes;
2028
+ }, []);
2029
+ var rubyGetGeometry = useCallback(function (key, selection, force) {
2061
2030
  if (key === void 0) { key = performance.now().toString(); }
2062
2031
  if (selection === void 0) { selection = false; }
2032
+ if (force === void 0) { force = false; }
2063
2033
  if (!checkRuby())
2064
2034
  return;
2065
2035
  // ruby invoke
2066
2036
  window.parent.sketchup.get_geometry(key, selection, {
2067
2037
  onCompleted: function (res) {
2068
2038
  var message = JSON.parse(res);
2069
- setMessageResponse(function (state) { return (__assign(__assign({}, state), { geometry: message.Geometry, identifier: message.Identifier })); });
2070
- }
2039
+ setReturnVal(message, force);
2040
+ },
2071
2041
  });
2072
- }, []);
2073
- var dotNetGetGeometry = useCallback(function (key, selection) {
2042
+ }, [setReturnVal]);
2043
+ var dotNetGetGeometry = useCallback(function (key, selection, force) {
2074
2044
  if (key === void 0) { key = performance.now().toString(); }
2075
2045
  if (selection === void 0) { selection = false; }
2046
+ if (force === void 0) { force = false; }
2076
2047
  if (!checkDotNet())
2077
2048
  return;
2078
2049
  var res = {
2079
2050
  Geometry: null,
2080
- Identifier: null
2051
+ Identifier: null,
2081
2052
  };
2082
- // @ts-ignore
2083
2053
  res = window.parent.chrome.webview.hostObjects.sync.geometry.PassJsonGeometry(key, selection);
2084
- setMessageResponse(function (state) { return (__assign(__assign({}, state), { geometry: res.Geometry, identifier: res.Identifier })); });
2085
- }, []);
2086
- useEffect(function () {
2087
- if (!messageResponse)
2088
- return;
2089
- // @ts-ignore
2090
- var bytes = new TextEncoder().encode(messageResponse.geometry);
2091
- if (geometry) {
2092
- geometry.arrayBuffer().then(function (data) {
2093
- if (!lodash_isequal(bytes, new Uint8Array(data))) {
2094
- setGeometry(new Blob([bytes], {
2095
- type: 'application/json;charset=utf-8',
2096
- }));
2097
- }
2098
- });
2099
- }
2100
- else {
2101
- setGeometry(new Blob([bytes], {
2102
- type: 'application/json;charset=utf-8',
2103
- }));
2104
- }
2105
- }, [messageResponse]);
2054
+ setReturnVal(res, force);
2055
+ }, [setReturnVal]);
2106
2056
  var getGeometry = useMemo(function () {
2107
2057
  switch (host) {
2108
- case 'sketchup':
2109
- return rubyGetGeometry;
2110
2058
  case 'rhino':
2111
2059
  return dotNetGetGeometry;
2060
+ case 'sketchup':
2061
+ return rubyGetGeometry;
2112
2062
  default:
2113
2063
  return undefined;
2114
2064
  }
2115
- }, [host, dotNetGetGeometry, rubyGetGeometry]);
2065
+ }, [dotNetGetGeometry, host, rubyGetGeometry]);
2116
2066
  return {
2117
2067
  host: host,
2118
2068
  geometry: geometry,
@@ -2120,37 +2070,127 @@ var useGetGeometry = function () {
2120
2070
  };
2121
2071
  };
2122
2072
 
2073
+ /******************************************************************************
2074
+ Copyright (c) Microsoft Corporation.
2075
+
2076
+ Permission to use, copy, modify, and/or distribute this software for any
2077
+ purpose with or without fee is hereby granted.
2078
+
2079
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2080
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2081
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2082
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2083
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2084
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2085
+ PERFORMANCE OF THIS SOFTWARE.
2086
+ ***************************************************************************** */
2087
+
2088
+ var __assign = function() {
2089
+ __assign = Object.assign || function __assign(t) {
2090
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
2091
+ s = arguments[i];
2092
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
2093
+ }
2094
+ return t;
2095
+ };
2096
+ return __assign.apply(this, arguments);
2097
+ };
2098
+
2099
+ function __rest(s, e) {
2100
+ var t = {};
2101
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2102
+ t[p] = s[p];
2103
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
2104
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2105
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
2106
+ t[p[i]] = s[p[i]];
2107
+ }
2108
+ return t;
2109
+ }
2110
+
2111
+ function __awaiter(thisArg, _arguments, P, generator) {
2112
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2113
+ return new (P || (P = Promise))(function (resolve, reject) {
2114
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
2115
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
2116
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
2117
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2118
+ });
2119
+ }
2120
+
2121
+ function __generator(thisArg, body) {
2122
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
2123
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
2124
+ function verb(n) { return function (v) { return step([n, v]); }; }
2125
+ function step(op) {
2126
+ if (f) throw new TypeError("Generator is already executing.");
2127
+ while (_) try {
2128
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
2129
+ if (y = 0, t) op = [op[0] & 2, t.value];
2130
+ switch (op[0]) {
2131
+ case 0: case 1: t = op; break;
2132
+ case 4: _.label++; return { value: op[1], done: false };
2133
+ case 5: _.label++; y = op[1]; op = [0]; continue;
2134
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
2135
+ default:
2136
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
2137
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
2138
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
2139
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
2140
+ if (t[2]) _.ops.pop();
2141
+ _.trys.pop(); continue;
2142
+ }
2143
+ op = body.call(thisArg, _);
2144
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
2145
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
2146
+ }
2147
+ }
2148
+
2149
+ function __spreadArray(to, from, pack) {
2150
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
2151
+ if (ar || !(i in from)) {
2152
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
2153
+ ar[i] = from[i];
2154
+ }
2155
+ }
2156
+ return to.concat(ar || Array.prototype.slice.call(from));
2157
+ }
2158
+
2123
2159
  var useSendHbjson = function () {
2124
2160
  var host = getHost();
2125
2161
  var _a = useState({}), state = _a[0], setState = _a[1];
2126
- var rubySendHBJSON = useCallback(function (message, preview) {
2162
+ var rubySendHbjson = useCallback(function (message, preview) {
2127
2163
  if (preview === void 0) { preview = true; }
2164
+ if (!checkRuby())
2165
+ return;
2128
2166
  var response = sendMessageRuby(__assign({ action: preview ? 'DrawPollinationModel' : 'BakePollinationModel' }, message));
2129
2167
  setState(function (state) { return (__assign(__assign({}, state), { response: response })); });
2130
2168
  return response;
2131
2169
  }, []);
2132
- var dotNetSendHBJSON = useCallback(function (message, preview) {
2170
+ var dotNetSendHbjson = useCallback(function (message, preview) {
2133
2171
  if (preview === void 0) { preview = true; }
2172
+ if (!checkDotNet())
2173
+ return;
2134
2174
  var response = sendMessageDotNet(__assign({ action: preview ? 'DrawPollinationModel' : 'BakePollinationModel' }, message));
2135
2175
  setState(function (state) { return (__assign(__assign({}, state), { response: response })); });
2136
2176
  return response;
2137
2177
  }, []);
2138
- var sendHBJSON = useMemo(function () {
2178
+ var sendHbjson = useMemo(function () {
2139
2179
  switch (host) {
2140
2180
  case 'sketchup':
2141
- return rubySendHBJSON;
2181
+ return rubySendHbjson;
2142
2182
  case 'rhino':
2143
- return dotNetSendHBJSON;
2183
+ return dotNetSendHbjson;
2144
2184
  case 'revit':
2145
- return dotNetSendHBJSON;
2185
+ return dotNetSendHbjson;
2146
2186
  default:
2147
2187
  return undefined;
2148
2188
  }
2149
- }, [dotNetSendHBJSON, host, rubySendHBJSON]);
2189
+ }, [dotNetSendHbjson, host, rubySendHbjson]);
2150
2190
  return ({
2151
2191
  host: host,
2152
2192
  state: state,
2153
- sendHBJSON: sendHBJSON
2193
+ sendHbjson: sendHbjson,
2154
2194
  });
2155
2195
  };
2156
2196
 
@@ -2159,12 +2199,16 @@ var useSendGeometry = function () {
2159
2199
  var _a = useState({}), state = _a[0], setState = _a[1];
2160
2200
  var rubySendGeometry = useCallback(function (message, preview) {
2161
2201
  if (preview === void 0) { preview = true; }
2202
+ if (!checkRuby())
2203
+ return;
2162
2204
  var response = sendMessageRuby(__assign({ action: preview ? 'DrawGeometry' : 'BakeGeometry' }, message));
2163
2205
  setState(function (state) { return (__assign(__assign({}, state), { response: response })); });
2164
2206
  return response;
2165
2207
  }, []);
2166
2208
  var dotNetSendGeometry = useCallback(function (message, preview) {
2167
2209
  if (preview === void 0) { preview = true; }
2210
+ if (!checkDotNet())
2211
+ return;
2168
2212
  var response = sendMessageDotNet(__assign({ action: preview ? 'DrawGeometry' : 'BakeGeometry' }, message));
2169
2213
  setState(function (state) { return (__assign(__assign({}, state), { response: response })); });
2170
2214
  return response;
@@ -2184,7 +2228,7 @@ var useSendGeometry = function () {
2184
2228
  return ({
2185
2229
  host: host,
2186
2230
  state: state,
2187
- sendGeometry: sendGeometry
2231
+ sendGeometry: sendGeometry,
2188
2232
  });
2189
2233
  };
2190
2234
 
@@ -2207,7 +2251,7 @@ var useRunCommand = function () {
2207
2251
  }, [host, rhinoRunCommand]);
2208
2252
  return {
2209
2253
  host: host,
2210
- runCommand: runCommand
2254
+ runCommand: runCommand,
2211
2255
  };
2212
2256
  };
2213
2257
 
@@ -2216,7 +2260,7 @@ var useManageSettings = function () {
2216
2260
  var rhinoSendSettings = useCallback(function (settings) {
2217
2261
  var message = {
2218
2262
  action: 'SetModelSettings',
2219
- data: settings
2263
+ data: settings,
2220
2264
  };
2221
2265
  return sendMessageDotNet(message);
2222
2266
  }, []);
@@ -2243,7 +2287,7 @@ var useManageSettings = function () {
2243
2287
  return ({
2244
2288
  host: host,
2245
2289
  sendSettings: sendSettings,
2246
- getSettings: getSettings
2290
+ getSettings: getSettings,
2247
2291
  });
2248
2292
  };
2249
2293
 
@@ -2256,13 +2300,13 @@ var useHbjsontoVTK = function () {
2256
2300
  return undefined;
2257
2301
  setLoading(true);
2258
2302
  return hbjson.text().then(function (fileString) {
2259
- fetch(UTILSENDPOINT + "/hbjson-to-vtk", {
2303
+ fetch("".concat(UTILSENDPOINT, "/hbjson-to-vtk"), {
2260
2304
  method: 'POST',
2261
2305
  headers: {
2262
2306
  'Content-Type': 'application/json',
2263
- 'Accept': '*/*',
2307
+ Accept: '*/*',
2264
2308
  },
2265
- body: "{\n \"output_format\": \"vtkjs\",\n \"hbjson\": " + fileString + "\n }"
2309
+ body: "{\n \"output_format\": \"vtkjs\",\n \"hbjson\": ".concat(fileString, "\n }"),
2266
2310
  })
2267
2311
  .catch(function (e) {
2268
2312
  throw new Error(e);
@@ -2277,9 +2321,7 @@ var useHbjsontoVTK = function () {
2277
2321
  case 1:
2278
2322
  translatedFile = _a.sent();
2279
2323
  setVTK(translatedFile);
2280
- return [2 /*return*/, translatedFile
2281
- // viewerRef.current.loadFile(translatedFile, 'vtkjs')
2282
- ];
2324
+ return [2 /*return*/, translatedFile];
2283
2325
  case 2: throw new Error('Failed to retrieve .vtkjs from .hbjson file.Error translating hbjson to vtkjs');
2284
2326
  }
2285
2327
  });
@@ -2292,9 +2334,2354 @@ var useHbjsontoVTK = function () {
2292
2334
  return {
2293
2335
  loading: loading,
2294
2336
  vtk: vtk,
2295
- fetchVTK: fetchVTK
2337
+ fetchVTK: fetchVTK,
2296
2338
  };
2297
2339
  };
2298
2340
 
2299
- export { checkDotNet, checkRuby, getHost, sendMessageDotNet, sendMessageRuby, subscribeDotNet, useGetGeometry, useGetHbjson, useHbjsontoVTK, useManageSettings, useRunCommand, useSendGeometry, useSendHbjson };
2341
+ /** @license React v16.13.1
2342
+ * react-is.production.min.js
2343
+ *
2344
+ * Copyright (c) Facebook, Inc. and its affiliates.
2345
+ *
2346
+ * This source code is licensed under the MIT license found in the
2347
+ * LICENSE file in the root directory of this source tree.
2348
+ */
2349
+ var b$2="function"===typeof Symbol&&Symbol.for,c$4=b$2?Symbol.for("react.element"):60103,d$4=b$2?Symbol.for("react.portal"):60106,e$3=b$2?Symbol.for("react.fragment"):60107,f$4=b$2?Symbol.for("react.strict_mode"):60108,g$2=b$2?Symbol.for("react.profiler"):60114,h=b$2?Symbol.for("react.provider"):60109,k$1=b$2?Symbol.for("react.context"):60110,l$4=b$2?Symbol.for("react.async_mode"):60111,m$3=b$2?Symbol.for("react.concurrent_mode"):60111,n$5=b$2?Symbol.for("react.forward_ref"):60112,p$2=b$2?Symbol.for("react.suspense"):60113,q$1=b$2?
2350
+ Symbol.for("react.suspense_list"):60120,r$4=b$2?Symbol.for("react.memo"):60115,t$4=b$2?Symbol.for("react.lazy"):60116,v$1=b$2?Symbol.for("react.block"):60121,w$2=b$2?Symbol.for("react.fundamental"):60117,x$1=b$2?Symbol.for("react.responder"):60118,y$1=b$2?Symbol.for("react.scope"):60119;
2351
+ function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$4:switch(a=a.type,a){case l$4:case m$3:case e$3:case g$2:case f$4:case p$2:return a;default:switch(a=a&&a.$$typeof,a){case k$1:case n$5:case t$4:case r$4:case h:return a;default:return u}}case d$4:return u}}}function A$1(a){return z(a)===m$3}var AsyncMode=l$4;var ConcurrentMode=m$3;var ContextConsumer=k$1;var ContextProvider=h;var Element=c$4;var ForwardRef=n$5;var Fragment=e$3;var Lazy=t$4;var Memo=r$4;var Portal$1=d$4;
2352
+ var Profiler=g$2;var StrictMode=f$4;var Suspense=p$2;var isAsyncMode=function(a){return A$1(a)||z(a)===l$4};var isConcurrentMode=A$1;var isContextConsumer=function(a){return z(a)===k$1};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c$4};var isForwardRef=function(a){return z(a)===n$5};var isFragment=function(a){return z(a)===e$3};var isLazy=function(a){return z(a)===t$4};
2353
+ var isMemo=function(a){return z(a)===r$4};var isPortal=function(a){return z(a)===d$4};var isProfiler=function(a){return z(a)===g$2};var isStrictMode=function(a){return z(a)===f$4};var isSuspense=function(a){return z(a)===p$2};
2354
+ var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e$3||a===m$3||a===g$2||a===f$4||a===p$2||a===q$1||"object"===typeof a&&null!==a&&(a.$$typeof===t$4||a.$$typeof===r$4||a.$$typeof===h||a.$$typeof===k$1||a.$$typeof===n$5||a.$$typeof===w$2||a.$$typeof===x$1||a.$$typeof===y$1||a.$$typeof===v$1)};var typeOf=z;
2355
+
2356
+ var reactIs_production_min = {
2357
+ AsyncMode: AsyncMode,
2358
+ ConcurrentMode: ConcurrentMode,
2359
+ ContextConsumer: ContextConsumer,
2360
+ ContextProvider: ContextProvider,
2361
+ Element: Element,
2362
+ ForwardRef: ForwardRef,
2363
+ Fragment: Fragment,
2364
+ Lazy: Lazy,
2365
+ Memo: Memo,
2366
+ Portal: Portal$1,
2367
+ Profiler: Profiler,
2368
+ StrictMode: StrictMode,
2369
+ Suspense: Suspense,
2370
+ isAsyncMode: isAsyncMode,
2371
+ isConcurrentMode: isConcurrentMode,
2372
+ isContextConsumer: isContextConsumer,
2373
+ isContextProvider: isContextProvider,
2374
+ isElement: isElement,
2375
+ isForwardRef: isForwardRef,
2376
+ isFragment: isFragment,
2377
+ isLazy: isLazy,
2378
+ isMemo: isMemo,
2379
+ isPortal: isPortal,
2380
+ isProfiler: isProfiler,
2381
+ isStrictMode: isStrictMode,
2382
+ isSuspense: isSuspense,
2383
+ isValidElementType: isValidElementType,
2384
+ typeOf: typeOf
2385
+ };
2386
+
2387
+ /** @license React v16.13.1
2388
+ * react-is.development.js
2389
+ *
2390
+ * Copyright (c) Facebook, Inc. and its affiliates.
2391
+ *
2392
+ * This source code is licensed under the MIT license found in the
2393
+ * LICENSE file in the root directory of this source tree.
2394
+ */
2395
+
2396
+ var reactIs_development = createCommonjsModule(function (module, exports) {
2397
+
2398
+
2399
+
2400
+ if (process.env.NODE_ENV !== "production") {
2401
+ (function() {
2402
+
2403
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
2404
+ // nor polyfill, then a plain number is used for performance.
2405
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
2406
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
2407
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
2408
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
2409
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
2410
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
2411
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
2412
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
2413
+ // (unstable) APIs that have been removed. Can we remove the symbols?
2414
+
2415
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
2416
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
2417
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
2418
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
2419
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
2420
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
2421
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
2422
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
2423
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
2424
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
2425
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
2426
+
2427
+ function isValidElementType(type) {
2428
+ return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
2429
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
2430
+ }
2431
+
2432
+ function typeOf(object) {
2433
+ if (typeof object === 'object' && object !== null) {
2434
+ var $$typeof = object.$$typeof;
2435
+
2436
+ switch ($$typeof) {
2437
+ case REACT_ELEMENT_TYPE:
2438
+ var type = object.type;
2439
+
2440
+ switch (type) {
2441
+ case REACT_ASYNC_MODE_TYPE:
2442
+ case REACT_CONCURRENT_MODE_TYPE:
2443
+ case REACT_FRAGMENT_TYPE:
2444
+ case REACT_PROFILER_TYPE:
2445
+ case REACT_STRICT_MODE_TYPE:
2446
+ case REACT_SUSPENSE_TYPE:
2447
+ return type;
2448
+
2449
+ default:
2450
+ var $$typeofType = type && type.$$typeof;
2451
+
2452
+ switch ($$typeofType) {
2453
+ case REACT_CONTEXT_TYPE:
2454
+ case REACT_FORWARD_REF_TYPE:
2455
+ case REACT_LAZY_TYPE:
2456
+ case REACT_MEMO_TYPE:
2457
+ case REACT_PROVIDER_TYPE:
2458
+ return $$typeofType;
2459
+
2460
+ default:
2461
+ return $$typeof;
2462
+ }
2463
+
2464
+ }
2465
+
2466
+ case REACT_PORTAL_TYPE:
2467
+ return $$typeof;
2468
+ }
2469
+ }
2470
+
2471
+ return undefined;
2472
+ } // AsyncMode is deprecated along with isAsyncMode
2473
+
2474
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
2475
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
2476
+ var ContextConsumer = REACT_CONTEXT_TYPE;
2477
+ var ContextProvider = REACT_PROVIDER_TYPE;
2478
+ var Element = REACT_ELEMENT_TYPE;
2479
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
2480
+ var Fragment = REACT_FRAGMENT_TYPE;
2481
+ var Lazy = REACT_LAZY_TYPE;
2482
+ var Memo = REACT_MEMO_TYPE;
2483
+ var Portal = REACT_PORTAL_TYPE;
2484
+ var Profiler = REACT_PROFILER_TYPE;
2485
+ var StrictMode = REACT_STRICT_MODE_TYPE;
2486
+ var Suspense = REACT_SUSPENSE_TYPE;
2487
+ var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
2488
+
2489
+ function isAsyncMode(object) {
2490
+ {
2491
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
2492
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
2493
+
2494
+ console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
2495
+ }
2496
+ }
2497
+
2498
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
2499
+ }
2500
+ function isConcurrentMode(object) {
2501
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
2502
+ }
2503
+ function isContextConsumer(object) {
2504
+ return typeOf(object) === REACT_CONTEXT_TYPE;
2505
+ }
2506
+ function isContextProvider(object) {
2507
+ return typeOf(object) === REACT_PROVIDER_TYPE;
2508
+ }
2509
+ function isElement(object) {
2510
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
2511
+ }
2512
+ function isForwardRef(object) {
2513
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
2514
+ }
2515
+ function isFragment(object) {
2516
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
2517
+ }
2518
+ function isLazy(object) {
2519
+ return typeOf(object) === REACT_LAZY_TYPE;
2520
+ }
2521
+ function isMemo(object) {
2522
+ return typeOf(object) === REACT_MEMO_TYPE;
2523
+ }
2524
+ function isPortal(object) {
2525
+ return typeOf(object) === REACT_PORTAL_TYPE;
2526
+ }
2527
+ function isProfiler(object) {
2528
+ return typeOf(object) === REACT_PROFILER_TYPE;
2529
+ }
2530
+ function isStrictMode(object) {
2531
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
2532
+ }
2533
+ function isSuspense(object) {
2534
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
2535
+ }
2536
+
2537
+ exports.AsyncMode = AsyncMode;
2538
+ exports.ConcurrentMode = ConcurrentMode;
2539
+ exports.ContextConsumer = ContextConsumer;
2540
+ exports.ContextProvider = ContextProvider;
2541
+ exports.Element = Element;
2542
+ exports.ForwardRef = ForwardRef;
2543
+ exports.Fragment = Fragment;
2544
+ exports.Lazy = Lazy;
2545
+ exports.Memo = Memo;
2546
+ exports.Portal = Portal;
2547
+ exports.Profiler = Profiler;
2548
+ exports.StrictMode = StrictMode;
2549
+ exports.Suspense = Suspense;
2550
+ exports.isAsyncMode = isAsyncMode;
2551
+ exports.isConcurrentMode = isConcurrentMode;
2552
+ exports.isContextConsumer = isContextConsumer;
2553
+ exports.isContextProvider = isContextProvider;
2554
+ exports.isElement = isElement;
2555
+ exports.isForwardRef = isForwardRef;
2556
+ exports.isFragment = isFragment;
2557
+ exports.isLazy = isLazy;
2558
+ exports.isMemo = isMemo;
2559
+ exports.isPortal = isPortal;
2560
+ exports.isProfiler = isProfiler;
2561
+ exports.isStrictMode = isStrictMode;
2562
+ exports.isSuspense = isSuspense;
2563
+ exports.isValidElementType = isValidElementType;
2564
+ exports.typeOf = typeOf;
2565
+ })();
2566
+ }
2567
+ });
2568
+
2569
+ var reactIs = createCommonjsModule(function (module) {
2570
+
2571
+ if (process.env.NODE_ENV === 'production') {
2572
+ module.exports = reactIs_production_min;
2573
+ } else {
2574
+ module.exports = reactIs_development;
2575
+ }
2576
+ });
2577
+
2578
+ /*
2579
+ object-assign
2580
+ (c) Sindre Sorhus
2581
+ @license MIT
2582
+ */
2583
+ /* eslint-disable no-unused-vars */
2584
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
2585
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
2586
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
2587
+
2588
+ function toObject(val) {
2589
+ if (val === null || val === undefined) {
2590
+ throw new TypeError('Object.assign cannot be called with null or undefined');
2591
+ }
2592
+
2593
+ return Object(val);
2594
+ }
2595
+
2596
+ function shouldUseNative() {
2597
+ try {
2598
+ if (!Object.assign) {
2599
+ return false;
2600
+ }
2601
+
2602
+ // Detect buggy property enumeration order in older V8 versions.
2603
+
2604
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
2605
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
2606
+ test1[5] = 'de';
2607
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
2608
+ return false;
2609
+ }
2610
+
2611
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
2612
+ var test2 = {};
2613
+ for (var i = 0; i < 10; i++) {
2614
+ test2['_' + String.fromCharCode(i)] = i;
2615
+ }
2616
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
2617
+ return test2[n];
2618
+ });
2619
+ if (order2.join('') !== '0123456789') {
2620
+ return false;
2621
+ }
2622
+
2623
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
2624
+ var test3 = {};
2625
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
2626
+ test3[letter] = letter;
2627
+ });
2628
+ if (Object.keys(Object.assign({}, test3)).join('') !==
2629
+ 'abcdefghijklmnopqrst') {
2630
+ return false;
2631
+ }
2632
+
2633
+ return true;
2634
+ } catch (err) {
2635
+ // We don't expect any of the above to throw, but better to be safe.
2636
+ return false;
2637
+ }
2638
+ }
2639
+
2640
+ var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
2641
+ var from;
2642
+ var to = toObject(target);
2643
+ var symbols;
2644
+
2645
+ for (var s = 1; s < arguments.length; s++) {
2646
+ from = Object(arguments[s]);
2647
+
2648
+ for (var key in from) {
2649
+ if (hasOwnProperty.call(from, key)) {
2650
+ to[key] = from[key];
2651
+ }
2652
+ }
2653
+
2654
+ if (getOwnPropertySymbols) {
2655
+ symbols = getOwnPropertySymbols(from);
2656
+ for (var i = 0; i < symbols.length; i++) {
2657
+ if (propIsEnumerable.call(from, symbols[i])) {
2658
+ to[symbols[i]] = from[symbols[i]];
2659
+ }
2660
+ }
2661
+ }
2662
+ }
2663
+
2664
+ return to;
2665
+ };
2666
+
2667
+ /**
2668
+ * Copyright (c) 2013-present, Facebook, Inc.
2669
+ *
2670
+ * This source code is licensed under the MIT license found in the
2671
+ * LICENSE file in the root directory of this source tree.
2672
+ */
2673
+
2674
+ var ReactPropTypesSecret$2 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
2675
+
2676
+ var ReactPropTypesSecret_1 = ReactPropTypesSecret$2;
2677
+
2678
+ var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
2679
+
2680
+ var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
2681
+
2682
+ var has$1 = has$2;
2683
+
2684
+ /**
2685
+ * Copyright (c) 2013-present, Facebook, Inc.
2686
+ *
2687
+ * This source code is licensed under the MIT license found in the
2688
+ * LICENSE file in the root directory of this source tree.
2689
+ */
2690
+
2691
+ var printWarning$1 = function() {};
2692
+
2693
+ if (process.env.NODE_ENV !== 'production') {
2694
+ var ReactPropTypesSecret = ReactPropTypesSecret$1;
2695
+ var loggedTypeFailures = {};
2696
+ var has = has$1;
2697
+
2698
+ printWarning$1 = function(text) {
2699
+ var message = 'Warning: ' + text;
2700
+ if (typeof console !== 'undefined') {
2701
+ console.error(message);
2702
+ }
2703
+ try {
2704
+ // --- Welcome to debugging React ---
2705
+ // This error was thrown as a convenience so that you can use this stack
2706
+ // to find the callsite that caused this warning to fire.
2707
+ throw new Error(message);
2708
+ } catch (x) { /**/ }
2709
+ };
2710
+ }
2711
+
2712
+ /**
2713
+ * Assert that the values match with the type specs.
2714
+ * Error messages are memorized and will only be shown once.
2715
+ *
2716
+ * @param {object} typeSpecs Map of name to a ReactPropType
2717
+ * @param {object} values Runtime values that need to be type-checked
2718
+ * @param {string} location e.g. "prop", "context", "child context"
2719
+ * @param {string} componentName Name of the component for error messages.
2720
+ * @param {?Function} getStack Returns the component stack.
2721
+ * @private
2722
+ */
2723
+ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
2724
+ if (process.env.NODE_ENV !== 'production') {
2725
+ for (var typeSpecName in typeSpecs) {
2726
+ if (has(typeSpecs, typeSpecName)) {
2727
+ var error;
2728
+ // Prop type validation may throw. In case they do, we don't want to
2729
+ // fail the render phase where it didn't fail before. So we log it.
2730
+ // After these have been cleaned up, we'll let them throw.
2731
+ try {
2732
+ // This is intentionally an invariant that gets caught. It's the same
2733
+ // behavior as without this statement except with a better message.
2734
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
2735
+ var err = Error(
2736
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
2737
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
2738
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
2739
+ );
2740
+ err.name = 'Invariant Violation';
2741
+ throw err;
2742
+ }
2743
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
2744
+ } catch (ex) {
2745
+ error = ex;
2746
+ }
2747
+ if (error && !(error instanceof Error)) {
2748
+ printWarning$1(
2749
+ (componentName || 'React class') + ': type specification of ' +
2750
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
2751
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
2752
+ 'You may have forgotten to pass an argument to the type checker ' +
2753
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
2754
+ 'shape all require an argument).'
2755
+ );
2756
+ }
2757
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
2758
+ // Only monitor this failure once because there tends to be a lot of the
2759
+ // same error.
2760
+ loggedTypeFailures[error.message] = true;
2761
+
2762
+ var stack = getStack ? getStack() : '';
2763
+
2764
+ printWarning$1(
2765
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
2766
+ );
2767
+ }
2768
+ }
2769
+ }
2770
+ }
2771
+ }
2772
+
2773
+ /**
2774
+ * Resets warning cache when testing.
2775
+ *
2776
+ * @private
2777
+ */
2778
+ checkPropTypes$1.resetWarningCache = function() {
2779
+ if (process.env.NODE_ENV !== 'production') {
2780
+ loggedTypeFailures = {};
2781
+ }
2782
+ };
2783
+
2784
+ var checkPropTypes_1 = checkPropTypes$1;
2785
+
2786
+ var checkPropTypes = checkPropTypes_1;
2787
+
2788
+ /**
2789
+ * Copyright (c) 2013-present, Facebook, Inc.
2790
+ *
2791
+ * This source code is licensed under the MIT license found in the
2792
+ * LICENSE file in the root directory of this source tree.
2793
+ */
2794
+
2795
+
2796
+
2797
+
2798
+
2799
+
2800
+
2801
+
2802
+ var printWarning = function() {};
2803
+
2804
+ if (process.env.NODE_ENV !== 'production') {
2805
+ printWarning = function(text) {
2806
+ var message = 'Warning: ' + text;
2807
+ if (typeof console !== 'undefined') {
2808
+ console.error(message);
2809
+ }
2810
+ try {
2811
+ // --- Welcome to debugging React ---
2812
+ // This error was thrown as a convenience so that you can use this stack
2813
+ // to find the callsite that caused this warning to fire.
2814
+ throw new Error(message);
2815
+ } catch (x) {}
2816
+ };
2817
+ }
2818
+
2819
+ function emptyFunctionThatReturnsNull() {
2820
+ return null;
2821
+ }
2822
+
2823
+ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
2824
+ /* global Symbol */
2825
+ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
2826
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
2827
+
2828
+ /**
2829
+ * Returns the iterator method function contained on the iterable object.
2830
+ *
2831
+ * Be sure to invoke the function with the iterable as context:
2832
+ *
2833
+ * var iteratorFn = getIteratorFn(myIterable);
2834
+ * if (iteratorFn) {
2835
+ * var iterator = iteratorFn.call(myIterable);
2836
+ * ...
2837
+ * }
2838
+ *
2839
+ * @param {?object} maybeIterable
2840
+ * @return {?function}
2841
+ */
2842
+ function getIteratorFn(maybeIterable) {
2843
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
2844
+ if (typeof iteratorFn === 'function') {
2845
+ return iteratorFn;
2846
+ }
2847
+ }
2848
+
2849
+ /**
2850
+ * Collection of methods that allow declaration and validation of props that are
2851
+ * supplied to React components. Example usage:
2852
+ *
2853
+ * var Props = require('ReactPropTypes');
2854
+ * var MyArticle = React.createClass({
2855
+ * propTypes: {
2856
+ * // An optional string prop named "description".
2857
+ * description: Props.string,
2858
+ *
2859
+ * // A required enum prop named "category".
2860
+ * category: Props.oneOf(['News','Photos']).isRequired,
2861
+ *
2862
+ * // A prop named "dialog" that requires an instance of Dialog.
2863
+ * dialog: Props.instanceOf(Dialog).isRequired
2864
+ * },
2865
+ * render: function() { ... }
2866
+ * });
2867
+ *
2868
+ * A more formal specification of how these methods are used:
2869
+ *
2870
+ * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
2871
+ * decl := ReactPropTypes.{type}(.isRequired)?
2872
+ *
2873
+ * Each and every declaration produces a function with the same signature. This
2874
+ * allows the creation of custom validation functions. For example:
2875
+ *
2876
+ * var MyLink = React.createClass({
2877
+ * propTypes: {
2878
+ * // An optional string or URI prop named "href".
2879
+ * href: function(props, propName, componentName) {
2880
+ * var propValue = props[propName];
2881
+ * if (propValue != null && typeof propValue !== 'string' &&
2882
+ * !(propValue instanceof URI)) {
2883
+ * return new Error(
2884
+ * 'Expected a string or an URI for ' + propName + ' in ' +
2885
+ * componentName
2886
+ * );
2887
+ * }
2888
+ * }
2889
+ * },
2890
+ * render: function() {...}
2891
+ * });
2892
+ *
2893
+ * @internal
2894
+ */
2895
+
2896
+ var ANONYMOUS = '<<anonymous>>';
2897
+
2898
+ // Important!
2899
+ // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
2900
+ var ReactPropTypes = {
2901
+ array: createPrimitiveTypeChecker('array'),
2902
+ bigint: createPrimitiveTypeChecker('bigint'),
2903
+ bool: createPrimitiveTypeChecker('boolean'),
2904
+ func: createPrimitiveTypeChecker('function'),
2905
+ number: createPrimitiveTypeChecker('number'),
2906
+ object: createPrimitiveTypeChecker('object'),
2907
+ string: createPrimitiveTypeChecker('string'),
2908
+ symbol: createPrimitiveTypeChecker('symbol'),
2909
+
2910
+ any: createAnyTypeChecker(),
2911
+ arrayOf: createArrayOfTypeChecker,
2912
+ element: createElementTypeChecker(),
2913
+ elementType: createElementTypeTypeChecker(),
2914
+ instanceOf: createInstanceTypeChecker,
2915
+ node: createNodeChecker(),
2916
+ objectOf: createObjectOfTypeChecker,
2917
+ oneOf: createEnumTypeChecker,
2918
+ oneOfType: createUnionTypeChecker,
2919
+ shape: createShapeTypeChecker,
2920
+ exact: createStrictShapeTypeChecker,
2921
+ };
2922
+
2923
+ /**
2924
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
2925
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
2926
+ */
2927
+ /*eslint-disable no-self-compare*/
2928
+ function is(x, y) {
2929
+ // SameValue algorithm
2930
+ if (x === y) {
2931
+ // Steps 1-5, 7-10
2932
+ // Steps 6.b-6.e: +0 != -0
2933
+ return x !== 0 || 1 / x === 1 / y;
2934
+ } else {
2935
+ // Step 6.a: NaN == NaN
2936
+ return x !== x && y !== y;
2937
+ }
2938
+ }
2939
+ /*eslint-enable no-self-compare*/
2940
+
2941
+ /**
2942
+ * We use an Error-like object for backward compatibility as people may call
2943
+ * PropTypes directly and inspect their output. However, we don't use real
2944
+ * Errors anymore. We don't inspect their stack anyway, and creating them
2945
+ * is prohibitively expensive if they are created too often, such as what
2946
+ * happens in oneOfType() for any type before the one that matched.
2947
+ */
2948
+ function PropTypeError(message, data) {
2949
+ this.message = message;
2950
+ this.data = data && typeof data === 'object' ? data: {};
2951
+ this.stack = '';
2952
+ }
2953
+ // Make `instanceof Error` still work for returned errors.
2954
+ PropTypeError.prototype = Error.prototype;
2955
+
2956
+ function createChainableTypeChecker(validate) {
2957
+ if (process.env.NODE_ENV !== 'production') {
2958
+ var manualPropTypeCallCache = {};
2959
+ var manualPropTypeWarningCount = 0;
2960
+ }
2961
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
2962
+ componentName = componentName || ANONYMOUS;
2963
+ propFullName = propFullName || propName;
2964
+
2965
+ if (secret !== ReactPropTypesSecret$1) {
2966
+ if (throwOnDirectAccess) {
2967
+ // New behavior only for users of `prop-types` package
2968
+ var err = new Error(
2969
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
2970
+ 'Use `PropTypes.checkPropTypes()` to call them. ' +
2971
+ 'Read more at http://fb.me/use-check-prop-types'
2972
+ );
2973
+ err.name = 'Invariant Violation';
2974
+ throw err;
2975
+ } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
2976
+ // Old behavior for people using React.PropTypes
2977
+ var cacheKey = componentName + ':' + propName;
2978
+ if (
2979
+ !manualPropTypeCallCache[cacheKey] &&
2980
+ // Avoid spamming the console because they are often not actionable except for lib authors
2981
+ manualPropTypeWarningCount < 3
2982
+ ) {
2983
+ printWarning(
2984
+ 'You are manually calling a React.PropTypes validation ' +
2985
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
2986
+ 'and will throw in the standalone `prop-types` package. ' +
2987
+ 'You may be seeing this warning due to a third-party PropTypes ' +
2988
+ 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
2989
+ );
2990
+ manualPropTypeCallCache[cacheKey] = true;
2991
+ manualPropTypeWarningCount++;
2992
+ }
2993
+ }
2994
+ }
2995
+ if (props[propName] == null) {
2996
+ if (isRequired) {
2997
+ if (props[propName] === null) {
2998
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
2999
+ }
3000
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
3001
+ }
3002
+ return null;
3003
+ } else {
3004
+ return validate(props, propName, componentName, location, propFullName);
3005
+ }
3006
+ }
3007
+
3008
+ var chainedCheckType = checkType.bind(null, false);
3009
+ chainedCheckType.isRequired = checkType.bind(null, true);
3010
+
3011
+ return chainedCheckType;
3012
+ }
3013
+
3014
+ function createPrimitiveTypeChecker(expectedType) {
3015
+ function validate(props, propName, componentName, location, propFullName, secret) {
3016
+ var propValue = props[propName];
3017
+ var propType = getPropType(propValue);
3018
+ if (propType !== expectedType) {
3019
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
3020
+ // check, but we can offer a more precise error message here rather than
3021
+ // 'of type `object`'.
3022
+ var preciseType = getPreciseType(propValue);
3023
+
3024
+ return new PropTypeError(
3025
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
3026
+ {expectedType: expectedType}
3027
+ );
3028
+ }
3029
+ return null;
3030
+ }
3031
+ return createChainableTypeChecker(validate);
3032
+ }
3033
+
3034
+ function createAnyTypeChecker() {
3035
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
3036
+ }
3037
+
3038
+ function createArrayOfTypeChecker(typeChecker) {
3039
+ function validate(props, propName, componentName, location, propFullName) {
3040
+ if (typeof typeChecker !== 'function') {
3041
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
3042
+ }
3043
+ var propValue = props[propName];
3044
+ if (!Array.isArray(propValue)) {
3045
+ var propType = getPropType(propValue);
3046
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
3047
+ }
3048
+ for (var i = 0; i < propValue.length; i++) {
3049
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret$1);
3050
+ if (error instanceof Error) {
3051
+ return error;
3052
+ }
3053
+ }
3054
+ return null;
3055
+ }
3056
+ return createChainableTypeChecker(validate);
3057
+ }
3058
+
3059
+ function createElementTypeChecker() {
3060
+ function validate(props, propName, componentName, location, propFullName) {
3061
+ var propValue = props[propName];
3062
+ if (!isValidElement(propValue)) {
3063
+ var propType = getPropType(propValue);
3064
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
3065
+ }
3066
+ return null;
3067
+ }
3068
+ return createChainableTypeChecker(validate);
3069
+ }
3070
+
3071
+ function createElementTypeTypeChecker() {
3072
+ function validate(props, propName, componentName, location, propFullName) {
3073
+ var propValue = props[propName];
3074
+ if (!reactIs.isValidElementType(propValue)) {
3075
+ var propType = getPropType(propValue);
3076
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
3077
+ }
3078
+ return null;
3079
+ }
3080
+ return createChainableTypeChecker(validate);
3081
+ }
3082
+
3083
+ function createInstanceTypeChecker(expectedClass) {
3084
+ function validate(props, propName, componentName, location, propFullName) {
3085
+ if (!(props[propName] instanceof expectedClass)) {
3086
+ var expectedClassName = expectedClass.name || ANONYMOUS;
3087
+ var actualClassName = getClassName(props[propName]);
3088
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
3089
+ }
3090
+ return null;
3091
+ }
3092
+ return createChainableTypeChecker(validate);
3093
+ }
3094
+
3095
+ function createEnumTypeChecker(expectedValues) {
3096
+ if (!Array.isArray(expectedValues)) {
3097
+ if (process.env.NODE_ENV !== 'production') {
3098
+ if (arguments.length > 1) {
3099
+ printWarning(
3100
+ 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
3101
+ 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
3102
+ );
3103
+ } else {
3104
+ printWarning('Invalid argument supplied to oneOf, expected an array.');
3105
+ }
3106
+ }
3107
+ return emptyFunctionThatReturnsNull;
3108
+ }
3109
+
3110
+ function validate(props, propName, componentName, location, propFullName) {
3111
+ var propValue = props[propName];
3112
+ for (var i = 0; i < expectedValues.length; i++) {
3113
+ if (is(propValue, expectedValues[i])) {
3114
+ return null;
3115
+ }
3116
+ }
3117
+
3118
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
3119
+ var type = getPreciseType(value);
3120
+ if (type === 'symbol') {
3121
+ return String(value);
3122
+ }
3123
+ return value;
3124
+ });
3125
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
3126
+ }
3127
+ return createChainableTypeChecker(validate);
3128
+ }
3129
+
3130
+ function createObjectOfTypeChecker(typeChecker) {
3131
+ function validate(props, propName, componentName, location, propFullName) {
3132
+ if (typeof typeChecker !== 'function') {
3133
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
3134
+ }
3135
+ var propValue = props[propName];
3136
+ var propType = getPropType(propValue);
3137
+ if (propType !== 'object') {
3138
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
3139
+ }
3140
+ for (var key in propValue) {
3141
+ if (has$1(propValue, key)) {
3142
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
3143
+ if (error instanceof Error) {
3144
+ return error;
3145
+ }
3146
+ }
3147
+ }
3148
+ return null;
3149
+ }
3150
+ return createChainableTypeChecker(validate);
3151
+ }
3152
+
3153
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
3154
+ if (!Array.isArray(arrayOfTypeCheckers)) {
3155
+ process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
3156
+ return emptyFunctionThatReturnsNull;
3157
+ }
3158
+
3159
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
3160
+ var checker = arrayOfTypeCheckers[i];
3161
+ if (typeof checker !== 'function') {
3162
+ printWarning(
3163
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
3164
+ 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
3165
+ );
3166
+ return emptyFunctionThatReturnsNull;
3167
+ }
3168
+ }
3169
+
3170
+ function validate(props, propName, componentName, location, propFullName) {
3171
+ var expectedTypes = [];
3172
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
3173
+ var checker = arrayOfTypeCheckers[i];
3174
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1);
3175
+ if (checkerResult == null) {
3176
+ return null;
3177
+ }
3178
+ if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
3179
+ expectedTypes.push(checkerResult.data.expectedType);
3180
+ }
3181
+ }
3182
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
3183
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
3184
+ }
3185
+ return createChainableTypeChecker(validate);
3186
+ }
3187
+
3188
+ function createNodeChecker() {
3189
+ function validate(props, propName, componentName, location, propFullName) {
3190
+ if (!isNode(props[propName])) {
3191
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
3192
+ }
3193
+ return null;
3194
+ }
3195
+ return createChainableTypeChecker(validate);
3196
+ }
3197
+
3198
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
3199
+ return new PropTypeError(
3200
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
3201
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
3202
+ );
3203
+ }
3204
+
3205
+ function createShapeTypeChecker(shapeTypes) {
3206
+ function validate(props, propName, componentName, location, propFullName) {
3207
+ var propValue = props[propName];
3208
+ var propType = getPropType(propValue);
3209
+ if (propType !== 'object') {
3210
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
3211
+ }
3212
+ for (var key in shapeTypes) {
3213
+ var checker = shapeTypes[key];
3214
+ if (typeof checker !== 'function') {
3215
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3216
+ }
3217
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
3218
+ if (error) {
3219
+ return error;
3220
+ }
3221
+ }
3222
+ return null;
3223
+ }
3224
+ return createChainableTypeChecker(validate);
3225
+ }
3226
+
3227
+ function createStrictShapeTypeChecker(shapeTypes) {
3228
+ function validate(props, propName, componentName, location, propFullName) {
3229
+ var propValue = props[propName];
3230
+ var propType = getPropType(propValue);
3231
+ if (propType !== 'object') {
3232
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
3233
+ }
3234
+ // We need to check all keys in case some are required but missing from props.
3235
+ var allKeys = objectAssign({}, props[propName], shapeTypes);
3236
+ for (var key in allKeys) {
3237
+ var checker = shapeTypes[key];
3238
+ if (has$1(shapeTypes, key) && typeof checker !== 'function') {
3239
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3240
+ }
3241
+ if (!checker) {
3242
+ return new PropTypeError(
3243
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
3244
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
3245
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
3246
+ );
3247
+ }
3248
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
3249
+ if (error) {
3250
+ return error;
3251
+ }
3252
+ }
3253
+ return null;
3254
+ }
3255
+
3256
+ return createChainableTypeChecker(validate);
3257
+ }
3258
+
3259
+ function isNode(propValue) {
3260
+ switch (typeof propValue) {
3261
+ case 'number':
3262
+ case 'string':
3263
+ case 'undefined':
3264
+ return true;
3265
+ case 'boolean':
3266
+ return !propValue;
3267
+ case 'object':
3268
+ if (Array.isArray(propValue)) {
3269
+ return propValue.every(isNode);
3270
+ }
3271
+ if (propValue === null || isValidElement(propValue)) {
3272
+ return true;
3273
+ }
3274
+
3275
+ var iteratorFn = getIteratorFn(propValue);
3276
+ if (iteratorFn) {
3277
+ var iterator = iteratorFn.call(propValue);
3278
+ var step;
3279
+ if (iteratorFn !== propValue.entries) {
3280
+ while (!(step = iterator.next()).done) {
3281
+ if (!isNode(step.value)) {
3282
+ return false;
3283
+ }
3284
+ }
3285
+ } else {
3286
+ // Iterator will provide entry [k,v] tuples rather than values.
3287
+ while (!(step = iterator.next()).done) {
3288
+ var entry = step.value;
3289
+ if (entry) {
3290
+ if (!isNode(entry[1])) {
3291
+ return false;
3292
+ }
3293
+ }
3294
+ }
3295
+ }
3296
+ } else {
3297
+ return false;
3298
+ }
3299
+
3300
+ return true;
3301
+ default:
3302
+ return false;
3303
+ }
3304
+ }
3305
+
3306
+ function isSymbol(propType, propValue) {
3307
+ // Native Symbol.
3308
+ if (propType === 'symbol') {
3309
+ return true;
3310
+ }
3311
+
3312
+ // falsy value can't be a Symbol
3313
+ if (!propValue) {
3314
+ return false;
3315
+ }
3316
+
3317
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
3318
+ if (propValue['@@toStringTag'] === 'Symbol') {
3319
+ return true;
3320
+ }
3321
+
3322
+ // Fallback for non-spec compliant Symbols which are polyfilled.
3323
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
3324
+ return true;
3325
+ }
3326
+
3327
+ return false;
3328
+ }
3329
+
3330
+ // Equivalent of `typeof` but with special handling for array and regexp.
3331
+ function getPropType(propValue) {
3332
+ var propType = typeof propValue;
3333
+ if (Array.isArray(propValue)) {
3334
+ return 'array';
3335
+ }
3336
+ if (propValue instanceof RegExp) {
3337
+ // Old webkits (at least until Android 4.0) return 'function' rather than
3338
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
3339
+ // passes PropTypes.object.
3340
+ return 'object';
3341
+ }
3342
+ if (isSymbol(propType, propValue)) {
3343
+ return 'symbol';
3344
+ }
3345
+ return propType;
3346
+ }
3347
+
3348
+ // This handles more types than `getPropType`. Only used for error messages.
3349
+ // See `createPrimitiveTypeChecker`.
3350
+ function getPreciseType(propValue) {
3351
+ if (typeof propValue === 'undefined' || propValue === null) {
3352
+ return '' + propValue;
3353
+ }
3354
+ var propType = getPropType(propValue);
3355
+ if (propType === 'object') {
3356
+ if (propValue instanceof Date) {
3357
+ return 'date';
3358
+ } else if (propValue instanceof RegExp) {
3359
+ return 'regexp';
3360
+ }
3361
+ }
3362
+ return propType;
3363
+ }
3364
+
3365
+ // Returns a string that is postfixed to a warning about an invalid type.
3366
+ // For example, "undefined" or "of type array"
3367
+ function getPostfixForTypeWarning(value) {
3368
+ var type = getPreciseType(value);
3369
+ switch (type) {
3370
+ case 'array':
3371
+ case 'object':
3372
+ return 'an ' + type;
3373
+ case 'boolean':
3374
+ case 'date':
3375
+ case 'regexp':
3376
+ return 'a ' + type;
3377
+ default:
3378
+ return type;
3379
+ }
3380
+ }
3381
+
3382
+ // Returns class name of the object, if any.
3383
+ function getClassName(propValue) {
3384
+ if (!propValue.constructor || !propValue.constructor.name) {
3385
+ return ANONYMOUS;
3386
+ }
3387
+ return propValue.constructor.name;
3388
+ }
3389
+
3390
+ ReactPropTypes.checkPropTypes = checkPropTypes;
3391
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
3392
+ ReactPropTypes.PropTypes = ReactPropTypes;
3393
+
3394
+ return ReactPropTypes;
3395
+ };
3396
+
3397
+ /**
3398
+ * Copyright (c) 2013-present, Facebook, Inc.
3399
+ *
3400
+ * This source code is licensed under the MIT license found in the
3401
+ * LICENSE file in the root directory of this source tree.
3402
+ */
3403
+
3404
+
3405
+
3406
+ function emptyFunction() {}
3407
+ function emptyFunctionWithReset() {}
3408
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
3409
+
3410
+ var factoryWithThrowingShims = function() {
3411
+ function shim(props, propName, componentName, location, propFullName, secret) {
3412
+ if (secret === ReactPropTypesSecret$1) {
3413
+ // It is still safe when called from React.
3414
+ return;
3415
+ }
3416
+ var err = new Error(
3417
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
3418
+ 'Use PropTypes.checkPropTypes() to call them. ' +
3419
+ 'Read more at http://fb.me/use-check-prop-types'
3420
+ );
3421
+ err.name = 'Invariant Violation';
3422
+ throw err;
3423
+ } shim.isRequired = shim;
3424
+ function getShim() {
3425
+ return shim;
3426
+ } // Important!
3427
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
3428
+ var ReactPropTypes = {
3429
+ array: shim,
3430
+ bigint: shim,
3431
+ bool: shim,
3432
+ func: shim,
3433
+ number: shim,
3434
+ object: shim,
3435
+ string: shim,
3436
+ symbol: shim,
3437
+
3438
+ any: shim,
3439
+ arrayOf: getShim,
3440
+ element: shim,
3441
+ elementType: shim,
3442
+ instanceOf: getShim,
3443
+ node: shim,
3444
+ objectOf: getShim,
3445
+ oneOf: getShim,
3446
+ oneOfType: getShim,
3447
+ shape: getShim,
3448
+ exact: getShim,
3449
+
3450
+ checkPropTypes: emptyFunctionWithReset,
3451
+ resetWarningCache: emptyFunction
3452
+ };
3453
+
3454
+ ReactPropTypes.PropTypes = ReactPropTypes;
3455
+
3456
+ return ReactPropTypes;
3457
+ };
3458
+
3459
+ var require$$1 = factoryWithTypeCheckers;
3460
+
3461
+ var require$$2 = factoryWithThrowingShims;
3462
+
3463
+ /**
3464
+ * Copyright (c) 2013-present, Facebook, Inc.
3465
+ *
3466
+ * This source code is licensed under the MIT license found in the
3467
+ * LICENSE file in the root directory of this source tree.
3468
+ */
3469
+
3470
+ var propTypes = createCommonjsModule(function (module) {
3471
+ if (process.env.NODE_ENV !== 'production') {
3472
+ var ReactIs = reactIs;
3473
+
3474
+ // By explicitly using `prop-types` you are opting into new development behavior.
3475
+ // http://fb.me/prop-types-in-prod
3476
+ var throwOnDirectAccess = true;
3477
+ module.exports = require$$1(ReactIs.isElement, throwOnDirectAccess);
3478
+ } else {
3479
+ // By explicitly using `prop-types` you are opting into new production behavior.
3480
+ // http://fb.me/prop-types-in-prod
3481
+ module.exports = require$$2();
3482
+ }
3483
+ });
3484
+
3485
+ var PropTypes = propTypes;
3486
+
3487
+ var _excluded$1 = ["color", "size", "title"];
3488
+
3489
+ function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
3490
+
3491
+ function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$1(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3492
+
3493
+ function _objectWithoutPropertiesLoose$1(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
3494
+ var CaretDownFill = /*#__PURE__*/forwardRef(function (_ref, ref) {
3495
+ var color = _ref.color,
3496
+ size = _ref.size,
3497
+ title = _ref.title,
3498
+ rest = _objectWithoutProperties$1(_ref, _excluded$1);
3499
+
3500
+ return /*#__PURE__*/React__default.createElement("svg", _extends$2({
3501
+ ref: ref,
3502
+ xmlns: "http://www.w3.org/2000/svg",
3503
+ viewBox: "0 0 16 16",
3504
+ width: size,
3505
+ height: size,
3506
+ fill: color
3507
+ }, rest), title ? /*#__PURE__*/React__default.createElement("title", null, title) : null, /*#__PURE__*/React__default.createElement("path", {
3508
+ d: "M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"
3509
+ }));
3510
+ });
3511
+ CaretDownFill.propTypes = {
3512
+ color: PropTypes.string,
3513
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
3514
+ title: PropTypes.string
3515
+ };
3516
+ CaretDownFill.defaultProps = {
3517
+ color: 'currentColor',
3518
+ size: '1em',
3519
+ title: null
3520
+ };
3521
+ var CaretDownFill$1 = CaretDownFill;
3522
+
3523
+ var _excluded = ["color", "size", "title"];
3524
+
3525
+ function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
3526
+
3527
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3528
+
3529
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
3530
+ var CheckCircle = /*#__PURE__*/forwardRef(function (_ref, ref) {
3531
+ var color = _ref.color,
3532
+ size = _ref.size,
3533
+ title = _ref.title,
3534
+ rest = _objectWithoutProperties(_ref, _excluded);
3535
+
3536
+ return /*#__PURE__*/React__default.createElement("svg", _extends$1({
3537
+ ref: ref,
3538
+ xmlns: "http://www.w3.org/2000/svg",
3539
+ viewBox: "0 0 16 16",
3540
+ width: size,
3541
+ height: size,
3542
+ fill: color
3543
+ }, rest), title ? /*#__PURE__*/React__default.createElement("title", null, title) : null, /*#__PURE__*/React__default.createElement("path", {
3544
+ d: "M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"
3545
+ }), /*#__PURE__*/React__default.createElement("path", {
3546
+ d: "M10.97 4.97a.235.235 0 0 0-.02.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05z"
3547
+ }));
3548
+ });
3549
+ CheckCircle.propTypes = {
3550
+ color: PropTypes.string,
3551
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
3552
+ title: PropTypes.string
3553
+ };
3554
+ CheckCircle.defaultProps = {
3555
+ color: 'currentColor',
3556
+ size: '1em',
3557
+ title: null
3558
+ };
3559
+ var CheckCircle$1 = CheckCircle;
3560
+
3561
+ const useLayoutEffect=Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)?React.useLayoutEffect:()=>{};
3562
+
3563
+ const r$3=React["useId".toString()]||(()=>{});let n$4=0;function useId(o){const[u,i]=React.useState(r$3());return useLayoutEffect((()=>{o||i((t=>null!=t?t:String(n$4++)));}),[o]),o||(u?`radix-${u}`:"")}
3564
+
3565
+ let t$3=0;function useFocusGuards(){React.useEffect((()=>{var e,n;const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=r[0])&&void 0!==e?e:o$3()),document.body.insertAdjacentElement("beforeend",null!==(n=r[1])&&void 0!==n?n:o$3()),t$3++,()=>{1===t$3&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),t$3--;}}),[]);}function o$3(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}
3566
+
3567
+ function useCallbackRef$1(r){const t=React.useRef(r);return React.useEffect((()=>{t.current=r;})),React.useMemo((()=>(...e)=>{var r;return null===(r=t.current)||void 0===r?void 0:r.call(t,...e)}),[])}
3568
+
3569
+ function useDirection(t,n){const[r,o]=React.useState("ltr"),[i,u]=React.useState(),c=React.useRef(0);return React.useEffect((()=>{if(void 0===n&&null!=t&&t.parentElement){const e=getComputedStyle(t.parentElement);u(e);}}),[t,n]),React.useEffect((()=>(void 0===n&&function e(){c.current=requestAnimationFrame((()=>{const t=null==i?void 0:i.direction;t&&o(t),e();}));}(),()=>cancelAnimationFrame(c.current))),[i,n,o]),n||r}
3570
+
3571
+ function useControllableState({prop:o,defaultProp:r,onChange:n=(()=>{})}){const[a,u]=function({defaultProp:o,onChange:r}){const n=React.useState(o),[a]=n,u=React.useRef(a),c=useCallbackRef$1(r);return React.useEffect((()=>{u.current!==a&&(c(a),u.current=a);}),[a,u,c]),n}({defaultProp:r,onChange:n}),c=void 0!==o,f=c?o:a,l=useCallbackRef$1(n);return [f,React.useCallback((e=>{if(c){const t=e,r="function"==typeof e?t(o):e;r!==o&&l(r);}else u(e);}),[c,o,u,l])]}
3572
+
3573
+ function composeRefs(...o){return e=>o.forEach((o=>function(o,e){"function"==typeof o?o(e):null!=o&&(o.current=e);}(o,e)))}function useComposedRefs(...e){return React.useCallback(composeRefs(...e),e)}
3574
+
3575
+ function _extends() {
3576
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
3577
+ for (var i = 1; i < arguments.length; i++) {
3578
+ var source = arguments[i];
3579
+
3580
+ for (var key in source) {
3581
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3582
+ target[key] = source[key];
3583
+ }
3584
+ }
3585
+ }
3586
+
3587
+ return target;
3588
+ };
3589
+ return _extends.apply(this, arguments);
3590
+ }
3591
+
3592
+ const Slot=/*#__PURE__*/React.forwardRef(((e,o)=>{const{children:a,...s}=e;return React.Children.toArray(a).some(l$3)?/*#__PURE__*/React.createElement(React.Fragment,null,React.Children.map(a,(e=>l$3(e)?/*#__PURE__*/React.createElement(n$3,_extends({},s,{ref:o}),e.props.children):e))):/*#__PURE__*/React.createElement(n$3,_extends({},s,{ref:o}),a)}));Slot.displayName="Slot";const n$3=/*#__PURE__*/React.forwardRef(((r,n)=>{const{children:l,...a}=r;return React.isValidElement(l)?/*#__PURE__*/React.cloneElement(l,{...o$2(a,l.props),ref:composeRefs(n,l.ref)}):React.Children.count(l)>1?React.Children.only(null):null}));n$3.displayName="SlotClone";const Slottable=({children:e})=>/*#__PURE__*/React.createElement(React.Fragment,null,e);function l$3(e){return React.isValidElement(e)&&e.type===Slottable}function o$2(e,t){const r={...t};for(const n in t){const l=e[n],o=t[n];/^on[A-Z]/.test(n)?r[n]=(...e)=>{null==o||o(...e),null==l||l(...e);}:"style"===n?r[n]={...l,...o}:"className"===n&&(r[n]=[l,o].filter(Boolean).join(" "));}return {...e,...r}}
3593
+
3594
+ const Primitive=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"].reduce(((o,i)=>({...o,[i]:/*#__PURE__*/React.forwardRef(((o,m)=>{const{asChild:a,...s}=o,n=a?Slot:i;return React.useEffect((()=>{window[Symbol.for("radix-ui")]=!0;}),[]),/*#__PURE__*/React.createElement(n,_extends({},s,{ref:m}))}))})),{});
3595
+
3596
+ function createContextScope(n,o=[]){let r=[];const c=()=>{const t=r.map((t=>/*#__PURE__*/React.createContext(t)));return function(o){const r=(null==o?void 0:o[n])||t;return React.useMemo((()=>({[`__scope${n}`]:{...o,[n]:r}})),[o,r])}};return c.scopeName=n,[function(t,o){const c=/*#__PURE__*/React.createContext(o),u=r.length;function s(t){const{scope:o,children:r,...s}=t,i=(null==o?void 0:o[n][u])||c,a=React.useMemo((()=>s),Object.values(s));return React.createElement(i.Provider,{value:a},r)}return r=[...r,o],s.displayName=t+"Provider",[s,function(r,s){const i=(null==s?void 0:s[n][u])||c,a=React.useContext(i);if(a)return a;if(void 0!==o)return o;throw new Error(`\`${r}\` must be used within \`${t}\``)}]},t$2(c,...o)]}function t$2(...t){const n=t[0];if(1===t.length)return n;const o=()=>{const o=t.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(t){const r=o.reduce(((e,{useScope:n,scopeName:o})=>({...e,...n(t)[`__scope${o}`]})),{});return React.useMemo((()=>({[`__scope${n.scopeName}`]:r})),[r])}};return o.scopeName=n.scopeName,o}
3597
+
3598
+ function createCollection(c){const n=c+"CollectionProvider",[l,i]=createContextScope(n),[f,a]=l(n,{collectionRef:{current:null},itemMap:new Map}),u=e=>{const{scope:r,children:t}=e,c=React__default.useRef(null),n=React__default.useRef(new Map).current;return React__default.createElement(f,{scope:r,itemMap:n,collectionRef:c},t)},m=c+"CollectionSlot",s=/*#__PURE__*/React__default.forwardRef(((t,c)=>{const{scope:n,children:l}=t,i=a(m,n),f=useComposedRefs(c,i.collectionRef);return React__default.createElement(Slot,{ref:f},l)})),p=c+"CollectionItemSlot",d="data-radix-collection-item",R=/*#__PURE__*/React__default.forwardRef(((t,c)=>{const{scope:n,children:l,...i}=t,f=React__default.useRef(null),u=useComposedRefs(c,f),m=a(p,n);return React__default.useEffect((()=>(m.itemMap.set(f,{ref:f,...i}),()=>{m.itemMap.delete(f);}))),/*#__PURE__*/React__default.createElement(Slot,{[d]:"",ref:u},l)}));return [{Provider:u,Slot:s,ItemSlot:R},function(e){const r=a(c+"CollectionConsumer",e);return React__default.useCallback((()=>{const e=r.collectionRef.current;if(!e)return [];const t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(r.itemMap.values()).sort(((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current)))}),[r.collectionRef,r.itemMap])},i]}
3599
+
3600
+ function composeEventHandlers(e,n,{checkForDefaultPrevented:t=!0}={}){return function(r){if(null==e||e(r),!1===t||!r.defaultPrevented)return null==n?void 0:n(r)}}
3601
+
3602
+ const f$3={bubbles:!1,cancelable:!0},[p$1,l$2,m$2]=createCollection("RovingFocusGroup"),[d$3,v]=createContextScope("RovingFocusGroup",[m$2]);const[g$1,F$1]=d$3("RovingFocusGroup");const RovingFocusGroup=/*#__PURE__*/React.forwardRef(((e,o)=>/*#__PURE__*/React.createElement(p$1.Provider,{scope:e.__scopeRovingFocusGroup},/*#__PURE__*/React.createElement(p$1.Slot,{scope:e.__scopeRovingFocusGroup},/*#__PURE__*/React.createElement(w$1,_extends({},e,{ref:o}))))));const w$1=/*#__PURE__*/React.forwardRef(((t,n)=>{const{__scopeRovingFocusGroup:c,orientation:p,dir:m="ltr",loop:d=!1,currentTabStopId:v,defaultCurrentTabStopId:F,onCurrentTabStopIdChange:w,onEntryFocus:b,...x}=t,E=React.useRef(null),I=useComposedRefs(n,E),[G=null,h]=useControllableState({prop:v,defaultProp:F,onChange:w}),[T,A]=React.useState(!1),y=useCallbackRef$1(b),D=l$2(c),S=React.useRef(!1);return React.useEffect((()=>{const e=E.current;if(e)return e.addEventListener("rovingFocusGroup.onEntryFocus",y),()=>e.removeEventListener("rovingFocusGroup.onEntryFocus",y)}),[y]),/*#__PURE__*/React.createElement(g$1,{scope:c,orientation:p,dir:m,loop:d,currentTabStopId:G,onItemFocus:React.useCallback((e=>h(e)),[h]),onItemShiftTab:React.useCallback((()=>A(!0)),[])},/*#__PURE__*/React.createElement(Primitive.div,_extends({tabIndex:T?-1:0,"data-orientation":p},x,{ref:I,style:{outline:"none",...t.style},onMouseDown:composeEventHandlers(t.onMouseDown,(()=>{S.current=!0;})),onFocus:composeEventHandlers(t.onFocus,(e=>{const o=!S.current;if(e.target===e.currentTarget&&o&&!T){const o=new Event("rovingFocusGroup.onEntryFocus",f$3);if(e.currentTarget.dispatchEvent(o),!o.defaultPrevented){const e=D().filter((e=>e.focusable));R$1([e.find((e=>e.active)),e.find((e=>e.id===G)),...e].filter(Boolean).map((e=>e.ref.current)));}}S.current=!1;})),onBlur:composeEventHandlers(t.onBlur,(()=>A(!1)))})))}));const RovingFocusGroupItem=/*#__PURE__*/React.forwardRef(((e,o)=>{const{__scopeRovingFocusGroup:n,focusable:i=!0,active:c=!1,...f}=e,m=useId(),d=F$1("RovingFocusGroupItem",n),v=d.currentTabStopId===m,g=l$2(n);return React.createElement(p$1.ItemSlot,{scope:n,id:m,focusable:i,active:c},/*#__PURE__*/React.createElement(Primitive.span,_extends({tabIndex:v?0:-1,"data-orientation":d.orientation},f,{ref:o,onMouseDown:composeEventHandlers(e.onMouseDown,(e=>{i?d.onItemFocus(m):e.preventDefault();})),onFocus:composeEventHandlers(e.onFocus,(()=>d.onItemFocus(m))),onKeyDown:composeEventHandlers(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void d.onItemShiftTab();if(e.target!==e.currentTarget)return;const o=function(e,o,r){const t=function(e,o){return "rtl"!==o?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return "vertical"===o&&["ArrowLeft","ArrowRight"].includes(t)||"horizontal"===o&&["ArrowUp","ArrowDown"].includes(t)?void 0:b$1[t]}(e,d.orientation,d.dir);if(void 0!==o){e.preventDefault();let n=g().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===o)n.reverse();else if("prev"===o||"next"===o){"prev"===o&&n.reverse();const i=n.indexOf(e.currentTarget);n=d.loop?(t=i+1,(r=n).map(((e,o)=>r[(t+o)%r.length]))):n.slice(i+1);}setTimeout((()=>R$1(n)));}var r,t;}))})))}));const b$1={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function R$1(e){const o=document.activeElement;for(const r of e){if(r===o)return;if(r.focus(),document.activeElement!==o)return}}const Root$5=RovingFocusGroup;const Item$2=RovingFocusGroupItem;
3603
+
3604
+ const Portal=/*#__PURE__*/React.forwardRef(((a,i)=>{var n,d;const{containerRef:s,style:u,...c}=a,m=null!==(n=null==s?void 0:s.current)&&void 0!==n?n:null===globalThis||void 0===globalThis||null===(d=globalThis.document)||void 0===d?void 0:d.body,[,f]=React.useState({});return useLayoutEffect((()=>{f({});}),[]),m?/*#__PURE__*/e$4.createPortal(/*#__PURE__*/React.createElement(Primitive.div,_extends({"data-radix-portal":""},c,{ref:i,style:m===document.body?{position:"absolute",top:0,left:0,zIndex:2147483647,...u}:void 0})),m):null}));
3605
+
3606
+ const Arrow$3=/*#__PURE__*/React.forwardRef(((o,i)=>{const{children:n,width:s=10,height:m=5,...p}=o;return React.createElement(Primitive.svg,_extends({},p,{ref:i,width:s,height:m,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),o.asChild?n:/*#__PURE__*/React.createElement("polygon",{points:"0,0 30,0 15,10"}))}));const Root$4=Arrow$3;
3607
+
3608
+ function useSize(r){const[i,t]=React.useState(void 0);return React.useEffect((()=>{if(r){const e=new ResizeObserver((e=>{if(!Array.isArray(e))return;if(!e.length)return;const i=e[0];let o,n;if("borderBoxSize"in i){const e=i.borderBoxSize,r=Array.isArray(e)?e[0]:e;o=r.inlineSize,n=r.blockSize;}else {const e=r.getBoundingClientRect();o=e.width,n=e.height;}t({width:o,height:n});}));return e.observe(r,{box:"border-box"}),()=>e.unobserve(r)}t(void 0);}),[r]),i}
3609
+
3610
+ function observeElementRect(n,o){const i=e$2.get(n);return void 0===i?(e$2.set(n,{rect:{},callbacks:[o]}),1===e$2.size&&(t$1=requestAnimationFrame(c$3))):(i.callbacks.push(o),o(n.getBoundingClientRect())),()=>{const c=e$2.get(n);if(void 0===c)return;const i=c.callbacks.indexOf(o);i>-1&&c.callbacks.splice(i,1),0===c.callbacks.length&&(e$2.delete(n),0===e$2.size&&cancelAnimationFrame(t$1));}}let t$1;const e$2=new Map;function c$3(){const n=[];e$2.forEach(((t,e)=>{const c=e.getBoundingClientRect();var o,i;o=t.rect,i=c,(o.width!==i.width||o.height!==i.height||o.top!==i.top||o.right!==i.right||o.bottom!==i.bottom||o.left!==i.left)&&(t.rect=c,n.push(t));})),n.forEach((t=>{t.callbacks.forEach((e=>e(t.rect)));})),t$1=requestAnimationFrame(c$3);}
3611
+
3612
+ function useRect(e){const[o,c]=React.useState();return React.useEffect((()=>{if(e){const r=observeElementRect(e,c);return ()=>{c(void 0),r();}}}),[e]),o}
3613
+
3614
+ function getPlacementData({anchorRect:p,popperSize:c,arrowSize:f,arrowOffset:l=0,side:d,sideOffset:h=0,align:x,alignOffset:g=0,shouldAvoidCollisions:u=!0,collisionBoundariesRect:w,collisionTolerance:m=0}){if(!p||!c||!w)return {popperStyles:o$1,arrowStyles:n$2};const y=function(e,r,o=0,n=0,i){const p=i?i.height:0,a=t(r,e,"x"),s=t(r,e,"y"),c=s.before-o-p,f=s.after+o+p,l=a.before-o-p,d=a.after+o+p;return {top:{start:{x:a.start+n,y:c},center:{x:a.center,y:c},end:{x:a.end-n,y:c}},right:{start:{x:d,y:s.start+n},center:{x:d,y:s.center},end:{x:d,y:s.end-n}},bottom:{start:{x:a.start+n,y:f},center:{x:a.center,y:f},end:{x:a.end-n,y:f}},left:{start:{x:l,y:s.start+n},center:{x:l,y:s.center},end:{x:l,y:s.end-n}}}}(c,p,h,g,f),b=y[d][x];if(!1===u){const t=e$1(b);let o=n$2;f&&(o=i$3({popperSize:c,arrowSize:f,arrowOffset:l,side:d,align:x}));return {popperStyles:{...t,"--radix-popper-transform-origin":r$2(c,d,x,l,f)},arrowStyles:o,placedSide:d,placedAlign:x}}const S=DOMRect.fromRect({...c,...b}),$=(O=w,z=m,DOMRect.fromRect({width:O.width-2*z,height:O.height-2*z,x:O.left+z,y:O.top+z}));var O,z;const R=s$2(S,$),M=y[a$1(d)][x],D=function(t,e,r){const o=a$1(t);return e[t]&&!r[o]?o:t}(d,R,s$2(DOMRect.fromRect({...c,...M}),$)),A=function(t,e,r,o,n){const i="top"===r||"bottom"===r,p=i?"left":"top",a=i?"right":"bottom",s=i?"width":"height",c=e[s]>t[s];if(("start"===o||"center"===o)&&(n[p]&&c||n[a]&&!c))return "end";if(("end"===o||"center"===o)&&(n[a]&&c||n[p]&&!c))return "start";return o}(c,p,d,x,R),I=e$1(y[D][A]);let C=n$2;f&&(C=i$3({popperSize:c,arrowSize:f,arrowOffset:l,side:D,align:A}));return {popperStyles:{...I,"--radix-popper-transform-origin":r$2(c,D,A,l,f)},arrowStyles:C,placedSide:D,placedAlign:A}}function t(t,e,r){const o=t["x"===r?"left":"top"],n="x"===r?"width":"height",i=t[n],p=e[n];return {before:o-p,start:o,center:o+(i-p)/2,end:o+i-p,after:o+i}}function e$1(t){return {position:"absolute",top:0,left:0,minWidth:"max-content",willChange:"transform",transform:`translate3d(${Math.round(t.x+window.scrollX)}px, ${Math.round(t.y+window.scrollY)}px, 0)`}}function r$2(t,e,r,o,n){const i="top"===e||"bottom"===e,p=n?n.width:0,a=n?n.height:0,s=p/2+o;let c="",f="";return i?(c={start:`${s}px`,center:"center",end:t.width-s+"px"}[r],f="top"===e?`${t.height+a}px`:-a+"px"):(c="left"===e?`${t.width+a}px`:-a+"px",f={start:`${s}px`,center:"center",end:t.height-s+"px"}[r]),`${c} ${f}`}const o$1={position:"fixed",top:0,left:0,opacity:0,transform:"translate3d(0, -200%, 0)"},n$2={position:"absolute",opacity:0};function i$3({popperSize:t,arrowSize:e,arrowOffset:r,side:o,align:n}){const i=(t.width-e.width)/2,a=(t.height-e.width)/2,s={top:0,right:90,bottom:180,left:-90}[o],c=Math.max(e.width,e.height),f={width:`${c}px`,height:`${c}px`,transform:`rotate(${s}deg)`,willChange:"transform",position:"absolute",[o]:"100%",direction:p(o,n)};return "top"!==o&&"bottom"!==o||("start"===n&&(f.left=`${r}px`),"center"===n&&(f.left=`${i}px`),"end"===n&&(f.right=`${r}px`)),"left"!==o&&"right"!==o||("start"===n&&(f.top=`${r}px`),"center"===n&&(f.top=`${a}px`),"end"===n&&(f.bottom=`${r}px`)),f}function p(t,e){return ("top"!==t&&"right"!==t||"end"!==e)&&("bottom"!==t&&"left"!==t||"end"===e)?"ltr":"rtl"}function a$1(t){return {top:"bottom",right:"left",bottom:"top",left:"right"}[t]}function s$2(t,e){return {top:t.top<e.top,right:t.right>e.right,bottom:t.bottom>e.bottom,left:t.left<e.left}}
3615
+
3616
+ const[c$2,l$1]=createContextScope("Popper");const[f$2,d$2]=c$2("Popper");const Popper=e=>{const{__scopePopper:o,children:r}=e,[t,n]=React.useState(null);return React.createElement(f$2,{scope:o,anchor:t,onAnchorChange:n},r)};const PopperAnchor=/*#__PURE__*/React.forwardRef(((e,r)=>{const{__scopePopper:t,virtualRef:n,...p}=e,c=d$2("PopperAnchor",t),l=React.useRef(null),f=useComposedRefs(r,l);return React.useEffect((()=>{c.onAnchorChange((null==n?void 0:n.current)||l.current);})),n?null:/*#__PURE__*/React.createElement(Primitive.div,_extends({},p,{ref:f}))}));const[u$1,m$1]=c$2("PopperContent");const PopperContent=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopePopper:c,side:l="bottom",sideOffset:f,align:m="center",alignOffset:w,collisionTolerance:h,avoidCollisions:x=!0,...v}=e,P=d$2("PopperContent",c),[A,g]=React.useState(),E=useRect(P.anchor),[y,C]=React.useState(null),S=useSize(y),[R,O]=React.useState(null),_=useSize(R),b=useComposedRefs(n,(e=>C(e))),z=function(){const[e,o]=React.useState(void 0);return React.useEffect((()=>{let e;function r(){o({width:window.innerWidth,height:window.innerHeight});}function t(){window.clearTimeout(e),e=window.setTimeout(r,100);}return r(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}),[]),e}(),T=z?DOMRect.fromRect({...z,x:0,y:0}):void 0,{popperStyles:k,arrowStyles:L,placedSide:B,placedAlign:D}=getPlacementData({anchorRect:E,popperSize:S,arrowSize:_,arrowOffset:A,side:l,sideOffset:f,align:m,alignOffset:w,shouldAvoidCollisions:x,collisionBoundariesRect:T,collisionTolerance:h}),H=void 0!==B;return React.createElement("div",{style:k,"data-radix-popper-content-wrapper":""},/*#__PURE__*/React.createElement(u$1,{scope:c,arrowStyles:L,onArrowChange:O,onArrowOffsetChange:g},/*#__PURE__*/React.createElement(Primitive.div,_extends({"data-side":B,"data-align":D},v,{style:{...v.style,animation:H?void 0:"none"},ref:b}))))}));const PopperArrow=/*#__PURE__*/React.forwardRef((function(o,r){const{__scopePopper:t,offset:n,...i}=o,p=m$1("PopperArrow",t),{onArrowOffsetChange:c}=p;return React.useEffect((()=>c(n)),[c,n]),/*#__PURE__*/React.createElement("span",{style:{...p.arrowStyles,pointerEvents:"none"}},/*#__PURE__*/React.createElement("span",{ref:p.onArrowChange,style:{display:"inline-block",verticalAlign:"top",pointerEvents:"auto"}},/*#__PURE__*/React.createElement(Root$4,_extends({},i,{ref:r,style:{...i.style,display:"block"}}))))}));const Root$3=Popper;const Anchor$1=PopperAnchor;const Content$2=PopperContent;const Arrow$2=PopperArrow;
3617
+
3618
+ const Presence=u=>{const{present:o,children:i}=u,s=function(n){const[u,o]=React.useState(),i=React.useRef({}),s=React.useRef(n),c=React.useRef("none"),a=n?"mounted":"unmounted",[d,m]=function(e,n){return React.useReducer(((e,t)=>{const r=n[e][t];return null!=r?r:e}),e)}(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return React.useEffect((()=>{const e=r$1(i.current);c.current="mounted"===d?e:"none";}),[d]),useLayoutEffect((()=>{const e=i.current,t=s.current;if(t!==n){const u=c.current,o=r$1(e);if(n)m("MOUNT");else if("none"===o||"none"===(null==e?void 0:e.display))m("UNMOUNT");else {const e=u!==o;m(t&&e?"ANIMATION_OUT":"UNMOUNT");}s.current=n;}}),[n,m]),useLayoutEffect((()=>{if(u){const e=e=>{const n=r$1(i.current).includes(e.animationName);e.target===u&&n&&m("ANIMATION_END");},n=e=>{e.target===u&&(c.current=r$1(i.current));};return u.addEventListener("animationstart",n),u.addEventListener("animationcancel",e),u.addEventListener("animationend",e),()=>{u.removeEventListener("animationstart",n),u.removeEventListener("animationcancel",e),u.removeEventListener("animationend",e);}}m("ANIMATION_END");}),[u,m]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:React.useCallback((e=>{e&&(i.current=getComputedStyle(e)),o(e);}),[])}}(o),c="function"==typeof i?i({present:s.isPresent}):React.Children.only(i),a=useComposedRefs(s.ref,c.ref);return "function"==typeof i||s.isPresent?/*#__PURE__*/React.cloneElement(c,{ref:a}):null};function r$1(e){return (null==e?void 0:e.animationName)||"none"}Presence.displayName="Presence";
3619
+
3620
+ const c$1={bubbles:!1,cancelable:!0};const FocusScope=/*#__PURE__*/React.forwardRef(((i,f)=>{const{loop:l=!1,trapped:m=!1,onMountAutoFocus:p,onUnmountAutoFocus:v,...E}=i,[F,S]=React.useState(null),b=useCallbackRef$1(p),T=useCallbackRef$1(v),y=React.useRef(null),L=useComposedRefs(f,(e=>S(e))),h=React.useRef({paused:!1,pause(){this.paused=!0;},resume(){this.paused=!1;}}).current;React.useEffect((()=>{if(m){function e(e){if(h.paused||!F)return;const t=e.target;F.contains(t)?y.current=t:a(y.current,{select:!0});}function t(e){!h.paused&&F&&(F.contains(e.relatedTarget)||a(y.current,{select:!0}));}return document.addEventListener("focusin",e),document.addEventListener("focusout",t),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t);}}}),[m,F,h.paused]),React.useEffect((()=>{if(F){d$1.add(h);const t=document.activeElement;if(!F.contains(t)){const n=new Event("focusScope.autoFocusOnMount",c$1);F.addEventListener("focusScope.autoFocusOnMount",b),F.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(a(o,{select:t}),document.activeElement!==n)return}((e=r(F),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&a(F));}return ()=>{F.removeEventListener("focusScope.autoFocusOnMount",b),setTimeout((()=>{const e=new Event("focusScope.autoFocusOnUnmount",c$1);F.addEventListener("focusScope.autoFocusOnUnmount",T),F.dispatchEvent(e),e.defaultPrevented||a(null!=t?t:document.body,{select:!0}),F.removeEventListener("focusScope.autoFocusOnUnmount",T),d$1.remove(h);}),0);}}var e;}),[F,b,T,h]);const N=React.useCallback((e=>{if(!l&&!m)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[o,u]=function(e){const t=r(e),n=s$1(t,e),o=s$1(t.reverse(),e);return [n,o]}(t);o&&u?e.shiftKey||n!==u?e.shiftKey&&n===o&&(e.preventDefault(),l&&a(u,{select:!0})):(e.preventDefault(),l&&a(o,{select:!0})):n===t&&e.preventDefault();}}),[l,m,h.paused]);return React.createElement(Primitive.div,_extends({tabIndex:-1},E,{ref:L,onKeyDown:N}))}));function r(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function s$1(e,t){for(const n of e)if(!i$2(n,{upTo:t}))return n}function i$2(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return !0;for(;e;){if(void 0!==t&&e===t)return !1;if("none"===getComputedStyle(e).display)return !0;e=e.parentElement;}return !1}function a(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select();}}const d$1=function(){let e=[];return {add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=f$1(e,t),e.unshift(t);},remove(t){var n;e=f$1(e,t),null===(n=e[0])||void 0===n||n.resume();}}}();function f$1(e,t){const n=[...e],o=n.indexOf(t);return -1!==o&&n.splice(o,1),n}
3621
+
3622
+ function useEscapeKeydown(n){const o=useCallbackRef$1(n);React.useEffect((()=>{const e=e=>{"Escape"===e.key&&o(e);};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[o]);}
3623
+
3624
+ let n$1,o=0;function useBodyPointerEvents({disabled:r}){const i=React.useRef(!1);useLayoutEffect((()=>{if(r){function e(){o--,0===o&&(document.body.style.pointerEvents=n$1);}function t(e){i.current="mouse"!==e.pointerType;}return 0===o&&(n$1=document.body.style.pointerEvents),document.body.style.pointerEvents="none",o++,document.addEventListener("pointerup",t),()=>{i.current?document.addEventListener("click",e,{once:!0}):e(),document.removeEventListener("pointerup",t);}}}),[r]);}
3625
+
3626
+ const u=/*#__PURE__*/React.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set});const DismissableLayer=/*#__PURE__*/React.forwardRef(((l,m)=>{const{disableOutsidePointerEvents:f=!1,onEscapeKeyDown:p,onPointerDownOutside:v,onFocusOutside:b,onInteractOutside:E,onDismiss:y,...w}=l,h=React.useContext(u),[D,x]=React.useState(null),[,C]=React.useState({}),L=useComposedRefs(m,(e=>x(e))),P=Array.from(h.layers),[O]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),g=P.indexOf(O),B=D?P.indexOf(D):-1,R=h.layersWithOutsidePointerEventsDisabled.size>0,F=B>=g,S=function(e){const n=useCallbackRef$1(e),r=React.useRef(!1);return React.useEffect((()=>{const e=e=>{if(e.target&&!r.current){d("dismissableLayer.pointerDownOutside",n,{originalEvent:e});}r.current=!1;},t=window.setTimeout((()=>{document.addEventListener("pointerdown",e);}),0);return ()=>{window.clearTimeout(t),document.removeEventListener("pointerdown",e);}}),[n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...h.branches].some((e=>e.contains(t)));F&&!n&&(null==v||v(e),null==E||E(e),e.defaultPrevented||null==y||y());})),W=function(e){const n=useCallbackRef$1(e),r=React.useRef(!1);return React.useEffect((()=>{const e=e=>{if(e.target&&!r.current){d("dismissableLayer.focusOutside",n,{originalEvent:e});}};return document.addEventListener("focusin",e),()=>document.removeEventListener("focusin",e)}),[n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...h.branches].some((e=>e.contains(t)))||(null==b||b(e),null==E||E(e),e.defaultPrevented||null==y||y());}));return useEscapeKeydown((e=>{B===h.layers.size-1&&(null==p||p(e),e.defaultPrevented||null==y||y());})),useBodyPointerEvents({disabled:f}),React.useEffect((()=>{D&&(f&&h.layersWithOutsidePointerEventsDisabled.add(D),h.layers.add(D),c());}),[D,f,h]),React.useEffect((()=>()=>{D&&(h.layers.delete(D),h.layersWithOutsidePointerEventsDisabled.delete(D),c());}),[D,h]),React.useEffect((()=>{const e=()=>C({});return document.addEventListener("dismissableLayer.update",e),()=>document.removeEventListener("dismissableLayer.update",e)}),[]),/*#__PURE__*/React.createElement(Primitive.div,_extends({},w,{ref:L,style:{pointerEvents:R?F?"auto":"none":void 0,...l.style},onFocusCapture:composeEventHandlers(l.onFocusCapture,W.onFocusCapture),onBlurCapture:composeEventHandlers(l.onBlurCapture,W.onBlurCapture),onPointerDownCapture:composeEventHandlers(l.onPointerDownCapture,S.onPointerDownCapture)}))}));function c(){const e=new Event("dismissableLayer.update");document.dispatchEvent(e);}function d(e,t,n){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});return t&&r.addEventListener(e,t,{once:!0}),!r.dispatchEvent(s)}
3627
+
3628
+ var getDefaultParent = function (originalTarget) {
3629
+ if (typeof document === 'undefined') {
3630
+ return null;
3631
+ }
3632
+ var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
3633
+ return sampleTarget.ownerDocument.body;
3634
+ };
3635
+ var counterMap = new WeakMap();
3636
+ var uncontrolledNodes = new WeakMap();
3637
+ var markerMap = {};
3638
+ var lockCount = 0;
3639
+ var hideOthers = function (originalTarget, parentNode, markerName) {
3640
+ if (parentNode === void 0) { parentNode = getDefaultParent(originalTarget); }
3641
+ if (markerName === void 0) { markerName = "data-aria-hidden"; }
3642
+ var targets = Array.isArray(originalTarget) ? originalTarget : [originalTarget];
3643
+ if (!markerMap[markerName]) {
3644
+ markerMap[markerName] = new WeakMap();
3645
+ }
3646
+ var markerCounter = markerMap[markerName];
3647
+ var hiddenNodes = [];
3648
+ var elementsToKeep = new Set();
3649
+ var keep = (function (el) {
3650
+ if (!el || elementsToKeep.has(el)) {
3651
+ return;
3652
+ }
3653
+ elementsToKeep.add(el);
3654
+ keep(el.parentNode);
3655
+ });
3656
+ targets.forEach(keep);
3657
+ var deep = function (parent) {
3658
+ if (!parent || targets.indexOf(parent) >= 0) {
3659
+ return;
3660
+ }
3661
+ Array.prototype.forEach.call(parent.children, function (node) {
3662
+ if (elementsToKeep.has(node)) {
3663
+ deep(node);
3664
+ }
3665
+ else {
3666
+ var attr = node.getAttribute('aria-hidden');
3667
+ var alreadyHidden = attr !== null && attr !== 'false';
3668
+ var counterValue = (counterMap.get(node) || 0) + 1;
3669
+ var markerValue = (markerCounter.get(node) || 0) + 1;
3670
+ counterMap.set(node, counterValue);
3671
+ markerCounter.set(node, markerValue);
3672
+ hiddenNodes.push(node);
3673
+ if (counterValue === 1 && alreadyHidden) {
3674
+ uncontrolledNodes.set(node, true);
3675
+ }
3676
+ if (markerValue === 1) {
3677
+ node.setAttribute(markerName, 'true');
3678
+ }
3679
+ if (!alreadyHidden) {
3680
+ node.setAttribute('aria-hidden', 'true');
3681
+ }
3682
+ }
3683
+ });
3684
+ };
3685
+ deep(parentNode);
3686
+ elementsToKeep.clear();
3687
+ lockCount++;
3688
+ return function () {
3689
+ hiddenNodes.forEach(function (node) {
3690
+ var counterValue = counterMap.get(node) - 1;
3691
+ var markerValue = markerCounter.get(node) - 1;
3692
+ counterMap.set(node, counterValue);
3693
+ markerCounter.set(node, markerValue);
3694
+ if (!counterValue) {
3695
+ if (!uncontrolledNodes.has(node)) {
3696
+ node.removeAttribute('aria-hidden');
3697
+ }
3698
+ uncontrolledNodes.delete(node);
3699
+ }
3700
+ if (!markerValue) {
3701
+ node.removeAttribute(markerName);
3702
+ }
3703
+ });
3704
+ lockCount--;
3705
+ if (!lockCount) {
3706
+ counterMap = new WeakMap();
3707
+ counterMap = new WeakMap();
3708
+ uncontrolledNodes = new WeakMap();
3709
+ markerMap = {};
3710
+ }
3711
+ };
3712
+ };
3713
+
3714
+ var zeroRightClassName = 'right-scroll-bar-position';
3715
+ var fullWidthClassName = 'width-before-scroll-bar';
3716
+ var noScrollbarsClassName = 'with-scroll-bars-hidden';
3717
+ /**
3718
+ * Name of a CSS variable containing the amount of "hidden" scrollbar
3719
+ * ! might be undefined ! use will fallback!
3720
+ */
3721
+ var removedBarSizeVariable = '--removed-body-scroll-bar-size';
3722
+
3723
+ /**
3724
+ * Assigns a value for a given ref, no matter of the ref format
3725
+ * @param {RefObject} ref - a callback function or ref object
3726
+ * @param value - a new value
3727
+ *
3728
+ * @see https://github.com/theKashey/use-callback-ref#assignref
3729
+ * @example
3730
+ * const refObject = useRef();
3731
+ * const refFn = (ref) => {....}
3732
+ *
3733
+ * assignRef(refObject, "refValue");
3734
+ * assignRef(refFn, "refValue");
3735
+ */
3736
+ function assignRef(ref, value) {
3737
+ if (typeof ref === 'function') {
3738
+ ref(value);
3739
+ }
3740
+ else if (ref) {
3741
+ ref.current = value;
3742
+ }
3743
+ return ref;
3744
+ }
3745
+
3746
+ /**
3747
+ * creates a MutableRef with ref change callback
3748
+ * @param initialValue - initial ref value
3749
+ * @param {Function} callback - a callback to run when value changes
3750
+ *
3751
+ * @example
3752
+ * const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);
3753
+ * ref.current = 1;
3754
+ * // prints 0 -> 1
3755
+ *
3756
+ * @see https://reactjs.org/docs/hooks-reference.html#useref
3757
+ * @see https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref
3758
+ * @returns {MutableRefObject}
3759
+ */
3760
+ function useCallbackRef(initialValue, callback) {
3761
+ var ref = useState(function () { return ({
3762
+ // value
3763
+ value: initialValue,
3764
+ // last callback
3765
+ callback: callback,
3766
+ // "memoized" public interface
3767
+ facade: {
3768
+ get current() {
3769
+ return ref.value;
3770
+ },
3771
+ set current(value) {
3772
+ var last = ref.value;
3773
+ if (last !== value) {
3774
+ ref.value = value;
3775
+ ref.callback(value, last);
3776
+ }
3777
+ },
3778
+ },
3779
+ }); })[0];
3780
+ // update callback
3781
+ ref.callback = callback;
3782
+ return ref.facade;
3783
+ }
3784
+
3785
+ /**
3786
+ * Merges two or more refs together providing a single interface to set their value
3787
+ * @param {RefObject|Ref} refs
3788
+ * @returns {MutableRefObject} - a new ref, which translates all changes to {refs}
3789
+ *
3790
+ * @see {@link mergeRefs} a version without buit-in memoization
3791
+ * @see https://github.com/theKashey/use-callback-ref#usemergerefs
3792
+ * @example
3793
+ * const Component = React.forwardRef((props, ref) => {
3794
+ * const ownRef = useRef();
3795
+ * const domRef = useMergeRefs([ref, ownRef]); // 👈 merge together
3796
+ * return <div ref={domRef}>...</div>
3797
+ * }
3798
+ */
3799
+ function useMergeRefs(refs, defaultValue) {
3800
+ return useCallbackRef(defaultValue || null, function (newValue) { return refs.forEach(function (ref) { return assignRef(ref, newValue); }); });
3801
+ }
3802
+
3803
+ function ItoI(a) {
3804
+ return a;
3805
+ }
3806
+ function innerCreateMedium(defaults, middleware) {
3807
+ if (middleware === void 0) { middleware = ItoI; }
3808
+ var buffer = [];
3809
+ var assigned = false;
3810
+ var medium = {
3811
+ read: function () {
3812
+ if (assigned) {
3813
+ throw new Error('Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.');
3814
+ }
3815
+ if (buffer.length) {
3816
+ return buffer[buffer.length - 1];
3817
+ }
3818
+ return defaults;
3819
+ },
3820
+ useMedium: function (data) {
3821
+ var item = middleware(data, assigned);
3822
+ buffer.push(item);
3823
+ return function () {
3824
+ buffer = buffer.filter(function (x) { return x !== item; });
3825
+ };
3826
+ },
3827
+ assignSyncMedium: function (cb) {
3828
+ assigned = true;
3829
+ while (buffer.length) {
3830
+ var cbs = buffer;
3831
+ buffer = [];
3832
+ cbs.forEach(cb);
3833
+ }
3834
+ buffer = {
3835
+ push: function (x) { return cb(x); },
3836
+ filter: function () { return buffer; },
3837
+ };
3838
+ },
3839
+ assignMedium: function (cb) {
3840
+ assigned = true;
3841
+ var pendingQueue = [];
3842
+ if (buffer.length) {
3843
+ var cbs = buffer;
3844
+ buffer = [];
3845
+ cbs.forEach(cb);
3846
+ pendingQueue = buffer;
3847
+ }
3848
+ var executeQueue = function () {
3849
+ var cbs = pendingQueue;
3850
+ pendingQueue = [];
3851
+ cbs.forEach(cb);
3852
+ };
3853
+ var cycle = function () { return Promise.resolve().then(executeQueue); };
3854
+ cycle();
3855
+ buffer = {
3856
+ push: function (x) {
3857
+ pendingQueue.push(x);
3858
+ cycle();
3859
+ },
3860
+ filter: function (filter) {
3861
+ pendingQueue = pendingQueue.filter(filter);
3862
+ return buffer;
3863
+ },
3864
+ };
3865
+ },
3866
+ };
3867
+ return medium;
3868
+ }
3869
+ // eslint-disable-next-line @typescript-eslint/ban-types
3870
+ function createSidecarMedium(options) {
3871
+ if (options === void 0) { options = {}; }
3872
+ var medium = innerCreateMedium(null);
3873
+ medium.options = __assign({ async: true, ssr: false }, options);
3874
+ return medium;
3875
+ }
3876
+
3877
+ var SideCar$1 = function (_a) {
3878
+ var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
3879
+ if (!sideCar) {
3880
+ throw new Error('Sidecar: please provide `sideCar` property to import the right car');
3881
+ }
3882
+ var Target = sideCar.read();
3883
+ if (!Target) {
3884
+ throw new Error('Sidecar medium not found');
3885
+ }
3886
+ return React.createElement(Target, __assign({}, rest));
3887
+ };
3888
+ SideCar$1.isSideCarExport = true;
3889
+ function exportSidecar(medium, exported) {
3890
+ medium.useMedium(exported);
3891
+ return SideCar$1;
3892
+ }
3893
+
3894
+ var effectCar = createSidecarMedium();
3895
+
3896
+ var nothing = function () {
3897
+ return;
3898
+ };
3899
+ /**
3900
+ * Removes scrollbar from the page and contain the scroll within the Lock
3901
+ */
3902
+ var RemoveScroll = React.forwardRef(function (props, parentRef) {
3903
+ var ref = React.useRef(null);
3904
+ var _a = React.useState({
3905
+ onScrollCapture: nothing,
3906
+ onWheelCapture: nothing,
3907
+ onTouchMoveCapture: nothing,
3908
+ }), callbacks = _a[0], setCallbacks = _a[1];
3909
+ var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as"]);
3910
+ var SideCar = sideCar;
3911
+ var containerRef = useMergeRefs([ref, parentRef]);
3912
+ var containerProps = __assign(__assign({}, rest), callbacks);
3913
+ return (React.createElement(React.Fragment, null,
3914
+ enabled && (React.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref })),
3915
+ forwardProps ? (React.cloneElement(React.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef }))) : (React.createElement(Container, __assign({}, containerProps, { className: className, ref: containerRef }), children))));
3916
+ });
3917
+ RemoveScroll.defaultProps = {
3918
+ enabled: true,
3919
+ removeScrollBar: true,
3920
+ inert: false,
3921
+ };
3922
+ RemoveScroll.classNames = {
3923
+ fullWidth: fullWidthClassName,
3924
+ zeroRight: zeroRightClassName,
3925
+ };
3926
+
3927
+ var getNonce = function () {
3928
+ if (typeof __webpack_nonce__ !== 'undefined') {
3929
+ return __webpack_nonce__;
3930
+ }
3931
+ return undefined;
3932
+ };
3933
+
3934
+ function makeStyleTag() {
3935
+ if (!document)
3936
+ return null;
3937
+ var tag = document.createElement('style');
3938
+ tag.type = 'text/css';
3939
+ var nonce = getNonce();
3940
+ if (nonce) {
3941
+ tag.setAttribute('nonce', nonce);
3942
+ }
3943
+ return tag;
3944
+ }
3945
+ function injectStyles(tag, css) {
3946
+ // @ts-ignore
3947
+ if (tag.styleSheet) {
3948
+ // @ts-ignore
3949
+ tag.styleSheet.cssText = css;
3950
+ }
3951
+ else {
3952
+ tag.appendChild(document.createTextNode(css));
3953
+ }
3954
+ }
3955
+ function insertStyleTag(tag) {
3956
+ var head = document.head || document.getElementsByTagName('head')[0];
3957
+ head.appendChild(tag);
3958
+ }
3959
+ var stylesheetSingleton = function () {
3960
+ var counter = 0;
3961
+ var stylesheet = null;
3962
+ return {
3963
+ add: function (style) {
3964
+ if (counter == 0) {
3965
+ if ((stylesheet = makeStyleTag())) {
3966
+ injectStyles(stylesheet, style);
3967
+ insertStyleTag(stylesheet);
3968
+ }
3969
+ }
3970
+ counter++;
3971
+ },
3972
+ remove: function () {
3973
+ counter--;
3974
+ if (!counter && stylesheet) {
3975
+ stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
3976
+ stylesheet = null;
3977
+ }
3978
+ },
3979
+ };
3980
+ };
3981
+
3982
+ /**
3983
+ * creates a hook to control style singleton
3984
+ * @see {@link styleSingleton} for a safer component version
3985
+ * @example
3986
+ * ```tsx
3987
+ * const useStyle = styleHookSingleton();
3988
+ * ///
3989
+ * useStyle('body { overflow: hidden}');
3990
+ */
3991
+ var styleHookSingleton = function () {
3992
+ var sheet = stylesheetSingleton();
3993
+ return function (styles, isDynamic) {
3994
+ React.useEffect(function () {
3995
+ sheet.add(styles);
3996
+ return function () {
3997
+ sheet.remove();
3998
+ };
3999
+ }, [styles && isDynamic]);
4000
+ };
4001
+ };
4002
+
4003
+ /**
4004
+ * create a Component to add styles on demand
4005
+ * - styles are added when first instance is mounted
4006
+ * - styles are removed when the last instance is unmounted
4007
+ * - changing styles in runtime does nothing unless dynamic is set. But with multiple components that can lead to the undefined behavior
4008
+ */
4009
+ var styleSingleton = function () {
4010
+ var useStyle = styleHookSingleton();
4011
+ var Sheet = function (_a) {
4012
+ var styles = _a.styles, dynamic = _a.dynamic;
4013
+ useStyle(styles, dynamic);
4014
+ return null;
4015
+ };
4016
+ return Sheet;
4017
+ };
4018
+
4019
+ var zeroGap = {
4020
+ left: 0,
4021
+ top: 0,
4022
+ right: 0,
4023
+ gap: 0,
4024
+ };
4025
+ var parse = function (x) { return parseInt(x || '', 10) || 0; };
4026
+ var getOffset = function (gapMode) {
4027
+ var cs = window.getComputedStyle(document.body);
4028
+ if (process.env.NODE_ENV !== 'production') {
4029
+ if (cs.overflowY === 'hidden') {
4030
+ console.error('react-remove-scroll-bar: cannot calculate scrollbar size because it is removed (overflow:hidden on body');
4031
+ }
4032
+ }
4033
+ var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];
4034
+ var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];
4035
+ var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];
4036
+ return [parse(left), parse(top), parse(right)];
4037
+ };
4038
+ var getGapWidth = function (gapMode) {
4039
+ if (gapMode === void 0) { gapMode = 'margin'; }
4040
+ if (typeof window === 'undefined') {
4041
+ return zeroGap;
4042
+ }
4043
+ var offsets = getOffset(gapMode);
4044
+ var documentWidth = document.documentElement.clientWidth;
4045
+ var windowWidth = window.innerWidth;
4046
+ return {
4047
+ left: offsets[0],
4048
+ top: offsets[1],
4049
+ right: offsets[2],
4050
+ gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]),
4051
+ };
4052
+ };
4053
+
4054
+ var Style = styleSingleton();
4055
+ // important tip - once we measure scrollBar width and remove them
4056
+ // we could not repeat this operation
4057
+ // thus we are using style-singleton - only the first "yet correct" style will be applied.
4058
+ var getStyles = function (_a, allowRelative, gapMode, important) {
4059
+ var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
4060
+ if (gapMode === void 0) { gapMode = 'margin'; }
4061
+ return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
4062
+ allowRelative && "position: relative ".concat(important, ";"),
4063
+ gapMode === 'margin' &&
4064
+ "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
4065
+ gapMode === 'padding' && "padding-right: ".concat(gap, "px ").concat(important, ";"),
4066
+ ]
4067
+ .filter(Boolean)
4068
+ .join(''), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
4069
+ };
4070
+ /**
4071
+ * Removes page scrollbar and blocks page scroll when mounted
4072
+ */
4073
+ var RemoveScrollBar = function (props) {
4074
+ var noRelative = props.noRelative, noImportant = props.noImportant, _a = props.gapMode, gapMode = _a === void 0 ? 'margin' : _a;
4075
+ var gap = React.useMemo(function () { return getGapWidth(gapMode); }, [gapMode]);
4076
+ return React.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '') });
4077
+ };
4078
+
4079
+ var passiveSupported = false;
4080
+ if (typeof window !== 'undefined') {
4081
+ try {
4082
+ var options = Object.defineProperty({}, 'passive', {
4083
+ get: function () {
4084
+ passiveSupported = true;
4085
+ return true;
4086
+ },
4087
+ });
4088
+ // @ts-ignore
4089
+ window.addEventListener('test', options, options);
4090
+ // @ts-ignore
4091
+ window.removeEventListener('test', options, options);
4092
+ }
4093
+ catch (err) {
4094
+ passiveSupported = false;
4095
+ }
4096
+ }
4097
+ var nonPassive = passiveSupported ? { passive: false } : false;
4098
+
4099
+ var elementCouldBeVScrolled = function (node) {
4100
+ var styles = window.getComputedStyle(node);
4101
+ return (styles.overflowY !== 'hidden' && // not-not-scrollable
4102
+ !(styles.overflowY === styles.overflowX && styles.overflowY === 'visible') // scrollable
4103
+ );
4104
+ };
4105
+ var elementCouldBeHScrolled = function (node) {
4106
+ var styles = window.getComputedStyle(node);
4107
+ return (styles.overflowX !== 'hidden' && // not-not-scrollable
4108
+ !(styles.overflowY === styles.overflowX && styles.overflowX === 'visible') // scrollable
4109
+ );
4110
+ };
4111
+ var locationCouldBeScrolled = function (axis, node) {
4112
+ var current = node;
4113
+ do {
4114
+ // Skip over shadow root
4115
+ if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {
4116
+ current = current.host;
4117
+ }
4118
+ var isScrollable = elementCouldBeScrolled(axis, current);
4119
+ if (isScrollable) {
4120
+ var _a = getScrollVariables(axis, current), s = _a[1], d = _a[2];
4121
+ if (s > d) {
4122
+ return true;
4123
+ }
4124
+ }
4125
+ current = current.parentNode;
4126
+ } while (current && current !== document.body);
4127
+ return false;
4128
+ };
4129
+ var getVScrollVariables = function (_a) {
4130
+ var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
4131
+ return [
4132
+ scrollTop,
4133
+ scrollHeight,
4134
+ clientHeight,
4135
+ ];
4136
+ };
4137
+ var getHScrollVariables = function (_a) {
4138
+ var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
4139
+ return [
4140
+ scrollLeft,
4141
+ scrollWidth,
4142
+ clientWidth,
4143
+ ];
4144
+ };
4145
+ var elementCouldBeScrolled = function (axis, node) {
4146
+ return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
4147
+ };
4148
+ var getScrollVariables = function (axis, node) {
4149
+ return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);
4150
+ };
4151
+ var getDirectionFactor = function (axis, direction) {
4152
+ /**
4153
+ * If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,
4154
+ * and then increasingly negative as you scroll towards the end of the content.
4155
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
4156
+ */
4157
+ return axis === 'h' && direction === 'rtl' ? -1 : 1;
4158
+ };
4159
+ var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {
4160
+ var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
4161
+ var delta = directionFactor * sourceDelta;
4162
+ // find scrollable target
4163
+ var target = event.target;
4164
+ var targetInLock = endTarget.contains(target);
4165
+ var shouldCancelScroll = false;
4166
+ var isDeltaPositive = delta > 0;
4167
+ var availableScroll = 0;
4168
+ var availableScrollTop = 0;
4169
+ do {
4170
+ var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
4171
+ var elementScroll = scroll_1 - capacity - directionFactor * position;
4172
+ if (position || elementScroll) {
4173
+ if (elementCouldBeScrolled(axis, target)) {
4174
+ availableScroll += elementScroll;
4175
+ availableScrollTop += position;
4176
+ }
4177
+ }
4178
+ target = target.parentNode;
4179
+ } while (
4180
+ // portaled content
4181
+ (!targetInLock && target !== document.body) ||
4182
+ // self content
4183
+ (targetInLock && (endTarget.contains(target) || endTarget === target)));
4184
+ if (isDeltaPositive && ((noOverscroll && availableScroll === 0) || (!noOverscroll && delta > availableScroll))) {
4185
+ shouldCancelScroll = true;
4186
+ }
4187
+ else if (!isDeltaPositive &&
4188
+ ((noOverscroll && availableScrollTop === 0) || (!noOverscroll && -delta > availableScrollTop))) {
4189
+ shouldCancelScroll = true;
4190
+ }
4191
+ return shouldCancelScroll;
4192
+ };
4193
+
4194
+ var getTouchXY = function (event) {
4195
+ return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
4196
+ };
4197
+ var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; };
4198
+ var extractRef = function (ref) {
4199
+ return ref && 'current' in ref ? ref.current : ref;
4200
+ };
4201
+ var deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; };
4202
+ var generateStyle = function (id) { return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n"); };
4203
+ var idCounter = 0;
4204
+ var lockStack = [];
4205
+ function RemoveScrollSideCar(props) {
4206
+ var shouldPreventQueue = React.useRef([]);
4207
+ var touchStartRef = React.useRef([0, 0]);
4208
+ var activeAxis = React.useRef();
4209
+ var id = React.useState(idCounter++)[0];
4210
+ var Style = React.useState(function () { return styleSingleton(); })[0];
4211
+ var lastProps = React.useRef(props);
4212
+ React.useEffect(function () {
4213
+ lastProps.current = props;
4214
+ }, [props]);
4215
+ React.useEffect(function () {
4216
+ if (props.inert) {
4217
+ document.body.classList.add("block-interactivity-".concat(id));
4218
+ var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
4219
+ allow_1.forEach(function (el) { return el.classList.add("allow-interactivity-".concat(id)); });
4220
+ return function () {
4221
+ document.body.classList.remove("block-interactivity-".concat(id));
4222
+ allow_1.forEach(function (el) { return el.classList.remove("allow-interactivity-".concat(id)); });
4223
+ };
4224
+ }
4225
+ return;
4226
+ }, [props.inert, props.lockRef.current, props.shards]);
4227
+ var shouldCancelEvent = React.useCallback(function (event, parent) {
4228
+ if ('touches' in event && event.touches.length === 2) {
4229
+ return !lastProps.current.allowPinchZoom;
4230
+ }
4231
+ var touch = getTouchXY(event);
4232
+ var touchStart = touchStartRef.current;
4233
+ var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];
4234
+ var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];
4235
+ var currentAxis;
4236
+ var target = event.target;
4237
+ var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';
4238
+ // allow horizontal touch move on Range inputs. They will not cause any scroll
4239
+ if ('touches' in event && moveDirection === 'h' && target.type === 'range') {
4240
+ return false;
4241
+ }
4242
+ var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
4243
+ if (!canBeScrolledInMainDirection) {
4244
+ return true;
4245
+ }
4246
+ if (canBeScrolledInMainDirection) {
4247
+ currentAxis = moveDirection;
4248
+ }
4249
+ else {
4250
+ currentAxis = moveDirection === 'v' ? 'h' : 'v';
4251
+ canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
4252
+ // other axis might be not scrollable
4253
+ }
4254
+ if (!canBeScrolledInMainDirection) {
4255
+ return false;
4256
+ }
4257
+ if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {
4258
+ activeAxis.current = currentAxis;
4259
+ }
4260
+ if (!currentAxis) {
4261
+ return true;
4262
+ }
4263
+ var cancelingAxis = activeAxis.current || currentAxis;
4264
+ return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);
4265
+ }, []);
4266
+ var shouldPrevent = React.useCallback(function (_event) {
4267
+ var event = _event;
4268
+ if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {
4269
+ // not the last active
4270
+ return;
4271
+ }
4272
+ var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);
4273
+ var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && e.target === event.target && deltaCompare(e.delta, delta); })[0];
4274
+ // self event, and should be canceled
4275
+ if (sourceEvent && sourceEvent.should) {
4276
+ event.preventDefault();
4277
+ return;
4278
+ }
4279
+ // outside or shard event
4280
+ if (!sourceEvent) {
4281
+ var shardNodes = (lastProps.current.shards || [])
4282
+ .map(extractRef)
4283
+ .filter(Boolean)
4284
+ .filter(function (node) { return node.contains(event.target); });
4285
+ var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
4286
+ if (shouldStop) {
4287
+ event.preventDefault();
4288
+ }
4289
+ }
4290
+ }, []);
4291
+ var shouldCancel = React.useCallback(function (name, delta, target, should) {
4292
+ var event = { name: name, delta: delta, target: target, should: should };
4293
+ shouldPreventQueue.current.push(event);
4294
+ setTimeout(function () {
4295
+ shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });
4296
+ }, 1);
4297
+ }, []);
4298
+ var scrollTouchStart = React.useCallback(function (event) {
4299
+ touchStartRef.current = getTouchXY(event);
4300
+ activeAxis.current = undefined;
4301
+ }, []);
4302
+ var scrollWheel = React.useCallback(function (event) {
4303
+ shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
4304
+ }, []);
4305
+ var scrollTouchMove = React.useCallback(function (event) {
4306
+ shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
4307
+ }, []);
4308
+ React.useEffect(function () {
4309
+ lockStack.push(Style);
4310
+ props.setCallbacks({
4311
+ onScrollCapture: scrollWheel,
4312
+ onWheelCapture: scrollWheel,
4313
+ onTouchMoveCapture: scrollTouchMove,
4314
+ });
4315
+ document.addEventListener('wheel', shouldPrevent, nonPassive);
4316
+ document.addEventListener('touchmove', shouldPrevent, nonPassive);
4317
+ document.addEventListener('touchstart', scrollTouchStart, nonPassive);
4318
+ return function () {
4319
+ lockStack = lockStack.filter(function (inst) { return inst !== Style; });
4320
+ document.removeEventListener('wheel', shouldPrevent, nonPassive);
4321
+ document.removeEventListener('touchmove', shouldPrevent, nonPassive);
4322
+ document.removeEventListener('touchstart', scrollTouchStart, nonPassive);
4323
+ };
4324
+ }, []);
4325
+ var removeScrollBar = props.removeScrollBar, inert = props.inert;
4326
+ return (React.createElement(React.Fragment, null,
4327
+ inert ? React.createElement(Style, { styles: generateStyle(id) }) : null,
4328
+ removeScrollBar ? React.createElement(RemoveScrollBar, { gapMode: "margin" }) : null));
4329
+ }
4330
+
4331
+ var SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
4332
+
4333
+ var ReactRemoveScroll = React.forwardRef(function (props, ref) { return (React.createElement(RemoveScroll, __assign({}, props, { ref: ref, sideCar: SideCar }))); });
4334
+ ReactRemoveScroll.classNames = RemoveScroll.classNames;
4335
+ var C = ReactRemoveScroll;
4336
+
4337
+ const x=["Enter"," "],b=["ArrowUp","PageDown","End"],R=["ArrowDown","PageUp","Home",...b],y={ltr:["ArrowLeft"],rtl:["ArrowRight"]},[I,k,P]=createCollection("Menu"),[D$1,S]=createContextScope("Menu",[P,l$1,v]);const O=l$1(),T=v(),[L,A]=D$1("Menu");const Menu=e=>{const{__scopeMenu:n,open:o=!1,children:u,onOpenChange:c,modal:i=!0}=e,s=O(n),[l,d]=React.useState(null),p=React.useRef(!1),f=useCallbackRef$1(c),m=useDirection(l,e.dir);return React.useEffect((()=>{const e=()=>{p.current=!0,document.addEventListener("pointerdown",n,{capture:!0,once:!0}),document.addEventListener("pointermove",n,{capture:!0,once:!0});},n=()=>p.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",n,{capture:!0}),document.removeEventListener("pointermove",n,{capture:!0});}}),[]),/*#__PURE__*/React.createElement(Root$3,s,/*#__PURE__*/React.createElement(L,{scope:n,isSubmenu:!1,isUsingKeyboardRef:p,dir:m,open:o,onOpenChange:f,content:l,onContentChange:d,onRootClose:React.useCallback((()=>f(!1)),[f]),modal:i},u))};const MenuSub=n=>{const{__scopeMenu:r,children:o,open:u=!1,onOpenChange:c}=n,i=A("MenuSub",r),s=O(r),[l,d]=React.useState(null),[p,f]=React.useState(null),m=useCallbackRef$1(c);return React.useEffect((()=>(!1===i.open&&m(!1),()=>m(!1))),[i.open,m]),/*#__PURE__*/React.createElement(Root$3,s,/*#__PURE__*/React.createElement(L,{scope:r,isSubmenu:!0,isUsingKeyboardRef:i.isUsingKeyboardRef,dir:i.dir,open:u,onOpenChange:m,content:p,onContentChange:f,onRootClose:i.onRootClose,contentId:useId(),trigger:l,onTriggerChange:d,triggerId:useId(),modal:!1},o))};const MenuAnchor=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopeMenu:t,...r}=e,o=O(t);return React.createElement(Anchor$1,_extends({},o,r,{ref:n}))}));const[F,K]=D$1("MenuContent");const MenuContent=/*#__PURE__*/React.forwardRef(((e,n)=>{const{forceMount:t,...r}=e,o=A("MenuContent",e.__scopeMenu);return React.createElement(I.Provider,{scope:e.__scopeMenu},/*#__PURE__*/React.createElement(Presence,{present:t||o.open},/*#__PURE__*/React.createElement(I.Slot,{scope:e.__scopeMenu},o.isSubmenu?/*#__PURE__*/React.createElement(X,_extends({},r,{ref:n})):/*#__PURE__*/React.createElement(G,_extends({},r,{ref:n})))))}));const G=/*#__PURE__*/React.forwardRef(((e,n)=>A("MenuContent",e.__scopeMenu).modal?/*#__PURE__*/React.createElement(U,_extends({},e,{ref:n})):/*#__PURE__*/React.createElement(V,_extends({},e,{ref:n})))),U=/*#__PURE__*/React.forwardRef(((e,n)=>{const t=A("MenuContent",e.__scopeMenu),r=React.useRef(null),o=useComposedRefs(n,r);return React.useEffect((()=>{const e=r.current;if(e)return hideOthers(e)}),[]),/*#__PURE__*/React.createElement(B,_extends({},e,{ref:o,trapFocus:t.open,disableOutsidePointerEvents:t.open,disableOutsideScroll:!0,onFocusOutside:composeEventHandlers(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1}),onDismiss:()=>t.onOpenChange(!1)}))})),V=/*#__PURE__*/React.forwardRef(((e,n)=>{const t=A("MenuContent",e.__scopeMenu);return React.createElement(B,_extends({},e,{ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>t.onOpenChange(!1)}))})),X=/*#__PURE__*/React.forwardRef(((e,n)=>{const t=A("MenuContent",e.__scopeMenu),r=React.useRef(null),o=useComposedRefs(n,r);return t.isSubmenu?/*#__PURE__*/React.createElement(B,_extends({id:t.contentId,"aria-labelledby":t.triggerId},e,{ref:o,align:"start",side:"rtl"===t.dir?"left":"right",portalled:!0,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{var n;t.isUsingKeyboardRef.current&&(null===(n=r.current)||void 0===n||n.focus()),e.preventDefault();},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:composeEventHandlers(e.onFocusOutside,(e=>{e.target!==t.trigger&&t.onOpenChange(!1);})),onEscapeKeyDown:composeEventHandlers(e.onEscapeKeyDown,t.onRootClose),onKeyDown:composeEventHandlers(e.onKeyDown,(e=>{const n=e.currentTarget.contains(e.target),r=y[t.dir].includes(e.key);var o;n&&r&&(t.onOpenChange(!1),null===(o=t.trigger)||void 0===o||o.focus(),e.preventDefault());}))})):null})),B=/*#__PURE__*/React.forwardRef(((e,t)=>{const{__scopeMenu:r,loop:u=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:f,onEscapeKeyDown:v,onPointerDownOutside:g,onFocusOutside:h,onInteractOutside:x,onDismiss:_,disableOutsideScroll:y,allowPinchZoom:I,portalled:P,...D}=e,S=A("MenuContent",r),L=O(r),K=T(r),G=k(r),[U,V]=React.useState(null),X=React.useRef(null),B=useComposedRefs(t,X,S.onContentChange),Y=React.useRef(0),Z=React.useRef(""),z=React.useRef(0),H=React.useRef(null),W=React.useRef("right"),q=React.useRef(0),N=P?Portal:React.Fragment,Q=y?C:React.Fragment,$=y?{allowPinchZoom:I}:void 0,ee=e=>{var n,t;const r=Z.current+e,o=G().filter((e=>!e.disabled)),u=document.activeElement,c=null===(n=o.find((e=>e.ref.current===u)))||void 0===n?void 0:n.textValue,a=function(e,n,t){const r=n.length>1&&Array.from(n).every((e=>e===n[0]))?n[0]:n,o=t?e.indexOf(t):-1;let u=(c=e,a=Math.max(o,0),c.map(((e,n)=>c[(a+n)%c.length])));var c,a;1===r.length&&(u=u.filter((e=>e!==t)));const i=u.find((e=>e.toLowerCase().startsWith(r.toLowerCase())));return i!==t?i:void 0}(o.map((e=>e.textValue)),r,c),i=null===(t=o.find((e=>e.textValue===a)))||void 0===t?void 0:t.ref.current;!function e(n){Z.current=n,window.clearTimeout(Y.current),""!==n&&(Y.current=window.setTimeout((()=>e("")),1e3));}(r),i&&setTimeout((()=>i.focus()));};React.useEffect((()=>()=>window.clearTimeout(Y.current)),[]),useFocusGuards();const ne=React.useCallback((e=>{var n,t;return W.current===(null===(n=H.current)||void 0===n?void 0:n.side)&&function(e,n){if(!n)return !1;return function(e,n){const{x:t,y:r}=e;let o=!1;for(let e=0,u=n.length-1;e<n.length;u=e++){const c=n[e].x,a=n[e].y,i=n[u].x,s=n[u].y;a>r!=s>r&&t<(i-c)*(r-a)/(s-a)+c&&(o=!o);}return o}({x:e.clientX,y:e.clientY},n)}(e,null===(t=H.current)||void 0===t?void 0:t.area)}),[]);return React.createElement(N,null,/*#__PURE__*/React.createElement(Q,$,/*#__PURE__*/React.createElement(F,{scope:r,searchRef:Z,onItemEnter:React.useCallback((e=>{ne(e)&&e.preventDefault();}),[ne]),onItemLeave:React.useCallback((e=>{var n;ne(e)||(null===(n=X.current)||void 0===n||n.focus(),V(null));}),[ne]),onTriggerLeave:React.useCallback((e=>{ne(e)&&e.preventDefault();}),[ne]),pointerGraceTimerRef:z,onPointerGraceIntentChange:React.useCallback((e=>{H.current=e;}),[])},/*#__PURE__*/React.createElement(FocusScope,{asChild:!0,trapped:i,onMountAutoFocus:composeEventHandlers(s,(e=>{var n;e.preventDefault(),null===(n=X.current)||void 0===n||n.focus();})),onUnmountAutoFocus:l},/*#__PURE__*/React.createElement(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:v,onPointerDownOutside:g,onFocusOutside:h,onInteractOutside:x,onDismiss:_},/*#__PURE__*/React.createElement(Root$5,_extends({asChild:!0},K,{dir:S.dir,orientation:"vertical",loop:u,currentTabStopId:U,onCurrentTabStopIdChange:V,onEntryFocus:e=>{S.isUsingKeyboardRef.current||e.preventDefault();}}),/*#__PURE__*/React.createElement(Content$2,_extends({role:"menu","aria-orientation":"vertical","data-state":j(S.open),dir:S.dir},L,D,{ref:B,style:{outline:"none",...D.style},onKeyDown:composeEventHandlers(D.onKeyDown,(e=>{const n=e.target,t=e.currentTarget.contains(n),r=e.ctrlKey||e.altKey||e.metaKey,o=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!r&&o&&ee(e.key));const u=X.current;if(e.target!==u)return;if(!R.includes(e.key))return;e.preventDefault();const c=G().filter((e=>!e.disabled)).map((e=>e.ref.current));b.includes(e.key)&&c.reverse(),function(e){const n=document.activeElement;for(const t of e){if(t===n)return;if(t.focus(),document.activeElement!==n)return}}(c);})),onBlur:composeEventHandlers(e.onBlur,(e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(Y.current),Z.current="");})),onPointerMove:composeEventHandlers(e.onPointerMove,J((e=>{const n=e.target,t=q.current!==e.clientX;if(e.currentTarget.contains(n)&&t){const n=e.clientX>q.current?"right":"left";W.current=n,q.current=e.clientX;}})))}))))))))}));const MenuLabel=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopeMenu:t,...r}=e;return React.createElement(Primitive.div,_extends({},r,{ref:n}))}));const MenuItem=/*#__PURE__*/React.forwardRef(((e,n)=>{const{disabled:t=!1,onSelect:r,...o}=e,u=React.useRef(null),c=A("MenuItem",e.__scopeMenu),a=K("MenuItem",e.__scopeMenu),i=useComposedRefs(n,u),s=React.useRef(!1);return React.createElement(Y,_extends({},o,{ref:i,disabled:t,onClick:composeEventHandlers(e.onClick,(()=>{const e=u.current;if(!t&&e){const n=new Event("menu.itemSelect",{bubbles:!0,cancelable:!0});e.addEventListener("menu.itemSelect",(e=>null==r?void 0:r(e)),{once:!0}),e.dispatchEvent(n),n.defaultPrevented?s.current=!1:c.onRootClose();}})),onPointerDown:n=>{var t;null===(t=e.onPointerDown)||void 0===t||t.call(e,n),s.current=!0;},onPointerUp:composeEventHandlers(e.onPointerUp,(e=>{var n;s.current||null===(n=e.currentTarget)||void 0===n||n.click();})),onKeyDown:composeEventHandlers(e.onKeyDown,(e=>{const n=""!==a.searchRef.current;t||n&&" "===e.key||x.includes(e.key)&&(e.currentTarget.click(),e.preventDefault());}))}))}));const Y=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopeMenu:t,disabled:r=!1,textValue:u,...c}=e,a=K("MenuItem",t),i=T(t),l=React.useRef(null),d=useComposedRefs(n,l),[p,f]=React.useState("");return React.useEffect((()=>{const e=l.current;var n;e&&f((null!==(n=e.textContent)&&void 0!==n?n:"").trim());}),[c.children]),/*#__PURE__*/React.createElement(I.ItemSlot,{scope:t,disabled:r,textValue:null!=u?u:p},/*#__PURE__*/React.createElement(Item$2,_extends({asChild:!0},i,{focusable:!r}),/*#__PURE__*/React.createElement(Primitive.div,_extends({role:"menuitem","aria-disabled":r||void 0,"data-disabled":r?"":void 0},c,{ref:d,onPointerMove:composeEventHandlers(e.onPointerMove,J((e=>{if(r)a.onItemLeave(e);else if(a.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus();}}))),onPointerLeave:composeEventHandlers(e.onPointerLeave,J((e=>a.onItemLeave(e))))}))))}));const MenuCheckboxItem=/*#__PURE__*/React.forwardRef(((e,n)=>{const{checked:t=!1,onCheckedChange:r,...o}=e;return React.createElement(H,{scope:e.__scopeMenu,checked:t},/*#__PURE__*/React.createElement(MenuItem,_extends({role:"menuitemcheckbox","aria-checked":t},o,{ref:n,"data-state":q(t),onSelect:composeEventHandlers(o.onSelect,(()=>null==r?void 0:r(!t)),{checkForDefaultPrevented:!1})})))}));D$1("MenuRadioGroup",{value:void 0,onValueChange:()=>{}});const[H,W]=D$1("MenuItemIndicator",{checked:!1});const MenuItemIndicator=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopeMenu:t,forceMount:r,...o}=e,u=W("MenuItemIndicator",t);return React.createElement(Presence,{present:r||u.checked},/*#__PURE__*/React.createElement(Primitive.span,_extends({},o,{ref:n,"data-state":q(u.checked)})))}));const MenuArrow=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopeMenu:t,...r}=e,o=O(t);return React.createElement(Arrow$2,_extends({},o,r,{ref:n}))}));function j(e){return e?"open":"closed"}function q(e){return e?"checked":"unchecked"}function J(e){return n=>"mouse"===n.pointerType?e(n):void 0}const Root$2=Menu;const Sub=MenuSub;const Anchor=MenuAnchor;const Content$1=MenuContent;const Label$1=MenuLabel;const Item$1=MenuItem;const CheckboxItem$1=MenuCheckboxItem;const ItemIndicator$1=MenuItemIndicator;const Arrow$1=MenuArrow;
4338
+
4339
+ const[s,i$1]=createContextScope("DropdownMenu",[S]);const l=S(),[m,w]=s("DropdownMenu");const DropdownMenu=e=>{const{__scopeDropdownMenu:n,children:r,open:p,defaultOpen:d,onOpenChange:a}=e,s=M("DropdownMenu",n),i=l(n),[w=!1,D]=useControllableState({prop:p,defaultProp:d,onChange:a}),g=React.useCallback((()=>D((e=>!e))),[D]);return s.isInsideContent?/*#__PURE__*/React.createElement(m,{scope:n,isRootMenu:!1,open:w,onOpenChange:D,onOpenToggle:g},/*#__PURE__*/React.createElement(Sub,_extends({},i,{open:w,onOpenChange:D}),r)):/*#__PURE__*/React.createElement(f,_extends({},e,{open:w,onOpenChange:D,onOpenToggle:g}),r)};const f=n=>{const{__scopeDropdownMenu:r,children:t,dir:p,open:d,onOpenChange:a,onOpenToggle:s,modal:i=!0}=n,w=l(r),f=React.useRef(null);return React.createElement(m,{scope:r,isRootMenu:!0,triggerId:useId(),triggerRef:f,contentId:useId(),open:d,onOpenChange:a,onOpenToggle:s,modal:i},/*#__PURE__*/React.createElement(Root$2,_extends({},w,{open:d,onOpenChange:a,dir:p,modal:i}),t))};const DropdownMenuTrigger=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopeDropdownMenu:t,disabled:p=!1,...s}=e,i=w("DropdownMenuTrigger",t),m=l(t);return i.isRootMenu?/*#__PURE__*/React.createElement(Anchor,_extends({asChild:!0},m),/*#__PURE__*/React.createElement(Primitive.button,_extends({type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":!!i.open||void 0,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":p?"":void 0,disabled:p},s,{ref:composeRefs(n,i.triggerRef),onPointerDown:composeEventHandlers(e.onPointerDown,(e=>{p||0!==e.button||!1!==e.ctrlKey||(i.open||e.preventDefault(),i.onOpenToggle());})),onKeyDown:composeEventHandlers(e.onKeyDown,(e=>{p||(["Enter"," "].includes(e.key)&&i.onOpenToggle(),"ArrowDown"===e.key&&i.onOpenChange(!0),[" ","ArrowDown"].includes(e.key)&&e.preventDefault());}))}))):null}));const[D,M]=s("DropdownMenuContent",{isInsideContent:!1});const DropdownMenuContent=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=w("DropdownMenuContent",r),d=l(r),a={...t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}};return React.createElement(D,{scope:r,isInsideContent:!0},p.isRootMenu?/*#__PURE__*/React.createElement(g,_extends({__scopeDropdownMenu:r},a,{ref:n})):/*#__PURE__*/React.createElement(Content$1,_extends({},d,a,{ref:n})))}));const g=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,portalled:t=!0,...p}=e,d=w("DropdownMenuContent",r),s=l(r),i=React.useRef(!1);return d.isRootMenu?/*#__PURE__*/React.createElement(Content$1,_extends({id:d.contentId,"aria-labelledby":d.triggerId},s,p,{ref:n,portalled:t,onCloseAutoFocus:composeEventHandlers(e.onCloseAutoFocus,(e=>{var o;i.current||null===(o=d.triggerRef.current)||void 0===o||o.focus(),i.current=!1,e.preventDefault();})),onInteractOutside:composeEventHandlers(e.onInteractOutside,(e=>{const o=e.detail.originalEvent,n=0===o.button&&!0===o.ctrlKey,r=2===o.button||n;d.modal&&!r||(i.current=!0);}))})):null}));const DropdownMenuLabel=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);return React.createElement(Label$1,_extends({},p,t,{ref:n}))}));const DropdownMenuItem=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);return React.createElement(Item$1,_extends({},p,t,{ref:n}))}));const DropdownMenuCheckboxItem=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);return React.createElement(CheckboxItem$1,_extends({},p,t,{ref:n}))}));const DropdownMenuItemIndicator=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);return React.createElement(ItemIndicator$1,_extends({},p,t,{ref:n}))}));const DropdownMenuArrow=/*#__PURE__*/React.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);return React.createElement(Arrow$1,_extends({},p,t,{ref:n}))}));const Root$1=DropdownMenu;const Trigger=DropdownMenuTrigger;const Content=DropdownMenuContent;const Label=DropdownMenuLabel;const Item=DropdownMenuItem;const CheckboxItem=DropdownMenuCheckboxItem;const ItemIndicator=DropdownMenuItemIndicator;const Arrow=DropdownMenuArrow;
4340
+
4341
+ const e="horizontal",n=["horizontal","vertical"];const Separator=/*#__PURE__*/React.forwardRef(((n,a)=>{const{decorative:p,orientation:l=e,...c}=n,s=i(l)?l:e,u=p?{role:"none"}:{"aria-orientation":"vertical"===s?s:void 0,role:"separator"};return React.createElement(Primitive.div,_extends({"data-orientation":s},u,c,{ref:a}))}));function i(r){return n.includes(r)}Separator.propTypes={orientation(r,o,t){const n=r[o],a=String(n);return n&&!i(n)?new Error(function(r,o){return `Invalid prop \`orientation\` of value \`${r}\` supplied to \`${o}\`, expected one of:\n - horizontal\n - vertical\n\nDefaulting to \`${e}\`.`}(a,t)):null}};const Root=Separator;
4342
+
4343
+ function styleInject(css, ref) {
4344
+ if ( ref === void 0 ) ref = {};
4345
+ var insertAt = ref.insertAt;
4346
+
4347
+ if (!css || typeof document === 'undefined') { return; }
4348
+
4349
+ var head = document.head || document.getElementsByTagName('head')[0];
4350
+ var style = document.createElement('style');
4351
+ style.type = 'text/css';
4352
+
4353
+ if (insertAt === 'top') {
4354
+ if (head.firstChild) {
4355
+ head.insertBefore(style, head.firstChild);
4356
+ } else {
4357
+ head.appendChild(style);
4358
+ }
4359
+ } else {
4360
+ head.appendChild(style);
4361
+ }
4362
+
4363
+ if (style.styleSheet) {
4364
+ style.styleSheet.cssText = css;
4365
+ } else {
4366
+ style.appendChild(document.createTextNode(css));
4367
+ }
4368
+ }
4369
+
4370
+ var css_248z$1 = ":root {\n --background: #FFFAEE;\n --primary: #1890ff;\n --primary2: #40a9ff;\n --primary0: #e6f7ff;\n --grey5: #8c8c8c;\n --grey3: #d0d7de;\n --secondary: #fff566;\n --font-color: #494949;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --background: #3c3c3c;\n --font-color: #fafafa;\n }\n}\n.poll-select-content {\n font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", Segoe UI Symbol, \"Noto Color Emoji\";\n display: flex;\n flex-direction: column;\n width: fit-content;\n background-color: white;\n border: 1px solid var(--grey3);\n border-radius: 4px;\n padding: 6px 4px;\n box-shadow: rgba(0, 0, 0, 0.08) 0px 2px 4px;\n gap: 2px;\n}\n\n.poll-select-item {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 6px;\n border-radius: 2px;\n padding: 2px 8px;\n transition: background-color 0.15s linear, color 0.15s linear;\n}\n\n.poll-select-item[data-state=checked] {\n background-color: var(--primary2);\n color: white;\n}\n\n.poll-select-item:focus-visible {\n outline: none;\n}\n\n.poll-select-item:hover {\n background-color: var(--primary0);\n cursor: pointer;\n color: unset;\n}\n\n.poll-separator {\n background-color: #d0d7de;\n height: 1px;\n width: 100%;\n margin: 4px 0;\n}";
4371
+ styleInject(css_248z$1);
4372
+
4373
+ var Dropdown = function (_a) {
4374
+ var options = _a.options, trigger = _a.trigger, contentProps = _a.contentProps, itemProps = _a.itemProps, _b = _a.arrow, arrow = _b === void 0 ? true : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c;
4375
+ return (React__default.createElement(Root$1, null,
4376
+ React__default.createElement(Trigger, { asChild: true, disabled: disabled }, trigger),
4377
+ React__default.createElement(Content, __assign({ className: 'poll-select-content' }, contentProps),
4378
+ options.map(function (option, i, a) { return (React__default.createElement(React__default.Fragment, null,
4379
+ option.map(function (o) {
4380
+ var _a;
4381
+ switch (o.type) {
4382
+ case 'checkbox':
4383
+ return (React__default.createElement(CheckboxItem, __assign({ key: o.id, className: 'poll-select-item', onSelect: function (e) {
4384
+ if (o.onSelect)
4385
+ o.onSelect(o);
4386
+ }, checked: o.checked }, itemProps),
4387
+ o.checked ?
4388
+ React__default.createElement(ItemIndicator, null,
4389
+ React__default.createElement("div", { style: {
4390
+ display: 'flex',
4391
+ alignItems: 'center',
4392
+ justifyContent: 'center',
4393
+ width: 12,
4394
+ height: 12,
4395
+ } },
4396
+ React__default.createElement(CheckCircle$1, null))) :
4397
+ React__default.createElement("div", { style: {
4398
+ width: 12,
4399
+ minWidth: 12,
4400
+ height: 12
4401
+ } }),
4402
+ o.label));
4403
+ case 'label':
4404
+ return (React__default.createElement(Label, { key: o.id }, o.label));
4405
+ case 'link':
4406
+ return (React__default.createElement("a", { href: (_a = o.to) !== null && _a !== void 0 ? _a : '/', key: o.id, style: { color: 'unset' } },
4407
+ React__default.createElement(Item, __assign({ className: 'poll-select-item', onSelect: function () { return o.onSelect && o.onSelect(o); } }, itemProps), o.label)));
4408
+ default:
4409
+ return (React__default.createElement(Item, __assign({ key: o.id, className: 'poll-select-item', onSelect: function (e) { return o.onSelect && o.onSelect(o); } }, itemProps), o.label));
4410
+ }
4411
+ }),
4412
+ i !== a.length - 1 && React__default.createElement(Root, { key: "dropdown-separator-".concat(i), className: 'poll-separator' }))); }),
4413
+ arrow && React__default.createElement(Arrow, { style: {
4414
+ fill: 'white',
4415
+ stroke: 'var(--grey3)',
4416
+ strokeWidth: 2,
4417
+ transform: 'translateY(-1px)',
4418
+ strokeDasharray: 34,
4419
+ strokeDashoffset: -31,
4420
+ strokeLinejoin: 'miter',
4421
+ strokeMiterlimit: 12
4422
+ }, offset: 12 }))));
4423
+ };
4424
+
4425
+ var css_248z = ":root {\n --background: #FFFAEE;\n --primary: #1890ff;\n --primary2: #40a9ff;\n --primary0: #e6f7ff;\n --grey5: #8c8c8c;\n --grey3: #d0d7de;\n --secondary: #fff566;\n --font-color: #494949;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --background: #3c3c3c;\n --font-color: #fafafa;\n }\n}\n.btn-group {\n font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", Segoe UI Symbol, \"Noto Color Emoji\";\n display: flex;\n border-radius: 4px;\n max-width: 260px;\n}\n\n.btn-group:hover {\n box-shadow: 0 1px 2px 0 rgba(26, 115, 232, 0.45), 0 1px 3px 1px rgba(26, 115, 232, 0.3);\n}\n\n.btn-group-disabled:hover {\n box-shadow: none;\n}\n\n.btn-group button {\n display: flex;\n background-color: var(--primary);\n border: 1px solid var(--primary);\n color: white;\n padding: 6px 10px;\n cursor: pointer;\n float: left;\n transition: background-color 0.125s ease-in-out;\n z-index: 10;\n align-items: center;\n}\n\n.btn-group button:disabled {\n background-color: var(--grey3);\n color: var(--grey5);\n cursor: default;\n border-color: var(--grey5);\n}\n\n.btn-group button:first-child {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n}\n\n.btn-group button:last-child {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n border-left-color: #096dd9;\n}\n\n.btn-group button:last-child:disabled {\n border-left-color: var(--grey5);\n}\n\n.btn-group button:not(:last-child) {\n border-right: none;\n}\n\n.btn-group button:focus-visible {\n outline: none;\n}\n\n/* Clear floats (clearfix hack) */\n.btn-group:after {\n content: \"\";\n clear: both;\n display: table;\n}\n\n.btn-group button:hover {\n background-color: var(--primary2);\n z-index: 11;\n}\n\n.btn-group-disabled:hover button:hover {\n background-color: var(--grey3);\n}\n\n.options-content {\n font-size: clamp(0.65rem, 8vw - 0.75rem, 0.85rem);\n}";
4426
+ styleInject(css_248z);
4427
+
4428
+ var logo = "<svg width=\"120\" height=\"121\" viewBox=\"0 0 120 121\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n<g clip-path=\"url(#clip0_196:2879)\">\r\n<path d=\"M74.1329 19.935C71.2546 18.1644 67.758 17.1586 64.2138 16.6379C60.8839 16.2527 59.0697 16.26 55.8842 16.5653C52.286 17.0295 48.8866 18.1269 45.8012 19.7422L38.9746 24.6334C35.0335 28.3844 32.1047 33.1898 30.6397 38.5977C30.5443 38.9501 30.2703 39.2271 29.9191 39.3269C18.2166 42.6537 9.09766 53.0173 8.14885 65.2517C7.9581 67.7115 8.04252 69.0779 8.14886 71.4989C8.61571 82.1278 18.2019 94.0465 29.92 97.4229C30.2708 97.5239 30.5444 97.8011 30.6398 98.1535C33.9063 110.221 44.4326 119.553 57.2727 120.332C59.7632 120.483 61.1213 120.466 63.5199 120.207C74.5027 119.017 85.6433 109.914 88.89 98.3036C88.9897 97.947 89.2715 97.6687 89.6295 97.5742C101.6 94.4141 110.809 83.9226 111.778 71.3276L111.79 71.1632C111.97 68.8349 112.076 67.4612 111.778 65.0804C110.172 52.2413 101.58 42.3185 89.6301 39.1763C89.272 39.0822 88.9904 38.8043 88.8876 38.4486C87.3454 33.1121 83.1567 26.9108 80.8669 24.8932C78.4936 22.802 77.0112 21.7055 74.1329 19.935Z\" fill=\"#FAFAFA\"/>\r\n<path d=\"M55.3565 81.5463C52.2106 85.7324 47.5988 88.7539 42.2833 89.8487C42.2796 89.9983 42.2777 90.1484 42.2777 90.299C42.2777 100.087 50.2123 108.021 60 108.021C69.7878 108.021 77.7223 100.087 77.7223 90.299C77.7223 80.5112 69.7878 72.5767 60 72.5767C59.7782 72.5767 59.5574 72.5807 59.3375 72.5888C58.8727 74.9919 58.0148 77.2548 56.8336 79.308C57.6845 78.5778 58.7908 78.1366 60 78.1366C62.6869 78.1366 64.865 80.3147 64.865 83.0016C64.865 85.6884 62.6869 87.8665 60 87.8665C57.3132 87.8665 55.1351 85.6884 55.1351 83.0016C55.1351 82.4946 55.2126 82.0058 55.3565 81.5463Z\" fill=\"#F2B24D\"/>\r\n<path d=\"M73.355 20.8754C73.7199 20.3591 73.5817 19.6239 73.0138 19.3459C70.6087 18.1683 68.024 17.3007 65.3119 16.7952C64.712 16.6834 64.1699 17.1524 64.1699 17.7626V24.2563C64.1699 24.7309 64.5042 25.1377 64.9652 25.2507C66.5364 25.6358 68.041 26.1905 69.4587 26.8942C70.0888 27.2071 70.8644 26.8376 71.0248 26.1527C71.4653 24.2718 72.1906 22.523 73.355 20.8754Z\" fill=\"#24292E\"/>\r\n<path d=\"M78.8727 35.8702C78.7876 35.7178 78.7415 35.5465 78.7415 35.3719V32.8891C78.7415 32.8887 78.7412 32.8884 78.7408 32.8884V32.8884C78.7404 32.8884 78.7401 32.8881 78.7401 32.8877C78.7402 28.951 79.1734 27.0703 80.196 25.6448C80.5202 25.1927 81.1701 25.1864 81.5552 25.5879C84.9716 29.1497 87.5245 33.5465 88.878 38.442C88.9767 38.7988 89.2587 39.077 89.6167 39.1713C101.248 42.2371 110.135 52.0536 111.831 64.179C111.913 64.766 111.449 65.2793 110.857 65.2793H104.43C103.932 65.2793 103.513 64.9128 103.423 64.4234C101.73 55.2146 94.2729 48.0189 84.9329 46.7234L82.5873 46.3981C82.1484 46.3372 81.802 45.9948 81.7358 45.5568L81.3825 43.2152C80.9855 40.5842 80.1195 38.1066 78.8727 35.8702Z\" fill=\"#24292E\"/>\r\n<path d=\"M39.0061 24.7171C38.9467 24.6578 38.8508 24.6565 38.7903 24.7147C34.8991 28.4552 32.0072 33.2279 30.5539 38.5928C30.4585 38.9451 30.1842 39.2223 29.8331 39.322C18.4732 42.5485 9.83817 52.2453 8.1687 64.1791C8.08658 64.7661 8.55058 65.2793 9.14329 65.2793H15.5701C16.0677 65.2793 16.4871 64.9128 16.5771 64.4234C18.2429 55.3641 25.4866 48.2524 34.6147 46.791L36.9098 46.4235C37.3408 46.3545 37.6772 46.014 37.741 45.5822L38.0806 43.2828C38.5232 40.2866 39.5736 37.4881 41.1024 35.0163C41.2022 34.8549 41.257 34.6694 41.2573 34.4796L41.2599 32.8817C41.2593 28.0472 40.6046 26.3156 39.0061 24.7171V24.7171Z\" fill=\"#24292E\"/>\r\n<path d=\"M50.4609 26.6789C49.8385 26.9705 49.0889 26.6078 48.9241 25.9406C48.4629 24.0736 47.7124 22.3372 46.5192 20.7003C46.1396 20.1796 46.2808 19.4264 46.8637 19.1517C49.3149 17.9965 51.9466 17.161 54.705 16.699C55.2998 16.5994 55.83 17.0665 55.83 17.6696V24.1339C55.83 24.6178 55.4829 25.0298 55.0104 25.1338C53.4224 25.4833 51.899 26.0053 50.4609 26.6789Z\" fill=\"#24292E\"/>\r\n<path d=\"M81.3825 93.5983C80.021 102.62 73.1466 109.837 64.3028 111.714C63.8265 111.815 63.4752 112.229 63.4752 112.716V119.172C63.4752 119.772 64.0018 120.239 64.5949 120.143C76.3086 118.251 85.765 109.63 88.8778 98.3722C88.9765 98.0153 89.2587 97.7365 89.6167 97.6422C101.247 94.5764 110.135 84.7598 111.831 72.6345C111.913 72.0475 111.449 71.5342 110.857 71.5342H104.43C103.932 71.5342 103.513 71.9007 103.423 72.3901C101.73 81.5989 94.2729 88.7946 84.9329 90.0901L82.5873 90.4154C82.1484 90.4763 81.802 90.8186 81.7358 91.2567L81.3825 93.5983Z\" fill=\"#24292E\"/>\r\n<path d=\"M34.6147 90.0225C25.4866 88.5611 18.2429 81.4494 16.5771 72.39C16.4871 71.9007 16.0677 71.5342 15.5701 71.5342H9.14329C8.55058 71.5342 8.08658 72.0474 8.1687 72.6344C9.83818 84.5682 18.4732 94.265 29.8331 97.4915C30.1842 97.5912 30.4586 97.869 30.5541 98.2214C33.7329 109.955 43.794 118.856 56.1395 120.319C56.7201 120.388 57.2203 119.927 57.2203 119.342V112.94C57.2203 112.432 56.8383 112.007 56.3361 111.929C46.9129 110.459 39.4759 102.977 38.0806 93.5307L37.741 91.2313C37.6772 90.7995 37.3408 90.4589 36.9098 90.3899L34.6147 90.0225Z\" fill=\"#24292E\"/>\r\n<path d=\"M81.6288 86.129C91.4166 86.129 99.3511 78.1945 99.3511 68.4067C99.3511 58.6189 91.4166 50.6844 81.6288 50.6844C71.841 50.6844 63.9065 58.6189 63.9065 68.4067C63.9065 68.5396 63.908 68.6721 63.9109 68.8042C66.337 69.2726 68.6204 70.1415 70.6896 71.3395C70.0725 70.5241 69.7065 69.5081 69.7065 68.4067C69.7065 65.7199 71.8846 63.5418 74.5715 63.5418C77.2583 63.5418 79.4364 65.7199 79.4364 68.4067C79.4364 71.0935 77.2583 73.2717 74.5715 73.2717C74.1249 73.2717 73.6923 73.2115 73.2814 73.0988C77.3251 76.2875 80.2171 80.8715 81.2313 86.1247C81.3635 86.1276 81.496 86.129 81.6288 86.129Z\" fill=\"#EB2227\"/>\r\n<path d=\"M77.7179 46.9119C77.7208 46.7798 77.7222 46.6473 77.7222 46.5144C77.7222 36.7267 69.7877 28.7921 59.9999 28.7921C50.2121 28.7921 42.2776 36.7267 42.2776 46.5144C42.2776 56.3022 50.2121 64.2367 59.9999 64.2367C60.1328 64.2367 60.2653 64.2353 60.3974 64.2324C60.8357 61.9623 61.6246 59.8172 62.7056 57.8556C61.932 58.3743 61.0013 58.6768 59.9999 58.6768C57.3131 58.6768 55.135 56.4987 55.135 53.8119C55.135 51.125 57.3131 48.9469 59.9999 48.9469C62.6867 48.9469 64.8649 51.125 64.8649 53.8119C64.8649 54.1364 64.8331 54.4536 64.7724 54.7604C67.9575 50.7698 72.5087 47.9176 77.7179 46.9119Z\" fill=\"#04A54F\"/>\r\n<path d=\"M55.561 67.9564C55.5647 68.1061 55.5666 68.2562 55.5666 68.4067C55.5666 78.1945 47.632 86.129 37.8443 86.129C28.0565 86.129 20.1219 78.1945 20.1219 68.4067C20.1219 58.6189 28.0565 50.6844 37.8443 50.6844C38.066 50.6844 38.2868 50.6885 38.5066 50.6965C39.5143 55.906 42.3689 60.457 46.3619 63.6408C46.0448 63.5759 45.7166 63.5418 45.3804 63.5418C42.6935 63.5418 40.5154 65.7199 40.5154 68.4067C40.5154 71.0935 42.6935 73.2717 45.3804 73.2717C48.0672 73.2717 50.2453 71.0935 50.2453 68.4067C50.2453 67.3959 49.9371 66.4572 49.4095 65.6793C51.3054 66.7292 53.3736 67.506 55.561 67.9564Z\" fill=\"#2DA9E1\"/>\r\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M30.1088 16.0686C30.1088 12.2302 33.2204 9.11865 37.0587 9.11865C40.897 9.11865 44.0086 12.2302 44.0086 16.0686C44.0086 17.3483 43.6628 18.5472 43.0594 19.577L43.4291 19.9467L40.4805 22.8953L39.9675 22.3823C39.0826 22.7907 38.0973 23.0185 37.0587 23.0185C33.2204 23.0185 30.1088 19.9069 30.1088 16.0686ZM37.0587 13.2886C35.5234 13.2886 34.2787 14.5332 34.2787 16.0686C34.2787 17.6039 35.5234 18.8486 37.0587 18.8486C38.594 18.8486 39.8387 17.6039 39.8387 16.0686C39.8387 14.5332 38.594 13.2886 37.0587 13.2886Z\" fill=\"#24292E\"/>\r\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M43.273 61.7897L43.3202 32.5375L43.345 32.5375C43.3447 27.5138 42.6696 25.0844 40.4805 22.8953L43.4291 19.9467C46.7995 23.3171 47.515 27.142 47.515 32.5409H45.4118L47.4902 32.5442L47.443 61.7606C50.2866 62.6317 52.3543 65.2777 52.3543 68.4067C52.3543 72.245 49.2427 75.3566 45.4044 75.3566C41.566 75.3566 38.4544 72.245 38.4544 68.4067C38.4544 65.3119 40.4773 62.6895 43.273 61.7897ZM45.4044 65.6267C43.869 65.6267 42.6244 66.8713 42.6244 68.4067C42.6244 69.942 43.869 71.1867 45.4044 71.1867C46.9397 71.1867 48.1843 69.942 48.1843 68.4067C48.1843 66.8714 46.9397 65.6267 45.4044 65.6267Z\" fill=\"#24292E\"/>\r\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M76.4483 16.0686C76.4483 12.2302 79.5599 9.11865 83.3982 9.11865C87.2366 9.11865 90.3481 12.2302 90.3481 16.0686C90.3481 19.9069 87.2366 23.0185 83.3982 23.0185C82.2382 23.0185 81.1446 22.7343 80.1832 22.2318L79.5196 22.8953C79.5196 22.8953 79.5196 22.8953 79.5196 22.8953C77.3301 25.0849 76.6553 27.5149 76.6553 32.5409L76.6567 32.5409V61.7674C79.4888 62.6455 81.5457 65.2859 81.5457 68.4067C81.5457 72.245 78.4341 75.3566 74.5958 75.3566C70.7575 75.3566 67.6459 72.245 67.6459 68.4067C67.6459 65.3036 69.6795 62.6756 72.4867 61.7825V32.5409L72.4854 32.5409C72.4854 27.142 73.2007 23.317 76.571 19.9467L77.2347 19.283C76.7324 18.3218 76.4483 17.2283 76.4483 16.0686ZM83.3982 13.2886C81.8629 13.2886 80.6182 14.5332 80.6182 16.0686C80.6182 17.6039 81.8629 18.8486 83.3982 18.8486C84.9336 18.8486 86.1782 17.6039 86.1782 16.0686C86.1782 14.5332 84.9336 13.2886 83.3982 13.2886ZM74.5958 65.6267C73.0605 65.6267 71.8158 66.8714 71.8158 68.4067C71.8158 69.942 73.0605 71.1867 74.5958 71.1867C76.1311 71.1867 77.3758 69.942 77.3758 68.4067C77.3758 66.8714 76.1311 65.6267 74.5958 65.6267Z\" fill=\"#24292E\"/>\r\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M60.0001 0.427979C56.1618 0.427979 53.0502 3.53957 53.0502 7.37791C53.0502 10.4898 55.0954 13.124 57.915 14.0096L57.915 47.1877C55.1078 48.0807 53.0741 50.7088 53.0741 53.8119C53.0741 56.9161 55.1093 59.545 57.9181 60.437L57.9198 61.7735C55.0978 62.6577 53.0503 65.2931 53.0503 68.4067C53.0503 71.5264 55.1059 74.1661 57.9365 75.0451L57.9382 76.3701C55.119 77.256 53.0741 79.89 53.0741 83.0016C53.0741 86.8399 56.1857 89.9515 60.024 89.9515C63.8624 89.9515 66.974 86.8399 66.974 83.0016C66.974 79.8893 64.9282 77.2549 62.1081 76.3695L62.1064 75.0318C64.9151 74.1397 66.9502 71.5108 66.9502 68.4067C66.9502 65.2965 64.9071 62.6634 62.0898 61.7764L62.0881 60.4502C64.9186 59.571 66.974 56.9315 66.974 53.8119C66.974 50.6911 64.917 48.0508 62.085 47.1726L62.085 14.0097C64.9047 13.1241 66.95 10.4899 66.95 7.37791C66.95 3.53957 63.8384 0.427979 60.0001 0.427979ZM57.2201 7.37791C57.2201 5.84257 58.4648 4.59794 60.0001 4.59794C61.5354 4.59794 62.7801 5.84257 62.7801 7.37791C62.7801 8.91324 61.5354 10.1579 60.0001 10.1579C58.4648 10.1579 57.2201 8.91324 57.2201 7.37791ZM57.2441 83.0016C57.2441 81.4662 58.4887 80.2216 60.024 80.2216C61.5594 80.2216 62.804 81.4662 62.804 83.0016C62.804 84.5369 61.5594 85.7815 60.024 85.7815C58.4887 85.7815 57.2441 84.5369 57.2441 83.0016ZM57.2203 68.4067C57.2203 66.8714 58.4649 65.6268 60.0003 65.6268C61.5356 65.6268 62.7802 66.8714 62.7802 68.4067C62.7802 69.9421 61.5356 71.1867 60.0003 71.1867C58.4649 71.1867 57.2203 69.9421 57.2203 68.4067ZM60.024 51.0319C58.4887 51.0319 57.2441 52.2765 57.2441 53.8119C57.2441 55.3472 58.4887 56.5918 60.024 56.5918C61.5594 56.5918 62.804 55.3472 62.804 53.8119C62.804 52.2765 61.5594 51.0319 60.024 51.0319Z\" fill=\"#24292E\"/>\r\n</g>\r\n<defs>\r\n<clipPath id=\"clip0_196:2879\">\r\n<rect width=\"120\" height=\"120\" fill=\"white\" transform=\"translate(0 0.427979)\"/>\r\n</clipPath>\r\n</defs>\r\n</svg>";
4429
+
4430
+ function Logo() {
4431
+ return (React__default.createElement("div", { style: {
4432
+ display: 'flex',
4433
+ justifyContent: 'center',
4434
+ alignContent: 'center',
4435
+ borderRadius: 99999,
4436
+ maxHeight: 24,
4437
+ maxWidth: 24,
4438
+ marginRight: 6,
4439
+ } },
4440
+ React__default.createElement("img", { src: logo, alt: "Pollination Logo" })));
4441
+ }
4442
+
4443
+ var SettingsButton = function (_a) {
4444
+ var options = _a.options, disabled = _a.disabled, onClick = _a.onClick, label = _a.label;
4445
+ return (React__default.createElement("div", { className: "btn-group ".concat(disabled && 'btn-group-disabled') },
4446
+ React__default.createElement("button", { onClick: onClick, disabled: disabled, style: {
4447
+ flex: 1,
4448
+ } },
4449
+ React__default.createElement(Logo, null),
4450
+ disabled ? 'Try a Pollination CAD Plugin' : label),
4451
+ React__default.createElement(Dropdown, { trigger: React__default.createElement("button", null,
4452
+ React__default.createElement(CaretDownFill$1, null)), options: options, contentProps: {
4453
+ align: 'end',
4454
+ style: {
4455
+ fontSize: 'clamp(0.65rem, 8vw - 0.75rem, 0.85rem)',
4456
+ }
4457
+ }, disabled: disabled })));
4458
+ };
4459
+
4460
+ var GetGeometry = function (_a) {
4461
+ var setParentState = _a.setParentState;
4462
+ var _b = useState(false), subscribe = _b[0], setSubscribe = _b[1];
4463
+ var subscribeRef = useRef();
4464
+ var _c = useState(false), selection = _c[0], setSelection = _c[1];
4465
+ // pollination-react-io hooks
4466
+ var _d = useGetGeometry(); _d.host; var geometry = _d.geometry, getGeometry = _d.getGeometry;
4467
+ // initial retrieval of geometry
4468
+ if (getGeometry)
4469
+ getGeometry('get-geometry');
4470
+ useEffect(function () {
4471
+ if (!geometry || !setParentState)
4472
+ return;
4473
+ setParentState(geometry);
4474
+ }, [geometry, setParentState]);
4475
+ // subscribe
4476
+ useEffect(function () {
4477
+ if (!getGeometry)
4478
+ return;
4479
+ if (subscribe &&
4480
+ typeof subscribeRef.current === 'undefined') {
4481
+ subscribeRef.current = setInterval(function () {
4482
+ getGeometry('get-geometry', false);
4483
+ }, 500);
4484
+ }
4485
+ else if (!subscribe &&
4486
+ typeof subscribeRef.current !== 'undefined') {
4487
+ clearInterval(subscribeRef.current);
4488
+ subscribeRef.current = undefined;
4489
+ }
4490
+ }, [getGeometry, subscribe]);
4491
+ // with the current way our selection mechanism works
4492
+ // you can't be both subscribing and in selection mode
4493
+ // asks the user to continually provide input
4494
+ useEffect(function () {
4495
+ if (selection) {
4496
+ if (subscribeRef.current) {
4497
+ clearInterval(subscribeRef.current);
4498
+ }
4499
+ setSubscribe(false);
4500
+ }
4501
+ }, [selection]);
4502
+ useEffect(function () {
4503
+ if (subscribe) {
4504
+ setSelection(false);
4505
+ }
4506
+ }, [subscribe]);
4507
+ return (React__default.createElement(SettingsButton, { onClick: function () {
4508
+ if (!getGeometry)
4509
+ return;
4510
+ getGeometry('get-geometry', selection && !subscribe, true);
4511
+ }, disabled: typeof getGeometry === 'undefined', options: [[
4512
+ {
4513
+ type: 'checkbox',
4514
+ id: 'subscribe',
4515
+ label: 'Subscribe to Geometry',
4516
+ checked: subscribe,
4517
+ disabled: !getGeometry,
4518
+ onSelect: function () { return setSubscribe(!subscribe); },
4519
+ },
4520
+ {
4521
+ type: 'checkbox',
4522
+ id: 'selection',
4523
+ label: 'Get Selected Geometry',
4524
+ checked: selection,
4525
+ disabled: !getGeometry,
4526
+ onSelect: function () { return setSelection(!selection); },
4527
+ },
4528
+ ]], label: "Get Geometry" }));
4529
+ };
4530
+
4531
+ var GetHbjson = function (_a) {
4532
+ var setParentState = _a.setParentState;
4533
+ // sync
4534
+ var _b = useState(false), subscribe = _b[0], setSubscribe = _b[1];
4535
+ var subscribeRef = useRef();
4536
+ var _c = useState(false), selection = _c[0], setSelection = _c[1];
4537
+ // pollination-react-io hooks
4538
+ var _d = useGetHbjson(), host = _d.host, hbjson = _d.hbjson, getHbjson = _d.getHbjson;
4539
+ // initial retrieval of hbjson
4540
+ useEffect(function () {
4541
+ if (!getHbjson)
4542
+ return;
4543
+ getHbjson('get-hbjson', selection, false);
4544
+ }, [getHbjson, host, selection]);
4545
+ useEffect(function () {
4546
+ if (!hbjson || !setParentState)
4547
+ return;
4548
+ setParentState(hbjson);
4549
+ }, [hbjson, setParentState]);
4550
+ // subscribe
4551
+ useEffect(function () {
4552
+ if (!getHbjson)
4553
+ return;
4554
+ if (subscribe &&
4555
+ typeof subscribeRef.current === 'undefined') {
4556
+ subscribeRef.current = setInterval(function () {
4557
+ getHbjson('get-hbjson', false);
4558
+ }, 500);
4559
+ }
4560
+ else if (!subscribe &&
4561
+ typeof subscribeRef.current !== 'undefined') {
4562
+ clearInterval(subscribeRef.current);
4563
+ subscribeRef.current = undefined;
4564
+ }
4565
+ }, [getHbjson, subscribe]);
4566
+ // with the current way our selection mechanism works
4567
+ // you can't be both subscribing and in selection mode
4568
+ // asks the user to continually provide input
4569
+ useEffect(function () {
4570
+ if (selection) {
4571
+ if (subscribeRef.current) {
4572
+ clearInterval(subscribeRef.current);
4573
+ }
4574
+ setSubscribe(false);
4575
+ }
4576
+ }, [selection]);
4577
+ useEffect(function () {
4578
+ if (subscribe) {
4579
+ setSelection(false);
4580
+ }
4581
+ }, [subscribe]);
4582
+ return (React__default.createElement(SettingsButton, { onClick: function () {
4583
+ if (!getHbjson)
4584
+ return;
4585
+ getHbjson('get-hbjson', selection, true);
4586
+ }, disabled: typeof getHbjson === 'undefined', options: [[
4587
+ {
4588
+ type: 'checkbox',
4589
+ id: 'subscribe',
4590
+ label: 'Subscribe to Hbjson',
4591
+ checked: subscribe,
4592
+ disabled: !getHbjson,
4593
+ onSelect: function () { return setSubscribe(!subscribe); },
4594
+ },
4595
+ {
4596
+ type: 'checkbox',
4597
+ id: 'selection',
4598
+ label: 'Get Selected Hbjson',
4599
+ checked: selection,
4600
+ disabled: !getHbjson,
4601
+ onSelect: function () { return setSelection(!selection); },
4602
+ },
4603
+ ]], label: "Get Hbjson" }));
4604
+ };
4605
+
4606
+ var SendGeometry = function (_a) {
4607
+ var geometry = _a.geometry;
4608
+ var _b = useState(true), preview = _b[0], setPreview = _b[1];
4609
+ var _c = useSendGeometry(); _c.host; _c.state; var sendGeometry = _c.sendGeometry;
4610
+ // subscribe
4611
+ useEffect(function () {
4612
+ if (!sendGeometry)
4613
+ return;
4614
+ sendGeometry({
4615
+ data: geometry,
4616
+ uniqueId: performance.now().toString(),
4617
+ options: {
4618
+ layer: 'StreamlitLayer',
4619
+ units: 'Meters',
4620
+ },
4621
+ }, preview);
4622
+ }, [geometry, preview, sendGeometry]);
4623
+ return (React__default.createElement(SettingsButton, { disabled: !sendGeometry, onClick: function () {
4624
+ if (!sendGeometry)
4625
+ return;
4626
+ sendGeometry({
4627
+ data: geometry,
4628
+ uniqueId: performance.now().toString(),
4629
+ options: {
4630
+ layer: 'StreamlitLayer',
4631
+ units: 'Meters',
4632
+ },
4633
+ }, preview);
4634
+ }, options: [[
4635
+ {
4636
+ type: 'checkbox',
4637
+ id: 'preview-send-geometry',
4638
+ label: 'Preview Geometry',
4639
+ checked: preview,
4640
+ disabled: !sendGeometry,
4641
+ onSelect: function () { return setPreview(function (p) { return !p; }); },
4642
+ },
4643
+ ]], label: "Send Geometry" }));
4644
+ };
4645
+
4646
+ var SendHbjson = function (_a) {
4647
+ var hbjson = _a.hbjson;
4648
+ var _b = useState(true), preview = _b[0], setPreview = _b[1];
4649
+ var _c = useSendHbjson(); _c.host; _c.state; var sendHbjson = _c.sendHbjson;
4650
+ // subscribe
4651
+ useEffect(function () {
4652
+ if (!sendHbjson)
4653
+ return;
4654
+ sendHbjson({
4655
+ data: hbjson,
4656
+ uniqueId: performance.now().toString(),
4657
+ options: {
4658
+ layer: 'StreamlitLayer',
4659
+ units: 'Meters',
4660
+ },
4661
+ }, preview);
4662
+ }, [hbjson, preview, sendHbjson]);
4663
+ return (React__default.createElement(SettingsButton, { disabled: !sendHbjson, onClick: function () {
4664
+ if (!sendHbjson)
4665
+ return;
4666
+ sendHbjson({
4667
+ data: hbjson,
4668
+ uniqueId: performance.now().toString(),
4669
+ options: {
4670
+ layer: 'StreamlitLayer',
4671
+ units: 'Meters',
4672
+ },
4673
+ }, preview);
4674
+ }, options: [[
4675
+ {
4676
+ type: 'checkbox',
4677
+ id: 'preview-send-hbjson',
4678
+ label: 'Preview Hbjson',
4679
+ checked: preview,
4680
+ disabled: !sendHbjson,
4681
+ onSelect: function () { return setPreview(function (p) { return !p; }); },
4682
+ },
4683
+ ]], label: "Send Hbjson" }));
4684
+ };
4685
+
4686
+ export { GetGeometry, GetHbjson, SendGeometry, SendHbjson, checkDotNet, checkRuby, getHost, sendMessageDotNet, sendMessageRuby, subscribeDotNet, useGetGeometry, useGetHbjson, useHbjsontoVTK, useManageSettings, useRunCommand, useSendGeometry, useSendHbjson };
2300
4687
  //# sourceMappingURL=index.esm.js.map