import { t as e } from "../chunks/ui.module-BisoTevy.js";
import { c as t, f as n, i as r, l as i, p as a, t as o } from "../chunks/picker-e6IsrMUG.js";
import { useRef as s, useState as c } from "react";
import { cn as l } from "@ryuzaki13/react-foundation-lib/utils";
import { CheckIcon as u } from "lucide-react";
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
//#region src/layout-picker/lib/layout.ts
function m(e, t) {
	return {
		gridTemplateColumns: `repeat(${e.columns}, minmax(0, 1fr))`,
		gridTemplateRows: `repeat(${e.rows}, minmax(${t ?? 0}em, 1fr))`
	};
}
function h(e) {
	return {
		gridColumn: `${e.column} / span ${e.columnSpan ?? 1}`,
		gridRow: `${e.row} / span ${e.rowSpan ?? 1}`
	};
}
//#endregion
//#region src/layout-picker/lib/presets.ts
var g = [
	{
		id: "1x1",
		label: "1x1",
		columns: 1,
		rows: 1,
		cells: [{
			id: "c11",
			row: 1,
			column: 1
		}]
	},
	{
		id: "1x2",
		label: "1x2",
		columns: 2,
		rows: 1,
		cells: [{
			id: "c11",
			row: 1,
			column: 1
		}, {
			id: "c12",
			row: 1,
			column: 2
		}]
	},
	{
		id: "1x3",
		label: "1x3",
		columns: 3,
		rows: 1,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c12",
				row: 1,
				column: 2
			},
			{
				id: "c13",
				row: 1,
				column: 3
			}
		]
	},
	{
		id: "2x1",
		label: "2x1",
		columns: 1,
		rows: 2,
		cells: [{
			id: "c11",
			row: 1,
			column: 1
		}, {
			id: "c21",
			row: 2,
			column: 1
		}]
	},
	{
		id: "2x2",
		label: "2x2",
		columns: 2,
		rows: 2,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c12",
				row: 1,
				column: 2
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			}
		]
	},
	{
		id: "2x3",
		label: "2x3",
		columns: 3,
		rows: 2,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c12",
				row: 1,
				column: 2
			},
			{
				id: "c13",
				row: 1,
				column: 3
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c23",
				row: 2,
				column: 3
			}
		]
	},
	{
		id: "3x1",
		label: "3x1",
		columns: 1,
		rows: 3,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c31",
				row: 3,
				column: 1
			}
		]
	},
	{
		id: "3x2",
		label: "3x2",
		columns: 2,
		rows: 3,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c12",
				row: 1,
				column: 2
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c31",
				row: 3,
				column: 1
			},
			{
				id: "c32",
				row: 3,
				column: 2
			}
		]
	},
	{
		id: "3x3",
		label: "3x3",
		columns: 3,
		rows: 3,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c12",
				row: 1,
				column: 2
			},
			{
				id: "c13",
				row: 1,
				column: 3
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c23",
				row: 2,
				column: 3
			},
			{
				id: "c31",
				row: 3,
				column: 1
			},
			{
				id: "c32",
				row: 3,
				column: 2
			},
			{
				id: "c33",
				row: 3,
				column: 3
			}
		]
	},
	{
		id: "4x1",
		label: "4x1",
		columns: 1,
		rows: 4,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c31",
				row: 3,
				column: 1
			},
			{
				id: "c41",
				row: 4,
				column: 1
			}
		]
	},
	{
		id: "4x2",
		label: "4x2",
		columns: 2,
		rows: 4,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c12",
				row: 1,
				column: 2
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c31",
				row: 3,
				column: 1
			},
			{
				id: "c32",
				row: 3,
				column: 2
			},
			{
				id: "c41",
				row: 4,
				column: 1
			},
			{
				id: "c42",
				row: 4,
				column: 2
			}
		]
	},
	{
		id: "4x3",
		label: "4x3",
		columns: 3,
		rows: 4,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c12",
				row: 1,
				column: 2
			},
			{
				id: "c13",
				row: 1,
				column: 3
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c23",
				row: 2,
				column: 3
			},
			{
				id: "c31",
				row: 3,
				column: 1
			},
			{
				id: "c32",
				row: 3,
				column: 2
			},
			{
				id: "c33",
				row: 3,
				column: 3
			},
			{
				id: "c41",
				row: 4,
				column: 1
			},
			{
				id: "c42",
				row: 4,
				column: 2
			},
			{
				id: "c43",
				row: 4,
				column: 3
			}
		]
	},
	{
		id: "2x2-l",
		label: "Большая слева + две справа",
		columns: 2,
		rows: 2,
		cells: [
			{
				id: "left",
				row: 1,
				column: 1,
				rowSpan: 2
			},
			{
				id: "rt",
				row: 1,
				column: 2
			},
			{
				id: "rb",
				row: 2,
				column: 2
			}
		]
	},
	{
		id: "2x2-r",
		label: "Две слева + большая справа",
		columns: 2,
		rows: 2,
		cells: [
			{
				id: "lt",
				row: 1,
				column: 1
			},
			{
				id: "lb",
				row: 2,
				column: 1
			},
			{
				id: "right",
				row: 1,
				column: 2,
				rowSpan: 2
			}
		]
	},
	{
		id: "2x2-t",
		label: "Широкая сверху + две снизу",
		columns: 2,
		rows: 2,
		cells: [
			{
				id: "top",
				row: 1,
				column: 1,
				columnSpan: 2
			},
			{
				id: "bl",
				row: 2,
				column: 1
			},
			{
				id: "br",
				row: 2,
				column: 2
			}
		]
	},
	{
		id: "2x2-b",
		label: "Две сверху + широкая снизу",
		columns: 2,
		rows: 2,
		cells: [
			{
				id: "tl",
				row: 1,
				column: 1
			},
			{
				id: "tr",
				row: 1,
				column: 2
			},
			{
				id: "bottom",
				row: 2,
				column: 1,
				columnSpan: 2
			}
		]
	},
	{
		id: "3x2-t",
		label: "Широкая сверху + 2x2",
		columns: 2,
		rows: 3,
		cells: [
			{
				id: "top",
				row: 1,
				column: 1,
				columnSpan: 2
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c31",
				row: 3,
				column: 1
			},
			{
				id: "c32",
				row: 3,
				column: 2
			}
		]
	},
	{
		id: "3x2-b",
		label: "2x2 + широкая снизу",
		columns: 2,
		rows: 3,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c12",
				row: 1,
				column: 2
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "bottom",
				row: 3,
				column: 1,
				columnSpan: 2
			}
		]
	},
	{
		id: "3x2-m",
		label: "Широкая по центру",
		columns: 2,
		rows: 3,
		cells: [
			{
				id: "tl",
				row: 1,
				column: 1
			},
			{
				id: "tr",
				row: 1,
				column: 2
			},
			{
				id: "middle",
				row: 2,
				column: 1,
				columnSpan: 2
			},
			{
				id: "bl",
				row: 3,
				column: 1
			},
			{
				id: "br",
				row: 3,
				column: 2
			}
		]
	},
	{
		id: "3x3-l",
		label: "Большая слева + 2x3 справа",
		columns: 3,
		rows: 3,
		cells: [
			{
				id: "left",
				row: 1,
				column: 1,
				rowSpan: 3
			},
			{
				id: "c12",
				row: 1,
				column: 2
			},
			{
				id: "c13",
				row: 1,
				column: 3
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c23",
				row: 2,
				column: 3
			},
			{
				id: "c32",
				row: 3,
				column: 2
			},
			{
				id: "c33",
				row: 3,
				column: 3
			}
		]
	},
	{
		id: "3x3-r",
		label: "2x3 слева + большая справа",
		columns: 3,
		rows: 3,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c12",
				row: 1,
				column: 2
			},
			{
				id: "right",
				row: 1,
				column: 3,
				rowSpan: 3
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c31",
				row: 3,
				column: 1
			},
			{
				id: "c32",
				row: 3,
				column: 2
			}
		]
	},
	{
		id: "3x3-t",
		label: "Широкая сверху + 2x3",
		columns: 3,
		rows: 3,
		cells: [
			{
				id: "top",
				row: 1,
				column: 1,
				columnSpan: 3
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c23",
				row: 2,
				column: 3
			},
			{
				id: "c31",
				row: 3,
				column: 1
			},
			{
				id: "c32",
				row: 3,
				column: 2
			},
			{
				id: "c33",
				row: 3,
				column: 3
			}
		]
	},
	{
		id: "3x3-b",
		label: "2x3 + широкая снизу",
		columns: 3,
		rows: 3,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c12",
				row: 1,
				column: 2
			},
			{
				id: "c13",
				row: 1,
				column: 3
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c23",
				row: 2,
				column: 3
			},
			{
				id: "bottom",
				row: 3,
				column: 1,
				columnSpan: 3
			}
		]
	},
	{
		id: "4x2-t",
		label: "Широкая сверху + 3x2",
		columns: 2,
		rows: 4,
		cells: [
			{
				id: "top",
				row: 1,
				column: 1,
				columnSpan: 2
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c31",
				row: 3,
				column: 1
			},
			{
				id: "c32",
				row: 3,
				column: 2
			},
			{
				id: "c41",
				row: 4,
				column: 1
			},
			{
				id: "c42",
				row: 4,
				column: 2
			}
		]
	},
	{
		id: "4x2-b",
		label: "3x2 + широкая снизу",
		columns: 2,
		rows: 4,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c12",
				row: 1,
				column: 2
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c31",
				row: 3,
				column: 1
			},
			{
				id: "c32",
				row: 3,
				column: 2
			},
			{
				id: "bottom",
				row: 4,
				column: 1,
				columnSpan: 2
			}
		]
	},
	{
		id: "4x3-t",
		label: "Широкая сверху + 3x3",
		columns: 3,
		rows: 4,
		cells: [
			{
				id: "top",
				row: 1,
				column: 1,
				columnSpan: 3
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c23",
				row: 2,
				column: 3
			},
			{
				id: "c31",
				row: 3,
				column: 1
			},
			{
				id: "c32",
				row: 3,
				column: 2
			},
			{
				id: "c33",
				row: 3,
				column: 3
			},
			{
				id: "c41",
				row: 4,
				column: 1
			},
			{
				id: "c42",
				row: 4,
				column: 2
			},
			{
				id: "c43",
				row: 4,
				column: 3
			}
		]
	},
	{
		id: "4x3-b",
		label: "3x3 + широкая снизу",
		columns: 3,
		rows: 4,
		cells: [
			{
				id: "c11",
				row: 1,
				column: 1
			},
			{
				id: "c12",
				row: 1,
				column: 2
			},
			{
				id: "c13",
				row: 1,
				column: 3
			},
			{
				id: "c21",
				row: 2,
				column: 1
			},
			{
				id: "c22",
				row: 2,
				column: 2
			},
			{
				id: "c23",
				row: 2,
				column: 3
			},
			{
				id: "c31",
				row: 3,
				column: 1
			},
			{
				id: "c32",
				row: 3,
				column: 2
			},
			{
				id: "c33",
				row: 3,
				column: 3
			},
			{
				id: "bottom",
				row: 4,
				column: 1,
				columnSpan: 3
			}
		]
	}
];
function _() {
	return g[0].id;
}
function v(e) {
	return g.find((t) => t.id === e) ?? g[0];
}
function y(e) {
	return g.find((t) => t.id === e)?.cells.length ?? 1;
}
var b = {
	valueOverlay: "_959ulH",
	triggerInput: "Ch-SZL",
	triggerText: "SmdPit",
	popup: "giOtGs",
	popupLayout: "_57Tr0T",
	popupBody: "Tkhulr",
	options: "VQlniu",
	option: "wb39Kf",
	optionActive: "HGvQdT",
	optionSelected: "rZuYyb",
	optionPreviewWrap: "vNV6Q2",
	optionCheck: "_3ytPPa",
	preview: "koxYU-",
	previewPlaceholder: "k8xLa2",
	previewCompact: "_5pd3Bb",
	previewCell: "VrHnjN"
}, x = "Выберите раскладку";
function S({ preset: e, compact: t = !1 }) {
	return /* @__PURE__ */ f("span", {
		className: l(b.preview, t && b.previewCompact),
		style: m(e),
		"aria-hidden": "true",
		"data-ui": "layout-picker-preview",
		children: e.cells.map((t) => /* @__PURE__ */ f("span", {
			className: b.previewCell,
			style: h(t)
		}, `${e.id}:${t.id}`))
	});
}
function C({ id: m, label: h, description: _, value: v, onChange: y, presets: C = g, disabled: w, getPresetDisabled: T, placeholder: E = x, showPlaceholder: D = !1, size: O, ariaLabel: k, className: ee, triggerClassName: te, popupClassName: A, placement: j = "bottom-start" }) {
	let M = s(null), [N, P] = c(!1), F = C.findIndex((e) => e.id === v), I = F >= 0 ? C[F] : void 0, L = I ?? C[0], R = I?.label ?? E, { activeIndex: z, context: B, floatingStyles: V, getFloatingProps: H, setReference: U, setFloating: W, setOptionRef: G, close: K, openList: q, toggleOpen: J, selectOption: Y, selectActiveOption: X, handleReferenceKeyDown: Z, handleFloatingKeyDown: ne, getOptionId: re, getActiveOptionId: Q } = r({
		options: C,
		selectedIndex: F,
		open: N,
		onOpenChange: P,
		getOptionDisabled: T,
		onSelect: (e) => y(e.id),
		disabled: w,
		placement: j,
		triggerMode: "display"
	}), $ = o({
		mode: "display",
		open: N,
		currentQuery: "",
		hasDisplayValue: I !== void 0,
		inputRef: M,
		openList: q,
		close: K,
		toggleOpen: J
	}), ie = (e) => {
		M.current = e;
	};
	return /* @__PURE__ */ f(a, {
		id: m,
		label: h,
		description: _,
		disabled: w,
		size: O,
		className: ee,
		children: ({ controlId: r, labelId: a, describedBy: o }) => {
			let s = `${r}-listbox`;
			return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(t, {
				ref: ie,
				rootRef: U,
				id: r,
				type: "button",
				disabled: w,
				readOnly: !0,
				autoComplete: "off",
				role: "combobox",
				value: R,
				"aria-haspopup": "listbox",
				"aria-expanded": N,
				"aria-controls": N ? s : void 0,
				"aria-labelledby": a,
				"aria-describedby": o,
				"aria-autocomplete": "none",
				"aria-activedescendant": N ? Q(s) : void 0,
				"aria-label": a ? void 0 : k ?? `Выбрать layout. Текущее значение: ${R}`,
				"data-ui": "layout-picker-trigger",
				rootClassName: te,
				inputClassName: b.triggerInput,
				overlay: /* @__PURE__ */ p("div", {
					className: b.valueOverlay,
					children: [L ? /* @__PURE__ */ f(S, {
						preset: L,
						compact: !0
					}) : /* @__PURE__ */ f("span", { className: b.previewPlaceholder }), D ? /* @__PURE__ */ f("span", {
						className: l(b.triggerText, e.uiPlaceholder),
						"data-ui": "layout-picker-placeholder",
						children: E
					}) : null]
				}),
				endAdornment: /* @__PURE__ */ f(i, {
					open: N,
					disabled: w,
					onToggleMouseDown: $.handleToggleMouseDown,
					onToggleClick: $.handleToggleClick,
					openAriaLabel: "Открыть список layout",
					closeAriaLabel: "Закрыть список layout"
				}),
				onClick: $.handleTriggerClick,
				onFocus: (e) => {
					$.handleTriggerFocus(e.currentTarget);
				},
				onKeyDown: (e) => {
					Z(e), !e.defaultPrevented && $.handleTriggerKeyDown({
						event: e,
						onActivateWhenOpen: X,
						enableSpaceActivation: !0
					});
				}
			}), /* @__PURE__ */ f(n, {
				open: N,
				context: B,
				floatingStyles: V,
				listId: s,
				labelId: a,
				descriptionId: o,
				activeOptionId: Q(s),
				setFloating: W,
				getFloatingProps: H,
				onKeyDown: ne,
				className: l(e.uiPopupOptions, b.popup, A),
				layoutClassName: b.popupLayout,
				bodyClassName: b.popupBody,
				children: /* @__PURE__ */ f("div", {
					className: b.options,
					children: C.map((e, t) => {
						let n = t === F, r = t === z, i = T?.(e) ?? !1, a = re(s, t);
						return /* @__PURE__ */ p("button", {
							id: a,
							ref: (e) => G(t, e),
							type: "button",
							role: "option",
							tabIndex: -1,
							disabled: i,
							"aria-selected": n,
							"aria-disabled": i || void 0,
							"aria-label": e.description ? `${e.label}. ${e.description}` : e.label,
							className: l(b.option, n && b.optionSelected, r && b.optionActive),
							"data-ui": "layout-picker-option",
							"data-selected": n || void 0,
							onMouseDown: (e) => e.preventDefault(),
							onClick: () => Y(e),
							children: [
								/* @__PURE__ */ f("span", {
									className: b.optionPreviewWrap,
									children: /* @__PURE__ */ f(S, { preset: e })
								}),
								/* @__PURE__ */ p("span", {
									className: "fontSizeSm",
									children: [/* @__PURE__ */ f("span", { children: e.label }), e.description ? /* @__PURE__ */ f("span", { children: e.description }) : null]
								}),
								/* @__PURE__ */ f("span", {
									className: b.optionCheck,
									"aria-hidden": "true",
									children: n ? /* @__PURE__ */ f(u, {}) : null
								})
							]
						}, e.id);
					})
				})
			})] });
		}
	});
}
//#endregion
export { g as DEFAULT_LAYOUT_PICKER_PRESETS, C as LayoutPicker, _ as getDefaultLayoutPickerPresetId, h as getLayoutCellStyle, m as getLayoutStyle, y as resolveLayoutCellCount, v as resolveLayoutPreset };

//# sourceMappingURL=index.js.map