@nypl/web-reader 4.3.3 → 4.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1658,2397 +1658,2384 @@ function variantSolid(props) {
1658
1658
  }
1659
1659
  var button_default = ButtonStyle;
1660
1660
 
1661
- // node_modules/@chakra-ui/shared-utils/dist/index.mjs
1662
- function isDev() {
1663
- return process.env.NODE_ENV !== "production";
1664
- }
1665
- function isObject(value) {
1666
- const type = typeof value;
1667
- return value != null && (type === "object" || type === "function") && !Array.isArray(value);
1668
- }
1669
- var warn = (options) => {
1670
- const { condition, message } = options;
1671
- if (condition && isDev()) {
1672
- console.warn(message);
1673
- }
1661
+ // src/ui/nypl-base-theme/foundations/breakpoints.ts
1662
+ var breakpoints = {
1663
+ sm: "20em",
1664
+ // 320px
1665
+ md: "38em",
1666
+ // 600px
1667
+ lg: "60em",
1668
+ // 960px
1669
+ xl: "80em",
1670
+ // 1280px
1671
+ "2xl": "96em"
1674
1672
  };
1675
- function runIfFn(valueOrFn, ...args) {
1676
- return isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
1677
- }
1678
- var isFunction = (value) => typeof value === "function";
1679
- var dataAttr = (condition) => condition ? "" : void 0;
1673
+ var breakpoints_default = breakpoints;
1680
1674
 
1681
- // node_modules/@chakra-ui/styled-system/dist/index.mjs
1682
- var import_lodash = __toESM(require_lodash(), 1);
1683
- var import_lodash2 = __toESM(require_lodash(), 1);
1684
- var import_lodash3 = __toESM(require_lodash(), 1);
1685
- var import_lodash4 = __toESM(require_lodash(), 1);
1686
- var isImportant = (value) => /!(important)?$/.test(value);
1687
- var withoutImportant = (value) => typeof value === "string" ? value.replace(/!(important)?$/, "").trim() : value;
1688
- var tokenToCSSVar = (scale, value) => (theme2) => {
1689
- const valueStr = String(value);
1690
- const important = isImportant(valueStr);
1691
- const valueWithoutImportant = withoutImportant(valueStr);
1692
- const key = scale ? `${scale}.${valueWithoutImportant}` : valueWithoutImportant;
1693
- let transformed = isObject(theme2.__cssMap) && key in theme2.__cssMap ? theme2.__cssMap[key].varRef : value;
1694
- transformed = withoutImportant(transformed);
1695
- return important ? `${transformed} !important` : transformed;
1696
- };
1697
- function createTransform(options) {
1698
- const { scale, transform: transform2, compose: compose2 } = options;
1699
- const fn = (value, theme2) => {
1700
- var _a2;
1701
- const _value = tokenToCSSVar(scale, value)(theme2);
1702
- let result = (_a2 = transform2 == null ? void 0 : transform2(_value, theme2)) != null ? _a2 : _value;
1703
- if (compose2) {
1704
- result = compose2(result, theme2);
1705
- }
1706
- return result;
1707
- };
1708
- return fn;
1709
- }
1710
- var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
1711
- function toConfig(scale, transform2) {
1712
- return (property) => {
1713
- const result = { property, scale };
1714
- result.transform = createTransform({
1715
- scale,
1716
- transform: transform2
1717
- });
1718
- return result;
1719
- };
1720
- }
1721
- var getRtl = ({ rtl, ltr }) => (theme2) => theme2.direction === "rtl" ? rtl : ltr;
1722
- function logical(options) {
1723
- const { property, scale, transform: transform2 } = options;
1724
- return {
1725
- scale,
1726
- property: getRtl(property),
1727
- transform: scale ? createTransform({
1728
- scale,
1729
- compose: transform2
1730
- }) : transform2
1731
- };
1732
- }
1733
- var transformTemplate = [
1734
- "rotate(var(--chakra-rotate, 0))",
1735
- "scaleX(var(--chakra-scale-x, 1))",
1736
- "scaleY(var(--chakra-scale-y, 1))",
1737
- "skewX(var(--chakra-skew-x, 0))",
1738
- "skewY(var(--chakra-skew-y, 0))"
1739
- ];
1740
- function getTransformTemplate() {
1741
- return [
1742
- "translateX(var(--chakra-translate-x, 0))",
1743
- "translateY(var(--chakra-translate-y, 0))",
1744
- ...transformTemplate
1745
- ].join(" ");
1746
- }
1747
- function getTransformGpuTemplate() {
1748
- return [
1749
- "translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",
1750
- ...transformTemplate
1751
- ].join(" ");
1752
- }
1753
- var filterTemplate = {
1754
- "--chakra-blur": "var(--chakra-empty,/*!*/ /*!*/)",
1755
- "--chakra-brightness": "var(--chakra-empty,/*!*/ /*!*/)",
1756
- "--chakra-contrast": "var(--chakra-empty,/*!*/ /*!*/)",
1757
- "--chakra-grayscale": "var(--chakra-empty,/*!*/ /*!*/)",
1758
- "--chakra-hue-rotate": "var(--chakra-empty,/*!*/ /*!*/)",
1759
- "--chakra-invert": "var(--chakra-empty,/*!*/ /*!*/)",
1760
- "--chakra-saturate": "var(--chakra-empty,/*!*/ /*!*/)",
1761
- "--chakra-sepia": "var(--chakra-empty,/*!*/ /*!*/)",
1762
- "--chakra-drop-shadow": "var(--chakra-empty,/*!*/ /*!*/)",
1763
- filter: [
1764
- "var(--chakra-blur)",
1765
- "var(--chakra-brightness)",
1766
- "var(--chakra-contrast)",
1767
- "var(--chakra-grayscale)",
1768
- "var(--chakra-hue-rotate)",
1769
- "var(--chakra-invert)",
1770
- "var(--chakra-saturate)",
1771
- "var(--chakra-sepia)",
1772
- "var(--chakra-drop-shadow)"
1773
- ].join(" ")
1774
- };
1775
- var backdropFilterTemplate = {
1776
- backdropFilter: [
1777
- "var(--chakra-backdrop-blur)",
1778
- "var(--chakra-backdrop-brightness)",
1779
- "var(--chakra-backdrop-contrast)",
1780
- "var(--chakra-backdrop-grayscale)",
1781
- "var(--chakra-backdrop-hue-rotate)",
1782
- "var(--chakra-backdrop-invert)",
1783
- "var(--chakra-backdrop-opacity)",
1784
- "var(--chakra-backdrop-saturate)",
1785
- "var(--chakra-backdrop-sepia)"
1786
- ].join(" "),
1787
- "--chakra-backdrop-blur": "var(--chakra-empty,/*!*/ /*!*/)",
1788
- "--chakra-backdrop-brightness": "var(--chakra-empty,/*!*/ /*!*/)",
1789
- "--chakra-backdrop-contrast": "var(--chakra-empty,/*!*/ /*!*/)",
1790
- "--chakra-backdrop-grayscale": "var(--chakra-empty,/*!*/ /*!*/)",
1791
- "--chakra-backdrop-hue-rotate": "var(--chakra-empty,/*!*/ /*!*/)",
1792
- "--chakra-backdrop-invert": "var(--chakra-empty,/*!*/ /*!*/)",
1793
- "--chakra-backdrop-opacity": "var(--chakra-empty,/*!*/ /*!*/)",
1794
- "--chakra-backdrop-saturate": "var(--chakra-empty,/*!*/ /*!*/)",
1795
- "--chakra-backdrop-sepia": "var(--chakra-empty,/*!*/ /*!*/)"
1796
- };
1797
- function getRingTemplate(value) {
1798
- return {
1799
- "--chakra-ring-offset-shadow": `var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)`,
1800
- "--chakra-ring-shadow": `var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)`,
1801
- "--chakra-ring-width": value,
1802
- boxShadow: [
1803
- `var(--chakra-ring-offset-shadow)`,
1804
- `var(--chakra-ring-shadow)`,
1805
- `var(--chakra-shadow, 0 0 #0000)`
1806
- ].join(", ")
1807
- };
1808
- }
1809
- var flexDirectionTemplate = {
1810
- "row-reverse": {
1811
- space: "--chakra-space-x-reverse",
1812
- divide: "--chakra-divide-x-reverse"
1813
- },
1814
- "column-reverse": {
1815
- space: "--chakra-space-y-reverse",
1816
- divide: "--chakra-divide-y-reverse"
1817
- }
1818
- };
1819
- var directionMap = {
1820
- "to-t": "to top",
1821
- "to-tr": "to top right",
1822
- "to-r": "to right",
1823
- "to-br": "to bottom right",
1824
- "to-b": "to bottom",
1825
- "to-bl": "to bottom left",
1826
- "to-l": "to left",
1827
- "to-tl": "to top left"
1828
- };
1829
- var valueSet = new Set(Object.values(directionMap));
1830
- var globalSet = /* @__PURE__ */ new Set([
1831
- "none",
1832
- "-moz-initial",
1833
- "inherit",
1834
- "initial",
1835
- "revert",
1836
- "unset"
1837
- ]);
1838
- var trimSpace = (str) => str.trim();
1839
- function parseGradient(value, theme2) {
1840
- if (value == null || globalSet.has(value))
1841
- return value;
1842
- const prevent = isCSSFunction(value) || globalSet.has(value);
1843
- if (!prevent)
1844
- return `url('${value}')`;
1845
- const regex = /(^[a-z-A-Z]+)\((.*)\)/g;
1846
- const results = regex.exec(value);
1847
- const type = results == null ? void 0 : results[1];
1848
- const values = results == null ? void 0 : results[2];
1849
- if (!type || !values)
1850
- return value;
1851
- const _type = type.includes("-gradient") ? type : `${type}-gradient`;
1852
- const [maybeDirection, ...stops] = values.split(",").map(trimSpace).filter(Boolean);
1853
- if ((stops == null ? void 0 : stops.length) === 0)
1854
- return value;
1855
- const direction = maybeDirection in directionMap ? directionMap[maybeDirection] : maybeDirection;
1856
- stops.unshift(direction);
1857
- const _values = stops.map((stop) => {
1858
- if (valueSet.has(stop))
1859
- return stop;
1860
- const firstStop = stop.indexOf(" ");
1861
- const [_color, _stop] = firstStop !== -1 ? [stop.substr(0, firstStop), stop.substr(firstStop + 1)] : [stop];
1862
- const _stopOrFunc = isCSSFunction(_stop) ? _stop : _stop && _stop.split(" ");
1863
- const key = `colors.${_color}`;
1864
- const color2 = key in theme2.__cssMap ? theme2.__cssMap[key].varRef : _color;
1865
- return _stopOrFunc ? [
1866
- color2,
1867
- ...Array.isArray(_stopOrFunc) ? _stopOrFunc : [_stopOrFunc]
1868
- ].join(" ") : color2;
1869
- });
1870
- return `${_type}(${_values.join(", ")})`;
1871
- }
1872
- var isCSSFunction = (value) => {
1873
- return typeof value === "string" && value.includes("(") && value.includes(")");
1874
- };
1875
- var gradientTransform = (value, theme2) => parseGradient(value, theme2 != null ? theme2 : {});
1876
- function isCssVar(value) {
1877
- return /^var\(--.+\)$/.test(value);
1878
- }
1879
- var analyzeCSSValue = (value) => {
1880
- const num = parseFloat(value.toString());
1881
- const unit = value.toString().replace(String(num), "");
1882
- return { unitless: !unit, value: num, unit };
1883
- };
1884
- var wrap = (str) => (value) => `${str}(${value})`;
1885
- var transformFunctions = {
1886
- filter(value) {
1887
- return value !== "auto" ? value : filterTemplate;
1675
+ // src/ui/nypl-base-theme/foundations/typography.ts
1676
+ var typography2 = {
1677
+ fonts: {
1678
+ body: "-apple-system, BlinkMacSystemFont, system-ui, sans-serif",
1679
+ heading: "-apple-system, BlinkMacSystemFont, system-ui, sans-seri",
1680
+ mono: `Courier,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace`
1888
1681
  },
1889
- backdropFilter(value) {
1890
- return value !== "auto" ? value : backdropFilterTemplate;
1682
+ fontSizes: {
1683
+ "-2": "0.75rem",
1684
+ "-1": "0.875rem",
1685
+ "0": "1rem",
1686
+ "1": "1.125rem",
1687
+ "2": "1.25rem",
1688
+ "3": "1.75rem",
1689
+ "4": "2.25rem",
1690
+ "5": "3rem"
1891
1691
  },
1892
- ring(value) {
1893
- return getRingTemplate(transformFunctions.px(value));
1692
+ fontWeights: {
1693
+ light: 300,
1694
+ regular: 400,
1695
+ medium: 500,
1696
+ bold: 700
1894
1697
  },
1895
- bgClip(value) {
1896
- return value === "text" ? { color: "transparent", backgroundClip: "text" } : { backgroundClip: value };
1897
- },
1898
- transform(value) {
1899
- if (value === "auto")
1900
- return getTransformTemplate();
1901
- if (value === "auto-gpu")
1902
- return getTransformGpuTemplate();
1903
- return value;
1904
- },
1905
- vh(value) {
1906
- return value === "$100vh" ? "var(--chakra-vh)" : value;
1698
+ lineHeights: [1, 1.1, 1.25, 1.5, 2, 2.5],
1699
+ letterSpacings: {
1700
+ tighter: "-0.05em",
1701
+ tight: "-0.025em",
1702
+ normal: "0",
1703
+ wide: "0.025em",
1704
+ wider: "0.05em",
1705
+ widest: "0.1em"
1706
+ }
1707
+ };
1708
+ var typography_default2 = typography2;
1709
+
1710
+ // src/ui/nypl-base-theme/foundations/colors.ts
1711
+ var colors2 = {
1712
+ transparent: "transparent",
1713
+ // ui fills
1714
+ ui: {
1715
+ black: "#000",
1716
+ white: "#fff",
1717
+ focus: "#4181F1",
1718
+ link: {
1719
+ primary: "#0576D3",
1720
+ secondary: "#004B98"
1721
+ },
1722
+ success: {
1723
+ primary: "#077719",
1724
+ secondary: "#095212"
1725
+ },
1726
+ warning: {
1727
+ primary: "#F0974E",
1728
+ secondary: "#EC7B1F"
1729
+ },
1730
+ status: {
1731
+ primary: "#F9E08E",
1732
+ secondary: "#FBE7E1"
1733
+ },
1734
+ error: "#97272C",
1735
+ disabled: {
1736
+ primary: "#E0E0E0",
1737
+ secondary: "#FAFAFA"
1738
+ },
1739
+ test: "#FF6347",
1740
+ gray: {
1741
+ active: "#D9D9D9",
1742
+ disabled: "#979797",
1743
+ icon: "#1C1B1F",
1744
+ medium: "#BDBDBD",
1745
+ dark: "#616161",
1746
+ "x-dark": "#424242",
1747
+ "light-cool": "#E0E0E0",
1748
+ "light-warm": "#EFEDEB",
1749
+ "x-light-cool": "#F5F5F5",
1750
+ "x-light-warm": "#F8F8F7",
1751
+ "xx-light-cool": "#FAFAFA"
1752
+ }
1907
1753
  },
1908
- px(value) {
1909
- if (value == null)
1910
- return value;
1911
- const { unitless } = analyzeCSSValue(value);
1912
- return unitless || typeof value === "number" ? `${value}px` : value;
1754
+ // brand fills. Only primary and secondary filled in for now.
1755
+ brand: {
1756
+ primary: "#C60917",
1757
+ secondary: "#760000",
1758
+ "nypl-red": "#D0343A"
1913
1759
  },
1914
- fraction(value) {
1915
- return !(typeof value === "number") || value > 1 ? value : `${value * 100}%`;
1760
+ /**
1761
+ * The following color scales are useful for color edge cases
1762
+ * where a distinct named ui or brand color doesn't quite work.
1763
+ */
1764
+ // based on ui/gray/medium
1765
+ gray: {
1766
+ "50": "#F2F2F2",
1767
+ "100": "#DBDBDB",
1768
+ "200": "#C4C4C4",
1769
+ "300": "#ADADAD",
1770
+ "400": "#969696",
1771
+ "500": "#808080",
1772
+ "600": "#666666",
1773
+ "700": "#4D4D4D",
1774
+ "800": "#333333",
1775
+ "900": "#1A1A1A"
1916
1776
  },
1917
- float(value, theme2) {
1918
- const map = { left: "right", right: "left" };
1919
- return theme2.direction === "rtl" ? map[value] : value;
1777
+ // based on NYPL red
1778
+ red: {
1779
+ 50: "#ffe7e6",
1780
+ 100: "#f6c2bf",
1781
+ 200: "#e99796",
1782
+ 300: "#de6d6e",
1783
+ 400: "#d4454a",
1784
+ 500: "#ba2f2b",
1785
+ 600: "#922b21",
1786
+ 700: "#692216",
1787
+ 800: "#41150a",
1788
+ 900: "#1d0a01"
1920
1789
  },
1921
- degree(value) {
1922
- if (isCssVar(value) || value == null)
1923
- return value;
1924
- const unitless = typeof value === "string" && !value.endsWith("deg");
1925
- return typeof value === "number" || unitless ? `${value}deg` : value;
1790
+ // based on ui/warning/secondary
1791
+ orange: {
1792
+ "50": "#FDF1E7",
1793
+ "100": "#F9D8BD",
1794
+ "200": "#F6BF93",
1795
+ "300": "#F2A669",
1796
+ "400": "#EF8D3E",
1797
+ "500": "#EB7414",
1798
+ "600": "#BC5D10",
1799
+ "700": "#8D460C",
1800
+ "800": "#5E2F08",
1801
+ "900": "#2F1704"
1926
1802
  },
1927
- gradient: gradientTransform,
1928
- blur: wrap("blur"),
1929
- opacity: wrap("opacity"),
1930
- brightness: wrap("brightness"),
1931
- contrast: wrap("contrast"),
1932
- dropShadow: wrap("drop-shadow"),
1933
- grayscale: wrap("grayscale"),
1934
- hueRotate: wrap("hue-rotate"),
1935
- invert: wrap("invert"),
1936
- saturate: wrap("saturate"),
1937
- sepia: wrap("sepia"),
1938
- bgImage(value) {
1939
- if (value == null)
1940
- return value;
1941
- const prevent = isCSSFunction(value) || globalSet.has(value);
1942
- return !prevent ? `url(${value})` : value;
1803
+ // based on ui/status/primary
1804
+ yellow: {
1805
+ "50": "#FEF8E7",
1806
+ "100": "#FBECBB",
1807
+ "200": "#F9E090",
1808
+ "300": "#F7D464",
1809
+ "400": "#F4C938",
1810
+ "500": "#F2BD0D",
1811
+ "600": "#C2970A",
1812
+ "700": "#917108",
1813
+ "800": "#614B05",
1814
+ "900": "#302603"
1943
1815
  },
1944
- outline(value) {
1945
- const isNoneOrZero = String(value) === "0" || String(value) === "none";
1946
- return value !== null && isNoneOrZero ? { outline: "2px solid transparent", outlineOffset: "2px" } : { outline: value };
1816
+ // based on ui/success/primary
1817
+ green: {
1818
+ "50": "#E7FEEB",
1819
+ "100": "#BCFBC6",
1820
+ "200": "#90F8A1",
1821
+ "300": "#65F67C",
1822
+ "400": "#3AF357",
1823
+ "500": "#0EF133",
1824
+ "600": "#0BC128",
1825
+ "700": "#08911E",
1826
+ "800": "#066014",
1827
+ "900": "#03300A"
1947
1828
  },
1948
- flexDirection(value) {
1949
- var _a2;
1950
- const { space: space2, divide: divide2 } = (_a2 = flexDirectionTemplate[value]) != null ? _a2 : {};
1951
- const result = { flexDirection: value };
1952
- if (space2)
1953
- result[space2] = 1;
1954
- if (divide2)
1955
- result[divide2] = 1;
1956
- return result;
1829
+ // based on NYPL blue
1830
+ blue: {
1831
+ 50: "#dbefff",
1832
+ 100: "#add2ff",
1833
+ 200: "#7cb8ff",
1834
+ 300: "#4aa2ff",
1835
+ 400: "#1a8fff",
1836
+ 500: "#007ee6",
1837
+ 600: "#0056b4",
1838
+ 700: "#003582",
1839
+ 800: "#001a51",
1840
+ 900: "#000621"
1957
1841
  }
1958
1842
  };
1959
- var t = {
1960
- borderWidths: toConfig("borderWidths"),
1961
- borderStyles: toConfig("borderStyles"),
1962
- colors: toConfig("colors"),
1963
- borders: toConfig("borders"),
1964
- gradients: toConfig("gradients", transformFunctions.gradient),
1965
- radii: toConfig("radii", transformFunctions.px),
1966
- space: toConfig("space", pipe(transformFunctions.vh, transformFunctions.px)),
1967
- spaceT: toConfig("space", pipe(transformFunctions.vh, transformFunctions.px)),
1968
- degreeT(property) {
1969
- return { property, transform: transformFunctions.degree };
1970
- },
1971
- prop(property, scale, transform2) {
1972
- return __spreadValues({
1973
- property,
1974
- scale
1975
- }, scale && {
1976
- transform: createTransform({ scale, transform: transform2 })
1977
- });
1978
- },
1979
- propT(property, transform2) {
1980
- return { property, transform: transform2 };
1981
- },
1982
- sizes: toConfig("sizes", pipe(transformFunctions.vh, transformFunctions.px)),
1983
- sizesT: toConfig("sizes", pipe(transformFunctions.vh, transformFunctions.fraction)),
1984
- shadows: toConfig("shadows"),
1985
- logical,
1986
- blur: toConfig("blur", transformFunctions.blur)
1987
- };
1988
- var background = {
1989
- background: t.colors("background"),
1990
- backgroundColor: t.colors("backgroundColor"),
1991
- backgroundImage: t.gradients("backgroundImage"),
1992
- backgroundSize: true,
1993
- backgroundPosition: true,
1994
- backgroundRepeat: true,
1995
- backgroundAttachment: true,
1996
- backgroundClip: { transform: transformFunctions.bgClip },
1997
- bgSize: t.prop("backgroundSize"),
1998
- bgPosition: t.prop("backgroundPosition"),
1999
- bg: t.colors("background"),
2000
- bgColor: t.colors("backgroundColor"),
2001
- bgPos: t.prop("backgroundPosition"),
2002
- bgRepeat: t.prop("backgroundRepeat"),
2003
- bgAttachment: t.prop("backgroundAttachment"),
2004
- bgGradient: t.gradients("backgroundImage"),
2005
- bgClip: { transform: transformFunctions.bgClip }
1843
+ var colors_default2 = colors2;
1844
+
1845
+ // src/ui/nypl-base-theme/foundations/radii.ts
1846
+ var radii = {
1847
+ none: "0",
1848
+ sm: "0.125rem",
1849
+ base: "0.25rem",
1850
+ md: "0.375rem",
1851
+ lg: "0.5rem",
1852
+ xl: "0.75rem",
1853
+ "2xl": "1rem",
1854
+ "3xl": "1.5rem",
1855
+ full: "9999px"
2006
1856
  };
2007
- Object.assign(background, {
2008
- bgImage: background.backgroundImage,
2009
- bgImg: background.backgroundImage
2010
- });
2011
- var border = {
2012
- border: t.borders("border"),
2013
- borderWidth: t.borderWidths("borderWidth"),
2014
- borderStyle: t.borderStyles("borderStyle"),
2015
- borderColor: t.colors("borderColor"),
2016
- borderRadius: t.radii("borderRadius"),
2017
- borderTop: t.borders("borderTop"),
2018
- borderBlockStart: t.borders("borderBlockStart"),
2019
- borderTopLeftRadius: t.radii("borderTopLeftRadius"),
2020
- borderStartStartRadius: t.logical({
2021
- scale: "radii",
2022
- property: {
2023
- ltr: "borderTopLeftRadius",
2024
- rtl: "borderTopRightRadius"
2025
- }
2026
- }),
2027
- borderEndStartRadius: t.logical({
2028
- scale: "radii",
2029
- property: {
2030
- ltr: "borderBottomLeftRadius",
2031
- rtl: "borderBottomRightRadius"
2032
- }
2033
- }),
2034
- borderTopRightRadius: t.radii("borderTopRightRadius"),
2035
- borderStartEndRadius: t.logical({
2036
- scale: "radii",
2037
- property: {
2038
- ltr: "borderTopRightRadius",
2039
- rtl: "borderTopLeftRadius"
1857
+ var radii_default = radii;
1858
+
1859
+ // src/ui/nypl-base-theme/foundations/spacing.ts
1860
+ var spacing = {
1861
+ space: {
1862
+ px: "1px",
1863
+ 0: "0",
1864
+ 0.5: "0.125rem",
1865
+ // 4px
1866
+ 1: "0.25rem",
1867
+ 1.5: "0.375rem",
1868
+ // 8px
1869
+ 2: "0.5rem",
1870
+ 2.5: "0.625rem",
1871
+ 3: "0.75rem",
1872
+ 3.5: "0.875rem",
1873
+ // 16px
1874
+ 4: "1rem",
1875
+ 5: "1.25rem",
1876
+ // 24px
1877
+ 6: "1.5rem",
1878
+ 7: "1.75rem",
1879
+ // 32 px
1880
+ 8: "2rem",
1881
+ 9: "2.25rem",
1882
+ 10: "2.5rem",
1883
+ // 48px
1884
+ 12: "3rem",
1885
+ 14: "3.5rem",
1886
+ // 64px
1887
+ 16: "4rem",
1888
+ 20: "5rem",
1889
+ // 96px
1890
+ 24: "6rem",
1891
+ 28: "7rem",
1892
+ 32: "8rem",
1893
+ 36: "9rem",
1894
+ 40: "10rem",
1895
+ 44: "11rem",
1896
+ 48: "12rem",
1897
+ 52: "13rem",
1898
+ 56: "14rem",
1899
+ 60: "15rem",
1900
+ 64: "16rem",
1901
+ 72: "18rem",
1902
+ 80: "20rem",
1903
+ 96: "24rem"
1904
+ }
1905
+ };
1906
+ var spacing_default = spacing;
1907
+
1908
+ // src/ui/nypl-base-theme/components/checkbox.ts
1909
+ var baseStyleLabel = {
1910
+ userSelect: "none",
1911
+ fontWeight: "light",
1912
+ _disabled: { color: "ui.gray.x-dark", opacity: 1 }
1913
+ };
1914
+ var Checkbox = {
1915
+ // style object for base or default style
1916
+ baseStyle: {
1917
+ control: {
1918
+ borderColor: "ui.gray.dark",
1919
+ _hover: {
1920
+ bg: "white",
1921
+ _disabled: {
1922
+ bg: "ui.gray.x-light-cool"
1923
+ }
1924
+ },
1925
+ _checked: {
1926
+ bg: "white",
1927
+ color: "gray.800",
1928
+ borderColor: "ui.gray.dark",
1929
+ _hover: {
1930
+ bg: "white",
1931
+ borderColor: "ui.gray.x-dark"
1932
+ }
1933
+ },
1934
+ _disabled: {
1935
+ bg: "ui.gray.x-light-cool",
1936
+ borderColor: "ui.gray.medium"
1937
+ }
1938
+ },
1939
+ label: baseStyleLabel
1940
+ },
1941
+ // styles for different sizes ("sm", "md", "lg")
1942
+ sizes: {},
1943
+ // styles for different visual variants ("outline", "solid")
1944
+ variants: {},
1945
+ // default values for `size`, `variant`, `colorScheme`
1946
+ defaultProps: {
1947
+ size: "md",
1948
+ colorScheme: "gray"
1949
+ }
1950
+ };
1951
+ var checkbox_default = Checkbox;
1952
+
1953
+ // src/ui/nypl-base-theme/components/input.ts
1954
+ var size = {
1955
+ lg: {
1956
+ fontSize: "lg",
1957
+ px: 4,
1958
+ h: 12,
1959
+ borderRadius: "none"
1960
+ },
1961
+ md: {
1962
+ fontSize: "sm",
1963
+ px: 4,
1964
+ h: 9,
1965
+ borderRadius: "none"
1966
+ },
1967
+ sm: {
1968
+ fontSize: "sm",
1969
+ px: 3,
1970
+ h: 8,
1971
+ borderRadius: "none"
1972
+ },
1973
+ xs: {
1974
+ fontSize: "xs",
1975
+ px: 2,
1976
+ h: 6,
1977
+ borderRadius: "none"
1978
+ }
1979
+ };
1980
+ var sizes2 = {
1981
+ lg: {
1982
+ field: size.lg,
1983
+ addon: size.lg
1984
+ },
1985
+ md: {
1986
+ field: size.md,
1987
+ addon: size.md
1988
+ },
1989
+ sm: {
1990
+ field: size.sm,
1991
+ addon: size.sm
1992
+ },
1993
+ xs: {
1994
+ field: size.xs,
1995
+ addon: size.xs
1996
+ }
1997
+ };
1998
+ var Input = {
1999
+ // style object for base or default style
2000
+ baseStyle: {
2001
+ field: {
2002
+ borderRadius: "none",
2003
+ fontSize: "sm",
2004
+ _focus: {
2005
+ borderColor: "ui.link.primary",
2006
+ _hover: {
2007
+ borderColor: "ui.link.primary"
2008
+ }
2009
+ },
2010
+ _placeholder: {
2011
+ fontStyle: "italic",
2012
+ color: "ui.gray.dark"
2013
+ },
2014
+ _invalid: {
2015
+ borderColor: "ui.error",
2016
+ _placeholder: {
2017
+ color: "ui.error"
2018
+ },
2019
+ _hover: {
2020
+ borderColor: "ui.error"
2021
+ }
2022
+ }
2040
2023
  }
2041
- }),
2042
- borderEndEndRadius: t.logical({
2043
- scale: "radii",
2044
- property: {
2045
- ltr: "borderBottomRightRadius",
2046
- rtl: "borderBottomLeftRadius"
2024
+ },
2025
+ // styles for different sizes ("sm", "md", "lg")
2026
+ sizes: sizes2,
2027
+ // styles for different visual variants ("outline", "solid")
2028
+ variants: {
2029
+ outline: {
2030
+ field: {
2031
+ _disabled: {
2032
+ bg: "ui.gray.xx-light-cool"
2033
+ },
2034
+ _focus: {
2035
+ boxShadow: "none",
2036
+ _hover: {
2037
+ borderColor: "ui.link.primary"
2038
+ }
2039
+ },
2040
+ _invalid: {
2041
+ boxShadow: "none"
2042
+ }
2043
+ }
2047
2044
  }
2048
- }),
2049
- borderRight: t.borders("borderRight"),
2050
- borderInlineEnd: t.borders("borderInlineEnd"),
2051
- borderBottom: t.borders("borderBottom"),
2052
- borderBlockEnd: t.borders("borderBlockEnd"),
2053
- borderBottomLeftRadius: t.radii("borderBottomLeftRadius"),
2054
- borderBottomRightRadius: t.radii("borderBottomRightRadius"),
2055
- borderLeft: t.borders("borderLeft"),
2056
- borderInlineStart: {
2057
- property: "borderInlineStart",
2058
- scale: "borders"
2059
2045
  },
2060
- borderInlineStartRadius: t.logical({
2061
- scale: "radii",
2062
- property: {
2063
- ltr: ["borderTopLeftRadius", "borderBottomLeftRadius"],
2064
- rtl: ["borderTopRightRadius", "borderBottomRightRadius"]
2046
+ // default values for `size`, `variant`, `colorScheme`
2047
+ defaultProps: {
2048
+ size: "md"
2049
+ }
2050
+ };
2051
+ var input_default = Input;
2052
+
2053
+ // src/ui/nypl-base-theme/foundations/global.ts
2054
+ var global2 = {
2055
+ // styles for the `body`
2056
+ body: {
2057
+ bg: "white",
2058
+ color: "black"
2059
+ },
2060
+ // styles for the `a`
2061
+ a: {
2062
+ color: "ui.link.primary",
2063
+ _hover: {
2064
+ textDecoration: "underline"
2065
2065
  }
2066
- }),
2067
- borderInlineEndRadius: t.logical({
2068
- scale: "radii",
2069
- property: {
2070
- ltr: ["borderTopRightRadius", "borderBottomRightRadius"],
2071
- rtl: ["borderTopLeftRadius", "borderBottomLeftRadius"]
2072
- }
2073
- }),
2074
- borderX: t.borders(["borderLeft", "borderRight"]),
2075
- borderInline: t.borders("borderInline"),
2076
- borderY: t.borders(["borderTop", "borderBottom"]),
2077
- borderBlock: t.borders("borderBlock"),
2078
- borderTopWidth: t.borderWidths("borderTopWidth"),
2079
- borderBlockStartWidth: t.borderWidths("borderBlockStartWidth"),
2080
- borderTopColor: t.colors("borderTopColor"),
2081
- borderBlockStartColor: t.colors("borderBlockStartColor"),
2082
- borderTopStyle: t.borderStyles("borderTopStyle"),
2083
- borderBlockStartStyle: t.borderStyles("borderBlockStartStyle"),
2084
- borderBottomWidth: t.borderWidths("borderBottomWidth"),
2085
- borderBlockEndWidth: t.borderWidths("borderBlockEndWidth"),
2086
- borderBottomColor: t.colors("borderBottomColor"),
2087
- borderBlockEndColor: t.colors("borderBlockEndColor"),
2088
- borderBottomStyle: t.borderStyles("borderBottomStyle"),
2089
- borderBlockEndStyle: t.borderStyles("borderBlockEndStyle"),
2090
- borderLeftWidth: t.borderWidths("borderLeftWidth"),
2091
- borderInlineStartWidth: t.borderWidths("borderInlineStartWidth"),
2092
- borderLeftColor: t.colors("borderLeftColor"),
2093
- borderInlineStartColor: t.colors("borderInlineStartColor"),
2094
- borderLeftStyle: t.borderStyles("borderLeftStyle"),
2095
- borderInlineStartStyle: t.borderStyles("borderInlineStartStyle"),
2096
- borderRightWidth: t.borderWidths("borderRightWidth"),
2097
- borderInlineEndWidth: t.borderWidths("borderInlineEndWidth"),
2098
- borderRightColor: t.colors("borderRightColor"),
2099
- borderInlineEndColor: t.colors("borderInlineEndColor"),
2100
- borderRightStyle: t.borderStyles("borderRightStyle"),
2101
- borderInlineEndStyle: t.borderStyles("borderInlineEndStyle"),
2102
- borderTopRadius: t.radii(["borderTopLeftRadius", "borderTopRightRadius"]),
2103
- borderBottomRadius: t.radii([
2104
- "borderBottomLeftRadius",
2105
- "borderBottomRightRadius"
2106
- ]),
2107
- borderLeftRadius: t.radii(["borderTopLeftRadius", "borderBottomLeftRadius"]),
2108
- borderRightRadius: t.radii([
2109
- "borderTopRightRadius",
2110
- "borderBottomRightRadius"
2111
- ])
2066
+ }
2112
2067
  };
2113
- Object.assign(border, {
2114
- rounded: border.borderRadius,
2115
- roundedTop: border.borderTopRadius,
2116
- roundedTopLeft: border.borderTopLeftRadius,
2117
- roundedTopRight: border.borderTopRightRadius,
2118
- roundedTopStart: border.borderStartStartRadius,
2119
- roundedTopEnd: border.borderStartEndRadius,
2120
- roundedBottom: border.borderBottomRadius,
2121
- roundedBottomLeft: border.borderBottomLeftRadius,
2122
- roundedBottomRight: border.borderBottomRightRadius,
2123
- roundedBottomStart: border.borderEndStartRadius,
2124
- roundedBottomEnd: border.borderEndEndRadius,
2125
- roundedLeft: border.borderLeftRadius,
2126
- roundedRight: border.borderRightRadius,
2127
- roundedStart: border.borderInlineStartRadius,
2128
- roundedEnd: border.borderInlineEndRadius,
2129
- borderStart: border.borderInlineStart,
2130
- borderEnd: border.borderInlineEnd,
2131
- borderTopStartRadius: border.borderStartStartRadius,
2132
- borderTopEndRadius: border.borderStartEndRadius,
2133
- borderBottomStartRadius: border.borderEndStartRadius,
2134
- borderBottomEndRadius: border.borderEndEndRadius,
2135
- borderStartRadius: border.borderInlineStartRadius,
2136
- borderEndRadius: border.borderInlineEndRadius,
2137
- borderStartWidth: border.borderInlineStartWidth,
2138
- borderEndWidth: border.borderInlineEndWidth,
2139
- borderStartColor: border.borderInlineStartColor,
2140
- borderEndColor: border.borderInlineEndColor,
2141
- borderStartStyle: border.borderInlineStartStyle,
2142
- borderEndStyle: border.borderInlineEndStyle
2143
- });
2144
- var color = {
2145
- color: t.colors("color"),
2146
- textColor: t.colors("color"),
2147
- fill: t.colors("fill"),
2148
- stroke: t.colors("stroke")
2068
+ var global_default = global2;
2069
+
2070
+ // src/ui/nypl-base-theme/components/form-label.ts
2071
+ var baseStyle2 = {
2072
+ fontSize: "sm",
2073
+ marginEnd: 0,
2074
+ mb: 2,
2075
+ fontWeight: "medium",
2076
+ transition: "all 0.2s",
2077
+ opacity: 1,
2078
+ _disabled: {
2079
+ opacity: 1
2080
+ }
2149
2081
  };
2150
- var effect = {
2151
- boxShadow: t.shadows("boxShadow"),
2152
- mixBlendMode: true,
2153
- blendMode: t.prop("mixBlendMode"),
2154
- backgroundBlendMode: true,
2155
- bgBlendMode: t.prop("backgroundBlendMode"),
2156
- opacity: true
2082
+ var form_label_default = {
2083
+ baseStyle: baseStyle2
2157
2084
  };
2158
- Object.assign(effect, {
2159
- shadow: effect.boxShadow
2160
- });
2161
- var filter = {
2162
- filter: { transform: transformFunctions.filter },
2163
- blur: t.blur("--chakra-blur"),
2164
- brightness: t.propT("--chakra-brightness", transformFunctions.brightness),
2165
- contrast: t.propT("--chakra-contrast", transformFunctions.contrast),
2166
- hueRotate: t.degreeT("--chakra-hue-rotate"),
2167
- invert: t.propT("--chakra-invert", transformFunctions.invert),
2168
- saturate: t.propT("--chakra-saturate", transformFunctions.saturate),
2169
- dropShadow: t.propT("--chakra-drop-shadow", transformFunctions.dropShadow),
2170
- backdropFilter: { transform: transformFunctions.backdropFilter },
2171
- backdropBlur: t.blur("--chakra-backdrop-blur"),
2172
- backdropBrightness: t.propT(
2173
- "--chakra-backdrop-brightness",
2174
- transformFunctions.brightness
2175
- ),
2176
- backdropContrast: t.propT("--chakra-backdrop-contrast", transformFunctions.contrast),
2177
- backdropHueRotate: t.degreeT("--chakra-backdrop-hue-rotate"),
2178
- backdropInvert: t.propT("--chakra-backdrop-invert", transformFunctions.invert),
2179
- backdropSaturate: t.propT("--chakra-backdrop-saturate", transformFunctions.saturate)
2085
+
2086
+ // src/ui/nypl-base-theme/components/form.ts
2087
+ var baseStyle3 = {
2088
+ requiredIndicator: {
2089
+ marginStart: 1,
2090
+ color: "red.500"
2091
+ },
2092
+ helperText: {
2093
+ mt: 2,
2094
+ color: "black",
2095
+ lineHeight: "normal",
2096
+ fontSize: "xs"
2097
+ }
2180
2098
  };
2181
- var flexbox = {
2182
- alignItems: true,
2183
- alignContent: true,
2184
- justifyItems: true,
2185
- justifyContent: true,
2186
- flexWrap: true,
2187
- flexDirection: { transform: transformFunctions.flexDirection },
2188
- flex: true,
2189
- flexFlow: true,
2190
- flexGrow: true,
2191
- flexShrink: true,
2192
- flexBasis: t.sizes("flexBasis"),
2193
- justifySelf: true,
2194
- alignSelf: true,
2195
- order: true,
2196
- placeItems: true,
2197
- placeContent: true,
2198
- placeSelf: true,
2199
- gap: t.space("gap"),
2200
- rowGap: t.space("rowGap"),
2201
- columnGap: t.space("columnGap")
2099
+ var form_default = {
2100
+ baseStyle: baseStyle3
2202
2101
  };
2203
- Object.assign(flexbox, {
2204
- flexDir: flexbox.flexDirection
2205
- });
2206
- var grid = {
2207
- gridGap: t.space("gridGap"),
2208
- gridColumnGap: t.space("gridColumnGap"),
2209
- gridRowGap: t.space("gridRowGap"),
2210
- gridColumn: true,
2211
- gridRow: true,
2212
- gridAutoFlow: true,
2213
- gridAutoColumns: true,
2214
- gridColumnStart: true,
2215
- gridColumnEnd: true,
2216
- gridRowStart: true,
2217
- gridRowEnd: true,
2218
- gridAutoRows: true,
2219
- gridTemplate: true,
2220
- gridTemplateColumns: true,
2221
- gridTemplateRows: true,
2222
- gridTemplateAreas: true,
2223
- gridArea: true
2102
+
2103
+ // src/ui/nypl-base-theme/components/form-error.ts
2104
+ var baseStyle4 = {
2105
+ text: {
2106
+ color: "ui.error",
2107
+ mt: 2,
2108
+ fontSize: "xs"
2109
+ },
2110
+ icon: {
2111
+ marginEnd: "0.5em",
2112
+ color: "ui.error"
2113
+ }
2224
2114
  };
2225
- var interactivity = {
2226
- appearance: true,
2227
- cursor: true,
2228
- resize: true,
2229
- userSelect: true,
2230
- pointerEvents: true,
2231
- outline: { transform: transformFunctions.outline },
2232
- outlineOffset: true,
2233
- outlineColor: t.colors("outlineColor")
2115
+ var form_error_default = {
2116
+ baseStyle: baseStyle4
2234
2117
  };
2235
- var layout = {
2236
- width: t.sizesT("width"),
2237
- inlineSize: t.sizesT("inlineSize"),
2238
- height: t.sizes("height"),
2239
- blockSize: t.sizes("blockSize"),
2240
- boxSize: t.sizes(["width", "height"]),
2241
- minWidth: t.sizes("minWidth"),
2242
- minInlineSize: t.sizes("minInlineSize"),
2243
- minHeight: t.sizes("minHeight"),
2244
- minBlockSize: t.sizes("minBlockSize"),
2245
- maxWidth: t.sizes("maxWidth"),
2246
- maxInlineSize: t.sizes("maxInlineSize"),
2247
- maxHeight: t.sizes("maxHeight"),
2248
- maxBlockSize: t.sizes("maxBlockSize"),
2249
- overflow: true,
2250
- overflowX: true,
2251
- overflowY: true,
2252
- overscrollBehavior: true,
2253
- overscrollBehaviorX: true,
2254
- overscrollBehaviorY: true,
2255
- display: true,
2256
- aspectRatio: true,
2257
- hideFrom: {
2258
- scale: "breakpoints",
2259
- transform: (value, theme2) => {
2260
- var _a2, _b, _c;
2261
- const breakpoint = (_c = (_b = (_a2 = theme2.__breakpoints) == null ? void 0 : _a2.get(value)) == null ? void 0 : _b.minW) != null ? _c : value;
2262
- const mq = `@media screen and (min-width: ${breakpoint})`;
2263
- return { [mq]: { display: "none" } };
2264
- }
2265
- },
2266
- hideBelow: {
2267
- scale: "breakpoints",
2268
- transform: (value, theme2) => {
2269
- var _a2, _b, _c;
2270
- const breakpoint = (_c = (_b = (_a2 = theme2.__breakpoints) == null ? void 0 : _a2.get(value)) == null ? void 0 : _b._minW) != null ? _c : value;
2271
- const mq = `@media screen and (max-width: ${breakpoint})`;
2272
- return { [mq]: { display: "none" } };
2118
+
2119
+ // src/ui/nypl-base-theme/components/text-area.ts
2120
+ var sizes3 = {
2121
+ xs: input_default.sizes.xs.field,
2122
+ sm: input_default.sizes.sm.field,
2123
+ md: input_default.sizes.md.field,
2124
+ lg: input_default.sizes.lg.field
2125
+ };
2126
+ var text_area_default = {
2127
+ baseStyle: {
2128
+ _disabled: {
2129
+ bg: "ui.gray.x-light-cool"
2273
2130
  }
2274
2131
  },
2275
- verticalAlign: true,
2276
- boxSizing: true,
2277
- boxDecorationBreak: true,
2278
- float: t.propT("float", transformFunctions.float),
2279
- objectFit: true,
2280
- objectPosition: true,
2281
- visibility: true,
2282
- isolation: true
2283
- };
2284
- Object.assign(layout, {
2285
- w: layout.width,
2286
- h: layout.height,
2287
- minW: layout.minWidth,
2288
- maxW: layout.maxWidth,
2289
- minH: layout.minHeight,
2290
- maxH: layout.maxHeight,
2291
- overscroll: layout.overscrollBehavior,
2292
- overscrollX: layout.overscrollBehaviorX,
2293
- overscrollY: layout.overscrollBehaviorY
2294
- });
2295
- var list = {
2296
- listStyleType: true,
2297
- listStylePosition: true,
2298
- listStylePos: t.prop("listStylePosition"),
2299
- listStyleImage: true,
2300
- listStyleImg: t.prop("listStyleImage")
2301
- };
2302
- function get(obj, path, fallback, index) {
2303
- const key = typeof path === "string" ? path.split(".") : [path];
2304
- for (index = 0; index < key.length; index += 1) {
2305
- if (!obj)
2306
- break;
2307
- obj = obj[key[index]];
2308
- }
2309
- return obj === void 0 ? fallback : obj;
2310
- }
2311
- var memoize = (fn) => {
2312
- const cache = /* @__PURE__ */ new WeakMap();
2313
- const memoizedFn = (obj, path, fallback, index) => {
2314
- if (typeof obj === "undefined") {
2315
- return fn(obj, path, fallback);
2316
- }
2317
- if (!cache.has(obj)) {
2318
- cache.set(obj, /* @__PURE__ */ new Map());
2319
- }
2320
- const map = cache.get(obj);
2321
- if (map.has(path)) {
2322
- return map.get(path);
2323
- }
2324
- const value = fn(obj, path, fallback, index);
2325
- map.set(path, value);
2326
- return value;
2327
- };
2328
- return memoizedFn;
2329
- };
2330
- var memoizedGet = memoize(get);
2331
- var srOnly = {
2332
- border: "0px",
2333
- clip: "rect(0, 0, 0, 0)",
2334
- width: "1px",
2335
- height: "1px",
2336
- margin: "-1px",
2337
- padding: "0px",
2338
- overflow: "hidden",
2339
- whiteSpace: "nowrap",
2340
- position: "absolute"
2341
- };
2342
- var srFocusable = {
2343
- position: "static",
2344
- width: "auto",
2345
- height: "auto",
2346
- clip: "auto",
2347
- padding: "0",
2348
- margin: "0",
2349
- overflow: "visible",
2350
- whiteSpace: "normal"
2132
+ sizes: sizes3
2351
2133
  };
2352
- var getWithPriority = (theme2, key, styles) => {
2353
- const result = {};
2354
- const obj = memoizedGet(theme2, key, {});
2355
- for (const prop in obj) {
2356
- const isInStyles = prop in styles && styles[prop] != null;
2357
- if (!isInStyles)
2358
- result[prop] = obj[prop];
2134
+
2135
+ // src/ui/nypl-base-theme/index.ts
2136
+ var theme = (0, import_react32.extendTheme)(__spreadProps(__spreadValues({
2137
+ styles: { global: global_default },
2138
+ breakpoints: breakpoints_default,
2139
+ radii: radii_default,
2140
+ colors: colors_default2
2141
+ }, typography_default2), {
2142
+ space: spacing_default,
2143
+ /**
2144
+ * Chakra documentation on component styles:
2145
+ * https://chakra-ui.com/docs/theming/component-style
2146
+ */
2147
+ components: {
2148
+ Button: button_default,
2149
+ Checkbox: checkbox_default,
2150
+ Input: input_default,
2151
+ FormLabel: form_label_default,
2152
+ Form: form_default,
2153
+ FormError: form_error_default,
2154
+ Textarea: text_area_default
2359
2155
  }
2360
- return result;
2361
- };
2362
- var others = {
2363
- srOnly: {
2364
- transform(value) {
2365
- if (value === true)
2366
- return srOnly;
2367
- if (value === "focusable")
2368
- return srFocusable;
2369
- return {};
2370
- }
2371
- },
2372
- layerStyle: {
2373
- processResult: true,
2374
- transform: (value, theme2, styles) => getWithPriority(theme2, `layerStyles.${value}`, styles)
2156
+ }));
2157
+ var nypl_base_theme_default = theme;
2158
+
2159
+ // src/ui/theme/components/button.ts
2160
+ var getButtonStyle = (getColor2) => ({
2161
+ // style object for base or default style
2162
+ baseStyle: {
2163
+ borderRadius: "none"
2375
2164
  },
2376
- textStyle: {
2377
- processResult: true,
2378
- transform: (value, theme2, styles) => getWithPriority(theme2, `textStyles.${value}`, styles)
2165
+ // styles for different sizes ("sm", "md", "lg")
2166
+ sizes: {},
2167
+ // styles for different visual variants ("outline", "solid")
2168
+ variants: {
2169
+ solid: variantSolid2(getColor2),
2170
+ settings: variantSettings(getColor2)
2379
2171
  },
2380
- apply: {
2381
- processResult: true,
2382
- transform: (value, theme2, styles) => getWithPriority(theme2, value, styles)
2172
+ // default values for `size`, `variant`, `colorScheme`
2173
+ defaultProps: {
2174
+ size: "sm",
2175
+ variant: "solid"
2383
2176
  }
2384
- };
2385
- var position = {
2386
- position: true,
2387
- pos: t.prop("position"),
2388
- zIndex: t.prop("zIndex", "zIndices"),
2389
- inset: t.spaceT("inset"),
2390
- insetX: t.spaceT(["left", "right"]),
2391
- insetInline: t.spaceT("insetInline"),
2392
- insetY: t.spaceT(["top", "bottom"]),
2393
- insetBlock: t.spaceT("insetBlock"),
2394
- top: t.spaceT("top"),
2395
- insetBlockStart: t.spaceT("insetBlockStart"),
2396
- bottom: t.spaceT("bottom"),
2397
- insetBlockEnd: t.spaceT("insetBlockEnd"),
2398
- left: t.spaceT("left"),
2399
- insetInlineStart: t.logical({
2400
- scale: "space",
2401
- property: { ltr: "left", rtl: "right" }
2402
- }),
2403
- right: t.spaceT("right"),
2404
- insetInlineEnd: t.logical({
2405
- scale: "space",
2406
- property: { ltr: "right", rtl: "left" }
2407
- })
2408
- };
2409
- Object.assign(position, {
2410
- insetStart: position.insetInlineStart,
2411
- insetEnd: position.insetInlineEnd
2412
2177
  });
2413
- var ring = {
2414
- ring: { transform: transformFunctions.ring },
2415
- ringColor: t.colors("--chakra-ring-color"),
2416
- ringOffset: t.prop("--chakra-ring-offset-width"),
2417
- ringOffsetColor: t.colors("--chakra-ring-offset-color"),
2418
- ringInset: t.prop("--chakra-ring-inset")
2419
- };
2420
- var space = {
2421
- margin: t.spaceT("margin"),
2422
- marginTop: t.spaceT("marginTop"),
2423
- marginBlockStart: t.spaceT("marginBlockStart"),
2424
- marginRight: t.spaceT("marginRight"),
2425
- marginInlineEnd: t.spaceT("marginInlineEnd"),
2426
- marginBottom: t.spaceT("marginBottom"),
2427
- marginBlockEnd: t.spaceT("marginBlockEnd"),
2428
- marginLeft: t.spaceT("marginLeft"),
2429
- marginInlineStart: t.spaceT("marginInlineStart"),
2430
- marginX: t.spaceT(["marginInlineStart", "marginInlineEnd"]),
2431
- marginInline: t.spaceT("marginInline"),
2432
- marginY: t.spaceT(["marginTop", "marginBottom"]),
2433
- marginBlock: t.spaceT("marginBlock"),
2434
- padding: t.space("padding"),
2435
- paddingTop: t.space("paddingTop"),
2436
- paddingBlockStart: t.space("paddingBlockStart"),
2437
- paddingRight: t.space("paddingRight"),
2438
- paddingBottom: t.space("paddingBottom"),
2439
- paddingBlockEnd: t.space("paddingBlockEnd"),
2440
- paddingLeft: t.space("paddingLeft"),
2441
- paddingInlineStart: t.space("paddingInlineStart"),
2442
- paddingInlineEnd: t.space("paddingInlineEnd"),
2443
- paddingX: t.space(["paddingInlineStart", "paddingInlineEnd"]),
2444
- paddingInline: t.space("paddingInline"),
2445
- paddingY: t.space(["paddingTop", "paddingBottom"]),
2446
- paddingBlock: t.space("paddingBlock")
2178
+ var variantSolid2 = (getColor2) => (props) => {
2179
+ const { "aria-expanded": expanded } = props;
2180
+ const bgColor = getColor2("ui.gray.light-warm", "ui.black", "ui.sepia");
2181
+ const bgColorActive = getColor2(
2182
+ "ui.gray.active",
2183
+ "ui.gray.x-dark",
2184
+ "ui.sepiaChecked"
2185
+ );
2186
+ const color2 = getColor2("gray.800", "ui.white", "gray.800");
2187
+ const _focus = {
2188
+ bgColor: bgColorActive,
2189
+ color: color2,
2190
+ ring: "2px",
2191
+ ringInset: "inset"
2192
+ };
2193
+ const _hover = {
2194
+ bgColor: bgColorActive,
2195
+ color: color2,
2196
+ _disabled: { bgColor }
2197
+ };
2198
+ const _active = { bgColor: bgColorActive, color: color2 };
2199
+ const _checked = { bgColor, color: color2 };
2200
+ const _disabled = { bgColor };
2201
+ return {
2202
+ border: "none",
2203
+ borderColor: "gray.100",
2204
+ height: "45px",
2205
+ transition: "none",
2206
+ fontSize: 0,
2207
+ letterSpacing: 1,
2208
+ maxWidth: "100%",
2209
+ cursor: "pointer",
2210
+ bgColor: expanded ? bgColorActive : bgColor,
2211
+ color: color2,
2212
+ _focus,
2213
+ _hover,
2214
+ _active,
2215
+ _checked,
2216
+ _disabled
2217
+ };
2447
2218
  };
2448
- Object.assign(space, {
2449
- m: space.margin,
2450
- mt: space.marginTop,
2451
- mr: space.marginRight,
2452
- me: space.marginInlineEnd,
2453
- marginEnd: space.marginInlineEnd,
2454
- mb: space.marginBottom,
2455
- ml: space.marginLeft,
2456
- ms: space.marginInlineStart,
2457
- marginStart: space.marginInlineStart,
2458
- mx: space.marginX,
2459
- my: space.marginY,
2460
- p: space.padding,
2461
- pt: space.paddingTop,
2462
- py: space.paddingY,
2463
- px: space.paddingX,
2464
- pb: space.paddingBottom,
2465
- pl: space.paddingLeft,
2466
- ps: space.paddingInlineStart,
2467
- paddingStart: space.paddingInlineStart,
2468
- pr: space.paddingRight,
2469
- pe: space.paddingInlineEnd,
2470
- paddingEnd: space.paddingInlineEnd
2471
- });
2472
- var textDecoration = {
2473
- textDecorationColor: t.colors("textDecorationColor"),
2474
- textDecoration: true,
2475
- textDecor: { property: "textDecoration" },
2476
- textDecorationLine: true,
2477
- textDecorationStyle: true,
2478
- textDecorationThickness: true,
2479
- textUnderlineOffset: true,
2480
- textShadow: t.shadows("textShadow")
2481
- };
2482
- var transform = {
2483
- clipPath: true,
2484
- transform: t.propT("transform", transformFunctions.transform),
2485
- transformOrigin: true,
2486
- translateX: t.spaceT("--chakra-translate-x"),
2487
- translateY: t.spaceT("--chakra-translate-y"),
2488
- skewX: t.degreeT("--chakra-skew-x"),
2489
- skewY: t.degreeT("--chakra-skew-y"),
2490
- scaleX: t.prop("--chakra-scale-x"),
2491
- scaleY: t.prop("--chakra-scale-y"),
2492
- scale: t.prop(["--chakra-scale-x", "--chakra-scale-y"]),
2493
- rotate: t.degreeT("--chakra-rotate")
2494
- };
2495
- var transition = {
2496
- transition: true,
2497
- transitionDelay: true,
2498
- animation: true,
2499
- willChange: true,
2500
- transitionDuration: t.prop("transitionDuration", "transition.duration"),
2501
- transitionProperty: t.prop("transitionProperty", "transition.property"),
2502
- transitionTimingFunction: t.prop(
2503
- "transitionTimingFunction",
2504
- "transition.easing"
2505
- )
2506
- };
2507
- var typography2 = {
2508
- fontFamily: t.prop("fontFamily", "fonts"),
2509
- fontSize: t.prop("fontSize", "fontSizes", transformFunctions.px),
2510
- fontWeight: t.prop("fontWeight", "fontWeights"),
2511
- lineHeight: t.prop("lineHeight", "lineHeights"),
2512
- letterSpacing: t.prop("letterSpacing", "letterSpacings"),
2513
- textAlign: true,
2514
- fontStyle: true,
2515
- textIndent: true,
2516
- wordBreak: true,
2517
- overflowWrap: true,
2518
- textOverflow: true,
2519
- textTransform: true,
2520
- whiteSpace: true,
2521
- isTruncated: {
2522
- transform(value) {
2523
- if (value === true) {
2524
- return {
2525
- overflow: "hidden",
2526
- textOverflow: "ellipsis",
2527
- whiteSpace: "nowrap"
2528
- };
2219
+ var variantSettings = (getColor2) => (props) => {
2220
+ const { bgColor } = props;
2221
+ const color2 = getColor2("ui.black", "ui.white", "ui.black");
2222
+ const checkedBgColor = getColor2(
2223
+ "ui.gray.light-warm",
2224
+ "ui.gray.x-dark",
2225
+ "ui.sepiaChecked"
2226
+ );
2227
+ return __spreadProps(__spreadValues({}, variantSolid2(getColor2)(props)), {
2228
+ bgColor: getColor2("ui.white", "ui.black", "ui.sepia"),
2229
+ border: "1px solid",
2230
+ color: color2,
2231
+ py: 8,
2232
+ width: [8, 16, 36],
2233
+ fontSize: [0, 0, 2],
2234
+ whiteSpace: ["normal", "normal", "nowrap"],
2235
+ p: {
2236
+ textAlign: "center"
2237
+ },
2238
+ _active: {
2239
+ bgColor
2240
+ },
2241
+ _checked: {
2242
+ color: color2,
2243
+ bgColor: checkedBgColor,
2244
+ borderBottomColor: checkedBgColor,
2245
+ p: {
2246
+ textDecoration: "underline",
2247
+ textUnderlinePosition: "under"
2529
2248
  }
2530
- }
2531
- },
2532
- noOfLines: {
2533
- static: {
2534
- overflow: "hidden",
2535
- textOverflow: "ellipsis",
2536
- display: "-webkit-box",
2537
- WebkitBoxOrient: "vertical",
2538
- WebkitLineClamp: "var(--chakra-line-clamp)"
2539
2249
  },
2540
- property: "--chakra-line-clamp"
2541
- }
2542
- };
2543
- var scroll = {
2544
- scrollBehavior: true,
2545
- scrollSnapAlign: true,
2546
- scrollSnapStop: true,
2547
- scrollSnapType: true,
2548
- scrollMargin: t.spaceT("scrollMargin"),
2549
- scrollMarginTop: t.spaceT("scrollMarginTop"),
2550
- scrollMarginBottom: t.spaceT("scrollMarginBottom"),
2551
- scrollMarginLeft: t.spaceT("scrollMarginLeft"),
2552
- scrollMarginRight: t.spaceT("scrollMarginRight"),
2553
- scrollMarginX: t.spaceT(["scrollMarginLeft", "scrollMarginRight"]),
2554
- scrollMarginY: t.spaceT(["scrollMarginTop", "scrollMarginBottom"]),
2555
- scrollPadding: t.spaceT("scrollPadding"),
2556
- scrollPaddingTop: t.spaceT("scrollPaddingTop"),
2557
- scrollPaddingBottom: t.spaceT("scrollPaddingBottom"),
2558
- scrollPaddingLeft: t.spaceT("scrollPaddingLeft"),
2559
- scrollPaddingRight: t.spaceT("scrollPaddingRight"),
2560
- scrollPaddingX: t.spaceT(["scrollPaddingLeft", "scrollPaddingRight"]),
2561
- scrollPaddingY: t.spaceT(["scrollPaddingTop", "scrollPaddingBottom"])
2562
- };
2563
- function resolveReference(operand) {
2564
- if (isObject(operand) && operand.reference) {
2565
- return operand.reference;
2566
- }
2567
- return String(operand);
2568
- }
2569
- var toExpression = (operator, ...operands) => operands.map(resolveReference).join(` ${operator} `).replace(/calc/g, "");
2570
- var add = (...operands) => `calc(${toExpression("+", ...operands)})`;
2571
- var subtract = (...operands) => `calc(${toExpression("-", ...operands)})`;
2572
- var multiply = (...operands) => `calc(${toExpression("*", ...operands)})`;
2573
- var divide = (...operands) => `calc(${toExpression("/", ...operands)})`;
2574
- var negate = (x) => {
2575
- const value = resolveReference(x);
2576
- if (value != null && !Number.isNaN(parseFloat(value))) {
2577
- return String(value).startsWith("-") ? String(value).slice(1) : `-${value}`;
2578
- }
2579
- return multiply(value, -1);
2250
+ _hover: {
2251
+ bgColor
2252
+ },
2253
+ _focus: {
2254
+ bgColor,
2255
+ ring: "2px",
2256
+ ringInset: "inset"
2257
+ }
2258
+ });
2580
2259
  };
2581
- var calc = Object.assign(
2582
- (x) => ({
2583
- add: (...operands) => calc(add(x, ...operands)),
2584
- subtract: (...operands) => calc(subtract(x, ...operands)),
2585
- multiply: (...operands) => calc(multiply(x, ...operands)),
2586
- divide: (...operands) => calc(divide(x, ...operands)),
2587
- negate: () => calc(negate(x)),
2588
- toString: () => x.toString()
2589
- }),
2590
- {
2591
- add,
2592
- subtract,
2593
- multiply,
2594
- divide,
2595
- negate
2596
- }
2597
- );
2598
- function analyzeCSSValue2(value) {
2599
- const num = parseFloat(value.toString());
2600
- const unit = value.toString().replace(String(num), "");
2601
- return { unitless: !unit, value: num, unit };
2602
- }
2603
- function px(value) {
2604
- if (value == null)
2605
- return value;
2606
- const { unitless } = analyzeCSSValue2(value);
2607
- return unitless || typeof value === "number" ? `${value}px` : value;
2260
+ var button_default2 = getButtonStyle;
2261
+
2262
+ // src/ui/theme/index.ts
2263
+ function getTheme(colorMode = "day") {
2264
+ return (0, import_react33.extendTheme)(
2265
+ __spreadProps(__spreadValues({
2266
+ colors: colors_default
2267
+ }, typography_default), {
2268
+ /**
2269
+ * Chakra documentation on component styles:
2270
+ * https://chakra-ui.com/docs/theming/component-style
2271
+ */
2272
+ components: {
2273
+ Button: button_default2(getColor(colorMode)),
2274
+ Text: text_default,
2275
+ Alert: alert_default,
2276
+ SkipNavigation: skipNavigation_default
2277
+ },
2278
+ currentColorMode: colorMode
2279
+ }),
2280
+ nypl_base_theme_default
2281
+ );
2608
2282
  }
2609
- function toMediaQueryString(min, max) {
2610
- const query = ["@media screen"];
2611
- if (min)
2612
- query.push("and", `(min-width: ${px(min)})`);
2613
- if (max)
2614
- query.push("and", `(max-width: ${px(max)})`);
2615
- return query.join(" ");
2283
+
2284
+ // src/ui/ToggleButton.tsx
2285
+ function ToggleButton(props) {
2286
+ const _a2 = props, {
2287
+ children,
2288
+ colorMode,
2289
+ icon,
2290
+ iconFill,
2291
+ label,
2292
+ value,
2293
+ isChecked
2294
+ } = _a2, rest = __objRest(_a2, [
2295
+ "children",
2296
+ "colorMode",
2297
+ "icon",
2298
+ "iconFill",
2299
+ "label",
2300
+ "value",
2301
+ "isChecked"
2302
+ ]);
2303
+ const { getInputProps, getRadioProps } = (0, import_react35.useRadio)(props);
2304
+ const input = getInputProps();
2305
+ const radio = getRadioProps();
2306
+ const theme2 = (0, import_react35.useTheme)();
2307
+ return (
2308
+ // This will override the default theme if we specify the colorMode to the toggle button.
2309
+ /* @__PURE__ */ import_react34.default.createElement(import_react35.ThemeProvider, { theme: getTheme(colorMode != null ? colorMode : theme2.currentColorMode) }, /* @__PURE__ */ import_react34.default.createElement(fonts_default, null), /* @__PURE__ */ import_react34.default.createElement(import_react35.Box, { as: "label", display: "flex", flexGrow: 1, "aria-label": label }, /* @__PURE__ */ import_react34.default.createElement("input", __spreadValues({}, input)), /* @__PURE__ */ import_react34.default.createElement(Button_default, __spreadValues(__spreadValues({ as: "div", variant: "settings", flexGrow: 1 }, radio), rest), icon && /* @__PURE__ */ import_react34.default.createElement(
2310
+ import_react35.Icon,
2311
+ {
2312
+ as: icon,
2313
+ verticalAlign: "middle",
2314
+ mr: 1.5,
2315
+ w: 6,
2316
+ h: 6,
2317
+ fill: iconFill && iconFill
2318
+ }
2319
+ ), label && /* @__PURE__ */ import_react34.default.createElement(import_react35.Text, null, label))))
2320
+ );
2616
2321
  }
2617
- var state = {
2618
- hover: (str, post) => `${str}:hover ${post}, ${str}[data-hover] ${post}`,
2619
- focus: (str, post) => `${str}:focus ${post}, ${str}[data-focus] ${post}`,
2620
- focusVisible: (str, post) => `${str}:focus-visible ${post}`,
2621
- focusWithin: (str, post) => `${str}:focus-within ${post}`,
2622
- active: (str, post) => `${str}:active ${post}, ${str}[data-active] ${post}`,
2623
- disabled: (str, post) => `${str}:disabled ${post}, ${str}[data-disabled] ${post}`,
2624
- invalid: (str, post) => `${str}:invalid ${post}, ${str}[data-invalid] ${post}`,
2625
- checked: (str, post) => `${str}:checked ${post}, ${str}[data-checked] ${post}`,
2626
- indeterminate: (str, post) => `${str}:indeterminate ${post}, ${str}[aria-checked=mixed] ${post}, ${str}[data-indeterminate] ${post}`,
2627
- readOnly: (str, post) => `${str}:read-only ${post}, ${str}[readonly] ${post}, ${str}[data-read-only] ${post}`,
2628
- expanded: (str, post) => `${str}:read-only ${post}, ${str}[aria-expanded=true] ${post}, ${str}[data-expanded] ${post}`,
2629
- placeholderShown: (str, post) => `${str}:placeholder-shown ${post}`
2322
+ var FontToggleButton = (props) => {
2323
+ return /* @__PURE__ */ import_react34.default.createElement(ToggleButton, __spreadValues({ fontSize: [-2, -2, -1, -1, 0], py: 6 }, props));
2630
2324
  };
2631
- var toGroup = (fn) => merge((v) => fn(v, "&"), "[role=group]", "[data-group]", ".group");
2632
- var toPeer = (fn) => merge((v) => fn(v, "~ &"), "[data-peer]", ".peer");
2633
- var merge = (fn, ...selectors) => selectors.map(fn).join(", ");
2634
- var pseudoSelectors = {
2635
- _hover: "&:hover, &[data-hover]",
2636
- _active: "&:active, &[data-active]",
2637
- _focus: "&:focus, &[data-focus]",
2638
- _highlighted: "&[data-highlighted]",
2639
- _focusWithin: "&:focus-within",
2640
- _focusVisible: "&:focus-visible, &[data-focus-visible]",
2641
- _disabled: "&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",
2642
- _readOnly: "&[aria-readonly=true], &[readonly], &[data-readonly]",
2643
- _before: "&::before",
2644
- _after: "&::after",
2645
- _empty: "&:empty",
2646
- _expanded: "&[aria-expanded=true], &[data-expanded]",
2647
- _checked: "&[aria-checked=true], &[data-checked]",
2648
- _grabbed: "&[aria-grabbed=true], &[data-grabbed]",
2649
- _pressed: "&[aria-pressed=true], &[data-pressed]",
2650
- _invalid: "&[aria-invalid=true], &[data-invalid]",
2651
- _valid: "&[data-valid], &[data-state=valid]",
2652
- _loading: "&[data-loading], &[aria-busy=true]",
2653
- _selected: "&[aria-selected=true], &[data-selected]",
2654
- _hidden: "&[hidden], &[data-hidden]",
2655
- _autofill: "&:-webkit-autofill",
2656
- _even: "&:nth-of-type(even)",
2657
- _odd: "&:nth-of-type(odd)",
2658
- _first: "&:first-of-type",
2659
- _firstLetter: "&::first-letter",
2660
- _last: "&:last-of-type",
2661
- _notFirst: "&:not(:first-of-type)",
2662
- _notLast: "&:not(:last-of-type)",
2663
- _visited: "&:visited",
2664
- _activeLink: "&[aria-current=page]",
2665
- _activeStep: "&[aria-current=step]",
2666
- _indeterminate: "&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",
2667
- _groupHover: toGroup(state.hover),
2668
- _peerHover: toPeer(state.hover),
2669
- _groupFocus: toGroup(state.focus),
2670
- _peerFocus: toPeer(state.focus),
2671
- _groupFocusVisible: toGroup(state.focusVisible),
2672
- _peerFocusVisible: toPeer(state.focusVisible),
2673
- _groupActive: toGroup(state.active),
2674
- _peerActive: toPeer(state.active),
2675
- _groupDisabled: toGroup(state.disabled),
2676
- _peerDisabled: toPeer(state.disabled),
2677
- _groupInvalid: toGroup(state.invalid),
2678
- _peerInvalid: toPeer(state.invalid),
2679
- _groupChecked: toGroup(state.checked),
2680
- _peerChecked: toPeer(state.checked),
2681
- _groupFocusWithin: toGroup(state.focusWithin),
2682
- _peerFocusWithin: toPeer(state.focusWithin),
2683
- _peerPlaceholderShown: toPeer(state.placeholderShown),
2684
- _placeholder: "&::placeholder",
2685
- _placeholderShown: "&:placeholder-shown",
2686
- _fullScreen: "&:fullscreen",
2687
- _selection: "&::selection",
2688
- _rtl: "[dir=rtl] &, &[dir=rtl]",
2689
- _ltr: "[dir=ltr] &, &[dir=ltr]",
2690
- _mediaDark: "@media (prefers-color-scheme: dark)",
2691
- _mediaReduceMotion: "@media (prefers-reduced-motion: reduce)",
2692
- _dark: ".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",
2693
- _light: ".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",
2694
- _horizontal: "&[data-orientation=horizontal]",
2695
- _vertical: "&[data-orientation=vertical]"
2325
+ var ColorModeToggleButton = (_a2) => {
2326
+ var _b = _a2, {
2327
+ bgColor
2328
+ } = _b, rest = __objRest(_b, [
2329
+ "bgColor"
2330
+ ]);
2331
+ return /* @__PURE__ */ import_react34.default.createElement(
2332
+ ToggleButton,
2333
+ __spreadValues({
2334
+ sx: {
2335
+ _checked: {
2336
+ bgColor,
2337
+ p: {
2338
+ textDecoration: "underline",
2339
+ textUnderlinePosition: "under"
2340
+ }
2341
+ }
2342
+ }
2343
+ }, rest)
2344
+ );
2696
2345
  };
2697
- var pseudoPropNames = Object.keys(
2698
- pseudoSelectors
2699
- );
2700
- function omit(object, keysToOmit = []) {
2701
- const clone = Object.assign({}, object);
2702
- for (const key of keysToOmit) {
2703
- if (key in clone) {
2704
- delete clone[key];
2705
- }
2706
- }
2707
- return clone;
2708
- }
2709
- var systemProps = (0, import_lodash3.default)(
2710
- {},
2711
- background,
2712
- border,
2713
- color,
2714
- flexbox,
2715
- layout,
2716
- filter,
2717
- ring,
2718
- interactivity,
2719
- grid,
2720
- others,
2721
- position,
2722
- effect,
2723
- space,
2724
- scroll,
2725
- typography2,
2726
- textDecoration,
2727
- transform,
2728
- list,
2729
- transition
2730
- );
2731
- var layoutSystem = Object.assign({}, space, layout, flexbox, grid, position);
2732
- var layoutPropNames = Object.keys(
2733
- layoutSystem
2734
- );
2735
- var propNames = [...Object.keys(systemProps), ...pseudoPropNames];
2736
- var styleProps = __spreadValues(__spreadValues({}, systemProps), pseudoSelectors);
2737
- var isStyleProp = (prop) => prop in styleProps;
2738
- var expandResponsive = (styles) => (theme2) => {
2739
- if (!theme2.__breakpoints)
2740
- return styles;
2741
- const { isResponsive, toArrayValue, media: medias } = theme2.__breakpoints;
2742
- const computedStyles = {};
2743
- for (const key in styles) {
2744
- let value = runIfFn(styles[key], theme2);
2745
- if (value == null)
2746
- continue;
2747
- value = isObject(value) && isResponsive(value) ? toArrayValue(value) : value;
2748
- if (!Array.isArray(value)) {
2749
- computedStyles[key] = value;
2750
- continue;
2346
+ var ToggleButton_default = ToggleButton;
2347
+
2348
+ // src/ui/ToggleGroup.tsx
2349
+ var import_react36 = __toESM(require("react"));
2350
+ var import_react37 = require("@chakra-ui/react");
2351
+ var ToggleGroup = ({
2352
+ value,
2353
+ label,
2354
+ name,
2355
+ children,
2356
+ onChange
2357
+ }) => {
2358
+ const { getRootProps, getRadioProps } = (0, import_react37.useRadioGroup)({
2359
+ name,
2360
+ onChange,
2361
+ value
2362
+ });
2363
+ const group = getRootProps();
2364
+ return /* @__PURE__ */ import_react36.default.createElement(import_react37.Flex, __spreadProps(__spreadValues({}, group), { "aria-label": label, flex: "1 0 auto", flexWrap: "nowrap" }), import_react36.default.Children.map(children, (element) => {
2365
+ try {
2366
+ const value2 = element.props.value;
2367
+ const radio = getRadioProps({ value: value2 });
2368
+ return import_react36.default.cloneElement(element, __spreadValues({}, radio));
2369
+ } catch (e) {
2370
+ throw new Error(
2371
+ "ToggleGroup expects ToggleButton children with `value` props."
2372
+ );
2751
2373
  }
2752
- const queries = value.slice(0, medias.length).length;
2753
- for (let index = 0; index < queries; index += 1) {
2754
- const media = medias == null ? void 0 : medias[index];
2755
- if (!media) {
2756
- computedStyles[key] = value[index];
2757
- continue;
2374
+ }));
2375
+ };
2376
+ var ToggleGroup_default = ToggleGroup;
2377
+
2378
+ // src/ui/PdfSettings.tsx
2379
+ var import_md = require("react-icons/md");
2380
+ function PdfSettings(props) {
2381
+ const { navigator, paginationValue } = props;
2382
+ const { zoomOut, zoomIn, setScroll } = navigator;
2383
+ const iconFill = "ui.gray.icon";
2384
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(import_react38.ButtonGroup, { display: "flex", spacing: 0 }, /* @__PURE__ */ React18.createElement(
2385
+ Button_default,
2386
+ {
2387
+ flexGrow: 1,
2388
+ "aria-label": "Zoom Out",
2389
+ onClick: zoomOut,
2390
+ variant: "settings"
2391
+ },
2392
+ /* @__PURE__ */ React18.createElement(import_react38.Icon, { as: import_md.MdOutlineZoomOut, w: 7, h: 7, pl: 1 }),
2393
+ "Zoom Out"
2394
+ ), /* @__PURE__ */ React18.createElement(
2395
+ Button_default,
2396
+ {
2397
+ flexGrow: 1,
2398
+ "aria-label": "Zoom In",
2399
+ onClick: zoomIn,
2400
+ variant: "settings"
2401
+ },
2402
+ /* @__PURE__ */ React18.createElement(import_react38.Icon, { as: import_md.MdOutlineZoomIn, w: 7, h: 7, pl: 1 }),
2403
+ "Zoom In"
2404
+ )), /* @__PURE__ */ React18.createElement(
2405
+ ToggleGroup_default,
2406
+ {
2407
+ onChange: setScroll,
2408
+ value: paginationValue,
2409
+ label: "pagination options"
2410
+ },
2411
+ /* @__PURE__ */ React18.createElement(
2412
+ ToggleButton_default,
2413
+ {
2414
+ value: "paginated",
2415
+ borderRadius: "0 0 0 4px",
2416
+ label: "Paginated",
2417
+ icon: Paginated_default,
2418
+ iconFill
2758
2419
  }
2759
- computedStyles[media] = computedStyles[media] || {};
2760
- if (value[index] == null) {
2761
- continue;
2420
+ ),
2421
+ /* @__PURE__ */ React18.createElement(
2422
+ ToggleButton_default,
2423
+ {
2424
+ value: "scrolling",
2425
+ borderRadius: "0 0 4px 0",
2426
+ label: "Scrolling",
2427
+ icon: Continuous_default,
2428
+ iconFill
2762
2429
  }
2763
- computedStyles[media][key] = value[index];
2764
- }
2765
- }
2766
- return computedStyles;
2767
- };
2768
- function splitByComma(value) {
2769
- const chunks = [];
2770
- let chunk2 = "";
2771
- let inParens = false;
2772
- for (let i = 0; i < value.length; i++) {
2773
- const char = value[i];
2774
- if (char === "(") {
2775
- inParens = true;
2776
- chunk2 += char;
2777
- } else if (char === ")") {
2778
- inParens = false;
2779
- chunk2 += char;
2780
- } else if (char === "," && !inParens) {
2781
- chunks.push(chunk2);
2782
- chunk2 = "";
2783
- } else {
2784
- chunk2 += char;
2785
- }
2786
- }
2787
- chunk2 = chunk2.trim();
2788
- if (chunk2) {
2789
- chunks.push(chunk2);
2790
- }
2791
- return chunks;
2792
- }
2793
- function isCssVar2(value) {
2794
- return /^var\(--.+\)$/.test(value);
2430
+ )
2431
+ ));
2795
2432
  }
2796
- var isCSSVariableTokenValue = (key, value) => key.startsWith("--") && typeof value === "string" && !isCssVar2(value);
2797
- var resolveTokenValue = (theme2, value) => {
2798
- var _a2, _b;
2799
- if (value == null)
2800
- return value;
2801
- const getVar = (val) => {
2802
- var _a22, _b2;
2803
- return (_b2 = (_a22 = theme2.__cssMap) == null ? void 0 : _a22[val]) == null ? void 0 : _b2.varRef;
2804
- };
2805
- const getValue = (val) => {
2806
- var _a22;
2807
- return (_a22 = getVar(val)) != null ? _a22 : val;
2808
- };
2809
- const [tokenValue, fallbackValue] = splitByComma(value);
2810
- value = (_b = (_a2 = getVar(tokenValue)) != null ? _a2 : getValue(fallbackValue)) != null ? _b : getValue(value);
2811
- return value;
2812
- };
2813
- function getCss(options) {
2814
- const { configs = {}, pseudos = {}, theme: theme2 } = options;
2815
- const css2 = (stylesOrFn, nested = false) => {
2816
- var _a2, _b, _c;
2817
- const _styles = runIfFn(stylesOrFn, theme2);
2818
- const styles = expandResponsive(_styles)(theme2);
2819
- let computedStyles = {};
2820
- for (let key in styles) {
2821
- const valueOrFn = styles[key];
2822
- let value = runIfFn(valueOrFn, theme2);
2823
- if (key in pseudos) {
2824
- key = pseudos[key];
2433
+
2434
+ // src/ui/HtmlSettings.tsx
2435
+ var React19 = __toESM(require("react"));
2436
+ var import_react39 = require("@chakra-ui/react");
2437
+ function HtmlSettings(props) {
2438
+ const { navigator, iconFill, readerState, paginationValue } = props;
2439
+ const buttonTextColor = useColorModeValue_default("ui.black", "ui.white", "ui.black");
2440
+ const checkedButtonBgColor = useColorModeValue_default(
2441
+ "ui.gray.light-warm",
2442
+ "ui.gray.x-dark",
2443
+ "ui.sepiaChecked"
2444
+ );
2445
+ if (!readerState.settings)
2446
+ return null;
2447
+ const { colorMode, fontFamily } = readerState.settings;
2448
+ const {
2449
+ setFontFamily,
2450
+ decreaseFontSize,
2451
+ increaseFontSize,
2452
+ resetSettings,
2453
+ setColorMode,
2454
+ setScroll
2455
+ } = navigator;
2456
+ return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
2457
+ ToggleGroup_default,
2458
+ {
2459
+ value: fontFamily,
2460
+ label: "text font options",
2461
+ onChange: setFontFamily
2462
+ },
2463
+ /* @__PURE__ */ React19.createElement(FontToggleButton, { value: "publisher", label: "Default" }),
2464
+ /* @__PURE__ */ React19.createElement(
2465
+ FontToggleButton,
2466
+ {
2467
+ value: "serif",
2468
+ label: "Serif",
2469
+ fontFamily: "serif",
2470
+ fontWeight: "regular"
2825
2471
  }
2826
- if (isCSSVariableTokenValue(key, value)) {
2827
- value = resolveTokenValue(theme2, value);
2472
+ ),
2473
+ /* @__PURE__ */ React19.createElement(
2474
+ FontToggleButton,
2475
+ {
2476
+ value: "sans-serif",
2477
+ label: "Sans-Serif",
2478
+ fontFamily: "body",
2479
+ fontWeight: "regular"
2828
2480
  }
2829
- let config = configs[key];
2830
- if (config === true) {
2831
- config = { property: key };
2481
+ ),
2482
+ /* @__PURE__ */ React19.createElement(
2483
+ FontToggleButton,
2484
+ {
2485
+ value: "open-dyslexic",
2486
+ label: "Dyslexia",
2487
+ fontFamily: "opendyslexic",
2488
+ fontWeight: "regular"
2832
2489
  }
2833
- if (isObject(value)) {
2834
- computedStyles[key] = (_a2 = computedStyles[key]) != null ? _a2 : {};
2835
- computedStyles[key] = (0, import_lodash2.default)(
2836
- {},
2837
- computedStyles[key],
2838
- css2(value, true)
2839
- );
2840
- continue;
2490
+ )
2491
+ ), /* @__PURE__ */ React19.createElement(
2492
+ import_react39.Box,
2493
+ {
2494
+ bgColor: checkedButtonBgColor,
2495
+ display: "flex",
2496
+ flexDirection: "column",
2497
+ px: [3, 3, 7],
2498
+ py: [4, 4, 5]
2499
+ },
2500
+ /* @__PURE__ */ React19.createElement(
2501
+ import_react39.Heading,
2502
+ {
2503
+ as: "h3",
2504
+ color: buttonTextColor,
2505
+ pb: [1.5, 1.5, 2.5],
2506
+ fontSize: 2,
2507
+ fontWeight: "light"
2508
+ },
2509
+ FONT_DETAILS[fontFamily].heading
2510
+ ),
2511
+ /* @__PURE__ */ React19.createElement(
2512
+ import_react39.Text,
2513
+ {
2514
+ color: buttonTextColor,
2515
+ fontFamily: FONT_DETAILS[fontFamily].token,
2516
+ fontSize: -1,
2517
+ fontWeight: FONT_DETAILS[fontFamily].fontWeight,
2518
+ margin: 0
2519
+ },
2520
+ FONT_DETAILS[fontFamily].body
2521
+ )
2522
+ ), /* @__PURE__ */ React19.createElement(
2523
+ ToggleGroup_default,
2524
+ {
2525
+ value: colorMode,
2526
+ label: "reading theme options",
2527
+ onChange: setColorMode
2528
+ },
2529
+ /* @__PURE__ */ React19.createElement(
2530
+ ColorModeToggleButton,
2531
+ {
2532
+ colorMode: "day",
2533
+ icon: Day_default,
2534
+ value: "day",
2535
+ label: "Day",
2536
+ bgColor: "ui.white",
2537
+ textColor: "ui.black"
2841
2538
  }
2842
- let rawValue = (_c = (_b = config == null ? void 0 : config.transform) == null ? void 0 : _b.call(config, value, theme2, _styles)) != null ? _c : value;
2843
- rawValue = (config == null ? void 0 : config.processResult) ? css2(rawValue, true) : rawValue;
2844
- const configProperty = runIfFn(config == null ? void 0 : config.property, theme2);
2845
- if (!nested && (config == null ? void 0 : config.static)) {
2846
- const staticStyles = runIfFn(config.static, theme2);
2847
- computedStyles = (0, import_lodash2.default)({}, computedStyles, staticStyles);
2539
+ ),
2540
+ /* @__PURE__ */ React19.createElement(
2541
+ ColorModeToggleButton,
2542
+ {
2543
+ colorMode: "sepia",
2544
+ icon: Sepia_default,
2545
+ value: "sepia",
2546
+ label: "Sepia",
2547
+ bgColor: "ui.sepia",
2548
+ textColor: "ui.black"
2848
2549
  }
2849
- if (configProperty && Array.isArray(configProperty)) {
2850
- for (const property of configProperty) {
2851
- computedStyles[property] = rawValue;
2852
- }
2853
- continue;
2550
+ ),
2551
+ /* @__PURE__ */ React19.createElement(
2552
+ ColorModeToggleButton,
2553
+ {
2554
+ colorMode: "night",
2555
+ icon: Night_default,
2556
+ value: "night",
2557
+ label: "Night",
2558
+ bgColor: "ui.black",
2559
+ textColor: "ui.white"
2854
2560
  }
2855
- if (configProperty) {
2856
- if (configProperty === "&" && isObject(rawValue)) {
2857
- computedStyles = (0, import_lodash2.default)({}, computedStyles, rawValue);
2858
- } else {
2859
- computedStyles[configProperty] = rawValue;
2561
+ )
2562
+ ), /* @__PURE__ */ React19.createElement(import_react39.ButtonGroup, { display: "flex", spacing: 0 }, /* @__PURE__ */ React19.createElement(
2563
+ Button_default,
2564
+ {
2565
+ flexGrow: 1,
2566
+ "aria-label": "Reset settings",
2567
+ onClick: resetSettings,
2568
+ variant: "settings"
2569
+ },
2570
+ /* @__PURE__ */ React19.createElement(
2571
+ Reset_default,
2572
+ {
2573
+ w: "45px",
2574
+ h: "45px",
2575
+ fill: areSettingsDefault(readerState.settings) ? "ui.gray.disabled" : iconFill
2576
+ }
2577
+ )
2578
+ ), /* @__PURE__ */ React19.createElement(
2579
+ Button_default,
2580
+ {
2581
+ "aria-label": "Decrease font size",
2582
+ flexGrow: 1,
2583
+ onClick: decreaseFontSize,
2584
+ sx: {
2585
+ _active: {
2586
+ bgColor: checkedButtonBgColor
2860
2587
  }
2861
- continue;
2588
+ },
2589
+ value: "decrease font size",
2590
+ variant: "settings"
2591
+ },
2592
+ /* @__PURE__ */ React19.createElement(ReduceFont_default, { w: "45px", h: "45px", fill: iconFill })
2593
+ ), /* @__PURE__ */ React19.createElement(
2594
+ Button_default,
2595
+ {
2596
+ "aria-label": "Increase font size",
2597
+ flexGrow: 1,
2598
+ onClick: increaseFontSize,
2599
+ sx: {
2600
+ _active: {
2601
+ bgColor: checkedButtonBgColor
2602
+ }
2603
+ },
2604
+ value: "increase font size",
2605
+ variant: "settings"
2606
+ },
2607
+ /* @__PURE__ */ React19.createElement(EnlargeFont_default, { w: "45px", h: "45px", fill: iconFill })
2608
+ )), /* @__PURE__ */ React19.createElement(
2609
+ ToggleGroup_default,
2610
+ {
2611
+ onChange: setScroll,
2612
+ value: paginationValue,
2613
+ label: "pagination options"
2614
+ },
2615
+ /* @__PURE__ */ React19.createElement(
2616
+ ToggleButton_default,
2617
+ {
2618
+ value: "paginated",
2619
+ borderRadius: "0 0 0 4px",
2620
+ label: "Paginated",
2621
+ icon: Paginated_default,
2622
+ iconFill
2862
2623
  }
2863
- if (isObject(rawValue)) {
2864
- computedStyles = (0, import_lodash2.default)({}, computedStyles, rawValue);
2865
- continue;
2624
+ ),
2625
+ /* @__PURE__ */ React19.createElement(
2626
+ ToggleButton_default,
2627
+ {
2628
+ value: "scrolling",
2629
+ borderRadius: "0 0 4px 0",
2630
+ label: "Scrolling",
2631
+ icon: Continuous_default,
2632
+ iconFill
2866
2633
  }
2867
- computedStyles[key] = rawValue;
2868
- }
2869
- return computedStyles;
2870
- };
2871
- return css2;
2872
- }
2873
- var css = (styles) => (theme2) => {
2874
- const cssFn = getCss({
2875
- theme: theme2,
2876
- pseudos: pseudoSelectors,
2877
- configs: systemProps
2878
- });
2879
- return cssFn(styles);
2634
+ )
2635
+ ));
2636
+ }
2637
+ var areSettingsDefault = (readerSettings) => {
2638
+ if (!readerSettings) {
2639
+ return false;
2640
+ }
2641
+ let setting;
2642
+ for (setting in DEFAULT_SETTINGS) {
2643
+ if (readerSettings[setting] !== DEFAULT_SETTINGS[setting]) {
2644
+ return false;
2645
+ }
2646
+ }
2647
+ return true;
2880
2648
  };
2881
- function normalize2(value, toArray) {
2882
- if (Array.isArray(value))
2883
- return value;
2884
- if (isObject(value))
2885
- return toArray(value);
2886
- if (value != null)
2887
- return [value];
2649
+
2650
+ // src/ui/SettingsButton.tsx
2651
+ function SettingsCard(props) {
2652
+ var _a2, _b;
2653
+ const [isOpen, setIsOpen] = React20.useState(false);
2654
+ const open = () => setIsOpen(true);
2655
+ const close = () => setIsOpen(false);
2656
+ const contentBgColor = useColorModeValue_default("ui.white", "ui.black", "ui.white");
2657
+ const iconFill = useColorModeValue_default(
2658
+ "ui.gray.icon",
2659
+ "ui.white",
2660
+ "ui.gray.icon"
2661
+ );
2662
+ const paginationValue = ((_b = (_a2 = props.state) == null ? void 0 : _a2.settings) == null ? void 0 : _b.isScrolling) ? "scrolling" : "paginated";
2663
+ return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
2664
+ import_react40.Popover,
2665
+ {
2666
+ gutter: 0,
2667
+ closeOnBlur: true,
2668
+ placement: "bottom-start",
2669
+ isOpen,
2670
+ onClose: close,
2671
+ onOpen: open,
2672
+ autoFocus: true,
2673
+ preventOverflow: true,
2674
+ strategy: "fixed"
2675
+ },
2676
+ /* @__PURE__ */ React20.createElement(import_react40.PopoverTrigger, null, /* @__PURE__ */ React20.createElement(
2677
+ Button_default,
2678
+ {
2679
+ "aria-label": "Settings",
2680
+ onClick: open,
2681
+ onMouseDown: (e) => e.preventDefault(),
2682
+ border: "none",
2683
+ gap: [0, 0, 2]
2684
+ },
2685
+ /* @__PURE__ */ React20.createElement(import_react40.Icon, { as: ReaderSettings_default, fill: iconFill, w: 6, h: 6 }),
2686
+ /* @__PURE__ */ React20.createElement(import_react40.Text, { variant: "headerNav" }, "Settings")
2687
+ )),
2688
+ /* @__PURE__ */ React20.createElement(
2689
+ import_react40.PopoverContent,
2690
+ {
2691
+ overflow: "hidden",
2692
+ bgColor: contentBgColor,
2693
+ borderColor: "ui.gray.disabled",
2694
+ borderRadius: "0 0 2px 2px",
2695
+ filter: "drop-shadow(0 1px 2px #00000040)",
2696
+ width: ["90vw", "90vw", "inherit"],
2697
+ marginRight: [4, 4, 4, 0],
2698
+ maxWidth: "100vw"
2699
+ },
2700
+ /* @__PURE__ */ React20.createElement(import_react40.PopoverBody, { p: 0 }, props.type === "PDF" && /* @__PURE__ */ React20.createElement(
2701
+ PdfSettings,
2702
+ {
2703
+ navigator: props.navigator,
2704
+ readerState: props.state,
2705
+ paginationValue
2706
+ }
2707
+ ), props.type === "HTML" && /* @__PURE__ */ React20.createElement(
2708
+ HtmlSettings,
2709
+ {
2710
+ navigator: props.navigator,
2711
+ iconFill,
2712
+ readerState: props.state,
2713
+ paginationValue
2714
+ }
2715
+ ))
2716
+ )
2717
+ ));
2888
2718
  }
2889
- function getNextIndex(values, i) {
2890
- for (let j = i + 1; j < values.length; j++) {
2891
- if (values[j] != null)
2892
- return j;
2719
+
2720
+ // src/ui/TableOfContent.tsx
2721
+ var import_react67 = __toESM(require("react"));
2722
+ var import_react68 = require("@chakra-ui/react");
2723
+
2724
+ // node_modules/@chakra-ui/system/dist/chunk-UIGT7YZF.mjs
2725
+ var import_react41 = require("@emotion/react");
2726
+ var import_react42 = require("react");
2727
+ function useTheme3() {
2728
+ const theme2 = (0, import_react42.useContext)(
2729
+ import_react41.ThemeContext
2730
+ );
2731
+ if (!theme2) {
2732
+ throw Error(
2733
+ "useTheme: `theme` is undefined. Seems you forgot to wrap your app in `<ChakraProvider />` or `<ThemeProvider />`"
2734
+ );
2893
2735
  }
2894
- return -1;
2736
+ return theme2;
2895
2737
  }
2896
- function createResolver(theme2) {
2897
- const breakpointUtil = theme2.__breakpoints;
2898
- return function resolver(config, prop, value, props) {
2899
- var _a2, _b;
2900
- if (!breakpointUtil)
2901
- return;
2902
- const result = {};
2903
- const normalized = normalize2(value, breakpointUtil.toArrayValue);
2904
- if (!normalized)
2905
- return result;
2906
- const len = normalized.length;
2907
- const isSingle = len === 1;
2908
- const isMultipart = !!config.parts;
2909
- for (let i = 0; i < len; i++) {
2910
- const key = breakpointUtil.details[i];
2911
- const nextKey = breakpointUtil.details[getNextIndex(normalized, i)];
2912
- const query = toMediaQueryString(key.minW, nextKey == null ? void 0 : nextKey._minW);
2913
- const styles = runIfFn((_a2 = config[prop]) == null ? void 0 : _a2[normalized[i]], props);
2914
- if (!styles)
2915
- continue;
2916
- if (isMultipart) {
2917
- (_b = config.parts) == null ? void 0 : _b.forEach((part) => {
2918
- (0, import_lodash4.default)(result, {
2919
- [part]: isSingle ? styles[part] : { [query]: styles[part] }
2920
- });
2921
- });
2922
- continue;
2923
- }
2924
- if (!isMultipart) {
2925
- if (isSingle)
2926
- (0, import_lodash4.default)(result, styles);
2927
- else
2928
- result[query] = styles;
2929
- continue;
2930
- }
2931
- result[query] = styles;
2738
+
2739
+ // node_modules/@chakra-ui/color-mode/dist/chunk-UQDW7KKV.mjs
2740
+ var import_react43 = require("react");
2741
+ var ColorModeContext = (0, import_react43.createContext)({});
2742
+ ColorModeContext.displayName = "ColorModeContext";
2743
+ function useColorMode() {
2744
+ const context = (0, import_react43.useContext)(ColorModeContext);
2745
+ if (context === void 0) {
2746
+ throw new Error("useColorMode must be used within a ColorModeProvider");
2747
+ }
2748
+ return context;
2749
+ }
2750
+
2751
+ // node_modules/@chakra-ui/system/dist/chunk-7FWEOSAE.mjs
2752
+ function useChakra() {
2753
+ const colorModeResult = useColorMode();
2754
+ const theme2 = useTheme3();
2755
+ return __spreadProps(__spreadValues({}, colorModeResult), { theme: theme2 });
2756
+ }
2757
+
2758
+ // node_modules/@chakra-ui/shared-utils/dist/index.mjs
2759
+ function isObject(value) {
2760
+ const type = typeof value;
2761
+ return value != null && (type === "object" || type === "function") && !Array.isArray(value);
2762
+ }
2763
+ function runIfFn(valueOrFn, ...args) {
2764
+ return isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
2765
+ }
2766
+ var isFunction = (value) => typeof value === "function";
2767
+ var dataAttr = (condition) => condition ? "" : void 0;
2768
+
2769
+ // node_modules/@chakra-ui/styled-system/dist/index.mjs
2770
+ var import_lodash = __toESM(require_lodash(), 1);
2771
+ var import_lodash2 = __toESM(require_lodash(), 1);
2772
+ var import_lodash3 = __toESM(require_lodash(), 1);
2773
+ var import_lodash4 = __toESM(require_lodash(), 1);
2774
+ var isImportant = (value) => /!(important)?$/.test(value);
2775
+ var withoutImportant = (value) => typeof value === "string" ? value.replace(/!(important)?$/, "").trim() : value;
2776
+ var tokenToCSSVar = (scale, value) => (theme2) => {
2777
+ const valueStr = String(value);
2778
+ const important = isImportant(valueStr);
2779
+ const valueWithoutImportant = withoutImportant(valueStr);
2780
+ const key = scale ? `${scale}.${valueWithoutImportant}` : valueWithoutImportant;
2781
+ let transformed = isObject(theme2.__cssMap) && key in theme2.__cssMap ? theme2.__cssMap[key].varRef : value;
2782
+ transformed = withoutImportant(transformed);
2783
+ return important ? `${transformed} !important` : transformed;
2784
+ };
2785
+ function createTransform(options) {
2786
+ const { scale, transform: transform2, compose: compose2 } = options;
2787
+ const fn = (value, theme2) => {
2788
+ var _a2;
2789
+ const _value = tokenToCSSVar(scale, value)(theme2);
2790
+ let result = (_a2 = transform2 == null ? void 0 : transform2(_value, theme2)) != null ? _a2 : _value;
2791
+ if (compose2) {
2792
+ result = compose2(result, theme2);
2932
2793
  }
2933
2794
  return result;
2934
2795
  };
2796
+ return fn;
2935
2797
  }
2936
- function resolveStyleConfig(config) {
2937
- return (props) => {
2938
- var _a2;
2939
- const { variant, size: size2, theme: theme2 } = props;
2940
- const recipe = createResolver(theme2);
2941
- return (0, import_lodash4.default)(
2942
- {},
2943
- runIfFn((_a2 = config.baseStyle) != null ? _a2 : {}, props),
2944
- recipe(config, "sizes", size2, props),
2945
- recipe(config, "variants", variant, props)
2946
- );
2798
+ var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
2799
+ function toConfig(scale, transform2) {
2800
+ return (property) => {
2801
+ const result = { property, scale };
2802
+ result.transform = createTransform({
2803
+ scale,
2804
+ transform: transform2
2805
+ });
2806
+ return result;
2947
2807
  };
2948
2808
  }
2949
- function omitThemingProps(props) {
2950
- return omit(props, ["styleConfig", "size", "variant", "colorScheme"]);
2809
+ var getRtl = ({ rtl, ltr }) => (theme2) => theme2.direction === "rtl" ? rtl : ltr;
2810
+ function logical(options) {
2811
+ const { property, scale, transform: transform2 } = options;
2812
+ return {
2813
+ scale,
2814
+ property: getRtl(property),
2815
+ transform: scale ? createTransform({
2816
+ scale,
2817
+ compose: transform2
2818
+ }) : transform2
2819
+ };
2951
2820
  }
2952
-
2953
- // node_modules/@chakra-ui/theme-tools/dist/chunk-N4TQSR52.mjs
2954
- var createBreakpoints = (config) => {
2955
- warn({
2956
- condition: true,
2957
- message: [
2958
- `[chakra-ui]: createBreakpoints(...) will be deprecated pretty soon`,
2959
- `simply pass the breakpoints as an object. Remove the createBreakpoints(..) call`
2960
- ].join("")
2961
- });
2962
- return __spreadValues({ base: "0em" }, config);
2963
- };
2964
-
2965
- // src/ui/nypl-base-theme/foundations/breakpoints.ts
2966
- var breakpoints_default = createBreakpoints({
2967
- sm: "20em",
2968
- // 320px
2969
- md: "38em",
2970
- // 600px
2971
- lg: "60em",
2972
- // 960px
2973
- xl: "80em",
2974
- // 1280px
2975
- "2xl": "96em"
2976
- });
2977
-
2978
- // src/ui/nypl-base-theme/foundations/typography.ts
2979
- var typography3 = {
2980
- fonts: {
2981
- body: "-apple-system, BlinkMacSystemFont, system-ui, sans-serif",
2982
- heading: "-apple-system, BlinkMacSystemFont, system-ui, sans-seri",
2983
- mono: `Courier,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace`
2984
- },
2985
- fontSizes: {
2986
- "-2": "0.75rem",
2987
- "-1": "0.875rem",
2988
- "0": "1rem",
2989
- "1": "1.125rem",
2990
- "2": "1.25rem",
2991
- "3": "1.75rem",
2992
- "4": "2.25rem",
2993
- "5": "3rem"
2994
- },
2995
- fontWeights: {
2996
- light: 300,
2997
- regular: 400,
2998
- medium: 500,
2999
- bold: 700
2821
+ var transformTemplate = [
2822
+ "rotate(var(--chakra-rotate, 0))",
2823
+ "scaleX(var(--chakra-scale-x, 1))",
2824
+ "scaleY(var(--chakra-scale-y, 1))",
2825
+ "skewX(var(--chakra-skew-x, 0))",
2826
+ "skewY(var(--chakra-skew-y, 0))"
2827
+ ];
2828
+ function getTransformTemplate() {
2829
+ return [
2830
+ "translateX(var(--chakra-translate-x, 0))",
2831
+ "translateY(var(--chakra-translate-y, 0))",
2832
+ ...transformTemplate
2833
+ ].join(" ");
2834
+ }
2835
+ function getTransformGpuTemplate() {
2836
+ return [
2837
+ "translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",
2838
+ ...transformTemplate
2839
+ ].join(" ");
2840
+ }
2841
+ var filterTemplate = {
2842
+ "--chakra-blur": "var(--chakra-empty,/*!*/ /*!*/)",
2843
+ "--chakra-brightness": "var(--chakra-empty,/*!*/ /*!*/)",
2844
+ "--chakra-contrast": "var(--chakra-empty,/*!*/ /*!*/)",
2845
+ "--chakra-grayscale": "var(--chakra-empty,/*!*/ /*!*/)",
2846
+ "--chakra-hue-rotate": "var(--chakra-empty,/*!*/ /*!*/)",
2847
+ "--chakra-invert": "var(--chakra-empty,/*!*/ /*!*/)",
2848
+ "--chakra-saturate": "var(--chakra-empty,/*!*/ /*!*/)",
2849
+ "--chakra-sepia": "var(--chakra-empty,/*!*/ /*!*/)",
2850
+ "--chakra-drop-shadow": "var(--chakra-empty,/*!*/ /*!*/)",
2851
+ filter: [
2852
+ "var(--chakra-blur)",
2853
+ "var(--chakra-brightness)",
2854
+ "var(--chakra-contrast)",
2855
+ "var(--chakra-grayscale)",
2856
+ "var(--chakra-hue-rotate)",
2857
+ "var(--chakra-invert)",
2858
+ "var(--chakra-saturate)",
2859
+ "var(--chakra-sepia)",
2860
+ "var(--chakra-drop-shadow)"
2861
+ ].join(" ")
2862
+ };
2863
+ var backdropFilterTemplate = {
2864
+ backdropFilter: [
2865
+ "var(--chakra-backdrop-blur)",
2866
+ "var(--chakra-backdrop-brightness)",
2867
+ "var(--chakra-backdrop-contrast)",
2868
+ "var(--chakra-backdrop-grayscale)",
2869
+ "var(--chakra-backdrop-hue-rotate)",
2870
+ "var(--chakra-backdrop-invert)",
2871
+ "var(--chakra-backdrop-opacity)",
2872
+ "var(--chakra-backdrop-saturate)",
2873
+ "var(--chakra-backdrop-sepia)"
2874
+ ].join(" "),
2875
+ "--chakra-backdrop-blur": "var(--chakra-empty,/*!*/ /*!*/)",
2876
+ "--chakra-backdrop-brightness": "var(--chakra-empty,/*!*/ /*!*/)",
2877
+ "--chakra-backdrop-contrast": "var(--chakra-empty,/*!*/ /*!*/)",
2878
+ "--chakra-backdrop-grayscale": "var(--chakra-empty,/*!*/ /*!*/)",
2879
+ "--chakra-backdrop-hue-rotate": "var(--chakra-empty,/*!*/ /*!*/)",
2880
+ "--chakra-backdrop-invert": "var(--chakra-empty,/*!*/ /*!*/)",
2881
+ "--chakra-backdrop-opacity": "var(--chakra-empty,/*!*/ /*!*/)",
2882
+ "--chakra-backdrop-saturate": "var(--chakra-empty,/*!*/ /*!*/)",
2883
+ "--chakra-backdrop-sepia": "var(--chakra-empty,/*!*/ /*!*/)"
2884
+ };
2885
+ function getRingTemplate(value) {
2886
+ return {
2887
+ "--chakra-ring-offset-shadow": `var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)`,
2888
+ "--chakra-ring-shadow": `var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)`,
2889
+ "--chakra-ring-width": value,
2890
+ boxShadow: [
2891
+ `var(--chakra-ring-offset-shadow)`,
2892
+ `var(--chakra-ring-shadow)`,
2893
+ `var(--chakra-shadow, 0 0 #0000)`
2894
+ ].join(", ")
2895
+ };
2896
+ }
2897
+ var flexDirectionTemplate = {
2898
+ "row-reverse": {
2899
+ space: "--chakra-space-x-reverse",
2900
+ divide: "--chakra-divide-x-reverse"
3000
2901
  },
3001
- lineHeights: [1, 1.1, 1.25, 1.5, 2, 2.5],
3002
- letterSpacings: {
3003
- tighter: "-0.05em",
3004
- tight: "-0.025em",
3005
- normal: "0",
3006
- wide: "0.025em",
3007
- wider: "0.05em",
3008
- widest: "0.1em"
2902
+ "column-reverse": {
2903
+ space: "--chakra-space-y-reverse",
2904
+ divide: "--chakra-divide-y-reverse"
3009
2905
  }
3010
2906
  };
3011
- var typography_default2 = typography3;
3012
-
3013
- // src/ui/nypl-base-theme/foundations/colors.ts
3014
- var colors2 = {
3015
- transparent: "transparent",
3016
- // ui fills
3017
- ui: {
3018
- black: "#000",
3019
- white: "#fff",
3020
- focus: "#4181F1",
3021
- link: {
3022
- primary: "#0576D3",
3023
- secondary: "#004B98"
3024
- },
3025
- success: {
3026
- primary: "#077719",
3027
- secondary: "#095212"
3028
- },
3029
- warning: {
3030
- primary: "#F0974E",
3031
- secondary: "#EC7B1F"
3032
- },
3033
- status: {
3034
- primary: "#F9E08E",
3035
- secondary: "#FBE7E1"
3036
- },
3037
- error: "#97272C",
3038
- disabled: {
3039
- primary: "#E0E0E0",
3040
- secondary: "#FAFAFA"
3041
- },
3042
- test: "#FF6347",
3043
- gray: {
3044
- active: "#D9D9D9",
3045
- disabled: "#979797",
3046
- icon: "#1C1B1F",
3047
- medium: "#BDBDBD",
3048
- dark: "#616161",
3049
- "x-dark": "#424242",
3050
- "light-cool": "#E0E0E0",
3051
- "light-warm": "#EFEDEB",
3052
- "x-light-cool": "#F5F5F5",
3053
- "x-light-warm": "#F8F8F7",
3054
- "xx-light-cool": "#FAFAFA"
3055
- }
2907
+ var directionMap = {
2908
+ "to-t": "to top",
2909
+ "to-tr": "to top right",
2910
+ "to-r": "to right",
2911
+ "to-br": "to bottom right",
2912
+ "to-b": "to bottom",
2913
+ "to-bl": "to bottom left",
2914
+ "to-l": "to left",
2915
+ "to-tl": "to top left"
2916
+ };
2917
+ var valueSet = new Set(Object.values(directionMap));
2918
+ var globalSet = /* @__PURE__ */ new Set([
2919
+ "none",
2920
+ "-moz-initial",
2921
+ "inherit",
2922
+ "initial",
2923
+ "revert",
2924
+ "unset"
2925
+ ]);
2926
+ var trimSpace = (str) => str.trim();
2927
+ function parseGradient(value, theme2) {
2928
+ if (value == null || globalSet.has(value))
2929
+ return value;
2930
+ const prevent = isCSSFunction(value) || globalSet.has(value);
2931
+ if (!prevent)
2932
+ return `url('${value}')`;
2933
+ const regex = /(^[a-z-A-Z]+)\((.*)\)/g;
2934
+ const results = regex.exec(value);
2935
+ const type = results == null ? void 0 : results[1];
2936
+ const values = results == null ? void 0 : results[2];
2937
+ if (!type || !values)
2938
+ return value;
2939
+ const _type = type.includes("-gradient") ? type : `${type}-gradient`;
2940
+ const [maybeDirection, ...stops] = values.split(",").map(trimSpace).filter(Boolean);
2941
+ if ((stops == null ? void 0 : stops.length) === 0)
2942
+ return value;
2943
+ const direction = maybeDirection in directionMap ? directionMap[maybeDirection] : maybeDirection;
2944
+ stops.unshift(direction);
2945
+ const _values = stops.map((stop) => {
2946
+ if (valueSet.has(stop))
2947
+ return stop;
2948
+ const firstStop = stop.indexOf(" ");
2949
+ const [_color, _stop] = firstStop !== -1 ? [stop.substr(0, firstStop), stop.substr(firstStop + 1)] : [stop];
2950
+ const _stopOrFunc = isCSSFunction(_stop) ? _stop : _stop && _stop.split(" ");
2951
+ const key = `colors.${_color}`;
2952
+ const color2 = key in theme2.__cssMap ? theme2.__cssMap[key].varRef : _color;
2953
+ return _stopOrFunc ? [
2954
+ color2,
2955
+ ...Array.isArray(_stopOrFunc) ? _stopOrFunc : [_stopOrFunc]
2956
+ ].join(" ") : color2;
2957
+ });
2958
+ return `${_type}(${_values.join(", ")})`;
2959
+ }
2960
+ var isCSSFunction = (value) => {
2961
+ return typeof value === "string" && value.includes("(") && value.includes(")");
2962
+ };
2963
+ var gradientTransform = (value, theme2) => parseGradient(value, theme2 != null ? theme2 : {});
2964
+ function isCssVar(value) {
2965
+ return /^var\(--.+\)$/.test(value);
2966
+ }
2967
+ var analyzeCSSValue = (value) => {
2968
+ const num = parseFloat(value.toString());
2969
+ const unit = value.toString().replace(String(num), "");
2970
+ return { unitless: !unit, value: num, unit };
2971
+ };
2972
+ var wrap = (str) => (value) => `${str}(${value})`;
2973
+ var transformFunctions = {
2974
+ filter(value) {
2975
+ return value !== "auto" ? value : filterTemplate;
3056
2976
  },
3057
- // brand fills. Only primary and secondary filled in for now.
3058
- brand: {
3059
- primary: "#C60917",
3060
- secondary: "#760000",
3061
- "nypl-red": "#D0343A"
2977
+ backdropFilter(value) {
2978
+ return value !== "auto" ? value : backdropFilterTemplate;
3062
2979
  },
3063
- /**
3064
- * The following color scales are useful for color edge cases
3065
- * where a distinct named ui or brand color doesn't quite work.
3066
- */
3067
- // based on ui/gray/medium
3068
- gray: {
3069
- "50": "#F2F2F2",
3070
- "100": "#DBDBDB",
3071
- "200": "#C4C4C4",
3072
- "300": "#ADADAD",
3073
- "400": "#969696",
3074
- "500": "#808080",
3075
- "600": "#666666",
3076
- "700": "#4D4D4D",
3077
- "800": "#333333",
3078
- "900": "#1A1A1A"
2980
+ ring(value) {
2981
+ return getRingTemplate(transformFunctions.px(value));
3079
2982
  },
3080
- // based on NYPL red
3081
- red: {
3082
- 50: "#ffe7e6",
3083
- 100: "#f6c2bf",
3084
- 200: "#e99796",
3085
- 300: "#de6d6e",
3086
- 400: "#d4454a",
3087
- 500: "#ba2f2b",
3088
- 600: "#922b21",
3089
- 700: "#692216",
3090
- 800: "#41150a",
3091
- 900: "#1d0a01"
2983
+ bgClip(value) {
2984
+ return value === "text" ? { color: "transparent", backgroundClip: "text" } : { backgroundClip: value };
3092
2985
  },
3093
- // based on ui/warning/secondary
3094
- orange: {
3095
- "50": "#FDF1E7",
3096
- "100": "#F9D8BD",
3097
- "200": "#F6BF93",
3098
- "300": "#F2A669",
3099
- "400": "#EF8D3E",
3100
- "500": "#EB7414",
3101
- "600": "#BC5D10",
3102
- "700": "#8D460C",
3103
- "800": "#5E2F08",
3104
- "900": "#2F1704"
2986
+ transform(value) {
2987
+ if (value === "auto")
2988
+ return getTransformTemplate();
2989
+ if (value === "auto-gpu")
2990
+ return getTransformGpuTemplate();
2991
+ return value;
3105
2992
  },
3106
- // based on ui/status/primary
3107
- yellow: {
3108
- "50": "#FEF8E7",
3109
- "100": "#FBECBB",
3110
- "200": "#F9E090",
3111
- "300": "#F7D464",
3112
- "400": "#F4C938",
3113
- "500": "#F2BD0D",
3114
- "600": "#C2970A",
3115
- "700": "#917108",
3116
- "800": "#614B05",
3117
- "900": "#302603"
2993
+ vh(value) {
2994
+ return value === "$100vh" ? "var(--chakra-vh)" : value;
3118
2995
  },
3119
- // based on ui/success/primary
3120
- green: {
3121
- "50": "#E7FEEB",
3122
- "100": "#BCFBC6",
3123
- "200": "#90F8A1",
3124
- "300": "#65F67C",
3125
- "400": "#3AF357",
3126
- "500": "#0EF133",
3127
- "600": "#0BC128",
3128
- "700": "#08911E",
3129
- "800": "#066014",
3130
- "900": "#03300A"
2996
+ px(value) {
2997
+ if (value == null)
2998
+ return value;
2999
+ const { unitless } = analyzeCSSValue(value);
3000
+ return unitless || typeof value === "number" ? `${value}px` : value;
3131
3001
  },
3132
- // based on NYPL blue
3133
- blue: {
3134
- 50: "#dbefff",
3135
- 100: "#add2ff",
3136
- 200: "#7cb8ff",
3137
- 300: "#4aa2ff",
3138
- 400: "#1a8fff",
3139
- 500: "#007ee6",
3140
- 600: "#0056b4",
3141
- 700: "#003582",
3142
- 800: "#001a51",
3143
- 900: "#000621"
3002
+ fraction(value) {
3003
+ return !(typeof value === "number") || value > 1 ? value : `${value * 100}%`;
3004
+ },
3005
+ float(value, theme2) {
3006
+ const map = { left: "right", right: "left" };
3007
+ return theme2.direction === "rtl" ? map[value] : value;
3008
+ },
3009
+ degree(value) {
3010
+ if (isCssVar(value) || value == null)
3011
+ return value;
3012
+ const unitless = typeof value === "string" && !value.endsWith("deg");
3013
+ return typeof value === "number" || unitless ? `${value}deg` : value;
3014
+ },
3015
+ gradient: gradientTransform,
3016
+ blur: wrap("blur"),
3017
+ opacity: wrap("opacity"),
3018
+ brightness: wrap("brightness"),
3019
+ contrast: wrap("contrast"),
3020
+ dropShadow: wrap("drop-shadow"),
3021
+ grayscale: wrap("grayscale"),
3022
+ hueRotate: wrap("hue-rotate"),
3023
+ invert: wrap("invert"),
3024
+ saturate: wrap("saturate"),
3025
+ sepia: wrap("sepia"),
3026
+ bgImage(value) {
3027
+ if (value == null)
3028
+ return value;
3029
+ const prevent = isCSSFunction(value) || globalSet.has(value);
3030
+ return !prevent ? `url(${value})` : value;
3031
+ },
3032
+ outline(value) {
3033
+ const isNoneOrZero = String(value) === "0" || String(value) === "none";
3034
+ return value !== null && isNoneOrZero ? { outline: "2px solid transparent", outlineOffset: "2px" } : { outline: value };
3035
+ },
3036
+ flexDirection(value) {
3037
+ var _a2;
3038
+ const { space: space2, divide: divide2 } = (_a2 = flexDirectionTemplate[value]) != null ? _a2 : {};
3039
+ const result = { flexDirection: value };
3040
+ if (space2)
3041
+ result[space2] = 1;
3042
+ if (divide2)
3043
+ result[divide2] = 1;
3044
+ return result;
3144
3045
  }
3145
3046
  };
3146
- var colors_default2 = colors2;
3147
-
3148
- // src/ui/nypl-base-theme/foundations/radii.ts
3149
- var radii = {
3150
- none: "0",
3151
- sm: "0.125rem",
3152
- base: "0.25rem",
3153
- md: "0.375rem",
3154
- lg: "0.5rem",
3155
- xl: "0.75rem",
3156
- "2xl": "1rem",
3157
- "3xl": "1.5rem",
3158
- full: "9999px"
3047
+ var t = {
3048
+ borderWidths: toConfig("borderWidths"),
3049
+ borderStyles: toConfig("borderStyles"),
3050
+ colors: toConfig("colors"),
3051
+ borders: toConfig("borders"),
3052
+ gradients: toConfig("gradients", transformFunctions.gradient),
3053
+ radii: toConfig("radii", transformFunctions.px),
3054
+ space: toConfig("space", pipe(transformFunctions.vh, transformFunctions.px)),
3055
+ spaceT: toConfig("space", pipe(transformFunctions.vh, transformFunctions.px)),
3056
+ degreeT(property) {
3057
+ return { property, transform: transformFunctions.degree };
3058
+ },
3059
+ prop(property, scale, transform2) {
3060
+ return __spreadValues({
3061
+ property,
3062
+ scale
3063
+ }, scale && {
3064
+ transform: createTransform({ scale, transform: transform2 })
3065
+ });
3066
+ },
3067
+ propT(property, transform2) {
3068
+ return { property, transform: transform2 };
3069
+ },
3070
+ sizes: toConfig("sizes", pipe(transformFunctions.vh, transformFunctions.px)),
3071
+ sizesT: toConfig("sizes", pipe(transformFunctions.vh, transformFunctions.fraction)),
3072
+ shadows: toConfig("shadows"),
3073
+ logical,
3074
+ blur: toConfig("blur", transformFunctions.blur)
3159
3075
  };
3160
- var radii_default = radii;
3161
-
3162
- // src/ui/nypl-base-theme/foundations/spacing.ts
3163
- var spacing = {
3164
- space: {
3165
- px: "1px",
3166
- 0: "0",
3167
- 0.5: "0.125rem",
3168
- // 4px
3169
- 1: "0.25rem",
3170
- 1.5: "0.375rem",
3171
- // 8px
3172
- 2: "0.5rem",
3173
- 2.5: "0.625rem",
3174
- 3: "0.75rem",
3175
- 3.5: "0.875rem",
3176
- // 16px
3177
- 4: "1rem",
3178
- 5: "1.25rem",
3179
- // 24px
3180
- 6: "1.5rem",
3181
- 7: "1.75rem",
3182
- // 32 px
3183
- 8: "2rem",
3184
- 9: "2.25rem",
3185
- 10: "2.5rem",
3186
- // 48px
3187
- 12: "3rem",
3188
- 14: "3.5rem",
3189
- // 64px
3190
- 16: "4rem",
3191
- 20: "5rem",
3192
- // 96px
3193
- 24: "6rem",
3194
- 28: "7rem",
3195
- 32: "8rem",
3196
- 36: "9rem",
3197
- 40: "10rem",
3198
- 44: "11rem",
3199
- 48: "12rem",
3200
- 52: "13rem",
3201
- 56: "14rem",
3202
- 60: "15rem",
3203
- 64: "16rem",
3204
- 72: "18rem",
3205
- 80: "20rem",
3206
- 96: "24rem"
3207
- }
3076
+ var background = {
3077
+ background: t.colors("background"),
3078
+ backgroundColor: t.colors("backgroundColor"),
3079
+ backgroundImage: t.gradients("backgroundImage"),
3080
+ backgroundSize: true,
3081
+ backgroundPosition: true,
3082
+ backgroundRepeat: true,
3083
+ backgroundAttachment: true,
3084
+ backgroundClip: { transform: transformFunctions.bgClip },
3085
+ bgSize: t.prop("backgroundSize"),
3086
+ bgPosition: t.prop("backgroundPosition"),
3087
+ bg: t.colors("background"),
3088
+ bgColor: t.colors("backgroundColor"),
3089
+ bgPos: t.prop("backgroundPosition"),
3090
+ bgRepeat: t.prop("backgroundRepeat"),
3091
+ bgAttachment: t.prop("backgroundAttachment"),
3092
+ bgGradient: t.gradients("backgroundImage"),
3093
+ bgClip: { transform: transformFunctions.bgClip }
3094
+ };
3095
+ Object.assign(background, {
3096
+ bgImage: background.backgroundImage,
3097
+ bgImg: background.backgroundImage
3098
+ });
3099
+ var border = {
3100
+ border: t.borders("border"),
3101
+ borderWidth: t.borderWidths("borderWidth"),
3102
+ borderStyle: t.borderStyles("borderStyle"),
3103
+ borderColor: t.colors("borderColor"),
3104
+ borderRadius: t.radii("borderRadius"),
3105
+ borderTop: t.borders("borderTop"),
3106
+ borderBlockStart: t.borders("borderBlockStart"),
3107
+ borderTopLeftRadius: t.radii("borderTopLeftRadius"),
3108
+ borderStartStartRadius: t.logical({
3109
+ scale: "radii",
3110
+ property: {
3111
+ ltr: "borderTopLeftRadius",
3112
+ rtl: "borderTopRightRadius"
3113
+ }
3114
+ }),
3115
+ borderEndStartRadius: t.logical({
3116
+ scale: "radii",
3117
+ property: {
3118
+ ltr: "borderBottomLeftRadius",
3119
+ rtl: "borderBottomRightRadius"
3120
+ }
3121
+ }),
3122
+ borderTopRightRadius: t.radii("borderTopRightRadius"),
3123
+ borderStartEndRadius: t.logical({
3124
+ scale: "radii",
3125
+ property: {
3126
+ ltr: "borderTopRightRadius",
3127
+ rtl: "borderTopLeftRadius"
3128
+ }
3129
+ }),
3130
+ borderEndEndRadius: t.logical({
3131
+ scale: "radii",
3132
+ property: {
3133
+ ltr: "borderBottomRightRadius",
3134
+ rtl: "borderBottomLeftRadius"
3135
+ }
3136
+ }),
3137
+ borderRight: t.borders("borderRight"),
3138
+ borderInlineEnd: t.borders("borderInlineEnd"),
3139
+ borderBottom: t.borders("borderBottom"),
3140
+ borderBlockEnd: t.borders("borderBlockEnd"),
3141
+ borderBottomLeftRadius: t.radii("borderBottomLeftRadius"),
3142
+ borderBottomRightRadius: t.radii("borderBottomRightRadius"),
3143
+ borderLeft: t.borders("borderLeft"),
3144
+ borderInlineStart: {
3145
+ property: "borderInlineStart",
3146
+ scale: "borders"
3147
+ },
3148
+ borderInlineStartRadius: t.logical({
3149
+ scale: "radii",
3150
+ property: {
3151
+ ltr: ["borderTopLeftRadius", "borderBottomLeftRadius"],
3152
+ rtl: ["borderTopRightRadius", "borderBottomRightRadius"]
3153
+ }
3154
+ }),
3155
+ borderInlineEndRadius: t.logical({
3156
+ scale: "radii",
3157
+ property: {
3158
+ ltr: ["borderTopRightRadius", "borderBottomRightRadius"],
3159
+ rtl: ["borderTopLeftRadius", "borderBottomLeftRadius"]
3160
+ }
3161
+ }),
3162
+ borderX: t.borders(["borderLeft", "borderRight"]),
3163
+ borderInline: t.borders("borderInline"),
3164
+ borderY: t.borders(["borderTop", "borderBottom"]),
3165
+ borderBlock: t.borders("borderBlock"),
3166
+ borderTopWidth: t.borderWidths("borderTopWidth"),
3167
+ borderBlockStartWidth: t.borderWidths("borderBlockStartWidth"),
3168
+ borderTopColor: t.colors("borderTopColor"),
3169
+ borderBlockStartColor: t.colors("borderBlockStartColor"),
3170
+ borderTopStyle: t.borderStyles("borderTopStyle"),
3171
+ borderBlockStartStyle: t.borderStyles("borderBlockStartStyle"),
3172
+ borderBottomWidth: t.borderWidths("borderBottomWidth"),
3173
+ borderBlockEndWidth: t.borderWidths("borderBlockEndWidth"),
3174
+ borderBottomColor: t.colors("borderBottomColor"),
3175
+ borderBlockEndColor: t.colors("borderBlockEndColor"),
3176
+ borderBottomStyle: t.borderStyles("borderBottomStyle"),
3177
+ borderBlockEndStyle: t.borderStyles("borderBlockEndStyle"),
3178
+ borderLeftWidth: t.borderWidths("borderLeftWidth"),
3179
+ borderInlineStartWidth: t.borderWidths("borderInlineStartWidth"),
3180
+ borderLeftColor: t.colors("borderLeftColor"),
3181
+ borderInlineStartColor: t.colors("borderInlineStartColor"),
3182
+ borderLeftStyle: t.borderStyles("borderLeftStyle"),
3183
+ borderInlineStartStyle: t.borderStyles("borderInlineStartStyle"),
3184
+ borderRightWidth: t.borderWidths("borderRightWidth"),
3185
+ borderInlineEndWidth: t.borderWidths("borderInlineEndWidth"),
3186
+ borderRightColor: t.colors("borderRightColor"),
3187
+ borderInlineEndColor: t.colors("borderInlineEndColor"),
3188
+ borderRightStyle: t.borderStyles("borderRightStyle"),
3189
+ borderInlineEndStyle: t.borderStyles("borderInlineEndStyle"),
3190
+ borderTopRadius: t.radii(["borderTopLeftRadius", "borderTopRightRadius"]),
3191
+ borderBottomRadius: t.radii([
3192
+ "borderBottomLeftRadius",
3193
+ "borderBottomRightRadius"
3194
+ ]),
3195
+ borderLeftRadius: t.radii(["borderTopLeftRadius", "borderBottomLeftRadius"]),
3196
+ borderRightRadius: t.radii([
3197
+ "borderTopRightRadius",
3198
+ "borderBottomRightRadius"
3199
+ ])
3200
+ };
3201
+ Object.assign(border, {
3202
+ rounded: border.borderRadius,
3203
+ roundedTop: border.borderTopRadius,
3204
+ roundedTopLeft: border.borderTopLeftRadius,
3205
+ roundedTopRight: border.borderTopRightRadius,
3206
+ roundedTopStart: border.borderStartStartRadius,
3207
+ roundedTopEnd: border.borderStartEndRadius,
3208
+ roundedBottom: border.borderBottomRadius,
3209
+ roundedBottomLeft: border.borderBottomLeftRadius,
3210
+ roundedBottomRight: border.borderBottomRightRadius,
3211
+ roundedBottomStart: border.borderEndStartRadius,
3212
+ roundedBottomEnd: border.borderEndEndRadius,
3213
+ roundedLeft: border.borderLeftRadius,
3214
+ roundedRight: border.borderRightRadius,
3215
+ roundedStart: border.borderInlineStartRadius,
3216
+ roundedEnd: border.borderInlineEndRadius,
3217
+ borderStart: border.borderInlineStart,
3218
+ borderEnd: border.borderInlineEnd,
3219
+ borderTopStartRadius: border.borderStartStartRadius,
3220
+ borderTopEndRadius: border.borderStartEndRadius,
3221
+ borderBottomStartRadius: border.borderEndStartRadius,
3222
+ borderBottomEndRadius: border.borderEndEndRadius,
3223
+ borderStartRadius: border.borderInlineStartRadius,
3224
+ borderEndRadius: border.borderInlineEndRadius,
3225
+ borderStartWidth: border.borderInlineStartWidth,
3226
+ borderEndWidth: border.borderInlineEndWidth,
3227
+ borderStartColor: border.borderInlineStartColor,
3228
+ borderEndColor: border.borderInlineEndColor,
3229
+ borderStartStyle: border.borderInlineStartStyle,
3230
+ borderEndStyle: border.borderInlineEndStyle
3231
+ });
3232
+ var color = {
3233
+ color: t.colors("color"),
3234
+ textColor: t.colors("color"),
3235
+ fill: t.colors("fill"),
3236
+ stroke: t.colors("stroke")
3237
+ };
3238
+ var effect = {
3239
+ boxShadow: t.shadows("boxShadow"),
3240
+ mixBlendMode: true,
3241
+ blendMode: t.prop("mixBlendMode"),
3242
+ backgroundBlendMode: true,
3243
+ bgBlendMode: t.prop("backgroundBlendMode"),
3244
+ opacity: true
3245
+ };
3246
+ Object.assign(effect, {
3247
+ shadow: effect.boxShadow
3248
+ });
3249
+ var filter = {
3250
+ filter: { transform: transformFunctions.filter },
3251
+ blur: t.blur("--chakra-blur"),
3252
+ brightness: t.propT("--chakra-brightness", transformFunctions.brightness),
3253
+ contrast: t.propT("--chakra-contrast", transformFunctions.contrast),
3254
+ hueRotate: t.degreeT("--chakra-hue-rotate"),
3255
+ invert: t.propT("--chakra-invert", transformFunctions.invert),
3256
+ saturate: t.propT("--chakra-saturate", transformFunctions.saturate),
3257
+ dropShadow: t.propT("--chakra-drop-shadow", transformFunctions.dropShadow),
3258
+ backdropFilter: { transform: transformFunctions.backdropFilter },
3259
+ backdropBlur: t.blur("--chakra-backdrop-blur"),
3260
+ backdropBrightness: t.propT(
3261
+ "--chakra-backdrop-brightness",
3262
+ transformFunctions.brightness
3263
+ ),
3264
+ backdropContrast: t.propT("--chakra-backdrop-contrast", transformFunctions.contrast),
3265
+ backdropHueRotate: t.degreeT("--chakra-backdrop-hue-rotate"),
3266
+ backdropInvert: t.propT("--chakra-backdrop-invert", transformFunctions.invert),
3267
+ backdropSaturate: t.propT("--chakra-backdrop-saturate", transformFunctions.saturate)
3208
3268
  };
3209
- var spacing_default = spacing;
3210
-
3211
- // src/ui/nypl-base-theme/components/checkbox.ts
3212
- var baseStyleLabel = {
3213
- userSelect: "none",
3214
- fontWeight: "light",
3215
- _disabled: { color: "ui.gray.x-dark", opacity: 1 }
3269
+ var flexbox = {
3270
+ alignItems: true,
3271
+ alignContent: true,
3272
+ justifyItems: true,
3273
+ justifyContent: true,
3274
+ flexWrap: true,
3275
+ flexDirection: { transform: transformFunctions.flexDirection },
3276
+ flex: true,
3277
+ flexFlow: true,
3278
+ flexGrow: true,
3279
+ flexShrink: true,
3280
+ flexBasis: t.sizes("flexBasis"),
3281
+ justifySelf: true,
3282
+ alignSelf: true,
3283
+ order: true,
3284
+ placeItems: true,
3285
+ placeContent: true,
3286
+ placeSelf: true,
3287
+ gap: t.space("gap"),
3288
+ rowGap: t.space("rowGap"),
3289
+ columnGap: t.space("columnGap")
3216
3290
  };
3217
- var Checkbox = {
3218
- // style object for base or default style
3219
- baseStyle: {
3220
- control: {
3221
- borderColor: "ui.gray.dark",
3222
- _hover: {
3223
- bg: "white",
3224
- _disabled: {
3225
- bg: "ui.gray.x-light-cool"
3226
- }
3227
- },
3228
- _checked: {
3229
- bg: "white",
3230
- color: "gray.800",
3231
- borderColor: "ui.gray.dark",
3232
- _hover: {
3233
- bg: "white",
3234
- borderColor: "ui.gray.x-dark"
3235
- }
3236
- },
3237
- _disabled: {
3238
- bg: "ui.gray.x-light-cool",
3239
- borderColor: "ui.gray.medium"
3240
- }
3241
- },
3242
- label: baseStyleLabel
3243
- },
3244
- // styles for different sizes ("sm", "md", "lg")
3245
- sizes: {},
3246
- // styles for different visual variants ("outline", "solid")
3247
- variants: {},
3248
- // default values for `size`, `variant`, `colorScheme`
3249
- defaultProps: {
3250
- size: "md",
3251
- colorScheme: "gray"
3252
- }
3291
+ Object.assign(flexbox, {
3292
+ flexDir: flexbox.flexDirection
3293
+ });
3294
+ var grid = {
3295
+ gridGap: t.space("gridGap"),
3296
+ gridColumnGap: t.space("gridColumnGap"),
3297
+ gridRowGap: t.space("gridRowGap"),
3298
+ gridColumn: true,
3299
+ gridRow: true,
3300
+ gridAutoFlow: true,
3301
+ gridAutoColumns: true,
3302
+ gridColumnStart: true,
3303
+ gridColumnEnd: true,
3304
+ gridRowStart: true,
3305
+ gridRowEnd: true,
3306
+ gridAutoRows: true,
3307
+ gridTemplate: true,
3308
+ gridTemplateColumns: true,
3309
+ gridTemplateRows: true,
3310
+ gridTemplateAreas: true,
3311
+ gridArea: true
3253
3312
  };
3254
- var checkbox_default = Checkbox;
3255
-
3256
- // src/ui/nypl-base-theme/components/input.ts
3257
- var size = {
3258
- lg: {
3259
- fontSize: "lg",
3260
- px: 4,
3261
- h: 12,
3262
- borderRadius: "none"
3263
- },
3264
- md: {
3265
- fontSize: "sm",
3266
- px: 4,
3267
- h: 9,
3268
- borderRadius: "none"
3269
- },
3270
- sm: {
3271
- fontSize: "sm",
3272
- px: 3,
3273
- h: 8,
3274
- borderRadius: "none"
3275
- },
3276
- xs: {
3277
- fontSize: "xs",
3278
- px: 2,
3279
- h: 6,
3280
- borderRadius: "none"
3281
- }
3313
+ var interactivity = {
3314
+ appearance: true,
3315
+ cursor: true,
3316
+ resize: true,
3317
+ userSelect: true,
3318
+ pointerEvents: true,
3319
+ outline: { transform: transformFunctions.outline },
3320
+ outlineOffset: true,
3321
+ outlineColor: t.colors("outlineColor")
3282
3322
  };
3283
- var sizes2 = {
3284
- lg: {
3285
- field: size.lg,
3286
- addon: size.lg
3287
- },
3288
- md: {
3289
- field: size.md,
3290
- addon: size.md
3323
+ var layout = {
3324
+ width: t.sizesT("width"),
3325
+ inlineSize: t.sizesT("inlineSize"),
3326
+ height: t.sizes("height"),
3327
+ blockSize: t.sizes("blockSize"),
3328
+ boxSize: t.sizes(["width", "height"]),
3329
+ minWidth: t.sizes("minWidth"),
3330
+ minInlineSize: t.sizes("minInlineSize"),
3331
+ minHeight: t.sizes("minHeight"),
3332
+ minBlockSize: t.sizes("minBlockSize"),
3333
+ maxWidth: t.sizes("maxWidth"),
3334
+ maxInlineSize: t.sizes("maxInlineSize"),
3335
+ maxHeight: t.sizes("maxHeight"),
3336
+ maxBlockSize: t.sizes("maxBlockSize"),
3337
+ overflow: true,
3338
+ overflowX: true,
3339
+ overflowY: true,
3340
+ overscrollBehavior: true,
3341
+ overscrollBehaviorX: true,
3342
+ overscrollBehaviorY: true,
3343
+ display: true,
3344
+ aspectRatio: true,
3345
+ hideFrom: {
3346
+ scale: "breakpoints",
3347
+ transform: (value, theme2) => {
3348
+ var _a2, _b, _c;
3349
+ const breakpoint = (_c = (_b = (_a2 = theme2.__breakpoints) == null ? void 0 : _a2.get(value)) == null ? void 0 : _b.minW) != null ? _c : value;
3350
+ const mq = `@media screen and (min-width: ${breakpoint})`;
3351
+ return { [mq]: { display: "none" } };
3352
+ }
3291
3353
  },
3292
- sm: {
3293
- field: size.sm,
3294
- addon: size.sm
3354
+ hideBelow: {
3355
+ scale: "breakpoints",
3356
+ transform: (value, theme2) => {
3357
+ var _a2, _b, _c;
3358
+ const breakpoint = (_c = (_b = (_a2 = theme2.__breakpoints) == null ? void 0 : _a2.get(value)) == null ? void 0 : _b._minW) != null ? _c : value;
3359
+ const mq = `@media screen and (max-width: ${breakpoint})`;
3360
+ return { [mq]: { display: "none" } };
3361
+ }
3295
3362
  },
3296
- xs: {
3297
- field: size.xs,
3298
- addon: size.xs
3299
- }
3363
+ verticalAlign: true,
3364
+ boxSizing: true,
3365
+ boxDecorationBreak: true,
3366
+ float: t.propT("float", transformFunctions.float),
3367
+ objectFit: true,
3368
+ objectPosition: true,
3369
+ visibility: true,
3370
+ isolation: true
3300
3371
  };
3301
- var Input = {
3302
- // style object for base or default style
3303
- baseStyle: {
3304
- field: {
3305
- borderRadius: "none",
3306
- fontSize: "sm",
3307
- _focus: {
3308
- borderColor: "ui.link.primary",
3309
- _hover: {
3310
- borderColor: "ui.link.primary"
3311
- }
3312
- },
3313
- _placeholder: {
3314
- fontStyle: "italic",
3315
- color: "ui.gray.dark"
3316
- },
3317
- _invalid: {
3318
- borderColor: "ui.error",
3319
- _placeholder: {
3320
- color: "ui.error"
3321
- },
3322
- _hover: {
3323
- borderColor: "ui.error"
3324
- }
3325
- }
3372
+ Object.assign(layout, {
3373
+ w: layout.width,
3374
+ h: layout.height,
3375
+ minW: layout.minWidth,
3376
+ maxW: layout.maxWidth,
3377
+ minH: layout.minHeight,
3378
+ maxH: layout.maxHeight,
3379
+ overscroll: layout.overscrollBehavior,
3380
+ overscrollX: layout.overscrollBehaviorX,
3381
+ overscrollY: layout.overscrollBehaviorY
3382
+ });
3383
+ var list = {
3384
+ listStyleType: true,
3385
+ listStylePosition: true,
3386
+ listStylePos: t.prop("listStylePosition"),
3387
+ listStyleImage: true,
3388
+ listStyleImg: t.prop("listStyleImage")
3389
+ };
3390
+ function get(obj, path, fallback, index) {
3391
+ const key = typeof path === "string" ? path.split(".") : [path];
3392
+ for (index = 0; index < key.length; index += 1) {
3393
+ if (!obj)
3394
+ break;
3395
+ obj = obj[key[index]];
3396
+ }
3397
+ return obj === void 0 ? fallback : obj;
3398
+ }
3399
+ var memoize = (fn) => {
3400
+ const cache = /* @__PURE__ */ new WeakMap();
3401
+ const memoizedFn = (obj, path, fallback, index) => {
3402
+ if (typeof obj === "undefined") {
3403
+ return fn(obj, path, fallback);
3326
3404
  }
3327
- },
3328
- // styles for different sizes ("sm", "md", "lg")
3329
- sizes: sizes2,
3330
- // styles for different visual variants ("outline", "solid")
3331
- variants: {
3332
- outline: {
3333
- field: {
3334
- _disabled: {
3335
- bg: "ui.gray.xx-light-cool"
3336
- },
3337
- _focus: {
3338
- boxShadow: "none",
3339
- _hover: {
3340
- borderColor: "ui.link.primary"
3341
- }
3342
- },
3343
- _invalid: {
3344
- boxShadow: "none"
3345
- }
3346
- }
3405
+ if (!cache.has(obj)) {
3406
+ cache.set(obj, /* @__PURE__ */ new Map());
3347
3407
  }
3348
- },
3349
- // default values for `size`, `variant`, `colorScheme`
3350
- defaultProps: {
3351
- size: "md"
3352
- }
3353
- };
3354
- var input_default = Input;
3355
-
3356
- // src/ui/nypl-base-theme/foundations/global.ts
3357
- var global2 = {
3358
- // styles for the `body`
3359
- body: {
3360
- bg: "white",
3361
- color: "black"
3362
- },
3363
- // styles for the `a`
3364
- a: {
3365
- color: "ui.link.primary",
3366
- _hover: {
3367
- textDecoration: "underline"
3408
+ const map = cache.get(obj);
3409
+ if (map.has(path)) {
3410
+ return map.get(path);
3368
3411
  }
3369
- }
3412
+ const value = fn(obj, path, fallback, index);
3413
+ map.set(path, value);
3414
+ return value;
3415
+ };
3416
+ return memoizedFn;
3370
3417
  };
3371
- var global_default = global2;
3372
-
3373
- // src/ui/nypl-base-theme/components/form-label.ts
3374
- var baseStyle2 = {
3375
- fontSize: "sm",
3376
- marginEnd: 0,
3377
- mb: 2,
3378
- fontWeight: "medium",
3379
- transition: "all 0.2s",
3380
- opacity: 1,
3381
- _disabled: {
3382
- opacity: 1
3383
- }
3418
+ var memoizedGet = memoize(get);
3419
+ var srOnly = {
3420
+ border: "0px",
3421
+ clip: "rect(0, 0, 0, 0)",
3422
+ width: "1px",
3423
+ height: "1px",
3424
+ margin: "-1px",
3425
+ padding: "0px",
3426
+ overflow: "hidden",
3427
+ whiteSpace: "nowrap",
3428
+ position: "absolute"
3384
3429
  };
3385
- var form_label_default = {
3386
- baseStyle: baseStyle2
3430
+ var srFocusable = {
3431
+ position: "static",
3432
+ width: "auto",
3433
+ height: "auto",
3434
+ clip: "auto",
3435
+ padding: "0",
3436
+ margin: "0",
3437
+ overflow: "visible",
3438
+ whiteSpace: "normal"
3387
3439
  };
3388
-
3389
- // src/ui/nypl-base-theme/components/form.ts
3390
- var baseStyle3 = {
3391
- requiredIndicator: {
3392
- marginStart: 1,
3393
- color: "red.500"
3394
- },
3395
- helperText: {
3396
- mt: 2,
3397
- color: "black",
3398
- lineHeight: "normal",
3399
- fontSize: "xs"
3440
+ var getWithPriority = (theme2, key, styles) => {
3441
+ const result = {};
3442
+ const obj = memoizedGet(theme2, key, {});
3443
+ for (const prop in obj) {
3444
+ const isInStyles = prop in styles && styles[prop] != null;
3445
+ if (!isInStyles)
3446
+ result[prop] = obj[prop];
3400
3447
  }
3448
+ return result;
3401
3449
  };
3402
- var form_default = {
3403
- baseStyle: baseStyle3
3404
- };
3405
-
3406
- // src/ui/nypl-base-theme/components/form-error.ts
3407
- var baseStyle4 = {
3408
- text: {
3409
- color: "ui.error",
3410
- mt: 2,
3411
- fontSize: "xs"
3450
+ var others = {
3451
+ srOnly: {
3452
+ transform(value) {
3453
+ if (value === true)
3454
+ return srOnly;
3455
+ if (value === "focusable")
3456
+ return srFocusable;
3457
+ return {};
3458
+ }
3412
3459
  },
3413
- icon: {
3414
- marginEnd: "0.5em",
3415
- color: "ui.error"
3460
+ layerStyle: {
3461
+ processResult: true,
3462
+ transform: (value, theme2, styles) => getWithPriority(theme2, `layerStyles.${value}`, styles)
3463
+ },
3464
+ textStyle: {
3465
+ processResult: true,
3466
+ transform: (value, theme2, styles) => getWithPriority(theme2, `textStyles.${value}`, styles)
3467
+ },
3468
+ apply: {
3469
+ processResult: true,
3470
+ transform: (value, theme2, styles) => getWithPriority(theme2, value, styles)
3416
3471
  }
3417
3472
  };
3418
- var form_error_default = {
3419
- baseStyle: baseStyle4
3473
+ var position = {
3474
+ position: true,
3475
+ pos: t.prop("position"),
3476
+ zIndex: t.prop("zIndex", "zIndices"),
3477
+ inset: t.spaceT("inset"),
3478
+ insetX: t.spaceT(["left", "right"]),
3479
+ insetInline: t.spaceT("insetInline"),
3480
+ insetY: t.spaceT(["top", "bottom"]),
3481
+ insetBlock: t.spaceT("insetBlock"),
3482
+ top: t.spaceT("top"),
3483
+ insetBlockStart: t.spaceT("insetBlockStart"),
3484
+ bottom: t.spaceT("bottom"),
3485
+ insetBlockEnd: t.spaceT("insetBlockEnd"),
3486
+ left: t.spaceT("left"),
3487
+ insetInlineStart: t.logical({
3488
+ scale: "space",
3489
+ property: { ltr: "left", rtl: "right" }
3490
+ }),
3491
+ right: t.spaceT("right"),
3492
+ insetInlineEnd: t.logical({
3493
+ scale: "space",
3494
+ property: { ltr: "right", rtl: "left" }
3495
+ })
3420
3496
  };
3421
-
3422
- // src/ui/nypl-base-theme/components/text-area.ts
3423
- var sizes3 = {
3424
- xs: input_default.sizes.xs.field,
3425
- sm: input_default.sizes.sm.field,
3426
- md: input_default.sizes.md.field,
3427
- lg: input_default.sizes.lg.field
3497
+ Object.assign(position, {
3498
+ insetStart: position.insetInlineStart,
3499
+ insetEnd: position.insetInlineEnd
3500
+ });
3501
+ var ring = {
3502
+ ring: { transform: transformFunctions.ring },
3503
+ ringColor: t.colors("--chakra-ring-color"),
3504
+ ringOffset: t.prop("--chakra-ring-offset-width"),
3505
+ ringOffsetColor: t.colors("--chakra-ring-offset-color"),
3506
+ ringInset: t.prop("--chakra-ring-inset")
3507
+ };
3508
+ var space = {
3509
+ margin: t.spaceT("margin"),
3510
+ marginTop: t.spaceT("marginTop"),
3511
+ marginBlockStart: t.spaceT("marginBlockStart"),
3512
+ marginRight: t.spaceT("marginRight"),
3513
+ marginInlineEnd: t.spaceT("marginInlineEnd"),
3514
+ marginBottom: t.spaceT("marginBottom"),
3515
+ marginBlockEnd: t.spaceT("marginBlockEnd"),
3516
+ marginLeft: t.spaceT("marginLeft"),
3517
+ marginInlineStart: t.spaceT("marginInlineStart"),
3518
+ marginX: t.spaceT(["marginInlineStart", "marginInlineEnd"]),
3519
+ marginInline: t.spaceT("marginInline"),
3520
+ marginY: t.spaceT(["marginTop", "marginBottom"]),
3521
+ marginBlock: t.spaceT("marginBlock"),
3522
+ padding: t.space("padding"),
3523
+ paddingTop: t.space("paddingTop"),
3524
+ paddingBlockStart: t.space("paddingBlockStart"),
3525
+ paddingRight: t.space("paddingRight"),
3526
+ paddingBottom: t.space("paddingBottom"),
3527
+ paddingBlockEnd: t.space("paddingBlockEnd"),
3528
+ paddingLeft: t.space("paddingLeft"),
3529
+ paddingInlineStart: t.space("paddingInlineStart"),
3530
+ paddingInlineEnd: t.space("paddingInlineEnd"),
3531
+ paddingX: t.space(["paddingInlineStart", "paddingInlineEnd"]),
3532
+ paddingInline: t.space("paddingInline"),
3533
+ paddingY: t.space(["paddingTop", "paddingBottom"]),
3534
+ paddingBlock: t.space("paddingBlock")
3535
+ };
3536
+ Object.assign(space, {
3537
+ m: space.margin,
3538
+ mt: space.marginTop,
3539
+ mr: space.marginRight,
3540
+ me: space.marginInlineEnd,
3541
+ marginEnd: space.marginInlineEnd,
3542
+ mb: space.marginBottom,
3543
+ ml: space.marginLeft,
3544
+ ms: space.marginInlineStart,
3545
+ marginStart: space.marginInlineStart,
3546
+ mx: space.marginX,
3547
+ my: space.marginY,
3548
+ p: space.padding,
3549
+ pt: space.paddingTop,
3550
+ py: space.paddingY,
3551
+ px: space.paddingX,
3552
+ pb: space.paddingBottom,
3553
+ pl: space.paddingLeft,
3554
+ ps: space.paddingInlineStart,
3555
+ paddingStart: space.paddingInlineStart,
3556
+ pr: space.paddingRight,
3557
+ pe: space.paddingInlineEnd,
3558
+ paddingEnd: space.paddingInlineEnd
3559
+ });
3560
+ var textDecoration = {
3561
+ textDecorationColor: t.colors("textDecorationColor"),
3562
+ textDecoration: true,
3563
+ textDecor: { property: "textDecoration" },
3564
+ textDecorationLine: true,
3565
+ textDecorationStyle: true,
3566
+ textDecorationThickness: true,
3567
+ textUnderlineOffset: true,
3568
+ textShadow: t.shadows("textShadow")
3569
+ };
3570
+ var transform = {
3571
+ clipPath: true,
3572
+ transform: t.propT("transform", transformFunctions.transform),
3573
+ transformOrigin: true,
3574
+ translateX: t.spaceT("--chakra-translate-x"),
3575
+ translateY: t.spaceT("--chakra-translate-y"),
3576
+ skewX: t.degreeT("--chakra-skew-x"),
3577
+ skewY: t.degreeT("--chakra-skew-y"),
3578
+ scaleX: t.prop("--chakra-scale-x"),
3579
+ scaleY: t.prop("--chakra-scale-y"),
3580
+ scale: t.prop(["--chakra-scale-x", "--chakra-scale-y"]),
3581
+ rotate: t.degreeT("--chakra-rotate")
3428
3582
  };
3429
- var text_area_default = {
3430
- baseStyle: {
3431
- _disabled: {
3432
- bg: "ui.gray.x-light-cool"
3583
+ var transition = {
3584
+ transition: true,
3585
+ transitionDelay: true,
3586
+ animation: true,
3587
+ willChange: true,
3588
+ transitionDuration: t.prop("transitionDuration", "transition.duration"),
3589
+ transitionProperty: t.prop("transitionProperty", "transition.property"),
3590
+ transitionTimingFunction: t.prop(
3591
+ "transitionTimingFunction",
3592
+ "transition.easing"
3593
+ )
3594
+ };
3595
+ var typography3 = {
3596
+ fontFamily: t.prop("fontFamily", "fonts"),
3597
+ fontSize: t.prop("fontSize", "fontSizes", transformFunctions.px),
3598
+ fontWeight: t.prop("fontWeight", "fontWeights"),
3599
+ lineHeight: t.prop("lineHeight", "lineHeights"),
3600
+ letterSpacing: t.prop("letterSpacing", "letterSpacings"),
3601
+ textAlign: true,
3602
+ fontStyle: true,
3603
+ textIndent: true,
3604
+ wordBreak: true,
3605
+ overflowWrap: true,
3606
+ textOverflow: true,
3607
+ textTransform: true,
3608
+ whiteSpace: true,
3609
+ isTruncated: {
3610
+ transform(value) {
3611
+ if (value === true) {
3612
+ return {
3613
+ overflow: "hidden",
3614
+ textOverflow: "ellipsis",
3615
+ whiteSpace: "nowrap"
3616
+ };
3617
+ }
3433
3618
  }
3434
3619
  },
3435
- sizes: sizes3
3620
+ noOfLines: {
3621
+ static: {
3622
+ overflow: "hidden",
3623
+ textOverflow: "ellipsis",
3624
+ display: "-webkit-box",
3625
+ WebkitBoxOrient: "vertical",
3626
+ WebkitLineClamp: "var(--chakra-line-clamp)"
3627
+ },
3628
+ property: "--chakra-line-clamp"
3629
+ }
3436
3630
  };
3437
-
3438
- // src/ui/nypl-base-theme/index.ts
3439
- var theme = (0, import_react32.extendTheme)(__spreadProps(__spreadValues({
3440
- styles: { global: global_default },
3441
- breakpoints: breakpoints_default,
3442
- radii: radii_default,
3443
- colors: colors_default2
3444
- }, typography_default2), {
3445
- space: spacing_default,
3446
- /**
3447
- * Chakra documentation on component styles:
3448
- * https://chakra-ui.com/docs/theming/component-style
3449
- */
3450
- components: {
3451
- Button: button_default,
3452
- Checkbox: checkbox_default,
3453
- Input: input_default,
3454
- FormLabel: form_label_default,
3455
- Form: form_default,
3456
- FormError: form_error_default,
3457
- Textarea: text_area_default
3631
+ var scroll = {
3632
+ scrollBehavior: true,
3633
+ scrollSnapAlign: true,
3634
+ scrollSnapStop: true,
3635
+ scrollSnapType: true,
3636
+ scrollMargin: t.spaceT("scrollMargin"),
3637
+ scrollMarginTop: t.spaceT("scrollMarginTop"),
3638
+ scrollMarginBottom: t.spaceT("scrollMarginBottom"),
3639
+ scrollMarginLeft: t.spaceT("scrollMarginLeft"),
3640
+ scrollMarginRight: t.spaceT("scrollMarginRight"),
3641
+ scrollMarginX: t.spaceT(["scrollMarginLeft", "scrollMarginRight"]),
3642
+ scrollMarginY: t.spaceT(["scrollMarginTop", "scrollMarginBottom"]),
3643
+ scrollPadding: t.spaceT("scrollPadding"),
3644
+ scrollPaddingTop: t.spaceT("scrollPaddingTop"),
3645
+ scrollPaddingBottom: t.spaceT("scrollPaddingBottom"),
3646
+ scrollPaddingLeft: t.spaceT("scrollPaddingLeft"),
3647
+ scrollPaddingRight: t.spaceT("scrollPaddingRight"),
3648
+ scrollPaddingX: t.spaceT(["scrollPaddingLeft", "scrollPaddingRight"]),
3649
+ scrollPaddingY: t.spaceT(["scrollPaddingTop", "scrollPaddingBottom"])
3650
+ };
3651
+ function resolveReference(operand) {
3652
+ if (isObject(operand) && operand.reference) {
3653
+ return operand.reference;
3458
3654
  }
3459
- }));
3460
- var nypl_base_theme_default = theme;
3461
-
3462
- // src/ui/theme/components/button.ts
3463
- var getButtonStyle = (getColor2) => ({
3464
- // style object for base or default style
3465
- baseStyle: {
3466
- borderRadius: "none"
3467
- },
3468
- // styles for different sizes ("sm", "md", "lg")
3469
- sizes: {},
3470
- // styles for different visual variants ("outline", "solid")
3471
- variants: {
3472
- solid: variantSolid2(getColor2),
3473
- settings: variantSettings(getColor2)
3474
- },
3475
- // default values for `size`, `variant`, `colorScheme`
3476
- defaultProps: {
3477
- size: "sm",
3478
- variant: "solid"
3655
+ return String(operand);
3656
+ }
3657
+ var toExpression = (operator, ...operands) => operands.map(resolveReference).join(` ${operator} `).replace(/calc/g, "");
3658
+ var add = (...operands) => `calc(${toExpression("+", ...operands)})`;
3659
+ var subtract = (...operands) => `calc(${toExpression("-", ...operands)})`;
3660
+ var multiply = (...operands) => `calc(${toExpression("*", ...operands)})`;
3661
+ var divide = (...operands) => `calc(${toExpression("/", ...operands)})`;
3662
+ var negate = (x) => {
3663
+ const value = resolveReference(x);
3664
+ if (value != null && !Number.isNaN(parseFloat(value))) {
3665
+ return String(value).startsWith("-") ? String(value).slice(1) : `-${value}`;
3479
3666
  }
3480
- });
3481
- var variantSolid2 = (getColor2) => (props) => {
3482
- const { "aria-expanded": expanded } = props;
3483
- const bgColor = getColor2("ui.gray.light-warm", "ui.black", "ui.sepia");
3484
- const bgColorActive = getColor2(
3485
- "ui.gray.active",
3486
- "ui.gray.x-dark",
3487
- "ui.sepiaChecked"
3488
- );
3489
- const color2 = getColor2("gray.800", "ui.white", "gray.800");
3490
- const _focus = {
3491
- bgColor: bgColorActive,
3492
- color: color2,
3493
- ring: "2px",
3494
- ringInset: "inset"
3495
- };
3496
- const _hover = {
3497
- bgColor: bgColorActive,
3498
- color: color2,
3499
- _disabled: { bgColor }
3500
- };
3501
- const _active = { bgColor: bgColorActive, color: color2 };
3502
- const _checked = { bgColor, color: color2 };
3503
- const _disabled = { bgColor };
3504
- return {
3505
- border: "none",
3506
- borderColor: "gray.100",
3507
- height: "45px",
3508
- transition: "none",
3509
- fontSize: 0,
3510
- letterSpacing: 1,
3511
- maxWidth: "100%",
3512
- cursor: "pointer",
3513
- bgColor: expanded ? bgColorActive : bgColor,
3514
- color: color2,
3515
- _focus,
3516
- _hover,
3517
- _active,
3518
- _checked,
3519
- _disabled
3520
- };
3521
- };
3522
- var variantSettings = (getColor2) => (props) => {
3523
- const { bgColor } = props;
3524
- const color2 = getColor2("ui.black", "ui.white", "ui.black");
3525
- const checkedBgColor = getColor2(
3526
- "ui.gray.light-warm",
3527
- "ui.gray.x-dark",
3528
- "ui.sepiaChecked"
3529
- );
3530
- return __spreadProps(__spreadValues({}, variantSolid2(getColor2)(props)), {
3531
- bgColor: getColor2("ui.white", "ui.black", "ui.sepia"),
3532
- border: "1px solid",
3533
- color: color2,
3534
- py: 8,
3535
- width: [8, 16, 36],
3536
- fontSize: [0, 0, 2],
3537
- whiteSpace: ["normal", "normal", "nowrap"],
3538
- p: {
3539
- textAlign: "center"
3540
- },
3541
- _active: {
3542
- bgColor
3543
- },
3544
- _checked: {
3545
- color: color2,
3546
- bgColor: checkedBgColor,
3547
- borderBottomColor: checkedBgColor,
3548
- p: {
3549
- textDecoration: "underline",
3550
- textUnderlinePosition: "under"
3551
- }
3552
- },
3553
- _hover: {
3554
- bgColor
3555
- },
3556
- _focus: {
3557
- bgColor,
3558
- ring: "2px",
3559
- ringInset: "inset"
3560
- }
3561
- });
3667
+ return multiply(value, -1);
3562
3668
  };
3563
- var button_default2 = getButtonStyle;
3564
-
3565
- // src/ui/theme/index.ts
3566
- function getTheme(colorMode = "day") {
3567
- return (0, import_react33.extendTheme)(
3568
- __spreadProps(__spreadValues({
3569
- colors: colors_default
3570
- }, typography_default), {
3571
- /**
3572
- * Chakra documentation on component styles:
3573
- * https://chakra-ui.com/docs/theming/component-style
3574
- */
3575
- components: {
3576
- Button: button_default2(getColor(colorMode)),
3577
- Text: text_default,
3578
- Alert: alert_default,
3579
- SkipNavigation: skipNavigation_default
3580
- },
3581
- currentColorMode: colorMode
3582
- }),
3583
- nypl_base_theme_default
3584
- );
3669
+ var calc = Object.assign(
3670
+ (x) => ({
3671
+ add: (...operands) => calc(add(x, ...operands)),
3672
+ subtract: (...operands) => calc(subtract(x, ...operands)),
3673
+ multiply: (...operands) => calc(multiply(x, ...operands)),
3674
+ divide: (...operands) => calc(divide(x, ...operands)),
3675
+ negate: () => calc(negate(x)),
3676
+ toString: () => x.toString()
3677
+ }),
3678
+ {
3679
+ add,
3680
+ subtract,
3681
+ multiply,
3682
+ divide,
3683
+ negate
3684
+ }
3685
+ );
3686
+ function analyzeCSSValue2(value) {
3687
+ const num = parseFloat(value.toString());
3688
+ const unit = value.toString().replace(String(num), "");
3689
+ return { unitless: !unit, value: num, unit };
3690
+ }
3691
+ function px(value) {
3692
+ if (value == null)
3693
+ return value;
3694
+ const { unitless } = analyzeCSSValue2(value);
3695
+ return unitless || typeof value === "number" ? `${value}px` : value;
3585
3696
  }
3586
-
3587
- // src/ui/ToggleButton.tsx
3588
- function ToggleButton(props) {
3589
- const _a2 = props, { children, colorMode, icon, iconFill, label, value } = _a2, rest = __objRest(_a2, ["children", "colorMode", "icon", "iconFill", "label", "value"]);
3590
- const { getInputProps, getCheckboxProps } = (0, import_react35.useRadio)(props);
3591
- const input = getInputProps();
3592
- const checkbox = getCheckboxProps();
3593
- const theme2 = (0, import_react35.useTheme)();
3594
- return (
3595
- // This will override the default theme if we specify the colorMode to the toggle button.
3596
- /* @__PURE__ */ import_react34.default.createElement(import_react35.ThemeProvider, { theme: getTheme(colorMode != null ? colorMode : theme2.currentColorMode) }, /* @__PURE__ */ import_react34.default.createElement(fonts_default, null), /* @__PURE__ */ import_react34.default.createElement(import_react35.Box, { as: "label", display: "flex", flexGrow: 1, "aria-label": label }, /* @__PURE__ */ import_react34.default.createElement("input", __spreadValues({}, input)), /* @__PURE__ */ import_react34.default.createElement(
3597
- Button_default,
3598
- __spreadValues(__spreadValues({
3599
- as: "div",
3600
- variant: "settings",
3601
- flexGrow: 1
3602
- }, checkbox), rest),
3603
- icon && /* @__PURE__ */ import_react34.default.createElement(
3604
- import_react35.Icon,
3605
- {
3606
- as: icon,
3607
- verticalAlign: "middle",
3608
- mr: 1.5,
3609
- w: 6,
3610
- h: 6,
3611
- fill: iconFill && iconFill
3612
- }
3613
- ),
3614
- label && /* @__PURE__ */ import_react34.default.createElement(import_react35.Text, null, label)
3615
- )))
3616
- );
3697
+ function toMediaQueryString(min, max) {
3698
+ const query = ["@media screen"];
3699
+ if (min)
3700
+ query.push("and", `(min-width: ${px(min)})`);
3701
+ if (max)
3702
+ query.push("and", `(max-width: ${px(max)})`);
3703
+ return query.join(" ");
3617
3704
  }
3618
- var FontToggleButton = (props) => {
3619
- return /* @__PURE__ */ import_react34.default.createElement(ToggleButton, __spreadValues({ fontSize: [-2, -2, -1, -1, 0], py: 6 }, props));
3705
+ var state = {
3706
+ hover: (str, post) => `${str}:hover ${post}, ${str}[data-hover] ${post}`,
3707
+ focus: (str, post) => `${str}:focus ${post}, ${str}[data-focus] ${post}`,
3708
+ focusVisible: (str, post) => `${str}:focus-visible ${post}`,
3709
+ focusWithin: (str, post) => `${str}:focus-within ${post}`,
3710
+ active: (str, post) => `${str}:active ${post}, ${str}[data-active] ${post}`,
3711
+ disabled: (str, post) => `${str}:disabled ${post}, ${str}[data-disabled] ${post}`,
3712
+ invalid: (str, post) => `${str}:invalid ${post}, ${str}[data-invalid] ${post}`,
3713
+ checked: (str, post) => `${str}:checked ${post}, ${str}[data-checked] ${post}`,
3714
+ indeterminate: (str, post) => `${str}:indeterminate ${post}, ${str}[aria-checked=mixed] ${post}, ${str}[data-indeterminate] ${post}`,
3715
+ readOnly: (str, post) => `${str}:read-only ${post}, ${str}[readonly] ${post}, ${str}[data-read-only] ${post}`,
3716
+ expanded: (str, post) => `${str}:read-only ${post}, ${str}[aria-expanded=true] ${post}, ${str}[data-expanded] ${post}`,
3717
+ placeholderShown: (str, post) => `${str}:placeholder-shown ${post}`
3620
3718
  };
3621
- var ColorModeToggleButton = (_a2) => {
3622
- var _b = _a2, {
3623
- bgColor
3624
- } = _b, rest = __objRest(_b, [
3625
- "bgColor"
3626
- ]);
3627
- return /* @__PURE__ */ import_react34.default.createElement(
3628
- ToggleButton,
3629
- __spreadValues({
3630
- sx: {
3631
- _checked: {
3632
- bgColor,
3633
- p: {
3634
- textDecoration: "underline",
3635
- textUnderlinePosition: "under"
3636
- }
3637
- }
3638
- }
3639
- }, rest)
3640
- );
3719
+ var toGroup = (fn) => merge((v) => fn(v, "&"), "[role=group]", "[data-group]", ".group");
3720
+ var toPeer = (fn) => merge((v) => fn(v, "~ &"), "[data-peer]", ".peer");
3721
+ var merge = (fn, ...selectors) => selectors.map(fn).join(", ");
3722
+ var pseudoSelectors = {
3723
+ _hover: "&:hover, &[data-hover]",
3724
+ _active: "&:active, &[data-active]",
3725
+ _focus: "&:focus, &[data-focus]",
3726
+ _highlighted: "&[data-highlighted]",
3727
+ _focusWithin: "&:focus-within",
3728
+ _focusVisible: "&:focus-visible, &[data-focus-visible]",
3729
+ _disabled: "&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",
3730
+ _readOnly: "&[aria-readonly=true], &[readonly], &[data-readonly]",
3731
+ _before: "&::before",
3732
+ _after: "&::after",
3733
+ _empty: "&:empty",
3734
+ _expanded: "&[aria-expanded=true], &[data-expanded]",
3735
+ _checked: "&[aria-checked=true], &[data-checked]",
3736
+ _grabbed: "&[aria-grabbed=true], &[data-grabbed]",
3737
+ _pressed: "&[aria-pressed=true], &[data-pressed]",
3738
+ _invalid: "&[aria-invalid=true], &[data-invalid]",
3739
+ _valid: "&[data-valid], &[data-state=valid]",
3740
+ _loading: "&[data-loading], &[aria-busy=true]",
3741
+ _selected: "&[aria-selected=true], &[data-selected]",
3742
+ _hidden: "&[hidden], &[data-hidden]",
3743
+ _autofill: "&:-webkit-autofill",
3744
+ _even: "&:nth-of-type(even)",
3745
+ _odd: "&:nth-of-type(odd)",
3746
+ _first: "&:first-of-type",
3747
+ _firstLetter: "&::first-letter",
3748
+ _last: "&:last-of-type",
3749
+ _notFirst: "&:not(:first-of-type)",
3750
+ _notLast: "&:not(:last-of-type)",
3751
+ _visited: "&:visited",
3752
+ _activeLink: "&[aria-current=page]",
3753
+ _activeStep: "&[aria-current=step]",
3754
+ _indeterminate: "&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",
3755
+ _groupHover: toGroup(state.hover),
3756
+ _peerHover: toPeer(state.hover),
3757
+ _groupFocus: toGroup(state.focus),
3758
+ _peerFocus: toPeer(state.focus),
3759
+ _groupFocusVisible: toGroup(state.focusVisible),
3760
+ _peerFocusVisible: toPeer(state.focusVisible),
3761
+ _groupActive: toGroup(state.active),
3762
+ _peerActive: toPeer(state.active),
3763
+ _groupDisabled: toGroup(state.disabled),
3764
+ _peerDisabled: toPeer(state.disabled),
3765
+ _groupInvalid: toGroup(state.invalid),
3766
+ _peerInvalid: toPeer(state.invalid),
3767
+ _groupChecked: toGroup(state.checked),
3768
+ _peerChecked: toPeer(state.checked),
3769
+ _groupFocusWithin: toGroup(state.focusWithin),
3770
+ _peerFocusWithin: toPeer(state.focusWithin),
3771
+ _peerPlaceholderShown: toPeer(state.placeholderShown),
3772
+ _placeholder: "&::placeholder",
3773
+ _placeholderShown: "&:placeholder-shown",
3774
+ _fullScreen: "&:fullscreen",
3775
+ _selection: "&::selection",
3776
+ _rtl: "[dir=rtl] &, &[dir=rtl]",
3777
+ _ltr: "[dir=ltr] &, &[dir=ltr]",
3778
+ _mediaDark: "@media (prefers-color-scheme: dark)",
3779
+ _mediaReduceMotion: "@media (prefers-reduced-motion: reduce)",
3780
+ _dark: ".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",
3781
+ _light: ".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",
3782
+ _horizontal: "&[data-orientation=horizontal]",
3783
+ _vertical: "&[data-orientation=vertical]"
3641
3784
  };
3642
- var ToggleButton_default = ToggleButton;
3643
-
3644
- // src/ui/ToggleGroup.tsx
3645
- var import_react36 = __toESM(require("react"));
3646
- var import_react37 = require("@chakra-ui/react");
3647
- var ToggleGroup = ({
3648
- value,
3649
- label,
3650
- name,
3651
- children,
3652
- onChange
3653
- }) => {
3654
- const { getRootProps, getRadioProps } = (0, import_react37.useRadioGroup)({
3655
- name,
3656
- onChange,
3657
- value
3658
- });
3659
- const group = getRootProps();
3660
- return /* @__PURE__ */ import_react36.default.createElement(import_react37.Flex, __spreadProps(__spreadValues({}, group), { "aria-label": label, flex: "1 0 auto", flexWrap: "nowrap" }), import_react36.default.Children.map(children, (element) => {
3661
- try {
3662
- const value2 = element.props.value;
3663
- const radio = getRadioProps({ value: value2 });
3664
- return import_react36.default.cloneElement(element, __spreadValues({}, radio));
3665
- } catch (e) {
3666
- throw new Error(
3667
- "ToggleGroup expects ToggleButton children with `value` props."
3668
- );
3785
+ var pseudoPropNames = Object.keys(
3786
+ pseudoSelectors
3787
+ );
3788
+ function omit(object, keysToOmit = []) {
3789
+ const clone = Object.assign({}, object);
3790
+ for (const key of keysToOmit) {
3791
+ if (key in clone) {
3792
+ delete clone[key];
3669
3793
  }
3670
- }));
3671
- };
3672
- var ToggleGroup_default = ToggleGroup;
3673
-
3674
- // src/ui/PdfSettings.tsx
3675
- var import_md = require("react-icons/md");
3676
- function PdfSettings(props) {
3677
- const { navigator, paginationValue } = props;
3678
- const { zoomOut, zoomIn, setScroll } = navigator;
3679
- const iconFill = "ui.gray.icon";
3680
- return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(import_react38.ButtonGroup, { display: "flex", spacing: 0 }, /* @__PURE__ */ React18.createElement(
3681
- Button_default,
3682
- {
3683
- flexGrow: 1,
3684
- "aria-label": "Zoom Out",
3685
- onClick: zoomOut,
3686
- variant: "settings"
3687
- },
3688
- /* @__PURE__ */ React18.createElement(import_react38.Icon, { as: import_md.MdOutlineZoomOut, w: 7, h: 7, pl: 1 }),
3689
- "Zoom Out"
3690
- ), /* @__PURE__ */ React18.createElement(
3691
- Button_default,
3692
- {
3693
- flexGrow: 1,
3694
- "aria-label": "Zoom In",
3695
- onClick: zoomIn,
3696
- variant: "settings"
3697
- },
3698
- /* @__PURE__ */ React18.createElement(import_react38.Icon, { as: import_md.MdOutlineZoomIn, w: 7, h: 7, pl: 1 }),
3699
- "Zoom In"
3700
- )), /* @__PURE__ */ React18.createElement(
3701
- ToggleGroup_default,
3702
- {
3703
- onChange: setScroll,
3704
- value: paginationValue,
3705
- label: "pagination options"
3706
- },
3707
- /* @__PURE__ */ React18.createElement(
3708
- ToggleButton_default,
3709
- {
3710
- value: "paginated",
3711
- borderRadius: "0 0 0 4px",
3712
- label: "Paginated",
3713
- icon: Paginated_default,
3714
- iconFill
3715
- }
3716
- ),
3717
- /* @__PURE__ */ React18.createElement(
3718
- ToggleButton_default,
3719
- {
3720
- value: "scrolling",
3721
- borderRadius: "0 0 4px 0",
3722
- label: "Scrolling",
3723
- icon: Continuous_default,
3724
- iconFill
3725
- }
3726
- )
3727
- ));
3794
+ }
3795
+ return clone;
3728
3796
  }
3729
-
3730
- // src/ui/HtmlSettings.tsx
3731
- var React19 = __toESM(require("react"));
3732
- var import_react39 = require("@chakra-ui/react");
3733
- function HtmlSettings(props) {
3734
- const { navigator, iconFill, readerState, paginationValue } = props;
3735
- const buttonTextColor = useColorModeValue_default("ui.black", "ui.white", "ui.black");
3736
- const checkedButtonBgColor = useColorModeValue_default(
3737
- "ui.gray.light-warm",
3738
- "ui.gray.x-dark",
3739
- "ui.sepiaChecked"
3740
- );
3741
- if (!readerState.settings)
3742
- return null;
3743
- const { colorMode, fontFamily } = readerState.settings;
3744
- const {
3745
- setFontFamily,
3746
- decreaseFontSize,
3747
- increaseFontSize,
3748
- resetSettings,
3749
- setColorMode,
3750
- setScroll
3751
- } = navigator;
3752
- return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
3753
- ToggleGroup_default,
3754
- {
3755
- value: fontFamily,
3756
- label: "text font options",
3757
- onChange: setFontFamily
3758
- },
3759
- /* @__PURE__ */ React19.createElement(FontToggleButton, { value: "publisher", label: "Default" }),
3760
- /* @__PURE__ */ React19.createElement(
3761
- FontToggleButton,
3762
- {
3763
- value: "serif",
3764
- label: "Serif",
3765
- fontFamily: "serif",
3766
- fontWeight: "regular"
3797
+ var systemProps = (0, import_lodash3.default)(
3798
+ {},
3799
+ background,
3800
+ border,
3801
+ color,
3802
+ flexbox,
3803
+ layout,
3804
+ filter,
3805
+ ring,
3806
+ interactivity,
3807
+ grid,
3808
+ others,
3809
+ position,
3810
+ effect,
3811
+ space,
3812
+ scroll,
3813
+ typography3,
3814
+ textDecoration,
3815
+ transform,
3816
+ list,
3817
+ transition
3818
+ );
3819
+ var layoutSystem = Object.assign({}, space, layout, flexbox, grid, position);
3820
+ var layoutPropNames = Object.keys(
3821
+ layoutSystem
3822
+ );
3823
+ var propNames = [...Object.keys(systemProps), ...pseudoPropNames];
3824
+ var styleProps = __spreadValues(__spreadValues({}, systemProps), pseudoSelectors);
3825
+ var isStyleProp = (prop) => prop in styleProps;
3826
+ var expandResponsive = (styles) => (theme2) => {
3827
+ if (!theme2.__breakpoints)
3828
+ return styles;
3829
+ const { isResponsive, toArrayValue, media: medias } = theme2.__breakpoints;
3830
+ const computedStyles = {};
3831
+ for (const key in styles) {
3832
+ let value = runIfFn(styles[key], theme2);
3833
+ if (value == null)
3834
+ continue;
3835
+ value = isObject(value) && isResponsive(value) ? toArrayValue(value) : value;
3836
+ if (!Array.isArray(value)) {
3837
+ computedStyles[key] = value;
3838
+ continue;
3839
+ }
3840
+ const queries = value.slice(0, medias.length).length;
3841
+ for (let index = 0; index < queries; index += 1) {
3842
+ const media = medias == null ? void 0 : medias[index];
3843
+ if (!media) {
3844
+ computedStyles[key] = value[index];
3845
+ continue;
3767
3846
  }
3768
- ),
3769
- /* @__PURE__ */ React19.createElement(
3770
- FontToggleButton,
3771
- {
3772
- value: "sans-serif",
3773
- label: "Sans-Serif",
3774
- fontFamily: "body",
3775
- fontWeight: "regular"
3847
+ computedStyles[media] = computedStyles[media] || {};
3848
+ if (value[index] == null) {
3849
+ continue;
3776
3850
  }
3777
- ),
3778
- /* @__PURE__ */ React19.createElement(
3779
- FontToggleButton,
3780
- {
3781
- value: "open-dyslexic",
3782
- label: "Dyslexia",
3783
- fontFamily: "opendyslexic",
3784
- fontWeight: "regular"
3851
+ computedStyles[media][key] = value[index];
3852
+ }
3853
+ }
3854
+ return computedStyles;
3855
+ };
3856
+ function splitByComma(value) {
3857
+ const chunks = [];
3858
+ let chunk2 = "";
3859
+ let inParens = false;
3860
+ for (let i = 0; i < value.length; i++) {
3861
+ const char = value[i];
3862
+ if (char === "(") {
3863
+ inParens = true;
3864
+ chunk2 += char;
3865
+ } else if (char === ")") {
3866
+ inParens = false;
3867
+ chunk2 += char;
3868
+ } else if (char === "," && !inParens) {
3869
+ chunks.push(chunk2);
3870
+ chunk2 = "";
3871
+ } else {
3872
+ chunk2 += char;
3873
+ }
3874
+ }
3875
+ chunk2 = chunk2.trim();
3876
+ if (chunk2) {
3877
+ chunks.push(chunk2);
3878
+ }
3879
+ return chunks;
3880
+ }
3881
+ function isCssVar2(value) {
3882
+ return /^var\(--.+\)$/.test(value);
3883
+ }
3884
+ var isCSSVariableTokenValue = (key, value) => key.startsWith("--") && typeof value === "string" && !isCssVar2(value);
3885
+ var resolveTokenValue = (theme2, value) => {
3886
+ var _a2, _b;
3887
+ if (value == null)
3888
+ return value;
3889
+ const getVar = (val) => {
3890
+ var _a22, _b2;
3891
+ return (_b2 = (_a22 = theme2.__cssMap) == null ? void 0 : _a22[val]) == null ? void 0 : _b2.varRef;
3892
+ };
3893
+ const getValue = (val) => {
3894
+ var _a22;
3895
+ return (_a22 = getVar(val)) != null ? _a22 : val;
3896
+ };
3897
+ const [tokenValue, fallbackValue] = splitByComma(value);
3898
+ value = (_b = (_a2 = getVar(tokenValue)) != null ? _a2 : getValue(fallbackValue)) != null ? _b : getValue(value);
3899
+ return value;
3900
+ };
3901
+ function getCss(options) {
3902
+ const { configs = {}, pseudos = {}, theme: theme2 } = options;
3903
+ const css2 = (stylesOrFn, nested = false) => {
3904
+ var _a2, _b, _c;
3905
+ const _styles = runIfFn(stylesOrFn, theme2);
3906
+ const styles = expandResponsive(_styles)(theme2);
3907
+ let computedStyles = {};
3908
+ for (let key in styles) {
3909
+ const valueOrFn = styles[key];
3910
+ let value = runIfFn(valueOrFn, theme2);
3911
+ if (key in pseudos) {
3912
+ key = pseudos[key];
3785
3913
  }
3786
- )
3787
- ), /* @__PURE__ */ React19.createElement(
3788
- import_react39.Box,
3789
- {
3790
- bgColor: checkedButtonBgColor,
3791
- display: "flex",
3792
- flexDirection: "column",
3793
- px: [3, 3, 7],
3794
- py: [4, 4, 5]
3795
- },
3796
- /* @__PURE__ */ React19.createElement(
3797
- import_react39.Heading,
3798
- {
3799
- as: "h3",
3800
- color: buttonTextColor,
3801
- pb: [1.5, 1.5, 2.5],
3802
- fontSize: 2,
3803
- fontWeight: "light"
3804
- },
3805
- FONT_DETAILS[fontFamily].heading
3806
- ),
3807
- /* @__PURE__ */ React19.createElement(
3808
- import_react39.Text,
3809
- {
3810
- color: buttonTextColor,
3811
- fontFamily: FONT_DETAILS[fontFamily].token,
3812
- fontSize: -1,
3813
- fontWeight: FONT_DETAILS[fontFamily].fontWeight,
3814
- margin: 0
3815
- },
3816
- FONT_DETAILS[fontFamily].body
3817
- )
3818
- ), /* @__PURE__ */ React19.createElement(
3819
- ToggleGroup_default,
3820
- {
3821
- value: colorMode,
3822
- label: "reading theme options",
3823
- onChange: setColorMode
3824
- },
3825
- /* @__PURE__ */ React19.createElement(
3826
- ColorModeToggleButton,
3827
- {
3828
- colorMode: "day",
3829
- icon: Day_default,
3830
- value: "day",
3831
- label: "Day",
3832
- bgColor: "ui.white",
3833
- textColor: "ui.black"
3914
+ if (isCSSVariableTokenValue(key, value)) {
3915
+ value = resolveTokenValue(theme2, value);
3834
3916
  }
3835
- ),
3836
- /* @__PURE__ */ React19.createElement(
3837
- ColorModeToggleButton,
3838
- {
3839
- colorMode: "sepia",
3840
- icon: Sepia_default,
3841
- value: "sepia",
3842
- label: "Sepia",
3843
- bgColor: "ui.sepia",
3844
- textColor: "ui.black"
3917
+ let config = configs[key];
3918
+ if (config === true) {
3919
+ config = { property: key };
3845
3920
  }
3846
- ),
3847
- /* @__PURE__ */ React19.createElement(
3848
- ColorModeToggleButton,
3849
- {
3850
- colorMode: "night",
3851
- icon: Night_default,
3852
- value: "night",
3853
- label: "Night",
3854
- bgColor: "ui.black",
3855
- textColor: "ui.white"
3921
+ if (isObject(value)) {
3922
+ computedStyles[key] = (_a2 = computedStyles[key]) != null ? _a2 : {};
3923
+ computedStyles[key] = (0, import_lodash2.default)(
3924
+ {},
3925
+ computedStyles[key],
3926
+ css2(value, true)
3927
+ );
3928
+ continue;
3856
3929
  }
3857
- )
3858
- ), /* @__PURE__ */ React19.createElement(import_react39.ButtonGroup, { display: "flex", spacing: 0 }, /* @__PURE__ */ React19.createElement(
3859
- Button_default,
3860
- {
3861
- flexGrow: 1,
3862
- "aria-label": "Reset settings",
3863
- onClick: resetSettings,
3864
- variant: "settings"
3865
- },
3866
- /* @__PURE__ */ React19.createElement(
3867
- Reset_default,
3868
- {
3869
- w: "45px",
3870
- h: "45px",
3871
- fill: areSettingsDefault(readerState.settings) ? "ui.gray.disabled" : iconFill
3930
+ let rawValue = (_c = (_b = config == null ? void 0 : config.transform) == null ? void 0 : _b.call(config, value, theme2, _styles)) != null ? _c : value;
3931
+ rawValue = (config == null ? void 0 : config.processResult) ? css2(rawValue, true) : rawValue;
3932
+ const configProperty = runIfFn(config == null ? void 0 : config.property, theme2);
3933
+ if (!nested && (config == null ? void 0 : config.static)) {
3934
+ const staticStyles = runIfFn(config.static, theme2);
3935
+ computedStyles = (0, import_lodash2.default)({}, computedStyles, staticStyles);
3872
3936
  }
3873
- )
3874
- ), /* @__PURE__ */ React19.createElement(
3875
- Button_default,
3876
- {
3877
- "aria-label": "Decrease font size",
3878
- flexGrow: 1,
3879
- onClick: decreaseFontSize,
3880
- sx: {
3881
- _active: {
3882
- bgColor: checkedButtonBgColor
3883
- }
3884
- },
3885
- value: "decrease font size",
3886
- variant: "settings"
3887
- },
3888
- /* @__PURE__ */ React19.createElement(ReduceFont_default, { w: "45px", h: "45px", fill: iconFill })
3889
- ), /* @__PURE__ */ React19.createElement(
3890
- Button_default,
3891
- {
3892
- "aria-label": "Increase font size",
3893
- flexGrow: 1,
3894
- onClick: increaseFontSize,
3895
- sx: {
3896
- _active: {
3897
- bgColor: checkedButtonBgColor
3937
+ if (configProperty && Array.isArray(configProperty)) {
3938
+ for (const property of configProperty) {
3939
+ computedStyles[property] = rawValue;
3898
3940
  }
3899
- },
3900
- value: "increase font size",
3901
- variant: "settings"
3902
- },
3903
- /* @__PURE__ */ React19.createElement(EnlargeFont_default, { w: "45px", h: "45px", fill: iconFill })
3904
- )), /* @__PURE__ */ React19.createElement(
3905
- ToggleGroup_default,
3906
- {
3907
- onChange: setScroll,
3908
- value: paginationValue,
3909
- label: "pagination options"
3910
- },
3911
- /* @__PURE__ */ React19.createElement(
3912
- ToggleButton_default,
3913
- {
3914
- value: "paginated",
3915
- borderRadius: "0 0 0 4px",
3916
- label: "Paginated",
3917
- icon: Paginated_default,
3918
- iconFill
3941
+ continue;
3919
3942
  }
3920
- ),
3921
- /* @__PURE__ */ React19.createElement(
3922
- ToggleButton_default,
3923
- {
3924
- value: "scrolling",
3925
- borderRadius: "0 0 4px 0",
3926
- label: "Scrolling",
3927
- icon: Continuous_default,
3928
- iconFill
3943
+ if (configProperty) {
3944
+ if (configProperty === "&" && isObject(rawValue)) {
3945
+ computedStyles = (0, import_lodash2.default)({}, computedStyles, rawValue);
3946
+ } else {
3947
+ computedStyles[configProperty] = rawValue;
3948
+ }
3949
+ continue;
3929
3950
  }
3930
- )
3931
- ));
3932
- }
3933
- var areSettingsDefault = (readerSettings) => {
3934
- if (!readerSettings) {
3935
- return false;
3936
- }
3937
- let setting;
3938
- for (setting in DEFAULT_SETTINGS) {
3939
- if (readerSettings[setting] !== DEFAULT_SETTINGS[setting]) {
3940
- return false;
3951
+ if (isObject(rawValue)) {
3952
+ computedStyles = (0, import_lodash2.default)({}, computedStyles, rawValue);
3953
+ continue;
3954
+ }
3955
+ computedStyles[key] = rawValue;
3941
3956
  }
3942
- }
3943
- return true;
3957
+ return computedStyles;
3958
+ };
3959
+ return css2;
3960
+ }
3961
+ var css = (styles) => (theme2) => {
3962
+ const cssFn = getCss({
3963
+ theme: theme2,
3964
+ pseudos: pseudoSelectors,
3965
+ configs: systemProps
3966
+ });
3967
+ return cssFn(styles);
3944
3968
  };
3945
-
3946
- // src/ui/SettingsButton.tsx
3947
- function SettingsCard(props) {
3948
- var _a2, _b;
3949
- const [isOpen, setIsOpen] = React20.useState(false);
3950
- const open = () => setIsOpen(true);
3951
- const close = () => setIsOpen(false);
3952
- const contentBgColor = useColorModeValue_default("ui.white", "ui.black", "ui.white");
3953
- const iconFill = useColorModeValue_default(
3954
- "ui.gray.icon",
3955
- "ui.white",
3956
- "ui.gray.icon"
3957
- );
3958
- const paginationValue = ((_b = (_a2 = props.state) == null ? void 0 : _a2.settings) == null ? void 0 : _b.isScrolling) ? "scrolling" : "paginated";
3959
- return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
3960
- import_react40.Popover,
3961
- {
3962
- gutter: 0,
3963
- closeOnBlur: true,
3964
- placement: "bottom-start",
3965
- isOpen,
3966
- onClose: close,
3967
- onOpen: open,
3968
- autoFocus: true,
3969
- preventOverflow: true,
3970
- strategy: "fixed"
3971
- },
3972
- /* @__PURE__ */ React20.createElement(import_react40.PopoverTrigger, null, /* @__PURE__ */ React20.createElement(
3973
- Button_default,
3974
- {
3975
- "aria-label": "Settings",
3976
- onClick: open,
3977
- onMouseDown: (e) => e.preventDefault(),
3978
- border: "none",
3979
- gap: [0, 0, 2]
3980
- },
3981
- /* @__PURE__ */ React20.createElement(import_react40.Icon, { as: ReaderSettings_default, fill: iconFill, w: 6, h: 6 }),
3982
- /* @__PURE__ */ React20.createElement(import_react40.Text, { variant: "headerNav" }, "Settings")
3983
- )),
3984
- /* @__PURE__ */ React20.createElement(
3985
- import_react40.PopoverContent,
3986
- {
3987
- overflow: "hidden",
3988
- bgColor: contentBgColor,
3989
- borderColor: "ui.gray.disabled",
3990
- borderRadius: "0 0 2px 2px",
3991
- filter: "drop-shadow(0 1px 2px #00000040)",
3992
- width: ["90vw", "90vw", "inherit"],
3993
- marginRight: [4, 4, 4, 0],
3994
- maxWidth: "100vw"
3995
- },
3996
- /* @__PURE__ */ React20.createElement(import_react40.PopoverBody, { p: 0 }, props.type === "PDF" && /* @__PURE__ */ React20.createElement(
3997
- PdfSettings,
3998
- {
3999
- navigator: props.navigator,
4000
- readerState: props.state,
4001
- paginationValue
4002
- }
4003
- ), props.type === "HTML" && /* @__PURE__ */ React20.createElement(
4004
- HtmlSettings,
4005
- {
4006
- navigator: props.navigator,
4007
- iconFill,
4008
- readerState: props.state,
4009
- paginationValue
4010
- }
4011
- ))
4012
- )
4013
- ));
3969
+ function normalize2(value, toArray) {
3970
+ if (Array.isArray(value))
3971
+ return value;
3972
+ if (isObject(value))
3973
+ return toArray(value);
3974
+ if (value != null)
3975
+ return [value];
4014
3976
  }
4015
-
4016
- // src/ui/TableOfContent.tsx
4017
- var import_react67 = __toESM(require("react"));
4018
- var import_react68 = require("@chakra-ui/react");
4019
-
4020
- // node_modules/@chakra-ui/system/dist/chunk-UIGT7YZF.mjs
4021
- var import_react41 = require("@emotion/react");
4022
- var import_react42 = require("react");
4023
- function useTheme3() {
4024
- const theme2 = (0, import_react42.useContext)(
4025
- import_react41.ThemeContext
4026
- );
4027
- if (!theme2) {
4028
- throw Error(
4029
- "useTheme: `theme` is undefined. Seems you forgot to wrap your app in `<ChakraProvider />` or `<ThemeProvider />`"
4030
- );
3977
+ function getNextIndex(values, i) {
3978
+ for (let j = i + 1; j < values.length; j++) {
3979
+ if (values[j] != null)
3980
+ return j;
4031
3981
  }
4032
- return theme2;
3982
+ return -1;
4033
3983
  }
4034
-
4035
- // node_modules/@chakra-ui/color-mode/dist/chunk-UQDW7KKV.mjs
4036
- var import_react43 = require("react");
4037
- var ColorModeContext = (0, import_react43.createContext)({});
4038
- ColorModeContext.displayName = "ColorModeContext";
4039
- function useColorMode() {
4040
- const context = (0, import_react43.useContext)(ColorModeContext);
4041
- if (context === void 0) {
4042
- throw new Error("useColorMode must be used within a ColorModeProvider");
4043
- }
4044
- return context;
3984
+ function createResolver(theme2) {
3985
+ const breakpointUtil = theme2.__breakpoints;
3986
+ return function resolver(config, prop, value, props) {
3987
+ var _a2, _b;
3988
+ if (!breakpointUtil)
3989
+ return;
3990
+ const result = {};
3991
+ const normalized = normalize2(value, breakpointUtil.toArrayValue);
3992
+ if (!normalized)
3993
+ return result;
3994
+ const len = normalized.length;
3995
+ const isSingle = len === 1;
3996
+ const isMultipart = !!config.parts;
3997
+ for (let i = 0; i < len; i++) {
3998
+ const key = breakpointUtil.details[i];
3999
+ const nextKey = breakpointUtil.details[getNextIndex(normalized, i)];
4000
+ const query = toMediaQueryString(key.minW, nextKey == null ? void 0 : nextKey._minW);
4001
+ const styles = runIfFn((_a2 = config[prop]) == null ? void 0 : _a2[normalized[i]], props);
4002
+ if (!styles)
4003
+ continue;
4004
+ if (isMultipart) {
4005
+ (_b = config.parts) == null ? void 0 : _b.forEach((part) => {
4006
+ (0, import_lodash4.default)(result, {
4007
+ [part]: isSingle ? styles[part] : { [query]: styles[part] }
4008
+ });
4009
+ });
4010
+ continue;
4011
+ }
4012
+ if (!isMultipart) {
4013
+ if (isSingle)
4014
+ (0, import_lodash4.default)(result, styles);
4015
+ else
4016
+ result[query] = styles;
4017
+ continue;
4018
+ }
4019
+ result[query] = styles;
4020
+ }
4021
+ return result;
4022
+ };
4045
4023
  }
4046
-
4047
- // node_modules/@chakra-ui/system/dist/chunk-7FWEOSAE.mjs
4048
- function useChakra() {
4049
- const colorModeResult = useColorMode();
4050
- const theme2 = useTheme3();
4051
- return __spreadProps(__spreadValues({}, colorModeResult), { theme: theme2 });
4024
+ function resolveStyleConfig(config) {
4025
+ return (props) => {
4026
+ var _a2;
4027
+ const { variant, size: size2, theme: theme2 } = props;
4028
+ const recipe = createResolver(theme2);
4029
+ return (0, import_lodash4.default)(
4030
+ {},
4031
+ runIfFn((_a2 = config.baseStyle) != null ? _a2 : {}, props),
4032
+ recipe(config, "sizes", size2, props),
4033
+ recipe(config, "variants", variant, props)
4034
+ );
4035
+ };
4036
+ }
4037
+ function omitThemingProps(props) {
4038
+ return omit(props, ["styleConfig", "size", "variant", "colorScheme"]);
4052
4039
  }
4053
4040
 
4054
4041
  // node_modules/@chakra-ui/utils/dist/chunk-O3SWHQEE.mjs
@@ -4194,7 +4181,7 @@ function once(fn) {
4194
4181
  return result;
4195
4182
  };
4196
4183
  }
4197
- var warn2 = /* @__PURE__ */ once((options) => () => {
4184
+ var warn = /* @__PURE__ */ once((options) => () => {
4198
4185
  const { condition, message } = options;
4199
4186
  if (condition && __DEV__) {
4200
4187
  console.warn(message);
@@ -4297,7 +4284,7 @@ function focus(element, options = {}) {
4297
4284
  return -1;
4298
4285
  function triggerFocus() {
4299
4286
  if (!element) {
4300
- warn2({
4287
+ warn({
4301
4288
  condition: true,
4302
4289
  message: "[chakra-ui]: can't call focus() on `null` or `undefined` element"
4303
4290
  });
@@ -6733,7 +6720,7 @@ var getResourceUrl = (index, readingOrder) => {
6733
6720
  }
6734
6721
  return readingOrder[index].href;
6735
6722
  };
6736
- var loadResource = (resourceUrl, proxyUrl) => __async(void 0, null, function* () {
6723
+ var fetchAsUint8Array = (resourceUrl, proxyUrl) => __async(void 0, null, function* () {
6737
6724
  const url = proxyUrl ? `${proxyUrl}${encodeURIComponent(resourceUrl)}` : resourceUrl;
6738
6725
  const response = yield fetch(url, { mode: "cors" });
6739
6726
  const array = new Uint8Array(yield response.arrayBuffer());
@@ -6887,6 +6874,12 @@ function makePdfReducer(args) {
6887
6874
  // end of the PDF that was just parsed
6888
6875
  pageNumber: state2.pageNumber === -1 ? action.numPages : state2.pageNumber
6889
6876
  });
6877
+ case "PDF_LOAD_ERROR":
6878
+ return __spreadProps(__spreadValues({}, state2), {
6879
+ state: "ERROR",
6880
+ error: action.error,
6881
+ settings: DEFAULT_SETTINGS
6882
+ });
6890
6883
  case "SET_SCROLL":
6891
6884
  if (state2.state !== "ACTIVE") {
6892
6885
  return handleInvalidTransition(state2, action);
@@ -6942,7 +6935,7 @@ function usePdfReader(args) {
6942
6935
  webpubManifestUrl,
6943
6936
  manifest,
6944
6937
  proxyUrl,
6945
- getContent,
6938
+ getContent = fetchAsUint8Array,
6946
6939
  injectablesReflowable,
6947
6940
  injectablesFixed,
6948
6941
  height = DEFAULT_HEIGHT,
@@ -6998,17 +6991,22 @@ function usePdfReader(args) {
6998
6991
  if (!manifest.readingOrder || !manifest.readingOrder.length) {
6999
6992
  throw new Error("Manifest has no Reading Order");
7000
6993
  }
7001
- const resourceUrl = getResourceUrl(
6994
+ const currentResource = getResourceUrl(
7002
6995
  state2.resourceIndex,
7003
6996
  manifest.readingOrder
7004
6997
  );
7005
- loadResource(resourceUrl, proxyUrl).then((data) => {
7006
- dispatch({
7007
- type: "RESOURCE_FETCH_SUCCESS",
7008
- resource: { data }
6998
+ const fetchResource = () => __async(this, null, function* () {
6999
+ getContent(currentResource, proxyUrl).then((data) => {
7000
+ dispatch({
7001
+ type: "RESOURCE_FETCH_SUCCESS",
7002
+ resource: { data }
7003
+ });
7009
7004
  });
7010
7005
  });
7011
- }, [state2.resourceIndex, manifest, proxyUrl]);
7006
+ if (manifest.readingOrder && manifest.readingOrder.length) {
7007
+ fetchResource();
7008
+ }
7009
+ }, [state2.resourceIndex, manifest, proxyUrl, getContent]);
7012
7010
  const resizePage = React34.useCallback(
7013
7011
  (pdfWidth, pdfHeight, containerSize2) => {
7014
7012
  const wRatio = pdfWidth / containerSize2.width;
@@ -7097,12 +7095,20 @@ function usePdfReader(args) {
7097
7095
  state: null
7098
7096
  };
7099
7097
  }
7098
+ if (state2.state === "ERROR")
7099
+ throw state2.error;
7100
7100
  const onDocumentLoadSuccess = ({ numPages }) => {
7101
7101
  dispatch({
7102
7102
  type: "PDF_PARSED",
7103
7103
  numPages
7104
7104
  });
7105
7105
  };
7106
+ const onDocumentLoadError = (error2) => {
7107
+ dispatch({
7108
+ type: "PDF_LOAD_ERROR",
7109
+ error: error2
7110
+ });
7111
+ };
7106
7112
  function onRenderSuccess(page) {
7107
7113
  if (!page.height || !page.width)
7108
7114
  throw new Error(
@@ -7142,28 +7148,36 @@ function usePdfReader(args) {
7142
7148
  overflow-y: auto;
7143
7149
  }
7144
7150
  `),
7145
- /* @__PURE__ */ React34.createElement(import_react_pdf2.Document, { file: state2.resource, onLoadSuccess: onDocumentLoadSuccess }, isParsed && state2.numPages && /* @__PURE__ */ React34.createElement(React34.Fragment, null, state2.settings.isScrolling && Array.from(new Array(state2.numPages), (_, index) => /* @__PURE__ */ React34.createElement(
7146
- ScrollPage_default,
7147
- {
7148
- key: `page_${index + 1}`,
7149
- width: containerSize.width,
7150
- placeholderHeight: state2.pdfHeight,
7151
- placeholderWidth: state2.pdfWidth,
7152
- scale: state2.scale,
7153
- pageNumber: index + 1,
7154
- onLoadSuccess: onRenderSuccess
7155
- }
7156
- )), !state2.settings.isScrolling && /* @__PURE__ */ React34.createElement(
7157
- ChakraPage_default,
7151
+ /* @__PURE__ */ React34.createElement(
7152
+ import_react_pdf2.Document,
7158
7153
  {
7159
- pageNumber: state2.pageNumber,
7160
- onLoadSuccess: onRenderSuccess,
7161
- width: state2.pageWidth,
7162
- height: state2.pageHeight,
7163
- scale: state2.scale,
7164
- loading: /* @__PURE__ */ React34.createElement(React34.Fragment, null)
7165
- }
7166
- )))
7154
+ file: state2.resource,
7155
+ onLoadSuccess: onDocumentLoadSuccess,
7156
+ onLoadError: onDocumentLoadError
7157
+ },
7158
+ isParsed && state2.numPages && /* @__PURE__ */ React34.createElement(React34.Fragment, null, state2.settings.isScrolling && Array.from(new Array(state2.numPages), (_, index) => /* @__PURE__ */ React34.createElement(
7159
+ ScrollPage_default,
7160
+ {
7161
+ key: `page_${index + 1}`,
7162
+ width: containerSize.width,
7163
+ placeholderHeight: state2.pdfHeight,
7164
+ placeholderWidth: state2.pdfWidth,
7165
+ scale: state2.scale,
7166
+ pageNumber: index + 1,
7167
+ onLoadSuccess: onRenderSuccess
7168
+ }
7169
+ )), !state2.settings.isScrolling && /* @__PURE__ */ React34.createElement(
7170
+ ChakraPage_default,
7171
+ {
7172
+ pageNumber: state2.pageNumber,
7173
+ onLoadSuccess: onRenderSuccess,
7174
+ width: state2.pageWidth,
7175
+ height: state2.pageHeight,
7176
+ scale: state2.scale,
7177
+ loading: /* @__PURE__ */ React34.createElement(React34.Fragment, null)
7178
+ }
7179
+ ))
7180
+ )
7167
7181
  ),
7168
7182
  state: state2,
7169
7183
  manifest,
@@ -8402,11 +8416,13 @@ function useWebReader(args) {
8402
8416
  const readerType = getReaderType(
8403
8417
  manifest ? manifest.metadata.conformsTo : null
8404
8418
  );
8419
+ const getContentHtml = getContent;
8420
+ const getContentPdf = getContent;
8405
8421
  const htmlReader = useHtmlReader(
8406
8422
  readerType === "HTML" && manifest ? {
8407
8423
  webpubManifestUrl,
8408
8424
  manifest,
8409
- getContent,
8425
+ getContent: getContentHtml,
8410
8426
  injectablesReflowable,
8411
8427
  injectablesFixed,
8412
8428
  height,
@@ -8419,6 +8435,7 @@ function useWebReader(args) {
8419
8435
  readerType === "PDF" && manifest ? {
8420
8436
  webpubManifestUrl,
8421
8437
  manifest,
8438
+ getContent: getContentPdf,
8422
8439
  proxyUrl,
8423
8440
  pdfWorkerSrc,
8424
8441
  height,