baseline-kit 2.1.0 → 3.0.1

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.
Files changed (38) hide show
  1. package/README.md +93 -17
  2. package/dist/README.md +93 -17
  3. package/dist/baseline-kit.css +151 -0
  4. package/dist/components/Baseline/Baseline.d.ts +0 -23
  5. package/dist/components/Box/Box.d.ts +14 -24
  6. package/dist/components/Config/Config.d.ts +25 -25
  7. package/dist/components/Config/defaults.d.ts +2 -2
  8. package/dist/components/Config/index.d.ts +1 -1
  9. package/dist/components/Guide/Guide.d.ts +2 -16
  10. package/dist/components/Guide/index.d.ts +0 -6
  11. package/dist/components/Guide/types.d.ts +1 -1
  12. package/dist/components/Layout/Layout.d.ts +0 -10
  13. package/dist/components/Padder/Padder.d.ts +8 -19
  14. package/dist/components/Spacer/Spacer.d.ts +0 -4
  15. package/dist/components/Stack/Stack.d.ts +2 -11
  16. package/dist/components/index.d.ts +4 -3
  17. package/dist/components/styles/index.d.ts +11 -0
  18. package/dist/components/types.d.ts +2 -2
  19. package/dist/hooks/useConfig.d.ts +3 -3
  20. package/dist/hooks/useIsClient.d.ts +6 -0
  21. package/dist/index.cjs +1 -31
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.ts +25 -3
  24. package/dist/index.mjs +1454 -1848
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/styles.css +1 -1
  27. package/dist/styles.d.ts +6 -0
  28. package/dist/theme/dark.css +67 -0
  29. package/dist/theme/default.css +82 -0
  30. package/dist/theme/tokens.css +82 -0
  31. package/dist/theme.css +116 -114
  32. package/dist/theme.d.ts +6 -0
  33. package/dist/utils/convert.d.ts +0 -17
  34. package/dist/utils/math.d.ts +0 -37
  35. package/dist/utils/normalize.d.ts +0 -35
  36. package/dist/utils/parse.d.ts +0 -29
  37. package/dist/utils/ssr.d.ts +0 -7
  38. package/package.json +51 -20
@@ -20,7 +20,7 @@ type Colors = {
20
20
  text: string;
21
21
  };
22
22
  /** Complete configuration schema for baseline-kit. */
