@tamagui/core 1.85.5 → 1.85.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/native.js CHANGED
@@ -1465,7 +1465,7 @@ var require_insertStyleRule_native = __commonJS({
1465
1465
  }
1466
1466
  return scannedCache.set(sheet2, cacheKey), dedupedThemes;
1467
1467
  }
1468
- var colorVarToVal, rootComputedStyle = null;
1468
+ var colorVarToVal, rootComputedStyle = null, schemes = { dark: !0, light: !0 };
1469
1469
  function addThemesFromCSS(cssStyleRule, tokens) {
1470
1470
  let selectors = cssStyleRule.selectorText.split(",");
1471
1471
  if (!selectors.length)
@@ -1497,17 +1497,20 @@ var require_insertStyleRule_native = __commonJS({
1497
1497
  !0
1498
1498
  );
1499
1499
  }
1500
- let dedupedEntry = {
1501
- names: [],
1500
+ return {
1501
+ names: [
1502
+ ...new Set(
1503
+ selectors.map((selector) => {
1504
+ let parts = selector.replace(/(.t_|:root)/g, "").trim().split(" "), secondToLast = parts[parts.length - 2] || "", scheme = secondToLast.includes("dark") ? "dark" : secondToLast.includes("light") ? "light" : "", name = (() => {
1505
+ let _ = parts[parts.length - 1];
1506
+ return scheme && _.startsWith(scheme) && (_ = _.slice(scheme.length + 1)), _;
1507
+ })();
1508
+ return scheme === name || schemes[name] ? scheme : `${scheme}${scheme && name ? "_" : ""}${name}`;
1509
+ })
1510
+ )
1511
+ ],
1502
1512
  theme: values
1503
1513
  };
1504
- for (let selector of selectors) {
1505
- let di = selector.indexOf("t_dark"), li = selector.indexOf("t_light"), scheme = di && li ? di < li ? "dark" : "light" : "", name = selector.slice(selector.lastIndexOf(".t_") + 3);
1506
- name.startsWith(scheme) && (name = name.slice(scheme.length + 1)), scheme === name && (scheme = "");
1507
- let themeName = `${scheme}${scheme && name ? "_" : ""}${name}`;
1508
- dedupedEntry.names.includes(themeName) || dedupedEntry.names.push(themeName);
1509
- }
1510
- return dedupedEntry;
1511
1514
  }
1512
1515
  function getTamaguiSelector(rule, collectThemes = !1) {
1513
1516
  if (rule instanceof CSSStyleRule) {
@@ -1839,116 +1842,9 @@ var require_useMedia_native = __commonJS({
1839
1842
  }
1840
1843
  });
1841
1844
 
1842
- // ../web/dist/cjs/Tamagui.native.js
1843
- var require_Tamagui_native = __commonJS({
1844
- "../web/dist/cjs/Tamagui.native.js"(exports2, module2) {
1845
- "use strict";
1846
- var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1847
- for (var name in all)
1848
- __defProp2(target, name, { get: all[name], enumerable: !0 });
1849
- }, __copyProps2 = (to, from, except, desc) => {
1850
- if (from && typeof from == "object" || typeof from == "function")
1851
- for (let key of __getOwnPropNames2(from))
1852
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1853
- return to;
1854
- }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
1855
- // If the importer is in node compatibility mode or this is not an ESM
1856
- // file that has been converted to a CommonJS file using a Babel-
1857
- // compatible transform (i.e. "__esModule" has not been set), then set
1858
- // "default" to the CommonJS "module.exports" for node compatibility.
1859
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
1860
- mod
1861
- )), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Tamagui_exports = {};
1862
- __export2(Tamagui_exports, {
1863
- Tamagui: () => Tamagui,
1864
- getValueFromIdentifier: () => getValueFromIdentifier,
1865
- setIdentifierValue: () => setIdentifierValue
1866
- });
1867
- module2.exports = __toCommonJS2(Tamagui_exports);
1868
- var Helpers = __toESM2(require_index_native4()), import_config = require_config_native(), import_insertStyleRule = require_insertStyleRule_native(), import_useMedia = require_useMedia_native(), TamaguiManager = class {
1869
- constructor() {
1870
- this.Helpers = Helpers;
1871
- }
1872
- get mediaState() {
1873
- return { ...import_useMedia.mediaState };
1874
- }
1875
- get config() {
1876
- return (0, import_config.getConfig)();
1877
- }
1878
- get insertedRules() {
1879
- return (0, import_insertStyleRule.getAllRules)();
1880
- }
1881
- get allSelectors() {
1882
- return (0, import_insertStyleRule.getAllSelectors)();
1883
- }
1884
- get allTransforms() {
1885
- return (0, import_insertStyleRule.getAllTransforms)();
1886
- }
1887
- get identifierToValue() {
1888
- return identifierToValue;
1889
- }
1890
- }, Tamagui = new TamaguiManager(), identifierToValue = /* @__PURE__ */ new Map(), getValueFromIdentifier = (identifier) => identifierToValue.get(identifier), setIdentifierValue = (identifier, value) => {
1891
- identifierToValue.set(identifier, value);
1892
- };
1893
- }
1894
- });
1895
-
1896
- // ../compose-refs/dist/cjs/compose-refs.native.js
1897
- var require_compose_refs_native = __commonJS({
1898
- "../compose-refs/dist/cjs/compose-refs.native.js"(exports2, module2) {
1899
- "use strict";
1900
- var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1901
- for (var name in all)
1902
- __defProp2(target, name, { get: all[name], enumerable: !0 });
1903
- }, __copyProps2 = (to, from, except, desc) => {
1904
- if (from && typeof from == "object" || typeof from == "function")
1905
- for (let key of __getOwnPropNames2(from))
1906
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1907
- return to;
1908
- }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
1909
- // If the importer is in node compatibility mode or this is not an ESM
1910
- // file that has been converted to a CommonJS file using a Babel-
1911
- // compatible transform (i.e. "__esModule" has not been set), then set
1912
- // "default" to the CommonJS "module.exports" for node compatibility.
1913
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
1914
- mod
1915
- )), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), compose_refs_exports = {};
1916
- __export2(compose_refs_exports, {
1917
- composeRefs: () => composeRefs,
1918
- useComposedRefs: () => useComposedRefs
1919
- });
1920
- module2.exports = __toCommonJS2(compose_refs_exports);
1921
- var React = __toESM2(require("react"));
1922
- function setRef(ref, value) {
1923
- typeof ref == "function" ? ref(value) : ref && (ref.current = value);
1924
- }
1925
- function composeRefs(...refs) {
1926
- return (node) => refs.forEach((ref) => setRef(ref, node));
1927
- }
1928
- function useComposedRefs(...refs) {
1929
- return React.useCallback(composeRefs(...refs), refs);
1930
- }
1931
- }
1932
- });
1933
-
1934
- // ../compose-refs/dist/cjs/index.native.js
1935
- var require_index_native5 = __commonJS({
1936
- "../compose-refs/dist/cjs/index.native.js"(exports2, module2) {
1937
- "use strict";
1938
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __copyProps2 = (to, from, except, desc) => {
1939
- if (from && typeof from == "object" || typeof from == "function")
1940
- for (let key of __getOwnPropNames2(from))
1941
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1942
- return to;
1943
- }, __reExport2 = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), src_exports2 = {};
1944
- module2.exports = __toCommonJS2(src_exports2);
1945
- __reExport2(src_exports2, require_compose_refs_native(), module2.exports);
1946
- }
1947
- });
1948
-
1949
- // ../use-did-finish-ssr/dist/cjs/index.native.js
1950
- var require_index_native6 = __commonJS({
1951
- "../use-did-finish-ssr/dist/cjs/index.native.js"(exports2, module2) {
1845
+ // ../web/dist/cjs/helpers/createShallowSetState.native.js
1846
+ var require_createShallowSetState_native = __commonJS({
1847
+ "../web/dist/cjs/helpers/createShallowSetState.native.js"(exports2, module2) {
1952
1848
  "use strict";
1953
1849
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1954
1850
  for (var name in all)
@@ -1958,18 +1854,24 @@ var require_index_native6 = __commonJS({
1958
1854
  for (let key of __getOwnPropNames2(from))
1959
1855
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1960
1856
  return to;
1961
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), src_exports2 = {};
1962
- __export2(src_exports2, {
1963
- useClientValue: () => useClientValue,
1964
- useDidFinishSSR: () => useDidFinishSSR
1857
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createShallowSetState_exports = {};
1858
+ __export2(createShallowSetState_exports, {
1859
+ createShallowSetState: () => createShallowSetState,
1860
+ isEqualShallow: () => isEqualShallow,
1861
+ mergeIfNotShallowEqual: () => mergeIfNotShallowEqual
1965
1862
  });
1966
- module2.exports = __toCommonJS2(src_exports2);
1967
- var import_react3 = require("react");
1968
- function useDidFinishSSR(value) {
1969
- return value ?? !0;
1863
+ module2.exports = __toCommonJS2(createShallowSetState_exports);
1864
+ function createShallowSetState(setter, debug) {
1865
+ return (next) => setter((prev) => mergeIfNotShallowEqual(prev, next, debug));
1970
1866
  }
1971
- function useClientValue(value) {
1972
- return useDidFinishSSR() ? typeof value == "function" ? value() : value : void 0;
1867
+ function mergeIfNotShallowEqual(prev, next, debug) {
1868
+ return isEqualShallow(prev, next) ? prev : (process.env.NODE_ENV === "development" && debug && console.warn("setStateShallow CHANGE", { prev, next }), { ...prev, ...next });
1869
+ }
1870
+ function isEqualShallow(prev, next) {
1871
+ for (let key in next)
1872
+ if (prev[key] !== next[key])
1873
+ return !1;
1874
+ return !0;
1973
1875
  }
1974
1876
  }
1975
1877
  });
@@ -2008,9 +1910,9 @@ var require_constants_native2 = __commonJS({
2008
1910
  }
2009
1911
  });
2010
1912
 
2011
- // ../web/dist/cjs/helpers/objectIdentityKey.native.js
2012
- var require_objectIdentityKey_native = __commonJS({
2013
- "../web/dist/cjs/helpers/objectIdentityKey.native.js"(exports2, module2) {
1913
+ // ../web/dist/cjs/helpers/ThemeManager.native.js
1914
+ var require_ThemeManager_native = __commonJS({
1915
+ "../web/dist/cjs/helpers/ThemeManager.native.js"(exports2, module2) {
2014
1916
  "use strict";
2015
1917
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2016
1918
  for (var name in all)
@@ -2020,177 +1922,149 @@ var require_objectIdentityKey_native = __commonJS({
2020
1922
  for (let key of __getOwnPropNames2(from))
2021
1923
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2022
1924
  return to;
2023
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), objectIdentityKey_exports = {};
2024
- __export2(objectIdentityKey_exports, {
2025
- objectIdentityKey: () => objectIdentityKey
1925
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManager_exports = {};
1926
+ __export2(ThemeManager_exports, {
1927
+ ThemeManager: () => ThemeManager,
1928
+ getHasThemeUpdatingProps: () => getHasThemeUpdatingProps,
1929
+ getManagers: () => getManagers
2026
1930
  });
2027
- module2.exports = __toCommonJS2(objectIdentityKey_exports);
2028
- function objectIdentityKey(obj) {
2029
- let k = "";
2030
- for (let key in obj) {
2031
- k += key;
2032
- let arg = obj[key], type = typeof arg;
2033
- if (!arg || type !== "object" && type !== "function")
2034
- k += type + arg;
2035
- else if (cache.has(arg))
2036
- k += cache.get(arg);
2037
- else {
2038
- let v = Math.random();
2039
- cache.set(arg, v), k += v;
2040
- }
2041
- }
2042
- return k;
1931
+ module2.exports = __toCommonJS2(ThemeManager_exports);
1932
+ var import_constants = require_index_native3(), import_config = require_config_native(), import_constants2 = require_constants_native2(), emptyState = { name: "" };
1933
+ function getHasThemeUpdatingProps(props) {
1934
+ return !!(props.name || props.componentName || props.inverse || props.reset);
2043
1935
  }
2044
- var cache = /* @__PURE__ */ new WeakMap();
2045
- }
2046
- });
2047
-
2048
- // ../web/dist/cjs/helpers/createStyledContext.native.js
2049
- var require_createStyledContext_native = __commonJS({
2050
- "../web/dist/cjs/helpers/createStyledContext.native.js"(exports2, module2) {
2051
- "use strict";
2052
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2053
- for (var name in all)
2054
- __defProp2(target, name, { get: all[name], enumerable: !0 });
2055
- }, __copyProps2 = (to, from, except, desc) => {
2056
- if (from && typeof from == "object" || typeof from == "function")
2057
- for (let key of __getOwnPropNames2(from))
2058
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2059
- return to;
2060
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createStyledContext_exports = {};
2061
- __export2(createStyledContext_exports, {
2062
- createStyledContext: () => createStyledContext
2063
- });
2064
- module2.exports = __toCommonJS2(createStyledContext_exports);
2065
- var import_react3 = require("react"), import_objectIdentityKey = require_objectIdentityKey_native(), import_jsx_runtime = require("react/jsx-runtime");
2066
- function createStyledContext(defaultValues) {
2067
- let OGContext = (0, import_react3.createContext)(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map(), Provider = ({
2068
- children,
2069
- scope,
2070
- ...values
2071
- }) => {
2072
- let next = (0, import_react3.useMemo)(() => ({
2073
- // this ! is a workaround for ts error
2074
- ...defaultValues,
2075
- ...values
2076
- }), [(0, import_objectIdentityKey.objectIdentityKey)(values)]), Provider2 = OGProvider;
2077
- if (scope) {
2078
- let ScopedContext = scopedContexts.get(scope);
2079
- ScopedContext || (ScopedContext = (0, import_react3.createContext)(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
1936
+ var uid = 0, ThemeManager = class {
1937
+ constructor(props = {}, parentManager) {
1938
+ if (this.props = props, this.id = 0, this.themeListeners = /* @__PURE__ */ new Set(), this.parentManager = null, this.state = emptyState, this._allKeys = null, uid = (uid + 1) % Number.MAX_VALUE, this.id = uid, parentManager === "root") {
1939
+ this.updateStateFromProps(props, !1);
1940
+ return;
2080
1941
  }
2081
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, { value: next, children });
2082
- }, useStyledContext = (scope) => {
2083
- let context = scope ? scopedContexts.get(scope) : OGContext;
2084
- return (0, import_react3.useContext)(context);
2085
- };
2086
- return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
2087
- }
2088
- }
2089
- });
2090
-
2091
- // ../web/dist/cjs/contexts/ComponentContext.native.js
2092
- var require_ComponentContext_native = __commonJS({
2093
- "../web/dist/cjs/contexts/ComponentContext.native.js"(exports2, module2) {
2094
- "use strict";
2095
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2096
- for (var name in all)
2097
- __defProp2(target, name, { get: all[name], enumerable: !0 });
2098
- }, __copyProps2 = (to, from, except, desc) => {
2099
- if (from && typeof from == "object" || typeof from == "function")
2100
- for (let key of __getOwnPropNames2(from))
2101
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2102
- return to;
2103
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ComponentContext_exports = {};
2104
- __export2(ComponentContext_exports, {
2105
- ComponentContext: () => ComponentContext
2106
- });
2107
- module2.exports = __toCommonJS2(ComponentContext_exports);
2108
- var import_createStyledContext = require_createStyledContext_native(), ComponentContext = (0, import_createStyledContext.createStyledContext)({
2109
- disableSSR: void 0,
2110
- inText: !1,
2111
- language: null,
2112
- animationDriver: null,
2113
- groups: {
2114
- emit: null,
2115
- subscribe: null,
2116
- state: {}
1942
+ if (!parentManager)
1943
+ throw process.env.NODE_ENV !== "production" ? new Error(
1944
+ "No parent manager given, this is likely due to duplicated Tamagui dependencies. Check your lockfile for mis-matched versions. It could also be from an error somewhere else in your stack causing Tamagui to recieve undefined context, you can try putting some ErrorBoundary components around other areas of your app, or a Suspense boundary."
1945
+ ) : "\u274C 000";
1946
+ if (this.parentManager = parentManager, !this.updateStateFromProps(props, !1))
1947
+ return parentManager;
1948
+ }
1949
+ updateStateFromProps(props = this.props || {}, shouldNotify = !0) {
1950
+ if (this.props = props, props.forceTheme)
1951
+ return this.state.theme = props.forceTheme, this.state.name = props.name || "", this.updateState(this.state, !0), this.state;
1952
+ let nextState = this.getStateIfChanged(props);
1953
+ if (nextState)
1954
+ return this.updateState(nextState, shouldNotify), nextState;
1955
+ }
1956
+ updateState(nextState, shouldNotify = !0) {
1957
+ this.state = nextState, this._allKeys = null, process.env.NODE_ENV !== "production" && (this._numChangeEventsSent ??= 0, this._numChangeEventsSent++), shouldNotify && this.notify();
1958
+ }
1959
+ getStateIfChanged(props = this.props, state = this.state, parentManager = this.parentManager) {
1960
+ let _ = this.getState(props, parentManager);
1961
+ if (state && state !== emptyState && !_)
1962
+ return parentManager == null ? void 0 : parentManager.state;
1963
+ if (this.getStateShouldChange(_, state))
1964
+ return _;
1965
+ }
1966
+ getStateShouldChange(nextState, state = this.state) {
1967
+ return !(!(nextState != null && nextState.theme) || nextState.theme === (state == null ? void 0 : state.theme));
1968
+ }
1969
+ getState(props = this.props, parentManager = this.parentManager) {
1970
+ return getState(props, parentManager) || (parentManager == null ? void 0 : parentManager.state) || null;
1971
+ }
1972
+ get allKeys() {
1973
+ var _a;
1974
+ return this._allKeys ||= /* @__PURE__ */ new Set([
1975
+ ...((_a = this.parentManager) == null ? void 0 : _a.allKeys) || [],
1976
+ ...Object.keys(this.state.theme || {})
1977
+ ]), this._allKeys;
1978
+ }
1979
+ notify(forced = !1) {
1980
+ this.themeListeners.forEach((cb) => cb(this.state.name, this, forced));
1981
+ }
1982
+ onChangeTheme(cb, debugId) {
1983
+ return process.env.NODE_ENV !== "production" && debugId && (this._listeningIds ??= /* @__PURE__ */ new Set(), this._listeningIds.add(debugId)), this.themeListeners.add(cb), () => {
1984
+ this.themeListeners.delete(cb);
1985
+ };
2117
1986
  }
2118
- });
2119
- }
2120
- });
2121
-
2122
- // ../web/dist/cjs/defaultComponentState.native.js
2123
- var require_defaultComponentState_native = __commonJS({
2124
- "../web/dist/cjs/defaultComponentState.native.js"(exports2, module2) {
2125
- "use strict";
2126
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2127
- for (var name in all)
2128
- __defProp2(target, name, { get: all[name], enumerable: !0 });
2129
- }, __copyProps2 = (to, from, except, desc) => {
2130
- if (from && typeof from == "object" || typeof from == "function")
2131
- for (let key of __getOwnPropNames2(from))
2132
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2133
- return to;
2134
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), defaultComponentState_exports = {};
2135
- __export2(defaultComponentState_exports, {
2136
- defaultComponentState: () => defaultComponentState,
2137
- defaultComponentStateMounted: () => defaultComponentStateMounted,
2138
- defaultComponentStateShouldEnter: () => defaultComponentStateShouldEnter
2139
- });
2140
- module2.exports = __toCommonJS2(defaultComponentState_exports);
2141
- var defaultComponentState = {
2142
- hover: !1,
2143
- press: !1,
2144
- pressIn: !1,
2145
- focus: !1,
2146
- unmounted: !0
2147
- }, defaultComponentStateMounted = {
2148
- ...defaultComponentState,
2149
- unmounted: !1
2150
- }, defaultComponentStateShouldEnter = {
2151
- ...defaultComponentState,
2152
- unmounted: "should-enter"
2153
1987
  };
2154
- }
2155
- });
2156
-
2157
- // ../web/dist/cjs/helpers/createShallowSetState.native.js
2158
- var require_createShallowSetState_native = __commonJS({
2159
- "../web/dist/cjs/helpers/createShallowSetState.native.js"(exports2, module2) {
2160
- "use strict";
2161
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2162
- for (var name in all)
2163
- __defProp2(target, name, { get: all[name], enumerable: !0 });
2164
- }, __copyProps2 = (to, from, except, desc) => {
2165
- if (from && typeof from == "object" || typeof from == "function")
2166
- for (let key of __getOwnPropNames2(from))
2167
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2168
- return to;
2169
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createShallowSetState_exports = {};
2170
- __export2(createShallowSetState_exports, {
2171
- createShallowSetState: () => createShallowSetState,
2172
- isEqualShallow: () => isEqualShallow,
2173
- mergeIfNotShallowEqual: () => mergeIfNotShallowEqual
2174
- });
2175
- module2.exports = __toCommonJS2(createShallowSetState_exports);
2176
- function createShallowSetState(setter, debug) {
2177
- return (next) => setter((prev) => mergeIfNotShallowEqual(prev, next, debug));
2178
- }
2179
- function mergeIfNotShallowEqual(prev, next, debug) {
2180
- return isEqualShallow(prev, next) ? prev : (process.env.NODE_ENV === "development" && debug && console.warn("setStateShallow CHANGE", { prev, next }), { ...prev, ...next });
1988
+ function getState(props, manager) {
1989
+ var _a;
1990
+ if (props.name && props.reset)
1991
+ throw new Error(
1992
+ process.env.NODE_ENV === "production" ? "\u274C004" : "Cannot reset and set a new name at the same time."
1993
+ );
1994
+ if (!getHasThemeUpdatingProps(props))
1995
+ return null;
1996
+ let themes = (0, import_config.getThemes)(), [allManagers, componentManagers] = getManagers(manager), isDirectParentAComponentTheme = !!(manager != null && manager.state.isComponent), startIndex = props.reset && !isDirectParentAComponentTheme ? 1 : 0, baseManager = allManagers[startIndex], parentManager = allManagers[startIndex + 1];
1997
+ if (!baseManager && props.reset)
1998
+ return process.env.NODE_ENV !== "production" && console.warn("Cannot reset, no parent theme exists"), null;
1999
+ let { componentName } = props, result = null, baseName = (baseManager == null ? void 0 : baseManager.state.name) || "";
2000
+ baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][A-Za-z]+/, ""));
2001
+ let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
2002
+ isDirectParentAComponentTheme && allComponentThemes.shift();
2003
+ let base = baseName.split(import_constants2.THEME_NAME_SEPARATOR), max = base.length, min = props.componentName && !nextName ? max : 0;
2004
+ for (let i = max; i >= min; i--) {
2005
+ let prefix = base.slice(0, i).join(import_constants2.THEME_NAME_SEPARATOR);
2006
+ props.inverse && (prefix = inverseThemeName(prefix));
2007
+ let potentials = [];
2008
+ if (prefix && prefix !== baseName && potentials.push(prefix), nextName && potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName), i === 1) {
2009
+ let lastSegment = potentials.findIndex((x) => !x.includes("_"));
2010
+ lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
2011
+ }
2012
+ if (componentName && !props.reset) {
2013
+ let baseLen = base.length, componentPotentials = [];
2014
+ if (nextName && baseLen > 1) {
2015
+ let beforeSeparator = base[0];
2016
+ componentPotentials.push(`${beforeSeparator}_${nextName}_${componentName}`);
2017
+ }
2018
+ if (componentPotentials.push(`${prefix}_${componentName}`), nextName) {
2019
+ if (i > baseLen) {
2020
+ let prefixLessOne = base.slice(0, i - 1).join(import_constants2.THEME_NAME_SEPARATOR);
2021
+ if (prefixLessOne) {
2022
+ let lessSpecific = `${prefixLessOne}_${nextName}_${componentName}`;
2023
+ componentPotentials.unshift(lessSpecific);
2024
+ }
2025
+ }
2026
+ let moreSpecific = `${prefix}_${nextName}_${componentName}`;
2027
+ componentPotentials.unshift(moreSpecific);
2028
+ }
2029
+ potentials = [...componentPotentials, ...potentials, ...allComponentThemes];
2030
+ }
2031
+ let found = potentials.find((t) => t in themes);
2032
+ if (process.env.NODE_ENV !== "production" && typeof props.debug == "string" && console.info(" getState ", {
2033
+ props,
2034
+ found,
2035
+ potentials,
2036
+ baseManager,
2037
+ nextName,
2038
+ baseName,
2039
+ prefix
2040
+ }), found) {
2041
+ let names = found.split("_"), [firstName, ...restNames] = names, lastName = names[names.length - 1], isComponent = lastName[0] === lastName[0].toUpperCase(), scheme = firstName === "light" ? "light" : firstName === "dark" ? "dark" : void 0, pre = import_constants2.THEME_CLASSNAME_PREFIX, className = import_constants.isWeb ? `${pre}sub_theme ${pre}${!scheme || !restNames.length ? firstName : restNames.join("_")}` : "", parentState = (_a = baseManager || parentManager) == null ? void 0 : _a.state, parentName = parentState == null ? void 0 : parentState.name;
2042
+ result = {
2043
+ name: found,
2044
+ parentName,
2045
+ theme: themes[found],
2046
+ className,
2047
+ isComponent,
2048
+ scheme
2049
+ };
2050
+ break;
2051
+ }
2052
+ }
2053
+ return process.env.NODE_ENV !== "production" && props.debug === "verbose" && typeof window < "u" && (console.groupCollapsed("ThemeManager.getState()"), console.info({ props, baseName, base, min, max }), console.warn("result", { result }), console.trace(), console.groupEnd()), result;
2181
2054
  }
2182
- function isEqualShallow(prev, next) {
2183
- for (let key in next)
2184
- if (prev[key] !== next[key])
2185
- return !1;
2186
- return !0;
2055
+ var inverseThemeName = (themeName) => themeName.startsWith("light") ? themeName.replace(/^light/, "dark") : themeName.replace(/^dark/, "light");
2056
+ function getManagers(themeManager) {
2057
+ let comp = [], all = [], cur = themeManager;
2058
+ for (; cur; )
2059
+ all.push(cur), cur.state.isComponent && comp.push(cur), cur = cur.parentManager;
2060
+ return [all, comp];
2187
2061
  }
2188
2062
  }
2189
2063
  });
2190
2064
 
2191
- // ../web/dist/cjs/constants/accessibilityDirectMap.native.js
2192
- var require_accessibilityDirectMap_native = __commonJS({
2193
- "../web/dist/cjs/constants/accessibilityDirectMap.native.js"(exports2, module2) {
2065
+ // ../web/dist/cjs/helpers/ThemeManagerContext.native.js
2066
+ var require_ThemeManagerContext_native = __commonJS({
2067
+ "../web/dist/cjs/helpers/ThemeManagerContext.native.js"(exports2, module2) {
2194
2068
  "use strict";
2195
2069
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2196
2070
  for (var name in all)
@@ -2200,72 +2074,18 @@ var require_accessibilityDirectMap_native = __commonJS({
2200
2074
  for (let key of __getOwnPropNames2(from))
2201
2075
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2202
2076
  return to;
2203
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), accessibilityDirectMap_native_exports = {};
2204
- __export2(accessibilityDirectMap_native_exports, {
2205
- accessibilityDirectMap: () => accessibilityDirectMap,
2206
- accessibilityWebRoleToNativeRole: () => accessibilityWebRoleToNativeRole,
2207
- nativeAccessibilityState: () => nativeAccessibilityState,
2208
- nativeAccessibilityValue: () => nativeAccessibilityValue,
2209
- webToNativeAccessibilityDirectMap: () => webToNativeAccessibilityDirectMap
2077
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManagerContext_exports = {};
2078
+ __export2(ThemeManagerContext_exports, {
2079
+ ThemeManagerIDContext: () => ThemeManagerIDContext
2210
2080
  });
2211
- module2.exports = __toCommonJS2(accessibilityDirectMap_native_exports);
2212
- var accessibilityDirectMap = {}, webToNativeAccessibilityDirectMap = {
2213
- "aria-label": "accessibilityLabel",
2214
- "aria-labelledby": "accessibilityLabelledBy",
2215
- "aria-live": "accessibilityLiveRegion",
2216
- "aria-modal": "accessibilityViewIsModal",
2217
- "aria-hidden": "accessibilityElementsHidden"
2218
- }, nativeAccessibilityValue = {
2219
- "aria-valuemin": "min",
2220
- "aria-valuemax": "max",
2221
- "aria-valuenow": "now",
2222
- "aria-valuetext": "text"
2223
- }, nativeAccessibilityState = {
2224
- "aria-disabled": "disabled",
2225
- "aria-selected": "selected",
2226
- "aria-checked": "checked",
2227
- "aria-busy": "busy",
2228
- "aria-expanded": "expanded"
2229
- }, accessibilityWebRoleToNativeRole = {
2230
- alert: "alert",
2231
- button: "button",
2232
- checkbox: "checkbox",
2233
- combobox: "combobox",
2234
- grid: "grid",
2235
- group: "none",
2236
- heading: "header",
2237
- imagebutton: "imagebutton",
2238
- img: "image",
2239
- keyboardkey: "keyboardkey",
2240
- link: "link",
2241
- menu: "menu",
2242
- menubar: "menubar",
2243
- menuitem: "menuitem",
2244
- none: "none",
2245
- presentation: "none",
2246
- progressbar: "progressbar",
2247
- radio: "radio",
2248
- radiogroup: "radiogroup",
2249
- region: "summary",
2250
- scrollbar: "scrollbar",
2251
- searchbox: "search",
2252
- slider: "adjustable",
2253
- spinbutton: "spinbutton",
2254
- summary: "summary",
2255
- switch: "switch",
2256
- tab: "tab",
2257
- tablist: "tablist",
2258
- text: "text",
2259
- timer: "timer",
2260
- togglebutton: "togglebutton",
2261
- toolbar: "toolbar"
2262
- };
2081
+ module2.exports = __toCommonJS2(ThemeManagerContext_exports);
2082
+ var import_react3 = require("react"), ThemeManagerIDContext = (0, import_react3.createContext)(1);
2263
2083
  }
2264
2084
  });
2265
2085
 
2266
- // ../web/dist/cjs/constants/isDevTools.native.js
2267
- var require_isDevTools_native = __commonJS({
2268
- "../web/dist/cjs/constants/isDevTools.native.js"(exports2, module2) {
2086
+ // ../web/dist/cjs/hooks/useTheme.native.js
2087
+ var require_useTheme_native = __commonJS({
2088
+ "../web/dist/cjs/hooks/useTheme.native.js"(exports2, module2) {
2269
2089
  "use strict";
2270
2090
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2271
2091
  for (var name in all)
@@ -2275,27 +2095,260 @@ var require_isDevTools_native = __commonJS({
2275
2095
  for (let key of __getOwnPropNames2(from))
2276
2096
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2277
2097
  return to;
2278
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), isDevTools_exports = {};
2279
- __export2(isDevTools_exports, {
2280
- isDevTools: () => isDevTools
2098
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), useTheme_exports = {};
2099
+ __export2(useTheme_exports, {
2100
+ activeThemeManagers: () => activeThemeManagers,
2101
+ getThemeManager: () => getThemeManager,
2102
+ getThemeProxied: () => getThemeProxied,
2103
+ useChangeThemeEffect: () => useChangeThemeEffect,
2104
+ useTheme: () => useTheme,
2105
+ useThemeWithState: () => useThemeWithState
2281
2106
  });
2282
- module2.exports = __toCommonJS2(isDevTools_exports);
2283
- var isDevTools = (() => {
2284
- if (process.env.NODE_ENV === "development")
2285
- try {
2286
- return new Function("try {return this===window;}catch(e){ return false;}")();
2287
- } catch {
2107
+ module2.exports = __toCommonJS2(useTheme_exports);
2108
+ var import_constants = require_index_native3(), import_react3 = require("react"), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_createShallowSetState = require_createShallowSetState_native(), import_ThemeManager = require_ThemeManager_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), emptyProps = { name: null }, cached;
2109
+ function getDefaultThemeProxied() {
2110
+ if (cached)
2111
+ return cached;
2112
+ let config = (0, import_config.getConfig)(), name = config.themes.light ? "light" : Object.keys(config.themes)[0], defaultTheme = config.themes[name];
2113
+ return cached = getThemeProxied({ theme: defaultTheme, name }), cached;
2114
+ }
2115
+ var useTheme = (props = emptyProps) => {
2116
+ let [_, theme] = useThemeWithState(props);
2117
+ return theme || getDefaultThemeProxied();
2118
+ }, useThemeWithState = (props) => {
2119
+ let keys = (0, import_react3.useRef)([]), changedThemeState = useChangeThemeEffect(
2120
+ props,
2121
+ !1,
2122
+ keys.current,
2123
+ import_constants.isServer ? void 0 : () => {
2124
+ var _a, _b;
2125
+ let next = ((_a = props.shouldUpdate) == null ? void 0 : _a.call(props)) ?? (keys.current.length > 0 ? !0 : void 0);
2126
+ return process.env.NODE_ENV === "development" && typeof props.debug == "string" && props.debug !== "profile" && console.info(" \u{1F3A8} useTheme() shouldUpdate?", next, {
2127
+ shouldUpdateProp: (_b = props.shouldUpdate) == null ? void 0 : _b.call(props),
2128
+ keys: [...keys.current]
2129
+ }), next;
2130
+ }
2131
+ ), { themeManager, state } = changedThemeState;
2132
+ process.env.NODE_ENV === "development" && (state != null && state.theme || process.env.TAMAGUI_DISABLE_NO_THEME_WARNING !== "1" && console.warn(
2133
+ `[tamagui] No theme found, this could be due to an invalid theme name (given theme props ${JSON.stringify(
2134
+ props
2135
+ )}).
2136
+
2137
+ If this is intended and you are using Tamagui without any themes, you can disable this warning by setting the environment variable TAMAGUI_DISABLE_NO_THEME_WARNING=1`
2138
+ ));
2139
+ let themeProxied = (0, import_react3.useMemo)(() => !themeManager || !(state != null && state.theme) ? {} : getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug), [state == null ? void 0 : state.theme, themeManager, props.deopt, props.debug]);
2140
+ return process.env.NODE_ENV === "development" && props.debug === "verbose" && (console.groupCollapsed(" \u{1F539} useTheme =>", state == null ? void 0 : state.name), console.info("returning state", changedThemeState, "from props", props), console.groupEnd()), [changedThemeState, themeProxied];
2141
+ };
2142
+ function getThemeProxied({ theme, name, scheme }, deopt = !1, themeManager, keys, debug) {
2143
+ if (!theme)
2144
+ return {};
2145
+ let config = (0, import_config.getConfig)();
2146
+ function track(key) {
2147
+ keys && !keys.includes(key) && (keys.push(key), process.env.NODE_ENV === "development" && debug && console.info(` \u{1F3A8} useTheme() tracking new key: ${key}`));
2148
+ }
2149
+ return new Proxy(theme, {
2150
+ has(_, key) {
2151
+ if (Reflect.has(theme, key))
2152
+ return !0;
2153
+ if (typeof key == "string")
2154
+ return key[0] === "$" && (key = key.slice(1)), themeManager == null ? void 0 : themeManager.allKeys.has(key);
2155
+ },
2156
+ get(_, key) {
2157
+ if (
2158
+ // dont ask me, idk why but on hermes you can see that useTheme()[undefined] passes in STRING undefined to proxy
2159
+ // if someone is crazy enough to use "undefined" as a theme key then this not working is on them
2160
+ key !== "undefined" && typeof key == "string"
2161
+ ) {
2162
+ let keyString = key[0] === "$" ? key.slice(1) : key, val = theme[keyString];
2163
+ if (val && typeof val == "object")
2164
+ return new Proxy(val, {
2165
+ // when they touch the actual value we only track it
2166
+ // if its a variable (web), its ignored!
2167
+ get(_2, subkey) {
2168
+ if (subkey === "val")
2169
+ track(keyString);
2170
+ else if (subkey === "get")
2171
+ return (platform) => {
2172
+ let outVal = (0, import_createVariable.getVariable)(val);
2173
+ if (platform !== "web" && import_constants.isIos && !deopt && config.settings.fastSchemeChange && !someParentIsInversed(themeManager) && scheme) {
2174
+ let oppositeThemeName = name.replace(
2175
+ scheme === "dark" ? "dark" : "light",
2176
+ scheme === "dark" ? "light" : "dark"
2177
+ ), oppositeTheme = config.themes[oppositeThemeName], oppositeVal = (0, import_createVariable.getVariable)(oppositeTheme == null ? void 0 : oppositeTheme[keyString]);
2178
+ if (oppositeVal)
2179
+ return {
2180
+ dynamic: {
2181
+ dark: scheme === "dark" ? outVal : oppositeVal,
2182
+ light: scheme === "light" ? outVal : oppositeVal
2183
+ }
2184
+ };
2185
+ }
2186
+ return track(keyString), outVal;
2187
+ };
2188
+ return Reflect.get(val, subkey);
2189
+ }
2190
+ });
2191
+ if (process.env.NODE_ENV === "development" && process.env.TAMAGUI_FEAT_THROW_ON_MISSING_THEME_VALUE === "1")
2192
+ throw new Error(
2193
+ `[tamagui] No theme key "${key}" found in theme ${name}.
2194
+ Keys in theme: ${Object.keys(
2195
+ theme
2196
+ ).join(", ")}`
2197
+ );
2198
+ }
2199
+ return Reflect.get(_, key);
2200
+ }
2201
+ });
2202
+ }
2203
+ function someParentIsInversed(manager) {
2204
+ {
2205
+ let cur = manager;
2206
+ for (; cur; ) {
2207
+ if (!cur.parentManager)
2208
+ return !1;
2209
+ if (cur.parentManager.state.scheme !== cur.state.scheme)
2210
+ return !0;
2211
+ cur = cur.parentManager;
2288
2212
  }
2213
+ }
2289
2214
  return !1;
2290
- })();
2215
+ }
2216
+ var activeThemeManagers = /* @__PURE__ */ new Set(), _uidToManager = /* @__PURE__ */ new WeakMap(), _idToUID = {}, getId = (id) => _idToUID[id], getThemeManager = (id) => _uidToManager.get(getId(id)), registerThemeManager = (t) => {
2217
+ if (!_idToUID[t.id]) {
2218
+ let id = _idToUID[t.id] = {};
2219
+ _uidToManager.set(id, t);
2220
+ }
2221
+ }, useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
2222
+ let { disable } = props, parentManagerId = (0, import_react3.useContext)(import_ThemeManagerContext.ThemeManagerIDContext), parentManager = getThemeManager(parentManagerId);
2223
+ if (!isRoot && !parentManager || disable)
2224
+ return {
2225
+ isNewTheme: !1,
2226
+ state: parentManager == null ? void 0 : parentManager.state,
2227
+ themeManager: parentManager
2228
+ };
2229
+ let [themeState, setThemeState] = (0, import_react3.useState)(createState), { state, mounted, isNewTheme, themeManager, inversed } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
2230
+ function getShouldUpdateTheme(manager = themeManager, nextState, prevState = state, forceShouldChange = !1) {
2231
+ let forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
2232
+ if (!manager || !forceShouldChange && forceUpdate === !1)
2233
+ return;
2234
+ let next = nextState || manager.getState(props, parentManager);
2235
+ if (forceShouldChange || next && !(forceUpdate !== !0 && !manager.getStateShouldChange(next, prevState)))
2236
+ return next;
2237
+ }
2238
+ if (import_constants.isServer || ((0, import_react3.useEffect)(() => {
2239
+ if (!themeManager)
2240
+ return;
2241
+ if (props.inverse && !mounted) {
2242
+ setThemeState((prev) => createState({
2243
+ ...prev,
2244
+ mounted: !0
2245
+ }));
2246
+ return;
2247
+ }
2248
+ (isNewTheme || getShouldUpdateTheme(themeManager)) && (activeThemeManagers.add(themeManager), setThemeState(createState));
2249
+ let selfListenerDispose = themeManager.onChangeTheme((_a, _b, forced) => {
2250
+ forced && setThemeState((prev) => createState(prev, !0));
2251
+ }), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(
2252
+ (name, manager, forced) => {
2253
+ let force = forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"], shouldTryUpdate = force ?? !!(keys != null && keys.length || isNewTheme);
2254
+ process.env.NODE_ENV === "development" && props.debug === "verbose" && console.info(" \u{1F538} onChange", themeManager.id, {
2255
+ force,
2256
+ shouldTryUpdate,
2257
+ props,
2258
+ name,
2259
+ manager,
2260
+ keys
2261
+ }), shouldTryUpdate && setThemeState((prev) => createState(prev, force));
2262
+ },
2263
+ themeManager.id
2264
+ );
2265
+ return () => {
2266
+ selfListenerDispose(), disposeChangeListener == null || disposeChangeListener(), isNewTheme && activeThemeManagers.delete(themeManager);
2267
+ };
2268
+ }, [
2269
+ themeManager,
2270
+ parentManager,
2271
+ isNewTheme,
2272
+ props.componentName,
2273
+ props.inverse,
2274
+ props.name,
2275
+ props.reset,
2276
+ mounted
2277
+ ]), process.env.NODE_ENV === "development" && props.debug !== "profile" && (0, import_react3.useEffect)(() => (globalThis.TamaguiThemeManagers ??= /* @__PURE__ */ new Set(), globalThis.TamaguiThemeManagers.add(themeManager), () => {
2278
+ globalThis.TamaguiThemeManagers.delete(themeManager);
2279
+ }), [themeManager])), isInversingOnMount)
2280
+ return {
2281
+ isNewTheme: !1,
2282
+ inversed: !1,
2283
+ themeManager: parentManager,
2284
+ state: {
2285
+ name: "",
2286
+ ...parentManager == null ? void 0 : parentManager.state,
2287
+ className: ""
2288
+ }
2289
+ };
2290
+ return {
2291
+ state,
2292
+ isNewTheme,
2293
+ inversed,
2294
+ themeManager
2295
+ };
2296
+ function createState(prev, force = !1) {
2297
+ if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1 && !force)
2298
+ return prev;
2299
+ let themeManager2 = parentManager, state2;
2300
+ if ((0, import_ThemeManager.getHasThemeUpdatingProps)(props)) {
2301
+ let getNewThemeManager = () => new import_ThemeManager.ThemeManager(props, isRoot ? "root" : parentManager);
2302
+ if (prev != null && prev.themeManager) {
2303
+ themeManager2 = prev.themeManager;
2304
+ let forceChange = force || !!(keys != null && keys.length), next = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(
2305
+ themeManager2,
2306
+ next,
2307
+ prev.state,
2308
+ forceChange
2309
+ );
2310
+ nextState ? (state2 = nextState, prev.isNewTheme ? themeManager2.updateState(nextState) : themeManager2 = getNewThemeManager()) : prev.isNewTheme && parentManager && !next && (themeManager2 = parentManager);
2311
+ } else
2312
+ themeManager2 = getNewThemeManager(), state2 = { ...themeManager2.state };
2313
+ }
2314
+ let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse);
2315
+ isNewTheme2 && registerThemeManager(themeManager2);
2316
+ let mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
2317
+ state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
2318
+ let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed != null ? !1 : null, response = {
2319
+ themeManager: themeManager2,
2320
+ isNewTheme: isNewTheme2,
2321
+ mounted: mounted2,
2322
+ inversed: inversed2
2323
+ }, shouldReturnPrev = prev && !force && // isEqualShallow uses the second arg as the keys so this should compare without state first...
2324
+ (0, import_createShallowSetState.isEqualShallow)(prev, response) && // ... and then compare just the state, because we make a new state obj but is likely the same
2325
+ (0, import_createShallowSetState.isEqualShallow)(prev.state, state2);
2326
+ if (prev && shouldReturnPrev)
2327
+ return prev;
2328
+ if (response.state = state2, process.env.NODE_ENV === "development" && props.debug && import_constants.isClient) {
2329
+ console.groupCollapsed(` \u{1F537} ${themeManager2.id} useChangeThemeEffect createState`);
2330
+ let parentState = { ...parentManager == null ? void 0 : parentManager.state }, parentId = parentManager == null ? void 0 : parentManager.id, themeManagerState = { ...themeManager2.state };
2331
+ console.info({
2332
+ props,
2333
+ parentState,
2334
+ parentId,
2335
+ themeManager: themeManager2,
2336
+ prev,
2337
+ response,
2338
+ themeManagerState
2339
+ }), console.groupEnd();
2340
+ }
2341
+ return response;
2342
+ }
2343
+ };
2291
2344
  }
2292
2345
  });
2293
2346
 
2294
- // ../web/dist/cjs/helpers/getGroupPropParts.native.js
2295
- var require_getGroupPropParts_native = __commonJS({
2296
- "../web/dist/cjs/helpers/getGroupPropParts.native.js"(exports2, module2) {
2347
+ // ../web/dist/cjs/Tamagui.native.js
2348
+ var require_Tamagui_native = __commonJS({
2349
+ "../web/dist/cjs/Tamagui.native.js"(exports2, module2) {
2297
2350
  "use strict";
2298
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2351
+ var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2299
2352
  for (var name in all)
2300
2353
  __defProp2(target, name, { get: all[name], enumerable: !0 });
2301
2354
  }, __copyProps2 = (to, from, except, desc) => {
@@ -2303,24 +2356,61 @@ var require_getGroupPropParts_native = __commonJS({
2303
2356
  for (let key of __getOwnPropNames2(from))
2304
2357
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2305
2358
  return to;
2306
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), getGroupPropParts_exports = {};
2307
- __export2(getGroupPropParts_exports, {
2308
- getGroupPropParts: () => getGroupPropParts
2309
- });
2310
- module2.exports = __toCommonJS2(getGroupPropParts_exports);
2311
- var import_useMedia = require_useMedia_native();
2312
- function getGroupPropParts(groupProp) {
2313
- let mediaQueries = (0, import_useMedia.getMedia)(), [_, name, part3, part4] = groupProp.split("-"), pseudo, media = part3 in mediaQueries ? part3 : void 0;
2314
- return media ? pseudo = part4 : pseudo = part3, { name, pseudo, media };
2315
- }
2359
+ }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
2360
+ // If the importer is in node compatibility mode or this is not an ESM
2361
+ // file that has been converted to a CommonJS file using a Babel-
2362
+ // compatible transform (i.e. "__esModule" has not been set), then set
2363
+ // "default" to the CommonJS "module.exports" for node compatibility.
2364
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
2365
+ mod
2366
+ )), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Tamagui_exports = {};
2367
+ __export2(Tamagui_exports, {
2368
+ Tamagui: () => Tamagui,
2369
+ getValueFromIdentifier: () => getValueFromIdentifier,
2370
+ setIdentifierValue: () => setIdentifierValue
2371
+ });
2372
+ module2.exports = __toCommonJS2(Tamagui_exports);
2373
+ var Helpers = __toESM2(require_index_native4()), import_config = require_config_native(), import_insertStyleRule = require_insertStyleRule_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native(), Tamagui = (() => {
2374
+ if (process.env.NODE_ENV === "development") {
2375
+ class TamaguiManager {
2376
+ constructor() {
2377
+ this.Helpers = Helpers, this.getThemeManager = import_useTheme.getThemeManager;
2378
+ }
2379
+ get activeThemeManagers() {
2380
+ return import_useTheme.activeThemeManagers;
2381
+ }
2382
+ get mediaState() {
2383
+ return { ...import_useMedia.mediaState };
2384
+ }
2385
+ get config() {
2386
+ return (0, import_config.getConfig)();
2387
+ }
2388
+ get insertedRules() {
2389
+ return (0, import_insertStyleRule.getAllRules)();
2390
+ }
2391
+ get allSelectors() {
2392
+ return (0, import_insertStyleRule.getAllSelectors)();
2393
+ }
2394
+ get allTransforms() {
2395
+ return (0, import_insertStyleRule.getAllTransforms)();
2396
+ }
2397
+ get identifierToValue() {
2398
+ return identifierToValue;
2399
+ }
2400
+ }
2401
+ return new TamaguiManager();
2402
+ }
2403
+ })(), identifierToValue = /* @__PURE__ */ new Map(), getValueFromIdentifier = (identifier) => identifierToValue.get(identifier), setIdentifierValue = (identifier, value) => {
2404
+ identifierToValue.set(identifier, value);
2405
+ };
2316
2406
  }
2317
2407
  });
2318
2408
 
2319
- // ../web/dist/cjs/helpers/createMediaStyle.native.js
2320
- var require_createMediaStyle_native = __commonJS({
2321
- "../web/dist/cjs/helpers/createMediaStyle.native.js"(exports2, module2) {
2409
+ // ../compose-refs/dist/cjs/compose-refs.native.js
2410
+ var require_compose_refs_native = __commonJS({
2411
+ "../compose-refs/dist/cjs/compose-refs.native.js"(exports2, module2) {
2322
2412
  "use strict";
2323
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2413
+ var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2324
2414
  for (var name in all)
2325
2415
  __defProp2(target, name, { get: all[name], enumerable: !0 });
2326
2416
  }, __copyProps2 = (to, from, except, desc) => {
@@ -2328,166 +2418,521 @@ var require_createMediaStyle_native = __commonJS({
2328
2418
  for (let key of __getOwnPropNames2(from))
2329
2419
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2330
2420
  return to;
2331
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createMediaStyle_exports = {};
2332
- __export2(createMediaStyle_exports, {
2333
- MEDIA_SEP: () => MEDIA_SEP,
2334
- createMediaStyle: () => createMediaStyle
2421
+ }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
2422
+ // If the importer is in node compatibility mode or this is not an ESM
2423
+ // file that has been converted to a CommonJS file using a Babel-
2424
+ // compatible transform (i.e. "__esModule" has not been set), then set
2425
+ // "default" to the CommonJS "module.exports" for node compatibility.
2426
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
2427
+ mod
2428
+ )), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), compose_refs_exports = {};
2429
+ __export2(compose_refs_exports, {
2430
+ composeRefs: () => composeRefs,
2431
+ useComposedRefs: () => useComposedRefs
2335
2432
  });
2336
- module2.exports = __toCommonJS2(createMediaStyle_exports);
2337
- var import_config = require_config_native(), import_useMedia = require_useMedia_native(), import_getGroupPropParts = require_getGroupPropParts_native(), MEDIA_SEP = "_", prefixes = null, selectors = null, groupPseudoToPseudoCSSMap = {
2338
- press: "active"
2339
- }, createMediaStyle = (styleObject, mediaKeyIn, mediaQueries, type, negate, priority) => {
2340
- let { property, identifier, rules } = styleObject, conf = (0, import_config.getConfig)(), enableMediaPropOrder = conf.settings.mediaPropOrder, isTheme = type === "theme", isPlatform = type === "platform", isGroup = type === "group", isNonWindowMedia = isTheme || isPlatform || isGroup, negKey = negate ? "0" : "", ogPrefix = identifier.slice(0, identifier.indexOf("-") + 1), id = `${ogPrefix}${MEDIA_SEP}${mediaKeyIn.replace("-", "")}${negKey}${MEDIA_SEP}`, styleRule = "", groupMediaKey, containerName, nextIdentifier = identifier.replace(ogPrefix, id), styleInner = rules.map((rule) => rule.replace(identifier, nextIdentifier)).join(";");
2341
- if (isNonWindowMedia) {
2342
- let precedenceImportancePrefix = new Array((priority || 0) + (isGroup ? 1 : 0)).fill(":root").join("");
2343
- if (isTheme || isGroup) {
2344
- let groupInfo = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyIn), mediaName = groupInfo == null ? void 0 : groupInfo.name;
2345
- groupMediaKey = groupInfo == null ? void 0 : groupInfo.media, isGroup && (containerName = mediaName);
2346
- let name = (isGroup ? "group_" : "") + mediaName, selectorStart = styleInner.indexOf(":root"), selectorEnd = styleInner.lastIndexOf("{"), selector = styleInner.slice(selectorStart, selectorEnd), precedenceSpace = conf.themeClassNameOnRoot && isTheme ? "" : " ", pseudoSelectorName = groupInfo.pseudo ? groupPseudoToPseudoCSSMap[groupInfo.pseudo] || groupInfo.pseudo : void 0, pseudoSelector = pseudoSelectorName ? `:${pseudoSelectorName}` : "", presedencePrefix = `:root${precedenceImportancePrefix}${precedenceSpace}`, mediaSelector = `.t_${name}${pseudoSelector}`, nextSelector = `${presedencePrefix}${mediaSelector} ${selector.replace(
2347
- ":root",
2348
- ""
2349
- )}`;
2350
- styleRule = styleInner.replace(selector, nextSelector);
2351
- } else
2352
- styleRule = `${precedenceImportancePrefix}${styleInner}`;
2353
- }
2354
- if (!isNonWindowMedia || groupMediaKey) {
2355
- if (!selectors) {
2356
- let mediaKeys = Object.keys(mediaQueries);
2357
- selectors = Object.fromEntries(
2358
- mediaKeys.map((key) => [key, (0, import_useMedia.mediaObjectToString)(mediaQueries[key])])
2359
- ), enableMediaPropOrder || (prefixes = Object.fromEntries(
2360
- mediaKeys.map((k, index) => [k, new Array(index + 1).fill(":root").join("")])
2361
- ));
2362
- }
2363
- let mediaKey = groupMediaKey || mediaKeyIn, mediaSelector = selectors[mediaKey], mediaQuery = `${negate ? "not all and " : ""}${mediaSelector}`, precedenceImportancePrefix = groupMediaKey ? "" : enableMediaPropOrder ? (
2364
- // this new array should be cached
2365
- new Array(priority).fill(":root").join("")
2366
- ) : (
2367
- // @ts-ignore
2368
- prefixes[mediaKey]
2369
- ), prefix = groupMediaKey ? `@container ${containerName}` : "@media";
2370
- groupMediaKey && (styleInner = styleRule), styleInner.includes(prefix) ? styleRule = styleInner.replace("{", ` and ${mediaQuery} {`).replace("and screen and", "and") : styleRule = `${prefix} ${mediaQuery}{${precedenceImportancePrefix}${styleInner}}`, groupMediaKey && (styleRule = `@supports (contain: ${conf.settings.webContainerType || "inline-size"}) {${styleRule}}`);
2371
- }
2372
- return {
2373
- property,
2374
- rules: [styleRule],
2375
- identifier: nextIdentifier
2376
- };
2377
- };
2433
+ module2.exports = __toCommonJS2(compose_refs_exports);
2434
+ var React = __toESM2(require("react"));
2435
+ function setRef(ref, value) {
2436
+ typeof ref == "function" ? ref(value) : ref && (ref.current = value);
2437
+ }
2438
+ function composeRefs(...refs) {
2439
+ return (node) => refs.forEach((ref) => setRef(ref, node));
2440
+ }
2441
+ function useComposedRefs(...refs) {
2442
+ return React.useCallback(composeRefs(...refs), refs);
2443
+ }
2378
2444
  }
2379
2445
  });
2380
2446
 
2381
- // ../../node_modules/@react-native/normalize-color/index.js
2382
- var require_normalize_color = __commonJS({
2383
- "../../node_modules/@react-native/normalize-color/index.js"(exports2, module2) {
2447
+ // ../compose-refs/dist/cjs/index.native.js
2448
+ var require_index_native5 = __commonJS({
2449
+ "../compose-refs/dist/cjs/index.native.js"(exports2, module2) {
2384
2450
  "use strict";
2385
- function normalizeColor(color) {
2386
- if (typeof color == "number")
2387
- return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null;
2388
- if (typeof color != "string")
2389
- return null;
2390
- let matchers = getMatchers(), match;
2391
- if (match = matchers.hex6.exec(color))
2392
- return parseInt(match[1] + "ff", 16) >>> 0;
2393
- let colorFromKeyword = normalizeKeyword(color);
2394
- return colorFromKeyword ?? ((match = matchers.rgb.exec(color)) ? (parse255(match[1]) << 24 | // r
2395
- parse255(match[2]) << 16 | // g
2396
- parse255(match[3]) << 8 | // b
2397
- 255) >>> // a
2398
- 0 : (match = matchers.rgba.exec(color)) ? match[6] !== void 0 ? (parse255(match[6]) << 24 | // r
2399
- parse255(match[7]) << 16 | // g
2400
- parse255(match[8]) << 8 | // b
2401
- parse1(match[9])) >>> // a
2402
- 0 : (parse255(match[2]) << 24 | // r
2403
- parse255(match[3]) << 16 | // g
2404
- parse255(match[4]) << 8 | // b
2405
- parse1(match[5])) >>> // a
2406
- 0 : (match = matchers.hex3.exec(color)) ? parseInt(
2407
- match[1] + match[1] + // r
2408
- match[2] + match[2] + // g
2409
- match[3] + match[3] + // b
2410
- "ff",
2411
- // a
2412
- 16
2413
- ) >>> 0 : (match = matchers.hex8.exec(color)) ? parseInt(match[1], 16) >>> 0 : (match = matchers.hex4.exec(color)) ? parseInt(
2414
- match[1] + match[1] + // r
2415
- match[2] + match[2] + // g
2416
- match[3] + match[3] + // b
2417
- match[4] + match[4],
2418
- // a
2419
- 16
2420
- ) >>> 0 : (match = matchers.hsl.exec(color)) ? (hslToRgb(
2421
- parse360(match[1]),
2422
- // h
2423
- parsePercentage(match[2]),
2424
- // s
2425
- parsePercentage(match[3])
2426
- // l
2427
- ) | 255) >>> // a
2428
- 0 : (match = matchers.hsla.exec(color)) ? match[6] !== void 0 ? (hslToRgb(
2429
- parse360(match[6]),
2430
- // h
2431
- parsePercentage(match[7]),
2432
- // s
2433
- parsePercentage(match[8])
2434
- // l
2435
- ) | parse1(match[9])) >>> // a
2436
- 0 : (hslToRgb(
2437
- parse360(match[2]),
2438
- // h
2439
- parsePercentage(match[3]),
2440
- // s
2441
- parsePercentage(match[4])
2442
- // l
2443
- ) | parse1(match[5])) >>> // a
2444
- 0 : (match = matchers.hwb.exec(color)) ? (hwbToRgb(
2445
- parse360(match[1]),
2446
- // h
2447
- parsePercentage(match[2]),
2448
- // w
2449
- parsePercentage(match[3])
2450
- // b
2451
- ) | 255) >>> // a
2452
- 0 : null);
2453
- }
2454
- function hue2rgb(p, q, t) {
2455
- return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? p + (q - p) * 6 * t : t < 1 / 2 ? q : t < 2 / 3 ? p + (q - p) * (2 / 3 - t) * 6 : p;
2451
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __copyProps2 = (to, from, except, desc) => {
2452
+ if (from && typeof from == "object" || typeof from == "function")
2453
+ for (let key of __getOwnPropNames2(from))
2454
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2455
+ return to;
2456
+ }, __reExport2 = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), src_exports2 = {};
2457
+ module2.exports = __toCommonJS2(src_exports2);
2458
+ __reExport2(src_exports2, require_compose_refs_native(), module2.exports);
2459
+ }
2460
+ });
2461
+
2462
+ // ../use-did-finish-ssr/dist/cjs/index.native.js
2463
+ var require_index_native6 = __commonJS({
2464
+ "../use-did-finish-ssr/dist/cjs/index.native.js"(exports2, module2) {
2465
+ "use strict";
2466
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2467
+ for (var name in all)
2468
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2469
+ }, __copyProps2 = (to, from, except, desc) => {
2470
+ if (from && typeof from == "object" || typeof from == "function")
2471
+ for (let key of __getOwnPropNames2(from))
2472
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2473
+ return to;
2474
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), src_exports2 = {};
2475
+ __export2(src_exports2, {
2476
+ useClientValue: () => useClientValue,
2477
+ useDidFinishSSR: () => useDidFinishSSR
2478
+ });
2479
+ module2.exports = __toCommonJS2(src_exports2);
2480
+ var import_react3 = require("react");
2481
+ function useDidFinishSSR(value) {
2482
+ return value ?? !0;
2456
2483
  }
2457
- function hslToRgb(h, s, l) {
2458
- let q = l < 0.5 ? l * (1 + s) : l + s - l * s, p = 2 * l - q, r = hue2rgb(p, q, h + 1 / 3), g = hue2rgb(p, q, h), b = hue2rgb(p, q, h - 1 / 3);
2459
- return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
2484
+ function useClientValue(value) {
2485
+ return useDidFinishSSR() ? typeof value == "function" ? value() : value : void 0;
2460
2486
  }
2461
- function hwbToRgb(h, w, b) {
2462
- if (w + b >= 1) {
2463
- let gray = Math.round(w * 255 / (w + b));
2464
- return gray << 24 | gray << 16 | gray << 8;
2487
+ }
2488
+ });
2489
+
2490
+ // ../web/dist/cjs/helpers/objectIdentityKey.native.js
2491
+ var require_objectIdentityKey_native = __commonJS({
2492
+ "../web/dist/cjs/helpers/objectIdentityKey.native.js"(exports2, module2) {
2493
+ "use strict";
2494
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2495
+ for (var name in all)
2496
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2497
+ }, __copyProps2 = (to, from, except, desc) => {
2498
+ if (from && typeof from == "object" || typeof from == "function")
2499
+ for (let key of __getOwnPropNames2(from))
2500
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2501
+ return to;
2502
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), objectIdentityKey_exports = {};
2503
+ __export2(objectIdentityKey_exports, {
2504
+ objectIdentityKey: () => objectIdentityKey
2505
+ });
2506
+ module2.exports = __toCommonJS2(objectIdentityKey_exports);
2507
+ function objectIdentityKey(obj) {
2508
+ let k = "";
2509
+ for (let key in obj) {
2510
+ k += key;
2511
+ let arg = obj[key], type = typeof arg;
2512
+ if (!arg || type !== "object" && type !== "function")
2513
+ k += type + arg;
2514
+ else if (cache.has(arg))
2515
+ k += cache.get(arg);
2516
+ else {
2517
+ let v = Math.random();
2518
+ cache.set(arg, v), k += v;
2519
+ }
2465
2520
  }
2466
- let red = hue2rgb(0, 1, h + 1 / 3) * (1 - w - b) + w, green = hue2rgb(0, 1, h) * (1 - w - b) + w, blue = hue2rgb(0, 1, h - 1 / 3) * (1 - w - b) + w;
2467
- return Math.round(red * 255) << 24 | Math.round(green * 255) << 16 | Math.round(blue * 255) << 8;
2521
+ return k;
2468
2522
  }
2469
- var NUMBER = "[-+]?\\d*\\.?\\d+", PERCENTAGE = NUMBER + "%";
2470
- function call(...args) {
2471
- return "\\(\\s*(" + args.join(")\\s*,?\\s*(") + ")\\s*\\)";
2472
- }
2473
- function callWithSlashSeparator(...args) {
2474
- return "\\(\\s*(" + args.slice(0, args.length - 1).join(")\\s*,?\\s*(") + ")\\s*/\\s*(" + args[args.length - 1] + ")\\s*\\)";
2523
+ var cache = /* @__PURE__ */ new WeakMap();
2524
+ }
2525
+ });
2526
+
2527
+ // ../web/dist/cjs/helpers/createStyledContext.native.js
2528
+ var require_createStyledContext_native = __commonJS({
2529
+ "../web/dist/cjs/helpers/createStyledContext.native.js"(exports2, module2) {
2530
+ "use strict";
2531
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2532
+ for (var name in all)
2533
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2534
+ }, __copyProps2 = (to, from, except, desc) => {
2535
+ if (from && typeof from == "object" || typeof from == "function")
2536
+ for (let key of __getOwnPropNames2(from))
2537
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2538
+ return to;
2539
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createStyledContext_exports = {};
2540
+ __export2(createStyledContext_exports, {
2541
+ createStyledContext: () => createStyledContext
2542
+ });
2543
+ module2.exports = __toCommonJS2(createStyledContext_exports);
2544
+ var import_react3 = require("react"), import_objectIdentityKey = require_objectIdentityKey_native(), import_jsx_runtime = require("react/jsx-runtime");
2545
+ function createStyledContext(defaultValues) {
2546
+ let OGContext = (0, import_react3.createContext)(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map(), Provider = ({
2547
+ children,
2548
+ scope,
2549
+ ...values
2550
+ }) => {
2551
+ let next = (0, import_react3.useMemo)(() => ({
2552
+ // this ! is a workaround for ts error
2553
+ ...defaultValues,
2554
+ ...values
2555
+ }), [(0, import_objectIdentityKey.objectIdentityKey)(values)]), Provider2 = OGProvider;
2556
+ if (scope) {
2557
+ let ScopedContext = scopedContexts.get(scope);
2558
+ ScopedContext || (ScopedContext = (0, import_react3.createContext)(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
2559
+ }
2560
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, { value: next, children });
2561
+ }, useStyledContext = (scope) => {
2562
+ let context = scope ? scopedContexts.get(scope) : OGContext;
2563
+ return (0, import_react3.useContext)(context);
2564
+ };
2565
+ return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
2475
2566
  }
2476
- function commaSeparatedCall(...args) {
2477
- return "\\(\\s*(" + args.join(")\\s*,\\s*(") + ")\\s*\\)";
2567
+ }
2568
+ });
2569
+
2570
+ // ../web/dist/cjs/contexts/ComponentContext.native.js
2571
+ var require_ComponentContext_native = __commonJS({
2572
+ "../web/dist/cjs/contexts/ComponentContext.native.js"(exports2, module2) {
2573
+ "use strict";
2574
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2575
+ for (var name in all)
2576
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2577
+ }, __copyProps2 = (to, from, except, desc) => {
2578
+ if (from && typeof from == "object" || typeof from == "function")
2579
+ for (let key of __getOwnPropNames2(from))
2580
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2581
+ return to;
2582
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ComponentContext_exports = {};
2583
+ __export2(ComponentContext_exports, {
2584
+ ComponentContext: () => ComponentContext
2585
+ });
2586
+ module2.exports = __toCommonJS2(ComponentContext_exports);
2587
+ var import_createStyledContext = require_createStyledContext_native(), ComponentContext = (0, import_createStyledContext.createStyledContext)({
2588
+ disableSSR: void 0,
2589
+ inText: !1,
2590
+ language: null,
2591
+ animationDriver: null,
2592
+ groups: {
2593
+ emit: null,
2594
+ subscribe: null,
2595
+ state: {}
2596
+ }
2597
+ });
2598
+ }
2599
+ });
2600
+
2601
+ // ../web/dist/cjs/defaultComponentState.native.js
2602
+ var require_defaultComponentState_native = __commonJS({
2603
+ "../web/dist/cjs/defaultComponentState.native.js"(exports2, module2) {
2604
+ "use strict";
2605
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2606
+ for (var name in all)
2607
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2608
+ }, __copyProps2 = (to, from, except, desc) => {
2609
+ if (from && typeof from == "object" || typeof from == "function")
2610
+ for (let key of __getOwnPropNames2(from))
2611
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2612
+ return to;
2613
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), defaultComponentState_exports = {};
2614
+ __export2(defaultComponentState_exports, {
2615
+ defaultComponentState: () => defaultComponentState,
2616
+ defaultComponentStateMounted: () => defaultComponentStateMounted,
2617
+ defaultComponentStateShouldEnter: () => defaultComponentStateShouldEnter
2618
+ });
2619
+ module2.exports = __toCommonJS2(defaultComponentState_exports);
2620
+ var defaultComponentState = {
2621
+ hover: !1,
2622
+ press: !1,
2623
+ pressIn: !1,
2624
+ focus: !1,
2625
+ unmounted: !0
2626
+ }, defaultComponentStateMounted = {
2627
+ ...defaultComponentState,
2628
+ unmounted: !1
2629
+ }, defaultComponentStateShouldEnter = {
2630
+ ...defaultComponentState,
2631
+ unmounted: "should-enter"
2632
+ };
2633
+ }
2634
+ });
2635
+
2636
+ // ../web/dist/cjs/constants/accessibilityDirectMap.native.js
2637
+ var require_accessibilityDirectMap_native = __commonJS({
2638
+ "../web/dist/cjs/constants/accessibilityDirectMap.native.js"(exports2, module2) {
2639
+ "use strict";
2640
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2641
+ for (var name in all)
2642
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2643
+ }, __copyProps2 = (to, from, except, desc) => {
2644
+ if (from && typeof from == "object" || typeof from == "function")
2645
+ for (let key of __getOwnPropNames2(from))
2646
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2647
+ return to;
2648
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), accessibilityDirectMap_native_exports = {};
2649
+ __export2(accessibilityDirectMap_native_exports, {
2650
+ accessibilityDirectMap: () => accessibilityDirectMap,
2651
+ accessibilityWebRoleToNativeRole: () => accessibilityWebRoleToNativeRole,
2652
+ nativeAccessibilityState: () => nativeAccessibilityState,
2653
+ nativeAccessibilityValue: () => nativeAccessibilityValue,
2654
+ webToNativeAccessibilityDirectMap: () => webToNativeAccessibilityDirectMap
2655
+ });
2656
+ module2.exports = __toCommonJS2(accessibilityDirectMap_native_exports);
2657
+ var accessibilityDirectMap = {}, webToNativeAccessibilityDirectMap = {
2658
+ "aria-label": "accessibilityLabel",
2659
+ "aria-labelledby": "accessibilityLabelledBy",
2660
+ "aria-live": "accessibilityLiveRegion",
2661
+ "aria-modal": "accessibilityViewIsModal",
2662
+ "aria-hidden": "accessibilityElementsHidden"
2663
+ }, nativeAccessibilityValue = {
2664
+ "aria-valuemin": "min",
2665
+ "aria-valuemax": "max",
2666
+ "aria-valuenow": "now",
2667
+ "aria-valuetext": "text"
2668
+ }, nativeAccessibilityState = {
2669
+ "aria-disabled": "disabled",
2670
+ "aria-selected": "selected",
2671
+ "aria-checked": "checked",
2672
+ "aria-busy": "busy",
2673
+ "aria-expanded": "expanded"
2674
+ }, accessibilityWebRoleToNativeRole = {
2675
+ alert: "alert",
2676
+ button: "button",
2677
+ checkbox: "checkbox",
2678
+ combobox: "combobox",
2679
+ grid: "grid",
2680
+ group: "none",
2681
+ heading: "header",
2682
+ imagebutton: "imagebutton",
2683
+ img: "image",
2684
+ keyboardkey: "keyboardkey",
2685
+ link: "link",
2686
+ menu: "menu",
2687
+ menubar: "menubar",
2688
+ menuitem: "menuitem",
2689
+ none: "none",
2690
+ presentation: "none",
2691
+ progressbar: "progressbar",
2692
+ radio: "radio",
2693
+ radiogroup: "radiogroup",
2694
+ region: "summary",
2695
+ scrollbar: "scrollbar",
2696
+ searchbox: "search",
2697
+ slider: "adjustable",
2698
+ spinbutton: "spinbutton",
2699
+ summary: "summary",
2700
+ switch: "switch",
2701
+ tab: "tab",
2702
+ tablist: "tablist",
2703
+ text: "text",
2704
+ timer: "timer",
2705
+ togglebutton: "togglebutton",
2706
+ toolbar: "toolbar"
2707
+ };
2708
+ }
2709
+ });
2710
+
2711
+ // ../web/dist/cjs/constants/isDevTools.native.js
2712
+ var require_isDevTools_native = __commonJS({
2713
+ "../web/dist/cjs/constants/isDevTools.native.js"(exports2, module2) {
2714
+ "use strict";
2715
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2716
+ for (var name in all)
2717
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2718
+ }, __copyProps2 = (to, from, except, desc) => {
2719
+ if (from && typeof from == "object" || typeof from == "function")
2720
+ for (let key of __getOwnPropNames2(from))
2721
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2722
+ return to;
2723
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), isDevTools_exports = {};
2724
+ __export2(isDevTools_exports, {
2725
+ isDevTools: () => isDevTools
2726
+ });
2727
+ module2.exports = __toCommonJS2(isDevTools_exports);
2728
+ var isDevTools = (() => {
2729
+ if (process.env.NODE_ENV === "development")
2730
+ try {
2731
+ return new Function("try {return this===window;}catch(e){ return false;}")();
2732
+ } catch {
2733
+ }
2734
+ return !1;
2735
+ })();
2736
+ }
2737
+ });
2738
+
2739
+ // ../web/dist/cjs/helpers/getGroupPropParts.native.js
2740
+ var require_getGroupPropParts_native = __commonJS({
2741
+ "../web/dist/cjs/helpers/getGroupPropParts.native.js"(exports2, module2) {
2742
+ "use strict";
2743
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2744
+ for (var name in all)
2745
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2746
+ }, __copyProps2 = (to, from, except, desc) => {
2747
+ if (from && typeof from == "object" || typeof from == "function")
2748
+ for (let key of __getOwnPropNames2(from))
2749
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2750
+ return to;
2751
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), getGroupPropParts_exports = {};
2752
+ __export2(getGroupPropParts_exports, {
2753
+ getGroupPropParts: () => getGroupPropParts
2754
+ });
2755
+ module2.exports = __toCommonJS2(getGroupPropParts_exports);
2756
+ var import_useMedia = require_useMedia_native();
2757
+ function getGroupPropParts(groupProp) {
2758
+ let mediaQueries = (0, import_useMedia.getMedia)(), [_, name, part3, part4] = groupProp.split("-"), pseudo, media = part3 in mediaQueries ? part3 : void 0;
2759
+ return media ? pseudo = part4 : pseudo = part3, { name, pseudo, media };
2478
2760
  }
2479
- var cachedMatchers;
2480
- function getMatchers() {
2481
- return cachedMatchers === void 0 && (cachedMatchers = {
2482
- rgb: new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER)),
2483
- rgba: new RegExp(
2484
- "rgba(" + commaSeparatedCall(NUMBER, NUMBER, NUMBER, NUMBER) + "|" + callWithSlashSeparator(NUMBER, NUMBER, NUMBER, NUMBER) + ")"
2485
- ),
2486
- hsl: new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE)),
2487
- hsla: new RegExp(
2488
- "hsla(" + commaSeparatedCall(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER) + "|" + callWithSlashSeparator(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER) + ")"
2489
- ),
2490
- hwb: new RegExp("hwb" + call(NUMBER, PERCENTAGE, PERCENTAGE)),
2761
+ }
2762
+ });
2763
+
2764
+ // ../web/dist/cjs/helpers/createMediaStyle.native.js
2765
+ var require_createMediaStyle_native = __commonJS({
2766
+ "../web/dist/cjs/helpers/createMediaStyle.native.js"(exports2, module2) {
2767
+ "use strict";
2768
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2769
+ for (var name in all)
2770
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2771
+ }, __copyProps2 = (to, from, except, desc) => {
2772
+ if (from && typeof from == "object" || typeof from == "function")
2773
+ for (let key of __getOwnPropNames2(from))
2774
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2775
+ return to;
2776
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createMediaStyle_exports = {};
2777
+ __export2(createMediaStyle_exports, {
2778
+ MEDIA_SEP: () => MEDIA_SEP,
2779
+ createMediaStyle: () => createMediaStyle
2780
+ });
2781
+ module2.exports = __toCommonJS2(createMediaStyle_exports);
2782
+ var import_config = require_config_native(), import_useMedia = require_useMedia_native(), import_getGroupPropParts = require_getGroupPropParts_native(), MEDIA_SEP = "_", prefixes = null, selectors = null, groupPseudoToPseudoCSSMap = {
2783
+ press: "active"
2784
+ }, createMediaStyle = (styleObject, mediaKeyIn, mediaQueries, type, negate, priority) => {
2785
+ let { property, identifier, rules } = styleObject, conf = (0, import_config.getConfig)(), enableMediaPropOrder = conf.settings.mediaPropOrder, isTheme = type === "theme", isPlatform = type === "platform", isGroup = type === "group", isNonWindowMedia = isTheme || isPlatform || isGroup, negKey = negate ? "0" : "", ogPrefix = identifier.slice(0, identifier.indexOf("-") + 1), id = `${ogPrefix}${MEDIA_SEP}${mediaKeyIn.replace("-", "")}${negKey}${MEDIA_SEP}`, styleRule = "", groupMediaKey, containerName, nextIdentifier = identifier.replace(ogPrefix, id), styleInner = rules.map((rule) => rule.replace(identifier, nextIdentifier)).join(";");
2786
+ if (isNonWindowMedia) {
2787
+ let precedenceImportancePrefix = new Array((priority || 0) + (isGroup ? 1 : 0)).fill(":root").join("");
2788
+ if (isTheme || isGroup) {
2789
+ let groupInfo = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyIn), mediaName = groupInfo == null ? void 0 : groupInfo.name;
2790
+ groupMediaKey = groupInfo == null ? void 0 : groupInfo.media, isGroup && (containerName = mediaName);
2791
+ let name = (isGroup ? "group_" : "") + mediaName, selectorStart = styleInner.indexOf(":root"), selectorEnd = styleInner.lastIndexOf("{"), selector = styleInner.slice(selectorStart, selectorEnd), precedenceSpace = conf.themeClassNameOnRoot && isTheme ? "" : " ", pseudoSelectorName = groupInfo.pseudo ? groupPseudoToPseudoCSSMap[groupInfo.pseudo] || groupInfo.pseudo : void 0, pseudoSelector = pseudoSelectorName ? `:${pseudoSelectorName}` : "", presedencePrefix = `:root${precedenceImportancePrefix}${precedenceSpace}`, mediaSelector = `.t_${name}${pseudoSelector}`, nextSelector = `${presedencePrefix}${mediaSelector} ${selector.replace(
2792
+ ":root",
2793
+ ""
2794
+ )}`;
2795
+ styleRule = styleInner.replace(selector, nextSelector);
2796
+ } else
2797
+ styleRule = `${precedenceImportancePrefix}${styleInner}`;
2798
+ }
2799
+ if (!isNonWindowMedia || groupMediaKey) {
2800
+ if (!selectors) {
2801
+ let mediaKeys = Object.keys(mediaQueries);
2802
+ selectors = Object.fromEntries(
2803
+ mediaKeys.map((key) => [key, (0, import_useMedia.mediaObjectToString)(mediaQueries[key])])
2804
+ ), enableMediaPropOrder || (prefixes = Object.fromEntries(
2805
+ mediaKeys.map((k, index) => [k, new Array(index + 1).fill(":root").join("")])
2806
+ ));
2807
+ }
2808
+ let mediaKey = groupMediaKey || mediaKeyIn, mediaSelector = selectors[mediaKey], mediaQuery = `${negate ? "not all and " : ""}${mediaSelector}`, precedenceImportancePrefix = groupMediaKey ? "" : enableMediaPropOrder ? (
2809
+ // this new array should be cached
2810
+ new Array(priority).fill(":root").join("")
2811
+ ) : (
2812
+ // @ts-ignore
2813
+ prefixes[mediaKey]
2814
+ ), prefix = groupMediaKey ? `@container ${containerName}` : "@media";
2815
+ groupMediaKey && (styleInner = styleRule), styleInner.includes(prefix) ? styleRule = styleInner.replace("{", ` and ${mediaQuery} {`).replace("and screen and", "and") : styleRule = `${prefix} ${mediaQuery}{${precedenceImportancePrefix}${styleInner}}`, groupMediaKey && (styleRule = `@supports (contain: ${conf.settings.webContainerType || "inline-size"}) {${styleRule}}`);
2816
+ }
2817
+ return {
2818
+ property,
2819
+ rules: [styleRule],
2820
+ identifier: nextIdentifier
2821
+ };
2822
+ };
2823
+ }
2824
+ });
2825
+
2826
+ // ../../node_modules/@react-native/normalize-color/index.js
2827
+ var require_normalize_color = __commonJS({
2828
+ "../../node_modules/@react-native/normalize-color/index.js"(exports2, module2) {
2829
+ "use strict";
2830
+ function normalizeColor(color) {
2831
+ if (typeof color == "number")
2832
+ return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null;
2833
+ if (typeof color != "string")
2834
+ return null;
2835
+ let matchers = getMatchers(), match;
2836
+ if (match = matchers.hex6.exec(color))
2837
+ return parseInt(match[1] + "ff", 16) >>> 0;
2838
+ let colorFromKeyword = normalizeKeyword(color);
2839
+ return colorFromKeyword ?? ((match = matchers.rgb.exec(color)) ? (parse255(match[1]) << 24 | // r
2840
+ parse255(match[2]) << 16 | // g
2841
+ parse255(match[3]) << 8 | // b
2842
+ 255) >>> // a
2843
+ 0 : (match = matchers.rgba.exec(color)) ? match[6] !== void 0 ? (parse255(match[6]) << 24 | // r
2844
+ parse255(match[7]) << 16 | // g
2845
+ parse255(match[8]) << 8 | // b
2846
+ parse1(match[9])) >>> // a
2847
+ 0 : (parse255(match[2]) << 24 | // r
2848
+ parse255(match[3]) << 16 | // g
2849
+ parse255(match[4]) << 8 | // b
2850
+ parse1(match[5])) >>> // a
2851
+ 0 : (match = matchers.hex3.exec(color)) ? parseInt(
2852
+ match[1] + match[1] + // r
2853
+ match[2] + match[2] + // g
2854
+ match[3] + match[3] + // b
2855
+ "ff",
2856
+ // a
2857
+ 16
2858
+ ) >>> 0 : (match = matchers.hex8.exec(color)) ? parseInt(match[1], 16) >>> 0 : (match = matchers.hex4.exec(color)) ? parseInt(
2859
+ match[1] + match[1] + // r
2860
+ match[2] + match[2] + // g
2861
+ match[3] + match[3] + // b
2862
+ match[4] + match[4],
2863
+ // a
2864
+ 16
2865
+ ) >>> 0 : (match = matchers.hsl.exec(color)) ? (hslToRgb(
2866
+ parse360(match[1]),
2867
+ // h
2868
+ parsePercentage(match[2]),
2869
+ // s
2870
+ parsePercentage(match[3])
2871
+ // l
2872
+ ) | 255) >>> // a
2873
+ 0 : (match = matchers.hsla.exec(color)) ? match[6] !== void 0 ? (hslToRgb(
2874
+ parse360(match[6]),
2875
+ // h
2876
+ parsePercentage(match[7]),
2877
+ // s
2878
+ parsePercentage(match[8])
2879
+ // l
2880
+ ) | parse1(match[9])) >>> // a
2881
+ 0 : (hslToRgb(
2882
+ parse360(match[2]),
2883
+ // h
2884
+ parsePercentage(match[3]),
2885
+ // s
2886
+ parsePercentage(match[4])
2887
+ // l
2888
+ ) | parse1(match[5])) >>> // a
2889
+ 0 : (match = matchers.hwb.exec(color)) ? (hwbToRgb(
2890
+ parse360(match[1]),
2891
+ // h
2892
+ parsePercentage(match[2]),
2893
+ // w
2894
+ parsePercentage(match[3])
2895
+ // b
2896
+ ) | 255) >>> // a
2897
+ 0 : null);
2898
+ }
2899
+ function hue2rgb(p, q, t) {
2900
+ return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? p + (q - p) * 6 * t : t < 1 / 2 ? q : t < 2 / 3 ? p + (q - p) * (2 / 3 - t) * 6 : p;
2901
+ }
2902
+ function hslToRgb(h, s, l) {
2903
+ let q = l < 0.5 ? l * (1 + s) : l + s - l * s, p = 2 * l - q, r = hue2rgb(p, q, h + 1 / 3), g = hue2rgb(p, q, h), b = hue2rgb(p, q, h - 1 / 3);
2904
+ return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
2905
+ }
2906
+ function hwbToRgb(h, w, b) {
2907
+ if (w + b >= 1) {
2908
+ let gray = Math.round(w * 255 / (w + b));
2909
+ return gray << 24 | gray << 16 | gray << 8;
2910
+ }
2911
+ let red = hue2rgb(0, 1, h + 1 / 3) * (1 - w - b) + w, green = hue2rgb(0, 1, h) * (1 - w - b) + w, blue = hue2rgb(0, 1, h - 1 / 3) * (1 - w - b) + w;
2912
+ return Math.round(red * 255) << 24 | Math.round(green * 255) << 16 | Math.round(blue * 255) << 8;
2913
+ }
2914
+ var NUMBER = "[-+]?\\d*\\.?\\d+", PERCENTAGE = NUMBER + "%";
2915
+ function call(...args) {
2916
+ return "\\(\\s*(" + args.join(")\\s*,?\\s*(") + ")\\s*\\)";
2917
+ }
2918
+ function callWithSlashSeparator(...args) {
2919
+ return "\\(\\s*(" + args.slice(0, args.length - 1).join(")\\s*,?\\s*(") + ")\\s*/\\s*(" + args[args.length - 1] + ")\\s*\\)";
2920
+ }
2921
+ function commaSeparatedCall(...args) {
2922
+ return "\\(\\s*(" + args.join(")\\s*,\\s*(") + ")\\s*\\)";
2923
+ }
2924
+ var cachedMatchers;
2925
+ function getMatchers() {
2926
+ return cachedMatchers === void 0 && (cachedMatchers = {
2927
+ rgb: new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER)),
2928
+ rgba: new RegExp(
2929
+ "rgba(" + commaSeparatedCall(NUMBER, NUMBER, NUMBER, NUMBER) + "|" + callWithSlashSeparator(NUMBER, NUMBER, NUMBER, NUMBER) + ")"
2930
+ ),
2931
+ hsl: new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE)),
2932
+ hsla: new RegExp(
2933
+ "hsla(" + commaSeparatedCall(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER) + "|" + callWithSlashSeparator(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER) + ")"
2934
+ ),
2935
+ hwb: new RegExp("hwb" + call(NUMBER, PERCENTAGE, PERCENTAGE)),
2491
2936
  hex3: /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
2492
2937
  hex4: /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
2493
2938
  hex6: /^#([0-9a-fA-F]{6})$/,
@@ -3287,784 +3732,232 @@ var require_propMapper_native = __commonJS({
3287
3732
  getPropMappedFontFamily: () => getPropMappedFontFamily,
3288
3733
  getTokenForKey: () => getTokenForKey,
3289
3734
  propMapper: () => propMapper
3290
- });
3291
- module2.exports = __toCommonJS2(propMapper_exports);
3292
- var import_constants = require_index_native3(), import_helpers = require_index_native4(), import_config = require_config_native(), import_isDevTools = require_isDevTools_native(), import_createVariable = require_createVariable_native(), import_expandStyle = require_expandStyle_native(), import_expandStylesAndRemoveNullishValues = require_expandStylesAndRemoveNullishValues_native(), import_getVariantExtras = require_getVariantExtras_native(), import_isObj = require_isObj_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), propMapper = (key, value, styleStateIn, subPropsIn) => {
3293
- var _a;
3294
- if (lastFontFamilyToken = null, !import_constants.isAndroid && key === "elevationAndroid")
3295
- return;
3296
- if (value === "unset") {
3297
- let unsetVal = (_a = styleStateIn.conf.unset) == null ? void 0 : _a[key];
3298
- if (unsetVal != null)
3299
- value = unsetVal;
3300
- else
3301
- return;
3302
- }
3303
- let subProps = styleStateIn.styleProps.fallbackProps || subPropsIn, styleState = subProps ? new Proxy(styleStateIn, {
3304
- get(_, k) {
3305
- return k === "curProps" ? subProps : Reflect.get(_, k);
3306
- }
3307
- }) : styleStateIn, { conf, styleProps, fontFamily, staticConfig } = styleState, { variants } = staticConfig;
3308
- if (process.env.NODE_ENV === "development" && fontFamily && fontFamily[0] === "$" && !(fontFamily in conf.fontsParsed) && console.warn(
3309
- `Warning: no fontFamily "${fontFamily}" found in config: ${Object.keys(
3310
- conf.fontsParsed
3311
- ).join(", ")}`
3312
- ), !styleProps.noExpand && variants && key in variants) {
3313
- styleState.curProps[key] = value;
3314
- let variantValue = resolveVariants(key, value, styleProps, styleState, "");
3315
- if (variantValue)
3316
- return variantValue;
3317
- }
3318
- let shouldReturn = !1;
3319
- if (styleProps.disableExpandShorthands || key in conf.shorthands && (shouldReturn = !0, key = conf.shorthands[key]), value && (value[0] === "$" ? value = getTokenForKey(key, value, styleProps.resolveValues, styleState) : (0, import_createVariable.isVariable)(value) && (value = resolveVariableValue(key, value, styleProps.resolveValues))), shouldReturn || value != null) {
3320
- let result = (styleProps.noExpand ? null : (0, import_expandStyle.expandStyle)(key, value)) || [
3321
- [key, value]
3322
- ];
3323
- return key === "fontFamily" && lastFontFamilyToken && fontFamilyCache.set(result, lastFontFamilyToken), result;
3324
- }
3325
- }, resolveVariants = (key, value, styleProps, styleState, parentVariantKey) => {
3326
- let { staticConfig, conf, debug } = styleState, { variants } = staticConfig;
3327
- if (!variants)
3328
- return;
3329
- let variantValue = getVariantDefinition(variants[key], value, conf);
3330
- if (process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(`\u2666\uFE0F\u2666\uFE0F\u2666\uFE0F resolve variant ${key}`), console.info({
3331
- key,
3332
- value,
3333
- variantValue,
3334
- variants,
3335
- curProps: { ...styleState.curProps }
3336
- }), console.groupEnd()), !variantValue) {
3337
- if (process.env.TAMAGUI_WARN_ON_MISSING_VARIANT === "1" && typeof value != "boolean") {
3338
- let name = staticConfig.componentName || "[UnnamedComponent]";
3339
- console.warn(
3340
- `No variant found: ${name} has variant "${key}", but no matching value "${value}"`
3341
- );
3342
- }
3343
- return;
3344
- }
3345
- if (typeof variantValue == "function") {
3346
- let fn = variantValue, extras = (0, import_getVariantExtras.getVariantExtras)(styleState);
3347
- variantValue = fn(value, extras), process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(" expanded functional variant", key), console.info({ fn, variantValue, extras }), console.groupEnd());
3348
- }
3349
- let fontFamilyResult;
3350
- if ((0, import_isObj.isObj)(variantValue)) {
3351
- let fontFamilyUpdate = variantValue.fontFamily || variantValue[conf.inverseShorthands.fontFamily];
3352
- fontFamilyUpdate && (fontFamilyResult = getFontFamilyFromNameOrVariable(fontFamilyUpdate, conf), styleState.fontFamily = fontFamilyResult, process.env.NODE_ENV === "development" && debug === "verbose" && console.info(" updating font family", fontFamilyResult)), variantValue = resolveTokensAndVariants(
3353
- key,
3354
- variantValue,
3355
- styleProps,
3356
- styleState,
3357
- parentVariantKey
3358
- );
3359
- }
3360
- if (variantValue) {
3361
- let expanded = (0, import_expandStylesAndRemoveNullishValues.expandStylesAndRemoveNullishValues)(
3362
- variantValue,
3363
- !!styleProps.noNormalize
3364
- ), next = Object.entries(expanded);
3365
- return fontFamilyResult && fontFamilyResult[0] === "$" && fontFamilyCache.set(next, (0, import_createVariable.getVariableValue)(fontFamilyResult)), next;
3366
- }
3367
- };
3368
- function getFontFamilyFromNameOrVariable(input, conf) {
3369
- if ((0, import_createVariable.isVariable)(input)) {
3370
- let val = variableToFontNameCache.get(input);
3371
- if (val)
3372
- return val;
3373
- for (let key in conf.fontsParsed) {
3374
- let familyVariable = conf.fontsParsed[key].family;
3375
- if ((0, import_createVariable.isVariable)(familyVariable) && (variableToFontNameCache.set(familyVariable, key), familyVariable === input))
3376
- return key;
3377
- }
3378
- } else if (typeof input == "string" && input[0] === "$")
3379
- return input;
3380
- }
3381
- var variableToFontNameCache = /* @__PURE__ */ new WeakMap(), fontFamilyCache = /* @__PURE__ */ new WeakMap(), getPropMappedFontFamily = (expanded) => expanded && fontFamilyCache.get(expanded), resolveTokensAndVariants = (key, value, styleProps, styleState, parentVariantKey) => {
3382
- var _a;
3383
- let { conf, staticConfig, debug, theme } = styleState, { variants } = staticConfig, res = {};
3384
- process.env.NODE_ENV === "development" && debug === "verbose" && console.info(" - resolveTokensAndVariants", key, value);
3385
- for (let _key in value) {
3386
- let subKey = conf.shorthands[_key] || _key, val = value[_key];
3387
- if (styleProps.noExpand)
3388
- res[subKey] = val;
3389
- else if (variants && subKey in variants) {
3390
- if (styleState.curProps[subKey] = val, parentVariantKey && parentVariantKey === key)
3391
- res[subKey] = // SYNC WITH *1
3392
- val[0] === "$" ? getTokenForKey(subKey, val, styleProps.resolveValues, styleState) : val;
3393
- else {
3394
- let variantOut = resolveVariants(subKey, val, styleProps, styleState, key);
3395
- if (variantOut)
3396
- for (let [key2, val2] of variantOut)
3397
- val2 != null && (key2 in import_pseudoDescriptors.pseudoDescriptors ? (res[key2] ??= {}, Object.assign(res[key2], val2)) : res[key2] = val2);
3398
- }
3399
- continue;
3400
- }
3401
- if ((0, import_createVariable.isVariable)(val)) {
3402
- res[subKey] = resolveVariableValue(subKey, val, styleProps.resolveValues);
3403
- continue;
3404
- }
3405
- if (typeof val == "string") {
3406
- let fVal = (
3407
- // SYNC WITH *1
3408
- val[0] === "$" ? getTokenForKey(subKey, val, styleProps.resolveValues, styleState) : val
3409
- );
3410
- res[subKey] = fVal;
3411
- continue;
3412
- }
3413
- if ((0, import_isObj.isObj)(val)) {
3414
- let subObject = resolveTokensAndVariants(subKey, val, styleProps, styleState, key);
3415
- process.env.NODE_ENV === "development" && debug === "verbose" && console.info("object", subKey, subObject), res[subKey] ??= {}, Object.assign(res[subKey], subObject);
3416
- } else
3417
- res[subKey] = val;
3418
- process.env.NODE_ENV === "development" && debug && ((_a = res[subKey]) == null ? void 0 : _a[0]) === "$" && console.warn(
3419
- `\u26A0\uFE0F Missing token in theme ${theme.name}:`,
3420
- subKey,
3421
- res[subKey],
3422
- theme
3423
- );
3424
- }
3425
- return res;
3426
- }, tokenCats = ["size", "color", "radius", "space", "zIndex"].map((name) => ({
3427
- name,
3428
- spreadName: `...${name}`
3429
- }));
3430
- function getVariantDefinition(variant, value, conf) {
3431
- if (typeof variant == "function")
3432
- return variant;
3433
- let exact = variant[value];
3434
- if (exact)
3435
- return exact;
3436
- if (value != null) {
3437
- let { tokensParsed } = conf;
3438
- for (let { name, spreadName } of tokenCats)
3439
- if (spreadName in variant && value in tokensParsed[name])
3440
- return variant[spreadName];
3441
- let fontSizeVariant = variant["...fontSize"];
3442
- if (fontSizeVariant && conf.fontSizeTokens.has(value))
3443
- return fontSizeVariant;
3444
- }
3445
- return variant[`:${typeof value}`] || variant["..."];
3446
- }
3447
- var fontShorthand = {
3448
- fontSize: "size",
3449
- fontWeight: "weight"
3450
- }, lastFontFamilyToken = null, getTokenForKey = (key, value, resolveAs = "none", styleState) => {
3451
- var _a, _b, _c, _d;
3452
- if (resolveAs === "none")
3453
- return value;
3454
- let { theme, conf = (0, import_config.getConfig)(), context, fontFamily, staticConfig } = styleState, tokensParsed = conf.tokensParsed, valOrVar, hasSet = !1;
3455
- if (theme && value in theme)
3456
- valOrVar = theme[value], process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info(` - resolving ${key} to theme value ${value}: ${(_a = valOrVar == null ? void 0 : valOrVar.get) == null ? void 0 : _a.call(valOrVar)}`), hasSet = !0;
3457
- else if (value in conf.specificTokens)
3458
- hasSet = !0, valOrVar = conf.specificTokens[value];
3459
- else {
3460
- let customTokenAccept = (_b = staticConfig == null ? void 0 : staticConfig.acceptTokens) == null ? void 0 : _b[key];
3461
- if (customTokenAccept) {
3462
- let val = tokensParsed[customTokenAccept][value];
3463
- val && (valOrVar = val, hasSet = !0);
3464
- } else {
3465
- switch (key) {
3466
- case "fontFamily": {
3467
- valOrVar = ((_c = (context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed)[value]) == null ? void 0 : _c.family) || value, lastFontFamilyToken = value, hasSet = !0;
3468
- break;
3469
- }
3470
- case "fontSize":
3471
- case "lineHeight":
3472
- case "letterSpacing":
3473
- case "fontWeight": {
3474
- let defaultFont = conf.defaultFont || "$body", fam = fontFamily || defaultFont;
3475
- if (fam) {
3476
- let fontsParsed = context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed, font = fontsParsed[fam] || fontsParsed[defaultFont];
3477
- valOrVar = ((_d = font == null ? void 0 : font[fontShorthand[key] || key]) == null ? void 0 : _d[value]) || value, hasSet = !0;
3478
- }
3479
- break;
3480
- }
3481
- }
3482
- for (let cat in import_helpers.tokenCategories)
3483
- if (key in import_helpers.tokenCategories[cat]) {
3484
- let res = tokensParsed[cat][value];
3485
- res != null && (valOrVar = res, hasSet = !0);
3486
- }
3487
- }
3488
- if (!hasSet) {
3489
- let spaceVar = tokensParsed.space[value];
3490
- spaceVar != null && (valOrVar = spaceVar, hasSet = !0);
3491
- }
3492
- }
3493
- if (hasSet) {
3494
- let out = resolveVariableValue(key, valOrVar, resolveAs);
3495
- return process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info("resolved", resolveAs, valOrVar, out), out;
3496
- }
3497
- return process.env.NODE_ENV === "development" && import_isDevTools.isDevTools && styleState.debug === "verbose" && (console.groupCollapsed(" \uFE52 propMap (val)", key, value), console.info({ valOrVar, theme, hasSet }, theme ? theme[key] : ""), console.groupEnd()), value;
3498
- };
3499
- function resolveVariableValue(key, valOrVar, resolveValues) {
3500
- if (resolveValues === "none")
3501
- return valOrVar;
3502
- if ((0, import_createVariable.isVariable)(valOrVar)) {
3503
- if (resolveValues === "value")
3504
- return valOrVar.val;
3505
- let get = valOrVar == null ? void 0 : valOrVar.get;
3506
- return key !== "shadowColor" && typeof get == "function" ? get(resolveValues === "web" ? "web" : void 0) : valOrVar.val;
3507
- }
3508
- return valOrVar;
3509
- }
3510
- }
3511
- });
3512
-
3513
- // ../web/dist/cjs/helpers/getSplitStyles.native.js
3514
- var require_getSplitStyles_native = __commonJS({
3515
- "../web/dist/cjs/helpers/getSplitStyles.native.js"(exports2, module2) {
3516
- "use strict";
3517
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
3518
- for (var name in all)
3519
- __defProp2(target, name, { get: all[name], enumerable: !0 });
3520
- }, __copyProps2 = (to, from, except, desc) => {
3521
- if (from && typeof from == "object" || typeof from == "function")
3522
- for (let key of __getOwnPropNames2(from))
3523
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
3524
- return to;
3525
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), getSplitStyles_exports = {};
3526
- __export2(getSplitStyles_exports, {
3527
- PROP_SPLIT: () => PROP_SPLIT,
3528
- getSplitStyles: () => getSplitStyles,
3529
- getSubStyle: () => getSubStyle,
3530
- useSplitStyles: () => useSplitStyles
3531
- });
3532
- module2.exports = __toCommonJS2(getSplitStyles_exports);
3533
- var import_constants = require_index_native3(), import_helpers = require_index_native4(), import_react3 = require("react"), import_config = require_config_native(), import_accessibilityDirectMap = require_accessibilityDirectMap_native(), import_constants2 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_useMedia = require_useMedia_native(), import_createMediaStyle = require_createMediaStyle_native(), import_expandStyles = require_expandStyles_native(), import_getGroupPropParts = require_getGroupPropParts_native(), import_getStylesAtomic = require_getStylesAtomic_native(), import_insertStyleRule = require_insertStyleRule_native(), import_log = require_log_native(), import_normalizeValueWithProperty = require_normalizeValueWithProperty_native(), import_propMapper = require_propMapper_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), IS_STATIC = process.env.IS_STATIC === "is_static", conf, PROP_SPLIT = "-";
3534
- function isValidStyleKey(key, staticConfig) {
3535
- let validStyleProps = staticConfig.validStyles ?? (staticConfig.isText ? import_helpers.stylePropsText : import_helpers.validStyles);
3536
- return key in validStyleProps || staticConfig.acceptTokens && key in staticConfig.acceptTokens;
3537
- }
3538
- var getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
3539
- var _a, _b, _c, _e, _f, _g;
3540
- conf = conf || (0, import_config.getConfig)(), import_constants.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
3541
- let { shorthands } = conf, {
3542
- isHOC,
3543
- isText,
3544
- variants,
3545
- isReactNative,
3546
- inlineProps,
3547
- inlineWhenUnflattened,
3548
- parentStaticConfig,
3549
- acceptsClassName
3550
- } = staticConfig, viewProps = {}, mediaState2 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants.isWeb && !styleProps.noClassNames, rulesToInsert = [], classNames = {}, transforms = {}, pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, style = {}, className = props.className ?? "", mediaStylesSeen = 0, styleState = {
3551
- curProps: { ...props },
3552
- classNames,
3553
- conf,
3554
- props,
3555
- styleProps,
3556
- componentState,
3557
- staticConfig,
3558
- style,
3559
- theme,
3560
- usedKeys,
3561
- viewProps,
3562
- context,
3563
- debug
3564
- };
3565
- process.env.NODE_ENV === "development" && debug && debug !== "profile" && import_constants.isClient && (console.groupCollapsed("getSplitStyles (collapsed)"), (0, import_log.log)({
3566
- props,
3567
- staticConfig,
3568
- shouldDoClasses,
3569
- styleProps,
3570
- componentState,
3571
- styleState,
3572
- theme: { ...theme }
3573
- }), console.groupEnd());
3574
- for (let keyOg in props) {
3575
- let keyInit = keyOg, valInit = props[keyOg];
3576
- if (styleProps.disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || keyInit in skipProps && !styleProps.noSkip && !isHOC)
3577
- continue;
3578
- let valInitType = typeof valInit, isValidStyleKeyInit = isValidStyleKey(keyInit, staticConfig);
3579
- if (styleState.curProps[keyInit] = valInit, !import_constants.isAndroid && keyInit === "elevationAndroid")
3580
- continue;
3581
- if (keyInit === "userSelect")
3582
- keyInit = "selectable", valInit = valInit !== "none";
3583
- else if (keyInit === "role") {
3584
- viewProps.accessibilityRole = import_accessibilityDirectMap.accessibilityWebRoleToNativeRole[valInit];
3585
- continue;
3586
- } else if (keyInit.startsWith("aria-")) {
3587
- if (import_accessibilityDirectMap.webToNativeAccessibilityDirectMap[keyInit]) {
3588
- let nativeA11yProp = import_accessibilityDirectMap.webToNativeAccessibilityDirectMap[keyInit];
3589
- keyInit === "aria-hidden" && (viewProps["aria-hidden"] = valInit), viewProps[nativeA11yProp] = valInit;
3590
- continue;
3591
- }
3592
- if (import_accessibilityDirectMap.nativeAccessibilityValue[keyInit]) {
3593
- let field = import_accessibilityDirectMap.nativeAccessibilityValue[keyInit];
3594
- viewProps.accessibilityValue ? viewProps.accessibilityValue[field] = valInit : viewProps.accessibilityValue = {
3595
- [field]: valInit
3596
- };
3597
- } else if (import_accessibilityDirectMap.nativeAccessibilityState[keyInit]) {
3598
- let field = import_accessibilityDirectMap.nativeAccessibilityState[keyInit];
3599
- viewProps.accessibilityState ? viewProps.accessibilityState[field] = valInit : viewProps.accessibilityState = {
3600
- [field]: valInit
3601
- };
3602
- }
3603
- continue;
3604
- } else if (keyInit.startsWith("data-"))
3605
- continue;
3606
- if (keyInit === "dataSet") {
3607
- for (let keyInit2 in valInit)
3608
- viewProps[`data-${hyphenate(keyInit2)}`] = valInit[keyInit2];
3609
- continue;
3610
- }
3611
- if (keyInit[0] === "_" && keyInit.startsWith("_style")) {
3612
- mergeStylePropIntoStyle(styleState, valInit);
3613
- continue;
3614
- }
3615
- if (0)
3616
- switch (keyInit) {
3617
- case "accessibilityRole":
3618
- case "accessibilityLabelledBy":
3619
- case "accessibilityFlowTo":
3620
- case "accessibilityControls":
3621
- case "accessibilityDescribedBy":
3622
- case "accessibilityKeyShortcuts":
3623
- case "accessibilityLiveRegion":
3624
- case "accessibilityReadOnly":
3625
- case "accessibilityRequired":
3626
- default:
3627
- }
3628
- let isShorthand = keyInit in shorthands, isVariant = !isValidStyleKeyInit && variants && keyInit in variants, isStyleLikeKey = isShorthand || isValidStyleKeyInit || isVariant, isPseudo = keyInit in import_helpers.validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo && (0, import_useMedia.isMediaKey)(keyInit), isMediaOrPseudo = !!(isMedia || isPseudo), isStyleProp = isMediaOrPseudo || isVariant && !styleProps.noExpand || isValidStyleKeyInit || isShorthand;
3629
- if (isStyleProp && (props.asChild === "except-style" || props.asChild === "except-style-web"))
3630
- continue;
3631
- let shouldPassProp = !isStyleProp || // is in parent variants
3632
- isHOC && (parentStaticConfig == null ? void 0 : parentStaticConfig.variants) && keyInit in parentStaticConfig.variants || (inlineProps == null ? void 0 : inlineProps.has(keyInit)), parentVariant = (_a = parentStaticConfig == null ? void 0 : parentStaticConfig.variants) == null ? void 0 : _a[keyInit], isHOCShouldPassThrough = !!(isHOC && (isShorthand || isValidStyleKeyInit || isMediaOrPseudo || parentVariant || keyInit in skipProps)), shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
3633
- if (process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(
3634
- `\u{1F539}\u{1F539}\u{1F539}\u{1F539} ${keyOg}${keyInit !== keyOg ? ` (shorthand for ${keyInit})` : ""} ${shouldPassThrough ? "(pass)" : ""} \u{1F539}\u{1F539}\u{1F539}\u{1F539}`
3635
- ), (0, import_log.log)({ isVariant, valInit, shouldPassProp }), import_constants.isClient && (0, import_log.log)({
3636
- variants,
3637
- variant: variants == null ? void 0 : variants[keyInit],
3638
- isVariant,
3639
- isHOCShouldPassThrough,
3640
- curProps: { ...styleState.curProps },
3641
- parentStaticConfig
3642
- }), console.groupEnd()), shouldPassThrough && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo), !isVariant) || !styleProps.noSkip && keyInit in skipProps)
3643
- continue;
3644
- if (isText && valInit && (keyInit === "fontFamily" || keyInit === shorthands.fontFamily) && valInit in conf.fontsParsed && (styleState.fontFamily = valInit), isValidStyleKeyInit && !variants && valInit !== "unset" && (valInitType === "number" || valInitType === "string" && valInit[0] !== "$")) {
3645
- style[keyInit] = valInit;
3646
- continue;
3647
- }
3648
- let expanded = isMediaOrPseudo || !isVariant && !isValidStyleKeyInit ? [[keyInit, valInit]] : (0, import_propMapper.propMapper)(keyInit, valInit, styleState), next = (0, import_propMapper.getPropMappedFontFamily)(expanded);
3649
- if (next && (styleState.fontFamily = next), process.env.NODE_ENV === "development" && debug === "verbose") {
3650
- console.groupCollapsed(" \u{1F4A0} expanded", keyInit, valInit);
3651
- try {
3652
- !import_constants.isServer && import_isDevTools.isDevTools && ((0, import_log.log)({
3653
- expanded,
3654
- styleProps,
3655
- componentState,
3656
- isVariant,
3657
- variant: variants == null ? void 0 : variants[keyInit],
3658
- shouldPassProp,
3659
- isHOCShouldPassThrough,
3660
- theme,
3661
- usedKeys: { ...usedKeys },
3662
- curProps: { ...styleState.curProps }
3663
- }), (0, import_log.log)("expanded", expanded, `
3664
- usedKeys`, { ...usedKeys }, `
3665
- current`, {
3666
- ...style
3667
- }));
3668
- } catch {
3669
- }
3670
- console.groupEnd();
3671
- }
3672
- if (expanded) {
3673
- for (let [key, val] of expanded)
3674
- if (!(val == null || key in usedKeys)) {
3675
- if (isPseudo = key in import_helpers.validPseudoKeys, isMedia = !isPseudo && !isValidStyleKeyInit && (0, import_useMedia.isMediaKey)(key), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key in variants, (inlineProps != null && inlineProps.has(key) || IS_STATIC && inlineWhenUnflattened != null && inlineWhenUnflattened.has(key)) && (viewProps[key] = props[key] ?? val), styleProps.noExpand && isPseudo || isHOC && (isMediaOrPseudo || ((_b = parentStaticConfig == null ? void 0 : parentStaticConfig.variants) == null ? void 0 : _b[keyInit]))) {
3676
- passDownProp(viewProps, key, val, isMediaOrPseudo), process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(` - passing down prop ${key}`), (0, import_log.log)({ val, after: { ...viewProps[key] } }), console.groupEnd());
3677
- continue;
3678
- }
3679
- if (isPseudo) {
3680
- if (!val)
3681
- continue;
3682
- let pseudoStyleObject = getSubStyle(
3683
- styleState,
3684
- key,
3685
- val,
3686
- styleProps.noClassNames
3687
- ), descriptor = import_pseudoDescriptors.pseudoDescriptors[key], isEnter = key === "enterStyle", isExit = key === "exitStyle";
3688
- if (!descriptor || isExit && !styleProps.isExiting)
3689
- continue;
3690
- if ((!shouldDoClasses || IS_STATIC) && (pseudos ||= {}, pseudos[key] ||= {}, IS_STATIC)) {
3691
- Object.assign(pseudos[key], pseudoStyleObject);
3692
- continue;
3693
- }
3694
- if (shouldDoClasses && !isExit) {
3695
- let pseudoStyles = (0, import_getStylesAtomic.generateAtomicStyles)(pseudoStyleObject, descriptor);
3696
- process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed("pseudo (classes)", key), (0, import_log.log)({ pseudoStyleObject, pseudoStyles }), console.groupEnd());
3697
- for (let psuedoStyle of pseudoStyles)
3698
- `${psuedoStyle.property}${PROP_SPLIT}${descriptor.name}` in usedKeys || psuedoStyle.identifier;
3699
- }
3700
- if (!shouldDoClasses || isExit || isEnter) {
3701
- let descriptorKey = descriptor.stateKey || descriptor.name, isDisabled = componentState[descriptorKey] === !1;
3702
- isExit && (isDisabled = !styleProps.isExiting), isEnter && (isDisabled = componentState.unmounted === "should-enter" ? !0 : !componentState.unmounted), process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed("pseudo", key, { isDisabled }), (0, import_log.log)({ pseudoStyleObject, isDisabled, descriptor, componentState }), console.groupEnd());
3703
- let importance = descriptor.priority;
3704
- for (let pkey in pseudoStyleObject) {
3705
- let val2 = pseudoStyleObject[pkey];
3706
- if (isDisabled) {
3707
- if (pkey in animatableDefaults && !(pkey in usedKeys)) {
3708
- let defaultVal = animatableDefaults[pkey];
3709
- mergeStyle(styleState, pkey, defaultVal);
3710
- }
3711
- } else {
3712
- let curImportance = usedKeys[pkey] || 0, shouldMerge = importance >= curImportance;
3713
- shouldMerge && (pseudos ||= {}, pseudos[key] ||= {}, pseudos[key][pkey] = val2, mergeStyle(styleState, pkey, val2)), process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(" subKey", pkey, shouldMerge, {
3714
- importance,
3715
- curImportance,
3716
- pkey,
3717
- val: val2,
3718
- transforms: { ...styleState.transforms }
3719
- });
3720
- }
3721
- }
3722
- if (!isDisabled)
3723
- for (let key2 in val) {
3724
- let k = shorthands[key2] || key2;
3725
- usedKeys[k] = Math.max(importance, usedKeys[k] || 0);
3726
- }
3727
- }
3728
- continue;
3729
- }
3730
- if (isMedia) {
3731
- if (!val)
3732
- continue;
3733
- if (isMedia === "platform") {
3734
- let platform = key.slice(10);
3735
- if (
3736
- // supports web, ios, android
3737
- platform !== import_constants.currentPlatform && // supports web, native
3738
- platform !== "native"
3739
- )
3740
- continue;
3741
- }
3742
- hasMedia ||= !0;
3743
- let mediaStyle = getSubStyle(
3744
- styleState,
3745
- key,
3746
- val,
3747
- // TODO try true like pseudo
3748
- !1
3749
- ), mediaKeyShort = key.slice(1);
3750
- process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(` \u{1F4FA} ${key}`, {
3751
- key,
3752
- val,
3753
- mediaStyle,
3754
- props,
3755
- shouldDoClasses,
3756
- componentState
3757
- });
3758
- let hasSpace = val.space;
3759
- if ((hasSpace || !shouldDoClasses) && (Array.isArray(hasMedia) || (hasMedia = []), hasMedia.push(mediaKeyShort)), shouldDoClasses) {
3760
- if (hasSpace && (delete mediaStyle.space, mediaState2[mediaKeyShort])) {
3761
- let importance = (0, import_useMedia.getMediaImportanceIfMoreImportant)(
3762
- mediaKeyShort,
3763
- "space",
3764
- usedKeys,
3765
- !0
3766
- );
3767
- importance && (space = val.space, usedKeys.space = importance, process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(
3768
- `Found more important space for current media ${mediaKeyShort}: ${val} (importance: ${importance})`
3769
- ));
3770
- }
3771
- let mediaStyles = (0, import_getStylesAtomic.getStylesAtomic)(mediaStyle, debug), priority = mediaStylesSeen;
3772
- mediaStylesSeen += 1;
3773
- for (let style2 of mediaStyles) {
3774
- let out = (0, import_createMediaStyle.createMediaStyle)(
3775
- style2,
3776
- mediaKeyShort,
3777
- import_useMedia.mediaQueryConfig,
3778
- isMedia,
3779
- !1,
3780
- priority
3781
- );
3782
- process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)("\u{1F4FA} media style:", out), `${style2.property}${PROP_SPLIT}${mediaKeyShort}` in usedKeys || out.identifier;
3783
- }
3784
- } else {
3785
- let isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group";
3786
- if (!isThemeMedia && isMedia !== "platform" && !isGroupMedia && !mediaState2[mediaKeyShort])
3787
- continue;
3788
- let importanceBump = 0;
3789
- if (isThemeMedia) {
3790
- dynamicThemeAccess = !0;
3791
- let mediaThemeName = mediaKeyShort.slice(6);
3792
- if (!(themeName === mediaThemeName || themeName.startsWith(mediaThemeName)))
3793
- continue;
3794
- } else if (isGroupMedia) {
3795
- let groupInfo = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyShort), groupName = groupInfo.name, groupContext = context == null ? void 0 : context.groups.state[groupName];
3796
- if (!groupContext) {
3797
- process.env.NODE_ENV === "development" && debug && console.warn(`No parent with group prop, skipping styles: ${groupName}`);
3798
- continue;
3799
- }
3800
- let groupPseudoKey = groupInfo.pseudo, groupMediaKey = groupInfo.media, componentGroupState = (_c = componentState.group) == null ? void 0 : _c[groupName];
3801
- if (groupMediaKey) {
3802
- mediaGroups ||= /* @__PURE__ */ new Set(), mediaGroups.add(groupMediaKey);
3803
- let mediaState22 = componentGroupState == null ? void 0 : componentGroupState.media, isActive = mediaState22 == null ? void 0 : mediaState22[groupMediaKey];
3804
- if (!mediaState22 && groupContext.layout && (isActive = (0, import_useMedia.mediaKeyMatch)(groupMediaKey, groupContext.layout)), !isActive)
3805
- continue;
3806
- importanceBump = 2;
3807
- }
3808
- if (groupPseudoKey) {
3809
- pseudoGroups ||= /* @__PURE__ */ new Set(), pseudoGroups.add(groupName);
3810
- let componentGroupPseudoState = (componentGroupState || // fallback to context initially
3811
- context.groups.state[groupName]).pseudo;
3812
- if (!(componentGroupPseudoState != null && componentGroupPseudoState[groupPseudoKey]))
3813
- continue;
3814
- importanceBump = import_pseudoDescriptors.pseudoPriorities[groupPseudoKey];
3815
- }
3816
- }
3817
- for (let subKey in mediaStyle) {
3818
- if (subKey === "space") {
3819
- space = valInit.space;
3820
- continue;
3821
- }
3822
- (0, import_useMedia.mergeMediaByImportance)(
3823
- style,
3824
- mediaKeyShort,
3825
- subKey,
3826
- mediaStyle[subKey],
3827
- usedKeys,
3828
- mediaState2[mediaKeyShort],
3829
- importanceBump
3830
- ), key === "fontFamily" && (styleState.fontFamily = mediaStyle.fontFamily);
3831
- }
3832
- }
3833
- continue;
3834
- }
3835
- if (key === "pointerEvents") {
3836
- viewProps[key] = val;
3837
- continue;
3838
- }
3839
- if (
3840
- // is HOC we can just pass through the styles as props
3841
- // this fixes issues where style prop got merged with wrong priority
3842
- !isHOC && (isValidStyleKey(key, staticConfig) || import_constants.isAndroid && key === "elevation")
3843
- ) {
3844
- mergeStyle(styleState, key, val);
3845
- continue;
3846
- }
3847
- isVariant || (viewProps[key] = val);
3848
- }
3849
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
3850
- console.groupCollapsed(" \u2714\uFE0F expand complete", keyInit);
3851
- try {
3852
- (0, import_log.log)("style", { ...style }), (0, import_log.log)("transforms", { ...transforms }), (0, import_log.log)("viewProps", { ...viewProps });
3853
- } catch {
3854
- }
3855
- console.groupEnd();
3856
- }
3857
- }
3735
+ });
3736
+ module2.exports = __toCommonJS2(propMapper_exports);
3737
+ var import_constants = require_index_native3(), import_helpers = require_index_native4(), import_config = require_config_native(), import_isDevTools = require_isDevTools_native(), import_createVariable = require_createVariable_native(), import_expandStyle = require_expandStyle_native(), import_expandStylesAndRemoveNullishValues = require_expandStylesAndRemoveNullishValues_native(), import_getVariantExtras = require_getVariantExtras_native(), import_isObj = require_isObj_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), propMapper = (key, value, styleStateIn, subPropsIn) => {
3738
+ var _a;
3739
+ if (lastFontFamilyToken = null, !import_constants.isAndroid && key === "elevationAndroid")
3740
+ return;
3741
+ if (value === "unset") {
3742
+ let unsetVal = (_a = styleStateIn.conf.unset) == null ? void 0 : _a[key];
3743
+ if (unsetVal != null)
3744
+ value = unsetVal;
3745
+ else
3746
+ return;
3858
3747
  }
3859
- if (props.style && mergeStylePropIntoStyle(styleState, props.style), styleProps.noNormalize !== !1 && ((0, import_expandStyles.fixStyles)(style), import_constants.isWeb && !staticConfig.isReactNative && (0, import_getStylesAtomic.styleToCSS)(style), styleState.transforms && Object.entries(styleState.transforms).sort(([a], [b]) => a.localeCompare(b)).forEach(([key, val]) => {
3860
- mergeTransform(style, key, val, !0);
3861
- }), parentSplitStyles && !shouldDoClasses))
3862
- for (let key in parentSplitStyles.style)
3863
- key in classNames || key in style || (style[key] = parentSplitStyles.style[key]);
3864
- let result = {
3865
- space,
3866
- hasMedia,
3867
- fontFamily: styleState.fontFamily,
3868
- viewProps,
3869
- // @ts-expect-error
3870
- style,
3871
- pseudos,
3872
- classNames,
3873
- rulesToInsert,
3874
- dynamicThemeAccess,
3875
- pseudoGroups,
3876
- mediaGroups
3877
- };
3878
- if (style.fontFamily) {
3879
- let faceInfo = (_e = (0, import_config.getFont)(style.fontFamily)) == null ? void 0 : _e.face;
3880
- if (faceInfo) {
3881
- let overrideFace = (_g = (_f = faceInfo[style.fontWeight]) == null ? void 0 : _f[style.fontStyle || "normal"]) == null ? void 0 : _g.val;
3882
- overrideFace && (style.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style.fontWeight, delete style.fontStyle);
3748
+ let subProps = styleStateIn.styleProps.fallbackProps || subPropsIn, styleState = subProps ? new Proxy(styleStateIn, {
3749
+ get(_, k) {
3750
+ return k === "curProps" ? subProps : Reflect.get(_, k);
3883
3751
  }
3884
- process.env.NODE_ENV === "development" && debug && debug !== "profile" && (0, import_log.log)(`Found fontFamily native: ${style.fontFamily}`, faceInfo);
3752
+ }) : styleStateIn, { conf, styleProps, fontFamily, staticConfig } = styleState, { variants } = staticConfig;
3753
+ if (process.env.NODE_ENV === "development" && fontFamily && fontFamily[0] === "$" && !(fontFamily in conf.fontsParsed) && console.warn(
3754
+ `Warning: no fontFamily "${fontFamily}" found in config: ${Object.keys(
3755
+ conf.fontsParsed
3756
+ ).join(", ")}`
3757
+ ), !styleProps.noExpand && variants && key in variants) {
3758
+ styleState.curProps[key] = value;
3759
+ let variantValue = resolveVariants(key, value, styleProps, styleState, "");
3760
+ if (variantValue)
3761
+ return variantValue;
3885
3762
  }
3886
- if (className && (classNames.className = className), process.env.NODE_ENV === "development" && debug === "verbose" && import_isDevTools.isDevTools) {
3887
- console.groupCollapsed(" \u{1F539} ===>");
3888
- try {
3889
- let logs = {
3890
- ...result,
3891
- className,
3892
- componentState,
3893
- transforms,
3894
- viewProps,
3895
- viewPropsOrder: Object.keys(viewProps),
3896
- rulesToInsert,
3897
- parentSplitStyles
3898
- };
3899
- for (let key in logs)
3900
- (0, import_log.log)(key, logs[key]);
3901
- } catch {
3763
+ let shouldReturn = !1;
3764
+ if (styleProps.disableExpandShorthands || key in conf.shorthands && (shouldReturn = !0, key = conf.shorthands[key]), value && (value[0] === "$" ? value = getTokenForKey(key, value, styleProps.resolveValues, styleState) : (0, import_createVariable.isVariable)(value) && (value = resolveVariableValue(key, value, styleProps.resolveValues))), shouldReturn || value != null) {
3765
+ let result = (styleProps.noExpand ? null : (0, import_expandStyle.expandStyle)(key, value)) || [
3766
+ [key, value]
3767
+ ];
3768
+ return key === "fontFamily" && lastFontFamilyToken && fontFamilyCache.set(result, lastFontFamilyToken), result;
3769
+ }
3770
+ }, resolveVariants = (key, value, styleProps, styleState, parentVariantKey) => {
3771
+ let { staticConfig, conf, debug } = styleState, { variants } = staticConfig;
3772
+ if (!variants)
3773
+ return;
3774
+ let variantValue = getVariantDefinition(variants[key], value, conf);
3775
+ if (process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(`\u2666\uFE0F\u2666\uFE0F\u2666\uFE0F resolve variant ${key}`), console.info({
3776
+ key,
3777
+ value,
3778
+ variantValue,
3779
+ variants,
3780
+ curProps: { ...styleState.curProps }
3781
+ }), console.groupEnd()), !variantValue) {
3782
+ if (process.env.TAMAGUI_WARN_ON_MISSING_VARIANT === "1" && typeof value != "boolean") {
3783
+ let name = staticConfig.componentName || "[UnnamedComponent]";
3784
+ console.warn(
3785
+ `No variant found: ${name} has variant "${key}", but no matching value "${value}"`
3786
+ );
3902
3787
  }
3903
- console.groupEnd();
3788
+ return;
3904
3789
  }
3905
- return result;
3906
- };
3907
- function mergeStyle(styleState, key, val, disableNormalize = !1) {
3908
- let { classNames, viewProps, style, usedKeys, styleProps } = styleState;
3909
- if (import_constants.isWeb && (val == null ? void 0 : val[0]) === "_")
3910
- classNames[key] = val, usedKeys[key] ||= 1;
3911
- else if (key in import_helpers.stylePropsTransform)
3912
- styleState.transforms ||= {}, styleState.transforms[key] = val;
3913
- else {
3914
- let out = import_constants.isWeb && !disableNormalize && !styleProps.noNormalize ? (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key) : val;
3915
- key in import_helpers.validStylesOnBaseProps ? viewProps[key] = out : style[key] = out;
3790
+ if (typeof variantValue == "function") {
3791
+ let fn = variantValue, extras = (0, import_getVariantExtras.getVariantExtras)(styleState);
3792
+ variantValue = fn(value, extras), process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(" expanded functional variant", key), console.info({ fn, variantValue, extras }), console.groupEnd());
3916
3793
  }
3917
- }
3918
- var getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
3919
- let { staticConfig, props, conf: conf2, styleProps } = styleState, styleOut = {};
3920
- for (let key in styleIn) {
3921
- let val = styleIn[key];
3922
- key = conf2.shorthands[key] || key;
3923
- let expanded = (0, import_propMapper.propMapper)(key, val, styleState, { ...props, ...props[subKey] });
3924
- if (!(!expanded || !staticConfig.isHOC && key in skipProps && !styleProps.noSkip))
3925
- for (let [skey, sval] of expanded)
3926
- !avoidMergeTransform && skey in import_helpers.stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps.noNormalize ? sval : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(sval, key);
3794
+ let fontFamilyResult;
3795
+ if ((0, import_isObj.isObj)(variantValue)) {
3796
+ let fontFamilyUpdate = variantValue.fontFamily || variantValue[conf.inverseShorthands.fontFamily];
3797
+ fontFamilyUpdate && (fontFamilyResult = getFontFamilyFromNameOrVariable(fontFamilyUpdate, conf), styleState.fontFamily = fontFamilyResult, process.env.NODE_ENV === "development" && debug === "verbose" && console.info(" updating font family", fontFamilyResult)), variantValue = resolveTokensAndVariants(
3798
+ key,
3799
+ variantValue,
3800
+ styleProps,
3801
+ styleState,
3802
+ parentVariantKey
3803
+ );
3927
3804
  }
3928
- return styleProps.noNormalize || (0, import_expandStyles.fixStyles)(styleOut), styleOut;
3929
- };
3930
- function mergeStylePropIntoStyle(styleState, cur) {
3931
- if (!cur)
3932
- return;
3933
- let styles = Array.isArray(cur) ? cur : [cur];
3934
- for (let style of styles) {
3935
- if (!style)
3936
- continue;
3937
- let isRNW = style.$$css;
3938
- Object.assign(isRNW ? styleState.classNames : styleState.style, style);
3805
+ if (variantValue) {
3806
+ let expanded = (0, import_expandStylesAndRemoveNullishValues.expandStylesAndRemoveNullishValues)(
3807
+ variantValue,
3808
+ !!styleProps.noNormalize
3809
+ ), next = Object.entries(expanded);
3810
+ return fontFamilyResult && fontFamilyResult[0] === "$" && fontFamilyCache.set(next, (0, import_createVariable.getVariableValue)(fontFamilyResult)), next;
3939
3811
  }
3940
- }
3941
- var useInsertEffectCompat = import_constants.isWeb ? import_react3.useInsertionEffect || import_constants.useIsomorphicLayoutEffect : () => {
3942
- }, useSplitStyles = (...args) => {
3943
- let res = getSplitStyles(...args);
3944
- return useInsertEffectCompat(() => {
3945
- (0, import_insertStyleRule.insertStyleRules)(res.rulesToInsert);
3946
- }, [res.rulesToInsert]), res;
3947
- }, animatableDefaults = {
3948
- opacity: 1,
3949
- scale: 1,
3950
- rotate: "0deg",
3951
- rotateY: "0deg",
3952
- rotateX: "0deg",
3953
- x: 0,
3954
- y: 0
3955
- }, lowercaseHyphenate = (match) => `-${match.toLowerCase()}`, hyphenate = (str) => str.replace(/[A-Z]/g, lowercaseHyphenate), mergeTransform = (obj, key, val, backwards = !1) => {
3956
- typeof obj.transform != "string" && (obj.transform ||= [], obj.transform[backwards ? "unshift" : "push"]({
3957
- [mapTransformKeys[key] || key]: val
3958
- }));
3959
- }, mapTransformKeys = {
3960
- x: "translateX",
3961
- y: "translateY"
3962
- }, skipProps = {
3963
- untilMeasured: 1,
3964
- animation: 1,
3965
- space: 1,
3966
- animateOnly: 1,
3967
- disableClassName: 1,
3968
- debug: 1,
3969
- componentName: 1,
3970
- disableOptimization: 1,
3971
- tag: 1,
3972
- style: 1,
3973
- // handled after loop so pseudos set usedKeys and override it if necessary
3974
- group: 1
3975
3812
  };
3976
- process.env.NODE_ENV === "test" && (skipProps["data-test-renders"] = 1);
3977
- Object.assign(skipProps, {
3978
- whiteSpace: 1,
3979
- wordWrap: 1,
3980
- textOverflow: 1,
3981
- textDecorationDistance: 1,
3982
- cursor: 1,
3983
- contain: 1,
3984
- boxSizing: 1,
3985
- boxShadow: 1,
3986
- outlineStyle: 1,
3987
- outlineOffset: 1,
3988
- outlineWidth: 1,
3989
- outlineColor: 1
3990
- });
3991
- function passDownProp(viewProps, key, val, shouldMergeObject = !1) {
3992
- if (shouldMergeObject) {
3993
- let next = {
3994
- ...viewProps[key],
3995
- ...val
3996
- };
3997
- delete viewProps[key], viewProps[key] = next;
3998
- } else
3999
- viewProps[key] = val;
3813
+ function getFontFamilyFromNameOrVariable(input, conf) {
3814
+ if ((0, import_createVariable.isVariable)(input)) {
3815
+ let val = variableToFontNameCache.get(input);
3816
+ if (val)
3817
+ return val;
3818
+ for (let key in conf.fontsParsed) {
3819
+ let familyVariable = conf.fontsParsed[key].family;
3820
+ if ((0, import_createVariable.isVariable)(familyVariable) && (variableToFontNameCache.set(familyVariable, key), familyVariable === input))
3821
+ return key;
3822
+ }
3823
+ } else if (typeof input == "string" && input[0] === "$")
3824
+ return input;
3825
+ }
3826
+ var variableToFontNameCache = /* @__PURE__ */ new WeakMap(), fontFamilyCache = /* @__PURE__ */ new WeakMap(), getPropMappedFontFamily = (expanded) => expanded && fontFamilyCache.get(expanded), resolveTokensAndVariants = (key, value, styleProps, styleState, parentVariantKey) => {
3827
+ var _a;
3828
+ let { conf, staticConfig, debug, theme } = styleState, { variants } = staticConfig, res = {};
3829
+ process.env.NODE_ENV === "development" && debug === "verbose" && console.info(" - resolveTokensAndVariants", key, value);
3830
+ for (let _key in value) {
3831
+ let subKey = conf.shorthands[_key] || _key, val = value[_key];
3832
+ if (styleProps.noExpand)
3833
+ res[subKey] = val;
3834
+ else if (variants && subKey in variants) {
3835
+ if (styleState.curProps[subKey] = val, parentVariantKey && parentVariantKey === key)
3836
+ res[subKey] = // SYNC WITH *1
3837
+ val[0] === "$" ? getTokenForKey(subKey, val, styleProps.resolveValues, styleState) : val;
3838
+ else {
3839
+ let variantOut = resolveVariants(subKey, val, styleProps, styleState, key);
3840
+ if (variantOut)
3841
+ for (let [key2, val2] of variantOut)
3842
+ val2 != null && (key2 in import_pseudoDescriptors.pseudoDescriptors ? (res[key2] ??= {}, Object.assign(res[key2], val2)) : res[key2] = val2);
3843
+ }
3844
+ continue;
3845
+ }
3846
+ if ((0, import_createVariable.isVariable)(val)) {
3847
+ res[subKey] = resolveVariableValue(subKey, val, styleProps.resolveValues);
3848
+ continue;
3849
+ }
3850
+ if (typeof val == "string") {
3851
+ let fVal = (
3852
+ // SYNC WITH *1
3853
+ val[0] === "$" ? getTokenForKey(subKey, val, styleProps.resolveValues, styleState) : val
3854
+ );
3855
+ res[subKey] = fVal;
3856
+ continue;
3857
+ }
3858
+ if ((0, import_isObj.isObj)(val)) {
3859
+ let subObject = resolveTokensAndVariants(subKey, val, styleProps, styleState, key);
3860
+ process.env.NODE_ENV === "development" && debug === "verbose" && console.info("object", subKey, subObject), res[subKey] ??= {}, Object.assign(res[subKey], subObject);
3861
+ } else
3862
+ res[subKey] = val;
3863
+ process.env.NODE_ENV === "development" && debug && ((_a = res[subKey]) == null ? void 0 : _a[0]) === "$" && console.warn(
3864
+ `\u26A0\uFE0F Missing token in theme ${theme.name}:`,
3865
+ subKey,
3866
+ res[subKey],
3867
+ theme
3868
+ );
3869
+ }
3870
+ return res;
3871
+ }, tokenCats = ["size", "color", "radius", "space", "zIndex"].map((name) => ({
3872
+ name,
3873
+ spreadName: `...${name}`
3874
+ }));
3875
+ function getVariantDefinition(variant, value, conf) {
3876
+ if (typeof variant == "function")
3877
+ return variant;
3878
+ let exact = variant[value];
3879
+ if (exact)
3880
+ return exact;
3881
+ if (value != null) {
3882
+ let { tokensParsed } = conf;
3883
+ for (let { name, spreadName } of tokenCats)
3884
+ if (spreadName in variant && value in tokensParsed[name])
3885
+ return variant[spreadName];
3886
+ let fontSizeVariant = variant["...fontSize"];
3887
+ if (fontSizeVariant && conf.fontSizeTokens.has(value))
3888
+ return fontSizeVariant;
3889
+ }
3890
+ return variant[`:${typeof value}`] || variant["..."];
4000
3891
  }
4001
- }
4002
- });
4003
-
4004
- // ../web/dist/cjs/helpers/mergeProps.native.js
4005
- var require_mergeProps_native = __commonJS({
4006
- "../web/dist/cjs/helpers/mergeProps.native.js"(exports2, module2) {
4007
- "use strict";
4008
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
4009
- for (var name in all)
4010
- __defProp2(target, name, { get: all[name], enumerable: !0 });
4011
- }, __copyProps2 = (to, from, except, desc) => {
4012
- if (from && typeof from == "object" || typeof from == "function")
4013
- for (let key of __getOwnPropNames2(from))
4014
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
4015
- return to;
4016
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), mergeProps_exports = {};
4017
- __export2(mergeProps_exports, {
4018
- mergeProps: () => mergeProps
4019
- });
4020
- module2.exports = __toCommonJS2(mergeProps_exports);
4021
- var import_useMedia = require_useMedia_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), mergeProps = (a, b, inverseShorthands) => {
4022
- let out = {};
4023
- for (let key in a)
4024
- mergeProp(out, a, b, key, inverseShorthands);
4025
- if (b)
4026
- for (let key in b)
4027
- mergeProp(out, b, void 0, key, inverseShorthands);
4028
- return out;
3892
+ var fontShorthand = {
3893
+ fontSize: "size",
3894
+ fontWeight: "weight"
3895
+ }, lastFontFamilyToken = null, getTokenForKey = (key, value, resolveAs = "none", styleState) => {
3896
+ var _a, _b, _c, _d;
3897
+ if (resolveAs === "none")
3898
+ return value;
3899
+ let { theme, conf = (0, import_config.getConfig)(), context, fontFamily, staticConfig } = styleState, tokensParsed = conf.tokensParsed, valOrVar, hasSet = !1;
3900
+ if (theme && value in theme)
3901
+ valOrVar = theme[value], process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info(` - resolving ${key} to theme value ${value}: ${(_a = valOrVar == null ? void 0 : valOrVar.get) == null ? void 0 : _a.call(valOrVar)}`), hasSet = !0;
3902
+ else if (value in conf.specificTokens)
3903
+ hasSet = !0, valOrVar = conf.specificTokens[value];
3904
+ else {
3905
+ let customTokenAccept = (_b = staticConfig == null ? void 0 : staticConfig.acceptTokens) == null ? void 0 : _b[key];
3906
+ if (customTokenAccept) {
3907
+ let val = tokensParsed[customTokenAccept][value];
3908
+ val && (valOrVar = val, hasSet = !0);
3909
+ } else {
3910
+ switch (key) {
3911
+ case "fontFamily": {
3912
+ valOrVar = ((_c = (context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed)[value]) == null ? void 0 : _c.family) || value, lastFontFamilyToken = value, hasSet = !0;
3913
+ break;
3914
+ }
3915
+ case "fontSize":
3916
+ case "lineHeight":
3917
+ case "letterSpacing":
3918
+ case "fontWeight": {
3919
+ let defaultFont = conf.defaultFont || "$body", fam = fontFamily || defaultFont;
3920
+ if (fam) {
3921
+ let fontsParsed = context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed, font = fontsParsed[fam] || fontsParsed[defaultFont];
3922
+ valOrVar = ((_d = font == null ? void 0 : font[fontShorthand[key] || key]) == null ? void 0 : _d[value]) || value, hasSet = !0;
3923
+ }
3924
+ break;
3925
+ }
3926
+ }
3927
+ for (let cat in import_helpers.tokenCategories)
3928
+ if (key in import_helpers.tokenCategories[cat]) {
3929
+ let res = tokensParsed[cat][value];
3930
+ res != null && (valOrVar = res, hasSet = !0);
3931
+ }
3932
+ }
3933
+ if (!hasSet) {
3934
+ let spaceVar = tokensParsed.space[value];
3935
+ spaceVar != null && (valOrVar = spaceVar, hasSet = !0);
3936
+ }
3937
+ }
3938
+ if (hasSet) {
3939
+ let out = resolveVariableValue(key, valOrVar, resolveAs);
3940
+ return process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info("resolved", resolveAs, valOrVar, out), out;
3941
+ }
3942
+ return process.env.NODE_ENV === "development" && import_isDevTools.isDevTools && styleState.debug === "verbose" && (console.groupCollapsed(" \uFE52 propMap (val)", key, value), console.info({ valOrVar, theme, hasSet }, theme ? theme[key] : ""), console.groupEnd()), value;
4029
3943
  };
4030
- function mergeProp(out, a, b, key, inverseShorthands) {
4031
- let longhand = (inverseShorthands == null ? void 0 : inverseShorthands[key]) || null, val = a[key];
4032
- if (key in import_pseudoDescriptors.pseudoDescriptors || import_useMedia.mediaKeys.has(key)) {
4033
- out[key] = {
4034
- ...out[key],
4035
- ...val
4036
- };
4037
- return;
3944
+ function resolveVariableValue(key, valOrVar, resolveValues) {
3945
+ if (resolveValues === "none")
3946
+ return valOrVar;
3947
+ if ((0, import_createVariable.isVariable)(valOrVar)) {
3948
+ if (resolveValues === "value")
3949
+ return valOrVar.val;
3950
+ let get = valOrVar == null ? void 0 : valOrVar.get;
3951
+ return key !== "shadowColor" && typeof get == "function" ? get(resolveValues === "web" ? "web" : void 0) : valOrVar.val;
4038
3952
  }
4039
- b && (key in b || longhand && longhand in b) || (out[longhand || key] = val);
3953
+ return valOrVar;
4040
3954
  }
4041
3955
  }
4042
3956
  });
4043
3957
 
4044
- // ../web/dist/cjs/helpers/ThemeManagerContext.native.js
4045
- var require_ThemeManagerContext_native = __commonJS({
4046
- "../web/dist/cjs/helpers/ThemeManagerContext.native.js"(exports2, module2) {
4047
- "use strict";
4048
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
4049
- for (var name in all)
4050
- __defProp2(target, name, { get: all[name], enumerable: !0 });
4051
- }, __copyProps2 = (to, from, except, desc) => {
4052
- if (from && typeof from == "object" || typeof from == "function")
4053
- for (let key of __getOwnPropNames2(from))
4054
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
4055
- return to;
4056
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManagerContext_exports = {};
4057
- __export2(ThemeManagerContext_exports, {
4058
- ThemeManagerIDContext: () => ThemeManagerIDContext
4059
- });
4060
- module2.exports = __toCommonJS2(ThemeManagerContext_exports);
4061
- var import_react3 = require("react"), ThemeManagerIDContext = (0, import_react3.createContext)(1);
4062
- }
4063
- });
4064
-
4065
- // ../web/dist/cjs/helpers/ThemeManager.native.js
4066
- var require_ThemeManager_native = __commonJS({
4067
- "../web/dist/cjs/helpers/ThemeManager.native.js"(exports2, module2) {
3958
+ // ../web/dist/cjs/helpers/getSplitStyles.native.js
3959
+ var require_getSplitStyles_native = __commonJS({
3960
+ "../web/dist/cjs/helpers/getSplitStyles.native.js"(exports2, module2) {
4068
3961
  "use strict";
4069
3962
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
4070
3963
  for (var name in all)
@@ -4074,404 +3967,522 @@ var require_ThemeManager_native = __commonJS({
4074
3967
  for (let key of __getOwnPropNames2(from))
4075
3968
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
4076
3969
  return to;
4077
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManager_exports = {};
4078
- __export2(ThemeManager_exports, {
4079
- ThemeManager: () => ThemeManager,
4080
- getHasThemeUpdatingProps: () => getHasThemeUpdatingProps,
4081
- getManagers: () => getManagers
3970
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), getSplitStyles_exports = {};
3971
+ __export2(getSplitStyles_exports, {
3972
+ PROP_SPLIT: () => PROP_SPLIT,
3973
+ getSplitStyles: () => getSplitStyles,
3974
+ getSubStyle: () => getSubStyle,
3975
+ useSplitStyles: () => useSplitStyles
4082
3976
  });
4083
- module2.exports = __toCommonJS2(ThemeManager_exports);
4084
- var import_constants = require_index_native3(), import_config = require_config_native(), import_constants2 = require_constants_native2(), emptyState = { name: "" };
4085
- function getHasThemeUpdatingProps(props) {
4086
- return !!(props.name || props.componentName || props.inverse || props.reset);
3977
+ module2.exports = __toCommonJS2(getSplitStyles_exports);
3978
+ var import_constants = require_index_native3(), import_helpers = require_index_native4(), import_react3 = require("react"), import_config = require_config_native(), import_accessibilityDirectMap = require_accessibilityDirectMap_native(), import_constants2 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_useMedia = require_useMedia_native(), import_createMediaStyle = require_createMediaStyle_native(), import_expandStyles = require_expandStyles_native(), import_getGroupPropParts = require_getGroupPropParts_native(), import_getStylesAtomic = require_getStylesAtomic_native(), import_insertStyleRule = require_insertStyleRule_native(), import_log = require_log_native(), import_normalizeValueWithProperty = require_normalizeValueWithProperty_native(), import_propMapper = require_propMapper_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), IS_STATIC = process.env.IS_STATIC === "is_static", conf, PROP_SPLIT = "-";
3979
+ function isValidStyleKey(key, staticConfig) {
3980
+ let validStyleProps = staticConfig.validStyles ?? (staticConfig.isText ? import_helpers.stylePropsText : import_helpers.validStyles);
3981
+ return key in validStyleProps || staticConfig.acceptTokens && key in staticConfig.acceptTokens;
4087
3982
  }
4088
- var uid = 0, ThemeManager = class {
4089
- constructor(props = {}, parentManager) {
4090
- if (this.props = props, this.id = 0, this.themeListeners = /* @__PURE__ */ new Set(), this.parentManager = null, this.state = emptyState, this._allKeys = null, uid = (uid + 1) % Number.MAX_VALUE, this.id = uid, parentManager === "root") {
4091
- this.updateStateFromProps(props, !1);
4092
- return;
4093
- }
4094
- if (!parentManager)
4095
- throw process.env.NODE_ENV !== "production" ? new Error(
4096
- "No parent manager given, this is likely due to duplicated Tamagui dependencies. Check your lockfile for mis-matched versions. It could also be from an error somewhere else in your stack causing Tamagui to recieve undefined context, you can try putting some ErrorBoundary components around other areas of your app, or a Suspense boundary."
4097
- ) : "\u274C 000";
4098
- if (this.parentManager = parentManager, !this.updateStateFromProps(props, !1))
4099
- return parentManager;
4100
- }
4101
- updateStateFromProps(props = this.props || {}, shouldNotify = !0) {
4102
- if (this.props = props, props.forceTheme)
4103
- return this.state.theme = props.forceTheme, this.state.name = props.name || "", this.updateState(this.state, !0), this.state;
4104
- let nextState = this.getStateIfChanged(props);
4105
- if (nextState)
4106
- return this.updateState(nextState, shouldNotify), nextState;
4107
- }
4108
- updateState(nextState, shouldNotify = !0) {
4109
- this.state = nextState, this._allKeys = null, process.env.NODE_ENV !== "production" && (this._numChangeEventsSent ??= 0, this._numChangeEventsSent++), shouldNotify && this.notify();
4110
- }
4111
- getStateIfChanged(props = this.props, state = this.state, parentManager = this.parentManager) {
4112
- let _ = this.getState(props, parentManager);
4113
- if (state && state !== emptyState && !_)
4114
- return parentManager == null ? void 0 : parentManager.state;
4115
- if (this.getStateShouldChange(_, state))
4116
- return _;
4117
- }
4118
- getStateShouldChange(nextState, state = this.state) {
4119
- return !(!(nextState != null && nextState.theme) || nextState.theme === (state == null ? void 0 : state.theme));
4120
- }
4121
- getState(props = this.props, parentManager = this.parentManager) {
4122
- return getState(props, parentManager) || (parentManager == null ? void 0 : parentManager.state) || null;
4123
- }
4124
- get allKeys() {
4125
- var _a;
4126
- return this._allKeys ||= /* @__PURE__ */ new Set([
4127
- ...((_a = this.parentManager) == null ? void 0 : _a.allKeys) || [],
4128
- ...Object.keys(this.state.theme || {})
4129
- ]), this._allKeys;
4130
- }
4131
- notify(forced = !1) {
4132
- this.themeListeners.forEach((cb) => cb(this.state.name, this, forced));
4133
- }
4134
- onChangeTheme(cb, debugId) {
4135
- return process.env.NODE_ENV !== "production" && debugId && (this._listeningIds ??= /* @__PURE__ */ new Set(), this._listeningIds.add(debugId)), this.themeListeners.add(cb), () => {
4136
- this.themeListeners.delete(cb);
4137
- };
4138
- }
4139
- };
4140
- function getState(props, manager) {
4141
- var _a;
4142
- if (props.name && props.reset)
4143
- throw new Error(
4144
- process.env.NODE_ENV === "production" ? "\u274C004" : "Cannot reset and set a new name at the same time."
4145
- );
4146
- if (!getHasThemeUpdatingProps(props))
4147
- return null;
4148
- let themes = (0, import_config.getThemes)(), [allManagers, componentManagers] = getManagers(manager), isDirectParentAComponentTheme = !!(manager != null && manager.state.isComponent), startIndex = props.reset && !isDirectParentAComponentTheme ? 1 : 0, baseManager = allManagers[startIndex], parentManager = allManagers[startIndex + 1];
4149
- if (!baseManager && props.reset)
4150
- return process.env.NODE_ENV !== "production" && console.warn("Cannot reset, no parent theme exists"), null;
4151
- let { componentName } = props, result = null, baseName = (baseManager == null ? void 0 : baseManager.state.name) || "";
4152
- baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][A-Za-z]+/, ""));
4153
- let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
4154
- isDirectParentAComponentTheme && allComponentThemes.shift();
4155
- let base = baseName.split(import_constants2.THEME_NAME_SEPARATOR), max = base.length, min = props.componentName && !nextName ? max : 0;
4156
- for (let i = max; i >= min; i--) {
4157
- let prefix = base.slice(0, i).join(import_constants2.THEME_NAME_SEPARATOR);
4158
- props.inverse && (prefix = inverseThemeName(prefix));
4159
- let potentials = [];
4160
- if (prefix && prefix !== baseName && potentials.push(prefix), nextName && potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName), i === 1) {
4161
- let lastSegment = potentials.findIndex((x) => !x.includes("_"));
4162
- lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
3983
+ var getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
3984
+ var _a, _b, _c, _e, _f, _g;
3985
+ conf = conf || (0, import_config.getConfig)(), import_constants.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
3986
+ let { shorthands } = conf, {
3987
+ isHOC,
3988
+ isText,
3989
+ variants,
3990
+ isReactNative,
3991
+ inlineProps,
3992
+ inlineWhenUnflattened,
3993
+ parentStaticConfig,
3994
+ acceptsClassName
3995
+ } = staticConfig, viewProps = {}, mediaState2 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants.isWeb && !styleProps.noClassNames, rulesToInsert = [], classNames = {}, transforms = {}, pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, style = {}, className = props.className ?? "", mediaStylesSeen = 0, styleState = {
3996
+ curProps: { ...props },
3997
+ classNames,
3998
+ conf,
3999
+ props,
4000
+ styleProps,
4001
+ componentState,
4002
+ staticConfig,
4003
+ style,
4004
+ theme,
4005
+ usedKeys,
4006
+ viewProps,
4007
+ context,
4008
+ debug
4009
+ };
4010
+ process.env.NODE_ENV === "development" && debug && debug !== "profile" && import_constants.isClient && (console.groupCollapsed("getSplitStyles (collapsed)"), (0, import_log.log)({
4011
+ props,
4012
+ staticConfig,
4013
+ shouldDoClasses,
4014
+ styleProps,
4015
+ componentState,
4016
+ styleState,
4017
+ theme: { ...theme }
4018
+ }), console.groupEnd());
4019
+ for (let keyOg in props) {
4020
+ let keyInit = keyOg, valInit = props[keyOg];
4021
+ if (styleProps.disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || keyInit in skipProps && !styleProps.noSkip && !isHOC)
4022
+ continue;
4023
+ let valInitType = typeof valInit, isValidStyleKeyInit = isValidStyleKey(keyInit, staticConfig);
4024
+ if (styleState.curProps[keyInit] = valInit, !import_constants.isAndroid && keyInit === "elevationAndroid")
4025
+ continue;
4026
+ if (keyInit === "userSelect")
4027
+ keyInit = "selectable", valInit = valInit !== "none";
4028
+ else if (keyInit === "role") {
4029
+ viewProps.accessibilityRole = import_accessibilityDirectMap.accessibilityWebRoleToNativeRole[valInit];
4030
+ continue;
4031
+ } else if (keyInit.startsWith("aria-")) {
4032
+ if (import_accessibilityDirectMap.webToNativeAccessibilityDirectMap[keyInit]) {
4033
+ let nativeA11yProp = import_accessibilityDirectMap.webToNativeAccessibilityDirectMap[keyInit];
4034
+ keyInit === "aria-hidden" && (viewProps["aria-hidden"] = valInit), viewProps[nativeA11yProp] = valInit;
4035
+ continue;
4036
+ }
4037
+ if (import_accessibilityDirectMap.nativeAccessibilityValue[keyInit]) {
4038
+ let field = import_accessibilityDirectMap.nativeAccessibilityValue[keyInit];
4039
+ viewProps.accessibilityValue ? viewProps.accessibilityValue[field] = valInit : viewProps.accessibilityValue = {
4040
+ [field]: valInit
4041
+ };
4042
+ } else if (import_accessibilityDirectMap.nativeAccessibilityState[keyInit]) {
4043
+ let field = import_accessibilityDirectMap.nativeAccessibilityState[keyInit];
4044
+ viewProps.accessibilityState ? viewProps.accessibilityState[field] = valInit : viewProps.accessibilityState = {
4045
+ [field]: valInit
4046
+ };
4047
+ }
4048
+ continue;
4049
+ } else if (keyInit.startsWith("data-"))
4050
+ continue;
4051
+ if (keyInit === "dataSet") {
4052
+ for (let keyInit2 in valInit)
4053
+ viewProps[`data-${hyphenate(keyInit2)}`] = valInit[keyInit2];
4054
+ continue;
4163
4055
  }
4164
- if (componentName && !props.reset) {
4165
- let baseLen = base.length, componentPotentials = [];
4166
- if (nextName && baseLen > 1) {
4167
- let beforeSeparator = base[0];
4168
- componentPotentials.push(`${beforeSeparator}_${nextName}_${componentName}`);
4056
+ if (keyInit[0] === "_" && keyInit.startsWith("_style")) {
4057
+ mergeStylePropIntoStyle(styleState, valInit);
4058
+ continue;
4059
+ }
4060
+ if (0)
4061
+ switch (keyInit) {
4062
+ case "accessibilityRole":
4063
+ case "accessibilityLabelledBy":
4064
+ case "accessibilityFlowTo":
4065
+ case "accessibilityControls":
4066
+ case "accessibilityDescribedBy":
4067
+ case "accessibilityKeyShortcuts":
4068
+ case "accessibilityLiveRegion":
4069
+ case "accessibilityReadOnly":
4070
+ case "accessibilityRequired":
4071
+ default:
4169
4072
  }
4170
- if (componentPotentials.push(`${prefix}_${componentName}`), nextName) {
4171
- if (i > baseLen) {
4172
- let prefixLessOne = base.slice(0, i - 1).join(import_constants2.THEME_NAME_SEPARATOR);
4173
- if (prefixLessOne) {
4174
- let lessSpecific = `${prefixLessOne}_${nextName}_${componentName}`;
4175
- componentPotentials.unshift(lessSpecific);
4073
+ let isShorthand = keyInit in shorthands, isVariant = !isValidStyleKeyInit && variants && keyInit in variants, isStyleLikeKey = isShorthand || isValidStyleKeyInit || isVariant, isPseudo = keyInit in import_helpers.validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo && (0, import_useMedia.isMediaKey)(keyInit), isMediaOrPseudo = !!(isMedia || isPseudo), isStyleProp = isMediaOrPseudo || isVariant && !styleProps.noExpand || isValidStyleKeyInit || isShorthand;
4074
+ if (isStyleProp && (props.asChild === "except-style" || props.asChild === "except-style-web"))
4075
+ continue;
4076
+ let shouldPassProp = !isStyleProp || // is in parent variants
4077
+ isHOC && (parentStaticConfig == null ? void 0 : parentStaticConfig.variants) && keyInit in parentStaticConfig.variants || (inlineProps == null ? void 0 : inlineProps.has(keyInit)), parentVariant = (_a = parentStaticConfig == null ? void 0 : parentStaticConfig.variants) == null ? void 0 : _a[keyInit], isHOCShouldPassThrough = !!(isHOC && (isShorthand || isValidStyleKeyInit || isMediaOrPseudo || parentVariant || keyInit in skipProps)), shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
4078
+ if (process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(
4079
+ `\u{1F539}\u{1F539}\u{1F539}\u{1F539} ${keyOg}${keyInit !== keyOg ? ` (shorthand for ${keyInit})` : ""} ${shouldPassThrough ? "(pass)" : ""} \u{1F539}\u{1F539}\u{1F539}\u{1F539}`
4080
+ ), (0, import_log.log)({ isVariant, valInit, shouldPassProp }), import_constants.isClient && (0, import_log.log)({
4081
+ variants,
4082
+ variant: variants == null ? void 0 : variants[keyInit],
4083
+ isVariant,
4084
+ isHOCShouldPassThrough,
4085
+ curProps: { ...styleState.curProps },
4086
+ parentStaticConfig
4087
+ }), console.groupEnd()), shouldPassThrough && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo), !isVariant) || !styleProps.noSkip && keyInit in skipProps)
4088
+ continue;
4089
+ if (isText && valInit && (keyInit === "fontFamily" || keyInit === shorthands.fontFamily) && valInit in conf.fontsParsed && (styleState.fontFamily = valInit), isValidStyleKeyInit && !variants && valInit !== "unset" && (valInitType === "number" || valInitType === "string" && valInit[0] !== "$")) {
4090
+ style[keyInit] = valInit;
4091
+ continue;
4092
+ }
4093
+ let expanded = isMediaOrPseudo || !isVariant && !isValidStyleKeyInit ? [[keyInit, valInit]] : (0, import_propMapper.propMapper)(keyInit, valInit, styleState), next = (0, import_propMapper.getPropMappedFontFamily)(expanded);
4094
+ if (next && (styleState.fontFamily = next), process.env.NODE_ENV === "development" && debug === "verbose") {
4095
+ console.groupCollapsed(" \u{1F4A0} expanded", keyInit, valInit);
4096
+ try {
4097
+ !import_constants.isServer && import_isDevTools.isDevTools && ((0, import_log.log)({
4098
+ expanded,
4099
+ styleProps,
4100
+ componentState,
4101
+ isVariant,
4102
+ variant: variants == null ? void 0 : variants[keyInit],
4103
+ shouldPassProp,
4104
+ isHOCShouldPassThrough,
4105
+ theme,
4106
+ usedKeys: { ...usedKeys },
4107
+ curProps: { ...styleState.curProps }
4108
+ }), (0, import_log.log)("expanded", expanded, `
4109
+ usedKeys`, { ...usedKeys }, `
4110
+ current`, {
4111
+ ...style
4112
+ }));
4113
+ } catch {
4114
+ }
4115
+ console.groupEnd();
4116
+ }
4117
+ if (expanded) {
4118
+ for (let [key, val] of expanded)
4119
+ if (!(val == null || key in usedKeys)) {
4120
+ if (isPseudo = key in import_helpers.validPseudoKeys, isMedia = !isPseudo && !isValidStyleKeyInit && (0, import_useMedia.isMediaKey)(key), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key in variants, (inlineProps != null && inlineProps.has(key) || IS_STATIC && inlineWhenUnflattened != null && inlineWhenUnflattened.has(key)) && (viewProps[key] = props[key] ?? val), styleProps.noExpand && isPseudo || isHOC && (isMediaOrPseudo || ((_b = parentStaticConfig == null ? void 0 : parentStaticConfig.variants) == null ? void 0 : _b[keyInit]))) {
4121
+ passDownProp(viewProps, key, val, isMediaOrPseudo), process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(` - passing down prop ${key}`), (0, import_log.log)({ val, after: { ...viewProps[key] } }), console.groupEnd());
4122
+ continue;
4123
+ }
4124
+ if (isPseudo) {
4125
+ if (!val)
4126
+ continue;
4127
+ let pseudoStyleObject = getSubStyle(
4128
+ styleState,
4129
+ key,
4130
+ val,
4131
+ styleProps.noClassNames
4132
+ ), descriptor = import_pseudoDescriptors.pseudoDescriptors[key], isEnter = key === "enterStyle", isExit = key === "exitStyle";
4133
+ if (!descriptor || isExit && !styleProps.isExiting)
4134
+ continue;
4135
+ if ((!shouldDoClasses || IS_STATIC) && (pseudos ||= {}, pseudos[key] ||= {}, IS_STATIC)) {
4136
+ Object.assign(pseudos[key], pseudoStyleObject);
4137
+ continue;
4138
+ }
4139
+ if (shouldDoClasses && !isExit) {
4140
+ let pseudoStyles = (0, import_getStylesAtomic.generateAtomicStyles)(pseudoStyleObject, descriptor);
4141
+ process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed("pseudo (classes)", key), (0, import_log.log)({ pseudoStyleObject, pseudoStyles }), console.groupEnd());
4142
+ for (let psuedoStyle of pseudoStyles)
4143
+ `${psuedoStyle.property}${PROP_SPLIT}${descriptor.name}` in usedKeys || psuedoStyle.identifier;
4144
+ }
4145
+ if (!shouldDoClasses || isExit || isEnter) {
4146
+ let descriptorKey = descriptor.stateKey || descriptor.name, isDisabled = componentState[descriptorKey] === !1;
4147
+ isExit && (isDisabled = !styleProps.isExiting), isEnter && (isDisabled = componentState.unmounted === "should-enter" ? !0 : !componentState.unmounted), process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed("pseudo", key, { isDisabled }), (0, import_log.log)({ pseudoStyleObject, isDisabled, descriptor, componentState }), console.groupEnd());
4148
+ let importance = descriptor.priority;
4149
+ for (let pkey in pseudoStyleObject) {
4150
+ let val2 = pseudoStyleObject[pkey];
4151
+ if (isDisabled) {
4152
+ if (pkey in animatableDefaults && !(pkey in usedKeys)) {
4153
+ let defaultVal = animatableDefaults[pkey];
4154
+ mergeStyle(styleState, pkey, defaultVal);
4155
+ }
4156
+ } else {
4157
+ let curImportance = usedKeys[pkey] || 0, shouldMerge = importance >= curImportance;
4158
+ shouldMerge && (pseudos ||= {}, pseudos[key] ||= {}, pseudos[key][pkey] = val2, mergeStyle(styleState, pkey, val2)), process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(" subKey", pkey, shouldMerge, {
4159
+ importance,
4160
+ curImportance,
4161
+ pkey,
4162
+ val: val2,
4163
+ transforms: { ...styleState.transforms }
4164
+ });
4165
+ }
4166
+ }
4167
+ if (!isDisabled)
4168
+ for (let key2 in val) {
4169
+ let k = shorthands[key2] || key2;
4170
+ usedKeys[k] = Math.max(importance, usedKeys[k] || 0);
4171
+ }
4172
+ }
4173
+ continue;
4174
+ }
4175
+ if (isMedia) {
4176
+ if (!val)
4177
+ continue;
4178
+ if (isMedia === "platform") {
4179
+ let platform = key.slice(10);
4180
+ if (
4181
+ // supports web, ios, android
4182
+ platform !== import_constants.currentPlatform && // supports web, native
4183
+ platform !== "native"
4184
+ )
4185
+ continue;
4186
+ }
4187
+ hasMedia ||= !0;
4188
+ let mediaStyle = getSubStyle(
4189
+ styleState,
4190
+ key,
4191
+ val,
4192
+ // TODO try true like pseudo
4193
+ !1
4194
+ ), mediaKeyShort = key.slice(1);
4195
+ process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(` \u{1F4FA} ${key}`, {
4196
+ key,
4197
+ val,
4198
+ mediaStyle,
4199
+ props,
4200
+ shouldDoClasses,
4201
+ componentState
4202
+ });
4203
+ let hasSpace = val.space;
4204
+ if ((hasSpace || !shouldDoClasses) && (Array.isArray(hasMedia) || (hasMedia = []), hasMedia.push(mediaKeyShort)), shouldDoClasses) {
4205
+ if (hasSpace && (delete mediaStyle.space, mediaState2[mediaKeyShort])) {
4206
+ let importance = (0, import_useMedia.getMediaImportanceIfMoreImportant)(
4207
+ mediaKeyShort,
4208
+ "space",
4209
+ usedKeys,
4210
+ !0
4211
+ );
4212
+ importance && (space = val.space, usedKeys.space = importance, process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(
4213
+ `Found more important space for current media ${mediaKeyShort}: ${val} (importance: ${importance})`
4214
+ ));
4215
+ }
4216
+ let mediaStyles = (0, import_getStylesAtomic.getStylesAtomic)(mediaStyle, debug), priority = mediaStylesSeen;
4217
+ mediaStylesSeen += 1;
4218
+ for (let style2 of mediaStyles) {
4219
+ let out = (0, import_createMediaStyle.createMediaStyle)(
4220
+ style2,
4221
+ mediaKeyShort,
4222
+ import_useMedia.mediaQueryConfig,
4223
+ isMedia,
4224
+ !1,
4225
+ priority
4226
+ );
4227
+ process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)("\u{1F4FA} media style:", out), `${style2.property}${PROP_SPLIT}${mediaKeyShort}` in usedKeys || out.identifier;
4228
+ }
4229
+ } else {
4230
+ let isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group";
4231
+ if (!isThemeMedia && isMedia !== "platform" && !isGroupMedia && !mediaState2[mediaKeyShort])
4232
+ continue;
4233
+ let importanceBump = 0;
4234
+ if (isThemeMedia) {
4235
+ dynamicThemeAccess = !0;
4236
+ let mediaThemeName = mediaKeyShort.slice(6);
4237
+ if (!(themeName === mediaThemeName || themeName.startsWith(mediaThemeName)))
4238
+ continue;
4239
+ } else if (isGroupMedia) {
4240
+ let groupInfo = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyShort), groupName = groupInfo.name, groupContext = context == null ? void 0 : context.groups.state[groupName];
4241
+ if (!groupContext) {
4242
+ process.env.NODE_ENV === "development" && debug && console.warn(`No parent with group prop, skipping styles: ${groupName}`);
4243
+ continue;
4244
+ }
4245
+ let groupPseudoKey = groupInfo.pseudo, groupMediaKey = groupInfo.media, componentGroupState = (_c = componentState.group) == null ? void 0 : _c[groupName];
4246
+ if (groupMediaKey) {
4247
+ mediaGroups ||= /* @__PURE__ */ new Set(), mediaGroups.add(groupMediaKey);
4248
+ let mediaState22 = componentGroupState == null ? void 0 : componentGroupState.media, isActive = mediaState22 == null ? void 0 : mediaState22[groupMediaKey];
4249
+ if (!mediaState22 && groupContext.layout && (isActive = (0, import_useMedia.mediaKeyMatch)(groupMediaKey, groupContext.layout)), !isActive)
4250
+ continue;
4251
+ importanceBump = 2;
4252
+ }
4253
+ if (groupPseudoKey) {
4254
+ pseudoGroups ||= /* @__PURE__ */ new Set(), pseudoGroups.add(groupName);
4255
+ let componentGroupPseudoState = (componentGroupState || // fallback to context initially
4256
+ context.groups.state[groupName]).pseudo;
4257
+ if (!(componentGroupPseudoState != null && componentGroupPseudoState[groupPseudoKey]))
4258
+ continue;
4259
+ importanceBump = import_pseudoDescriptors.pseudoPriorities[groupPseudoKey];
4260
+ }
4261
+ }
4262
+ for (let subKey in mediaStyle) {
4263
+ if (subKey === "space") {
4264
+ space = valInit.space;
4265
+ continue;
4266
+ }
4267
+ (0, import_useMedia.mergeMediaByImportance)(
4268
+ style,
4269
+ mediaKeyShort,
4270
+ subKey,
4271
+ mediaStyle[subKey],
4272
+ usedKeys,
4273
+ mediaState2[mediaKeyShort],
4274
+ importanceBump
4275
+ ), key === "fontFamily" && (styleState.fontFamily = mediaStyle.fontFamily);
4276
+ }
4277
+ }
4278
+ continue;
4279
+ }
4280
+ if (key === "pointerEvents") {
4281
+ viewProps[key] = val;
4282
+ continue;
4283
+ }
4284
+ if (
4285
+ // is HOC we can just pass through the styles as props
4286
+ // this fixes issues where style prop got merged with wrong priority
4287
+ !isHOC && (isValidStyleKey(key, staticConfig) || import_constants.isAndroid && key === "elevation")
4288
+ ) {
4289
+ mergeStyle(styleState, key, val);
4290
+ continue;
4176
4291
  }
4292
+ isVariant || (viewProps[key] = val);
4177
4293
  }
4178
- let moreSpecific = `${prefix}_${nextName}_${componentName}`;
4179
- componentPotentials.unshift(moreSpecific);
4294
+ if (process.env.NODE_ENV === "development" && debug === "verbose") {
4295
+ console.groupCollapsed(" \u2714\uFE0F expand complete", keyInit);
4296
+ try {
4297
+ (0, import_log.log)("style", { ...style }), (0, import_log.log)("transforms", { ...transforms }), (0, import_log.log)("viewProps", { ...viewProps });
4298
+ } catch {
4299
+ }
4300
+ console.groupEnd();
4180
4301
  }
4181
- potentials = [...componentPotentials, ...potentials, ...allComponentThemes];
4182
- }
4183
- let found = potentials.find((t) => t in themes);
4184
- if (process.env.NODE_ENV !== "production" && typeof props.debug == "string" && console.info(" getState ", {
4185
- props,
4186
- found,
4187
- potentials,
4188
- baseManager,
4189
- nextName,
4190
- baseName,
4191
- prefix
4192
- }), found) {
4193
- let names = found.split("_"), [firstName, ...restNames] = names, lastName = names[names.length - 1], isComponent = lastName[0] === lastName[0].toUpperCase(), scheme = firstName === "light" ? "light" : firstName === "dark" ? "dark" : void 0, pre = import_constants2.THEME_CLASSNAME_PREFIX, className = import_constants.isWeb ? `${pre}sub_theme ${pre}${!scheme || !restNames.length ? firstName : restNames.join("_")}` : "", parentState = (_a = baseManager || parentManager) == null ? void 0 : _a.state, parentName = parentState == null ? void 0 : parentState.name;
4194
- result = {
4195
- name: found,
4196
- parentName,
4197
- theme: themes[found],
4198
- className,
4199
- isComponent,
4200
- scheme
4201
- };
4202
- break;
4203
4302
  }
4204
4303
  }
4205
- return process.env.NODE_ENV !== "production" && props.debug === "verbose" && typeof window < "u" && (console.groupCollapsed("ThemeManager.getState()"), console.info({ props, baseName, base, min, max }), console.warn("result", { result }), console.trace(), console.groupEnd()), result;
4206
- }
4207
- var inverseThemeName = (themeName) => themeName.startsWith("light") ? themeName.replace(/^light/, "dark") : themeName.replace(/^dark/, "light");
4208
- function getManagers(themeManager) {
4209
- let comp = [], all = [], cur = themeManager;
4210
- for (; cur; )
4211
- all.push(cur), cur.state.isComponent && comp.push(cur), cur = cur.parentManager;
4212
- return [all, comp];
4213
- }
4214
- }
4215
- });
4216
-
4217
- // ../web/dist/cjs/hooks/useTheme.native.js
4218
- var require_useTheme_native = __commonJS({
4219
- "../web/dist/cjs/hooks/useTheme.native.js"(exports2, module2) {
4220
- "use strict";
4221
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
4222
- for (var name in all)
4223
- __defProp2(target, name, { get: all[name], enumerable: !0 });
4224
- }, __copyProps2 = (to, from, except, desc) => {
4225
- if (from && typeof from == "object" || typeof from == "function")
4226
- for (let key of __getOwnPropNames2(from))
4227
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
4228
- return to;
4229
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), useTheme_exports = {};
4230
- __export2(useTheme_exports, {
4231
- activeThemeManagers: () => activeThemeManagers,
4232
- getThemeManager: () => getThemeManager,
4233
- getThemeProxied: () => getThemeProxied,
4234
- useChangeThemeEffect: () => useChangeThemeEffect,
4235
- useTheme: () => useTheme,
4236
- useThemeWithState: () => useThemeWithState
4237
- });
4238
- module2.exports = __toCommonJS2(useTheme_exports);
4239
- var import_constants = require_index_native3(), import_react3 = require("react"), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_createShallowSetState = require_createShallowSetState_native(), import_ThemeManager = require_ThemeManager_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), emptyProps = { name: null }, cached;
4240
- function getDefaultThemeProxied() {
4241
- if (cached)
4242
- return cached;
4243
- let config = (0, import_config.getConfig)(), name = config.themes.light ? "light" : Object.keys(config.themes)[0], defaultTheme = config.themes[name];
4244
- return cached = getThemeProxied({ theme: defaultTheme, name }), cached;
4245
- }
4246
- var useTheme = (props = emptyProps) => {
4247
- let [_, theme] = useThemeWithState(props);
4248
- return theme || getDefaultThemeProxied();
4249
- }, useThemeWithState = (props) => {
4250
- let keys = (0, import_react3.useRef)([]), changedThemeState = useChangeThemeEffect(
4251
- props,
4252
- !1,
4253
- keys.current,
4254
- import_constants.isServer ? void 0 : () => {
4255
- var _a, _b;
4256
- let next = ((_a = props.shouldUpdate) == null ? void 0 : _a.call(props)) ?? (keys.current.length > 0 ? !0 : void 0);
4257
- return process.env.NODE_ENV === "development" && typeof props.debug == "string" && props.debug !== "profile" && console.info(" \u{1F3A8} useTheme() shouldUpdate?", next, {
4258
- shouldUpdateProp: (_b = props.shouldUpdate) == null ? void 0 : _b.call(props),
4259
- keys: [...keys.current]
4260
- }), next;
4304
+ if (props.style && mergeStylePropIntoStyle(styleState, props.style), styleProps.noNormalize !== !1 && ((0, import_expandStyles.fixStyles)(style), import_constants.isWeb && !staticConfig.isReactNative && (0, import_getStylesAtomic.styleToCSS)(style), styleState.transforms && Object.entries(styleState.transforms).sort(([a], [b]) => a.localeCompare(b)).forEach(([key, val]) => {
4305
+ mergeTransform(style, key, val, !0);
4306
+ }), parentSplitStyles && !shouldDoClasses))
4307
+ for (let key in parentSplitStyles.style)
4308
+ key in classNames || key in style || (style[key] = parentSplitStyles.style[key]);
4309
+ let result = {
4310
+ space,
4311
+ hasMedia,
4312
+ fontFamily: styleState.fontFamily,
4313
+ viewProps,
4314
+ // @ts-expect-error
4315
+ style,
4316
+ pseudos,
4317
+ classNames,
4318
+ rulesToInsert,
4319
+ dynamicThemeAccess,
4320
+ pseudoGroups,
4321
+ mediaGroups
4322
+ };
4323
+ if (style.fontFamily) {
4324
+ let faceInfo = (_e = (0, import_config.getFont)(style.fontFamily)) == null ? void 0 : _e.face;
4325
+ if (faceInfo) {
4326
+ let overrideFace = (_g = (_f = faceInfo[style.fontWeight]) == null ? void 0 : _f[style.fontStyle || "normal"]) == null ? void 0 : _g.val;
4327
+ overrideFace && (style.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style.fontWeight, delete style.fontStyle);
4261
4328
  }
4262
- ), { themeManager, state } = changedThemeState;
4263
- process.env.NODE_ENV === "development" && (state != null && state.theme || process.env.TAMAGUI_DISABLE_NO_THEME_WARNING !== "1" && console.warn(
4264
- `[tamagui] No theme found, this could be due to an invalid theme name (given theme props ${JSON.stringify(
4265
- props
4266
- )}).
4267
-
4268
- If this is intended and you are using Tamagui without any themes, you can disable this warning by setting the environment variable TAMAGUI_DISABLE_NO_THEME_WARNING=1`
4269
- ));
4270
- let themeProxied = (0, import_react3.useMemo)(() => !themeManager || !(state != null && state.theme) ? {} : getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug), [state == null ? void 0 : state.theme, themeManager, props.deopt, props.debug]);
4271
- return process.env.NODE_ENV === "development" && props.debug === "verbose" && (console.groupCollapsed(" \u{1F539} useTheme =>", state == null ? void 0 : state.name), console.info("returning state", changedThemeState, "from props", props), console.groupEnd()), [changedThemeState, themeProxied];
4272
- };
4273
- function getThemeProxied({ theme, name, scheme }, deopt = !1, themeManager, keys, debug) {
4274
- if (!theme)
4275
- return {};
4276
- let config = (0, import_config.getConfig)();
4277
- function track(key) {
4278
- keys && !keys.includes(key) && (keys.push(key), process.env.NODE_ENV === "development" && debug && console.info(` \u{1F3A8} useTheme() tracking new key: ${key}`));
4329
+ process.env.NODE_ENV === "development" && debug && debug !== "profile" && (0, import_log.log)(`Found fontFamily native: ${style.fontFamily}`, faceInfo);
4279
4330
  }
4280
- return new Proxy(theme, {
4281
- has(_, key) {
4282
- if (Reflect.has(theme, key))
4283
- return !0;
4284
- if (typeof key == "string")
4285
- return key[0] === "$" && (key = key.slice(1)), themeManager == null ? void 0 : themeManager.allKeys.has(key);
4286
- },
4287
- get(_, key) {
4288
- if (
4289
- // dont ask me, idk why but on hermes you can see that useTheme()[undefined] passes in STRING undefined to proxy
4290
- // if someone is crazy enough to use "undefined" as a theme key then this not working is on them
4291
- key !== "undefined" && typeof key == "string"
4292
- ) {
4293
- let keyString = key[0] === "$" ? key.slice(1) : key, val = theme[keyString];
4294
- if (val && typeof val == "object")
4295
- return new Proxy(val, {
4296
- // when they touch the actual value we only track it
4297
- // if its a variable (web), its ignored!
4298
- get(_2, subkey) {
4299
- if (subkey === "val")
4300
- track(keyString);
4301
- else if (subkey === "get")
4302
- return (platform) => {
4303
- let outVal = (0, import_createVariable.getVariable)(val);
4304
- if (platform !== "web" && import_constants.isIos && !deopt && config.settings.fastSchemeChange && !someParentIsInversed(themeManager) && scheme) {
4305
- let oppositeThemeName = name.replace(
4306
- scheme === "dark" ? "dark" : "light",
4307
- scheme === "dark" ? "light" : "dark"
4308
- ), oppositeTheme = config.themes[oppositeThemeName], oppositeVal = (0, import_createVariable.getVariable)(oppositeTheme == null ? void 0 : oppositeTheme[keyString]);
4309
- if (oppositeVal)
4310
- return {
4311
- dynamic: {
4312
- dark: scheme === "dark" ? outVal : oppositeVal,
4313
- light: scheme === "light" ? outVal : oppositeVal
4314
- }
4315
- };
4316
- }
4317
- return track(keyString), outVal;
4318
- };
4319
- return Reflect.get(val, subkey);
4320
- }
4321
- });
4322
- if (process.env.NODE_ENV === "development" && process.env.TAMAGUI_FEAT_THROW_ON_MISSING_THEME_VALUE === "1")
4323
- throw new Error(
4324
- `[tamagui] No theme key "${key}" found in theme ${name}.
4325
- Keys in theme: ${Object.keys(
4326
- theme
4327
- ).join(", ")}`
4328
- );
4329
- }
4330
- return Reflect.get(_, key);
4331
- }
4332
- });
4333
- }
4334
- function someParentIsInversed(manager) {
4335
- {
4336
- let cur = manager;
4337
- for (; cur; ) {
4338
- if (!cur.parentManager)
4339
- return !1;
4340
- if (cur.parentManager.state.scheme !== cur.state.scheme)
4341
- return !0;
4342
- cur = cur.parentManager;
4331
+ if (className && (classNames.className = className), process.env.NODE_ENV === "development" && debug === "verbose" && import_isDevTools.isDevTools) {
4332
+ console.groupCollapsed(" \u{1F539} ===>");
4333
+ try {
4334
+ let logs = {
4335
+ ...result,
4336
+ className,
4337
+ componentState,
4338
+ transforms,
4339
+ viewProps,
4340
+ viewPropsOrder: Object.keys(viewProps),
4341
+ rulesToInsert,
4342
+ parentSplitStyles
4343
+ };
4344
+ for (let key in logs)
4345
+ (0, import_log.log)(key, logs[key]);
4346
+ } catch {
4343
4347
  }
4348
+ console.groupEnd();
4349
+ }
4350
+ return result;
4351
+ };
4352
+ function mergeStyle(styleState, key, val, disableNormalize = !1) {
4353
+ let { classNames, viewProps, style, usedKeys, styleProps } = styleState;
4354
+ if (import_constants.isWeb && (val == null ? void 0 : val[0]) === "_")
4355
+ classNames[key] = val, usedKeys[key] ||= 1;
4356
+ else if (key in import_helpers.stylePropsTransform)
4357
+ styleState.transforms ||= {}, styleState.transforms[key] = val;
4358
+ else {
4359
+ let out = import_constants.isWeb && !disableNormalize && !styleProps.noNormalize ? (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key) : val;
4360
+ key in import_helpers.validStylesOnBaseProps ? viewProps[key] = out : style[key] = out;
4344
4361
  }
4345
- return !1;
4346
4362
  }
4347
- var activeThemeManagers = /* @__PURE__ */ new Set(), _uidToManager = /* @__PURE__ */ new WeakMap(), _idToUID = {}, getId = (id) => _idToUID[id], getThemeManager = (id) => _uidToManager.get(getId(id)), registerThemeManager = (t) => {
4348
- if (!_idToUID[t.id]) {
4349
- let id = _idToUID[t.id] = {};
4350
- _uidToManager.set(id, t);
4363
+ var getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
4364
+ let { staticConfig, props, conf: conf2, styleProps } = styleState, styleOut = {};
4365
+ for (let key in styleIn) {
4366
+ let val = styleIn[key];
4367
+ key = conf2.shorthands[key] || key;
4368
+ let expanded = (0, import_propMapper.propMapper)(key, val, styleState, { ...props, ...props[subKey] });
4369
+ if (!(!expanded || !staticConfig.isHOC && key in skipProps && !styleProps.noSkip))
4370
+ for (let [skey, sval] of expanded)
4371
+ !avoidMergeTransform && skey in import_helpers.stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps.noNormalize ? sval : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(sval, key);
4351
4372
  }
4352
- }, useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
4353
- let { disable } = props, parentManagerId = (0, import_react3.useContext)(import_ThemeManagerContext.ThemeManagerIDContext), parentManager = getThemeManager(parentManagerId);
4354
- if (!isRoot && !parentManager || disable)
4355
- return {
4356
- isNewTheme: !1,
4357
- state: parentManager == null ? void 0 : parentManager.state,
4358
- themeManager: parentManager
4359
- };
4360
- let [themeState, setThemeState] = (0, import_react3.useState)(createState), { state, mounted, isNewTheme, themeManager, inversed } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
4361
- function getShouldUpdateTheme(manager = themeManager, nextState, prevState = state, forceShouldChange = !1) {
4362
- let forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
4363
- if (!manager || !forceShouldChange && forceUpdate === !1)
4364
- return;
4365
- let next = nextState || manager.getState(props, parentManager);
4366
- if (forceShouldChange || next && !(forceUpdate !== !0 && !manager.getStateShouldChange(next, prevState)))
4367
- return next;
4373
+ return styleProps.noNormalize || (0, import_expandStyles.fixStyles)(styleOut), styleOut;
4374
+ };
4375
+ function mergeStylePropIntoStyle(styleState, cur) {
4376
+ if (!cur)
4377
+ return;
4378
+ let styles = Array.isArray(cur) ? cur : [cur];
4379
+ for (let style of styles) {
4380
+ if (!style)
4381
+ continue;
4382
+ let isRNW = style.$$css;
4383
+ Object.assign(isRNW ? styleState.classNames : styleState.style, style);
4368
4384
  }
4369
- if (import_constants.isServer || ((0, import_react3.useEffect)(() => {
4370
- if (!themeManager)
4371
- return;
4372
- if (props.inverse && !mounted) {
4373
- setThemeState((prev) => createState({
4374
- ...prev,
4375
- mounted: !0
4376
- }));
4377
- return;
4378
- }
4379
- (isNewTheme || getShouldUpdateTheme(themeManager)) && (activeThemeManagers.add(themeManager), setThemeState(createState));
4380
- let selfListenerDispose = themeManager.onChangeTheme((_a, _b, forced) => {
4381
- forced && setThemeState((prev) => createState(prev, !0));
4382
- }), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(
4383
- (name, manager, forced) => {
4384
- let force = forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"], shouldTryUpdate = force ?? !!(keys != null && keys.length || isNewTheme);
4385
- process.env.NODE_ENV === "development" && props.debug === "verbose" && console.info(" \u{1F538} onChange", themeManager.id, {
4386
- force,
4387
- shouldTryUpdate,
4388
- props,
4389
- name,
4390
- manager,
4391
- keys
4392
- }), shouldTryUpdate && setThemeState((prev) => createState(prev, force));
4393
- },
4394
- themeManager.id
4395
- );
4396
- return () => {
4397
- selfListenerDispose(), disposeChangeListener == null || disposeChangeListener(), isNewTheme && activeThemeManagers.delete(themeManager);
4385
+ }
4386
+ var useInsertEffectCompat = import_constants.isWeb ? import_react3.useInsertionEffect || import_constants.useIsomorphicLayoutEffect : () => {
4387
+ }, useSplitStyles = (...args) => {
4388
+ let res = getSplitStyles(...args);
4389
+ return useInsertEffectCompat(() => {
4390
+ (0, import_insertStyleRule.insertStyleRules)(res.rulesToInsert);
4391
+ }, [res.rulesToInsert]), res;
4392
+ }, animatableDefaults = {
4393
+ opacity: 1,
4394
+ scale: 1,
4395
+ rotate: "0deg",
4396
+ rotateY: "0deg",
4397
+ rotateX: "0deg",
4398
+ x: 0,
4399
+ y: 0
4400
+ }, lowercaseHyphenate = (match) => `-${match.toLowerCase()}`, hyphenate = (str) => str.replace(/[A-Z]/g, lowercaseHyphenate), mergeTransform = (obj, key, val, backwards = !1) => {
4401
+ typeof obj.transform != "string" && (obj.transform ||= [], obj.transform[backwards ? "unshift" : "push"]({
4402
+ [mapTransformKeys[key] || key]: val
4403
+ }));
4404
+ }, mapTransformKeys = {
4405
+ x: "translateX",
4406
+ y: "translateY"
4407
+ }, skipProps = {
4408
+ untilMeasured: 1,
4409
+ animation: 1,
4410
+ space: 1,
4411
+ animateOnly: 1,
4412
+ disableClassName: 1,
4413
+ debug: 1,
4414
+ componentName: 1,
4415
+ disableOptimization: 1,
4416
+ tag: 1,
4417
+ style: 1,
4418
+ // handled after loop so pseudos set usedKeys and override it if necessary
4419
+ group: 1
4420
+ };
4421
+ process.env.NODE_ENV === "test" && (skipProps["data-test-renders"] = 1);
4422
+ Object.assign(skipProps, {
4423
+ whiteSpace: 1,
4424
+ wordWrap: 1,
4425
+ textOverflow: 1,
4426
+ textDecorationDistance: 1,
4427
+ cursor: 1,
4428
+ contain: 1,
4429
+ boxSizing: 1,
4430
+ boxShadow: 1,
4431
+ outlineStyle: 1,
4432
+ outlineOffset: 1,
4433
+ outlineWidth: 1,
4434
+ outlineColor: 1
4435
+ });
4436
+ function passDownProp(viewProps, key, val, shouldMergeObject = !1) {
4437
+ if (shouldMergeObject) {
4438
+ let next = {
4439
+ ...viewProps[key],
4440
+ ...val
4398
4441
  };
4399
- }, [
4400
- themeManager,
4401
- parentManager,
4402
- isNewTheme,
4403
- props.componentName,
4404
- props.inverse,
4405
- props.name,
4406
- props.reset,
4407
- mounted
4408
- ]), process.env.NODE_ENV === "development" && props.debug !== "profile" && (0, import_react3.useEffect)(() => (globalThis.TamaguiThemeManagers ??= /* @__PURE__ */ new Set(), globalThis.TamaguiThemeManagers.add(themeManager), () => {
4409
- globalThis.TamaguiThemeManagers.delete(themeManager);
4410
- }), [themeManager])), isInversingOnMount)
4411
- return {
4412
- isNewTheme: !1,
4413
- inversed: !1,
4414
- themeManager: parentManager,
4415
- state: {
4416
- name: "",
4417
- ...parentManager == null ? void 0 : parentManager.state,
4418
- className: ""
4419
- }
4442
+ delete viewProps[key], viewProps[key] = next;
4443
+ } else
4444
+ viewProps[key] = val;
4445
+ }
4446
+ }
4447
+ });
4448
+
4449
+ // ../web/dist/cjs/helpers/mergeProps.native.js
4450
+ var require_mergeProps_native = __commonJS({
4451
+ "../web/dist/cjs/helpers/mergeProps.native.js"(exports2, module2) {
4452
+ "use strict";
4453
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
4454
+ for (var name in all)
4455
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
4456
+ }, __copyProps2 = (to, from, except, desc) => {
4457
+ if (from && typeof from == "object" || typeof from == "function")
4458
+ for (let key of __getOwnPropNames2(from))
4459
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
4460
+ return to;
4461
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), mergeProps_exports = {};
4462
+ __export2(mergeProps_exports, {
4463
+ mergeProps: () => mergeProps
4464
+ });
4465
+ module2.exports = __toCommonJS2(mergeProps_exports);
4466
+ var import_useMedia = require_useMedia_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), mergeProps = (a, b, inverseShorthands) => {
4467
+ let out = {};
4468
+ for (let key in a)
4469
+ mergeProp(out, a, b, key, inverseShorthands);
4470
+ if (b)
4471
+ for (let key in b)
4472
+ mergeProp(out, b, void 0, key, inverseShorthands);
4473
+ return out;
4474
+ };
4475
+ function mergeProp(out, a, b, key, inverseShorthands) {
4476
+ let longhand = (inverseShorthands == null ? void 0 : inverseShorthands[key]) || null, val = a[key];
4477
+ if (key in import_pseudoDescriptors.pseudoDescriptors || import_useMedia.mediaKeys.has(key)) {
4478
+ out[key] = {
4479
+ ...out[key],
4480
+ ...val
4420
4481
  };
4421
- return {
4422
- state,
4423
- isNewTheme,
4424
- inversed,
4425
- themeManager
4426
- };
4427
- function createState(prev, force = !1) {
4428
- if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1 && !force)
4429
- return prev;
4430
- let themeManager2 = parentManager, state2;
4431
- if ((0, import_ThemeManager.getHasThemeUpdatingProps)(props)) {
4432
- let getNewThemeManager = () => new import_ThemeManager.ThemeManager(props, isRoot ? "root" : parentManager);
4433
- if (prev != null && prev.themeManager) {
4434
- themeManager2 = prev.themeManager;
4435
- let forceChange = force || !!(keys != null && keys.length), next = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(
4436
- themeManager2,
4437
- next,
4438
- prev.state,
4439
- forceChange
4440
- );
4441
- nextState ? (state2 = nextState, prev.isNewTheme ? themeManager2.updateState(nextState) : themeManager2 = getNewThemeManager()) : prev.isNewTheme && parentManager && !next && (themeManager2 = parentManager);
4442
- } else
4443
- themeManager2 = getNewThemeManager(), state2 = { ...themeManager2.state };
4444
- }
4445
- let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse);
4446
- isNewTheme2 && registerThemeManager(themeManager2);
4447
- let mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
4448
- state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
4449
- let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed != null ? !1 : null, response = {
4450
- themeManager: themeManager2,
4451
- isNewTheme: isNewTheme2,
4452
- mounted: mounted2,
4453
- inversed: inversed2
4454
- }, shouldReturnPrev = prev && !force && // isEqualShallow uses the second arg as the keys so this should compare without state first...
4455
- (0, import_createShallowSetState.isEqualShallow)(prev, response) && // ... and then compare just the state, because we make a new state obj but is likely the same
4456
- (0, import_createShallowSetState.isEqualShallow)(prev.state, state2);
4457
- if (prev && shouldReturnPrev)
4458
- return prev;
4459
- if (response.state = state2, process.env.NODE_ENV === "development" && props.debug && import_constants.isClient) {
4460
- console.groupCollapsed(` \u{1F537} ${themeManager2.id} useChangeThemeEffect createState`);
4461
- let parentState = { ...parentManager == null ? void 0 : parentManager.state }, parentId = parentManager == null ? void 0 : parentManager.id, themeManagerState = { ...themeManager2.state };
4462
- console.info({
4463
- props,
4464
- parentState,
4465
- parentId,
4466
- themeManager: themeManager2,
4467
- prev,
4468
- response,
4469
- themeManagerState
4470
- }), console.groupEnd();
4471
- }
4472
- return response;
4482
+ return;
4473
4483
  }
4474
- };
4484
+ b && (key in b || longhand && longhand in b) || (out[longhand || key] = val);
4485
+ }
4475
4486
  }
4476
4487
  });
4477
4488