23
- export type Config = {
23
+ export type ConfigSchema = {
24
24
  /** Base unit for spacing calculations */
25
25
  base: number;
26
26
  /** Guide component configuration */
@@ -62,44 +62,44 @@ export type Config = {
62
62
  debugging: DebuggingMode;
63
63
  };
64
64
  };
65
- export declare const useDefaultConfig: () => Config;
65
+ export declare const useDefaultConfig: () => ConfigSchema;
66
66
  type ConfigProps = {
67
67
  children: React.ReactNode;
68
68
  /** Base unit for spacing calculations */
69
69
  base?: number;
70
70
  /** Baseline component overrides */
71
- baseline?: Partial<Config['baseline']>;
71
+ baseline?: Partial<ConfigSchema['baseline']>;
72
72
  /** Flex component overrides */
73
- stack?: Partial<Config['stack']>;
73
+ stack?: Partial<ConfigSchema['stack']>;
74
74
  /** Layout component overrides */
75
- layout?: Partial<Config['layout']>;
75
+ layout?: Partial<ConfigSchema['layout']>;
76
76
  /** Guide component overrides */
77
- guide?: Partial<Config['guide']>;
77
+ guide?: Partial<ConfigSchema['guide']>;
78
78
  /** Spacer component overrides */
79
- spacer?: Partial<Config['spacer']>;
79
+ spacer?: Partial<ConfigSchema['spacer']>;
80
80
  /** Box component overrides */
81
- box?: Partial<Config['box']>;
81
+ box?: Partial<ConfigSchema['box']>;
82
82
  /** Padder component overrides */
83
- padder?: Partial<Config['padder']>;
83
+ padder?: Partial<ConfigSchema['padder']>;
84
84
  };
85
85
  /** Parameters for creating CSS variables */
86
86
  type CSSVariablesParams = {
87
87
  /** Base unit for spacing calculations */
88
88
  base: number;
89
89
  /** Baseline component configuration */
90
- baseline: Config['baseline'];
90
+ baseline: ConfigSchema['baseline'];
91
91
  /** Guide component configuration */
92
- guide: Config['guide'];
92
+ guide: ConfigSchema['guide'];
93
93
  /** Stack component configuration */
94
- stack: Config['stack'];
94
+ stack: ConfigSchema['stack'];
95
95
  /** Spacer component configuration */
96
- spacer: Config['spacer'];
96
+ spacer: ConfigSchema['spacer'];
97
97
  /** Layout component configuration */
98
- layout: Config['layout'];
98
+ layout: ConfigSchema['layout'];
99
99
  /** Box component configuration */
100
- box: Config['box'];
100
+ box: ConfigSchema['box'];
101
101
  /** Padder component configuration */
102
- padder: Config['padder'];
102
+ padder: ConfigSchema['padder'];
103
103
  };
104
104
  /**
105
105
  * Creates CSS variables from the configuration object.
@@ -109,29 +109,29 @@ export declare const createCSSVariables: (params: CSSVariablesParams) => Record<
109
109
  /** Parameters for merging configuration */
110
110
  type MergeConfigParams = {
111
111
  /** Parent configuration to extend */
112
- parentConfig: Config;
112
+ parentConfig: ConfigSchema;
113
113
  /** Base unit override */
114
114
  base?: number;
115
115
  /** Baseline component overrides */
116
- baseline?: Partial<Config['baseline']>;
116
+ baseline?: Partial<ConfigSchema['baseline']>;
117
117
  /** Guide component overrides */
118
- guide?: Partial<Config['guide']>;
118
+ guide?: Partial<ConfigSchema['guide']>;
119
119
  /** Spacer component overrides */
120
- spacer?: Partial<Config['spacer']>;
120
+ spacer?: Partial<ConfigSchema['spacer']>;
121
121
  /** Box component overrides */
122
- box?: Partial<Config['box']>;
122
+ box?: Partial<ConfigSchema['box']>;
123
123
  /** Stack component overrides */
124
- stack?: Partial<Config['stack']>;
124
+ stack?: Partial<ConfigSchema['stack']>;
125
125
  /** Layout component overrides */
126
- layout?: Partial<Config['layout']>;
126
+ layout?: Partial<ConfigSchema['layout']>;
127
127
  /** Padder component overrides */
128
- padder?: Partial<Config['padder']>;
128
+ padder?: Partial<ConfigSchema['padder']>;
129
129
  };
130
130
  /**
131
131
  * Merges parent config with overrides.
132
132
  * Creates a new config object without mutating the parent.
133
133
  */
134
- export declare const mergeConfig: (params: MergeConfigParams) => Config;
134
+ export declare const mergeConfig: (params: MergeConfigParams) => ConfigSchema;
135
135
  /**
136
136
  * Configuration provider for baseline-kit components.
137
137
  *
@@ -3,7 +3,7 @@
3
3
  * @description Default theme and configuration values for baseline-kit
4
4
  * @module baseline-kit/components/Config
5
5
  */
6
- import type { Config } from './Config';
6
+ import type { ConfigSchema } from './Config';
7
7
  /**
8
8
  * Default configuration for baseline-kit.
9
9
  *
@@ -22,4 +22,4 @@ import type { Config } from './Config';
22
22
  * The configuration is marked as const to ensure type safety
23
23
  * and prevent accidental modifications.
24
24
  */
25
- export declare const DEFAULT_CONFIG: Config;
25
+ export declare const DEFAULT_CONFIG: ConfigSchema;
@@ -8,4 +8,4 @@
8
8
  * theme values and default settings.
9
9
  */
10
10
  export * from './Config';
11
- export * from './defaults';
11
+ export { DEFAULT_CONFIG } from './defaults';
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
+ import { ComponentsProps } from '@components';
2
3
  import { AutoConfig, FixedConfig, LineConfig, PatternConfig } from './types';
3
- import type { ComponentsProps, GuideVariant } from '../types';
4
+ import type { GuideVariant } from '../types';
4
5
  /** Merged configuration types that support various grid layout strategies */
5
6
  export type GuideConfig = PatternConfig | AutoConfig | FixedConfig | LineConfig;
6
7
  export type GuideProps = {
@@ -12,8 +13,6 @@ export type GuideProps = {
12
13
  columns?: number | readonly (string | number | undefined | 'auto')[];
13
14
  /** Column width (for fixed variant) */
14
15
  columnWidth?: React.CSSProperties['width'];
15
- /** Gutter width between columns */
16
- gutterWidth?: React.CSSProperties['width'];
17
16
  /** Maximum width of the guide */
18
17
  maxWidth?: React.CSSProperties['maxWidth'];
19
18
  /** Color override for guide lines */
@@ -25,18 +24,6 @@ export type GuideProps = {
25
24
  /** Flag to enable SSR-compatible mode (simplified initial render) */
26
25
  ssrMode?: boolean;
27
26
  } & ComponentsProps & Omit<GuideConfig, 'columns' | 'columnWidth' | 'gap'>;
28
- /** Parameters for creating a grid configuration */
29
- type GridConfigParams = {
30
- variant: GuideVariant;
31
- base: number;
32
- gap: number;
33
- columns?: number | readonly (string | number | undefined | 'auto')[];
34
- columnWidth?: React.CSSProperties['width'];
35
- };
36
- /** Creates the appropriate grid configuration based on variant */
37
- export declare const createGridConfig: (params: GridConfigParams) => (PatternConfig | AutoConfig | FixedConfig | LineConfig);
38
- /** Creates default guide styles */
39
- export declare const createDefaultGuideStyles: (base: number, lineColor: string) => Record<string, string>;
40
27
  /**
41
28
  * A developer tool component that provides visual grid overlays for alignment.
42
29
  *
@@ -81,4 +68,3 @@ export declare const createDefaultGuideStyles: (base: number, lineColor: string)
81
68
  * ```
82
69
  */
83
70
  export declare const Guide: React.NamedExoticComponent<GuideProps>;
84
- export {};
@@ -2,11 +2,5 @@
2
2
  * @file Guide Component Entry (components/Guide/index.ts)
3
3
  * @description Visual grid overlay system for alignment
4
4
  * @module baseline-kit/components/Guide
5
- *
6
- * @remarks
7
- * Provides visual grid overlays for layout alignment with
8
- * multiple grid strategies and validation.
9
5
  */
10
6
  export * from './Guide';
11
- export * from './types';
12
- export * from './validation';
@@ -90,7 +90,7 @@ export type FixedConfig = BaseGuideConfig & {
90
90
  *
91
91
  * @example
92
92
  * ```ts
93
- * // Auto-fit columns of 200px
93
+ * // Auto-fill columns of 200px
94
94
  * const auto: AutoConfig = {
95
95
  * variant: 'auto',
96
96
  * columnWidth: '200px',
@@ -33,16 +33,6 @@ export type LayoutProps = {
33
33
  height?: React.CSSProperties['height'];
34
34
  children?: React.ReactNode;
35
35
  } & ComponentsProps & Gaps;
36
- /** Creates default layout styles with theme colors */
37
- export declare const createDefaultLayoutStyles: (colors: {
38
- line: string;
39
- flat: string;
40
- text: string;
41
- }) => Record<string, string>;
42
- /** Parses grid template definitions into CSS grid-template values. */
43
- export declare const getGridTemplate: (prop?: number | string | Array<number | string>) => string;
44
- /** Creates grid gap styles */
45
- export declare const createGridGapStyles: (gap?: React.CSSProperties["gap"] | number, rowGap?: React.CSSProperties["rowGap"] | number, columnGap?: React.CSSProperties["columnGap"] | number) => Record<string, string>;
46
36
  /**
47
37
  * A grid-based layout component with baseline alignment and responsive columns.
48
38
  *
@@ -1,24 +1,14 @@
1
1
  import * as React from 'react';
2
- import { Variant } from '../types';
2
+ import { ComponentsProps } from '../types';
3
3
  import { IndicatorNode } from '../Spacer';
4
4
  import { DebuggingMode } from '@/components';
5
- type RenderSpacerFn = (width: React.CSSProperties['width'], height: React.CSSProperties['height']) => React.ReactNode;
6
- type PaddingStyles = {
7
- paddingBlock?: string;
8
- paddingInline?: string;
9
- [key: string]: string | undefined;
10
- };
11
- /** Creates default container styles for Padder */
12
- export declare const createPadderContainerStyles: (width: React.CSSProperties["width"], height: React.CSSProperties["height"], base: number, color: string) => Record<string, string>;
13
- /** Creates padding styles when spacers are disabled */
14
- export declare const createDirectPaddingStyles: (enableSpacers: boolean, padding: {
15
- top: number;
16
- right: number;
17
- bottom: number;
18
- left: number;
19
- }) => PaddingStyles;
20
- /** Creates a render function for spacers */
21
- export declare const createRenderSpacerFn: (variant: Variant | undefined, debugging: DebuggingMode | undefined, indicatorNode?: IndicatorNode) => RenderSpacerFn;
5
+ export type PadderProps = {
6
+ /** Render function for custom measurement indicators */
7
+ indicatorNode?: IndicatorNode;
8
+ /** Flag to enable SSR-compatible mode (simplified initial render) */
9
+ ssrMode?: boolean;
10
+ children?: React.ReactNode;
11
+ } & ComponentsProps;
22
12
  /**
23
13
  * A foundational component that manages consistent padding with visual debugging.
24
14
  *
@@ -75,4 +65,3 @@ export declare const Padder: React.NamedExoticComponent<{
75
65
  height?: React.CSSProperties["height"];
76
66
  width?: React.CSSProperties["width"];
77
67
  } & import("@/components").SpacingProps & React.RefAttributes<HTMLDivElement>>;
78
- export {};
@@ -19,10 +19,6 @@ export type SpacerProps = {
19
19
  /** Flag to enable SSR-compatible mode (simplified initial render) */
20
20
  ssrMode?: boolean;
21
21
  } & ComponentsProps;
22
- /** Creates default spacer styles */
23
- export declare const createDefaultSpacerStyles: (base: number, textColor: string, flatColor: string, lineColor: string) => Record<string, string>;
24
- /** Generates measurement indicators for debugging */
25
- export declare const generateMeasurements: (isShown: boolean, indicatorNode: SpacerProps["indicatorNode"], normWidth: number | string, normHeight: number | string) => React.ReactNode | null;
26
22
  /**
27
23
  * Creates empty space for implementing margins, gaps, and spacing.
28
24
  *
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import type { Gaps } from '@components';
3
3
  import { IndicatorNode } from '../Spacer';
4
4
  import { ComponentsProps, Variant } from '../types';
5
- export declare const DIRECTION_AXIS: Record<string, React.CSSProperties['flexDirection']>;
5
+ declare const DIRECTION_AXIS: Record<string, React.CSSProperties['flexDirection']>;
6
6
  export type CSSPropertiesDirectionalAxis = keyof typeof DIRECTION_AXIS;
7
7
  export type StackProps = {
8
8
  /** Main axis orientation */
@@ -29,16 +29,6 @@ export type StackProps = {
29
29
  ssrMode?: boolean;
30
30
  children?: React.ReactNode;
31
31
  } & ComponentsProps;
32
- /** Creates default stack styles with theme colors */
33
- export declare const createDefaultStackStyles: (colors: Record<string, string>) => {
34
- '--bkkw': string;
35
- '--bkkh': string;
36
- '--bkkcl': string;
37
- '--bkkcf': string;
38
- '--bkkci': string;
39
- };
40
- /** Creates gap styles for the stack */
41
- export declare const createStackGapStyles: (rowGap?: number, columnGap?: number, gap?: number) => Record<string, number | undefined>;
42
32
  /**
43
33
  * A flexible container component aligning children to the baseline grid.
44
34
  *
@@ -91,3 +81,4 @@ export declare const createStackGapStyles: (rowGap?: number, columnGap?: number,
91
81
  * ```
92
82
  */
93
83
  export declare const Stack: React.NamedExoticComponent<StackProps>;
84
+ export {};
@@ -3,13 +3,14 @@
3
3
  * @description Main entry point for baseline-kit components
4
4
  * @module baseline-kit/components
5
5
  */
6
- import './styles/index.css';
6
+ import './styles/core.css';
7
+ import './styles/theme.css';
7
8
  export * from './Layout';
8
9
  export * from './Box';
9
10
  export * from './Stack';
10
- export * from './Guide';
11
- export * from './Baseline';
12
11
  export * from './Spacer';
13
12
  export * from './Padder';
13
+ export * from './Guide';
14
+ export * from './Baseline';
14
15
  export * from './Config';
15
16
  export * from './types';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Baseline Kit Styles System
3
+ *
4
+ * This file exports all core styles needed for the component library.
5
+ * The import order is important:
6
+ * 1. core.css - Contains reset.css, base.css, and component styles
7
+ * 2. theme.css - Contains color variables and theming
8
+ */
9
+ import './core.css';
10
+ import './theme.css';
11
+ export {};
@@ -68,10 +68,10 @@ export type GuideColumnValue = string | number | undefined | 'auto';
68
68
  export type GuideColumnsPattern = readonly GuideColumnValue[];
69
69
  /** Valid grid alignment values. */
70
70
  export declare const GRID_ALIGNMENTS: readonly ["start", "center", "end"];
71
- export type GridAlignment = typeof GRID_ALIGNMENTS[number];
71
+ export type GridAlignment = (typeof GRID_ALIGNMENTS)[number];
72
72
  /** Valid component variants affecting visual style. */
73
73
  export declare const PADD_VARIANTS: readonly ["line", "flat"];
74
- export type PaddedVariant = typeof PADD_VARIANTS[number];
74
+ export type PaddedVariant = (typeof PADD_VARIANTS)[number];
75
75
  /**
76
76
  * Common props shared across library components.
77
77
  * Provides consistent sizing, spacing, styling, and debugging options.
@@ -1,6 +1,6 @@
1
- import { Config } from '@components';
1
+ import { ConfigSchema } from '@components';
2
2
  /** Type helper that merges base configuration with component-specific settings. */
3
- export type ComponentConfig<K extends keyof Config> = Config[K] & {
3
+ export type ComponentConfig<K extends keyof ConfigSchema> = ConfigSchema[K] & {
4
4
  /** Base unit for spacing calculations */
5
5
  base: number;
6
6
  };
@@ -38,4 +38,4 @@ export type ComponentConfig<K extends keyof Config> = Config[K] & {
38
38
  * }
39
39
  * ```
40
40
  */
41
- export declare function useConfig<K extends keyof Config>(component: K): ComponentConfig<K>;
41
+ export declare function useConfig<K extends keyof ConfigSchema>(component: K): ComponentConfig<K>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Hook to determine if the code is running on the client side.
3
+ *
4
+ * @returns Boolean indicating if the code is running in a browser environment
5
+ */
6
+ export declare function useIsClient(): boolean;
package/dist/index.cjs CHANGED
@@ -1,32 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("react");function $t(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return n.default=e,Object.freeze(n)}const c=$t(K);var ye={exports:{}},be={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Je;function Vt(){if(Je)return be;Je=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function o(r,s,a){var l=null;if(a!==void 0&&(l=""+a),s.key!==void 0&&(l=""+s.key),"key"in s){a={};for(var i in s)i!=="key"&&(a[i]=s[i])}else a=s;return s=a.ref,{$$typeof:e,type:r,key:l,ref:s!==void 0?s:null,props:a}}return be.Fragment=n,be.jsx=o,be.jsxs=o,be}var me={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Ze;function Gt(){return Ze||(Ze=1,process.env.NODE_ENV!=="production"&&function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===J?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case D:return"Fragment";case P:return"Portal";case O:return"Profiler";case k:return"StrictMode";case W:return"Suspense";case v:return"SuspenseList"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case E:return(t.displayName||"Context")+".Provider";case I:return(t._context.displayName||"Context")+".Consumer";case H:var f=t.render;return t=t.displayName,t||(t=f.displayName||f.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case z:return f=t.displayName||null,f!==null?f:e(t.type)||"Memo";case B:f=t._payload,t=t._init;try{return e(t(f))}catch{}}return null}function n(t){return""+t}function o(t){try{n(t);var f=!1}catch{f=!0}if(f){f=console;var d=f.error,C=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return d.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",C),n(t)}}function r(){}function s(){if(X===0){Ie=console.log,Be=console.info,Pe=console.warn,We=console.error,ze=console.group,He=console.groupCollapsed,Le=console.groupEnd;var t={configurable:!0,enumerable:!0,value:r,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}X++}function a(){if(X--,X===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},t,{value:Ie}),info:L({},t,{value:Be}),warn:L({},t,{value:Pe}),error:L({},t,{value:We}),group:L({},t,{value:ze}),groupCollapsed:L({},t,{value:He}),groupEnd:L({},t,{value:Le})})}0>X&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function l(t){if(Ce===void 0)try{throw Error()}catch(d){var f=d.stack.trim().match(/\n( *(at )?)/);Ce=f&&f[1]||"",Ue=-1<d.stack.indexOf(`
18
- at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
19
- `+Ce+t+Ue}function i(t,f){if(!t||Re)return"";var d=_e.get(t);if(d!==void 0)return d;Re=!0,d=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var C=null;C=_.H,_.H=null,s();try{var U={DetermineComponentFrameRoot:function(){try{if(f){var ae=function(){throw Error()};if(Object.defineProperty(ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ae,[])}catch(te){var pe=te}Reflect.construct(t,[],ae)}else{try{ae.call()}catch(te){pe=te}t.call(ae.prototype)}}else{try{throw Error()}catch(te){pe=te}(ae=t())&&typeof ae.catch=="function"&&ae.catch(function(){})}}catch(te){if(te&&pe&&typeof te.stack=="string")return[te.stack,pe.stack]}return[null,null]}};U.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var $=Object.getOwnPropertyDescriptor(U.DetermineComponentFrameRoot,"name");$&&$.configurable&&Object.defineProperty(U.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=U.DetermineComponentFrameRoot(),ee=y[0],ue=y[1];if(ee&&ue){var F=ee.split(`
20
- `),ce=ue.split(`
21
- `);for(y=$=0;$<F.length&&!F[$].includes("DetermineComponentFrameRoot");)$++;for(;y<ce.length&&!ce[y].includes("DetermineComponentFrameRoot");)y++;if($===F.length||y===ce.length)for($=F.length-1,y=ce.length-1;1<=$&&0<=y&&F[$]!==ce[y];)y--;for(;1<=$&&0<=y;$--,y--)if(F[$]!==ce[y]){if($!==1||y!==1)do if($--,y--,0>y||F[$]!==ce[y]){var de=`
22
- `+F[$].replace(" at new "," at ");return t.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",t.displayName)),typeof t=="function"&&_e.set(t,de),de}while(1<=$&&0<=y);break}}}finally{Re=!1,_.H=C,a(),Error.prepareStackTrace=d}return F=(F=t?t.displayName||t.name:"")?l(F):"",typeof t=="function"&&_e.set(t,F),F}function u(t){if(t==null)return"";if(typeof t=="function"){var f=t.prototype;return i(t,!(!f||!f.isReactComponent))}if(typeof t=="string")return l(t);switch(t){case W:return l("Suspense");case v:return l("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case H:return t=i(t.render,!1),t;case z:return u(t.type);case B:f=t._payload,t=t._init;try{return u(t(f))}catch{}}return""}function m(){var t=_.A;return t===null?null:t.getOwner()}function p(t){if(Y.call(t,"key")){var f=Object.getOwnPropertyDescriptor(t,"key").get;if(f&&f.isReactWarning)return!1}return t.key!==void 0}function b(t,f){function d(){Fe||(Fe=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",f))}d.isReactWarning=!0,Object.defineProperty(t,"key",{get:d,configurable:!0})}function M(){var t=e(this.type);return Ye[t]||(Ye[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function S(t,f,d,C,U,$){return d=$.ref,t={$$typeof:R,type:t,key:f,props:$,_owner:U},(d!==void 0?d:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:M}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function h(t,f,d,C,U,$){if(typeof t=="string"||typeof t=="function"||t===D||t===O||t===k||t===W||t===v||t===A||typeof t=="object"&&t!==null&&(t.$$typeof===B||t.$$typeof===z||t.$$typeof===E||t.$$typeof===I||t.$$typeof===H||t.$$typeof===Z||t.getModuleId!==void 0)){var y=f.children;if(y!==void 0)if(C)if(q(y)){for(C=0;C<y.length;C++)j(y[C],t);Object.freeze&&Object.freeze(y)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else j(y,t)}else y="",(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(y+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),t===null?C="null":q(t)?C="array":t!==void 0&&t.$$typeof===R?(C="<"+(e(t.type)||"Unknown")+" />",y=" Did you accidentally export a JSX literal instead of a component?"):C=typeof t,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",C,y);if(Y.call(f,"key")){y=e(t);var ee=Object.keys(f).filter(function(F){return F!=="key"});C=0<ee.length?"{key: someKey, "+ee.join(": ..., ")+": ...}":"{key: someKey}",qe[y+C]||(ee=0<ee.length?"{"+ee.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
23
- let props = %s;
24
- <%s {...props} />
25
- React keys must be passed directly to JSX without using spread:
26
- let props = %s;
27
- <%s key={someKey} {...props} />`,C,y,ee,y),qe[y+C]=!0)}if(y=null,d!==void 0&&(o(d),y=""+d),p(f)&&(o(f.key),y=""+f.key),"key"in f){d={};for(var ue in f)ue!=="key"&&(d[ue]=f[ue])}else d=f;return y&&b(d,typeof t=="function"?t.displayName||t.name||"Unknown":t),S(t,y,$,U,m(),d)}function j(t,f){if(typeof t=="object"&&t&&t.$$typeof!==Nt){if(q(t))for(var d=0;d<t.length;d++){var C=t[d];T(C)&&g(C,f)}else if(T(t))t._store&&(t._store.validated=1);else if(t===null||typeof t!="object"?d=null:(d=Q&&t[Q]||t["@@iterator"],d=typeof d=="function"?d:null),typeof d=="function"&&d!==t.entries&&(d=d.call(t),d!==t))for(;!(t=d.next()).done;)T(t.value)&&g(t.value,f)}}function T(t){return typeof t=="object"&&t!==null&&t.$$typeof===R}function g(t,f){if(t._store&&!t._store.validated&&t.key==null&&(t._store.validated=1,f=V(f),!Xe[f])){Xe[f]=!0;var d="";t&&t._owner!=null&&t._owner!==m()&&(d=null,typeof t._owner.tag=="number"?d=e(t._owner.type):typeof t._owner.name=="string"&&(d=t._owner.name),d=" It was passed a child from "+d+".");var C=_.getCurrentStack;_.getCurrentStack=function(){var U=u(t.type);return C&&(U+=C()||""),U},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',f,d),_.getCurrentStack=C}}function V(t){var f="",d=m();return d&&(d=e(d.type))&&(f=`
28
-
29
- Check the render method of \``+d+"`."),f||(t=e(t))&&(f=`
30
-
31
- Check the top-level render call using <`+t+">."),f}var N=K,R=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),E=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),Q=Symbol.iterator,J=Symbol.for("react.client.reference"),_=N.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,L=Object.assign,Z=Symbol.for("react.client.reference"),q=Array.isArray,X=0,Ie,Be,Pe,We,ze,He,Le;r.__reactDisabledLog=!0;var Ce,Ue,Re=!1,_e=new(typeof WeakMap=="function"?WeakMap:Map),Nt=Symbol.for("react.client.reference"),Fe,Ye={},qe={},Xe={};me.Fragment=D,me.jsx=function(t,f,d,C,U){return h(t,f,d,!1,C,U)},me.jsxs=function(t,f,d,C,U){return h(t,f,d,!0,C,U)}}()),me}var Ke;function Dt(){return Ke||(Ke=1,process.env.NODE_ENV==="production"?ye.exports=Vt():ye.exports=Gt()),ye.exports}var w=Dt();function ot(e){const n=e.trim().match(/^([+-]?[\d.]+)([a-zA-Z%]+)$/);if(!n)return null;const o=parseFloat(n[1]),r=n[2];return{value:o,unit:r}}function G(e,n){return e===void 0&&n!==void 0?`${n}px`:e==="auto"||typeof e=="string"&&/^(auto|100%|0|.*(fr|vh|vw|vmin|vmax|rem))$/.test(e)?String(e):typeof e=="number"?`${e}px`:e??""}const It={parentSize:0,viewportWidth:typeof window<"u"?window.innerWidth:1920,viewportHeight:typeof window<"u"?window.innerHeight:1080,rootFontSize:16,parentFontSize:16},ve={px:1,in:96,cm:37.8,mm:3.78,pt:1.33,pc:16},Me=["em","rem","vh","vw","vmin","vmax","%"];function Se(e,n){if(typeof e=="number")return e;if(typeof e!="string")return null;const o=ot(e);if(!o)return null;const{value:r,unit:s}=o;if(s in ve)return r*ve[s];if(s==="auto")return null;if(Me.includes(s)){const a={...It,...n};switch(s){case"em":return r*a.parentFontSize;case"rem":return r*a.rootFontSize;case"vh":return r/100*a.viewportHeight;case"vw":return r/100*a.viewportWidth;case"vmin":return r/100*Math.min(a.viewportWidth,a.viewportHeight);case"vmax":return r/100*Math.max(a.viewportWidth,a.viewportHeight);case"%":return r/100*a.parentSize;default:return null}}return null}function Bt(e,n,o){const r=(o==null?void 0:o.round)??!0,s=e===void 0?0:typeof e=="number"?e:Se(e)??0;return`${(r?Math.round(s):s)%n}px`}function rt(e,n,o){return Math.min(Math.max(e,n),o)}function Pt(e,n=0){if(n>=0)return Number((Math.round(e*10**n)/10**n).toFixed(n));{const o=10**Math.abs(n);return Math.round(e/o)*o}}function st(e){const{height:n,top:o,bottom:r,base:s}=e,a=(n??0)-(o+r);return Math.max(1,Math.floor(a/s))}function xe(e,n={}){const{base:o=8,round:r=!0,clamp:s,suppressWarnings:a=!1}=n;if(e==="auto")return o;let l=null;if(typeof e=="number")l=e;else if(typeof e=="string"){const m=Se(e);m===null?(a||console.error(`Failed to convert "${e}" to pixels. Falling back to base ${o}.`),l=o):l=m}l===null&&(l=o);const i=r?Math.round(l/o)*o:l,u=s!==void 0?rt(i,s.min??-1/0,s.max??1/0):i;return!a&&u!==l&&console.warn(`Normalized ${l} to ${u} to match base ${o}px.`),u}function Te(e,n,o){if(!e||e[0]===void 0&&e[1]===void 0)return n;const r=e[0]!==void 0?xe(e[0],o):n[0],s=e[1]!==void 0?xe(e[1],o):n[1];return[r,s]}function le(e){if("padding"in e&&e.padding!=null)return Wt(e.padding);const n="block"in e&&e.block!=null?zt(e.block):{top:0,bottom:0},o="inline"in e&&e.inline!=null?Ht(e.inline):{left:0,right:0};return{top:n.top,right:o.right,bottom:n.bottom,left:o.left}}function Wt(e){if(typeof e=="number")return{top:e,right:e,bottom:e,left:e};if(Array.isArray(e)){if(e.length===2){const[n,o]=e;return{top:n,right:o,bottom:n,left:o}}if(e.length>=4){const[n,o,r,s]=e;return{top:n??0,right:o??0,bottom:r??0,left:s??0}}}if(typeof e=="object"&&!Array.isArray(e)){const n=e.top??0,o=e.bottom??0,r=e.left??0,s=e.right??0;return{top:n,right:s,bottom:o,left:r}}return{top:0,right:0,bottom:0,left:0}}function zt(e){if(typeof e=="number")return{top:e,bottom:e};if(Array.isArray(e)){const[n,o]=e;return{top:n??0,bottom:o??0}}return typeof e=="object"?{top:e.start??0,bottom:e.end??0}:{top:0,bottom:0}}function Ht(e){if(typeof e=="number")return{left:e,right:e};if(Array.isArray(e)){const[n,o]=e;return{left:n??0,right:o??0}}return typeof e=="object"?{left:e.start??0,right:e.end??0}:{left:0,right:0}}function at(e,n,o,r){const s=le({padding:o});if(r==="none")return s;if(r==="height"){const a=e%n;a!==0&&(s.bottom+=n-a)}if(r==="clamp"){s.top=s.top%n;const a=e%n;a!==0&&(s.bottom+=n-a),s.bottom=s.bottom%n}return s}const lt=(e,n,o)=>{const r={};return e!==void 0?(r.gridColumn=`span ${e}`,r.gridRow=`span ${e}`):(n!==void 0&&(r.gridColumn=`span ${n}`),o!==void 0&&(r.gridRow=`span ${o}`)),r},ne=(...e)=>e.filter(Boolean).join(" ").trim(),oe=(...e)=>Object.assign({},...e.filter(n=>n!==void 0));function Lt(e,n){if(e)if(typeof e=="function")e(n);else try{Object.assign(e,{current:n})}catch(o){console.error("Error assigning ref:",o)}}function Ae(...e){return n=>{e.forEach(o=>{Lt(o,n)})}}function x(e,n,o){var i,u,m;const r=typeof e=="string"?e:e.key,s=typeof e=="string"?n:e.value,a=typeof e=="string"?o:e.defaultStyles,l=typeof e=="object"?e.skipDimensions:void 0;if(l){if((i=l.fitContent)!=null&&i.includes(r)&&s==="fit-content")return{};if((u=l.auto)!=null&&u.includes(r)&&s==="auto")return{};if((m=l.fullSize)!=null&&m.includes(r)&&(s==="100%"||s==="100vh"||s==="100vw"))return{}}return s!==a[r]?{[r]:s}:{}}const Ut=(e,n)=>{let o=null;const r=()=>{o&&(clearTimeout(o),o=null)};return[(...a)=>{r(),o=setTimeout(()=>e(...a),n)},r]},Ne=e=>{let n=null,o=null;return(...s)=>{o=s,n!==null&&cancelAnimationFrame(n),n=requestAnimationFrame(()=>{e(...o),n=null,o=null})}},$e=typeof window>"u",it={width:1024,height:768};function Ft(e,n){if($e)return n;try{return e()}catch{return n}}function re(e,n,o){return!e||$e?n:o}function ge(e){const[n,o]=c.useState({width:0,height:0}),r=c.useCallback(()=>{if(e.current)try{const a=e.current.getBoundingClientRect(),l={width:a?Math.round(a.width):0,height:a?Math.round(a.height):0};o(i=>i.width===l.width&&i.height===l.height?i:l)}catch{o({width:0,height:0})}},[e]),s=c.useMemo(()=>Ne(r),[r]);return c.useLayoutEffect(()=>{r()},[r]),c.useLayoutEffect(()=>{if(!e.current)return;const a=new ResizeObserver(()=>{s()});return a.observe(e.current),()=>{a.disconnect()}},[e,s]),{...n,refresh:s}}function ct({totalLines:e,lineHeight:n,containerRef:o,buffer:r=0}){const s=K.useMemo(()=>typeof r=="number"?r:parseInt(r,10)||0,[r]),a=K.useCallback(()=>{const p=o.current;if(!p)return{start:0,end:e};if(p.closest(".block"))return{start:0,end:e};const M=p.getBoundingClientRect().top+window.scrollY,S=Math.max(0,window.scrollY-M-s),h=S+window.innerHeight+s*2,j=Math.max(0,Math.floor(S/n)),T=Math.min(e,Math.ceil(h/n));return{start:j,end:T}},[e,n,o,s]),[l,i]=K.useState(a);Yt(["scroll","resize"],()=>{m()});const u=K.useCallback(()=>{i(p=>{const b=a();return p.start!==b.start||p.end!==b.end?b:p})},[a]),m=K.useMemo(()=>Ne(u),[u]);return K.useLayoutEffect(()=>{const p=o.current;if(!p)return;const b=new IntersectionObserver(m,{threshold:0});return b.observe(p),m(),()=>{b.disconnect()}},[o,a,m]),l}function Yt(e,n){const o=K.useCallback(n,[n]);K.useLayoutEffect(()=>{const r=()=>o();return e.forEach(s=>window.addEventListener(s,r)),()=>e.forEach(s=>window.removeEventListener(s,r))},[e,o])}function he(e,{base:n=8,snapping:o="none",spacing:r={},warnOnMisalignment:s=!1}={}){if(n<1)throw new Error("Base must be >= 1 for baseline alignment.");const{height:a}=ge(e),l=c.useRef(!1),i=c.useRef(!1);return c.useMemo(()=>{const u=le({padding:r}),m=a%n===0;if(!m&&s&&process.env.NODE_ENV==="development"&&(i.current||(console.warn(`[useBaseline] Element height (${a}px) is not aligned with base (${n}px).`),i.current=!0)),o==="none")return{padding:u,isAligned:m,height:a};if(l.current)return{padding:u,isAligned:m,height:a};const p=at(a,n,u,o);return l.current=!0,{padding:p,isAligned:m,height:a}},[n,o,r,s,a])}function ut(e,n){const{width:o}=ge(e),r=c.useRef(!1);return c.useMemo(()=>{const s=n.variant??"line",a=n.base??8,l=xe(n.gap??0,{base:a});if(!o)return{template:"none",columnsCount:0,calculatedGap:0,isValid:!1};try{switch(s){case"line":{const i=Math.max(1,Math.floor(o/(l+1))+1);return{template:`repeat(${i}, 1px)`,columnsCount:i,calculatedGap:l,isValid:!0}}case"pattern":{if(!Ot(n.columns))throw new Error('Invalid "pattern" columns array');const i=n.columns.map(u=>typeof u=="number"?`${u}px`:u);return i.some(u=>u==="0"||u==="0px")?{template:"none",columnsCount:0,calculatedGap:0,isValid:!1}:{template:i.join(" "),columnsCount:i.length,calculatedGap:l,isValid:!0}}case"fixed":{const i=typeof n.columns=="number"?n.columns:0;if(i<1)throw new Error(`Invalid columns count: ${i}`);const u=n.columnWidth?G(n.columnWidth):"1fr";return{template:`repeat(${i}, ${u})`,columnsCount:i,calculatedGap:l,isValid:!0}}case"auto":{const i=n.columnWidth??"auto";if(i==="auto")return{template:"repeat(auto-fit, minmax(0, 1fr))",columnsCount:1,calculatedGap:l,isValid:!0};const u=typeof i=="number"?`${i}px`:i.toString(),m=Se(u)??0,p=m>0?Math.max(1,Math.floor((o+l)/(m+l))):1;return{template:`repeat(auto-fit, minmax(${u}, 1fr))`,columnsCount:p,calculatedGap:l,isValid:!0}}default:{r.current||(console.warn(`[useGuide] Unknown variant "${s}". Falling back to "line".`),r.current=!0);const i=Math.max(1,Math.floor(o/(l+1))+1);return{template:`repeat(${i}, 1px)`,columnsCount:i,calculatedGap:l,isValid:!0}}}}catch(i){return console.warn("Error in useGuide:",i),{template:"none",columnsCount:0,calculatedGap:0,isValid:!1}}},[n,o])}function se(e){const n=Ge();return K.useMemo(()=>Object.assign({base:n.base},n[e]),[n,e])}function ie(e,n){return K.useMemo(()=>{const o=e??n;return{isShown:o==="visible",isHidden:o==="hidden",isNone:o==="none",debugging:o}},[e,n])}const qt={line:"var(--bk-guide-color-line-theme)",pattern:"var(--bk-guide-color-pattern-theme)",auto:"var(--bk-guide-color-auto-theme)",fixed:"var(--bk-guide-color-fixed-theme)"},Xt={line:"var(--bk-baseline-color-line-theme)",flat:"var(--bk-baseline-color-flat-theme)"},Jt={line:"var(--bk-spacer-color-line-theme)",flat:"var(--bk-spacer-color-flat-theme)",text:"var(--bk-spacer-color-text-theme)"},Zt={line:"var(--bk-box-color-line-theme)",flat:"var(--bk-box-color-flat-theme)",text:"var(--bk-box-color-text-theme)"},Kt={line:"var(--bk-stack-color-line-theme)",flat:"var(--bk-stack-color-flat-theme)",text:"var(--bk-stack-color-text-theme)"},Qt={line:"var(--bk-layout-color-line-theme)",flat:"var(--bk-layout-color-flat-theme)",text:"var(--bk-layout-color-text-theme)"},en="var(--bk-padder-color-theme)",ft={base:8,baseline:{variant:"line",debugging:"hidden",colors:Xt},guide:{variant:"line",debugging:"hidden",colors:qt},spacer:{variant:"line",debugging:"hidden",colors:Jt},box:{debugging:"hidden",colors:Zt},stack:{debugging:"hidden",colors:Kt},layout:{debugging:"hidden",colors:Qt},padder:{debugging:"hidden",color:en}},Ve=c.createContext(ft);Ve.displayName="ConfigContext";const Ge=()=>c.use(Ve),tn=e=>{const{base:n,baseline:o,guide:r,stack:s,spacer:a,layout:l,box:i,padder:u}=e;return{"--bkb":`${n}px`,"--bkbcl":o.colors.line,"--bkbcf":o.colors.flat,"--bkgcl":r.colors.line,"--bkgcp":r.colors.pattern,"--bkgca":r.colors.auto,"--bkgcf":r.colors.fixed,"--bkscl":a.colors.line,"--bkscf":a.colors.flat,"--bksci":a.colors.text,"--bkxcl":i.colors.line,"--bkxcf":i.colors.flat,"--bkxci":i.colors.text,"--bkkcl":s.colors.line,"--bkkcf":s.colors.flat,"--bkkci":s.colors.text,"--bklcl":l.colors.line,"--bklcf":l.colors.flat,"--bklci":l.colors.text,"--bkpc":u.color}},dt=e=>{const{parentConfig:n,base:o,baseline:r,guide:s,spacer:a,box:l,stack:i,layout:u,padder:m}=e;return{base:o??n.base,baseline:{...n.baseline,...r},guide:{...n.guide,...s},spacer:{...n.spacer,...a},box:{...n.box,...l},stack:{...n.stack,...i},layout:{...n.layout,...u},padder:{...n.padder,...m}}};function we({children:e,base:n,stack:o,baseline:r,guide:s,layout:a,spacer:l,box:i,padder:u}){const m=Ge(),p=c.useMemo(()=>dt({parentConfig:m,base:n,baseline:r,guide:s,spacer:l,box:i,stack:o,layout:a,padder:u}),[m,n,r,s,l,i,o,a,u]);return w.jsx(Ve,{value:p,children:e})}const nn="spr_zbcF6",on="line_qHW69",rn="flat_gqixr",Qe={spr:nn,line:on,flat:rn},bt=(e,n,o,r)=>({"--bksw":"100%","--bksh":"100%","--bksb":`${e}px`,"--bksci":n,"--bkscl":r,"--bkscf":o}),mt=(e,n,o,r)=>{if(!e||!n)return null;const s=typeof o=="number"?o:0,a=typeof r=="number"?r:0;return w.jsxs(w.Fragment,{children:[a!==0&&w.jsx("span",{children:n(a,"height")},"height"),s!==0&&w.jsx("span",{children:n(s,"width")},"width")]})},gt=c.memo(function({height:n,width:o,indicatorNode:r,debugging:s,variant:a,base:l,color:i,className:u,style:m,children:p,ssrMode:b=!1,...M}){const S=c.useRef(null),h=se("spacer"),{isShown:j}=ie(s,h.debugging),T=a??h.variant,g=l??h.base,[V,N]=c.useState(!1);c.useEffect(()=>{N(!0)},[]);const[R,P]=c.useMemo(()=>Te([o,n],[0,0],{base:g,suppressWarnings:!0}),[o,n,g]),D=re(V&&!b,!1,j&&r!==void 0),k=c.useMemo(()=>D?mt(j,r,R,P):null,[D,j,r,R,P]),O=c.useMemo(()=>bt(g,h.colors.text,h.colors.flat,h.colors.line),[g,h.colors]),I=c.useMemo(()=>{const E=G(P||"100%"),H=G(R||"100%"),W=`${g}px`,v=["--bksw","--bksh"],z={...x({key:"--bksh",value:E,defaultStyles:O,skipDimensions:{fullSize:v}}),...x({key:"--bksw",value:H,defaultStyles:O,skipDimensions:{fullSize:v}}),"--bksb":W,...x({key:"--bksci",value:i??h.colors.text,defaultStyles:O}),...x({key:"--bkscl",value:i??h.colors.line,defaultStyles:O}),...x({key:"--bkscf",value:i??h.colors.flat,defaultStyles:O})};return oe(z,m)},[R,P,i,g,h.colors,O,m]);return w.jsxs("div",{ref:S,"data-testid":"spacer",className:ne(Qe.spr,j&&Qe[T],u),"data-variant":T,style:I,...M,children:[k,p]})}),sn="pad_w2-sL",an="v_lhGBy",je={pad:sn,v:an},ht=(e,n,o,r)=>{const s={};return e!=="fit-content"&&(s["--bkpw"]=G(e||"fit-content")),n!=="fit-content"&&(s["--bkph"]=G(n||"fit-content")),o!==8&&(s["--bkpb"]=`${o}px`),r!=="var(--bk-padder-color-theme)"&&(s["--bkpc"]=r),s},pt=(e,n)=>{const{top:o,right:r,bottom:s,left:a}=n,l={};return e||((o>0||s>0)&&(l.paddingBlock=`${o}px ${s}px`),(a>0||r>0)&&(l.paddingInline=`${a}px ${r}px`)),l},yt=(e,n,o)=>{const r=e||"line",s=n||"none",a=(l,i)=>w.jsx(gt,{variant:r,debugging:i===0||l===0?"none":s,indicatorNode:o,height:i!=="100%"?i:void 0,width:l!=="100%"?l:void 0});return a.displayName="PadderSpacer",a},Ee=c.memo(c.forwardRef(function({children:n,className:o,debugging:r,height:s,indicatorNode:a,style:l,width:i,ssrMode:u=!1,...m},p){const b=se("padder"),{variant:M}=se("spacer"),S=c.useMemo(()=>le(m),[m]),{isShown:h,isNone:j,debugging:T}=ie(r,b.debugging),g=!j,[V,N]=c.useState(!1);c.useEffect(()=>{N(!0)},[]);const R=c.useRef(null),P=he(R,{base:b.base,snapping:"height",spacing:S,warnOnMisalignment:!j}),D={padding:{top:S.top||0,right:S.right||0,bottom:S.bottom||0,left:S.left||0}},{padding:k}=re(V&&!u,D,P),O=Ae(p,R),I=c.useMemo(()=>{const H=ht(i,s,b.base,b.color),W=pt(g,{top:k.top,right:k.right,bottom:k.bottom,left:k.left});return oe({...H,...W},l)},[i,s,b.base,b.color,g,k.top,k.right,k.bottom,k.left,l]),E=c.useMemo(()=>yt(M,T,a),[M,T,a]);return g?w.jsxs("div",{ref:O,"data-testid":"padder",className:ne(je.pad,h&&je.v,o),style:I,children:[w.jsxs(w.Fragment,{children:[k.top>=0&&w.jsx("div",{style:{gridColumn:"1 / -1"},children:E("100%",k.top)}),k.left>=0&&w.jsx("div",{style:{gridRow:"2 / 3"},children:E(k.left,"100%")})]}),w.jsx("div",{style:{gridRow:"2 / 3",gridColumn:"2 / 3"},children:n}),w.jsxs(w.Fragment,{children:[k.right>=0&&w.jsx("div",{style:{gridRow:"2 / 3"},children:E(k.right,"100%")}),k.bottom>=0&&w.jsx("div",{style:{gridColumn:"1 / -1"},children:E("100%",k.bottom)})]})]}):w.jsx("div",{ref:O,"data-testid":"padder",className:ne(je.pad,o),style:I,children:n})})),ln="lay_5cMu5",cn="v_dprVE",et={lay:ln,v:cn},kt=e=>({"--bklw":"auto","--bklh":"auto","--bklcl":e.line,"--bklcf":e.flat,"--bklci":e.text}),Oe=e=>typeof e=="number"?`repeat(${e}, 1fr)`:typeof e=="string"?e:Array.isArray(e)?e.map(n=>typeof n=="number"?`${n}px`:n).join(" "):"repeat(auto-fit, minmax(100px, 1fr))",vt=(e,n,o)=>{const r={};return e!==void 0&&(r.gap=G(e)),n!==void 0&&(r.rowGap=G(n)),o!==void 0&&(r.columnGap=G(o)),r},un=c.memo(function({alignContent:n,alignItems:o,children:r,className:s,columns:a="repeat(auto-fit, minmax(100px, 1fr))",columnGap:l,debugging:i,gap:u,height:m,indicatorNode:p,justifyContent:b,justifyItems:M,rowGap:S,rows:h,style:j,variant:T,width:g,ssrMode:V=!1,...N}){const R=se("layout"),{isShown:P,debugging:D}=ie(i,R.debugging),[k,O]=c.useState(!1);c.useEffect(()=>{O(!0)},[]);const I=c.useRef(null),E=c.useMemo(()=>le(N),[N]),H=he(I,{base:R.base,snapping:"height",spacing:E,warnOnMisalignment:!0}),W={padding:{top:E.top||0,right:E.right||0,bottom:E.bottom||0,left:E.left||0}},{padding:v}=re(k&&!V,W,H),z=c.useMemo(()=>Oe(a),[a]),B=c.useMemo(()=>h?Oe(h):"auto",[h]),A=c.useMemo(()=>kt(R.colors),[R.colors]),Q=c.useMemo(()=>vt(u,S,l),[u,S,l]),J=c.useMemo(()=>{const _=G(g||"auto"),Y=G(m||"auto"),L=["--bklw","--bklh"];return oe({...x({key:"--bklw",value:_,defaultStyles:A,skipDimensions:{auto:L}}),...x({key:"--bklh",value:Y,defaultStyles:A,skipDimensions:{auto:L}}),...x({key:"--bklcl",value:R.colors.line,defaultStyles:A}),...x({key:"--bklcf",value:R.colors.flat,defaultStyles:A}),...x({key:"--bklci",value:R.colors.text,defaultStyles:A}),...z!=="repeat(auto-fit, minmax(100px, 1fr))"&&{"--bklgtc":z},...B!=="auto"&&{"--bklgtr":B},...M&&{"--bklji":M},...o&&{"--bklai":o},...b&&{"--bkljc":b},...n&&{"--bklac":n},...Q},j)},[z,B,M,o,b,n,g,m,R.colors,A,j,Q]);return w.jsx(we,{spacer:{variant:T??"line"},children:w.jsx(Ee,{ref:I,className:P?et.v:"",block:[v.top,v.bottom],...p?{indicatorNode:p}:{},inline:[v.left,v.right],debugging:D,width:g,height:m,ssrMode:V,children:w.jsx("div",{"data-testid":"layout",className:ne(s,et.lay),style:J,...N&&Object.keys(N).length>0?Object.fromEntries(Object.entries(N).filter(([_])=>_!=="ssrMode")):{},children:r})})})}),fn="box_rDCRX",dn="v_0MMHD",tt={box:fn,v:dn},xt=(e,n)=>({"--bkxw":"fit-content","--bkxh":"fit-content","--bkxb":`${e}px`,"--bkxcl":n}),St=({width:e,height:n,base:o,lineColor:r,defaultStyles:s})=>{const a=G(e||"fit-content"),l=G(n||"fit-content"),i=["--bkxw","--bkxh"];return{...x({key:"--bkxw",value:a,defaultStyles:s,skipDimensions:{fitContent:i}}),...x({key:"--bkxh",value:l,defaultStyles:s,skipDimensions:{fitContent:i}}),...x({key:"--bkxb",value:`${o}px`,defaultStyles:s}),...x({key:"--bkxcl",value:r,defaultStyles:s})}},bn=c.memo(c.forwardRef(function({children:n,snapping:o="clamp",debugging:r,className:s,colSpan:a,rowSpan:l,span:i,width:u,height:m,style:p,ssrMode:b=!1,...M},S){const h=se("box"),{isShown:j,debugging:T}=ie(r,h.debugging),[g,V]=c.useState(!1);c.useEffect(()=>{V(!0)},[]);const N=c.useRef(null),{top:R,bottom:P,left:D,right:k}=le(M),O=he(N,{base:h.base,snapping:o,spacing:{top:R,bottom:P,left:D,right:k},warnOnMisalignment:T!=="none"}),I={padding:{top:R||0,right:k||0,bottom:P||0,left:D||0}},{padding:E}=re(g&&!b,I,O),H=c.useMemo(()=>lt(i,a,l),[a,l,i]),W=c.useMemo(()=>xt(h.base,h.colors.line),[h.base,h.colors.line]),v=c.useMemo(()=>{const z=St({width:u,height:m,base:h.base,lineColor:h.colors.line,defaultStyles:W});return oe(z,p)},[h.base,h.colors.line,u,m,W,p]);return w.jsx("div",{ref:Ae(S,N),"data-testid":"box",className:ne(tt.box,j&&tt.v,s),style:oe(v,H),children:w.jsx(we,{base:1,spacer:{variant:"flat"},children:w.jsx(Ee,{block:[E.top,E.bottom],inline:[E.left,E.right],width:"fit-content",height:m,debugging:T,ssrMode:b,children:n})})})})),mn="stk_l-58l",gn="v_-k3qw",nt={stk:mn,v:gn},wt={x:"row",y:"column","-x":"row-reverse","-y":"column-reverse"},Et=e=>({"--bkkw":"auto","--bkkh":"auto","--bkkcl":e.line,"--bkkcf":e.flat,"--bkkci":e.text}),Ct=(e,n,o)=>({rowGap:o!==void 0?o:e,columnGap:o!==void 0?o:n}),hn=c.memo(function({align:n="flex-start",children:o,className:r,columnGap:s,debugging:a,direction:l="row",gap:i,height:u,indicatorNode:m,justify:p="flex-start",rowGap:b,style:M,variant:S,width:h,ssrMode:j=!1,...T}){const g=se("stack"),{isShown:V,debugging:N}=ie(a,g.debugging),[R,P]=c.useState(!1);c.useEffect(()=>{P(!0)},[]);const D=c.useRef(null),{top:k,right:O,bottom:I,left:E}=le({...T}),H=he(D,{base:g.base,snapping:"height",spacing:{top:k,right:O,bottom:I,left:E},warnOnMisalignment:N!=="none"}),W={padding:{top:k||0,right:O||0,bottom:I||0,left:E||0}},{padding:v}=re(R&&!j,W,H),z=c.useMemo(()=>{const J=b!==void 0?Number(b):void 0,_=s!==void 0?Number(s):void 0,Y=i!==void 0?Number(i):void 0;return Ct(J,_,Y)},[b,s,i]),B=c.useMemo(()=>Et(g.colors),[g.colors]),A=c.useMemo(()=>{const J=G(h||"auto"),_=G(u||"auto"),Y=wt[l]||l,L=["--bkkw","--bkkh"],Z={...x({key:"--bkkw",value:J,defaultStyles:B,skipDimensions:{auto:L}}),...x({key:"--bkkh",value:_,defaultStyles:B,skipDimensions:{auto:L}}),...x({key:"--bkkcl",value:g.colors.line,defaultStyles:B}),...x({key:"--bkkcf",value:g.colors.flat,defaultStyles:B}),...x({key:"--bkkci",value:g.colors.text,defaultStyles:B})};return oe({flexDirection:Y,justifyContent:p,alignItems:n,width:h,height:u},z,Z,M)},[l,p,n,h,u,g.colors.line,g.colors.flat,g.colors.text,B,z,M]),Q=N==="none"?{...A,paddingBlock:`${v.top}px ${v.bottom}px`,paddingInline:`${v.left}px ${v.right}px`}:A;return w.jsx(we,{spacer:{variant:S??"line"},children:w.jsx(Ee,{ref:D,className:V?nt.v:"",block:[v.top,v.bottom],inline:[v.left,v.right],debugging:N,indicatorNode:m,width:h,height:u,ssrMode:j,children:w.jsx("div",{"data-testid":"stack",className:ne(r,nt.stk),style:Q,...T,children:o})})})}),pn="gde_-Naxo",yn="line_-VS-e",kn="cols_8lD6D",vn="col_rlbsL",fe={gde:pn,line:yn,cols:kn,col:vn},Rt=e=>{const{variant:n,base:o,gap:r,columns:s,columnWidth:a}=e;return{line:{variant:"line",gap:r-1,base:o},auto:a?{variant:"auto",columnWidth:a,gap:r,base:o}:null,pattern:Array.isArray(s)?{variant:"pattern",columns:s,gap:r,base:o}:null,fixed:typeof s=="number"?{variant:"fixed",columns:s,columnWidth:a,gap:r,base:o}:null}[n]??{variant:"line",gap:r-1,base:o}},_t=(e,n)=>({"--bkgw":"auto","--bkgh":"auto","--bkgmw":"none","--bkgcw":"60px","--bkggw":"24px","--bkgc":"12","--bkgb":`${e}px`,"--bkgcl":n}),xn=c.memo(function({className:n,debugging:o,style:r,variant:s,align:a="start",gap:l,height:i,width:u,columns:m,columnWidth:p,gutterWidth:b,maxWidth:M,color:S,children:h,ssrMode:j=!1,...T}){const g=se("guide"),V=s??g.variant,N=typeof l=="number"?l:g.base,[R,P]=c.useState(!1);c.useEffect(()=>{P(!0)},[]);const D=c.useRef(null),k=ge(D),O=re(R&&!j,{width:1024,height:768,refresh:()=>{}},k),{width:I,height:E}=O,{isShown:H}=ie(o,g.debugging),W=c.useMemo(()=>Rt({variant:V,base:g.base,gap:N,columns:m,columnWidth:p}),[V,g.base,N,m,p]),{template:v,columnsCount:z,calculatedGap:B}=ut(D,W),A=c.useMemo(()=>_t(g.base,g.colors.line),[g.base,g.colors.line]),Q=c.useMemo(()=>{const J=G(u||I||"auto"),_=G(i||E||"auto"),Y=G(M||"none"),L=G(p||"60px"),Z=G(b||"24px"),q=["--bkgw","--bkgh"],X={...x({key:"--bkgw",value:J,defaultStyles:A,skipDimensions:{auto:q}}),...x({key:"--bkgh",value:_,defaultStyles:A,skipDimensions:{auto:q}}),...x({key:"--bkgmw",value:Y,defaultStyles:A}),...x({key:"--bkgcw",value:L,defaultStyles:A}),...x({key:"--bkggw",value:Z,defaultStyles:A}),...x({key:"--bkgc",value:`${z}`,defaultStyles:A}),...x({key:"--bkgb",value:`${g.base}px`,defaultStyles:A}),...x({key:"--bkgcl",value:S??g.colors.line,defaultStyles:A}),"--bkgg":`${B}px`,...v&&v!=="none"?{"--bkgt":v}:{},...v&&v!=="none"?{gridTemplateColumns:v}:{},...B?{gap:`${B}px`}:{},justifyContent:a};return oe(X,r)},[u,i,M,p,b,z,S,v,B,I,E,g.base,g.colors.line,A,r,a]);return w.jsxs("div",{ref:D,"data-testid":"guide",className:ne(fe.gde,n,H?fe.v:fe.h,V==="line"&&fe.line),"data-variant":V,style:Q,...T,children:[H&&w.jsx("div",{className:fe.cols,"data-variant":V,children:Array.from({length:z},(J,_)=>{const Y=g.colors[V]??g.colors.line;return w.jsx("div",{className:fe.col,"data-column-index":_,"data-variant":V,style:{backgroundColor:Y}},_)})}),h]})}),Sn=/^\d*\.?\d+(?:fr|px|%|em|rem|vh|vw|vmin|vmax|pt|pc|in|cm|mm)$/,jt=e=>typeof e=="number"?Number.isFinite(e)&&e>=0:typeof e!="string"?!1:e==="auto"||e==="100%"||Sn.test(e),Ot=e=>Array.isArray(e)&&e.length>0&&e.every(jt),wn=e=>{const n=[...Object.keys(ve),...Me];return typeof e=="number"||typeof e=="string"&&n.some(o=>e.endsWith(o))},En=e=>typeof e=="string"&&At.includes(e),De=e=>typeof e=="object"&&e!==null,Cn=e=>De(e)&&e.variant==="line",Rn=e=>De(e)&&"columns"in e&&!("variant"in e),_n=e=>De(e)&&"columnWidth"in e&&!("variant"in e)&&!("columns"in e),jn="bas_e-SXr",On="row_q-FZb",ke={bas:jn,row:On},Mt=(e,n,o)=>({"--bkbw":"100%","--bkbh":"100%","--bkbb":`${e}px`,"--bkbcl":n,"--bkbcf":o}),Tt=e=>{const{index:n,base:o,variant:r,chosenColor:s,lineColor:a,flatColor:l}=e;return{"--bkrt":n===0?"0px":`${n*o}px`,"--bkrh":r==="line"?"1px":`${o}px`,"--bkbc":s||(r==="line"?a:l)}},Mn=c.memo(function({className:n,debugging:o,style:r,variant:s,height:a,width:l,base:i,color:u,ssrMode:m=!1,...p}){const b=se("baseline"),M=s??b.variant,S=i??b.base,{isShown:h}=ie(o,b.debugging),j=c.useRef(null),[T,g]=c.useState(!1),V=ge(j);c.useEffect(()=>{g(!0)},[]);const N=re(T,it,V),{width:R,height:P}=N,[D,k]=c.useMemo(()=>Te([l,a],[R,P]),[l,a,R,P]),{top:O,right:I,bottom:E,left:H}=c.useMemo(()=>le(p),[p]),W=c.useMemo(()=>{const Z=[O,I,E,H].map(q=>q?`${q}px`:"0").join(" ");return Z!=="0 0 0 0"?Z:void 0},[O,I,E,H]),v=c.useMemo(()=>st({height:k,top:O,bottom:E,base:S}),[k,O,E,S]),z=ct({totalLines:v,lineHeight:S,containerRef:j,buffer:160}),B={start:0,end:Math.min(10,v)},{start:A,end:Q}=re(T&&!m,B,z),J=u||(M==="line"?b.colors.line:b.colors.flat),_=c.useMemo(()=>Mt(S,b.colors.line,b.colors.flat),[S,b.colors.line,b.colors.flat]),Y=c.useMemo(()=>{const Z=G(l||"100%"),q=G(a||"100%"),X=["--bkbw","--bkbh"];return oe({...x({key:"--bkbw",value:Z,defaultStyles:_,skipDimensions:{fullSize:X}}),...x({key:"--bkbh",value:q,defaultStyles:_,skipDimensions:{fullSize:X}}),...x({key:"--bkbb",value:`${S}px`,defaultStyles:_}),...x({key:"--bkbcl",value:u||b.colors.line,defaultStyles:_}),...x({key:"--bkbcf",value:u||b.colors.flat,defaultStyles:_}),...W&&{padding:W}},r)},[l,a,S,u,b.colors.line,b.colors.flat,W,_,r]),L=c.useCallback(Z=>Tt({index:Z,base:S,variant:M,chosenColor:J,lineColor:b.colors.line,flatColor:b.colors.flat}),[S,M,J,b.colors.line,b.colors.flat]);return w.jsx("div",{ref:j,"data-testid":"baseline",className:ne(ke.bas,h?ke.v:ke.h,n),style:Y,...p,children:h&&Array.from({length:Q-A},(Z,q)=>{const X=q+A;return w.jsx("div",{className:ke.row,"data-row-index":X,style:L(X)},X)})})}),At=["start","center","end"],Tn=["line","flat"];exports.ABSOLUTE_UNIT_CONVERSIONS=ve;exports.Baseline=Mn;exports.Box=bn;exports.Config=we;exports.DEFAULT_CONFIG=ft;exports.DIRECTION_AXIS=wt;exports.GRID_ALIGNMENTS=At;exports.Guide=xn;exports.Layout=un;exports.PADD_VARIANTS=Tn;exports.Padder=Ee;exports.RELATIVE_UNITS=Me;exports.SSR_DIMENSIONS=it;exports.Spacer=gt;exports.Stack=hn;exports.calculateRowCount=st;exports.calculateSnappedSpacing=at;exports.clamp=rt;exports.convertValue=Se;exports.createBaselineRowStyle=Tt;exports.createBoxCustomStyles=St;exports.createCSSVariables=tn;exports.createDefaultBaselineStyles=Mt;exports.createDefaultBoxStyles=xt;exports.createDefaultGuideStyles=_t;exports.createDefaultLayoutStyles=kt;exports.createDefaultSpacerStyles=bt;exports.createDefaultStackStyles=Et;exports.createDirectPaddingStyles=pt;exports.createGridConfig=Rt;exports.createGridGapStyles=vt;exports.createGridSpanStyles=lt;exports.createPadderContainerStyles=ht;exports.createRenderSpacerFn=yt;exports.createStackGapStyles=Ct;exports.createStyleOverride=x;exports.debounce=Ut;exports.formatValue=G;exports.generateMeasurements=mt;exports.getGridTemplate=Oe;exports.hydratedValue=re;exports.isAutoCalculatedGuide=_n;exports.isGuideAlignment=En;exports.isGuideColumnConfig=Rn;exports.isGuideLineConfig=Cn;exports.isGuideValue=wn;exports.isSSR=$e;exports.isValidGuideColumnValue=jt;exports.isValidGuidePattern=Ot;exports.mergeClasses=ne;exports.mergeConfig=dt;exports.mergeRefs=Ae;exports.mergeStyles=oe;exports.moduloize=Bt;exports.normalizeValue=xe;exports.normalizeValuePair=Te;exports.parsePadding=le;exports.parseUnit=ot;exports.rafThrottle=Ne;exports.round=Pt;exports.safeClientValue=Ft;exports.useBaseline=he;exports.useConfig=se;exports.useDebug=ie;exports.useDefaultConfig=Ge;exports.useGuide=ut;exports.useMeasure=ge;exports.useVirtual=ct;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),W=require("react");function ye(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const l=ye(W),ve={line:"var(--bk-guide-color-line-theme)",pattern:"var(--bk-guide-color-pattern-theme)",auto:"var(--bk-guide-color-auto-theme)",fixed:"var(--bk-guide-color-fixed-theme)"},xe={line:"var(--bk-baseline-color-line-theme)",flat:"var(--bk-baseline-color-flat-theme)"},we={line:"var(--bk-spacer-color-line-theme)",flat:"var(--bk-spacer-color-flat-theme)",text:"var(--bk-spacer-color-text-theme)"},Se={line:"var(--bk-box-color-line-theme)",flat:"var(--bk-box-color-flat-theme)",text:"var(--bk-box-color-text-theme)"},Ce={line:"var(--bk-stack-color-line-theme)",flat:"var(--bk-stack-color-flat-theme)",text:"var(--bk-stack-color-text-theme)"},Me={line:"var(--bk-layout-color-line-theme)",flat:"var(--bk-layout-color-flat-theme)",text:"var(--bk-layout-color-text-theme)"},Re="var(--bk-padder-color-theme)",je={base:8,baseline:{variant:"line",debugging:"hidden",colors:xe},guide:{variant:"line",debugging:"hidden",colors:ve},spacer:{variant:"line",debugging:"hidden",colors:we},box:{debugging:"hidden",colors:Se},stack:{debugging:"hidden",colors:Ce},layout:{debugging:"hidden",colors:Me},padder:{debugging:"hidden",color:Re}},se=l.createContext(je);se.displayName="ConfigContext";const fe=()=>l.use(se),$e=e=>{const{parentConfig:t,base:n,baseline:s,guide:o,spacer:r,box:i,stack:a,layout:c,padder:d}=e;return{base:n??t.base,baseline:{...t.baseline,...s},guide:{...t.guide,...o},spacer:{...t.spacer,...r},box:{...t.box,...i},stack:{...t.stack,...a},layout:{...t.layout,...c},padder:{...t.padder,...d}}};function P({children:e,base:t,stack:n,baseline:s,guide:o,layout:r,spacer:i,box:a,padder:c}){const d=fe(),b=l.useMemo(()=>$e({parentConfig:d,base:t,baseline:s,guide:o,spacer:i,box:a,stack:n,layout:r,padder:c}),[d,t,s,o,i,a,n,r,c]);return f.jsx(se,{value:b,children:e})}function Ee(e){const t=e.trim().match(/^([+-]?[\d.]+)([a-zA-Z%]+)$/);if(!t)return null;const n=parseFloat(t[1]),s=t[2];return{value:n,unit:s}}function O(e,t){return e===void 0&&t!==void 0?`${t}px`:e==="auto"||typeof e=="string"&&/^(auto|100%|0|.*(fr|vh|vw|vmin|vmax|rem))$/.test(e)?String(e):typeof e=="number"?`${e}px`:e??""}const Ve={parentSize:0,viewportWidth:typeof window<"u"?window.innerWidth:1920,viewportHeight:typeof window<"u"?window.innerHeight:1080,rootFontSize:16,parentFontSize:16},ie={px:1,in:96,cm:37.8,mm:3.78,pt:1.33,pc:16},Oe=["em","rem","vh","vw","vmin","vmax","%"];function be(e,t){if(typeof e=="number")return e;if(typeof e!="string")return null;const n=Ee(e);if(!n)return null;const{value:s,unit:o}=n;if(o in ie)return s*ie[o];if(o==="auto")return null;if(Oe.includes(o)){const r={...Ve,...t};switch(o){case"em":return s*r.parentFontSize;case"rem":return s*r.rootFontSize;case"vh":return s/100*r.viewportHeight;case"vw":return s/100*r.viewportWidth;case"vmin":return s/100*Math.min(r.viewportWidth,r.viewportHeight);case"vmax":return s/100*Math.max(r.viewportWidth,r.viewportHeight);case"%":return s/100*r.parentSize;default:return null}}return null}function Ge(e,t,n){return Math.min(Math.max(e,t),n)}function _e(e){const{height:t,top:n,bottom:s,base:o}=e,r=(t??0)-(n+s);return Math.max(1,Math.floor(r/o))}function oe(e,t={}){const{base:n=8,round:s=!0,clamp:o,suppressWarnings:r=!1}=t;if(e==="auto")return n;let i=null;if(typeof e=="number")i=e;else if(typeof e=="string"){const d=be(e);d===null?(r||console.error(`Failed to convert "${e}" to pixels. Falling back to base ${n}.`),i=n):i=d}i===null&&(i=n);const a=s?Math.round(i/n)*n:i,c=o!==void 0?Ge(a,o.min??-1/0,o.max??1/0):a;return!r&&c!==i&&console.warn(`Normalized ${i} to ${c} to match base ${n}px.`),c}function me(e,t,n){if(!e||e[0]===void 0&&e[1]===void 0)return t;const s=e[0]!==void 0?oe(e[0],n):t[0],o=e[1]!==void 0?oe(e[1],n):t[1];return[s,o]}function Z(e){if("padding"in e&&e.padding!=null)return De(e.padding);const t="block"in e&&e.block!=null?Ae(e.block):{top:0,bottom:0},n="inline"in e&&e.inline!=null?Le(e.inline):{left:0,right:0};return{top:t.top,right:n.right,bottom:t.bottom,left:n.left}}function De(e){if(typeof e=="number")return{top:e,right:e,bottom:e,left:e};if(Array.isArray(e)){if(e.length===2){const[t,n]=e;return{top:t,right:n,bottom:t,left:n}}if(e.length>=4){const[t,n,s,o]=e;return{top:t??0,right:n??0,bottom:s??0,left:o??0}}}if(typeof e=="object"&&!Array.isArray(e)){const t=e.top??0,n=e.bottom??0,s=e.left??0,o=e.right??0;return{top:t,right:o,bottom:n,left:s}}return{top:0,right:0,bottom:0,left:0}}function Ae(e){if(typeof e=="number")return{top:e,bottom:e};if(Array.isArray(e)){const[t,n]=e;return{top:t??0,bottom:n??0}}return typeof e=="object"?{top:e.start??0,bottom:e.end??0}:{top:0,bottom:0}}function Le(e){if(typeof e=="number")return{left:e,right:e};if(Array.isArray(e)){const[t,n]=e;return{left:t??0,right:n??0}}return typeof e=="object"?{left:e.start??0,right:e.end??0}:{left:0,right:0}}function Ie(e,t,n,s){const o=Z({padding:n});if(s==="none")return o;if(s==="height"){const r=e%t;r!==0&&(o.bottom+=t-r)}if(s==="clamp"){o.top=o.top%t;const r=e%t;r!==0&&(o.bottom+=t-r),o.bottom=o.bottom%t}return o}const Ne=(e,t,n)=>{const s={};return e!==void 0?(s.gridColumn=`span ${e}`,s.gridRow=`span ${e}`):(t!==void 0&&(s.gridColumn=`span ${t}`),n!==void 0&&(s.gridRow=`span ${n}`)),s},z=(...e)=>e.filter(Boolean).join(" ").trim(),X=(...e)=>Object.assign({},...e.filter(t=>t!==void 0));function Be(e,t){if(e)if(typeof e=="function")e(t);else try{Object.assign(e,{current:t})}catch(n){console.error("Error assigning ref:",n)}}function ge(...e){return t=>{e.forEach(n=>{Be(n,t)})}}function y(e,t,n){var a,c,d;const s=typeof e=="string"?e:e.key,o=typeof e=="string"?t:e.value,r=typeof e=="string"?n:e.defaultStyles,i=typeof e=="object"?e.skipDimensions:void 0;if(i){if((a=i.fitContent)!=null&&a.includes(s)&&o==="fit-content")return{};if((c=i.auto)!=null&&c.includes(s)&&o==="auto")return{};if((d=i.fullSize)!=null&&d.includes(s)&&(o==="100%"||o==="100vh"||o==="100vw"))return{}}return o!==r[s]?{[s]:o}:{}}const he=e=>{let t=null,n=null;return(...o)=>{n=o,t!==null&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{e(...n),t=null,n=null})}};function We(){const[e,t]=W.useState(!1);return W.useEffect(()=>{t(!0)},[]),e}const re=typeof window>"u";function ze(e,t){if(re)return t;try{return e()}catch{return t}}function K(e,t,n){return!e||re?t:n}function pe({children:e,fallback:t=null}){return We()?f.jsx(f.Fragment,{children:e}):f.jsx(f.Fragment,{children:t})}function J(e){const[t,n]=l.useState({width:0,height:0}),s=l.useCallback(()=>{if(e.current)try{const r=e.current.getBoundingClientRect(),i={width:r?Math.round(r.width):0,height:r?Math.round(r.height):0};n(a=>a.width===i.width&&a.height===i.height?a:i)}catch{n({width:0,height:0})}},[e]),o=l.useMemo(()=>he(s),[s]);return l.useLayoutEffect(()=>{typeof window>"u"||s()},[s]),l.useLayoutEffect(()=>{if(typeof window>"u"||!e.current)return;const r=new ResizeObserver(()=>{o()});return r.observe(e.current),()=>{r.disconnect()}},[e,o]),{...t,refresh:o}}function Fe({totalLines:e,lineHeight:t,containerRef:n,buffer:s=0}){const o=W.useMemo(()=>typeof s=="number"?s:parseInt(s,10)||0,[s]),r=W.useCallback(()=>{const b=n.current;if(!b)return{start:0,end:e};if(b.closest(".block"))return{start:0,end:e};const M=b.getBoundingClientRect().top+window.scrollY,v=Math.max(0,window.scrollY-M-o),m=v+window.innerHeight+o*2,w=Math.max(0,Math.floor(v/t)),p=Math.min(e,Math.ceil(m/t));return{start:w,end:p}},[e,t,n,o]),[i,a]=W.useState(r);He(["scroll","resize"],()=>{d()});const c=W.useCallback(()=>{a(b=>{const u=r();return b.start!==u.start||b.end!==u.end?u:b})},[r]),d=W.useMemo(()=>he(c),[c]);return W.useLayoutEffect(()=>{const b=n.current;if(!b)return;const u=new IntersectionObserver(d,{threshold:0});return u.observe(b),d(),()=>{u.disconnect()}},[n,r,d]),i}function He(e,t){const n=W.useCallback(t,[t]);W.useLayoutEffect(()=>{const s=()=>n();return e.forEach(o=>window.addEventListener(o,s)),()=>e.forEach(o=>window.removeEventListener(o,s))},[e,n])}function Q(e,{base:t=8,snapping:n="none",spacing:s={},warnOnMisalignment:o=!1}={}){if(t<1)throw new Error("Base must be >= 1 for baseline alignment.");const{height:r}=J(e),i=l.useRef(!1),a=l.useRef(!1);return l.useMemo(()=>{const c=Z({padding:s}),d=r%t===0;if(!d&&o&&process.env.NODE_ENV==="development"&&(a.current||(console.warn(`[useBaseline] Element height (${r}px) is not aligned with base (${t}px).`),a.current=!0)),n==="none")return{padding:c,isAligned:d,height:r};if(i.current)return{padding:c,isAligned:d,height:r};const b=Ie(r,t,c,n);return i.current=!0,{padding:b,isAligned:d,height:r}},[t,n,s,o,r])}const Te="spr_zbcF6",Ue="line_qHW69",qe="flat_gqixr",ae={spr:Te,line:Ue,flat:qe},Xe=(e,t,n,s)=>({"--bksw":"100%","--bksh":"100%","--bksb":`${e}px`,"--bksct":t,"--bkscf":n,"--bkscl":s}),Ye=(e,t,n,s)=>{if(!e||!t)return null;const o=typeof n=="number"?n:0,r=typeof s=="number"?s:0;return f.jsxs(f.Fragment,{children:[r!==0&&f.jsx("span",{children:t(r,"height")},"height"),o!==0&&f.jsx("span",{children:t(o,"width")},"width")]})},ke=l.memo(function({height:t,width:n,indicatorNode:s,debugging:o,variant:r,base:i,color:a,className:c,style:d,children:b,ssrMode:u=!1,...M}){const v=l.useRef(null),m=H("spacer"),{isShown:w}=U(o,m.debugging),p=r??m.variant,h=i??m.base,[G,S]=l.useState(!1);l.useEffect(()=>{S(!0)},[]);const[x,R]=l.useMemo(()=>me([n,t],[0,0],{base:h,suppressWarnings:!0}),[n,t,h]),A=K(G&&!u,!1,w&&s!==void 0),g=l.useMemo(()=>A?Ye(w,s,x,R):null,[A,w,s,x,R]),V=l.useMemo(()=>Xe(h,m.colors.text,m.colors.flat,m.colors.line),[h,m.colors]),D=l.useMemo(()=>{const k=O(R||"100%"),N=O(x||"100%"),_=`${h}px`,E=["--bksw","--bksh"],L={...y({key:"--bksh",value:k,defaultStyles:V,skipDimensions:{fullSize:E}}),...y({key:"--bksw",value:N,defaultStyles:V,skipDimensions:{fullSize:E}}),"--bksb":_,...y({key:"--bksct",value:a??m.colors.text,defaultStyles:V}),...y({key:"--bkscl",value:a??m.colors.line,defaultStyles:V}),...y({key:"--bkscf",value:a??m.colors.flat,defaultStyles:V})};return X(L,d)},[x,R,a,h,m.colors,V,d]);return f.jsxs("div",{ref:v,"data-testid":"spacer",className:z(ae.spr,w&&ae[p],c),"data-variant":p,"data-height":typeof R=="number"?`${R}px`:R,style:D,...M,children:[g,b]})}),Ze="pad_w2-sL",Ke="v_lhGBy",ne={pad:Ze,v:Ke},Pe=(e,t,n,s)=>{const o={};return e!=="fit-content"&&(o["--bkpw"]=O(e||"fit-content")),t!=="fit-content"&&(o["--bkph"]=O(t||"fit-content")),o["--bkpb"]=`${n}px`,o["--bkpc"]=s,o},Je=(e,t)=>{const{top:n,right:s,bottom:o,left:r}=t,i={};return e||((n>0||o>0)&&(i.paddingBlock=`${n}px ${o}px`),(r>0||s>0)&&(i.paddingInline=`${r}px ${s}px`)),i},Qe=(e,t,n)=>{const s=e||"line",o=t||"none",r=(i,a)=>f.jsx(ke,{variant:s,debugging:a===0||i===0?"none":o,indicatorNode:n,height:a!=="100%"?a:void 0,width:i!=="100%"?i:void 0});return r.displayName="PadderSpacer",r},ee=l.memo(l.forwardRef(function({children:t,className:n,debugging:s,height:o,indicatorNode:r,style:i,width:a,ssrMode:c=!1,...d},b){const u=H("padder"),{variant:M}=H("spacer"),v=l.useMemo(()=>Z(d),[d]),{isShown:m,isNone:w,debugging:p}=U(s,u.debugging),h=!w,[G,S]=l.useState(!1);l.useEffect(()=>{S(!0)},[]);const x=l.useRef(null),R=Q(x,{base:u.base,snapping:"height",spacing:v,warnOnMisalignment:!w}),A={padding:{top:v.top||0,right:v.right||0,bottom:v.bottom||0,left:v.left||0}},{padding:g}=K(G&&!c,A,R),V=ge(b,x),D=l.useMemo(()=>{const N=Pe(a,o,u.base,u.color),_=Je(h,{top:g.top,right:g.right,bottom:g.bottom,left:g.left});return X({...N,..._},i)},[a,o,u.base,u.color,h,g.top,g.right,g.bottom,g.left,i]),k=l.useMemo(()=>Qe(M,p,r),[M,p,r]);return h?f.jsxs("div",{ref:V,"data-testid":"padder",className:z(ne.pad,m&&ne.v,n),style:D,children:[f.jsxs(f.Fragment,{children:[g.top>=0&&f.jsx("div",{style:{gridColumn:"1 / -1"},children:k("100%",g.top)}),g.left>=0&&f.jsx("div",{style:{gridRow:"2 / 3"},children:k(g.left,"100%")})]}),f.jsx("div",{style:{gridRow:"2 / 3",gridColumn:"2 / 3"},children:t}),f.jsxs(f.Fragment,{children:[g.right>=0&&f.jsx("div",{style:{gridRow:"2 / 3"},children:k(g.right,"100%")}),g.bottom>=0&&f.jsx("div",{style:{gridColumn:"1 / -1"},children:k("100%",g.bottom)})]})]}):f.jsx("div",{ref:V,"data-testid":"padder",className:z(ne.pad,n),style:D,children:t})})),et="lay_5cMu5",tt="v_dprVE",le={lay:et,v:tt},nt=e=>({"--bklw":"auto","--bklh":"auto","--bklcl":e.line,"--bklcf":e.flat,"--bklci":e.text}),ce=e=>typeof e=="number"?`repeat(${e}, 1fr)`:typeof e=="string"?e:Array.isArray(e)?e.map(t=>typeof t=="number"?`${t}px`:t).join(" "):"repeat(auto-fill, minmax(100px, 1fr))",ot=(e,t,n)=>{const s={};return e!==void 0&&(s.gap=O(e)),t!==void 0&&(s.rowGap=O(t)),n!==void 0&&(s.columnGap=O(n)),s},st=l.memo(function({alignContent:t,alignItems:n,children:s,className:o,columns:r="repeat(auto-fill, minmax(100px, 1fr))",columnGap:i,debugging:a,gap:c,height:d,indicatorNode:b,justifyContent:u,justifyItems:M,rowGap:v,rows:m,style:w,variant:p,width:h,ssrMode:G=!1,...S}){const x=H("layout"),{isShown:R,debugging:A}=U(a,x.debugging),[g,V]=l.useState(!1);l.useEffect(()=>{V(!0)},[]);const D=l.useRef(null),k=l.useMemo(()=>Z(S),[S]),N=Q(D,{base:x.base,snapping:"height",spacing:k,warnOnMisalignment:!0}),_={padding:{top:k.top||0,right:k.right||0,bottom:k.bottom||0,left:k.left||0}},{padding:E}=K(g&&!G,_,N),L=l.useMemo(()=>ce(r),[r]),C=l.useMemo(()=>m?ce(m):"auto",[m]),$=l.useMemo(()=>nt(x.colors),[x.colors]),j=l.useMemo(()=>ot(c,v,i),[c,v,i]),I=l.useMemo(()=>{const B=O(h||"auto"),Y=O(d||"auto"),q=["--bklw","--bklh"];return X({...y({key:"--bklw",value:B,defaultStyles:$,skipDimensions:{auto:q}}),...y({key:"--bklh",value:Y,defaultStyles:$,skipDimensions:{auto:q}}),...y({key:"--bklcl",value:x.colors.line,defaultStyles:$}),...y({key:"--bklcf",value:x.colors.flat,defaultStyles:$}),...y({key:"--bklci",value:x.colors.text,defaultStyles:$}),...L!=="repeat(auto-fill, minmax(100px, 1fr))"&&{"--bklgtc":L},...C!=="auto"&&{"--bklgtr":C},...M&&{"--bklji":M},...n&&{"--bklai":n},...u&&{"--bkljc":u},...t&&{"--bklac":t},...j},w)},[L,C,M,n,u,t,h,d,x.colors,$,w,j]);return f.jsx(P,{spacer:{variant:p??"line"},children:f.jsx(ee,{ref:D,className:R?le.v:"",block:[E.top,E.bottom],...b?{indicatorNode:b}:{},inline:[E.left,E.right],debugging:A,width:h,height:d,ssrMode:G,children:f.jsx("div",{"data-testid":"layout",className:z(o,le.lay),style:I,...S&&Object.keys(S).length>0?Object.fromEntries(Object.entries(S).filter(([B])=>B!=="ssrMode")):{},children:s})})})}),rt="box_rDCRX",it="v_0MMHD",ue={box:rt,v:it},at=(e,t)=>({"--bkboxw":"auto","--bkboxh":"auto","--bkboxc":t,"--bkboxb":`${e}px`}),lt=({width:e,height:t,base:n,lineColor:s,defaultStyles:o})=>{const r=O(e||"fit-content"),i=O(t||"fit-content"),a=["--bkboxw","--bkboxh"];return{...y({key:"--bkboxw",value:r,defaultStyles:o,skipDimensions:{fitContent:a}}),...y({key:"--bkboxh",value:i,defaultStyles:o,skipDimensions:{fitContent:a}}),...y({key:"--bkboxb",value:`${n}px`,defaultStyles:o}),...y({key:"--bkboxc",value:s,defaultStyles:o})}},ct=l.memo(l.forwardRef(function({children:t,snapping:n="clamp",debugging:s,className:o,colSpan:r,rowSpan:i,span:a,width:c,height:d,style:b,ssrMode:u=!1,...M},v){const m=H("box"),{isShown:w,debugging:p}=U(s,m.debugging),[h,G]=l.useState(!1);l.useEffect(()=>{G(!0)},[]);const S=l.useRef(null),{top:x,bottom:R,left:A,right:g}=Z(M),V=Q(S,{base:m.base,snapping:n,spacing:{top:x,bottom:R,left:A,right:g},warnOnMisalignment:p!=="none"}),D={padding:{top:x||0,right:g||0,bottom:R||0,left:A||0}},{padding:k}=K(h&&!u,D,V),N=l.useMemo(()=>Ne(a,r,i),[r,i,a]),_=l.useMemo(()=>at(m.base,m.colors.line),[m.base,m.colors.line]),E=l.useMemo(()=>{const L=lt({width:c,height:d,base:m.base,lineColor:m.colors.line,defaultStyles:_});return X(L,b)},[m.base,m.colors.line,c,d,_,b]);return f.jsx("div",{ref:ge(v,S),"data-testid":"box",className:z(ue.box,w&&ue.v,o),style:X(E,N),children:f.jsx(P,{base:1,spacer:{variant:"flat"},children:f.jsx(ee,{block:[k.top,k.bottom],inline:[k.left,k.right],width:"fit-content",height:d,debugging:p,ssrMode:u,children:t})})})})),ut="stk_l-58l",dt="v_-k3qw",de={stk:ut,v:dt},ft={x:"row",y:"column","-x":"row-reverse","-y":"column-reverse"},bt=e=>({"--bkkw":"auto","--bkkh":"auto","--bkkcl":e.line,"--bkkcf":e.flat,"--bkkci":e.text}),mt=(e,t,n)=>({rowGap:n!==void 0?n:e,columnGap:n!==void 0?n:t}),gt=l.memo(function({align:t="flex-start",children:n,className:s,columnGap:o,debugging:r,direction:i="row",gap:a,height:c,indicatorNode:d,justify:b="flex-start",rowGap:u,style:M,variant:v,width:m,ssrMode:w=!1,...p}){const h=H("stack"),{isShown:G,debugging:S}=U(r,h.debugging),[x,R]=l.useState(!1);l.useEffect(()=>{R(!0)},[]);const A=l.useRef(null),{top:g,right:V,bottom:D,left:k}=Z({...p}),N=Q(A,{base:h.base,snapping:"height",spacing:{top:g,right:V,bottom:D,left:k},warnOnMisalignment:S!=="none"}),_={padding:{top:g||0,right:V||0,bottom:D||0,left:k||0}},{padding:E}=K(x&&!w,_,N),L=l.useMemo(()=>{const I=u!==void 0?Number(u):void 0,B=o!==void 0?Number(o):void 0,Y=a!==void 0?Number(a):void 0;return mt(I,B,Y)},[u,o,a]),C=l.useMemo(()=>bt(h.colors),[h.colors]),$=l.useMemo(()=>{const I=O(m||"auto"),B=O(c||"auto"),Y=ft[i]||i,q=["--bkkw","--bkkh"],te={...y({key:"--bkkw",value:I,defaultStyles:C,skipDimensions:{auto:q}}),...y({key:"--bkkh",value:B,defaultStyles:C,skipDimensions:{auto:q}}),...y({key:"--bkkcl",value:h.colors.line,defaultStyles:C}),...y({key:"--bkkcf",value:h.colors.flat,defaultStyles:C}),...y({key:"--bkkci",value:h.colors.text,defaultStyles:C})};return X({flexDirection:Y,justifyContent:b,alignItems:t,width:m,height:c},L,te,M)},[i,b,t,m,c,h.colors.line,h.colors.flat,h.colors.text,C,L,M]),j=S==="none"?{...$,paddingBlock:`${E.top}px ${E.bottom}px`,paddingInline:`${E.left}px ${E.right}px`}:$;return f.jsx(P,{spacer:{variant:v??"line"},children:f.jsx(ee,{ref:A,block:[E.top,E.bottom],inline:[E.left,E.right],debugging:S,indicatorNode:d,width:m,height:c,ssrMode:w,children:f.jsx("div",{"data-testid":"stack",className:z(s,de.stk,G&&de.v),style:j,...p,children:n})})})}),ht="gde_-Naxo",pt="line_-VS-e",kt="cols_8lD6D",yt="col_rlbsL",vt="ssr_VGvpO",F={gde:ht,line:pt,cols:kt,col:yt,ssr:vt},xt=e=>{const{variant:t,base:n,gap:s,columns:o,columnWidth:r}=e;switch(t){case"line":return{variant:"line",gap:s,base:n};case"pattern":if(o&&Array.isArray(o))return{variant:"pattern",columns:o,gap:s,base:n};break;case"fixed":if(o!==void 0){const i=typeof o=="number"?o:parseInt(String(o),10);return{variant:"fixed",columns:isNaN(i)?12:i,columnWidth:r||"60px",gap:s,base:n}}break}return{variant:"auto",columnWidth:r||"1fr",gap:s,base:n}},wt=(e,t)=>({"--bkgw":"auto","--bkgh":"auto","--bkgmw":"none","--bkgcw":"60px","--bkggw":"24px","--bkgc":"12","--bkgb":`${e}px`,"--bkgcl":t,"--bkgg":"0"}),St=l.memo(function({className:t,debugging:n,style:s,variant:o,align:r="center",gap:i,height:a,width:c,columns:d,columnWidth:b,maxWidth:u,color:M,children:v,ssrMode:m=!1,...w}){const p=H("guide"),h=o??p.variant,G=typeof i=="number"?i:0,{isShown:S}=U(n,p.debugging);if(!S)return f.jsx("div",{className:z(F.g,F.h,t),style:s,"data-testid":"guide","data-variant":h,...w,children:v});const x=f.jsx("div",{className:z(F.g,F.h,F.ssr,t),style:{width:c||"100%",height:a||"100%",maxWidth:u||"none",...s},"data-testid":"guide","data-variant":h,children:v});return f.jsx(pe,{fallback:x,children:f.jsx(Ct,{className:t,debugging:n,style:s,variant:h,align:r,gap:G,height:a,width:c,columns:d,columnWidth:b,maxWidth:u,color:M,ssrMode:m,...w,children:v})})}),Ct=l.memo(function({className:t,debugging:n,style:s,variant:o,align:r="center",gap:i,height:a,width:c,columns:d,columnWidth:b,maxWidth:u,color:M,children:v,ssrMode:m=!1,...w}){const p=H("guide"),{isShown:h}=U(n,p.debugging),G=l.useRef(null),{width:S,height:x,refresh:R}=J(G);l.useEffect(()=>{const j=()=>{R()};return window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j)}},[R]);const A=l.useMemo(()=>{const j=o,I=typeof i=="number"?i:0;return xt({variant:j,base:p.base,gap:I,columns:d,columnWidth:b})},[o,p.base,i,d,b]),{template:g,columnsCount:V,calculatedGap:D}=$t(G,A),k=l.useMemo(()=>wt(p.base,p.colors.line),[p.base,p.colors.line]),N=l.useMemo(()=>{const j=O(c||S||"auto"),I=O(a||x||"auto"),B=O(u||"none"),Y=O(b||"60px"),q=["--bkgw","--bkgh"],te={...y({key:"--bkgw",value:j,defaultStyles:k,skipDimensions:{auto:q}}),...y({key:"--bkgh",value:I,defaultStyles:k,skipDimensions:{auto:q}}),...y({key:"--bkgmw",value:B,defaultStyles:k}),...y({key:"--bkgcw",value:Y,defaultStyles:k}),...y({key:"--bkgc",value:`${V}`,defaultStyles:k}),...y({key:"--bkgb",value:"0",defaultStyles:k}),...y({key:"--bkgcl",value:M??p.colors.line,defaultStyles:k}),...y({key:"--bkgg",value:`${D}px`,defaultStyles:k}),...y({key:"--bkgj",value:r||"center",defaultStyles:k}),...g&&g!=="none"?{"--bkgt":g}:{},...g&&g!=="none"?{gridTemplateColumns:g}:{}};return X(te,s)},[c,a,u,b,V,M,g,D,S,x,p.colors.line,k,s,r]),_=()=>{const j=typeof i=="number"?i:0,I=j===0?0:j-1,B=I+1;return{finalGap:I,actualGapWithLine:B}},{finalGap:E,actualGapWithLine:L}=_(),C=typeof c=="number"?c:S||1024;let $;return E===0?$=Math.floor(C)+1:o==="line"?$=Math.max(1,Math.floor((C+1)/L)+1):$=Math.max(1,Math.floor(C/L)+1),f.jsxs("div",{ref:G,"data-testid":"guide",className:z(F.gde,t,h?F.v:F.h,o==="line"&&F.line),"data-variant":o,style:N,...w,children:[h&&f.jsx("div",{className:F.cols,"data-variant":o,children:Array.from({length:$},(j,I)=>{const B=p.colors[o]??p.colors.line;return f.jsx("div",{className:F.col,"data-column-index":I,"data-variant":o,style:{backgroundColor:B}},I)})}),v]})}),Mt=/^\d*\.?\d+(?:fr|px|%|em|rem|vh|vw|vmin|vmax|pt|pc|in|cm|mm)$/,Rt=e=>typeof e=="number"?Number.isFinite(e)&&e>=0:typeof e!="string"?!1:e==="auto"||e==="100%"||Mt.test(e),jt=e=>Array.isArray(e)&&e.length>0&&e.every(Rt);function $t(e,t){const{width:n}=J(e),s=l.useRef(!1);return l.useMemo(()=>{const o=t.variant??"line",r=t.base??8,i=oe(t.gap??0,{base:r});if(!n)return{template:"none",columnsCount:0,calculatedGap:0,isValid:!1};try{switch(o){case"line":{const a=i===0?0:i-1,c=a+1;let d;return a===0?d=Math.max(1,Math.floor(n)+1):d=Math.max(1,Math.floor((n+1)/c)+1),{template:`repeat(${d}, 1px)`,columnsCount:d,calculatedGap:i>0?i-1:i,isValid:!0}}case"pattern":{if(!t.columns||!Array.isArray(t.columns))throw new Error("Missing or invalid pattern columns");if(!jt(t.columns))throw new Error('Invalid "pattern" columns array');const a=t.columns.map(c=>typeof c=="number"?`${c}px`:c);return a.some(c=>c==="0"||c==="0px")?{template:"none",columnsCount:0,calculatedGap:0,isValid:!1}:{template:a.join(" "),columnsCount:a.length,calculatedGap:i,isValid:!0}}case"fixed":{const a=typeof t.columns=="number"?t.columns:0;if(a<1)throw new Error(`Invalid columns count: ${a}`);const c=t.columnWidth?O(t.columnWidth):"1fr";return{template:`repeat(${a}, ${c})`,columnsCount:a,calculatedGap:i,isValid:!0}}case"auto":{const a=t.columnWidth??"auto";if(a==="auto")return{template:"repeat(auto-fill, minmax(0, 1fr))",columnsCount:1,calculatedGap:i,isValid:!0};const c=typeof a=="number"?`${a}px`:a.toString(),d=be(c)??0,b=d>0?Math.max(1,Math.floor((n+i)/(d+i))):1;return{template:`repeat(auto-fill, ${c})`,columnsCount:b,calculatedGap:i,isValid:!0}}default:{s.current||(console.warn(`[useGuide] Unknown variant "${o}". Falling back to "line".`),s.current=!0);const a=Math.max(1,Math.floor(n/(i+1))+1);return{template:`repeat(${a}, 1px)`,columnsCount:a,calculatedGap:i,isValid:!0}}}}catch(a){return console.warn("Error in useGuide:",a),{template:"none",columnsCount:0,calculatedGap:0,isValid:!1}}},[t,n])}function H(e){const t=fe();return W.useMemo(()=>Object.assign({base:t.base},t[e]),[t,e])}function U(e,t){return W.useMemo(()=>{const n=e??t;return{isShown:n==="visible",isHidden:n==="hidden",isNone:n==="none",debugging:n}},[e,t])}const Et="bas_e-SXr",Vt="row_q-FZb",Ot="ssr_W1N5g",T={bas:Et,row:Vt,ssr:Ot},Gt=(e,t,n)=>({"--bkbw":"100%","--bkbh":"100%","--bkbb":`${e}px`,"--bkbcl":t,"--bkbcf":n}),_t=e=>{const{index:t,base:n,variant:s,chosenColor:o,lineColor:r,flatColor:i}=e;return{"--bkrt":t===0?"0px":`${t*n}px`,"--bkrh":s==="line"?"1px":`${n}px`,"--bkbc":o||(s==="line"?r:i)}},Dt=l.memo(function({className:t,debugging:n,style:s,variant:o,height:r,width:i,base:a,color:c,ssrMode:d=!1,...b}){const u=H("baseline"),{isShown:M}=U(n,u.debugging),v=l.useRef(null),{width:m,height:w,refresh:p}=J(v);l.useEffect(()=>{const C=()=>{p()};return window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C)}},[p]);const[h,G]=l.useMemo(()=>me([i,r],[m,w]),[i,r,m,w]),{top:S,right:x,bottom:R,left:A}=l.useMemo(()=>Z(b),[b]),g=l.useMemo(()=>{const C=[S,x,R,A].map($=>$?`${$}px`:"0").join(" ");return C!=="0 0 0 0"?C:void 0},[S,x,R,A]),V=l.useMemo(()=>{const C=a||u.base;return _e({height:G,top:S,bottom:R,base:C})},[G,S,R,a,u.base]),{start:D,end:k}=Fe({totalLines:V,lineHeight:a||u.base,containerRef:v,buffer:160}),N=c||(o==="line"?u.colors.line:u.colors.flat),_=l.useMemo(()=>Gt(a||u.base,u.colors.line,u.colors.flat),[a,u.colors.line,u.colors.flat,u.base]),E=l.useMemo(()=>{const C=O(i||"100%"),$=O(r||"100%"),j=["--bkbw","--bkbh"];return X({...y({key:"--bkbw",value:C,defaultStyles:_,skipDimensions:{fullSize:j}}),...y({key:"--bkbh",value:$,defaultStyles:_,skipDimensions:{fullSize:j}}),...y({key:"--bkbb",value:`${a}px`,defaultStyles:_}),...y({key:"--bkbcl",value:c||u.colors.line,defaultStyles:_}),...y({key:"--bkbcf",value:c||u.colors.flat,defaultStyles:_}),...g&&{padding:g}},s)},[i,r,a,c,u.colors.line,u.colors.flat,g,_,s]),L=l.useCallback(C=>{const $=o,j=a||u.base;return _t({index:C,base:j,variant:$,chosenColor:N,lineColor:u.colors.line,flatColor:u.colors.flat})},[a,o,N,u.colors.line,u.colors.flat,u.base]);return f.jsx("div",{ref:v,"data-testid":"baseline",className:z(T.bas,M?T.v:T.h,t),style:E,...b,children:M&&Array.from({length:k-D},(C,$)=>{const j=$+D;return f.jsx("div",{className:T.row,"data-row-index":j,style:L(j)},j)})})}),At=l.memo(function({className:t,debugging:n,style:s,variant:o,height:r,width:i,base:a,color:c,ssrMode:d=!1,...b}){const u=H("baseline"),M=o??u.variant,v=a??u.base,{isShown:m}=U(n,u.debugging);if(!m)return f.jsx("div",{className:z(T.b,T.h,t),style:s,"data-testid":"baseline",...b});const w=f.jsx("div",{className:z(T.b,T.h,T.ssr,t),style:{width:i||"100%",height:r||"100%",...s},"data-testid":"baseline"});return f.jsx(pe,{fallback:w,children:f.jsx(Dt,{className:t,debugging:n,style:s,variant:M,height:r,width:i,base:v,color:c,ssrMode:d,...b})})});exports.Baseline=At;exports.Box=ct;exports.Config=P;exports.Guide=St;exports.Layout=st;exports.Padder=ee;exports.Spacer=ke;exports.Stack=gt;exports.isSSR=re;exports.safeClientValue=ze;
32
2
  //# sourceMappingURL=index.cjs.map