import {
	u as useComposedRefs,
	a as useDirection,
	P as Primitive,
	b as Presence,
	c as composeEventHandlers,
	d as createContextScope,
	e as useCallbackRef,
	f as useLayoutEffect2,
	g as clamp,
	h as Portal,
	i as useDismissableLayerSurface,
	R as ReactRemoveScroll,
	j as hideOthers,
	k as createSlot,
	l as useFocusGuards,
	F as FocusScope,
	D as DismissableLayer,
	m as useControllableState,
	n as useId,
	o as usePrevious$1,
	p as useSize,
	s as svg,
	q as html,
	w as whitespace,
	r as ok,
	V as VFileMessage,
	t as find,
	v as stringify,
	x as stringify$1,
	y as pointStart,
	z as unified,
	A as remarkParse,
	B as remarkRehype,
	C as VFile,
	E as unreachable,
	G as visit,
	L as List,
	T as Trigger,
	H as Content,
	S as Slot$1,
	I as Root$2,
	J as SelectTrigger$1,
	K as SelectIcon,
	M as SelectScrollUpButton$1,
	N as SelectScrollDownButton$1,
	O as SelectPortal,
	Q as SelectContent$1,
	U as SelectViewport,
	W as SelectLabel$1,
	X as SelectItem$1,
	Y as SelectItemIndicator,
	Z as SelectItemText,
	_ as SelectSeparator$1,
	$ as __vitePreload,
	a0 as twMerge,
	a1 as clsx,
	a2 as cva,
	a3 as Select$1,
	a4 as SelectGroup$1,
	a5 as SelectValue$1,
	a6 as Root2$1,
} from "../index-BSkdT-DR.js";
export { a7 as conservativeSchema, a8 as courseContentSchema, a9 as defaultSchema } from "../index-BSkdT-DR.js";
import { importShared } from "../__federation_fn_import-hlt2XzeI.js";
import { j as jsxRuntimeExports } from "../jsx-runtime-CvJTHeKY.js";
import { g as getDefaultExportFromCjs } from "../_commonjsHelpers-B85MJLTf.js";
import { c as createLucideIcon, s as shimExports, L as List$1 } from "../index-Coq9nAfE.js";

/**
 * Special cases for React (`Record<string, string>`).
 *
 * `hast` is close to `React` but differs in a couple of cases.
 * To get a React property from a hast property,
 * check if it is in `hastToReact`.
 * If it is, use the corresponding value;
 * otherwise, use the hast property.
 *
 * @type {Record<string, string>}
 */
const hastToReact = {
	classId: "classID",
	dataType: "datatype",
	itemId: "itemID",
	strokeDashArray: "strokeDasharray",
	strokeDashOffset: "strokeDashoffset",
	strokeLineCap: "strokeLinecap",
	strokeLineJoin: "strokeLinejoin",
	strokeMiterLimit: "strokeMiterlimit",
	typeOf: "typeof",
	xLinkActuate: "xlinkActuate",
	xLinkArcRole: "xlinkArcrole",
	xLinkHref: "xlinkHref",
	xLinkRole: "xlinkRole",
	xLinkShow: "xlinkShow",
	xLinkTitle: "xlinkTitle",
	xLinkType: "xlinkType",
	xmlnsXLink: "xmlnsXlink",
};

// src/scroll-area.tsx
const React2$1 = await importShared("react");

// src/use-state-machine.ts
const React$g = await importShared("react");

function useStateMachine(initialState, machine) {
	return React$g.useReducer((state, event) => {
		const nextState = machine[state][event];
		return nextState ?? state;
	}, initialState);
}
var SCROLL_AREA_NAME = "ScrollArea";
var [createScrollAreaContext] = createContextScope(SCROLL_AREA_NAME);
var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);
var ScrollArea$1 = React2$1.forwardRef((props, forwardedRef) => {
	const { __scopeScrollArea, type = "hover", dir, scrollHideDelay = 600, ...scrollAreaProps } = props;
	const [scrollArea, setScrollArea] = React2$1.useState(null);
	const [viewport, setViewport] = React2$1.useState(null);
	const [content, setContent] = React2$1.useState(null);
	const [scrollbarX, setScrollbarX] = React2$1.useState(null);
	const [scrollbarY, setScrollbarY] = React2$1.useState(null);
	const [cornerWidth, setCornerWidth] = React2$1.useState(0);
	const [cornerHeight, setCornerHeight] = React2$1.useState(0);
	const [scrollbarXEnabled, setScrollbarXEnabled] = React2$1.useState(false);
	const [scrollbarYEnabled, setScrollbarYEnabled] = React2$1.useState(false);
	const composedRefs = useComposedRefs(forwardedRef, setScrollArea);
	const direction = useDirection(dir);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaProvider, {
		scope: __scopeScrollArea,
		type,
		dir: direction,
		scrollHideDelay,
		scrollArea,
		viewport,
		onViewportChange: setViewport,
		content,
		onContentChange: setContent,
		scrollbarX,
		onScrollbarXChange: setScrollbarX,
		scrollbarXEnabled,
		onScrollbarXEnabledChange: setScrollbarXEnabled,
		scrollbarY,
		onScrollbarYChange: setScrollbarY,
		scrollbarYEnabled,
		onScrollbarYEnabledChange: setScrollbarYEnabled,
		onCornerWidthChange: setCornerWidth,
		onCornerHeightChange: setCornerHeight,
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, {
			dir: direction,
			...scrollAreaProps,
			ref: composedRefs,
			style: {
				"position": "relative",
				// Pass corner sizes as CSS vars to reduce re-renders of context consumers
				"--radix-scroll-area-corner-width": cornerWidth + "px",
				"--radix-scroll-area-corner-height": cornerHeight + "px",
				...props.style,
			},
		}),
	});
});
ScrollArea$1.displayName = SCROLL_AREA_NAME;
var VIEWPORT_NAME = "ScrollAreaViewport";
var ScrollAreaViewport = React2$1.forwardRef((props, forwardedRef) => {
	const { __scopeScrollArea, children, nonce, ...viewportProps } = props;
	const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);
	const ref = React2$1.useRef(null);
	const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);
	return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaViewportStyle, { nonce }),
			/* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, {
				"data-radix-scroll-area-viewport": "",
				...viewportProps,
				"ref": composedRefs,
				"style": {
					/**
					 * We don't support `visible` because the intention is to have at least one scrollbar
					 * if this component is used and `visible` will behave like `auto` in that case
					 * https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description
					 *
					 * We don't handle `auto` because the intention is for the native implementation
					 * to be hidden if using this component. We just want to ensure the node is scrollable
					 * so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
					 * the browser from having to work out whether to render native scrollbars or not,
					 * we tell it to with the intention of hiding them in CSS.
					 */
					overflowX: context.scrollbarXEnabled ? "scroll" : "hidden",
					overflowY: context.scrollbarYEnabled ? "scroll" : "hidden",
					...props.style,
				},
				"children": /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: context.onContentChange, style: { minWidth: "100%", display: "table" }, children }),
			}),
		],
	});
});
ScrollAreaViewport.displayName = VIEWPORT_NAME;
var ScrollAreaViewportStyle = React2$1.memo(
	({ nonce }) => {
		return /* @__PURE__ */ jsxRuntimeExports.jsx("style", {
			dangerouslySetInnerHTML: {
				__html: `[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`,
			},
			nonce,
		});
	},
	(prevProps, nextProps) => prevProps.nonce === nextProps.nonce,
);
var SCROLLBAR_NAME = "ScrollAreaScrollbar";
var ScrollAreaScrollbar = React2$1.forwardRef((props, forwardedRef) => {
	const { forceMount, ...scrollbarProps } = props;
	const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
	const { onScrollbarXEnabledChange, onScrollbarYEnabledChange } = context;
	const isHorizontal = props.orientation === "horizontal";
	React2$1.useEffect(() => {
		isHorizontal ? onScrollbarXEnabledChange(true) : onScrollbarYEnabledChange(true);
		return () => {
			isHorizontal ? onScrollbarXEnabledChange(false) : onScrollbarYEnabledChange(false);
		};
	}, [isHorizontal, onScrollbarXEnabledChange, onScrollbarYEnabledChange]);
	return (
		context.type === "hover" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaScrollbarHover, { ...scrollbarProps, ref: forwardedRef, forceMount })
		: context.type === "scroll" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaScrollbarScroll, { ...scrollbarProps, ref: forwardedRef, forceMount })
		: context.type === "auto" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaScrollbarAuto, { ...scrollbarProps, ref: forwardedRef, forceMount })
		: context.type === "always" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaScrollbarVisible, { ...scrollbarProps, "ref": forwardedRef, "data-state": "visible" })
		: null
	);
});
ScrollAreaScrollbar.displayName = SCROLLBAR_NAME;
var ScrollAreaScrollbarHover = React2$1.forwardRef((props, forwardedRef) => {
	const { forceMount, ...scrollbarProps } = props;
	const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
	const [visible, setVisible] = React2$1.useState(false);
	React2$1.useEffect(() => {
		const scrollArea = context.scrollArea;
		let hideTimer = 0;
		if (scrollArea) {
			const handlePointerEnter = () => {
				window.clearTimeout(hideTimer);
				setVisible(true);
			};
			const handlePointerLeave = () => {
				hideTimer = window.setTimeout(() => setVisible(false), context.scrollHideDelay);
			};
			scrollArea.addEventListener("pointerenter", handlePointerEnter);
			scrollArea.addEventListener("pointerleave", handlePointerLeave);
			return () => {
				window.clearTimeout(hideTimer);
				scrollArea.removeEventListener("pointerenter", handlePointerEnter);
				scrollArea.removeEventListener("pointerleave", handlePointerLeave);
			};
		}
	}, [context.scrollArea, context.scrollHideDelay]);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, {
		present: forceMount || visible,
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaScrollbarAuto, {
			"data-state": visible ? "visible" : "hidden",
			...scrollbarProps,
			"ref": forwardedRef,
		}),
	});
});
var ScrollAreaScrollbarScroll = React2$1.forwardRef((props, forwardedRef) => {
	const { forceMount, ...scrollbarProps } = props;
	const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
	const isHorizontal = props.orientation === "horizontal";
	const debounceScrollEnd = useDebounceCallback(() => send("SCROLL_END"), 100);
	const [state, send] = useStateMachine("hidden", {
		hidden: {
			SCROLL: "scrolling",
		},
		scrolling: {
			SCROLL_END: "idle",
			POINTER_ENTER: "interacting",
		},
		interacting: {
			SCROLL: "interacting",
			POINTER_LEAVE: "idle",
		},
		idle: {
			HIDE: "hidden",
			SCROLL: "scrolling",
			POINTER_ENTER: "interacting",
		},
	});
	React2$1.useEffect(() => {
		if (state === "idle") {
			const hideTimer = window.setTimeout(() => send("HIDE"), context.scrollHideDelay);
			return () => window.clearTimeout(hideTimer);
		}
	}, [state, context.scrollHideDelay, send]);
	React2$1.useEffect(() => {
		const viewport = context.viewport;
		const scrollDirection = isHorizontal ? "scrollLeft" : "scrollTop";
		if (viewport) {
			let prevScrollPos = viewport[scrollDirection];
			const handleScroll = () => {
				const scrollPos = viewport[scrollDirection];
				const hasScrollInDirectionChanged = prevScrollPos !== scrollPos;
				if (hasScrollInDirectionChanged) {
					send("SCROLL");
					debounceScrollEnd();
				}
				prevScrollPos = scrollPos;
			};
			viewport.addEventListener("scroll", handleScroll);
			return () => viewport.removeEventListener("scroll", handleScroll);
		}
	}, [context.viewport, isHorizontal, send, debounceScrollEnd]);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, {
		present: forceMount || state !== "hidden",
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaScrollbarVisible, {
			"data-state": state === "hidden" ? "hidden" : "visible",
			...scrollbarProps,
			"ref": forwardedRef,
			"onPointerEnter": composeEventHandlers(props.onPointerEnter, () => send("POINTER_ENTER")),
			"onPointerLeave": composeEventHandlers(props.onPointerLeave, () => send("POINTER_LEAVE")),
		}),
	});
});
var ScrollAreaScrollbarAuto = React2$1.forwardRef((props, forwardedRef) => {
	const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
	const { forceMount, ...scrollbarProps } = props;
	const [visible, setVisible] = React2$1.useState(false);
	const isHorizontal = props.orientation === "horizontal";
	const handleResize = useDebounceCallback(() => {
		if (context.viewport) {
			const isOverflowX = context.viewport.offsetWidth < context.viewport.scrollWidth;
			const isOverflowY = context.viewport.offsetHeight < context.viewport.scrollHeight;
			setVisible(isHorizontal ? isOverflowX : isOverflowY);
		}
	}, 10);
	useResizeObserver$1(context.viewport, handleResize);
	useResizeObserver$1(context.content, handleResize);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, {
		present: forceMount || visible,
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaScrollbarVisible, {
			"data-state": visible ? "visible" : "hidden",
			...scrollbarProps,
			"ref": forwardedRef,
		}),
	});
});
var ScrollAreaScrollbarVisible = React2$1.forwardRef((props, forwardedRef) => {
	const { orientation = "vertical", ...scrollbarProps } = props;
	const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
	const thumbRef = React2$1.useRef(null);
	const pointerOffsetRef = React2$1.useRef(0);
	const [sizes, setSizes] = React2$1.useState({
		content: 0,
		viewport: 0,
		scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 },
	});
	const thumbRatio = getThumbRatio(sizes.viewport, sizes.content);
	const commonProps = {
		...scrollbarProps,
		sizes,
		onSizesChange: setSizes,
		hasThumb: Boolean(thumbRatio > 0 && thumbRatio < 1),
		onThumbChange: (thumb) => (thumbRef.current = thumb),
		onThumbPointerUp: () => (pointerOffsetRef.current = 0),
		onThumbPointerDown: (pointerPos) => (pointerOffsetRef.current = pointerPos),
	};
	function getScrollPosition(pointerPos, dir) {
		return getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes, dir);
	}
	if (orientation === "horizontal") {
		return /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaScrollbarX, {
			...commonProps,
			ref: forwardedRef,
			onThumbPositionChange: () => {
				if (context.viewport && thumbRef.current) {
					const scrollPos = context.viewport.scrollLeft;
					const offset = getThumbOffsetFromScroll(scrollPos, sizes, context.dir);
					thumbRef.current.style.transform = `translate3d(${offset}px, 0, 0)`;
				}
			},
			onWheelScroll: (scrollPos) => {
				if (context.viewport) context.viewport.scrollLeft = scrollPos;
			},
			onDragScroll: (pointerPos) => {
				if (context.viewport) {
					context.viewport.scrollLeft = getScrollPosition(pointerPos, context.dir);
				}
			},
		});
	}
	if (orientation === "vertical") {
		return /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaScrollbarY, {
			...commonProps,
			ref: forwardedRef,
			onThumbPositionChange: () => {
				if (context.viewport && thumbRef.current) {
					const scrollPos = context.viewport.scrollTop;
					const offset = getThumbOffsetFromScroll(scrollPos, sizes);
					thumbRef.current.style.transform = `translate3d(0, ${offset}px, 0)`;
				}
			},
			onWheelScroll: (scrollPos) => {
				if (context.viewport) context.viewport.scrollTop = scrollPos;
			},
			onDragScroll: (pointerPos) => {
				if (context.viewport) context.viewport.scrollTop = getScrollPosition(pointerPos);
			},
		});
	}
	return null;
});
var ScrollAreaScrollbarX = React2$1.forwardRef((props, forwardedRef) => {
	const { sizes, onSizesChange, ...scrollbarProps } = props;
	const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
	const [computedStyle, setComputedStyle] = React2$1.useState();
	const ref = React2$1.useRef(null);
	const composeRefs = useComposedRefs(forwardedRef, ref, context.onScrollbarXChange);
	React2$1.useEffect(() => {
		if (ref.current) setComputedStyle(getComputedStyle(ref.current));
	}, [ref]);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaScrollbarImpl, {
		"data-orientation": "horizontal",
		...scrollbarProps,
		"ref": composeRefs,
		sizes,
		"style": {
			"bottom": 0,
			"left": context.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
			"right": context.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
			"--radix-scroll-area-thumb-width": getThumbSize(sizes) + "px",
			...props.style,
		},
		"onThumbPointerDown": (pointerPos) => props.onThumbPointerDown(pointerPos.x),
		"onDragScroll": (pointerPos) => props.onDragScroll(pointerPos.x),
		"onWheelScroll": (event, maxScrollPos) => {
			if (context.viewport) {
				const scrollPos = context.viewport.scrollLeft + event.deltaX;
				props.onWheelScroll(scrollPos);
				if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) {
					event.preventDefault();
				}
			}
		},
		"onResize": () => {
			if (ref.current && context.viewport && computedStyle) {
				onSizesChange({
					content: context.viewport.scrollWidth,
					viewport: context.viewport.offsetWidth,
					scrollbar: {
						size: ref.current.clientWidth,
						paddingStart: toInt(computedStyle.paddingLeft),
						paddingEnd: toInt(computedStyle.paddingRight),
					},
				});
			}
		},
	});
});
var ScrollAreaScrollbarY = React2$1.forwardRef((props, forwardedRef) => {
	const { sizes, onSizesChange, ...scrollbarProps } = props;
	const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
	const [computedStyle, setComputedStyle] = React2$1.useState();
	const ref = React2$1.useRef(null);
	const composeRefs = useComposedRefs(forwardedRef, ref, context.onScrollbarYChange);
	React2$1.useEffect(() => {
		if (ref.current) setComputedStyle(getComputedStyle(ref.current));
	}, [ref]);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaScrollbarImpl, {
		"data-orientation": "vertical",
		...scrollbarProps,
		"ref": composeRefs,
		sizes,
		"style": {
			"top": 0,
			"right": context.dir === "ltr" ? 0 : void 0,
			"left": context.dir === "rtl" ? 0 : void 0,
			"bottom": "var(--radix-scroll-area-corner-height)",
			"--radix-scroll-area-thumb-height": getThumbSize(sizes) + "px",
			...props.style,
		},
		"onThumbPointerDown": (pointerPos) => props.onThumbPointerDown(pointerPos.y),
		"onDragScroll": (pointerPos) => props.onDragScroll(pointerPos.y),
		"onWheelScroll": (event, maxScrollPos) => {
			if (context.viewport) {
				const scrollPos = context.viewport.scrollTop + event.deltaY;
				props.onWheelScroll(scrollPos);
				if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) {
					event.preventDefault();
				}
			}
		},
		"onResize": () => {
			if (ref.current && context.viewport && computedStyle) {
				onSizesChange({
					content: context.viewport.scrollHeight,
					viewport: context.viewport.offsetHeight,
					scrollbar: {
						size: ref.current.clientHeight,
						paddingStart: toInt(computedStyle.paddingTop),
						paddingEnd: toInt(computedStyle.paddingBottom),
					},
				});
			}
		},
	});
});
var [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME);
var ScrollAreaScrollbarImpl = React2$1.forwardRef((props, forwardedRef) => {
	const { __scopeScrollArea, sizes, hasThumb, onThumbChange, onThumbPointerUp, onThumbPointerDown, onThumbPositionChange, onDragScroll, onWheelScroll, onResize, ...scrollbarProps } = props;
	const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea);
	const [scrollbar, setScrollbar] = React2$1.useState(null);
	const composeRefs = useComposedRefs(forwardedRef, setScrollbar);
	const rectRef = React2$1.useRef(null);
	const prevWebkitUserSelectRef = React2$1.useRef("");
	const viewport = context.viewport;
	const maxScrollPos = sizes.content - sizes.viewport;
	const handleWheelScroll = useCallbackRef(onWheelScroll);
	const handleThumbPositionChange = useCallbackRef(onThumbPositionChange);
	const handleResize = useDebounceCallback(onResize, 10);
	function handleDragScroll(event) {
		if (rectRef.current) {
			const x = event.clientX - rectRef.current.left;
			const y = event.clientY - rectRef.current.top;
			onDragScroll({ x, y });
		}
	}
	React2$1.useEffect(() => {
		const handleWheel = (event) => {
			const element = event.target;
			const isScrollbarWheel = scrollbar?.contains(element);
			if (isScrollbarWheel) handleWheelScroll(event, maxScrollPos);
		};
		document.addEventListener("wheel", handleWheel, { passive: false });
		return () => document.removeEventListener("wheel", handleWheel, { passive: false });
	}, [viewport, scrollbar, maxScrollPos, handleWheelScroll]);
	React2$1.useEffect(handleThumbPositionChange, [sizes, handleThumbPositionChange]);
	useResizeObserver$1(scrollbar, handleResize);
	useResizeObserver$1(context.content, handleResize);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollbarProvider, {
		scope: __scopeScrollArea,
		scrollbar,
		hasThumb,
		onThumbChange: useCallbackRef(onThumbChange),
		onThumbPointerUp: useCallbackRef(onThumbPointerUp),
		onThumbPositionChange: handleThumbPositionChange,
		onThumbPointerDown: useCallbackRef(onThumbPointerDown),
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, {
			...scrollbarProps,
			ref: composeRefs,
			style: { position: "absolute", ...scrollbarProps.style },
			onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
				const mainPointer = 0;
				if (event.button === mainPointer) {
					const element = event.target;
					element.setPointerCapture(event.pointerId);
					rectRef.current = scrollbar.getBoundingClientRect();
					prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;
					document.body.style.webkitUserSelect = "none";
					if (context.viewport) context.viewport.style.scrollBehavior = "auto";
					handleDragScroll(event);
				}
			}),
			onPointerMove: composeEventHandlers(props.onPointerMove, handleDragScroll),
			onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {
				const element = event.target;
				if (element.hasPointerCapture(event.pointerId)) {
					element.releasePointerCapture(event.pointerId);
				}
				document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
				if (context.viewport) context.viewport.style.scrollBehavior = "";
				rectRef.current = null;
			}),
		}),
	});
});
var THUMB_NAME$1 = "ScrollAreaThumb";
var ScrollAreaThumb = React2$1.forwardRef((props, forwardedRef) => {
	const { forceMount, ...thumbProps } = props;
	const scrollbarContext = useScrollbarContext(THUMB_NAME$1, props.__scopeScrollArea);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, {
		present: forceMount || scrollbarContext.hasThumb,
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaThumbImpl, { ref: forwardedRef, ...thumbProps }),
	});
});
var ScrollAreaThumbImpl = React2$1.forwardRef((props, forwardedRef) => {
	const { __scopeScrollArea, style, ...thumbProps } = props;
	const scrollAreaContext = useScrollAreaContext(THUMB_NAME$1, __scopeScrollArea);
	const scrollbarContext = useScrollbarContext(THUMB_NAME$1, __scopeScrollArea);
	const { onThumbPositionChange } = scrollbarContext;
	const composedRef = useComposedRefs(forwardedRef, scrollbarContext.onThumbChange);
	const removeUnlinkedScrollListenerRef = React2$1.useRef(void 0);
	const debounceScrollEnd = useDebounceCallback(() => {
		if (removeUnlinkedScrollListenerRef.current) {
			removeUnlinkedScrollListenerRef.current();
			removeUnlinkedScrollListenerRef.current = void 0;
		}
	}, 100);
	React2$1.useEffect(() => {
		const viewport = scrollAreaContext.viewport;
		if (viewport) {
			const handleScroll = () => {
				debounceScrollEnd();
				if (!removeUnlinkedScrollListenerRef.current) {
					const listener = addUnlinkedScrollListener(viewport, onThumbPositionChange);
					removeUnlinkedScrollListenerRef.current = listener;
					onThumbPositionChange();
				}
			};
			onThumbPositionChange();
			viewport.addEventListener("scroll", handleScroll);
			return () => viewport.removeEventListener("scroll", handleScroll);
		}
	}, [scrollAreaContext.viewport, debounceScrollEnd, onThumbPositionChange]);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, {
		"data-state": scrollbarContext.hasThumb ? "visible" : "hidden",
		...thumbProps,
		"ref": composedRef,
		"style": {
			width: "var(--radix-scroll-area-thumb-width)",
			height: "var(--radix-scroll-area-thumb-height)",
			...style,
		},
		"onPointerDownCapture": composeEventHandlers(props.onPointerDownCapture, (event) => {
			const thumb = event.target;
			const thumbRect = thumb.getBoundingClientRect();
			const x = event.clientX - thumbRect.left;
			const y = event.clientY - thumbRect.top;
			scrollbarContext.onThumbPointerDown({ x, y });
		}),
		"onPointerUp": composeEventHandlers(props.onPointerUp, scrollbarContext.onThumbPointerUp),
	});
});
ScrollAreaThumb.displayName = THUMB_NAME$1;
var CORNER_NAME = "ScrollAreaCorner";
var ScrollAreaCorner = React2$1.forwardRef((props, forwardedRef) => {
	const context = useScrollAreaContext(CORNER_NAME, props.__scopeScrollArea);
	const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
	const hasCorner = context.type !== "scroll" && hasBothScrollbarsVisible;
	return hasCorner ? /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaCornerImpl, { ...props, ref: forwardedRef }) : null;
});
ScrollAreaCorner.displayName = CORNER_NAME;
var ScrollAreaCornerImpl = React2$1.forwardRef((props, forwardedRef) => {
	const { __scopeScrollArea, ...cornerProps } = props;
	const context = useScrollAreaContext(CORNER_NAME, __scopeScrollArea);
	const [width, setWidth] = React2$1.useState(0);
	const [height, setHeight] = React2$1.useState(0);
	const hasSize = Boolean(width && height);
	useResizeObserver$1(context.scrollbarX, () => {
		const height2 = context.scrollbarX?.offsetHeight || 0;
		context.onCornerHeightChange(height2);
		setHeight(height2);
	});
	useResizeObserver$1(context.scrollbarY, () => {
		const width2 = context.scrollbarY?.offsetWidth || 0;
		context.onCornerWidthChange(width2);
		setWidth(width2);
	});
	return hasSize ?
			/* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, {
				...cornerProps,
				ref: forwardedRef,
				style: {
					width,
					height,
					position: "absolute",
					right: context.dir === "ltr" ? 0 : void 0,
					left: context.dir === "rtl" ? 0 : void 0,
					bottom: 0,
					...props.style,
				},
			})
		:	null;
});
function toInt(value) {
	return value ? parseInt(value, 10) : 0;
}
function getThumbRatio(viewportSize, contentSize) {
	const ratio = viewportSize / contentSize;
	return isNaN(ratio) ? 0 : ratio;
}
function getThumbSize(sizes) {
	const ratio = getThumbRatio(sizes.viewport, sizes.content);
	const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
	const thumbSize = (sizes.scrollbar.size - scrollbarPadding) * ratio;
	return Math.max(thumbSize, 18);
}
function getScrollPositionFromPointer(pointerPos, pointerOffset, sizes, dir = "ltr") {
	const thumbSizePx = getThumbSize(sizes);
	const thumbCenter = thumbSizePx / 2;
	const offset = pointerOffset || thumbCenter;
	const thumbOffsetFromEnd = thumbSizePx - offset;
	const minPointerPos = sizes.scrollbar.paddingStart + offset;
	const maxPointerPos = sizes.scrollbar.size - sizes.scrollbar.paddingEnd - thumbOffsetFromEnd;
	const maxScrollPos = sizes.content - sizes.viewport;
	const scrollRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
	const interpolate = linearScale([minPointerPos, maxPointerPos], scrollRange);
	return interpolate(pointerPos);
}
function getThumbOffsetFromScroll(scrollPos, sizes, dir = "ltr") {
	const thumbSizePx = getThumbSize(sizes);
	const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
	const scrollbar = sizes.scrollbar.size - scrollbarPadding;
	const maxScrollPos = sizes.content - sizes.viewport;
	const maxThumbPos = scrollbar - thumbSizePx;
	const scrollClampRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
	const scrollWithoutMomentum = clamp(scrollPos, scrollClampRange);
	const interpolate = linearScale([0, maxScrollPos], [0, maxThumbPos]);
	return interpolate(scrollWithoutMomentum);
}
function linearScale(input, output) {
	return (value) => {
		if (input[0] === input[1] || output[0] === output[1]) return output[0];
		const ratio = (output[1] - output[0]) / (input[1] - input[0]);
		return output[0] + ratio * (value - input[0]);
	};
}
function isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos) {
	return scrollPos > 0 && scrollPos < maxScrollPos;
}
var addUnlinkedScrollListener = (node, handler = () => {}) => {
	let prevPosition = { left: node.scrollLeft, top: node.scrollTop };
	let rAF = 0;
	(function loop() {
		const position = { left: node.scrollLeft, top: node.scrollTop };
		const isHorizontalScroll = prevPosition.left !== position.left;
		const isVerticalScroll = prevPosition.top !== position.top;
		if (isHorizontalScroll || isVerticalScroll) handler();
		prevPosition = position;
		rAF = window.requestAnimationFrame(loop);
	})();
	return () => window.cancelAnimationFrame(rAF);
};
function useDebounceCallback(callback, delay) {
	const handleCallback = useCallbackRef(callback);
	const debounceTimerRef = React2$1.useRef(0);
	React2$1.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
	return React2$1.useCallback(() => {
		window.clearTimeout(debounceTimerRef.current);
		debounceTimerRef.current = window.setTimeout(handleCallback, delay);
	}, [handleCallback, delay]);
}
function useResizeObserver$1(element, onResize) {
	const handleResize = useCallbackRef(onResize);
	useLayoutEffect2(() => {
		let rAF = 0;
		if (element) {
			const resizeObserver = new ResizeObserver(() => {
				cancelAnimationFrame(rAF);
				rAF = window.requestAnimationFrame(handleResize);
			});
			resizeObserver.observe(element);
			return () => {
				window.cancelAnimationFrame(rAF);
				resizeObserver.unobserve(element);
			};
		}
	}, [element, handleResize]);
}
var Root$1 = ScrollArea$1;
var Viewport = ScrollAreaViewport;
var Corner = ScrollAreaCorner;

// src/separator.tsx
const React$f = await importShared("react");
var NAME = "Separator";
var DEFAULT_ORIENTATION = "horizontal";
var ORIENTATIONS = ["horizontal", "vertical"];
var Separator$1 = React$f.forwardRef((props, forwardedRef) => {
	const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;
	const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
	const ariaOrientation = orientation === "vertical" ? orientation : void 0;
	const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, "role": "separator" };
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, {
		"data-orientation": orientation,
		...semanticProps,
		...domProps,
		"ref": forwardedRef,
	});
});
Separator$1.displayName = NAME;
function isValidOrientation(orientation) {
	return ORIENTATIONS.includes(orientation);
}
var Root = Separator$1;

// src/dialog.tsx
const React$e = await importShared("react");
var DIALOG_NAME = "Dialog";
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
var Dialog$1 = (props) => {
	const { __scopeDialog, children, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
	const triggerRef = React$e.useRef(null);
	const contentRef = React$e.useRef(null);
	const [open, setOpen] = useControllableState({
		prop: openProp,
		defaultProp: defaultOpen ?? false,
		onChange: onOpenChange,
		caller: DIALOG_NAME,
	});
	return /* @__PURE__ */ jsxRuntimeExports.jsx(DialogProvider, {
		scope: __scopeDialog,
		triggerRef,
		contentRef,
		contentId: useId(),
		titleId: useId(),
		descriptionId: useId(),
		open,
		onOpenChange: setOpen,
		onOpenToggle: React$e.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
		modal,
		children,
	});
};
Dialog$1.displayName = DIALOG_NAME;
var TRIGGER_NAME$3 = "DialogTrigger";
var DialogTrigger$1 = React$e.forwardRef((props, forwardedRef) => {
	const { __scopeDialog, ...triggerProps } = props;
	const context = useDialogContext(TRIGGER_NAME$3, __scopeDialog);
	const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.button, {
		"type": "button",
		"aria-haspopup": "dialog",
		"aria-expanded": context.open,
		"aria-controls": context.open ? context.contentId : void 0,
		"data-state": getState$2(context.open),
		...triggerProps,
		"ref": composedTriggerRef,
		"onClick": composeEventHandlers(props.onClick, context.onOpenToggle),
	});
});
DialogTrigger$1.displayName = TRIGGER_NAME$3;
var PORTAL_NAME$1 = "DialogPortal";
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME$1, {
	forceMount: void 0,
});
var DialogPortal$1 = (props) => {
	const { __scopeDialog, forceMount, children, container } = props;
	const context = useDialogContext(PORTAL_NAME$1, __scopeDialog);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider, {
		scope: __scopeDialog,
		forceMount,
		children: React$e.Children.map(children, (child) =>
			/* @__PURE__ */ jsxRuntimeExports.jsx(Presence, {
				present: forceMount || context.open,
				children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal, { asChild: true, container, children: child }),
			}),
		),
	});
};
DialogPortal$1.displayName = PORTAL_NAME$1;
var OVERLAY_NAME$1 = "DialogOverlay";
var DialogOverlay$1 = React$e.forwardRef((props, forwardedRef) => {
	const portalContext = usePortalContext(OVERLAY_NAME$1, props.__scopeDialog);
	const { forceMount = portalContext.forceMount, ...overlayProps } = props;
	const context = useDialogContext(OVERLAY_NAME$1, props.__scopeDialog);
	return context.modal ?
			/* @__PURE__ */ jsxRuntimeExports.jsx(Presence, {
				present: forceMount || context.open,
				children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }),
			})
		:	null;
});
DialogOverlay$1.displayName = OVERLAY_NAME$1;
var Slot = createSlot("DialogOverlay.RemoveScroll");
var DialogOverlayImpl = React$e.forwardRef((props, forwardedRef) => {
	const { __scopeDialog, ...overlayProps } = props;
	const context = useDialogContext(OVERLAY_NAME$1, __scopeDialog);
	const registerDismissableSurface = useDismissableLayerSurface();
	const composedRefs = useComposedRefs(forwardedRef, registerDismissableSurface);
	return (
		// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
		// ie. when `Overlay` and `Content` are siblings
		/* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, {
			as: Slot,
			allowPinchZoom: true,
			shards: [context.contentRef],
			children: /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, {
				"data-state": getState$2(context.open),
				...overlayProps,
				"ref": composedRefs,
				"style": { pointerEvents: "auto", ...overlayProps.style },
			}),
		})
	);
});
var CONTENT_NAME$1 = "DialogContent";
var DialogContent$1 = React$e.forwardRef((props, forwardedRef) => {
	const portalContext = usePortalContext(CONTENT_NAME$1, props.__scopeDialog);
	const { forceMount = portalContext.forceMount, ...contentProps } = props;
	const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, {
		present: forceMount || context.open,
		children:
			context.modal ?
				/* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentModal, { ...contentProps, ref: forwardedRef })
			:	/* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }),
	});
});
DialogContent$1.displayName = CONTENT_NAME$1;
var DialogContentModal = React$e.forwardRef((props, forwardedRef) => {
	const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
	const contentRef = React$e.useRef(null);
	const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
	React$e.useEffect(() => {
		const content = contentRef.current;
		if (content) return hideOthers(content);
	}, []);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentImpl, {
		...props,
		ref: composedRefs,
		trapFocus: context.open,
		disableOutsidePointerEvents: context.open,
		onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
			event.preventDefault();
			context.triggerRef.current?.focus();
		}),
		onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
			const originalEvent = event.detail.originalEvent;
			const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
			const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
			if (isRightClick) event.preventDefault();
		}),
		onFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => event.preventDefault()),
	});
});
var DialogContentNonModal = React$e.forwardRef((props, forwardedRef) => {
	const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
	const hasInteractedOutsideRef = React$e.useRef(false);
	const hasPointerDownOutsideRef = React$e.useRef(false);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentImpl, {
		...props,
		ref: forwardedRef,
		trapFocus: false,
		disableOutsidePointerEvents: false,
		onCloseAutoFocus: (event) => {
			props.onCloseAutoFocus?.(event);
			if (!event.defaultPrevented) {
				if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
				event.preventDefault();
			}
			hasInteractedOutsideRef.current = false;
			hasPointerDownOutsideRef.current = false;
		},
		onInteractOutside: (event) => {
			props.onInteractOutside?.(event);
			if (!event.defaultPrevented) {
				hasInteractedOutsideRef.current = true;
				if (event.detail.originalEvent.type === "pointerdown") {
					hasPointerDownOutsideRef.current = true;
				}
			}
			const target = event.target;
			const targetIsTrigger = context.triggerRef.current?.contains(target);
			if (targetIsTrigger) event.preventDefault();
			if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
				event.preventDefault();
			}
		},
	});
});
var DialogContentImpl = React$e.forwardRef((props, forwardedRef) => {
	const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
	const context = useDialogContext(CONTENT_NAME$1, __scopeDialog);
	useFocusGuards();
	return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(FocusScope, {
			asChild: true,
			loop: true,
			trapped: trapFocus,
			onMountAutoFocus: onOpenAutoFocus,
			onUnmountAutoFocus: onCloseAutoFocus,
			children: /* @__PURE__ */ jsxRuntimeExports.jsx(DismissableLayer, {
				"role": "dialog",
				"id": context.contentId,
				"aria-describedby": context.descriptionId,
				"aria-labelledby": context.titleId,
				"data-state": getState$2(context.open),
				...contentProps,
				"ref": forwardedRef,
				"deferPointerDownOutside": true,
				"onDismiss": () => context.onOpenChange(false),
			}),
		}),
	});
});
var TITLE_NAME$1 = "DialogTitle";
var DialogTitle$1 = React$e.forwardRef((props, forwardedRef) => {
	const { __scopeDialog, ...titleProps } = props;
	const context = useDialogContext(TITLE_NAME$1, __scopeDialog);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
});
DialogTitle$1.displayName = TITLE_NAME$1;
var DESCRIPTION_NAME$1 = "DialogDescription";
var DialogDescription$1 = React$e.forwardRef((props, forwardedRef) => {
	const { __scopeDialog, ...descriptionProps } = props;
	const context = useDialogContext(DESCRIPTION_NAME$1, __scopeDialog);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
});
DialogDescription$1.displayName = DESCRIPTION_NAME$1;
var CLOSE_NAME = "DialogClose";
var DialogClose$1 = React$e.forwardRef((props, forwardedRef) => {
	const { __scopeDialog, ...closeProps } = props;
	const context = useDialogContext(CLOSE_NAME, __scopeDialog);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.button, {
		type: "button",
		...closeProps,
		ref: forwardedRef,
		onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false)),
	});
});
DialogClose$1.displayName = CLOSE_NAME;
function getState$2(open) {
	return open ? "open" : "closed";
}

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const ArrowDown = createLucideIcon("ArrowDown", [
	["path", { d: "M12 5v14", key: "s699le" }],
	["path", { d: "m19 12-7 7-7-7", key: "1idqje" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const ArrowRight = createLucideIcon("ArrowRight", [
	["path", { d: "M5 12h14", key: "1ays0h" }],
	["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const ArrowUp = createLucideIcon("ArrowUp", [
	["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
	["path", { d: "M12 19V5", key: "x0mq9r" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const ChevronDown = createLucideIcon("ChevronDown", [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const ChevronLeft = createLucideIcon("ChevronLeft", [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const ChevronRight = createLucideIcon("ChevronRight", [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const ChevronUp = createLucideIcon("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const ChevronsLeft = createLucideIcon("ChevronsLeft", [
	["path", { d: "m11 17-5-5 5-5", key: "13zhaf" }],
	["path", { d: "m18 17-5-5 5-5", key: "h8a8et" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const ChevronsRight = createLucideIcon("ChevronsRight", [
	["path", { d: "m6 17 5-5-5-5", key: "xnjwq" }],
	["path", { d: "m13 17 5-5-5-5", key: "17xmmf" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const ChevronsUpDown = createLucideIcon("ChevronsUpDown", [
	["path", { d: "m7 15 5 5 5-5", key: "1hf1tw" }],
	["path", { d: "m7 9 5-5 5 5", key: "sgt6xg" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const CircleAlert = createLucideIcon("CircleAlert", [
	["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
	["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
	["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const CircleCheckBig = createLucideIcon("CircleCheckBig", [
	["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
	["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const CircleCheck = createLucideIcon("CircleCheck", [
	["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
	["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const CircleHelp = createLucideIcon("CircleHelp", [
	["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
	["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
	["path", { d: "M12 17h.01", key: "p32p05" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const CircleUserRound = createLucideIcon("CircleUserRound", [
	["path", { d: "M18 20a6 6 0 0 0-12 0", key: "1qehca" }],
	["circle", { cx: "12", cy: "10", r: "4", key: "1h16sb" }],
	["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const CircleX = createLucideIcon("CircleX", [
	["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
	["path", { d: "m15 9-6 6", key: "1uzhvr" }],
	["path", { d: "m9 9 6 6", key: "z0biqf" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Code$1 = createLucideIcon("Code", [
	["polyline", { points: "16 18 22 12 16 6", key: "z7tu5w" }],
	["polyline", { points: "8 6 2 12 8 18", key: "1eg1df" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Copy = createLucideIcon("Copy", [
	["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
	["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Download = createLucideIcon("Download", [
	["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
	["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }],
	["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const EllipsisVertical = createLucideIcon("EllipsisVertical", [
	["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
	["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
	["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Ellipsis = createLucideIcon("Ellipsis", [
	["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
	["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
	["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const ExternalLink = createLucideIcon("ExternalLink", [
	["path", { d: "M15 3h6v6", key: "1q9fwt" }],
	["path", { d: "M10 14 21 3", key: "gplh6r" }],
	["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const EyeOff = createLucideIcon("EyeOff", [
	[
		"path",
		{
			d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
			key: "ct8e1f",
		},
	],
	["path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242", key: "151rxh" }],
	[
		"path",
		{
			d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",
			key: "13bj9a",
		},
	],
	["path", { d: "m2 2 20 20", key: "1ooewy" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Eye = createLucideIcon("Eye", [
	[
		"path",
		{
			d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
			key: "1nclc0",
		},
	],
	["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const File$1 = createLucideIcon("File", [
	["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
	["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Filter = createLucideIcon("Filter", [["polygon", { points: "22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3", key: "1yg77f" }]]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Folder = createLucideIcon("Folder", [
	[
		"path",
		{
			d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
			key: "1kt360",
		},
	],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Grid3x3 = createLucideIcon("Grid3x3", [
	["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
	["path", { d: "M3 9h18", key: "1pudct" }],
	["path", { d: "M3 15h18", key: "5xshup" }],
	["path", { d: "M9 3v18", key: "fh3hqa" }],
	["path", { d: "M15 3v18", key: "14nvp0" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const History = createLucideIcon("History", [
	["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
	["path", { d: "M3 3v5h5", key: "1xhq8a" }],
	["path", { d: "M12 7v5l4 2", key: "1fdv2h" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Image = createLucideIcon("Image", [
	["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
	["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
	["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Info = createLucideIcon("Info", [
	["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
	["path", { d: "M12 16v-4", key: "1dtifu" }],
	["path", { d: "M12 8h.01", key: "e9boi3" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Key = createLucideIcon("Key", [
	["path", { d: "m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4", key: "g0fldk" }],
	["path", { d: "m21 2-9.6 9.6", key: "1j0ho8" }],
	["circle", { cx: "7.5", cy: "15.5", r: "5.5", key: "yqb3hr" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Link = createLucideIcon("Link", [
	["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
	["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const LoaderCircle = createLucideIcon("LoaderCircle", [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Menu = createLucideIcon("Menu", [
	["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }],
	["line", { x1: "4", x2: "20", y1: "6", y2: "6", key: "1owob3" }],
	["line", { x1: "4", x2: "20", y1: "18", y2: "18", key: "yk5zj1" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Minus = createLucideIcon("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const PenLine = createLucideIcon("PenLine", [
	["path", { d: "M12 20h9", key: "t2du7b" }],
	[
		"path",
		{
			d: "M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",
			key: "1ykcvy",
		},
	],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Plus = createLucideIcon("Plus", [
	["path", { d: "M5 12h14", key: "1ays0h" }],
	["path", { d: "M12 5v14", key: "s699le" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const RefreshCw = createLucideIcon("RefreshCw", [
	["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
	["path", { d: "M21 3v5h-5", key: "1q7to0" }],
	["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
	["path", { d: "M8 16H3v5", key: "1cv678" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Search = createLucideIcon("Search", [
	["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
	["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Send = createLucideIcon("Send", [
	[
		"path",
		{
			d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",
			key: "1ffxy3",
		},
	],
	["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Settings = createLucideIcon("Settings", [
	[
		"path",
		{
			d: "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",
			key: "1qme2f",
		},
	],
	["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
	["line", { x1: "21", x2: "14", y1: "4", y2: "4", key: "obuewd" }],
	["line", { x1: "10", x2: "3", y1: "4", y2: "4", key: "1q6298" }],
	["line", { x1: "21", x2: "12", y1: "12", y2: "12", key: "1iu8h1" }],
	["line", { x1: "8", x2: "3", y1: "12", y2: "12", key: "ntss68" }],
	["line", { x1: "21", x2: "16", y1: "20", y2: "20", key: "14d8ph" }],
	["line", { x1: "12", x2: "3", y1: "20", y2: "20", key: "m0wm8r" }],
	["line", { x1: "14", x2: "14", y1: "2", y2: "6", key: "14e1ph" }],
	["line", { x1: "8", x2: "8", y1: "10", y2: "14", key: "1i6ji0" }],
	["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Sparkles = createLucideIcon("Sparkles", [
	[
		"path",
		{
			d: "M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",
			key: "4pj2yx",
		},
	],
	["path", { d: "M20 3v4", key: "1olli1" }],
	["path", { d: "M22 5h-4", key: "1gvqau" }],
	["path", { d: "M4 17v2", key: "vumght" }],
	["path", { d: "M5 18H3", key: "zchphs" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Trash2 = createLucideIcon("Trash2", [
	["path", { d: "M3 6h18", key: "d0wm0j" }],
	["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
	["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
	["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
	["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const TriangleAlert = createLucideIcon("TriangleAlert", [
	[
		"path",
		{
			d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
			key: "wmoenq",
		},
	],
	["path", { d: "M12 9v4", key: "juzpu7" }],
	["path", { d: "M12 17h.01", key: "p32p05" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Upload = createLucideIcon("Upload", [
	["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
	["polyline", { points: "17 8 12 3 7 8", key: "t8dd8p" }],
	["line", { x1: "12", x2: "12", y1: "3", y2: "15", key: "widbto" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Users = createLucideIcon("Users", [
	["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
	["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }],
	["path", { d: "M22 21v-2a4 4 0 0 0-3-3.87", key: "kshegd" }],
	["path", { d: "M16 3.13a4 4 0 0 1 0 7.75", key: "1da9ce" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const WandSparkles = createLucideIcon("WandSparkles", [
	[
		"path",
		{
			d: "m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",
			key: "ul74o6",
		},
	],
	["path", { d: "m14 7 3 3", key: "1r5n42" }],
	["path", { d: "M5 6v4", key: "ilb8ba" }],
	["path", { d: "M19 14v4", key: "blhpug" }],
	["path", { d: "M10 2v2", key: "7u0qdc" }],
	["path", { d: "M7 8H3", key: "zfb6yr" }],
	["path", { d: "M21 16h-4", key: "1cnmox" }],
	["path", { d: "M11 3H9", key: "1obp7u" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const X = createLucideIcon("X", [
	["path", { d: "M18 6 6 18", key: "1bl5f8" }],
	["path", { d: "m6 6 12 12", key: "d8bk6v" }],
]);

/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

const Zap = createLucideIcon("Zap", [
	[
		"path",
		{
			d: "M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",
			key: "1xq2db",
		},
	],
]);

// src/switch.tsx
const React$d = await importShared("react");
var SWITCH_NAME = "Switch";
var [createSwitchContext] = createContextScope(SWITCH_NAME);
var [SwitchProviderImpl, useSwitchContext] = createSwitchContext(SWITCH_NAME);
function SwitchProvider(props) {
	const {
		__scopeSwitch,
		checked: checkedProp,
		children,
		defaultChecked,
		disabled,
		form,
		name,
		onCheckedChange,
		required,
		value = "on",
		// @ts-expect-error
		internal_do_not_use_render,
	} = props;
	const [checked, setChecked] = useControllableState({
		prop: checkedProp,
		defaultProp: defaultChecked ?? false,
		onChange: onCheckedChange,
		caller: SWITCH_NAME,
	});
	const [control, setControl] = React$d.useState(null);
	const [bubbleInput, setBubbleInput] = React$d.useState(null);
	const hasConsumerStoppedPropagationRef = React$d.useRef(false);
	const isFormControl =
		control ?
			!!form || !!control.closest("form")
			// We set this to true by default so that events bubble to forms without JS (SSR)
		:	true;
	const context = {
		checked,
		setChecked,
		disabled,
		control,
		setControl,
		name,
		form,
		value,
		hasConsumerStoppedPropagationRef,
		required,
		defaultChecked,
		isFormControl,
		bubbleInput,
		setBubbleInput,
	};
	return /* @__PURE__ */ jsxRuntimeExports.jsx(SwitchProviderImpl, {
		scope: __scopeSwitch,
		...context,
		children: isFunction$2(internal_do_not_use_render) ? internal_do_not_use_render(context) : children,
	});
}
var TRIGGER_NAME$2 = "SwitchTrigger";
var SwitchTrigger = React$d.forwardRef(({ __scopeSwitch, onClick, ...switchProps }, forwardedRef) => {
	const { value, disabled, checked, required, setControl, setChecked, hasConsumerStoppedPropagationRef, isFormControl, bubbleInput } = useSwitchContext(TRIGGER_NAME$2, __scopeSwitch);
	const composedRefs = useComposedRefs(forwardedRef, setControl);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.button, {
		"type": "button",
		"role": "switch",
		"aria-checked": checked,
		"aria-required": required,
		"data-state": getState$1(checked),
		"data-disabled": disabled ? "" : void 0,
		disabled,
		value,
		...switchProps,
		"ref": composedRefs,
		"onClick": composeEventHandlers(onClick, (event) => {
			setChecked((prevChecked) => !prevChecked);
			if (bubbleInput && isFormControl) {
				hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
				if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
			}
		}),
	});
});
SwitchTrigger.displayName = TRIGGER_NAME$2;
var Switch$1 = React$d.forwardRef((props, forwardedRef) => {
	const { __scopeSwitch, name, checked, defaultChecked, required, disabled, value, onCheckedChange, form, ...switchProps } = props;
	return /* @__PURE__ */ jsxRuntimeExports.jsx(SwitchProvider, {
		__scopeSwitch,
		checked,
		defaultChecked,
		disabled,
		required,
		onCheckedChange,
		name,
		form,
		value,
		internal_do_not_use_render: ({ isFormControl }) =>
			/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
				children: [
					/* @__PURE__ */ jsxRuntimeExports.jsx(SwitchTrigger, {
						...switchProps,
						ref: forwardedRef,
						__scopeSwitch,
					}),
					isFormControl &&
						/* @__PURE__ */ jsxRuntimeExports.jsx(SwitchBubbleInput, {
							__scopeSwitch,
						}),
				],
			}),
	});
});
Switch$1.displayName = SWITCH_NAME;
var THUMB_NAME = "SwitchThumb";
var SwitchThumb = React$d.forwardRef((props, forwardedRef) => {
	const { __scopeSwitch, ...thumbProps } = props;
	const context = useSwitchContext(THUMB_NAME, __scopeSwitch);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.span, {
		"data-state": getState$1(context.checked),
		"data-disabled": context.disabled ? "" : void 0,
		...thumbProps,
		"ref": forwardedRef,
	});
});
SwitchThumb.displayName = THUMB_NAME;
var BUBBLE_INPUT_NAME$1 = "SwitchBubbleInput";
var SwitchBubbleInput = React$d.forwardRef(({ __scopeSwitch, ...props }, forwardedRef) => {
	const { control, hasConsumerStoppedPropagationRef, checked, defaultChecked, required, disabled, name, value, form, bubbleInput, setBubbleInput } = useSwitchContext(
		BUBBLE_INPUT_NAME$1,
		__scopeSwitch,
	);
	const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);
	const prevChecked = usePrevious$1(checked);
	const controlSize = useSize(control);
	React$d.useEffect(() => {
		const input = bubbleInput;
		if (!input) return;
		const inputProto = window.HTMLInputElement.prototype;
		const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
		const setChecked = descriptor.set;
		const bubbles = !hasConsumerStoppedPropagationRef.current;
		if (prevChecked !== checked && setChecked) {
			const event = new Event("click", { bubbles });
			setChecked.call(input, checked);
			input.dispatchEvent(event);
		}
	}, [bubbleInput, prevChecked, checked, hasConsumerStoppedPropagationRef]);
	const defaultCheckedRef = React$d.useRef(checked);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.input, {
		"type": "checkbox",
		"aria-hidden": true,
		"defaultChecked": defaultChecked ?? defaultCheckedRef.current,
		required,
		disabled,
		name,
		value,
		form,
		...props,
		"tabIndex": -1,
		"ref": composedRefs,
		"style": {
			...props.style,
			...controlSize,
			position: "absolute",
			pointerEvents: "none",
			opacity: 0,
			margin: 0,
			// We transform because the input is absolutely positioned but we have
			// rendered it **after** the button. This pulls it back to sit on top
			// of the button.
			transform: "translateX(-100%)",
		},
	});
});
SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME$1;
function isFunction$2(value) {
	return typeof value === "function";
}
function getState$1(checked) {
	return checked ? "checked" : "unchecked";
}

// src/checkbox.tsx
const React$c = await importShared("react");
var CHECKBOX_NAME = "Checkbox";
var [createCheckboxContext] = createContextScope(CHECKBOX_NAME);
var [CheckboxProviderImpl, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
function CheckboxProvider(props) {
	const {
		__scopeCheckbox,
		checked: checkedProp,
		children,
		defaultChecked,
		disabled,
		form,
		name,
		onCheckedChange,
		required,
		value = "on",
		// @ts-expect-error
		internal_do_not_use_render,
	} = props;
	const [checked, setChecked] = useControllableState({
		prop: checkedProp,
		defaultProp: defaultChecked ?? false,
		onChange: onCheckedChange,
		caller: CHECKBOX_NAME,
	});
	const [control, setControl] = React$c.useState(null);
	const [bubbleInput, setBubbleInput] = React$c.useState(null);
	const hasConsumerStoppedPropagationRef = React$c.useRef(false);
	const isFormControl =
		control ?
			!!form || !!control.closest("form")
			// We set this to true by default so that events bubble to forms without JS (SSR)
		:	true;
	const context = {
		checked,
		disabled,
		setChecked,
		control,
		setControl,
		name,
		form,
		value,
		hasConsumerStoppedPropagationRef,
		required,
		defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,
		isFormControl,
		bubbleInput,
		setBubbleInput,
	};
	return /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxProviderImpl, {
		scope: __scopeCheckbox,
		...context,
		children: isFunction$1(internal_do_not_use_render) ? internal_do_not_use_render(context) : children,
	});
}
var TRIGGER_NAME$1 = "CheckboxTrigger";
var CheckboxTrigger = React$c.forwardRef(({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) => {
	const { control, value, disabled, checked, required, setControl, setChecked, hasConsumerStoppedPropagationRef, isFormControl, bubbleInput } = useCheckboxContext(TRIGGER_NAME$1, __scopeCheckbox);
	const composedRefs = useComposedRefs(forwardedRef, setControl);
	const initialCheckedStateRef = React$c.useRef(checked);
	React$c.useEffect(() => {
		const form = control?.form;
		if (form) {
			const reset = () => setChecked(initialCheckedStateRef.current);
			form.addEventListener("reset", reset);
			return () => form.removeEventListener("reset", reset);
		}
	}, [control, setChecked]);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.button, {
		"type": "button",
		"role": "checkbox",
		"aria-checked": isIndeterminate(checked) ? "mixed" : checked,
		"aria-required": required,
		"data-state": getState(checked),
		"data-disabled": disabled ? "" : void 0,
		disabled,
		value,
		...checkboxProps,
		"ref": composedRefs,
		"onKeyDown": composeEventHandlers(onKeyDown, (event) => {
			if (event.key === "Enter") event.preventDefault();
		}),
		"onClick": composeEventHandlers(onClick, (event) => {
			setChecked((prevChecked) => (isIndeterminate(prevChecked) ? true : !prevChecked));
			if (bubbleInput && isFormControl) {
				hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
				if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
			}
		}),
	});
});
CheckboxTrigger.displayName = TRIGGER_NAME$1;
var Checkbox$1 = React$c.forwardRef((props, forwardedRef) => {
	const { __scopeCheckbox, name, checked, defaultChecked, required, disabled, value, onCheckedChange, form, ...checkboxProps } = props;
	return /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxProvider, {
		__scopeCheckbox,
		checked,
		defaultChecked,
		disabled,
		required,
		onCheckedChange,
		name,
		form,
		value,
		internal_do_not_use_render: ({ isFormControl }) =>
			/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
				children: [
					/* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxTrigger, {
						...checkboxProps,
						ref: forwardedRef,
						__scopeCheckbox,
					}),
					isFormControl &&
						/* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxBubbleInput, {
							__scopeCheckbox,
						}),
				],
			}),
	});
});
Checkbox$1.displayName = CHECKBOX_NAME;
var INDICATOR_NAME = "CheckboxIndicator";
var CheckboxIndicator = React$c.forwardRef((props, forwardedRef) => {
	const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
	const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, {
		present: forceMount || isIndeterminate(context.checked) || context.checked === true,
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.span, {
			"data-state": getState(context.checked),
			"data-disabled": context.disabled ? "" : void 0,
			...indicatorProps,
			"ref": forwardedRef,
			"style": { pointerEvents: "none", ...props.style },
		}),
	});
});
CheckboxIndicator.displayName = INDICATOR_NAME;
var BUBBLE_INPUT_NAME = "CheckboxBubbleInput";
var CheckboxBubbleInput = React$c.forwardRef(({ __scopeCheckbox, ...props }, forwardedRef) => {
	const { control, hasConsumerStoppedPropagationRef, checked, defaultChecked, required, disabled, name, value, form, bubbleInput, setBubbleInput } = useCheckboxContext(
		BUBBLE_INPUT_NAME,
		__scopeCheckbox,
	);
	const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);
	const prevChecked = usePrevious$1(checked);
	const controlSize = useSize(control);
	React$c.useEffect(() => {
		const input = bubbleInput;
		if (!input) return;
		const inputProto = window.HTMLInputElement.prototype;
		const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
		const setChecked = descriptor.set;
		const bubbles = !hasConsumerStoppedPropagationRef.current;
		if (prevChecked !== checked && setChecked) {
			const event = new Event("click", { bubbles });
			input.indeterminate = isIndeterminate(checked);
			setChecked.call(input, isIndeterminate(checked) ? false : checked);
			input.dispatchEvent(event);
		}
	}, [bubbleInput, prevChecked, checked, hasConsumerStoppedPropagationRef]);
	const defaultCheckedRef = React$c.useRef(isIndeterminate(checked) ? false : checked);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.input, {
		"type": "checkbox",
		"aria-hidden": true,
		"defaultChecked": defaultChecked ?? defaultCheckedRef.current,
		required,
		disabled,
		name,
		value,
		form,
		...props,
		"tabIndex": -1,
		"ref": composedRefs,
		"style": {
			...props.style,
			...controlSize,
			position: "absolute",
			pointerEvents: "none",
			opacity: 0,
			margin: 0,
			// We transform because the input is absolutely positioned but we have
			// rendered it **after** the button. This pulls it back to sit on top
			// of the button.
			transform: "translateX(-100%)",
		},
	});
});
CheckboxBubbleInput.displayName = BUBBLE_INPUT_NAME;
function isFunction$1(value) {
	return typeof value === "function";
}
function isIndeterminate(checked) {
	return checked === "indeterminate";
}
function getState(checked) {
	return (
		isIndeterminate(checked) ? "indeterminate"
		: checked ? "checked"
		: "unchecked"
	);
}

// src/alert-dialog.tsx
const React$b = await importShared("react");
var ROOT_NAME = "AlertDialog";
var [createAlertDialogContext] = createContextScope(ROOT_NAME, [createDialogScope]);
var useDialogScope = createDialogScope();
var AlertDialog$1 = (props) => {
	const { __scopeAlertDialog, ...alertDialogProps } = props;
	const dialogScope = useDialogScope(__scopeAlertDialog);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Dialog$1, { ...dialogScope, ...alertDialogProps, modal: true });
};
AlertDialog$1.displayName = ROOT_NAME;
var TRIGGER_NAME = "AlertDialogTrigger";
var AlertDialogTrigger$1 = React$b.forwardRef((props, forwardedRef) => {
	const { __scopeAlertDialog, ...triggerProps } = props;
	const dialogScope = useDialogScope(__scopeAlertDialog);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTrigger$1, { ...dialogScope, ...triggerProps, ref: forwardedRef });
});
AlertDialogTrigger$1.displayName = TRIGGER_NAME;
var PORTAL_NAME = "AlertDialogPortal";
var AlertDialogPortal$1 = (props) => {
	const { __scopeAlertDialog, ...portalProps } = props;
	const dialogScope = useDialogScope(__scopeAlertDialog);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(DialogPortal$1, { ...dialogScope, ...portalProps });
};
AlertDialogPortal$1.displayName = PORTAL_NAME;
var OVERLAY_NAME = "AlertDialogOverlay";
var AlertDialogOverlay$1 = React$b.forwardRef((props, forwardedRef) => {
	const { __scopeAlertDialog, ...overlayProps } = props;
	const dialogScope = useDialogScope(__scopeAlertDialog);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlay$1, { ...dialogScope, ...overlayProps, ref: forwardedRef });
});
AlertDialogOverlay$1.displayName = OVERLAY_NAME;
var CONTENT_NAME = "AlertDialogContent";
var [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
var AlertDialogContent$1 = React$b.forwardRef((props, forwardedRef) => {
	const { __scopeAlertDialog, children, ...contentProps } = props;
	const dialogScope = useDialogScope(__scopeAlertDialog);
	const contentRef = React$b.useRef(null);
	const composedRefs = useComposedRefs(forwardedRef, contentRef);
	const cancelRef = React$b.useRef(null);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialogContentProvider, {
		scope: __scopeAlertDialog,
		cancelRef,
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContent$1, {
			role: "alertdialog",
			...dialogScope,
			...contentProps,
			ref: composedRefs,
			onOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
				event.preventDefault();
				cancelRef.current?.focus({ preventScroll: true });
			}),
			onPointerDownOutside: (event) => event.preventDefault(),
			onInteractOutside: (event) => event.preventDefault(),
			children,
		}),
	});
});
AlertDialogContent$1.displayName = CONTENT_NAME;
var TITLE_NAME = "AlertDialogTitle";
var AlertDialogTitle$1 = React$b.forwardRef((props, forwardedRef) => {
	const { __scopeAlertDialog, ...titleProps } = props;
	const dialogScope = useDialogScope(__scopeAlertDialog);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle$1, { ...dialogScope, ...titleProps, ref: forwardedRef });
});
AlertDialogTitle$1.displayName = TITLE_NAME;
var DESCRIPTION_NAME = "AlertDialogDescription";
var AlertDialogDescription$1 = React$b.forwardRef((props, forwardedRef) => {
	const { __scopeAlertDialog, ...descriptionProps } = props;
	const dialogScope = useDialogScope(__scopeAlertDialog);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(DialogDescription$1, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
});
AlertDialogDescription$1.displayName = DESCRIPTION_NAME;
var ACTION_NAME = "AlertDialogAction";
var AlertDialogAction$1 = React$b.forwardRef((props, forwardedRef) => {
	const { __scopeAlertDialog, ...actionProps } = props;
	const dialogScope = useDialogScope(__scopeAlertDialog);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(DialogClose$1, { ...dialogScope, ...actionProps, ref: forwardedRef });
});
AlertDialogAction$1.displayName = ACTION_NAME;
var CANCEL_NAME = "AlertDialogCancel";
var AlertDialogCancel$1 = React$b.forwardRef((props, forwardedRef) => {
	const { __scopeAlertDialog, ...cancelProps } = props;
	const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
	const dialogScope = useDialogScope(__scopeAlertDialog);
	const ref = useComposedRefs(forwardedRef, cancelRef);
	return /* @__PURE__ */ jsxRuntimeExports.jsx(DialogClose$1, { ...dialogScope, ...cancelProps, ref });
});
AlertDialogCancel$1.displayName = CANCEL_NAME;
var Root2 = AlertDialog$1;
var Trigger2 = AlertDialogTrigger$1;
var Portal2 = AlertDialogPortal$1;
var Overlay2 = AlertDialogOverlay$1;
var Content2 = AlertDialogContent$1;
var Action$1 = AlertDialogAction$1;
var Cancel = AlertDialogCancel$1;
var Title2 = AlertDialogTitle$1;
var Description2 = AlertDialogDescription$1;

function __insertCSS(code) {
	if (typeof document == "undefined") return;
	let head = document.head || document.getElementsByTagName("head")[0];
	let style = document.createElement("style");
	style.type = "text/css";
	head.appendChild(style);
	style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code));
}

const React$a = await importShared("react");

const ReactDOM = await importShared("react-dom");

const getAsset = (type) => {
	switch (type) {
		case "success":
			return SuccessIcon;
		case "info":
			return InfoIcon;
		case "warning":
			return WarningIcon;
		case "error":
			return ErrorIcon;
		default:
			return null;
	}
};
const bars = Array(12).fill(0);
const Loader = ({ visible, className }) => {
	return /*#__PURE__*/ React$a.createElement(
		"div",
		{
			"className": ["sonner-loading-wrapper", className].filter(Boolean).join(" "),
			"data-visible": visible,
		},
		/*#__PURE__*/ React$a.createElement(
			"div",
			{
				className: "sonner-spinner",
			},
			bars.map((_, i) =>
				/*#__PURE__*/ React$a.createElement("div", {
					className: "sonner-loading-bar",
					key: `spinner-bar-${i}`,
				}),
			),
		),
	);
};
const SuccessIcon = /*#__PURE__*/ React$a.createElement(
	"svg",
	{
		xmlns: "http://www.w3.org/2000/svg",
		viewBox: "0 0 20 20",
		fill: "currentColor",
		height: "20",
		width: "20",
	},
	/*#__PURE__*/ React$a.createElement("path", {
		fillRule: "evenodd",
		d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
		clipRule: "evenodd",
	}),
);
const WarningIcon = /*#__PURE__*/ React$a.createElement(
	"svg",
	{
		xmlns: "http://www.w3.org/2000/svg",
		viewBox: "0 0 24 24",
		fill: "currentColor",
		height: "20",
		width: "20",
	},
	/*#__PURE__*/ React$a.createElement("path", {
		fillRule: "evenodd",
		d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
		clipRule: "evenodd",
	}),
);
const InfoIcon = /*#__PURE__*/ React$a.createElement(
	"svg",
	{
		xmlns: "http://www.w3.org/2000/svg",
		viewBox: "0 0 20 20",
		fill: "currentColor",
		height: "20",
		width: "20",
	},
	/*#__PURE__*/ React$a.createElement("path", {
		fillRule: "evenodd",
		d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
		clipRule: "evenodd",
	}),
);
const ErrorIcon = /*#__PURE__*/ React$a.createElement(
	"svg",
	{
		xmlns: "http://www.w3.org/2000/svg",
		viewBox: "0 0 20 20",
		fill: "currentColor",
		height: "20",
		width: "20",
	},
	/*#__PURE__*/ React$a.createElement("path", {
		fillRule: "evenodd",
		d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
		clipRule: "evenodd",
	}),
);
const CloseIcon = /*#__PURE__*/ React$a.createElement(
	"svg",
	{
		xmlns: "http://www.w3.org/2000/svg",
		width: "12",
		height: "12",
		viewBox: "0 0 24 24",
		fill: "none",
		stroke: "currentColor",
		strokeWidth: "1.5",
		strokeLinecap: "round",
		strokeLinejoin: "round",
	},
	/*#__PURE__*/ React$a.createElement("line", {
		x1: "18",
		y1: "6",
		x2: "6",
		y2: "18",
	}),
	/*#__PURE__*/ React$a.createElement("line", {
		x1: "6",
		y1: "6",
		x2: "18",
		y2: "18",
	}),
);

const useIsDocumentHidden = () => {
	const [isDocumentHidden, setIsDocumentHidden] = React$a.useState(document.hidden);
	React$a.useEffect(() => {
		const callback = () => {
			setIsDocumentHidden(document.hidden);
		};
		document.addEventListener("visibilitychange", callback);
		return () => window.removeEventListener("visibilitychange", callback);
	}, []);
	return isDocumentHidden;
};

let toastsCounter = 1;
class Observer {
	constructor() {
		// We use arrow functions to maintain the correct `this` reference
		this.subscribe = (subscriber) => {
			this.subscribers.push(subscriber);
			return () => {
				const index = this.subscribers.indexOf(subscriber);
				this.subscribers.splice(index, 1);
			};
		};
		this.publish = (data) => {
			this.subscribers.forEach((subscriber) => subscriber(data));
		};
		this.addToast = (data) => {
			this.publish(data);
			this.toasts = [...this.toasts, data];
		};
		this.create = (data) => {
			var _data_id;
			const { message, ...rest } = data;
			const id = typeof (data == null ? void 0 : data.id) === "number" || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
			const alreadyExists = this.toasts.find((toast) => {
				return toast.id === id;
			});
			const dismissible = data.dismissible === undefined ? true : data.dismissible;
			if (this.dismissedToasts.has(id)) {
				this.dismissedToasts.delete(id);
			}
			if (alreadyExists) {
				this.toasts = this.toasts.map((toast) => {
					if (toast.id === id) {
						this.publish({
							...toast,
							...data,
							id,
							title: message,
						});
						return {
							...toast,
							...data,
							id,
							dismissible,
							title: message,
						};
					}
					return toast;
				});
			} else {
				this.addToast({
					title: message,
					...rest,
					dismissible,
					id,
				});
			}
			return id;
		};
		this.dismiss = (id) => {
			if (id) {
				this.dismissedToasts.add(id);
				requestAnimationFrame(() =>
					this.subscribers.forEach((subscriber) =>
						subscriber({
							id,
							dismiss: true,
						}),
					),
				);
			} else {
				this.toasts.forEach((toast) => {
					this.subscribers.forEach((subscriber) =>
						subscriber({
							id: toast.id,
							dismiss: true,
						}),
					);
				});
			}
			return id;
		};
		this.message = (message, data) => {
			return this.create({
				...data,
				message,
			});
		};
		this.error = (message, data) => {
			return this.create({
				...data,
				message,
				type: "error",
			});
		};
		this.success = (message, data) => {
			return this.create({
				...data,
				type: "success",
				message,
			});
		};
		this.info = (message, data) => {
			return this.create({
				...data,
				type: "info",
				message,
			});
		};
		this.warning = (message, data) => {
			return this.create({
				...data,
				type: "warning",
				message,
			});
		};
		this.loading = (message, data) => {
			return this.create({
				...data,
				type: "loading",
				message,
			});
		};
		this.promise = (promise, data) => {
			if (!data) {
				// Nothing to show
				return;
			}
			let id = undefined;
			if (data.loading !== undefined) {
				id = this.create({
					...data,
					promise,
					type: "loading",
					message: data.loading,
					description: typeof data.description !== "function" ? data.description : undefined,
				});
			}
			const p = Promise.resolve(promise instanceof Function ? promise() : promise);
			let shouldDismiss = id !== undefined;
			let result;
			const originalPromise = p
				.then(async (response) => {
					result = ["resolve", response];
					const isReactElementResponse = React$a.isValidElement(response);
					if (isReactElementResponse) {
						shouldDismiss = false;
						this.create({
							id,
							type: "default",
							message: response,
						});
					} else if (isHttpResponse(response) && !response.ok) {
						shouldDismiss = false;
						const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
						const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
						const isExtendedResult = typeof promiseData === "object" && !React$a.isValidElement(promiseData);
						const toastSettings =
							isExtendedResult ? promiseData : (
								{
									message: promiseData,
								}
							);
						this.create({
							id,
							type: "error",
							description,
							...toastSettings,
						});
					} else if (response instanceof Error) {
						shouldDismiss = false;
						const promiseData = typeof data.error === "function" ? await data.error(response) : data.error;
						const description = typeof data.description === "function" ? await data.description(response) : data.description;
						const isExtendedResult = typeof promiseData === "object" && !React$a.isValidElement(promiseData);
						const toastSettings =
							isExtendedResult ? promiseData : (
								{
									message: promiseData,
								}
							);
						this.create({
							id,
							type: "error",
							description,
							...toastSettings,
						});
					} else if (data.success !== undefined) {
						shouldDismiss = false;
						const promiseData = typeof data.success === "function" ? await data.success(response) : data.success;
						const description = typeof data.description === "function" ? await data.description(response) : data.description;
						const isExtendedResult = typeof promiseData === "object" && !React$a.isValidElement(promiseData);
						const toastSettings =
							isExtendedResult ? promiseData : (
								{
									message: promiseData,
								}
							);
						this.create({
							id,
							type: "success",
							description,
							...toastSettings,
						});
					}
				})
				.catch(async (error) => {
					result = ["reject", error];
					if (data.error !== undefined) {
						shouldDismiss = false;
						const promiseData = typeof data.error === "function" ? await data.error(error) : data.error;
						const description = typeof data.description === "function" ? await data.description(error) : data.description;
						const isExtendedResult = typeof promiseData === "object" && !React$a.isValidElement(promiseData);
						const toastSettings =
							isExtendedResult ? promiseData : (
								{
									message: promiseData,
								}
							);
						this.create({
							id,
							type: "error",
							description,
							...toastSettings,
						});
					}
				})
				.finally(() => {
					if (shouldDismiss) {
						// Toast is still in load state (and will be indefinitely — dismiss it)
						this.dismiss(id);
						id = undefined;
					}
					data.finally == null ? void 0 : data.finally.call(data);
				});
			const unwrap = () => new Promise((resolve, reject) => originalPromise.then(() => (result[0] === "reject" ? reject(result[1]) : resolve(result[1]))).catch(reject));
			if (typeof id !== "string" && typeof id !== "number") {
				// cannot Object.assign on undefined
				return {
					unwrap,
				};
			} else {
				return Object.assign(id, {
					unwrap,
				});
			}
		};
		this.custom = (jsx, data) => {
			const id = (data == null ? void 0 : data.id) || toastsCounter++;
			this.create({
				jsx: jsx(id),
				id,
				...data,
			});
			return id;
		};
		this.getActiveToasts = () => {
			return this.toasts.filter((toast) => !this.dismissedToasts.has(toast.id));
		};
		this.subscribers = [];
		this.toasts = [];
		this.dismissedToasts = new Set();
	}
}
const ToastState = new Observer();
// bind this to the toast function
const toastFunction = (message, data) => {
	const id = (data == null ? void 0 : data.id) || toastsCounter++;
	ToastState.addToast({
		title: message,
		...data,
		id,
	});
	return id;
};
const isHttpResponse = (data) => {
	return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
};
const basicToast = toastFunction;
const getHistory = () => ToastState.toasts;
const getToasts = () => ToastState.getActiveToasts();
// We use `Object.assign` to maintain the correct types as we would lose them otherwise
const toast = Object.assign(
	basicToast,
	{
		success: ToastState.success,
		info: ToastState.info,
		warning: ToastState.warning,
		error: ToastState.error,
		custom: ToastState.custom,
		message: ToastState.message,
		promise: ToastState.promise,
		dismiss: ToastState.dismiss,
		loading: ToastState.loading,
	},
	{
		getHistory,
		getToasts,
	},
);

__insertCSS(
	"[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}",
);

function isAction(action) {
	return action.label !== undefined;
}

// Visible toasts amount
const VISIBLE_TOASTS_AMOUNT = 3;
// Viewport padding
const VIEWPORT_OFFSET = "24px";
// Mobile viewport padding
const MOBILE_VIEWPORT_OFFSET = "16px";
// Default lifetime of a toasts (in ms)
const TOAST_LIFETIME = 4000;
// Default toast width
const TOAST_WIDTH = 356;
// Default gap between toasts
const GAP = 14;
// Threshold to dismiss a toast
const SWIPE_THRESHOLD = 45;
// Equal to exit animation duration
const TIME_BEFORE_UNMOUNT = 200;
function cn$1(...classes) {
	return classes.filter(Boolean).join(" ");
}
function getDefaultSwipeDirections(position) {
	const [y, x] = position.split("-");
	const directions = [];
	if (y) {
		directions.push(y);
	}
	if (x) {
		directions.push(x);
	}
	return directions;
}
const Toast = (props) => {
	var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
	const {
		invert: ToasterInvert,
		toast,
		unstyled,
		interacting,
		setHeights,
		visibleToasts,
		heights,
		index,
		toasts,
		expanded,
		removeToast,
		defaultRichColors,
		closeButton: closeButtonFromToaster,
		style,
		cancelButtonStyle,
		actionButtonStyle,
		className = "",
		descriptionClassName = "",
		duration: durationFromToaster,
		position,
		gap,
		expandByDefault,
		classNames,
		icons,
		closeButtonAriaLabel = "Close toast",
	} = props;
	const [swipeDirection, setSwipeDirection] = React$a.useState(null);
	const [swipeOutDirection, setSwipeOutDirection] = React$a.useState(null);
	const [mounted, setMounted] = React$a.useState(false);
	const [removed, setRemoved] = React$a.useState(false);
	const [swiping, setSwiping] = React$a.useState(false);
	const [swipeOut, setSwipeOut] = React$a.useState(false);
	const [isSwiped, setIsSwiped] = React$a.useState(false);
	const [offsetBeforeRemove, setOffsetBeforeRemove] = React$a.useState(0);
	const [initialHeight, setInitialHeight] = React$a.useState(0);
	const remainingTime = React$a.useRef(toast.duration || durationFromToaster || TOAST_LIFETIME);
	const dragStartTime = React$a.useRef(null);
	const toastRef = React$a.useRef(null);
	const isFront = index === 0;
	const isVisible = index + 1 <= visibleToasts;
	const toastType = toast.type;
	const dismissible = toast.dismissible !== false;
	const toastClassname = toast.className || "";
	const toastDescriptionClassname = toast.descriptionClassName || "";
	// Height index is used to calculate the offset as it gets updated before the toast array, which means we can calculate the new layout faster.
	const heightIndex = React$a.useMemo(() => heights.findIndex((height) => height.toastId === toast.id) || 0, [heights, toast.id]);
	const closeButton = React$a.useMemo(() => {
		var _toast_closeButton;
		return (_toast_closeButton = toast.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
	}, [toast.closeButton, closeButtonFromToaster]);
	const duration = React$a.useMemo(() => toast.duration || durationFromToaster || TOAST_LIFETIME, [toast.duration, durationFromToaster]);
	const closeTimerStartTimeRef = React$a.useRef(0);
	const offset = React$a.useRef(0);
	const lastCloseTimerStartTimeRef = React$a.useRef(0);
	const pointerStartRef = React$a.useRef(null);
	const [y, x] = position.split("-");
	const toastsHeightBefore = React$a.useMemo(() => {
		return heights.reduce((prev, curr, reducerIndex) => {
			// Calculate offset up until current toast
			if (reducerIndex >= heightIndex) {
				return prev;
			}
			return prev + curr.height;
		}, 0);
	}, [heights, heightIndex]);
	const isDocumentHidden = useIsDocumentHidden();
	const invert = toast.invert || ToasterInvert;
	const disabled = toastType === "loading";
	offset.current = React$a.useMemo(() => heightIndex * gap + toastsHeightBefore, [heightIndex, toastsHeightBefore]);
	React$a.useEffect(() => {
		remainingTime.current = duration;
	}, [duration]);
	React$a.useEffect(() => {
		// Trigger enter animation without using CSS animation
		setMounted(true);
	}, []);
	React$a.useEffect(() => {
		const toastNode = toastRef.current;
		if (toastNode) {
			const height = toastNode.getBoundingClientRect().height;
			// Add toast height to heights array after the toast is mounted
			setInitialHeight(height);
			setHeights((h) => [
				{
					toastId: toast.id,
					height,
					position: toast.position,
				},
				...h,
			]);
			return () => setHeights((h) => h.filter((height) => height.toastId !== toast.id));
		}
	}, [setHeights, toast.id]);
	React$a.useLayoutEffect(() => {
		// Keep height up to date with the content in case it updates
		if (!mounted) return;
		const toastNode = toastRef.current;
		const originalHeight = toastNode.style.height;
		toastNode.style.height = "auto";
		const newHeight = toastNode.getBoundingClientRect().height;
		toastNode.style.height = originalHeight;
		setInitialHeight(newHeight);
		setHeights((heights) => {
			const alreadyExists = heights.find((height) => height.toastId === toast.id);
			if (!alreadyExists) {
				return [
					{
						toastId: toast.id,
						height: newHeight,
						position: toast.position,
					},
					...heights,
				];
			} else {
				return heights.map((height) =>
					height.toastId === toast.id ?
						{
							...height,
							height: newHeight,
						}
					:	height,
				);
			}
		});
	}, [mounted, toast.title, toast.description, setHeights, toast.id, toast.jsx, toast.action, toast.cancel]);
	const deleteToast = React$a.useCallback(() => {
		// Save the offset for the exit swipe animation
		setRemoved(true);
		setOffsetBeforeRemove(offset.current);
		setHeights((h) => h.filter((height) => height.toastId !== toast.id));
		setTimeout(() => {
			removeToast(toast);
		}, TIME_BEFORE_UNMOUNT);
	}, [toast, removeToast, setHeights, offset]);
	React$a.useEffect(() => {
		if ((toast.promise && toastType === "loading") || toast.duration === Infinity || toast.type === "loading") return;
		let timeoutId;
		// Pause the timer on each hover
		const pauseTimer = () => {
			if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
				// Get the elapsed time since the timer started
				const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current;
				remainingTime.current = remainingTime.current - elapsedTime;
			}
			lastCloseTimerStartTimeRef.current = new Date().getTime();
		};
		const startTimer = () => {
			// setTimeout(, Infinity) behaves as if the delay is 0.
			// As a result, the toast would be closed immediately, giving the appearance that it was never rendered.
			// See: https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#an-infinite-timeout
			if (remainingTime.current === Infinity) return;
			closeTimerStartTimeRef.current = new Date().getTime();
			// Let the toast know it has started
			timeoutId = setTimeout(() => {
				toast.onAutoClose == null ? void 0 : toast.onAutoClose.call(toast, toast);
				deleteToast();
			}, remainingTime.current);
		};
		if (expanded || interacting || isDocumentHidden) {
			pauseTimer();
		} else {
			startTimer();
		}
		return () => clearTimeout(timeoutId);
	}, [expanded, interacting, toast, toastType, isDocumentHidden, deleteToast]);
	React$a.useEffect(() => {
		if (toast.delete) {
			deleteToast();
			toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);
		}
	}, [deleteToast, toast.delete]);
	function getLoadingIcon() {
		var _toast_classNames;
		if (icons == null ? void 0 : icons.loading) {
			var _toast_classNames1;
			return /*#__PURE__*/ React$a.createElement(
				"div",
				{
					"className": cn$1(
						classNames == null ? void 0 : classNames.loader,
						toast == null ? void 0
						: (_toast_classNames1 = toast.classNames) == null ? void 0
						: _toast_classNames1.loader,
						"sonner-loader",
					),
					"data-visible": toastType === "loading",
				},
				icons.loading,
			);
		}
		return /*#__PURE__*/ React$a.createElement(Loader, {
			className: cn$1(
				classNames == null ? void 0 : classNames.loader,
				toast == null ? void 0
				: (_toast_classNames = toast.classNames) == null ? void 0
				: _toast_classNames.loader,
			),
			visible: toastType === "loading",
		});
	}
	const icon = toast.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
	var _toast_richColors, _icons_close;
	return /*#__PURE__*/ React$a.createElement(
		"li",
		{
			"tabIndex": 0,
			"ref": toastRef,
			"className": cn$1(
				className,
				toastClassname,
				classNames == null ? void 0 : classNames.toast,
				toast == null ? void 0
				: (_toast_classNames = toast.classNames) == null ? void 0
				: _toast_classNames.toast,
				classNames == null ? void 0 : classNames.default,
				classNames == null ? void 0 : classNames[toastType],
				toast == null ? void 0
				: (_toast_classNames1 = toast.classNames) == null ? void 0
				: _toast_classNames1[toastType],
			),
			"data-sonner-toast": "",
			"data-rich-colors": (_toast_richColors = toast.richColors) != null ? _toast_richColors : defaultRichColors,
			"data-styled": !Boolean(toast.jsx || toast.unstyled || unstyled),
			"data-mounted": mounted,
			"data-promise": Boolean(toast.promise),
			"data-swiped": isSwiped,
			"data-removed": removed,
			"data-visible": isVisible,
			"data-y-position": y,
			"data-x-position": x,
			"data-index": index,
			"data-front": isFront,
			"data-swiping": swiping,
			"data-dismissible": dismissible,
			"data-type": toastType,
			"data-invert": invert,
			"data-swipe-out": swipeOut,
			"data-swipe-direction": swipeOutDirection,
			"data-expanded": Boolean(expanded || (expandByDefault && mounted)),
			"data-testid": toast.testId,
			"style": {
				"--index": index,
				"--toasts-before": index,
				"--z-index": toasts.length - index,
				"--offset": `${removed ? offsetBeforeRemove : offset.current}px`,
				"--initial-height": expandByDefault ? "auto" : `${initialHeight}px`,
				...style,
				...toast.style,
			},
			"onDragEnd": () => {
				setSwiping(false);
				setSwipeDirection(null);
				pointerStartRef.current = null;
			},
			"onPointerDown": (event) => {
				if (event.button === 2) return; // Return early on right click
				if (disabled || !dismissible) return;
				dragStartTime.current = new Date();
				setOffsetBeforeRemove(offset.current);
				// Ensure we maintain correct pointer capture even when going outside of the toast (e.g. when swiping)
				event.target.setPointerCapture(event.pointerId);
				if (event.target.tagName === "BUTTON") return;
				setSwiping(true);
				pointerStartRef.current = {
					x: event.clientX,
					y: event.clientY,
				};
			},
			"onPointerUp": () => {
				var _toastRef_current, _toastRef_current1, _dragStartTime_current;
				if (swipeOut || !dismissible) return;
				pointerStartRef.current = null;
				const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0);
				const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0);
				const timeTaken = new Date().getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());
				const swipeAmount = swipeDirection === "x" ? swipeAmountX : swipeAmountY;
				const velocity = Math.abs(swipeAmount) / timeTaken;
				if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
					setOffsetBeforeRemove(offset.current);
					toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);
					if (swipeDirection === "x") {
						setSwipeOutDirection(swipeAmountX > 0 ? "right" : "left");
					} else {
						setSwipeOutDirection(swipeAmountY > 0 ? "down" : "up");
					}
					deleteToast();
					setSwipeOut(true);
					return;
				} else {
					var _toastRef_current2, _toastRef_current3;
					(_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty("--swipe-amount-x", `0px`);
					(_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty("--swipe-amount-y", `0px`);
				}
				setIsSwiped(false);
				setSwiping(false);
				setSwipeDirection(null);
			},
			"onPointerMove": (event) => {
				var _window_getSelection, // Apply transform using both x and y values
					_toastRef_current,
					_toastRef_current1;
				if (!pointerStartRef.current || !dismissible) return;
				const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0;
				if (isHighlighted) return;
				const yDelta = event.clientY - pointerStartRef.current.y;
				const xDelta = event.clientX - pointerStartRef.current.x;
				var _props_swipeDirections;
				const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position);
				// Determine swipe direction if not already locked
				if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {
					setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? "x" : "y");
				}
				let swipeAmount = {
					x: 0,
					y: 0,
				};
				const getDampening = (delta) => {
					const factor = Math.abs(delta) / 20;
					return 1 / (1.5 + factor);
				};
				// Only apply swipe in the locked direction
				if (swipeDirection === "y") {
					// Handle vertical swipes
					if (swipeDirections.includes("top") || swipeDirections.includes("bottom")) {
						if ((swipeDirections.includes("top") && yDelta < 0) || (swipeDirections.includes("bottom") && yDelta > 0)) {
							swipeAmount.y = yDelta;
						} else {
							// Smoothly transition to dampened movement
							const dampenedDelta = yDelta * getDampening(yDelta);
							// Ensure we don't jump when transitioning to dampened movement
							swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;
						}
					}
				} else if (swipeDirection === "x") {
					// Handle horizontal swipes
					if (swipeDirections.includes("left") || swipeDirections.includes("right")) {
						if ((swipeDirections.includes("left") && xDelta < 0) || (swipeDirections.includes("right") && xDelta > 0)) {
							swipeAmount.x = xDelta;
						} else {
							// Smoothly transition to dampened movement
							const dampenedDelta = xDelta * getDampening(xDelta);
							// Ensure we don't jump when transitioning to dampened movement
							swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;
						}
					}
				}
				if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {
					setIsSwiped(true);
				}
				(_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty("--swipe-amount-x", `${swipeAmount.x}px`);
				(_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty("--swipe-amount-y", `${swipeAmount.y}px`);
			},
		},
		closeButton && !toast.jsx && toastType !== "loading" ?
			/*#__PURE__*/ React$a.createElement(
				"button",
				{
					"aria-label": closeButtonAriaLabel,
					"data-disabled": disabled,
					"data-close-button": true,
					"onClick":
						disabled || !dismissible ?
							() => {}
						:	() => {
								deleteToast();
								toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);
							},
					"className": cn$1(
						classNames == null ? void 0 : classNames.closeButton,
						toast == null ? void 0
						: (_toast_classNames2 = toast.classNames) == null ? void 0
						: _toast_classNames2.closeButton,
					),
				},
				(_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon,
			)
		:	null,
		(toastType || toast.icon || toast.promise) && toast.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast.icon) ?
			/*#__PURE__*/ React$a.createElement(
				"div",
				{
					"data-icon": "",
					"className": cn$1(
						classNames == null ? void 0 : classNames.icon,
						toast == null ? void 0
						: (_toast_classNames3 = toast.classNames) == null ? void 0
						: _toast_classNames3.icon,
					),
				},
				toast.promise || (toast.type === "loading" && !toast.icon) ? toast.icon || getLoadingIcon() : null,
				toast.type !== "loading" ? icon : null,
			)
		:	null,
		/*#__PURE__*/ React$a.createElement(
			"div",
			{
				"data-content": "",
				"className": cn$1(
					classNames == null ? void 0 : classNames.content,
					toast == null ? void 0
					: (_toast_classNames4 = toast.classNames) == null ? void 0
					: _toast_classNames4.content,
				),
			},
			/*#__PURE__*/ React$a.createElement(
				"div",
				{
					"data-title": "",
					"className": cn$1(
						classNames == null ? void 0 : classNames.title,
						toast == null ? void 0
						: (_toast_classNames5 = toast.classNames) == null ? void 0
						: _toast_classNames5.title,
					),
				},
				toast.jsx ? toast.jsx
				: typeof toast.title === "function" ? toast.title()
				: toast.title,
			),
			toast.description ?
				/*#__PURE__*/ React$a.createElement(
					"div",
					{
						"data-description": "",
						"className": cn$1(
							descriptionClassName,
							toastDescriptionClassname,
							classNames == null ? void 0 : classNames.description,
							toast == null ? void 0
							: (_toast_classNames6 = toast.classNames) == null ? void 0
							: _toast_classNames6.description,
						),
					},
					typeof toast.description === "function" ? toast.description() : toast.description,
				)
			:	null,
		),
		/*#__PURE__*/ React$a.isValidElement(toast.cancel) ? toast.cancel
		: toast.cancel && isAction(toast.cancel) ?
			/*#__PURE__*/ React$a.createElement(
				"button",
				{
					"data-button": true,
					"data-cancel": true,
					"style": toast.cancelButtonStyle || cancelButtonStyle,
					"onClick": (event) => {
						// We need to check twice because typescript
						if (!isAction(toast.cancel)) return;
						if (!dismissible) return;
						toast.cancel.onClick == null ? void 0 : toast.cancel.onClick.call(toast.cancel, event);
						deleteToast();
					},
					"className": cn$1(
						classNames == null ? void 0 : classNames.cancelButton,
						toast == null ? void 0
						: (_toast_classNames7 = toast.classNames) == null ? void 0
						: _toast_classNames7.cancelButton,
					),
				},
				toast.cancel.label,
			)
		:	null,
		/*#__PURE__*/ React$a.isValidElement(toast.action) ? toast.action
		: toast.action && isAction(toast.action) ?
			/*#__PURE__*/ React$a.createElement(
				"button",
				{
					"data-button": true,
					"data-action": true,
					"style": toast.actionButtonStyle || actionButtonStyle,
					"onClick": (event) => {
						// We need to check twice because typescript
						if (!isAction(toast.action)) return;
						toast.action.onClick == null ? void 0 : toast.action.onClick.call(toast.action, event);
						if (event.defaultPrevented) return;
						deleteToast();
					},
					"className": cn$1(
						classNames == null ? void 0 : classNames.actionButton,
						toast == null ? void 0
						: (_toast_classNames8 = toast.classNames) == null ? void 0
						: _toast_classNames8.actionButton,
					),
				},
				toast.action.label,
			)
		:	null,
	);
};
function getDocumentDirection() {
	if (typeof window === "undefined") return "ltr";
	if (typeof document === "undefined") return "ltr"; // For Fresh purpose
	const dirAttribute = document.documentElement.getAttribute("dir");
	if (dirAttribute === "auto" || !dirAttribute) {
		return window.getComputedStyle(document.documentElement).direction;
	}
	return dirAttribute;
}
function assignOffset(defaultOffset, mobileOffset) {
	const styles = {};
	[defaultOffset, mobileOffset].forEach((offset, index) => {
		const isMobile = index === 1;
		const prefix = isMobile ? "--mobile-offset" : "--offset";
		const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;
		function assignAll(offset) {
			["top", "right", "bottom", "left"].forEach((key) => {
				styles[`${prefix}-${key}`] = typeof offset === "number" ? `${offset}px` : offset;
			});
		}
		if (typeof offset === "number" || typeof offset === "string") {
			assignAll(offset);
		} else if (typeof offset === "object") {
			["top", "right", "bottom", "left"].forEach((key) => {
				if (offset[key] === undefined) {
					styles[`${prefix}-${key}`] = defaultValue;
				} else {
					styles[`${prefix}-${key}`] = typeof offset[key] === "number" ? `${offset[key]}px` : offset[key];
				}
			});
		} else {
			assignAll(defaultValue);
		}
	});
	return styles;
}
const Toaster$1 = /*#__PURE__*/ React$a.forwardRef(function Toaster(props, ref) {
	const {
		id,
		invert,
		position = "bottom-right",
		hotkey = ["altKey", "KeyT"],
		expand,
		closeButton,
		className,
		offset,
		mobileOffset,
		theme = "light",
		richColors,
		duration,
		style,
		visibleToasts = VISIBLE_TOASTS_AMOUNT,
		toastOptions,
		dir = getDocumentDirection(),
		gap = GAP,
		icons,
		containerAriaLabel = "Notifications",
	} = props;
	const [toasts, setToasts] = React$a.useState([]);
	const filteredToasts = React$a.useMemo(() => {
		if (id) {
			return toasts.filter((toast) => toast.toasterId === id);
		}
		return toasts.filter((toast) => !toast.toasterId);
	}, [toasts, id]);
	const possiblePositions = React$a.useMemo(() => {
		return Array.from(new Set([position].concat(filteredToasts.filter((toast) => toast.position).map((toast) => toast.position))));
	}, [filteredToasts, position]);
	const [heights, setHeights] = React$a.useState([]);
	const [expanded, setExpanded] = React$a.useState(false);
	const [interacting, setInteracting] = React$a.useState(false);
	const [actualTheme, setActualTheme] = React$a.useState(
		theme !== "system" ? theme
		: typeof window !== "undefined" ?
			window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ?
				"dark"
			:	"light"
		:	"light",
	);
	const listRef = React$a.useRef(null);
	const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
	const lastFocusedElementRef = React$a.useRef(null);
	const isFocusWithinRef = React$a.useRef(false);
	const removeToast = React$a.useCallback((toastToRemove) => {
		setToasts((toasts) => {
			var _toasts_find;
			if (!((_toasts_find = toasts.find((toast) => toast.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
				ToastState.dismiss(toastToRemove.id);
			}
			return toasts.filter(({ id }) => id !== toastToRemove.id);
		});
	}, []);
	React$a.useEffect(() => {
		return ToastState.subscribe((toast) => {
			if (toast.dismiss) {
				// Prevent batching of other state updates
				requestAnimationFrame(() => {
					setToasts((toasts) =>
						toasts.map((t) =>
							t.id === toast.id ?
								{
									...t,
									delete: true,
								}
							:	t,
						),
					);
				});
				return;
			}
			// Prevent batching, temp solution.
			setTimeout(() => {
				ReactDOM.flushSync(() => {
					setToasts((toasts) => {
						const indexOfExistingToast = toasts.findIndex((t) => t.id === toast.id);
						// Update the toast if it already exists
						if (indexOfExistingToast !== -1) {
							return [
								...toasts.slice(0, indexOfExistingToast),
								{
									...toasts[indexOfExistingToast],
									...toast,
								},
								...toasts.slice(indexOfExistingToast + 1),
							];
						}
						return [toast, ...toasts];
					});
				});
			});
		});
	}, [toasts]);
	React$a.useEffect(() => {
		if (theme !== "system") {
			setActualTheme(theme);
			return;
		}
		if (theme === "system") {
			// check if current preference is dark
			if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
				// it's currently dark
				setActualTheme("dark");
			} else {
				// it's not dark
				setActualTheme("light");
			}
		}
		if (typeof window === "undefined") return;
		const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
		try {
			// Chrome & Firefox
			darkMediaQuery.addEventListener("change", ({ matches }) => {
				if (matches) {
					setActualTheme("dark");
				} else {
					setActualTheme("light");
				}
			});
		} catch (error) {
			// Safari < 14
			darkMediaQuery.addListener(({ matches }) => {
				try {
					if (matches) {
						setActualTheme("dark");
					} else {
						setActualTheme("light");
					}
				} catch (e) {
					console.error(e);
				}
			});
		}
	}, [theme]);
	React$a.useEffect(() => {
		// Ensure expanded is always false when no toasts are present / only one left
		if (toasts.length <= 1) {
			setExpanded(false);
		}
	}, [toasts]);
	React$a.useEffect(() => {
		const handleKeyDown = (event) => {
			var _listRef_current;
			const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
			if (isHotkeyPressed) {
				var _listRef_current1;
				setExpanded(true);
				(_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus();
			}
			if (
				event.code === "Escape" &&
				(document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))
			) {
				setExpanded(false);
			}
		};
		document.addEventListener("keydown", handleKeyDown);
		return () => document.removeEventListener("keydown", handleKeyDown);
	}, [hotkey]);
	React$a.useEffect(() => {
		if (listRef.current) {
			return () => {
				if (lastFocusedElementRef.current) {
					lastFocusedElementRef.current.focus({
						preventScroll: true,
					});
					lastFocusedElementRef.current = null;
					isFocusWithinRef.current = false;
				}
			};
		}
	}, [listRef.current]);
	return (
		// Remove item from normal navigation flow, only available via hotkey
		/*#__PURE__*/ React$a.createElement(
			"section",
			{
				"ref": ref,
				"aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
				"tabIndex": -1,
				"aria-live": "polite",
				"aria-relevant": "additions text",
				"aria-atomic": "false",
				"suppressHydrationWarning": true,
			},
			possiblePositions.map((position, index) => {
				var _heights_;
				const [y, x] = position.split("-");
				if (!filteredToasts.length) return null;
				return /*#__PURE__*/ React$a.createElement(
					"ol",
					{
						"key": position,
						"dir": dir === "auto" ? getDocumentDirection() : dir,
						"tabIndex": -1,
						"ref": listRef,
						"className": className,
						"data-sonner-toaster": true,
						"data-sonner-theme": actualTheme,
						"data-y-position": y,
						"data-x-position": x,
						"style": {
							"--front-toast-height": `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`,
							"--width": `${TOAST_WIDTH}px`,
							"--gap": `${gap}px`,
							...style,
							...assignOffset(offset, mobileOffset),
						},
						"onBlur": (event) => {
							if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {
								isFocusWithinRef.current = false;
								if (lastFocusedElementRef.current) {
									lastFocusedElementRef.current.focus({
										preventScroll: true,
									});
									lastFocusedElementRef.current = null;
								}
							}
						},
						"onFocus": (event) => {
							const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
							if (isNotDismissible) return;
							if (!isFocusWithinRef.current) {
								isFocusWithinRef.current = true;
								lastFocusedElementRef.current = event.relatedTarget;
							}
						},
						"onMouseEnter": () => setExpanded(true),
						"onMouseMove": () => setExpanded(true),
						"onMouseLeave": () => {
							// Avoid setting expanded to false when interacting with a toast, e.g. swiping
							if (!interacting) {
								setExpanded(false);
							}
						},
						"onDragEnd": () => setExpanded(false),
						"onPointerDown": (event) => {
							const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
							if (isNotDismissible) return;
							setInteracting(true);
						},
						"onPointerUp": () => setInteracting(false),
					},
					filteredToasts
						.filter((toast) => (!toast.position && index === 0) || toast.position === position)
						.map((toast, index) => {
							var _toastOptions_duration, _toastOptions_closeButton;
							return /*#__PURE__*/ React$a.createElement(Toast, {
								key: toast.id,
								icons: icons,
								index: index,
								toast: toast,
								defaultRichColors: richColors,
								duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration,
								className: toastOptions == null ? void 0 : toastOptions.className,
								descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName,
								invert: invert,
								visibleToasts: visibleToasts,
								closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton,
								interacting: interacting,
								position: position,
								style: toastOptions == null ? void 0 : toastOptions.style,
								unstyled: toastOptions == null ? void 0 : toastOptions.unstyled,
								classNames: toastOptions == null ? void 0 : toastOptions.classNames,
								cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle,
								actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
								closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
								removeToast: removeToast,
								toasts: filteredToasts.filter((t) => t.position == toast.position),
								heights: heights.filter((h) => h.position == toast.position),
								setHeights: setHeights,
								expandByDefault: expand,
								gap: gap,
								expanded: expanded,
								swipeDirections: props.swipeDirections,
							});
						}),
				);
			}),
		)
	);
});

const isString$1 = (obj) => typeof obj === "string";
const defer = () => {
	let res;
	let rej;
	const promise = new Promise((resolve, reject) => {
		res = resolve;
		rej = reject;
	});
	promise.resolve = res;
	promise.reject = rej;
	return promise;
};
const makeString = (object) => {
	if (object == null) return "";
	return String(object);
};
const copy = (a, s, t) => {
	a.forEach((m) => {
		if (s[m]) t[m] = s[m];
	});
};
const lastOfPathSeparatorRegExp = /###/g;
const cleanKey = (key) => (key && key.includes("###") ? key.replace(lastOfPathSeparatorRegExp, ".") : key);
const canNotTraverseDeeper = (object) => !object || isString$1(object);
const getLastOfPath = (object, path, Empty) => {
	const stack = !isString$1(path) ? path : path.split(".");
	let stackIndex = 0;
	while (stackIndex < stack.length - 1) {
		if (canNotTraverseDeeper(object)) return {};
		const key = cleanKey(stack[stackIndex]);
		if (!object[key] && Empty) object[key] = new Empty();
		if (Object.prototype.hasOwnProperty.call(object, key)) {
			object = object[key];
		} else {
			object = {};
		}
		++stackIndex;
	}
	if (canNotTraverseDeeper(object)) return {};
	return {
		obj: object,
		k: cleanKey(stack[stackIndex]),
	};
};
const setPath = (object, path, newValue) => {
	const { obj, k } = getLastOfPath(object, path, Object);
	if (obj !== undefined || path.length === 1) {
		obj[k] = newValue;
		return;
	}
	let e = path[path.length - 1];
	let p = path.slice(0, path.length - 1);
	let last = getLastOfPath(object, p, Object);
	while (last.obj === undefined && p.length) {
		e = `${p[p.length - 1]}.${e}`;
		p = p.slice(0, p.length - 1);
		last = getLastOfPath(object, p, Object);
		if (last?.obj && typeof last.obj[`${last.k}.${e}`] !== "undefined") {
			last.obj = undefined;
		}
	}
	last.obj[`${last.k}.${e}`] = newValue;
};
const pushPath = (object, path, newValue, concat) => {
	const { obj, k } = getLastOfPath(object, path, Object);
	obj[k] = obj[k] || [];
	obj[k].push(newValue);
};
const getPath = (object, path) => {
	const { obj, k } = getLastOfPath(object, path);
	if (!obj) return undefined;
	if (!Object.prototype.hasOwnProperty.call(obj, k)) return undefined;
	return obj[k];
};
const getPathWithDefaults = (data, defaultData, key) => {
	const value = getPath(data, key);
	if (value !== undefined) {
		return value;
	}
	return getPath(defaultData, key);
};
const deepExtend = (target, source, overwrite) => {
	for (const prop in source) {
		if (prop !== "__proto__" && prop !== "constructor") {
			if (prop in target) {
				if (isString$1(target[prop]) || target[prop] instanceof String || isString$1(source[prop]) || source[prop] instanceof String) {
					if (overwrite) target[prop] = source[prop];
				} else {
					deepExtend(target[prop], source[prop], overwrite);
				}
			} else {
				target[prop] = source[prop];
			}
		}
	}
	return target;
};
const regexEscape = (str) => str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
const _entityMap = {
	"&": "&amp;",
	"<": "&lt;",
	">": "&gt;",
	'"': "&quot;",
	"'": "&#39;",
	"/": "&#x2F;",
};
const escape = (data) => {
	if (isString$1(data)) {
		return data.replace(/[&<>"'\/]/g, (s) => _entityMap[s]);
	}
	return data;
};
class RegExpCache {
	constructor(capacity) {
		this.capacity = capacity;
		this.regExpMap = new Map();
		this.regExpQueue = [];
	}
	getRegExp(pattern) {
		const regExpFromCache = this.regExpMap.get(pattern);
		if (regExpFromCache !== undefined) {
			return regExpFromCache;
		}
		const regExpNew = new RegExp(pattern);
		if (this.regExpQueue.length === this.capacity) {
			this.regExpMap.delete(this.regExpQueue.shift());
		}
		this.regExpMap.set(pattern, regExpNew);
		this.regExpQueue.push(pattern);
		return regExpNew;
	}
}
const chars = [" ", ",", "?", "!", ";"];
const looksLikeObjectPathRegExpCache = new RegExpCache(20);
const looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
	nsSeparator = nsSeparator || "";
	keySeparator = keySeparator || "";
	const possibleChars = chars.filter((c) => !nsSeparator.includes(c) && !keySeparator.includes(c));
	if (possibleChars.length === 0) return true;
	const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map((c) => (c === "?" ? "\\?" : c)).join("|")})`);
	let matched = !r.test(key);
	if (!matched) {
		const ki = key.indexOf(keySeparator);
		if (ki > 0 && !r.test(key.substring(0, ki))) {
			matched = true;
		}
	}
	return matched;
};
const deepFind = (obj, path, keySeparator = ".") => {
	if (!obj) return undefined;
	if (obj[path]) {
		if (!Object.prototype.hasOwnProperty.call(obj, path)) return undefined;
		return obj[path];
	}
	const tokens = path.split(keySeparator);
	let current = obj;
	for (let i = 0; i < tokens.length; ) {
		if (!current || typeof current !== "object") {
			return undefined;
		}
		let next;
		let nextPath = "";
		for (let j = i; j < tokens.length; ++j) {
			if (j !== i) {
				nextPath += keySeparator;
			}
			nextPath += tokens[j];
			next = current[nextPath];
			if (next !== undefined) {
				if (["string", "number", "boolean"].includes(typeof next) && j < tokens.length - 1) {
					continue;
				}
				i += j - i + 1;
				break;
			}
		}
		current = next;
	}
	return current;
};
const getCleanedCode = (code) => code?.replace(/_/g, "-");

const consoleLogger = {
	type: "logger",
	log(args) {
		this.output("log", args);
	},
	warn(args) {
		this.output("warn", args);
	},
	error(args) {
		this.output("error", args);
	},
	output(type, args) {
		console?.[type]?.apply?.(console, args);
	},
};
class Logger {
	constructor(concreteLogger, options = {}) {
		this.init(concreteLogger, options);
	}
	init(concreteLogger, options = {}) {
		this.prefix = options.prefix || "i18next:";
		this.logger = concreteLogger || consoleLogger;
		this.options = options;
		this.debug = options.debug;
	}
	log(...args) {
		return this.forward(args, "log", "", true);
	}
	warn(...args) {
		return this.forward(args, "warn", "", true);
	}
	error(...args) {
		return this.forward(args, "error", "");
	}
	deprecate(...args) {
		return this.forward(args, "warn", "WARNING DEPRECATED: ", true);
	}
	forward(args, lvl, prefix, debugOnly) {
		if (debugOnly && !this.debug) return null;
		if (isString$1(args[0])) args[0] = `${prefix}${this.prefix} ${args[0]}`;
		return this.logger[lvl](args);
	}
	create(moduleName) {
		return new Logger(this.logger, {
			...{
				prefix: `${this.prefix}:${moduleName}:`,
			},
			...this.options,
		});
	}
	clone(options) {
		options = options || this.options;
		options.prefix = options.prefix || this.prefix;
		return new Logger(this.logger, options);
	}
}
var baseLogger = new Logger();

class EventEmitter {
	constructor() {
		this.observers = {};
	}
	on(events, listener) {
		events.split(" ").forEach((event) => {
			if (!this.observers[event]) this.observers[event] = new Map();
			const numListeners = this.observers[event].get(listener) || 0;
			this.observers[event].set(listener, numListeners + 1);
		});
		return this;
	}
	off(event, listener) {
		if (!this.observers[event]) return;
		if (!listener) {
			delete this.observers[event];
			return;
		}
		this.observers[event].delete(listener);
	}
	once(event, listener) {
		const wrapper = (...args) => {
			listener(...args);
			this.off(event, wrapper);
		};
		this.on(event, wrapper);
		return this;
	}
	emit(event, ...args) {
		if (this.observers[event]) {
			const cloned = Array.from(this.observers[event].entries());
			cloned.forEach(([observer, numTimesAdded]) => {
				for (let i = 0; i < numTimesAdded; i++) {
					observer(...args);
				}
			});
		}
		if (this.observers["*"]) {
			const cloned = Array.from(this.observers["*"].entries());
			cloned.forEach(([observer, numTimesAdded]) => {
				for (let i = 0; i < numTimesAdded; i++) {
					observer(event, ...args);
				}
			});
		}
	}
}

class ResourceStore extends EventEmitter {
	constructor(
		data,
		options = {
			ns: ["translation"],
			defaultNS: "translation",
		},
	) {
		super();
		this.data = data || {};
		this.options = options;
		if (this.options.keySeparator === undefined) {
			this.options.keySeparator = ".";
		}
		if (this.options.ignoreJSONStructure === undefined) {
			this.options.ignoreJSONStructure = true;
		}
	}
	addNamespaces(ns) {
		if (!this.options.ns.includes(ns)) {
			this.options.ns.push(ns);
		}
	}
	removeNamespaces(ns) {
		const index = this.options.ns.indexOf(ns);
		if (index > -1) {
			this.options.ns.splice(index, 1);
		}
	}
	getResource(lng, ns, key, options = {}) {
		const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
		const ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
		let path;
		if (lng.includes(".")) {
			path = lng.split(".");
		} else {
			path = [lng, ns];
			if (key) {
				if (Array.isArray(key)) {
					path.push(...key);
				} else if (isString$1(key) && keySeparator) {
					path.push(...key.split(keySeparator));
				} else {
					path.push(key);
				}
			}
		}
		const result = getPath(this.data, path);
		if (!result && !ns && !key && lng.includes(".")) {
			lng = path[0];
			ns = path[1];
			key = path.slice(2).join(".");
		}
		if (result || !ignoreJSONStructure || !isString$1(key)) return result;
		return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
	}
	addResource(
		lng,
		ns,
		key,
		value,
		options = {
			silent: false,
		},
	) {
		const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
		let path = [lng, ns];
		if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
		if (lng.includes(".")) {
			path = lng.split(".");
			value = ns;
			ns = path[1];
		}
		this.addNamespaces(ns);
		setPath(this.data, path, value);
		if (!options.silent) this.emit("added", lng, ns, key, value);
	}
	addResources(
		lng,
		ns,
		resources,
		options = {
			silent: false,
		},
	) {
		for (const m in resources) {
			if (isString$1(resources[m]) || Array.isArray(resources[m]))
				this.addResource(lng, ns, m, resources[m], {
					silent: true,
				});
		}
		if (!options.silent) this.emit("added", lng, ns, resources);
	}
	addResourceBundle(
		lng,
		ns,
		resources,
		deep,
		overwrite,
		options = {
			silent: false,
			skipCopy: false,
		},
	) {
		let path = [lng, ns];
		if (lng.includes(".")) {
			path = lng.split(".");
			deep = resources;
			resources = ns;
			ns = path[1];
		}
		this.addNamespaces(ns);
		let pack = getPath(this.data, path) || {};
		if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources));
		if (deep) {
			deepExtend(pack, resources, overwrite);
		} else {
			pack = {
				...pack,
				...resources,
			};
		}
		setPath(this.data, path, pack);
		if (!options.silent) this.emit("added", lng, ns, resources);
	}
	removeResourceBundle(lng, ns) {
		if (this.hasResourceBundle(lng, ns)) {
			delete this.data[lng][ns];
		}
		this.removeNamespaces(ns);
		this.emit("removed", lng, ns);
	}
	hasResourceBundle(lng, ns) {
		return this.getResource(lng, ns) !== undefined;
	}
	getResourceBundle(lng, ns) {
		if (!ns) ns = this.options.defaultNS;
		return this.getResource(lng, ns);
	}
	getDataByLanguage(lng) {
		return this.data[lng];
	}
	hasLanguageSomeTranslations(lng) {
		const data = this.getDataByLanguage(lng);
		const n = (data && Object.keys(data)) || [];
		return !!n.find((v) => data[v] && Object.keys(data[v]).length > 0);
	}
	toJSON() {
		return this.data;
	}
}

var postProcessor = {
	processors: {},
	addPostProcessor(module) {
		this.processors[module.name] = module;
	},
	handle(processors, value, key, options, translator) {
		processors.forEach((processor) => {
			value = this.processors[processor]?.process(value, key, options, translator) ?? value;
		});
		return value;
	},
};

const PATH_KEY = Symbol("i18next/PATH_KEY");
function createProxy() {
	const state = [];
	const handler = Object.create(null);
	let proxy;
	handler.get = (target, key) => {
		proxy?.revoke?.();
		if (key === PATH_KEY) return state;
		state.push(key);
		proxy = Proxy.revocable(target, handler);
		return proxy.proxy;
	};
	return Proxy.revocable(Object.create(null), handler).proxy;
}
function keysFromSelector(selector, opts) {
	const { [PATH_KEY]: path } = selector(createProxy());
	const keySeparator = opts?.keySeparator ?? ".";
	const nsSeparator = opts?.nsSeparator ?? ":";
	if (path.length > 1 && nsSeparator) {
		const ns = opts?.ns;
		const nsArray = Array.isArray(ns) ? ns : null;
		if (nsArray && nsArray.length > 1 && nsArray.slice(1).includes(path[0])) {
			return `${path[0]}${nsSeparator}${path.slice(1).join(keySeparator)}`;
		}
	}
	return path.join(keySeparator);
}

const shouldHandleAsObject = (res) => !isString$1(res) && typeof res !== "boolean" && typeof res !== "number";
class Translator extends EventEmitter {
	constructor(services, options = {}) {
		super();
		copy(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], services, this);
		this.options = options;
		if (this.options.keySeparator === undefined) {
			this.options.keySeparator = ".";
		}
		this.logger = baseLogger.create("translator");
		this.checkedLoadedFor = {};
	}
	changeLanguage(lng) {
		if (lng) this.language = lng;
	}
	exists(
		key,
		o = {
			interpolation: {},
		},
	) {
		const opt = {
			...o,
		};
		if (key == null) return false;
		const resolved = this.resolve(key, opt);
		if (resolved?.res === undefined) return false;
		const isObject = shouldHandleAsObject(resolved.res);
		if (opt.returnObjects === false && isObject) {
			return false;
		}
		return true;
	}
	extractFromKey(key, opt) {
		let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
		if (nsSeparator === undefined) nsSeparator = ":";
		const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
		let namespaces = opt.ns || this.options.defaultNS || [];
		const wouldCheckForNsInKey = nsSeparator && key.includes(nsSeparator);
		const seemsNaturalLanguage =
			!this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
		if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
			const m = key.match(this.interpolator.nestingRegexp);
			if (m && m.length > 0) {
				return {
					key,
					namespaces: isString$1(namespaces) ? [namespaces] : namespaces,
				};
			}
			const parts = key.split(nsSeparator);
			if (nsSeparator !== keySeparator || (nsSeparator === keySeparator && this.options.ns.includes(parts[0]))) namespaces = parts.shift();
			key = parts.join(keySeparator);
		}
		return {
			key,
			namespaces: isString$1(namespaces) ? [namespaces] : namespaces,
		};
	}
	translate(keys, o, lastKey) {
		let opt =
			typeof o === "object" ?
				{
					...o,
				}
			:	o;
		if (typeof opt !== "object" && this.options.overloadTranslationOptionHandler) {
			opt = this.options.overloadTranslationOptionHandler(arguments);
		}
		if (typeof opt === "object")
			opt = {
				...opt,
			};
		if (!opt) opt = {};
		if (keys == null) return "";
		if (typeof keys === "function")
			keys = keysFromSelector(keys, {
				...this.options,
				...opt,
			});
		if (!Array.isArray(keys)) keys = [String(keys)];
		keys = keys.map((k) =>
			typeof k === "function" ?
				keysFromSelector(k, {
					...this.options,
					...opt,
				})
			:	String(k),
		);
		const returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails;
		const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
		const { key, namespaces } = this.extractFromKey(keys[keys.length - 1], opt);
		const namespace = namespaces[namespaces.length - 1];
		let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
		if (nsSeparator === undefined) nsSeparator = ":";
		const lng = opt.lng || this.language;
		const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
		if (lng?.toLowerCase() === "cimode") {
			if (appendNamespaceToCIMode) {
				if (returnDetails) {
					return {
						res: `${namespace}${nsSeparator}${key}`,
						usedKey: key,
						exactUsedKey: key,
						usedLng: lng,
						usedNS: namespace,
						usedParams: this.getUsedParamsDetails(opt),
					};
				}
				return `${namespace}${nsSeparator}${key}`;
			}
			if (returnDetails) {
				return {
					res: key,
					usedKey: key,
					exactUsedKey: key,
					usedLng: lng,
					usedNS: namespace,
					usedParams: this.getUsedParamsDetails(opt),
				};
			}
			return key;
		}
		const resolved = this.resolve(keys, opt);
		let res = resolved?.res;
		const resUsedKey = resolved?.usedKey || key;
		const resExactUsedKey = resolved?.exactUsedKey || key;
		const noObject = ["[object Number]", "[object Function]", "[object RegExp]"];
		const joinArrays = opt.joinArrays !== undefined ? opt.joinArrays : this.options.joinArrays;
		const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
		const needsPluralHandling = opt.count !== undefined && !isString$1(opt.count);
		const hasDefaultValue = Translator.hasDefaultValue(opt);
		const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, opt) : "";
		const defaultValueSuffixOrdinalFallback =
			opt.ordinal && needsPluralHandling ?
				this.pluralResolver.getSuffix(lng, opt.count, {
					ordinal: false,
				})
			:	"";
		const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
		const defaultValue =
			(needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`]) ||
			opt[`defaultValue${defaultValueSuffix}`] ||
			opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] ||
			opt.defaultValue;
		let resForObjHndl = res;
		if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
			resForObjHndl = defaultValue;
		}
		const handleAsObject = shouldHandleAsObject(resForObjHndl);
		const resType = Object.prototype.toString.apply(resForObjHndl);
		if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && !noObject.includes(resType) && !(isString$1(joinArrays) && Array.isArray(resForObjHndl))) {
			if (!opt.returnObjects && !this.options.returnObjects) {
				if (!this.options.returnedObjectHandler) {
					this.logger.warn("accessing an object - but returnObjects options is not enabled!");
				}
				const r =
					this.options.returnedObjectHandler ?
						this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {
							...opt,
							ns: namespaces,
						})
					:	`key '${key} (${this.language})' returned an object instead of string.`;
				if (returnDetails) {
					resolved.res = r;
					resolved.usedParams = this.getUsedParamsDetails(opt);
					return resolved;
				}
				return r;
			}
			if (keySeparator) {
				const resTypeIsArray = Array.isArray(resForObjHndl);
				const copy = resTypeIsArray ? [] : {};
				const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
				for (const m in resForObjHndl) {
					if (Object.prototype.hasOwnProperty.call(resForObjHndl, m)) {
						const deepKey = `${newKeyToUse}${keySeparator}${m}`;
						if (hasDefaultValue && !res) {
							copy[m] = this.translate(deepKey, {
								...opt,
								defaultValue: shouldHandleAsObject(defaultValue) ? defaultValue[m] : undefined,
								...{
									joinArrays: false,
									ns: namespaces,
								},
							});
						} else {
							copy[m] = this.translate(deepKey, {
								...opt,
								...{
									joinArrays: false,
									ns: namespaces,
								},
							});
						}
						if (copy[m] === deepKey) copy[m] = resForObjHndl[m];
					}
				}
				res = copy;
			}
		} else if (handleAsObjectInI18nFormat && isString$1(joinArrays) && Array.isArray(res)) {
			res = res.join(joinArrays);
			if (res) res = this.extendTranslation(res, keys, opt, lastKey);
		} else {
			let usedDefault = false;
			let usedKey = false;
			if (!this.isValidLookup(res) && hasDefaultValue) {
				usedDefault = true;
				res = defaultValue;
			}
			if (!this.isValidLookup(res)) {
				usedKey = true;
				res = key;
			}
			const missingKeyNoValueFallbackToKey = opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
			const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
			const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
			if (usedKey || usedDefault || updateMissing) {
				this.logger.log(updateMissing ? "updateKey" : "missingKey", lng, namespace, key, updateMissing ? defaultValue : res);
				if (keySeparator) {
					const fk = this.resolve(key, {
						...opt,
						keySeparator: false,
					});
					if (fk && fk.res)
						this.logger.warn(
							"Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.",
						);
				}
				let lngs = [];
				const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, opt.lng || this.language);
				if (this.options.saveMissingTo === "fallback" && fallbackLngs && fallbackLngs[0]) {
					for (let i = 0; i < fallbackLngs.length; i++) {
						lngs.push(fallbackLngs[i]);
					}
				} else if (this.options.saveMissingTo === "all") {
					lngs = this.languageUtils.toResolveHierarchy(opt.lng || this.language);
				} else {
					lngs.push(opt.lng || this.language);
				}
				const send = (l, k, specificDefaultValue) => {
					const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
					if (this.options.missingKeyHandler) {
						this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, opt);
					} else if (this.backendConnector?.saveMissing) {
						this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, opt);
					}
					this.emit("missingKey", l, namespace, k, res);
				};
				if (this.options.saveMissing) {
					if (this.options.saveMissingPlurals && needsPluralHandling) {
						lngs.forEach((language) => {
							const suffixes = this.pluralResolver.getSuffixes(language, opt);
							if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && !suffixes.includes(`${this.options.pluralSeparator}zero`)) {
								suffixes.push(`${this.options.pluralSeparator}zero`);
							}
							suffixes.forEach((suffix) => {
								send([language], key + suffix, opt[`defaultValue${suffix}`] || defaultValue);
							});
						});
					} else {
						send(lngs, key, defaultValue);
					}
				}
			}
			res = this.extendTranslation(res, keys, opt, resolved, lastKey);
			if (usedKey && res === key && this.options.appendNamespaceToMissingKey) {
				res = `${namespace}${nsSeparator}${key}`;
			}
			if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
				res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : undefined, opt);
			}
		}
		if (returnDetails) {
			resolved.res = res;
			resolved.usedParams = this.getUsedParamsDetails(opt);
			return resolved;
		}
		return res;
	}
	extendTranslation(res, key, opt, resolved, lastKey) {
		if (this.i18nFormat?.parse) {
			res = this.i18nFormat.parse(
				res,
				{
					...this.options.interpolation.defaultVariables,
					...opt,
				},
				opt.lng || this.language || resolved.usedLng,
				resolved.usedNS,
				resolved.usedKey,
				{
					resolved,
				},
			);
		} else if (!opt.skipInterpolation) {
			if (opt.interpolation)
				this.interpolator.init({
					...opt,
					...{
						interpolation: {
							...this.options.interpolation,
							...opt.interpolation,
						},
					},
				});
			const skipOnVariables = isString$1(res) && (opt?.interpolation?.skipOnVariables !== undefined ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
			let nestBef;
			if (skipOnVariables) {
				const nb = res.match(this.interpolator.nestingRegexp);
				nestBef = nb && nb.length;
			}
			let data = opt.replace && !isString$1(opt.replace) ? opt.replace : opt;
			if (this.options.interpolation.defaultVariables)
				data = {
					...this.options.interpolation.defaultVariables,
					...data,
				};
			res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
			if (skipOnVariables) {
				const na = res.match(this.interpolator.nestingRegexp);
				const nestAft = na && na.length;
				if (nestBef < nestAft) opt.nest = false;
			}
			if (!opt.lng && resolved && resolved.res) opt.lng = this.language || resolved.usedLng;
			if (opt.nest !== false)
				res = this.interpolator.nest(
					res,
					(...args) => {
						if (lastKey?.[0] === args[0] && !opt.context) {
							this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
							return null;
						}
						return this.translate(...args, key);
					},
					opt,
				);
			if (opt.interpolation) this.interpolator.reset();
		}
		const postProcess = opt.postProcess || this.options.postProcess;
		const postProcessorNames = isString$1(postProcess) ? [postProcess] : postProcess;
		if (res != null && postProcessorNames?.length && opt.applyPostProcessor !== false) {
			res = postProcessor.handle(
				postProcessorNames,
				res,
				key,
				this.options && this.options.postProcessPassResolved ?
					{
						i18nResolved: {
							...resolved,
							usedParams: this.getUsedParamsDetails(opt),
						},
						...opt,
					}
				:	opt,
				this,
			);
		}
		return res;
	}
	resolve(keys, opt = {}) {
		let found;
		let usedKey;
		let exactUsedKey;
		let usedLng;
		let usedNS;
		if (isString$1(keys)) keys = [keys];
		if (Array.isArray(keys))
			keys = keys.map((k) =>
				typeof k === "function" ?
					keysFromSelector(k, {
						...this.options,
						...opt,
					})
				:	k,
			);
		keys.forEach((k) => {
			if (this.isValidLookup(found)) return;
			const extracted = this.extractFromKey(k, opt);
			const key = extracted.key;
			usedKey = key;
			let namespaces = extracted.namespaces;
			if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);
			const needsPluralHandling = opt.count !== undefined && !isString$1(opt.count);
			const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
			const needsContextHandling = opt.context !== undefined && (isString$1(opt.context) || typeof opt.context === "number") && opt.context !== "";
			const codes = opt.lngs ? opt.lngs : this.languageUtils.toResolveHierarchy(opt.lng || this.language, opt.fallbackLng);
			namespaces.forEach((ns) => {
				if (this.isValidLookup(found)) return;
				usedNS = ns;
				if (!this.checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
					this.checkedLoadedFor[`${codes[0]}-${ns}`] = true;
					this.logger.warn(
						`key "${usedKey}" for languages "${codes.join(", ")}" won't get resolved as namespace "${usedNS}" was not yet loaded`,
						"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!",
					);
				}
				codes.forEach((code) => {
					if (this.isValidLookup(found)) return;
					usedLng = code;
					const finalKeys = [key];
					if (this.i18nFormat?.addLookupKeys) {
						this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, opt);
					} else {
						let pluralSuffix;
						if (needsPluralHandling) pluralSuffix = this.pluralResolver.getSuffix(code, opt.count, opt);
						const zeroSuffix = `${this.options.pluralSeparator}zero`;
						const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
						if (needsPluralHandling) {
							if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
								finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
							}
							finalKeys.push(key + pluralSuffix);
							if (needsZeroSuffixLookup) {
								finalKeys.push(key + zeroSuffix);
							}
						}
						if (needsContextHandling) {
							const contextKey = `${key}${this.options.contextSeparator || "_"}${opt.context}`;
							finalKeys.push(contextKey);
							if (needsPluralHandling) {
								if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
									finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
								}
								finalKeys.push(contextKey + pluralSuffix);
								if (needsZeroSuffixLookup) {
									finalKeys.push(contextKey + zeroSuffix);
								}
							}
						}
					}
					let possibleKey;
					while ((possibleKey = finalKeys.pop())) {
						if (!this.isValidLookup(found)) {
							exactUsedKey = possibleKey;
							found = this.getResource(code, ns, possibleKey, opt);
						}
					}
				});
			});
		});
		return {
			res: found,
			usedKey,
			exactUsedKey,
			usedLng,
			usedNS,
		};
	}
	isValidLookup(res) {
		return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
	}
	getResource(code, ns, key, options = {}) {
		if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options);
		return this.resourceStore.getResource(code, ns, key, options);
	}
	getUsedParamsDetails(options = {}) {
		const optionsKeys = [
			"defaultValue",
			"ordinal",
			"context",
			"replace",
			"lng",
			"lngs",
			"fallbackLng",
			"ns",
			"keySeparator",
			"nsSeparator",
			"returnObjects",
			"returnDetails",
			"joinArrays",
			"postProcess",
			"interpolation",
		];
		const useOptionsReplaceForData = options.replace && !isString$1(options.replace);
		let data = useOptionsReplaceForData ? options.replace : options;
		if (useOptionsReplaceForData && typeof options.count !== "undefined") {
			data.count = options.count;
		}
		if (this.options.interpolation.defaultVariables) {
			data = {
				...this.options.interpolation.defaultVariables,
				...data,
			};
		}
		if (!useOptionsReplaceForData) {
			data = {
				...data,
			};
			for (const key of optionsKeys) {
				delete data[key];
			}
		}
		return data;
	}
	static hasDefaultValue(options) {
		const prefix = "defaultValue";
		for (const option in options) {
			if (Object.prototype.hasOwnProperty.call(options, option) && option.startsWith(prefix) && undefined !== options[option]) {
				return true;
			}
		}
		return false;
	}
}

class LanguageUtil {
	constructor(options) {
		this.options = options;
		this.supportedLngs = this.options.supportedLngs || false;
		this.logger = baseLogger.create("languageUtils");
	}
	getScriptPartFromCode(code) {
		code = getCleanedCode(code);
		if (!code || !code.includes("-")) return null;
		const p = code.split("-");
		if (p.length === 2) return null;
		p.pop();
		if (p[p.length - 1].toLowerCase() === "x") return null;
		return this.formatLanguageCode(p.join("-"));
	}
	getLanguagePartFromCode(code) {
		code = getCleanedCode(code);
		if (!code || !code.includes("-")) return code;
		const p = code.split("-");
		return this.formatLanguageCode(p[0]);
	}
	formatLanguageCode(code) {
		if (isString$1(code) && code.includes("-")) {
			let formattedCode;
			try {
				formattedCode = Intl.getCanonicalLocales(code)[0];
			} catch (e) {}
			if (formattedCode && this.options.lowerCaseLng) {
				formattedCode = formattedCode.toLowerCase();
			}
			if (formattedCode) return formattedCode;
			if (this.options.lowerCaseLng) {
				return code.toLowerCase();
			}
			return code;
		}
		return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
	}
	isSupportedCode(code) {
		if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) {
			code = this.getLanguagePartFromCode(code);
		}
		return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.includes(code);
	}
	getBestMatchFromCodes(codes) {
		if (!codes) return null;
		let found;
		codes.forEach((code) => {
			if (found) return;
			const cleanedLng = this.formatLanguageCode(code);
			if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng)) found = cleanedLng;
		});
		if (!found && this.options.supportedLngs) {
			codes.forEach((code) => {
				if (found) return;
				const lngScOnly = this.getScriptPartFromCode(code);
				if (this.isSupportedCode(lngScOnly)) return (found = lngScOnly);
				const lngOnly = this.getLanguagePartFromCode(code);
				if (this.isSupportedCode(lngOnly)) return (found = lngOnly);
				found = this.options.supportedLngs.find((supportedLng) => {
					if (supportedLng === lngOnly) return true;
					if (!supportedLng.includes("-") && !lngOnly.includes("-")) return false;
					if (supportedLng.includes("-") && !lngOnly.includes("-") && supportedLng.slice(0, supportedLng.indexOf("-")) === lngOnly) return true;
					if (supportedLng.startsWith(lngOnly) && lngOnly.length > 1) return true;
					return false;
				});
			});
		}
		if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
		return found;
	}
	getFallbackCodes(fallbacks, code) {
		if (!fallbacks) return [];
		if (typeof fallbacks === "function") fallbacks = fallbacks(code);
		if (isString$1(fallbacks)) fallbacks = [fallbacks];
		if (Array.isArray(fallbacks)) return fallbacks;
		if (!code) return fallbacks.default || [];
		let found = fallbacks[code];
		if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
		if (!found) found = fallbacks[this.formatLanguageCode(code)];
		if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
		if (!found) found = fallbacks.default;
		return found || [];
	}
	toResolveHierarchy(code, fallbackCode) {
		const fallbackCodes = this.getFallbackCodes((fallbackCode === false ? [] : fallbackCode) || this.options.fallbackLng || [], code);
		const codes = [];
		const addCode = (c) => {
			if (!c) return;
			if (this.isSupportedCode(c)) {
				codes.push(c);
			} else {
				this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
			}
		};
		if (isString$1(code) && (code.includes("-") || code.includes("_"))) {
			if (this.options.load !== "languageOnly") addCode(this.formatLanguageCode(code));
			if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly") addCode(this.getScriptPartFromCode(code));
			if (this.options.load !== "currentOnly") addCode(this.getLanguagePartFromCode(code));
		} else if (isString$1(code)) {
			addCode(this.formatLanguageCode(code));
		}
		fallbackCodes.forEach((fc) => {
			if (!codes.includes(fc)) addCode(this.formatLanguageCode(fc));
		});
		return codes;
	}
}

const suffixesOrder = {
	zero: 0,
	one: 1,
	two: 2,
	few: 3,
	many: 4,
	other: 5,
};
const dummyRule = {
	select: (count) => (count === 1 ? "one" : "other"),
	resolvedOptions: () => ({
		pluralCategories: ["one", "other"],
	}),
};
class PluralResolver {
	constructor(languageUtils, options = {}) {
		this.languageUtils = languageUtils;
		this.options = options;
		this.logger = baseLogger.create("pluralResolver");
		this.pluralRulesCache = {};
	}
	clearCache() {
		this.pluralRulesCache = {};
	}
	getRule(code, options = {}) {
		const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
		const type = options.ordinal ? "ordinal" : "cardinal";
		const cacheKey = JSON.stringify({
			cleanedCode,
			type,
		});
		if (cacheKey in this.pluralRulesCache) {
			return this.pluralRulesCache[cacheKey];
		}
		let rule;
		try {
			rule = new Intl.PluralRules(cleanedCode, {
				type,
			});
		} catch (err) {
			if (typeof Intl === "undefined") {
				this.logger.error("No Intl support, please use an Intl polyfill!");
				return dummyRule;
			}
			if (!code.match(/-|_/)) return dummyRule;
			const lngPart = this.languageUtils.getLanguagePartFromCode(code);
			rule = this.getRule(lngPart, options);
		}
		this.pluralRulesCache[cacheKey] = rule;
		return rule;
	}
	needsPlural(code, options = {}) {
		let rule = this.getRule(code, options);
		if (!rule) rule = this.getRule("dev", options);
		return rule?.resolvedOptions().pluralCategories.length > 1;
	}
	getPluralFormsOfKey(code, key, options = {}) {
		return this.getSuffixes(code, options).map((suffix) => `${key}${suffix}`);
	}
	getSuffixes(code, options = {}) {
		let rule = this.getRule(code, options);
		if (!rule) rule = this.getRule("dev", options);
		if (!rule) return [];
		return rule
			.resolvedOptions()
			.pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2])
			.map((pluralCategory) => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
	}
	getSuffix(code, count, options = {}) {
		const rule = this.getRule(code, options);
		if (rule) {
			return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
		}
		this.logger.warn(`no plural rule found for: ${code}`);
		return this.getSuffix("dev", count, options);
	}
}

const deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJSONStructure = true) => {
	let path = getPathWithDefaults(data, defaultData, key);
	if (!path && ignoreJSONStructure && isString$1(key)) {
		path = deepFind(data, key, keySeparator);
		if (path === undefined) path = deepFind(defaultData, key, keySeparator);
	}
	return path;
};
const regexSafe = (val) => val.replace(/\$/g, "$$$$");
class Interpolator {
	constructor(options = {}) {
		this.logger = baseLogger.create("interpolator");
		this.options = options;
		this.format = options?.interpolation?.format || ((value) => value);
		this.init(options);
	}
	init(options = {}) {
		if (!options.interpolation)
			options.interpolation = {
				escapeValue: true,
			};
		const {
			escape: escape$1,
			escapeValue,
			useRawValueToEscape,
			prefix,
			prefixEscaped,
			suffix,
			suffixEscaped,
			formatSeparator,
			unescapeSuffix,
			unescapePrefix,
			nestingPrefix,
			nestingPrefixEscaped,
			nestingSuffix,
			nestingSuffixEscaped,
			nestingOptionsSeparator,
			maxReplaces,
			alwaysFormat,
		} = options.interpolation;
		this.escape = escape$1 !== undefined ? escape$1 : escape;
		this.escapeValue = escapeValue !== undefined ? escapeValue : true;
		this.useRawValueToEscape = useRawValueToEscape !== undefined ? useRawValueToEscape : false;
		this.prefix = prefix ? regexEscape(prefix) : prefixEscaped || "{{";
		this.suffix = suffix ? regexEscape(suffix) : suffixEscaped || "}}";
		this.formatSeparator = formatSeparator || ",";
		this.unescapePrefix = unescapeSuffix ? "" : unescapePrefix || "-";
		this.unescapeSuffix = this.unescapePrefix ? "" : unescapeSuffix || "";
		this.nestingPrefix = nestingPrefix ? regexEscape(nestingPrefix) : nestingPrefixEscaped || regexEscape("$t(");
		this.nestingSuffix = nestingSuffix ? regexEscape(nestingSuffix) : nestingSuffixEscaped || regexEscape(")");
		this.nestingOptionsSeparator = nestingOptionsSeparator || ",";
		this.maxReplaces = maxReplaces || 1000;
		this.alwaysFormat = alwaysFormat !== undefined ? alwaysFormat : false;
		this.resetRegExp();
	}
	reset() {
		if (this.options) this.init(this.options);
	}
	resetRegExp() {
		const getOrResetRegExp = (existingRegExp, pattern) => {
			if (existingRegExp?.source === pattern) {
				existingRegExp.lastIndex = 0;
				return existingRegExp;
			}
			return new RegExp(pattern, "g");
		};
		this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);
		this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
		this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
	}
	interpolate(str, data, lng, options) {
		let match;
		let value;
		let replaces;
		const defaultData = (this.options && this.options.interpolation && this.options.interpolation.defaultVariables) || {};
		const handleFormat = (key) => {
			if (!key.includes(this.formatSeparator)) {
				const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
				return this.alwaysFormat ?
						this.format(path, undefined, lng, {
							...options,
							...data,
							interpolationkey: key,
						})
					:	path;
			}
			const p = key.split(this.formatSeparator);
			const k = p.shift().trim();
			const f = p.join(this.formatSeparator).trim();
			return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
				...options,
				...data,
				interpolationkey: k,
			});
		};
		this.resetRegExp();
		const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
		const skipOnVariables = options?.interpolation?.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
		const todos = [
			{
				regex: this.regexpUnescape,
				safeValue: (val) => regexSafe(val),
			},
			{
				regex: this.regexp,
				safeValue: (val) => (this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val)),
			},
		];
		todos.forEach((todo) => {
			replaces = 0;
			while ((match = todo.regex.exec(str))) {
				const matchedVar = match[1].trim();
				value = handleFormat(matchedVar);
				if (value === undefined) {
					if (typeof missingInterpolationHandler === "function") {
						const temp = missingInterpolationHandler(str, match, options);
						value = isString$1(temp) ? temp : "";
					} else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
						value = "";
					} else if (skipOnVariables) {
						value = match[0];
						continue;
					} else {
						this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
						value = "";
					}
				} else if (!isString$1(value) && !this.useRawValueToEscape) {
					value = makeString(value);
				}
				const safeValue = todo.safeValue(value);
				str = str.replace(match[0], safeValue);
				if (skipOnVariables) {
					todo.regex.lastIndex += value.length;
					todo.regex.lastIndex -= match[0].length;
				} else {
					todo.regex.lastIndex = 0;
				}
				replaces++;
				if (replaces >= this.maxReplaces) {
					break;
				}
			}
		});
		return str;
	}
	nest(str, fc, options = {}) {
		let match;
		let value;
		let clonedOptions;
		const handleHasOptions = (key, inheritedOptions) => {
			const sep = this.nestingOptionsSeparator;
			if (!key.includes(sep)) return key;
			const c = key.split(new RegExp(`${regexEscape(sep)}[ ]*{`));
			let optionsString = `{${c[1]}`;
			key = c[0];
			optionsString = this.interpolate(optionsString, clonedOptions);
			const matchedSingleQuotes = optionsString.match(/'/g);
			const matchedDoubleQuotes = optionsString.match(/"/g);
			if (((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes) || (matchedDoubleQuotes?.length ?? 0) % 2 !== 0) {
				optionsString = optionsString.replace(/'/g, '"');
			}
			try {
				clonedOptions = JSON.parse(optionsString);
				if (inheritedOptions)
					clonedOptions = {
						...inheritedOptions,
						...clonedOptions,
					};
			} catch (e) {
				this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);
				return `${key}${sep}${optionsString}`;
			}
			if (clonedOptions.defaultValue && clonedOptions.defaultValue.includes(this.prefix)) delete clonedOptions.defaultValue;
			return key;
		};
		while ((match = this.nestingRegexp.exec(str))) {
			let formatters = [];
			clonedOptions = {
				...options,
			};
			clonedOptions = clonedOptions.replace && !isString$1(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
			clonedOptions.applyPostProcessor = false;
			delete clonedOptions.defaultValue;
			const keyEndIndex = /{.*}/.test(match[1]) ? match[1].lastIndexOf("}") + 1 : match[1].indexOf(this.formatSeparator);
			if (keyEndIndex !== -1) {
				formatters = match[1]
					.slice(keyEndIndex)
					.split(this.formatSeparator)
					.map((elem) => elem.trim())
					.filter(Boolean);
				match[1] = match[1].slice(0, keyEndIndex);
			}
			value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
			if (value && match[0] === str && !isString$1(value)) return value;
			if (!isString$1(value)) value = makeString(value);
			if (!value) {
				this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);
				value = "";
			}
			if (formatters.length) {
				value = formatters.reduce(
					(v, f) =>
						this.format(v, f, options.lng, {
							...options,
							interpolationkey: match[1].trim(),
						}),
					value.trim(),
				);
			}
			str = str.replace(match[0], value);
			this.regexp.lastIndex = 0;
		}
		return str;
	}
}

const parseFormatStr = (formatStr) => {
	let formatName = formatStr.toLowerCase().trim();
	const formatOptions = {};
	if (formatStr.includes("(")) {
		const p = formatStr.split("(");
		formatName = p[0].toLowerCase().trim();
		const optStr = p[1].slice(0, -1);
		if (formatName === "currency" && !optStr.includes(":")) {
			if (!formatOptions.currency) formatOptions.currency = optStr.trim();
		} else if (formatName === "relativetime" && !optStr.includes(":")) {
			if (!formatOptions.range) formatOptions.range = optStr.trim();
		} else {
			const opts = optStr.split(";");
			opts.forEach((opt) => {
				if (opt) {
					const [key, ...rest] = opt.split(":");
					const val = rest
						.join(":")
						.trim()
						.replace(/^'+|'+$/g, "");
					const trimmedKey = key.trim();
					if (!formatOptions[trimmedKey]) formatOptions[trimmedKey] = val;
					if (val === "false") formatOptions[trimmedKey] = false;
					if (val === "true") formatOptions[trimmedKey] = true;
					if (!isNaN(val)) formatOptions[trimmedKey] = parseInt(val, 10);
				}
			});
		}
	}
	return {
		formatName,
		formatOptions,
	};
};
const createCachedFormatter = (fn) => {
	const cache = {};
	return (v, l, o) => {
		let optForCache = o;
		if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
			optForCache = {
				...optForCache,
				[o.interpolationkey]: undefined,
			};
		}
		const key = l + JSON.stringify(optForCache);
		let frm = cache[key];
		if (!frm) {
			frm = fn(getCleanedCode(l), o);
			cache[key] = frm;
		}
		return frm(v);
	};
};
const createNonCachedFormatter = (fn) => (v, l, o) => fn(getCleanedCode(l), o)(v);
class Formatter {
	constructor(options = {}) {
		this.logger = baseLogger.create("formatter");
		this.options = options;
		this.init(options);
	}
	init(
		services,
		options = {
			interpolation: {},
		},
	) {
		this.formatSeparator = options.interpolation.formatSeparator || ",";
		const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
		this.formats = {
			number: cf((lng, opt) => {
				const formatter = new Intl.NumberFormat(lng, {
					...opt,
				});
				return (val) => formatter.format(val);
			}),
			currency: cf((lng, opt) => {
				const formatter = new Intl.NumberFormat(lng, {
					...opt,
					style: "currency",
				});
				return (val) => formatter.format(val);
			}),
			datetime: cf((lng, opt) => {
				const formatter = new Intl.DateTimeFormat(lng, {
					...opt,
				});
				return (val) => formatter.format(val);
			}),
			relativetime: cf((lng, opt) => {
				const formatter = new Intl.RelativeTimeFormat(lng, {
					...opt,
				});
				return (val) => formatter.format(val, opt.range || "day");
			}),
			list: cf((lng, opt) => {
				const formatter = new Intl.ListFormat(lng, {
					...opt,
				});
				return (val) => formatter.format(val);
			}),
		};
	}
	add(name, fc) {
		this.formats[name.toLowerCase().trim()] = fc;
	}
	addCached(name, fc) {
		this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
	}
	format(value, format, lng, options = {}) {
		if (!format) return value;
		if (value == null) return value;
		const formats = format.split(this.formatSeparator);
		if (formats.length > 1 && formats[0].indexOf("(") > 1 && !formats[0].includes(")") && formats.find((f) => f.includes(")"))) {
			const lastIndex = formats.findIndex((f) => f.includes(")"));
			formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
		}
		const result = formats.reduce((mem, f) => {
			const { formatName, formatOptions } = parseFormatStr(f);
			if (this.formats[formatName]) {
				let formatted = mem;
				try {
					const valOptions = options?.formatParams?.[options.interpolationkey] || {};
					const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
					formatted = this.formats[formatName](mem, l, {
						...formatOptions,
						...options,
						...valOptions,
					});
				} catch (error) {
					this.logger.warn(error);
				}
				return formatted;
			} else {
				this.logger.warn(`there was no format function for ${formatName}`);
			}
			return mem;
		}, value);
		return result;
	}
}

const removePending = (q, name) => {
	if (q.pending[name] !== undefined) {
		delete q.pending[name];
		q.pendingCount--;
	}
};
class Connector extends EventEmitter {
	constructor(backend, store, services, options = {}) {
		super();
		this.backend = backend;
		this.store = store;
		this.services = services;
		this.languageUtils = services.languageUtils;
		this.options = options;
		this.logger = baseLogger.create("backendConnector");
		this.waitingReads = [];
		this.maxParallelReads = options.maxParallelReads || 10;
		this.readingCalls = 0;
		this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
		this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
		this.state = {};
		this.queue = [];
		this.backend?.init?.(services, options.backend, options);
	}
	queueLoad(languages, namespaces, options, callback) {
		const toLoad = {};
		const pending = {};
		const toLoadLanguages = {};
		const toLoadNamespaces = {};
		languages.forEach((lng) => {
			let hasAllNamespaces = true;
			namespaces.forEach((ns) => {
				const name = `${lng}|${ns}`;
				if (!options.reload && this.store.hasResourceBundle(lng, ns)) {
					this.state[name] = 2;
				} else if (this.state[name] < 0);
				else if (this.state[name] === 1) {
					if (pending[name] === undefined) pending[name] = true;
				} else {
					this.state[name] = 1;
					hasAllNamespaces = false;
					if (pending[name] === undefined) pending[name] = true;
					if (toLoad[name] === undefined) toLoad[name] = true;
					if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;
				}
			});
			if (!hasAllNamespaces) toLoadLanguages[lng] = true;
		});
		if (Object.keys(toLoad).length || Object.keys(pending).length) {
			this.queue.push({
				pending,
				pendingCount: Object.keys(pending).length,
				loaded: {},
				errors: [],
				callback,
			});
		}
		return {
			toLoad: Object.keys(toLoad),
			pending: Object.keys(pending),
			toLoadLanguages: Object.keys(toLoadLanguages),
			toLoadNamespaces: Object.keys(toLoadNamespaces),
		};
	}
	loaded(name, err, data) {
		const s = name.split("|");
		const lng = s[0];
		const ns = s[1];
		if (err) this.emit("failedLoading", lng, ns, err);
		if (!err && data) {
			this.store.addResourceBundle(lng, ns, data, undefined, undefined, {
				skipCopy: true,
			});
		}
		this.state[name] = err ? -1 : 2;
		if (err && data) this.state[name] = 0;
		const loaded = {};
		this.queue.forEach((q) => {
			pushPath(q.loaded, [lng], ns);
			removePending(q, name);
			if (err) q.errors.push(err);
			if (q.pendingCount === 0 && !q.done) {
				Object.keys(q.loaded).forEach((l) => {
					if (!loaded[l]) loaded[l] = {};
					const loadedKeys = q.loaded[l];
					if (loadedKeys.length) {
						loadedKeys.forEach((n) => {
							if (loaded[l][n] === undefined) loaded[l][n] = true;
						});
					}
				});
				q.done = true;
				if (q.errors.length) {
					q.callback(q.errors);
				} else {
					q.callback();
				}
			}
		});
		this.emit("loaded", loaded);
		this.queue = this.queue.filter((q) => !q.done);
	}
	read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
		if (!lng.length) return callback(null, {});
		if (this.readingCalls >= this.maxParallelReads) {
			this.waitingReads.push({
				lng,
				ns,
				fcName,
				tried,
				wait,
				callback,
			});
			return;
		}
		this.readingCalls++;
		const resolver = (err, data) => {
			this.readingCalls--;
			if (this.waitingReads.length > 0) {
				const next = this.waitingReads.shift();
				this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
			}
			if (err && data && tried < this.maxRetries) {
				setTimeout(() => {
					this.read(lng, ns, fcName, tried + 1, wait * 2, callback);
				}, wait);
				return;
			}
			callback(err, data);
		};
		const fc = this.backend[fcName].bind(this.backend);
		if (fc.length === 2) {
			try {
				const r = fc(lng, ns);
				if (r && typeof r.then === "function") {
					r.then((data) => resolver(null, data)).catch(resolver);
				} else {
					resolver(null, r);
				}
			} catch (err) {
				resolver(err);
			}
			return;
		}
		return fc(lng, ns, resolver);
	}
	prepareLoading(languages, namespaces, options = {}, callback) {
		if (!this.backend) {
			this.logger.warn("No backend was added via i18next.use. Will not load resources.");
			return callback && callback();
		}
		if (isString$1(languages)) languages = this.languageUtils.toResolveHierarchy(languages);
		if (isString$1(namespaces)) namespaces = [namespaces];
		const toLoad = this.queueLoad(languages, namespaces, options, callback);
		if (!toLoad.toLoad.length) {
			if (!toLoad.pending.length) callback();
			return null;
		}
		toLoad.toLoad.forEach((name) => {
			this.loadOne(name);
		});
	}
	load(languages, namespaces, callback) {
		this.prepareLoading(languages, namespaces, {}, callback);
	}
	reload(languages, namespaces, callback) {
		this.prepareLoading(
			languages,
			namespaces,
			{
				reload: true,
			},
			callback,
		);
	}
	loadOne(name, prefix = "") {
		const s = name.split("|");
		const lng = s[0];
		const ns = s[1];
		this.read(lng, ns, "read", undefined, undefined, (err, data) => {
			if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
			if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
			this.loaded(name, err, data);
		});
	}
	saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {}) {
		if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
			this.logger.warn(
				`did not save key "${key}" as the namespace "${namespace}" was not yet loaded`,
				"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!",
			);
			return;
		}
		if (key === undefined || key === null || key === "") return;
		if (this.backend?.create) {
			const opts = {
				...options,
				isUpdate,
			};
			const fc = this.backend.create.bind(this.backend);
			if (fc.length < 6) {
				try {
					let r;
					if (fc.length === 5) {
						r = fc(languages, namespace, key, fallbackValue, opts);
					} else {
						r = fc(languages, namespace, key, fallbackValue);
					}
					if (r && typeof r.then === "function") {
						r.then((data) => clb(null, data)).catch(clb);
					} else {
						clb(null, r);
					}
				} catch (err) {
					clb(err);
				}
			} else {
				fc(languages, namespace, key, fallbackValue, clb, opts);
			}
		}
		if (!languages || !languages[0]) return;
		this.store.addResource(languages[0], namespace, key, fallbackValue);
	}
}

const get = () => ({
	debug: false,
	initAsync: true,
	ns: ["translation"],
	defaultNS: ["translation"],
	fallbackLng: ["dev"],
	fallbackNS: false,
	supportedLngs: false,
	nonExplicitSupportedLngs: false,
	load: "all",
	preload: false,
	keySeparator: ".",
	nsSeparator: ":",
	pluralSeparator: "_",
	contextSeparator: "_",
	partialBundledLanguages: false,
	saveMissing: false,
	updateMissing: false,
	saveMissingTo: "fallback",
	saveMissingPlurals: true,
	missingKeyHandler: false,
	missingInterpolationHandler: false,
	postProcess: false,
	postProcessPassResolved: false,
	returnNull: false,
	returnEmptyString: true,
	returnObjects: false,
	joinArrays: false,
	returnedObjectHandler: false,
	parseMissingKeyHandler: false,
	appendNamespaceToMissingKey: false,
	appendNamespaceToCIMode: false,
	overloadTranslationOptionHandler: (args) => {
		let ret = {};
		if (typeof args[1] === "object") ret = args[1];
		if (isString$1(args[1])) ret.defaultValue = args[1];
		if (isString$1(args[2])) ret.tDescription = args[2];
		if (typeof args[2] === "object" || typeof args[3] === "object") {
			const options = args[3] || args[2];
			Object.keys(options).forEach((key) => {
				ret[key] = options[key];
			});
		}
		return ret;
	},
	interpolation: {
		escapeValue: true,
		prefix: "{{",
		suffix: "}}",
		formatSeparator: ",",
		unescapePrefix: "-",
		nestingPrefix: "$t(",
		nestingSuffix: ")",
		nestingOptionsSeparator: ",",
		maxReplaces: 1000,
		skipOnVariables: true,
	},
	cacheInBuiltFormats: true,
});
const transformOptions = (options) => {
	if (isString$1(options.ns)) options.ns = [options.ns];
	if (isString$1(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
	if (isString$1(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
	if (options.supportedLngs && !options.supportedLngs.includes("cimode")) {
		options.supportedLngs = options.supportedLngs.concat(["cimode"]);
	}
	return options;
};

const noop$2 = () => {};
const bindMemberFunctions = (inst) => {
	const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
	mems.forEach((mem) => {
		if (typeof inst[mem] === "function") {
			inst[mem] = inst[mem].bind(inst);
		}
	});
};
class I18n extends EventEmitter {
	constructor(options = {}, callback) {
		super();
		this.options = transformOptions(options);
		this.services = {};
		this.logger = baseLogger;
		this.modules = {
			external: [],
		};
		bindMemberFunctions(this);
		if (callback && !this.isInitialized && !options.isClone) {
			if (!this.options.initAsync) {
				this.init(options, callback);
				return this;
			}
			setTimeout(() => {
				this.init(options, callback);
			}, 0);
		}
	}
	init(options = {}, callback) {
		this.isInitializing = true;
		if (typeof options === "function") {
			callback = options;
			options = {};
		}
		if (options.defaultNS == null && options.ns) {
			if (isString$1(options.ns)) {
				options.defaultNS = options.ns;
			} else if (!options.ns.includes("translation")) {
				options.defaultNS = options.ns[0];
			}
		}
		const defOpts = get();
		this.options = {
			...defOpts,
			...this.options,
			...transformOptions(options),
		};
		this.options.interpolation = {
			...defOpts.interpolation,
			...this.options.interpolation,
		};
		if (options.keySeparator !== undefined) {
			this.options.userDefinedKeySeparator = options.keySeparator;
		}
		if (options.nsSeparator !== undefined) {
			this.options.userDefinedNsSeparator = options.nsSeparator;
		}
		if (typeof this.options.overloadTranslationOptionHandler !== "function") {
			this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
		}
		const createClassOnDemand = (ClassOrObject) => {
			if (!ClassOrObject) return null;
			if (typeof ClassOrObject === "function") return new ClassOrObject();
			return ClassOrObject;
		};
		if (!this.options.isClone) {
			if (this.modules.logger) {
				baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
			} else {
				baseLogger.init(null, this.options);
			}
			let formatter;
			if (this.modules.formatter) {
				formatter = this.modules.formatter;
			} else {
				formatter = Formatter;
			}
			const lu = new LanguageUtil(this.options);
			this.store = new ResourceStore(this.options.resources, this.options);
			const s = this.services;
			s.logger = baseLogger;
			s.resourceStore = this.store;
			s.languageUtils = lu;
			s.pluralResolver = new PluralResolver(lu, {
				prepend: this.options.pluralSeparator,
			});
			if (formatter) {
				s.formatter = createClassOnDemand(formatter);
				if (s.formatter.init) s.formatter.init(s, this.options);
				this.options.interpolation.format = s.formatter.format.bind(s.formatter);
			}
			s.interpolator = new Interpolator(this.options);
			s.utils = {
				hasLoadedNamespace: this.hasLoadedNamespace.bind(this),
			};
			s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
			s.backendConnector.on("*", (event, ...args) => {
				this.emit(event, ...args);
			});
			if (this.modules.languageDetector) {
				s.languageDetector = createClassOnDemand(this.modules.languageDetector);
				if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
			}
			if (this.modules.i18nFormat) {
				s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
				if (s.i18nFormat.init) s.i18nFormat.init(this);
			}
			this.translator = new Translator(this.services, this.options);
			this.translator.on("*", (event, ...args) => {
				this.emit(event, ...args);
			});
			this.modules.external.forEach((m) => {
				if (m.init) m.init(this);
			});
		}
		this.format = this.options.interpolation.format;
		if (!callback) callback = noop$2;
		if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
			const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
			if (codes.length > 0 && codes[0] !== "dev") this.options.lng = codes[0];
		}
		if (!this.services.languageDetector && !this.options.lng) {
			this.logger.warn("init: no languageDetector is used and no lng is defined");
		}
		const storeApi = ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"];
		storeApi.forEach((fcName) => {
			this[fcName] = (...args) => this.store[fcName](...args);
		});
		const storeApiChained = ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"];
		storeApiChained.forEach((fcName) => {
			this[fcName] = (...args) => {
				this.store[fcName](...args);
				return this;
			};
		});
		const deferred = defer();
		const load = () => {
			const finish = (err, t) => {
				this.isInitializing = false;
				if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn("init: i18next is already initialized. You should call init just once!");
				this.isInitialized = true;
				if (!this.options.isClone) this.logger.log("initialized", this.options);
				this.emit("initialized", this.options);
				deferred.resolve(t);
				callback(err, t);
			};
			if (this.languages && !this.isInitialized) return finish(null, this.t.bind(this));
			this.changeLanguage(this.options.lng, finish);
		};
		if (this.options.resources || !this.options.initAsync) {
			load();
		} else {
			setTimeout(load, 0);
		}
		return deferred;
	}
	loadResources(language, callback = noop$2) {
		let usedCallback = callback;
		const usedLng = isString$1(language) ? language : this.language;
		if (typeof language === "function") usedCallback = language;
		if (!this.options.resources || this.options.partialBundledLanguages) {
			if (usedLng?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();
			const toLoad = [];
			const append = (lng) => {
				if (!lng) return;
				if (lng === "cimode") return;
				const lngs = this.services.languageUtils.toResolveHierarchy(lng);
				lngs.forEach((l) => {
					if (l === "cimode") return;
					if (!toLoad.includes(l)) toLoad.push(l);
				});
			};
			if (!usedLng) {
				const fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
				fallbacks.forEach((l) => append(l));
			} else {
				append(usedLng);
			}
			this.options.preload?.forEach?.((l) => append(l));
			this.services.backendConnector.load(toLoad, this.options.ns, (e) => {
				if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);
				usedCallback(e);
			});
		} else {
			usedCallback(null);
		}
	}
	reloadResources(lngs, ns, callback) {
		const deferred = defer();
		if (typeof lngs === "function") {
			callback = lngs;
			lngs = undefined;
		}
		if (typeof ns === "function") {
			callback = ns;
			ns = undefined;
		}
		if (!lngs) lngs = this.languages;
		if (!ns) ns = this.options.ns;
		if (!callback) callback = noop$2;
		this.services.backendConnector.reload(lngs, ns, (err) => {
			deferred.resolve();
			callback(err);
		});
		return deferred;
	}
	use(module) {
		if (!module) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
		if (!module.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
		if (module.type === "backend") {
			this.modules.backend = module;
		}
		if (module.type === "logger" || (module.log && module.warn && module.error)) {
			this.modules.logger = module;
		}
		if (module.type === "languageDetector") {
			this.modules.languageDetector = module;
		}
		if (module.type === "i18nFormat") {
			this.modules.i18nFormat = module;
		}
		if (module.type === "postProcessor") {
			postProcessor.addPostProcessor(module);
		}
		if (module.type === "formatter") {
			this.modules.formatter = module;
		}
		if (module.type === "3rdParty") {
			this.modules.external.push(module);
		}
		return this;
	}
	setResolvedLanguage(l) {
		if (!l || !this.languages) return;
		if (["cimode", "dev"].includes(l)) return;
		for (let li = 0; li < this.languages.length; li++) {
			const lngInLngs = this.languages[li];
			if (["cimode", "dev"].includes(lngInLngs)) continue;
			if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
				this.resolvedLanguage = lngInLngs;
				break;
			}
		}
		if (!this.resolvedLanguage && !this.languages.includes(l) && this.store.hasLanguageSomeTranslations(l)) {
			this.resolvedLanguage = l;
			this.languages.unshift(l);
		}
	}
	changeLanguage(lng, callback) {
		this.isLanguageChangingTo = lng;
		const deferred = defer();
		this.emit("languageChanging", lng);
		const setLngProps = (l) => {
			this.language = l;
			this.languages = this.services.languageUtils.toResolveHierarchy(l);
			this.resolvedLanguage = undefined;
			this.setResolvedLanguage(l);
		};
		const done = (err, l) => {
			if (l) {
				if (this.isLanguageChangingTo === lng) {
					setLngProps(l);
					this.translator.changeLanguage(l);
					this.isLanguageChangingTo = undefined;
					this.emit("languageChanged", l);
					this.logger.log("languageChanged", l);
				}
			} else {
				this.isLanguageChangingTo = undefined;
			}
			deferred.resolve((...args) => this.t(...args));
			if (callback) callback(err, (...args) => this.t(...args));
		};
		const setLng = (lngs) => {
			if (!lng && !lngs && this.services.languageDetector) lngs = [];
			const fl = isString$1(lngs) ? lngs : lngs && lngs[0];
			const l = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString$1(lngs) ? [lngs] : lngs);
			if (l) {
				if (!this.language) {
					setLngProps(l);
				}
				if (!this.translator.language) this.translator.changeLanguage(l);
				this.services.languageDetector?.cacheUserLanguage?.(l);
			}
			this.loadResources(l, (err) => {
				done(err, l);
			});
		};
		if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
			setLng(this.services.languageDetector.detect());
		} else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
			if (this.services.languageDetector.detect.length === 0) {
				this.services.languageDetector.detect().then(setLng);
			} else {
				this.services.languageDetector.detect(setLng);
			}
		} else {
			setLng(lng);
		}
		return deferred;
	}
	getFixedT(lng, ns, keyPrefix) {
		const fixedT = (key, opts, ...rest) => {
			let o;
			if (typeof opts !== "object") {
				o = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));
			} else {
				o = {
					...opts,
				};
			}
			o.lng = o.lng || fixedT.lng;
			o.lngs = o.lngs || fixedT.lngs;
			o.ns = o.ns || fixedT.ns;
			if (o.keyPrefix !== "") o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
			const selectorOpts = {
				...this.options,
				...o,
			};
			if (typeof o.keyPrefix === "function") o.keyPrefix = keysFromSelector(o.keyPrefix, selectorOpts);
			const keySeparator = this.options.keySeparator || ".";
			let resultKey;
			if (o.keyPrefix && Array.isArray(key)) {
				resultKey = key.map((k) => {
					if (typeof k === "function") k = keysFromSelector(k, selectorOpts);
					return `${o.keyPrefix}${keySeparator}${k}`;
				});
			} else {
				if (typeof key === "function") key = keysFromSelector(key, selectorOpts);
				resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
			}
			return this.t(resultKey, o);
		};
		if (isString$1(lng)) {
			fixedT.lng = lng;
		} else {
			fixedT.lngs = lng;
		}
		fixedT.ns = ns;
		fixedT.keyPrefix = keyPrefix;
		return fixedT;
	}
	t(...args) {
		return this.translator?.translate(...args);
	}
	exists(...args) {
		return this.translator?.exists(...args);
	}
	setDefaultNamespace(ns) {
		this.options.defaultNS = ns;
	}
	hasLoadedNamespace(ns, options = {}) {
		if (!this.isInitialized) {
			this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
			return false;
		}
		if (!this.languages || !this.languages.length) {
			this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages);
			return false;
		}
		const lng = options.lng || this.resolvedLanguage || this.languages[0];
		const fallbackLng = this.options ? this.options.fallbackLng : false;
		const lastLng = this.languages[this.languages.length - 1];
		if (lng.toLowerCase() === "cimode") return true;
		const loadNotPending = (l, n) => {
			const loadState = this.services.backendConnector.state[`${l}|${n}`];
			return loadState === -1 || loadState === 0 || loadState === 2;
		};
		if (options.precheck) {
			const preResult = options.precheck(this, loadNotPending);
			if (preResult !== undefined) return preResult;
		}
		if (this.hasResourceBundle(lng, ns)) return true;
		if (!this.services.backendConnector.backend || (this.options.resources && !this.options.partialBundledLanguages)) return true;
		if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
		return false;
	}
	loadNamespaces(ns, callback) {
		const deferred = defer();
		if (!this.options.ns) {
			if (callback) callback();
			return Promise.resolve();
		}
		if (isString$1(ns)) ns = [ns];
		ns.forEach((n) => {
			if (!this.options.ns.includes(n)) this.options.ns.push(n);
		});
		this.loadResources((err) => {
			deferred.resolve();
			if (callback) callback(err);
		});
		return deferred;
	}
	loadLanguages(lngs, callback) {
		const deferred = defer();
		if (isString$1(lngs)) lngs = [lngs];
		const preloaded = this.options.preload || [];
		const newLngs = lngs.filter((lng) => !preloaded.includes(lng) && this.services.languageUtils.isSupportedCode(lng));
		if (!newLngs.length) {
			if (callback) callback();
			return Promise.resolve();
		}
		this.options.preload = preloaded.concat(newLngs);
		this.loadResources((err) => {
			deferred.resolve();
			if (callback) callback(err);
		});
		return deferred;
	}
	dir(lng) {
		if (!lng) lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language);
		if (!lng) return "rtl";
		try {
			const l = new Intl.Locale(lng);
			if (l && l.getTextInfo) {
				const ti = l.getTextInfo();
				if (ti && ti.direction) return ti.direction;
			}
		} catch (e) {}
		const rtlLngs = [
			"ar",
			"shu",
			"sqr",
			"ssh",
			"xaa",
			"yhd",
			"yud",
			"aao",
			"abh",
			"abv",
			"acm",
			"acq",
			"acw",
			"acx",
			"acy",
			"adf",
			"ads",
			"aeb",
			"aec",
			"afb",
			"ajp",
			"apc",
			"apd",
			"arb",
			"arq",
			"ars",
			"ary",
			"arz",
			"auz",
			"avl",
			"ayh",
			"ayl",
			"ayn",
			"ayp",
			"bbz",
			"pga",
			"he",
			"iw",
			"ps",
			"pbt",
			"pbu",
			"pst",
			"prp",
			"prd",
			"ug",
			"ur",
			"ydd",
			"yds",
			"yih",
			"ji",
			"yi",
			"hbo",
			"men",
			"xmn",
			"fa",
			"jpr",
			"peo",
			"pes",
			"prs",
			"dv",
			"sam",
			"ckb",
		];
		const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
		if (lng.toLowerCase().indexOf("-latn") > 1) return "ltr";
		return rtlLngs.includes(languageUtils.getLanguagePartFromCode(lng)) || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
	}
	static createInstance(options = {}, callback) {
		const instance = new I18n(options, callback);
		instance.createInstance = I18n.createInstance;
		return instance;
	}
	cloneInstance(options = {}, callback = noop$2) {
		const forkResourceStore = options.forkResourceStore;
		if (forkResourceStore) delete options.forkResourceStore;
		const mergedOptions = {
			...this.options,
			...options,
			...{
				isClone: true,
			},
		};
		const clone = new I18n(mergedOptions);
		if (options.debug !== undefined || options.prefix !== undefined) {
			clone.logger = clone.logger.clone(options);
		}
		const membersToCopy = ["store", "services", "language"];
		membersToCopy.forEach((m) => {
			clone[m] = this[m];
		});
		clone.services = {
			...this.services,
		};
		clone.services.utils = {
			hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone),
		};
		if (forkResourceStore) {
			const clonedData = Object.keys(this.store.data).reduce((prev, l) => {
				prev[l] = {
					...this.store.data[l],
				};
				prev[l] = Object.keys(prev[l]).reduce((acc, n) => {
					acc[n] = {
						...prev[l][n],
					};
					return acc;
				}, prev[l]);
				return prev;
			}, {});
			clone.store = new ResourceStore(clonedData, mergedOptions);
			clone.services.resourceStore = clone.store;
		}
		if (options.interpolation) {
			const defOpts = get();
			const mergedInterpolation = {
				...defOpts.interpolation,
				...this.options.interpolation,
				...options.interpolation,
			};
			const mergedForInterpolator = {
				...mergedOptions,
				interpolation: mergedInterpolation,
			};
			clone.services.interpolator = new Interpolator(mergedForInterpolator);
		}
		clone.translator = new Translator(clone.services, mergedOptions);
		clone.translator.on("*", (event, ...args) => {
			clone.emit(event, ...args);
		});
		clone.init(mergedOptions, callback);
		clone.translator.options = mergedOptions;
		clone.translator.backendConnector.services.utils = {
			hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone),
		};
		return clone;
	}
	toJSON() {
		return {
			options: this.options,
			store: this.store,
			language: this.language,
			languages: this.languages,
			resolvedLanguage: this.resolvedLanguage,
		};
	}
}
const instance = I18n.createInstance();

instance.createInstance;
instance.dir;
instance.init;
instance.loadResources;
instance.reloadResources;
instance.use;
instance.changeLanguage;
instance.getFixedT;
instance.t;
instance.exists;
instance.setDefaultNamespace;
instance.hasLoadedNamespace;
instance.loadNamespaces;
instance.loadLanguages;

const warn = (i18n, code, msg, rest) => {
	const args = [
		msg,
		{
			code,
			...(rest || {}),
		},
	];
	if (i18n?.services?.logger?.forward) {
		return i18n.services.logger.forward(args, "warn", "react-i18next::", true);
	}
	if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
	if (i18n?.services?.logger?.warn) {
		i18n.services.logger.warn(...args);
	} else if (console?.warn) {
		console.warn(...args);
	}
};
const alreadyWarned = {};
const warnOnce = (i18n, code, msg, rest) => {
	if (isString(msg) && alreadyWarned[msg]) return;
	if (isString(msg)) alreadyWarned[msg] = new Date();
	warn(i18n, code, msg, rest);
};
const loadedClb = (i18n, cb) => () => {
	if (i18n.isInitialized) {
		cb();
	} else {
		const initialized = () => {
			setTimeout(() => {
				i18n.off("initialized", initialized);
			}, 0);
			cb();
		};
		i18n.on("initialized", initialized);
	}
};
const loadNamespaces = (i18n, ns, cb) => {
	i18n.loadNamespaces(ns, loadedClb(i18n, cb));
};
const loadLanguages = (i18n, lng, ns, cb) => {
	if (isString(ns)) ns = [ns];
	if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
	ns.forEach((n) => {
		if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
	});
	i18n.loadLanguages(lng, loadedClb(i18n, cb));
};
const hasLoadedNamespace = (ns, i18n, options = {}) => {
	if (!i18n.languages || !i18n.languages.length) {
		warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
			languages: i18n.languages,
		});
		return true;
	}
	return i18n.hasLoadedNamespace(ns, {
		lng: options.lng,
		precheck: (i18nInstance, loadNotPending) => {
			if (
				options.bindI18n &&
				options.bindI18n.indexOf("languageChanging") > -1 &&
				i18nInstance.services.backendConnector.backend &&
				i18nInstance.isLanguageChangingTo &&
				!loadNotPending(i18nInstance.isLanguageChangingTo, ns)
			)
				return false;
		},
	});
};
const isString = (obj) => typeof obj === "string";
const isObject$1 = (obj) => typeof obj === "object" && obj !== null;

const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
const htmlEntities = {
	"&amp;": "&",
	"&#38;": "&",
	"&lt;": "<",
	"&#60;": "<",
	"&gt;": ">",
	"&#62;": ">",
	"&apos;": "'",
	"&#39;": "'",
	"&quot;": '"',
	"&#34;": '"',
	"&nbsp;": " ",
	"&#160;": " ",
	"&copy;": "©",
	"&#169;": "©",
	"&reg;": "®",
	"&#174;": "®",
	"&hellip;": "…",
	"&#8230;": "…",
	"&#x2F;": "/",
	"&#47;": "/",
};
const unescapeHtmlEntity = (m) => htmlEntities[m];
const unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);

let defaultOptions$2 = {
	bindI18n: "languageChanged",
	bindI18nStore: "",
	transEmptyNodeValue: "",
	transSupportBasicHtmlNodes: true,
	transWrapTextNodes: "",
	transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
	useSuspense: true,
	unescape,
	transDefaultProps: undefined,
};
const setDefaults = (options = {}) => {
	defaultOptions$2 = {
		...defaultOptions$2,
		...options,
	};
};
const getDefaults = () => defaultOptions$2;

let i18nInstance;
const setI18n = (instance) => {
	i18nInstance = instance;
};
const getI18n = () => i18nInstance;

const initReactI18next = {
	type: "3rdParty",
	init(instance) {
		setDefaults(instance.options.react);
		setI18n(instance);
	},
};

const { createContext: createContext$3 } = await importShared("react");
const I18nContext = createContext$3();
class ReportNamespaces {
	constructor() {
		this.usedNamespaces = {};
	}
	addUsedNamespaces(namespaces) {
		namespaces.forEach((ns) => {
			if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
		});
	}
	getUsedNamespaces() {
		return Object.keys(this.usedNamespaces);
	}
}

const { useContext: useContext$3, useCallback: useCallback$4, useMemo: useMemo$2, useEffect: useEffect$3, useRef: useRef$3, useState: useState$3 } = await importShared("react");
const notReadyT = (k, optsOrDefaultValue) => {
	if (isString(optsOrDefaultValue)) return optsOrDefaultValue;
	if (isObject$1(optsOrDefaultValue) && isString(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
	if (typeof k === "function") return "";
	if (Array.isArray(k)) {
		const last = k[k.length - 1];
		return typeof last === "function" ? "" : last;
	}
	return k;
};
const notReadySnapshot = {
	t: notReadyT,
	ready: false,
};
const dummySubscribe = () => () => {};
const useTranslation = (ns, props = {}) => {
	const { i18n: i18nFromProps } = props;
	const { i18n: i18nFromContext, defaultNS: defaultNSFromContext } = useContext$3(I18nContext) || {};
	const i18n = i18nFromProps || i18nFromContext || getI18n();
	if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
	if (!i18n) {
		warnOnce(i18n, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
	}
	const i18nOptions = useMemo$2(
		() => ({
			...getDefaults(),
			...i18n?.options?.react,
			...props,
		}),
		[i18n, props],
	);
	const { useSuspense, keyPrefix } = i18nOptions;
	const nsOrContext = ns || defaultNSFromContext || i18n?.options?.defaultNS;
	const unstableNamespaces = isString(nsOrContext) ? [nsOrContext] : nsOrContext || ["translation"];
	const namespaces = useMemo$2(() => unstableNamespaces, unstableNamespaces);
	i18n?.reportNamespaces?.addUsedNamespaces?.(namespaces);
	const revisionRef = useRef$3(0);
	const subscribe = useCallback$4(
		(callback) => {
			if (!i18n) return dummySubscribe;
			const { bindI18n, bindI18nStore } = i18nOptions;
			const wrappedCallback = () => {
				revisionRef.current += 1;
				callback();
			};
			if (bindI18n) i18n.on(bindI18n, wrappedCallback);
			if (bindI18nStore) i18n.store.on(bindI18nStore, wrappedCallback);
			return () => {
				if (bindI18n) bindI18n.split(" ").forEach((e) => i18n.off(e, wrappedCallback));
				if (bindI18nStore) bindI18nStore.split(" ").forEach((e) => i18n.store.off(e, wrappedCallback));
			};
		},
		[i18n, i18nOptions],
	);
	const snapshotRef = useRef$3();
	const getSnapshot = useCallback$4(() => {
		if (!i18n) {
			return notReadySnapshot;
		}
		const calculatedReady = !!(i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace(n, i18n, i18nOptions));
		const currentLng = props.lng || i18n.language;
		const currentRevision = revisionRef.current;
		const lastSnapshot = snapshotRef.current;
		if (lastSnapshot && lastSnapshot.ready === calculatedReady && lastSnapshot.lng === currentLng && lastSnapshot.keyPrefix === keyPrefix && lastSnapshot.revision === currentRevision) {
			return lastSnapshot;
		}
		const calculatedT = i18n.getFixedT(currentLng, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
		const newSnapshot = {
			t: calculatedT,
			ready: calculatedReady,
			lng: currentLng,
			keyPrefix,
			revision: currentRevision,
		};
		snapshotRef.current = newSnapshot;
		return newSnapshot;
	}, [i18n, namespaces, keyPrefix, i18nOptions, props.lng]);
	const [loadCount, setLoadCount] = useState$3(0);
	const { t, ready } = shimExports.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
	useEffect$3(() => {
		if (i18n && !ready && !useSuspense) {
			const onLoaded = () => setLoadCount((c) => c + 1);
			if (props.lng) {
				loadLanguages(i18n, props.lng, namespaces, onLoaded);
			} else {
				loadNamespaces(i18n, namespaces, onLoaded);
			}
		}
	}, [i18n, props.lng, namespaces, ready, useSuspense, loadCount]);
	const finalI18n = i18n || {};
	const wrapperRef = useRef$3(null);
	const wrapperLangRef = useRef$3();
	const createI18nWrapper = (original) => {
		const descriptors = Object.getOwnPropertyDescriptors(original);
		if (descriptors.__original) delete descriptors.__original;
		const wrapper = Object.create(Object.getPrototypeOf(original), descriptors);
		if (!Object.prototype.hasOwnProperty.call(wrapper, "__original")) {
			try {
				Object.defineProperty(wrapper, "__original", {
					value: original,
					writable: false,
					enumerable: false,
					configurable: false,
				});
			} catch (_) {}
		}
		return wrapper;
	};
	const ret = useMemo$2(() => {
		const original = finalI18n;
		const lang = original?.language;
		let i18nWrapper = original;
		if (original) {
			if (wrapperRef.current && wrapperRef.current.__original === original) {
				if (wrapperLangRef.current !== lang) {
					i18nWrapper = createI18nWrapper(original);
					wrapperRef.current = i18nWrapper;
					wrapperLangRef.current = lang;
				} else {
					i18nWrapper = wrapperRef.current;
				}
			} else {
				i18nWrapper = createI18nWrapper(original);
				wrapperRef.current = i18nWrapper;
				wrapperLangRef.current = lang;
			}
		}
		const effectiveT =
			!ready && !useSuspense ?
				(...args) => {
					warnOnce(i18n, "USE_T_BEFORE_READY", "useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.");
					return t(...args);
				}
			:	t;
		const arr = [effectiveT, i18nWrapper, ready];
		arr.t = effectiveT;
		arr.i18n = i18nWrapper;
		arr.ready = ready;
		return arr;
	}, [t, finalI18n, ready, finalI18n.resolvedLanguage, finalI18n.language, finalI18n.languages]);
	if (i18n && useSuspense && !ready) {
		throw new Promise((resolve) => {
			const onLoaded = () => resolve();
			if (props.lng) {
				loadLanguages(i18n, props.lng, namespaces, onLoaded);
			} else {
				loadNamespaces(i18n, namespaces, onLoaded);
			}
		});
	}
	return ret;
};

/**
 * @typedef Options
 *   Configuration.
 * @property {boolean | null | undefined} [jsx=false]
 *   Support JSX identifiers (default: `false`).
 */

const nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
const nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;

/** @type {Options} */
const emptyOptions = {};

/**
 * Checks if the given value is a valid identifier name.
 *
 * @param {string} name
 *   Identifier to check.
 * @param {Options | null | undefined} [options]
 *   Configuration (optional).
 * @returns {boolean}
 *   Whether `name` can be an identifier.
 */
function name(name, options) {
	const settings = emptyOptions;
	const re = settings.jsx ? nameReJsx : nameRe;
	return re.test(name);
}

var cjs$2 = {};

var cjs$1;
var hasRequiredCjs$2;

function requireCjs$2() {
	if (hasRequiredCjs$2) return cjs$1;
	hasRequiredCjs$2 = 1;

	// http://www.w3.org/TR/CSS21/grammar.html
	// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
	var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;

	var NEWLINE_REGEX = /\n/g;
	var WHITESPACE_REGEX = /^\s*/;

	// declaration
	var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
	var COLON_REGEX = /^:\s*/;
	var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
	var SEMICOLON_REGEX = /^[;\s]*/;

	// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
	var TRIM_REGEX = /^\s+|\s+$/g;

	// strings
	var NEWLINE = "\n";
	var FORWARD_SLASH = "/";
	var ASTERISK = "*";
	var EMPTY_STRING = "";

	// types
	var TYPE_COMMENT = "comment";
	var TYPE_DECLARATION = "declaration";

	/**
	 * @param {String} style
	 * @param {Object} [options]
	 * @return {Object[]}
	 * @throws {TypeError}
	 * @throws {Error}
	 */
	function index(style, options) {
		if (typeof style !== "string") {
			throw new TypeError("First argument must be a string");
		}

		if (!style) return [];

		options = options || {};

		/**
		 * Positional.
		 */
		var lineno = 1;
		var column = 1;

		/**
		 * Update lineno and column based on `str`.
		 *
		 * @param {String} str
		 */
		function updatePosition(str) {
			var lines = str.match(NEWLINE_REGEX);
			if (lines) lineno += lines.length;
			var i = str.lastIndexOf(NEWLINE);
			column = ~i ? str.length - i : column + str.length;
		}

		/**
		 * Mark position and patch `node.position`.
		 *
		 * @return {Function}
		 */
		function position() {
			var start = { line: lineno, column: column };
			return function (node) {
				node.position = new Position(start);
				whitespace();
				return node;
			};
		}

		/**
		 * Store position information for a node.
		 *
		 * @constructor
		 * @property {Object} start
		 * @property {Object} end
		 * @property {undefined|String} source
		 */
		function Position(start) {
			this.start = start;
			this.end = { line: lineno, column: column };
			this.source = options.source;
		}

		/**
		 * Non-enumerable source string.
		 */
		Position.prototype.content = style;

		/**
		 * Error `msg`.
		 *
		 * @param {String} msg
		 * @throws {Error}
		 */
		function error(msg) {
			var err = new Error(options.source + ":" + lineno + ":" + column + ": " + msg);
			err.reason = msg;
			err.filename = options.source;
			err.line = lineno;
			err.column = column;
			err.source = style;

			if (options.silent);
			else {
				throw err;
			}
		}

		/**
		 * Match `re` and return captures.
		 *
		 * @param {RegExp} re
		 * @return {undefined|Array}
		 */
		function match(re) {
			var m = re.exec(style);
			if (!m) return;
			var str = m[0];
			updatePosition(str);
			style = style.slice(str.length);
			return m;
		}

		/**
		 * Parse whitespace.
		 */
		function whitespace() {
			match(WHITESPACE_REGEX);
		}

		/**
		 * Parse comments.
		 *
		 * @param {Object[]} [rules]
		 * @return {Object[]}
		 */
		function comments(rules) {
			var c;
			rules = rules || [];
			while ((c = comment())) {
				if (c !== false) {
					rules.push(c);
				}
			}
			return rules;
		}

		/**
		 * Parse comment.
		 *
		 * @return {Object}
		 * @throws {Error}
		 */
		function comment() {
			var pos = position();
			if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;

			var i = 2;
			while (EMPTY_STRING != style.charAt(i) && (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))) {
				++i;
			}
			i += 2;

			if (EMPTY_STRING === style.charAt(i - 1)) {
				return error("End of comment missing");
			}

			var str = style.slice(2, i - 2);
			column += 2;
			updatePosition(str);
			style = style.slice(i);
			column += 2;

			return pos({
				type: TYPE_COMMENT,
				comment: str,
			});
		}

		/**
		 * Parse declaration.
		 *
		 * @return {Object}
		 * @throws {Error}
		 */
		function declaration() {
			var pos = position();

			// prop
			var prop = match(PROPERTY_REGEX);
			if (!prop) return;
			comment();

			// :
			if (!match(COLON_REGEX)) return error("property missing ':'");

			// val
			var val = match(VALUE_REGEX);

			var ret = pos({
				type: TYPE_DECLARATION,
				property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
				value: val ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) : EMPTY_STRING,
			});

			// ;
			match(SEMICOLON_REGEX);

			return ret;
		}

		/**
		 * Parse declarations.
		 *
		 * @return {Object[]}
		 */
		function declarations() {
			var decls = [];

			comments(decls);

			// declarations
			var decl;
			while ((decl = declaration())) {
				if (decl !== false) {
					decls.push(decl);
					comments(decls);
				}
			}

			return decls;
		}

		whitespace();
		return declarations();
	}

	/**
	 * Trim `str`.
	 *
	 * @param {String} str
	 * @return {String}
	 */
	function trim(str) {
		return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
	}

	cjs$1 = index;

	return cjs$1;
}

var hasRequiredCjs$1;

function requireCjs$1() {
	if (hasRequiredCjs$1) return cjs$2;
	hasRequiredCjs$1 = 1;
	var __importDefault =
		(cjs$2 && cjs$2.__importDefault) ||
		function (mod) {
			return mod && mod.__esModule ? mod : { default: mod };
		};
	Object.defineProperty(cjs$2, "__esModule", { value: true });
	cjs$2.default = StyleToObject;
	const inline_style_parser_1 = __importDefault(requireCjs$2());
	/**
	 * Parses inline style to object.
	 *
	 * @param style - Inline style.
	 * @param iterator - Iterator.
	 * @returns - Style object or null.
	 *
	 * @example Parsing inline style to object:
	 *
	 * ```js
	 * import parse from 'style-to-object';
	 * parse('line-height: 42;'); // { 'line-height': '42' }
	 * ```
	 */
	function StyleToObject(style, iterator) {
		let styleObject = null;
		if (!style || typeof style !== "string") {
			return styleObject;
		}
		const declarations = (0, inline_style_parser_1.default)(style);
		const hasIterator = typeof iterator === "function";
		declarations.forEach((declaration) => {
			if (declaration.type !== "declaration") {
				return;
			}
			const { property, value } = declaration;
			if (hasIterator) {
				iterator(property, value, declaration);
			} else if (value) {
				styleObject = styleObject || {};
				styleObject[property] = value;
			}
		});
		return styleObject;
	}

	return cjs$2;
}

var utilities = {};

var hasRequiredUtilities;

function requireUtilities() {
	if (hasRequiredUtilities) return utilities;
	hasRequiredUtilities = 1;
	Object.defineProperty(utilities, "__esModule", { value: true });
	utilities.camelCase = void 0;
	var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
	var HYPHEN_REGEX = /-([a-z])/g;
	var NO_HYPHEN_REGEX = /^[^-]+$/;
	var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;
	var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;
	/**
	 * Checks whether to skip camelCase.
	 */
	var skipCamelCase = function (property) {
		return !property || NO_HYPHEN_REGEX.test(property) || CUSTOM_PROPERTY_REGEX.test(property);
	};
	/**
	 * Replacer that capitalizes first character.
	 */
	var capitalize = function (match, character) {
		return character.toUpperCase();
	};
	/**
	 * Replacer that removes beginning hyphen of vendor prefix property.
	 */
	var trimHyphen = function (match, prefix) {
		return "".concat(prefix, "-");
	};
	/**
	 * CamelCases a CSS property.
	 */
	var camelCase = function (property, options) {
		if (options === void 0) {
			options = {};
		}
		if (skipCamelCase(property)) {
			return property;
		}
		property = property.toLowerCase();
		if (options.reactCompat) {
			// `-ms` vendor prefix should not be capitalized
			property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);
		} else {
			// for non-React, remove first hyphen so vendor prefix is not capitalized
			property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);
		}
		return property.replace(HYPHEN_REGEX, capitalize);
	};
	utilities.camelCase = camelCase;

	return utilities;
}

var cjs;
var hasRequiredCjs;

function requireCjs() {
	if (hasRequiredCjs) return cjs;
	hasRequiredCjs = 1;
	var __importDefault =
		(cjs && cjs.__importDefault) ||
		function (mod) {
			return mod && mod.__esModule ? mod : { default: mod };
		};
	var style_to_object_1 = __importDefault(requireCjs$1());
	var utilities_1 = requireUtilities();
	/**
	 * Parses CSS inline style to JavaScript object (camelCased).
	 */
	function StyleToJS(style, options) {
		var output = {};
		if (!style || typeof style !== "string") {
			return output;
		}
		(0, style_to_object_1.default)(style, function (property, value) {
			// skip CSS comment
			if (property && value) {
				output[(0, utilities_1.camelCase)(property, options)] = value;
			}
		});
		return output;
	}
	StyleToJS.default = StyleToJS;
	cjs = StyleToJS;

	return cjs;
}

var cjsExports = requireCjs();
const styleToJs = /*@__PURE__*/ getDefaultExportFromCjs(cjsExports);

/**
 * @import {Identifier, Literal, MemberExpression} from 'estree'
 * @import {Jsx, JsxDev, Options, Props} from 'hast-util-to-jsx-runtime'
 * @import {Element, Nodes, Parents, Root, Text} from 'hast'
 * @import {MdxFlowExpressionHast, MdxTextExpressionHast} from 'mdast-util-mdx-expression'
 * @import {MdxJsxFlowElementHast, MdxJsxTextElementHast} from 'mdast-util-mdx-jsx'
 * @import {MdxjsEsmHast} from 'mdast-util-mdxjs-esm'
 * @import {Position} from 'unist'
 * @import {Child, Create, Field, JsxElement, State, Style} from './types.js'
 */

// To do: next major: `Object.hasOwn`.
const own = {}.hasOwnProperty;

/** @type {Map<string, number>} */
const emptyMap = new Map();

const cap = /[A-Z]/g;

// `react-dom` triggers a warning for *any* white space in tables.
// To follow GFM, `mdast-util-to-hast` injects line endings between elements.
// Other tools might do so too, but they don’t do here, so we remove all of
// that.

// See: <https://github.com/facebook/react/pull/7081>.
// See: <https://github.com/facebook/react/pull/7515>.
// See: <https://github.com/remarkjs/remark-react/issues/64>.
// See: <https://github.com/rehypejs/rehype-react/pull/29>.
// See: <https://github.com/rehypejs/rehype-react/pull/32>.
// See: <https://github.com/rehypejs/rehype-react/pull/45>.
const tableElements = new Set(["table", "tbody", "thead", "tfoot", "tr"]);

const tableCellElement = new Set(["td", "th"]);

const docs = "https://github.com/syntax-tree/hast-util-to-jsx-runtime";

/**
 * Transform a hast tree to preact, react, solid, svelte, vue, etc.,
 * with an automatic JSX runtime.
 *
 * @param {Nodes} tree
 *   Tree to transform.
 * @param {Options} options
 *   Configuration (required).
 * @returns {JsxElement}
 *   JSX element.
 */

function toJsxRuntime(tree, options) {
	if (!options || options.Fragment === undefined) {
		throw new TypeError("Expected `Fragment` in options");
	}

	const filePath = options.filePath || undefined;
	/** @type {Create} */
	let create;

	if (options.development) {
		if (typeof options.jsxDEV !== "function") {
			throw new TypeError("Expected `jsxDEV` in options when `development: true`");
		}

		create = developmentCreate(filePath, options.jsxDEV);
	} else {
		if (typeof options.jsx !== "function") {
			throw new TypeError("Expected `jsx` in production options");
		}

		if (typeof options.jsxs !== "function") {
			throw new TypeError("Expected `jsxs` in production options");
		}

		create = productionCreate(filePath, options.jsx, options.jsxs);
	}

	/** @type {State} */
	const state = {
		Fragment: options.Fragment,
		ancestors: [],
		components: options.components || {},
		create,
		elementAttributeNameCase: options.elementAttributeNameCase || "react",
		evaluater: options.createEvaluater ? options.createEvaluater() : undefined,
		filePath,
		ignoreInvalidStyle: options.ignoreInvalidStyle || false,
		passKeys: options.passKeys !== false,
		passNode: options.passNode || false,
		schema: options.space === "svg" ? svg : html,
		stylePropertyNameCase: options.stylePropertyNameCase || "dom",
		tableCellAlignToStyle: options.tableCellAlignToStyle !== false,
	};

	const result = one(state, tree, undefined);

	// JSX element.
	if (result && typeof result !== "string") {
		return result;
	}

	// Text node or something that turned into nothing.
	return state.create(tree, state.Fragment, { children: result || undefined }, undefined);
}

/**
 * Transform a node.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Nodes} node
 *   Current node.
 * @param {string | undefined} key
 *   Key.
 * @returns {Child | undefined}
 *   Child, optional.
 */
function one(state, node, key) {
	if (node.type === "element") {
		return element(state, node, key);
	}

	if (node.type === "mdxFlowExpression" || node.type === "mdxTextExpression") {
		return mdxExpression(state, node);
	}

	if (node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") {
		return mdxJsxElement(state, node, key);
	}

	if (node.type === "mdxjsEsm") {
		return mdxEsm(state, node);
	}

	if (node.type === "root") {
		return root(state, node, key);
	}

	if (node.type === "text") {
		return text$1(state, node);
	}
}

/**
 * Handle element.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Element} node
 *   Current node.
 * @param {string | undefined} key
 *   Key.
 * @returns {Child | undefined}
 *   Child, optional.
 */
function element(state, node, key) {
	const parentSchema = state.schema;
	let schema = parentSchema;

	if (node.tagName.toLowerCase() === "svg" && parentSchema.space === "html") {
		schema = svg;
		state.schema = schema;
	}

	state.ancestors.push(node);

	const type = findComponentFromName(state, node.tagName, false);
	const props = createElementProps(state, node);
	let children = createChildren(state, node);

	if (tableElements.has(node.tagName)) {
		children = children.filter(function (child) {
			return typeof child === "string" ? !whitespace(child) : true;
		});
	}

	addNode(state, props, type, node);
	addChildren(props, children);

	// Restore.
	state.ancestors.pop();
	state.schema = parentSchema;

	return state.create(node, type, props, key);
}

/**
 * Handle MDX expression.
 *
 * @param {State} state
 *   Info passed around.
 * @param {MdxFlowExpressionHast | MdxTextExpressionHast} node
 *   Current node.
 * @returns {Child | undefined}
 *   Child, optional.
 */
function mdxExpression(state, node) {
	if (node.data && node.data.estree && state.evaluater) {
		const program = node.data.estree;
		const expression = program.body[0];
		ok(expression.type === "ExpressionStatement");

		// Assume result is a child.
		return /** @type {Child | undefined} */ (state.evaluater.evaluateExpression(expression.expression));
	}

	crashEstree(state, node.position);
}

/**
 * Handle MDX ESM.
 *
 * @param {State} state
 *   Info passed around.
 * @param {MdxjsEsmHast} node
 *   Current node.
 * @returns {Child | undefined}
 *   Child, optional.
 */
function mdxEsm(state, node) {
	if (node.data && node.data.estree && state.evaluater) {
		// Assume result is a child.
		return /** @type {Child | undefined} */ (state.evaluater.evaluateProgram(node.data.estree));
	}

	crashEstree(state, node.position);
}

/**
 * Handle MDX JSX.
 *
 * @param {State} state
 *   Info passed around.
 * @param {MdxJsxFlowElementHast | MdxJsxTextElementHast} node
 *   Current node.
 * @param {string | undefined} key
 *   Key.
 * @returns {Child | undefined}
 *   Child, optional.
 */
function mdxJsxElement(state, node, key) {
	const parentSchema = state.schema;
	let schema = parentSchema;

	if (node.name === "svg" && parentSchema.space === "html") {
		schema = svg;
		state.schema = schema;
	}

	state.ancestors.push(node);

	const type = node.name === null ? state.Fragment : findComponentFromName(state, node.name, true);
	const props = createJsxElementProps(state, node);
	const children = createChildren(state, node);

	addNode(state, props, type, node);
	addChildren(props, children);

	// Restore.
	state.ancestors.pop();
	state.schema = parentSchema;

	return state.create(node, type, props, key);
}

/**
 * Handle root.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Root} node
 *   Current node.
 * @param {string | undefined} key
 *   Key.
 * @returns {Child | undefined}
 *   Child, optional.
 */
function root(state, node, key) {
	/** @type {Props} */
	const props = {};

	addChildren(props, createChildren(state, node));

	return state.create(node, state.Fragment, props, key);
}

/**
 * Handle text.
 *
 * @param {State} _
 *   Info passed around.
 * @param {Text} node
 *   Current node.
 * @returns {Child | undefined}
 *   Child, optional.
 */
function text$1(_, node) {
	return node.value;
}

/**
 * Add `node` to props.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Props} props
 *   Props.
 * @param {unknown} type
 *   Type.
 * @param {Element | MdxJsxFlowElementHast | MdxJsxTextElementHast} node
 *   Node.
 * @returns {undefined}
 *   Nothing.
 */
function addNode(state, props, type, node) {
	// If this is swapped out for a component:
	if (typeof type !== "string" && type !== state.Fragment && state.passNode) {
		props.node = node;
	}
}

/**
 * Add children to props.
 *
 * @param {Props} props
 *   Props.
 * @param {Array<Child>} children
 *   Children.
 * @returns {undefined}
 *   Nothing.
 */
function addChildren(props, children) {
	if (children.length > 0) {
		const value = children.length > 1 ? children : children[0];

		if (value) {
			props.children = value;
		}
	}
}

/**
 * @param {string | undefined} _
 *   Path to file.
 * @param {Jsx} jsx
 *   Dynamic.
 * @param {Jsx} jsxs
 *   Static.
 * @returns {Create}
 *   Create a production element.
 */
function productionCreate(_, jsx, jsxs) {
	return create;
	/** @type {Create} */
	function create(_, type, props, key) {
		// Only an array when there are 2 or more children.
		const isStaticChildren = Array.isArray(props.children);
		const fn = isStaticChildren ? jsxs : jsx;
		return key ? fn(type, props, key) : fn(type, props);
	}
}

/**
 * @param {string | undefined} filePath
 *   Path to file.
 * @param {JsxDev} jsxDEV
 *   Development.
 * @returns {Create}
 *   Create a development element.
 */
function developmentCreate(filePath, jsxDEV) {
	return create;
	/** @type {Create} */
	function create(node, type, props, key) {
		// Only an array when there are 2 or more children.
		const isStaticChildren = Array.isArray(props.children);
		const point = pointStart(node);
		return jsxDEV(
			type,
			props,
			key,
			isStaticChildren,
			{
				columnNumber: point ? point.column - 1 : undefined,
				fileName: filePath,
				lineNumber: point ? point.line : undefined,
			},
			undefined,
		);
	}
}

/**
 * Create props from an element.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Element} node
 *   Current element.
 * @returns {Props}
 *   Props.
 */
function createElementProps(state, node) {
	/** @type {Props} */
	const props = {};
	/** @type {string | undefined} */
	let alignValue;
	/** @type {string} */
	let prop;

	for (prop in node.properties) {
		if (prop !== "children" && own.call(node.properties, prop)) {
			const result = createProperty(state, prop, node.properties[prop]);

			if (result) {
				const [key, value] = result;

				if (state.tableCellAlignToStyle && key === "align" && typeof value === "string" && tableCellElement.has(node.tagName)) {
					alignValue = value;
				} else {
					props[key] = value;
				}
			}
		}
	}

	if (alignValue) {
		// Assume style is an object.
		const style = /** @type {Style} */ (props.style || (props.style = {}));
		style[state.stylePropertyNameCase === "css" ? "text-align" : "textAlign"] = alignValue;
	}

	return props;
}

/**
 * Create props from a JSX element.
 *
 * @param {State} state
 *   Info passed around.
 * @param {MdxJsxFlowElementHast | MdxJsxTextElementHast} node
 *   Current JSX element.
 * @returns {Props}
 *   Props.
 */
function createJsxElementProps(state, node) {
	/** @type {Props} */
	const props = {};

	for (const attribute of node.attributes) {
		if (attribute.type === "mdxJsxExpressionAttribute") {
			if (attribute.data && attribute.data.estree && state.evaluater) {
				const program = attribute.data.estree;
				const expression = program.body[0];
				ok(expression.type === "ExpressionStatement");
				const objectExpression = expression.expression;
				ok(objectExpression.type === "ObjectExpression");
				const property = objectExpression.properties[0];
				ok(property.type === "SpreadElement");

				Object.assign(props, state.evaluater.evaluateExpression(property.argument));
			} else {
				crashEstree(state, node.position);
			}
		} else {
			// For JSX, the author is responsible of passing in the correct values.
			const name = attribute.name;
			/** @type {unknown} */
			let value;

			if (attribute.value && typeof attribute.value === "object") {
				if (attribute.value.data && attribute.value.data.estree && state.evaluater) {
					const program = attribute.value.data.estree;
					const expression = program.body[0];
					ok(expression.type === "ExpressionStatement");
					value = state.evaluater.evaluateExpression(expression.expression);
				} else {
					crashEstree(state, node.position);
				}
			} else {
				value = attribute.value === null ? true : attribute.value;
			}

			// Assume a prop.
			props[name] = /** @type {Props[keyof Props]} */ (value);
		}
	}

	return props;
}

/**
 * Create children.
 *
 * @param {State} state
 *   Info passed around.
 * @param {Parents} node
 *   Current element.
 * @returns {Array<Child>}
 *   Children.
 */
function createChildren(state, node) {
	/** @type {Array<Child>} */
	const children = [];
	let index = -1;
	/** @type {Map<string, number>} */
	// Note: test this when Solid doesn’t want to merge my upcoming PR.
	/* c8 ignore next */
	const countsByName = state.passKeys ? new Map() : emptyMap;

	while (++index < node.children.length) {
		const child = node.children[index];
		/** @type {string | undefined} */
		let key;

		if (state.passKeys) {
			const name =
				child.type === "element" ? child.tagName
				: child.type === "mdxJsxFlowElement" || child.type === "mdxJsxTextElement" ? child.name
				: undefined;

			if (name) {
				const count = countsByName.get(name) || 0;
				key = name + "-" + count;
				countsByName.set(name, count + 1);
			}
		}

		const result = one(state, child, key);
		if (result !== undefined) children.push(result);
	}

	return children;
}

/**
 * Handle a property.
 *
 * @param {State} state
 *   Info passed around.
 * @param {string} prop
 *   Key.
 * @param {Array<number | string> | boolean | number | string | null | undefined} value
 *   hast property value.
 * @returns {Field | undefined}
 *   Field for runtime, optional.
 */
function createProperty(state, prop, value) {
	const info = find(state.schema, prop);

	// Ignore nullish and `NaN` values.
	if (value === null || value === undefined || (typeof value === "number" && Number.isNaN(value))) {
		return;
	}

	if (Array.isArray(value)) {
		// Accept `array`.
		// Most props are space-separated.
		value = info.commaSeparated ? stringify(value) : stringify$1(value);
	}

	// React only accepts `style` as object.
	if (info.property === "style") {
		let styleObject = typeof value === "object" ? value : parseStyle(state, String(value));

		if (state.stylePropertyNameCase === "css") {
			styleObject = transformStylesToCssCasing(styleObject);
		}

		return ["style", styleObject];
	}

	return [state.elementAttributeNameCase === "react" && info.space ? hastToReact[info.property] || info.property : info.attribute, value];
}

/**
 * Parse a CSS declaration to an object.
 *
 * @param {State} state
 *   Info passed around.
 * @param {string} value
 *   CSS declarations.
 * @returns {Style}
 *   Properties.
 * @throws
 *   Throws `VFileMessage` when CSS cannot be parsed.
 */
function parseStyle(state, value) {
	try {
		return styleToJs(value, { reactCompat: true });
	} catch (error) {
		if (state.ignoreInvalidStyle) {
			return {};
		}

		const cause = /** @type {Error} */ (error);
		const message = new VFileMessage("Cannot parse `style` attribute", {
			ancestors: state.ancestors,
			cause,
			ruleId: "style",
			source: "hast-util-to-jsx-runtime",
		});
		message.file = state.filePath || undefined;
		message.url = docs + "#cannot-parse-style-attribute";

		throw message;
	}
}

/**
 * Create a JSX name from a string.
 *
 * @param {State} state
 *   To do.
 * @param {string} name
 *   Name.
 * @param {boolean} allowExpression
 *   Allow member expressions and identifiers.
 * @returns {unknown}
 *   To do.
 */
function findComponentFromName(state, name$1, allowExpression) {
	/** @type {Identifier | Literal | MemberExpression} */
	let result;

	if (!allowExpression) {
		result = { type: "Literal", value: name$1 };
	} else if (name$1.includes(".")) {
		const identifiers = name$1.split(".");
		let index = -1;
		/** @type {Identifier | Literal | MemberExpression | undefined} */
		let node;

		while (++index < identifiers.length) {
			/** @type {Identifier | Literal} */
			const prop = name(identifiers[index]) ? { type: "Identifier", name: identifiers[index] } : { type: "Literal", value: identifiers[index] };
			node =
				node ?
					{
						type: "MemberExpression",
						object: node,
						property: prop,
						computed: Boolean(index && prop.type === "Literal"),
						optional: false,
					}
				:	prop;
		}
		result = node;
	} else {
		result = name(name$1) && !/^[a-z]/.test(name$1) ? { type: "Identifier", name: name$1 } : { type: "Literal", value: name$1 };
	}

	// Only literals can be passed in `components` currently.
	// No identifiers / member expressions.
	if (result.type === "Literal") {
		const name = /** @type {string | number} */ (result.value);
		return own.call(state.components, name) ? state.components[name] : name;
	}

	// Assume component.
	if (state.evaluater) {
		return state.evaluater.evaluateExpression(result);
	}

	crashEstree(state);
}

/**
 * @param {State} state
 * @param {Position | undefined} [place]
 * @returns {never}
 */
function crashEstree(state, place) {
	const message = new VFileMessage("Cannot handle MDX estrees without `createEvaluater`", {
		ancestors: state.ancestors,
		place,
		ruleId: "mdx-estree",
		source: "hast-util-to-jsx-runtime",
	});
	message.file = state.filePath || undefined;
	message.url = docs + "#cannot-handle-mdx-estrees-without-createevaluater";

	throw message;
}

/**
 * Transform a DOM casing style object to a CSS casing style object.
 *
 * @param {Style} domCasing
 * @returns {Style}
 */
function transformStylesToCssCasing(domCasing) {
	/** @type {Style} */
	const cssCasing = {};
	/** @type {string} */
	let from;

	for (from in domCasing) {
		if (own.call(domCasing, from)) {
			cssCasing[transformStyleToCssCasing(from)] = domCasing[from];
		}
	}

	return cssCasing;
}

/**
 * Transform a DOM casing style field to a CSS casing style field.
 *
 * @param {string} from
 * @returns {string}
 */
function transformStyleToCssCasing(from) {
	let to = from.replace(cap, toDash);
	// Handle `ms-xxx` -> `-ms-xxx`.
	if (to.slice(0, 3) === "ms-") to = "-" + to;
	return to;
}

/**
 * Make `$0` dash cased.
 *
 * @param {string} $0
 *   Capitalized ASCII leter.
 * @returns {string}
 *   Dash and lower letter.
 */
function toDash($0) {
	return "-" + $0.toLowerCase();
}

/**
 * HTML URL properties.
 *
 * Each key is a property name and each value is a list of tag names it applies
 * to or `null` if it applies to all elements.
 *
 * @type {Record<string, Array<string> | null>}
 */
const urlAttributes = {
	action: ["form"],
	cite: ["blockquote", "del", "ins", "q"],
	data: ["object"],
	formAction: ["button", "input"],
	href: ["a", "area", "base", "link"],
	icon: ["menuitem"],
	itemId: null,
	manifest: ["html"],
	ping: ["a", "area"],
	poster: ["video"],
	src: ["audio", "embed", "iframe", "img", "input", "script", "source", "track", "video"],
};

const { useEffect: useEffect$2, useState: useState$2 } = await importShared("react");

const changelog = "https://github.com/remarkjs/react-markdown/blob/main/changelog.md";

/** @type {PluggableList} */
const emptyPlugins = [];
/** @type {Readonly<RemarkRehypeOptions>} */
const emptyRemarkRehypeOptions = { allowDangerousHtml: true };
const safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i;

// Mutable because we `delete` any time it’s used and a message is sent.
/** @type {ReadonlyArray<Readonly<Deprecation>>} */
const deprecations = [
	{ from: "astPlugins", id: "remove-buggy-html-in-markdown-parser" },
	{ from: "allowDangerousHtml", id: "remove-buggy-html-in-markdown-parser" },
	{
		from: "allowNode",
		id: "replace-allownode-allowedtypes-and-disallowedtypes",
		to: "allowElement",
	},
	{
		from: "allowedTypes",
		id: "replace-allownode-allowedtypes-and-disallowedtypes",
		to: "allowedElements",
	},
	{ from: "className", id: "remove-classname" },
	{
		from: "disallowedTypes",
		id: "replace-allownode-allowedtypes-and-disallowedtypes",
		to: "disallowedElements",
	},
	{ from: "escapeHtml", id: "remove-buggy-html-in-markdown-parser" },
	{ from: "includeElementIndex", id: "#remove-includeelementindex" },
	{
		from: "includeNodeIndex",
		id: "change-includenodeindex-to-includeelementindex",
	},
	{ from: "linkTarget", id: "remove-linktarget" },
	{ from: "plugins", id: "change-plugins-to-remarkplugins", to: "remarkPlugins" },
	{ from: "rawSourcePos", id: "#remove-rawsourcepos" },
	{ from: "renderers", id: "change-renderers-to-components", to: "components" },
	{ from: "source", id: "change-source-to-children", to: "children" },
	{ from: "sourcePos", id: "#remove-sourcepos" },
	{ from: "transformImageUri", id: "#add-urltransform", to: "urlTransform" },
	{ from: "transformLinkUri", id: "#add-urltransform", to: "urlTransform" },
];

/**
 * Component to render markdown.
 *
 * This is a synchronous component.
 * When using async plugins,
 * see {@linkcode MarkdownAsync} or {@linkcode MarkdownHooks}.
 *
 * @param {Readonly<Options>} options
 *   Props.
 * @returns {ReactElement}
 *   React element.
 */
function Markdown(options) {
	const processor = createProcessor(options);
	const file = createFile(options);
	return post(processor.runSync(processor.parse(file), file), options);
}

/**
 * Set up the `unified` processor.
 *
 * @param {Readonly<Options>} options
 *   Props.
 * @returns {Processor<MdastRoot, MdastRoot, Root, undefined, undefined>}
 *   Result.
 */
function createProcessor(options) {
	const rehypePlugins = options.rehypePlugins || emptyPlugins;
	const remarkPlugins = options.remarkPlugins || emptyPlugins;
	const remarkRehypeOptions = options.remarkRehypeOptions ? { ...options.remarkRehypeOptions, ...emptyRemarkRehypeOptions } : emptyRemarkRehypeOptions;

	const processor = unified().use(remarkParse).use(remarkPlugins).use(remarkRehype, remarkRehypeOptions).use(rehypePlugins);

	return processor;
}

/**
 * Set up the virtual file.
 *
 * @param {Readonly<Options>} options
 *   Props.
 * @returns {VFile}
 *   Result.
 */
function createFile(options) {
	const children = options.children || "";
	const file = new VFile();

	if (typeof children === "string") {
		file.value = children;
	}

	return file;
}

/**
 * Process the result from unified some more.
 *
 * @param {Nodes} tree
 *   Tree.
 * @param {Readonly<Options>} options
 *   Props.
 * @returns {ReactElement}
 *   React element.
 */
function post(tree, options) {
	const allowedElements = options.allowedElements;
	const allowElement = options.allowElement;
	const components = options.components;
	const disallowedElements = options.disallowedElements;
	const skipHtml = options.skipHtml;
	const unwrapDisallowed = options.unwrapDisallowed;
	const urlTransform = options.urlTransform || defaultUrlTransform;

	for (const deprecation of deprecations) {
		if (Object.hasOwn(options, deprecation.from)) {
			unreachable(
				"Unexpected `" +
					deprecation.from +
					"` prop, " +
					(deprecation.to ? "use `" + deprecation.to + "` instead" : "remove it") +
					" (see <" +
					changelog +
					"#" +
					deprecation.id +
					"> for more info)",
			);
		}
	}

	visit(tree, transform);

	return toJsxRuntime(tree, {
		Fragment: jsxRuntimeExports.Fragment,
		components,
		ignoreInvalidStyle: true,
		jsx: jsxRuntimeExports.jsx,
		jsxs: jsxRuntimeExports.jsxs,
		passKeys: true,
		passNode: true,
	});

	/** @type {BuildVisitor<Root>} */
	function transform(node, index, parent) {
		if (node.type === "raw" && parent && typeof index === "number") {
			if (skipHtml) {
				parent.children.splice(index, 1);
			} else {
				parent.children[index] = { type: "text", value: node.value };
			}

			return index;
		}

		if (node.type === "element") {
			/** @type {string} */
			let key;

			for (key in urlAttributes) {
				if (Object.hasOwn(urlAttributes, key) && Object.hasOwn(node.properties, key)) {
					const value = node.properties[key];
					const test = urlAttributes[key];
					if (test === null || test.includes(node.tagName)) {
						node.properties[key] = urlTransform(String(value || ""), key, node);
					}
				}
			}
		}

		if (node.type === "element") {
			let remove =
				allowedElements ? !allowedElements.includes(node.tagName)
				: disallowedElements ? disallowedElements.includes(node.tagName)
				: false;

			if (!remove && allowElement && typeof index === "number") {
				remove = !allowElement(node, index, parent);
			}

			if (remove && parent && typeof index === "number") {
				if (unwrapDisallowed && node.children) {
					parent.children.splice(index, 1, ...node.children);
				} else {
					parent.children.splice(index, 1);
				}

				return index;
			}
		}
	}
}

/**
 * Make a URL safe.
 *
 * @satisfies {UrlTransform}
 * @param {string} value
 *   URL.
 * @returns {string}
 *   Safe URL.
 */
function defaultUrlTransform(value) {
	// Same as:
	// <https://github.com/micromark/micromark/blob/929275e/packages/micromark-util-sanitize-uri/dev/index.js#L34>
	// But without the `encode` part.
	const colon = value.indexOf(":");
	const questionMark = value.indexOf("?");
	const numberSign = value.indexOf("#");
	const slash = value.indexOf("/");

	if (
		// If there is no protocol, it’s relative.
		colon === -1 ||
		// If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
		(slash !== -1 && colon > slash) ||
		(questionMark !== -1 && colon > questionMark) ||
		(numberSign !== -1 && colon > numberSign) ||
		// It is a protocol, it should be allowed.
		safeProtocol.test(value.slice(0, colon))
	) {
		return value;
	}

	return "";
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Determine whether the given `arg` is a message.
 * If `desc` is set, determine whether `arg` is this specific message.
 */
function isMessage(arg, schema) {
	const isMessage = arg !== null && typeof arg == "object" && "$typeName" in arg && typeof arg.$typeName == "string";
	if (!isMessage) {
		return false;
	}
	if (schema === undefined) {
		return true;
	}
	return schema.typeName === arg.$typeName;
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Scalar value types. This is a subset of field types declared by protobuf
 * enum google.protobuf.FieldDescriptorProto.Type The types GROUP and MESSAGE
 * are omitted, but the numerical values are identical.
 */
var ScalarType;
(function (ScalarType) {
	// 0 is reserved for errors.
	// Order is weird for historical reasons.
	ScalarType[(ScalarType["DOUBLE"] = 1)] = "DOUBLE";
	ScalarType[(ScalarType["FLOAT"] = 2)] = "FLOAT";
	// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
	// negative values are likely.
	ScalarType[(ScalarType["INT64"] = 3)] = "INT64";
	ScalarType[(ScalarType["UINT64"] = 4)] = "UINT64";
	// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
	// negative values are likely.
	ScalarType[(ScalarType["INT32"] = 5)] = "INT32";
	ScalarType[(ScalarType["FIXED64"] = 6)] = "FIXED64";
	ScalarType[(ScalarType["FIXED32"] = 7)] = "FIXED32";
	ScalarType[(ScalarType["BOOL"] = 8)] = "BOOL";
	ScalarType[(ScalarType["STRING"] = 9)] = "STRING";
	// Tag-delimited aggregate.
	// Group type is deprecated and not supported in proto3. However, Proto3
	// implementations should still be able to parse the group wire format and
	// treat group fields as unknown fields.
	// TYPE_GROUP = 10,
	// TYPE_MESSAGE = 11,  // Length-delimited aggregate.
	// New in version 2.
	ScalarType[(ScalarType["BYTES"] = 12)] = "BYTES";
	ScalarType[(ScalarType["UINT32"] = 13)] = "UINT32";
	// TYPE_ENUM = 14,
	ScalarType[(ScalarType["SFIXED32"] = 15)] = "SFIXED32";
	ScalarType[(ScalarType["SFIXED64"] = 16)] = "SFIXED64";
	ScalarType[(ScalarType["SINT32"] = 17)] = "SINT32";
	ScalarType[(ScalarType["SINT64"] = 18)] = "SINT64";
})(ScalarType || (ScalarType = {}));

// Copyright 2008 Google Inc.  All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Code generated by the Protocol Buffer compiler is owned by the owner
// of the input file used when generating it.  This code is not
// standalone and requires a support library to be linked with it.  This
// support library is itself covered by the above license.
/**
 * Read a 64 bit varint as two JS numbers.
 *
 * Returns tuple:
 * [0]: low bits
 * [1]: high bits
 *
 * Copyright 2008 Google Inc.  All rights reserved.
 *
 * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175
 */
function varint64read() {
	let lowBits = 0;
	let highBits = 0;
	for (let shift = 0; shift < 28; shift += 7) {
		let b = this.buf[this.pos++];
		lowBits |= (b & 0x7f) << shift;
		if ((b & 0x80) == 0) {
			this.assertBounds();
			return [lowBits, highBits];
		}
	}
	let middleByte = this.buf[this.pos++];
	// last four bits of the first 32 bit number
	lowBits |= (middleByte & 0x0f) << 28;
	// 3 upper bits are part of the next 32 bit number
	highBits = (middleByte & 0x70) >> 4;
	if ((middleByte & 0x80) == 0) {
		this.assertBounds();
		return [lowBits, highBits];
	}
	for (let shift = 3; shift <= 31; shift += 7) {
		let b = this.buf[this.pos++];
		highBits |= (b & 0x7f) << shift;
		if ((b & 0x80) == 0) {
			this.assertBounds();
			return [lowBits, highBits];
		}
	}
	throw new Error("invalid varint");
}
// constants for binary math
const TWO_PWR_32_DBL = 0x100000000;
/**
 * Parse decimal string of 64 bit integer value as two JS numbers.
 *
 * Copyright 2008 Google Inc.  All rights reserved.
 *
 * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
 */
function int64FromString(dec) {
	// Check for minus sign.
	const minus = dec[0] === "-";
	if (minus) {
		dec = dec.slice(1);
	}
	// Work 6 decimal digits at a time, acting like we're converting base 1e6
	// digits to binary. This is safe to do with floating point math because
	// Number.isSafeInteger(ALL_32_BITS * 1e6) == true.
	const base = 1e6;
	let lowBits = 0;
	let highBits = 0;
	function add1e6digit(begin, end) {
		// Note: Number('') is 0.
		const digit1e6 = Number(dec.slice(begin, end));
		highBits *= base;
		lowBits = lowBits * base + digit1e6;
		// Carry bits from lowBits to
		if (lowBits >= TWO_PWR_32_DBL) {
			highBits = highBits + ((lowBits / TWO_PWR_32_DBL) | 0);
			lowBits = lowBits % TWO_PWR_32_DBL;
		}
	}
	add1e6digit(-24, -18);
	add1e6digit(-18, -12);
	add1e6digit(-12, -6);
	add1e6digit(-6);
	return minus ? negate(lowBits, highBits) : newBits(lowBits, highBits);
}
/**
 * Losslessly converts a 64-bit signed integer in 32:32 split representation
 * into a decimal string.
 *
 * Copyright 2008 Google Inc.  All rights reserved.
 *
 * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
 */
function int64ToString(lo, hi) {
	let bits = newBits(lo, hi);
	// If we're treating the input as a signed value and the high bit is set, do
	// a manual two's complement conversion before the decimal conversion.
	const negative = bits.hi & 0x80000000;
	if (negative) {
		bits = negate(bits.lo, bits.hi);
	}
	const result = uInt64ToString(bits.lo, bits.hi);
	return negative ? "-" + result : result;
}
/**
 * Losslessly converts a 64-bit unsigned integer in 32:32 split representation
 * into a decimal string.
 *
 * Copyright 2008 Google Inc.  All rights reserved.
 *
 * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
 */
function uInt64ToString(lo, hi) {
	({ lo, hi } = toUnsigned(lo, hi));
	// Skip the expensive conversion if the number is small enough to use the
	// built-in conversions.
	// Number.MAX_SAFE_INTEGER = 0x001FFFFF FFFFFFFF, thus any number with
	// highBits <= 0x1FFFFF can be safely expressed with a double and retain
	// integer precision.
	// Proven by: Number.isSafeInteger(0x1FFFFF * 2**32 + 0xFFFFFFFF) == true.
	if (hi <= 0x1fffff) {
		return String(TWO_PWR_32_DBL * hi + lo);
	}
	// What this code is doing is essentially converting the input number from
	// base-2 to base-1e7, which allows us to represent the 64-bit range with
	// only 3 (very large) digits. Those digits are then trivial to convert to
	// a base-10 string.
	// The magic numbers used here are -
	// 2^24 = 16777216 = (1,6777216) in base-1e7.
	// 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7.
	// Split 32:32 representation into 16:24:24 representation so our
	// intermediate digits don't overflow.
	const low = lo & 0xffffff;
	const mid = ((lo >>> 24) | (hi << 8)) & 0xffffff;
	const high = (hi >> 16) & 0xffff;
	// Assemble our three base-1e7 digits, ignoring carries. The maximum
	// value in a digit at this step is representable as a 48-bit integer, which
	// can be stored in a 64-bit floating point number.
	let digitA = low + mid * 6777216 + high * 6710656;
	let digitB = mid + high * 8147497;
	let digitC = high * 2;
	// Apply carries from A to B and from B to C.
	const base = 10000000;
	if (digitA >= base) {
		digitB += Math.floor(digitA / base);
		digitA %= base;
	}
	if (digitB >= base) {
		digitC += Math.floor(digitB / base);
		digitB %= base;
	}
	// If digitC is 0, then we should have returned in the trivial code path
	// at the top for non-safe integers. Given this, we can assume both digitB
	// and digitA need leading zeros.
	return digitC.toString() + decimalFrom1e7WithLeadingZeros(digitB) + decimalFrom1e7WithLeadingZeros(digitA);
}
function toUnsigned(lo, hi) {
	return { lo: lo >>> 0, hi: hi >>> 0 };
}
function newBits(lo, hi) {
	return { lo: lo | 0, hi: hi | 0 };
}
/**
 * Returns two's compliment negation of input.
 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Signed_32-bit_integers
 */
function negate(lowBits, highBits) {
	highBits = ~highBits;
	if (lowBits) {
		lowBits = ~lowBits + 1;
	} else {
		// If lowBits is 0, then bitwise-not is 0xFFFFFFFF,
		// adding 1 to that, results in 0x100000000, which leaves
		// the low bits 0x0 and simply adds one to the high bits.
		highBits += 1;
	}
	return newBits(lowBits, highBits);
}
/**
 * Returns decimal representation of digit1e7 with leading zeros.
 */
const decimalFrom1e7WithLeadingZeros = (digit1e7) => {
	const partial = String(digit1e7);
	return "0000000".slice(partial.length) + partial;
};
/**
 * Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)`
 *
 * Copyright 2008 Google Inc.  All rights reserved.
 *
 * See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144
 */
function varint32write(value, bytes) {
	if (value >= 0) {
		// write value as varint 32
		while (value > 0x7f) {
			bytes.push((value & 0x7f) | 0x80);
			value = value >>> 7;
		}
		bytes.push(value);
	} else {
		for (let i = 0; i < 9; i++) {
			bytes.push((value & 127) | 128);
			value = value >> 7;
		}
		bytes.push(1);
	}
}
/**
 * Read an unsigned 32 bit varint.
 *
 * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220
 */
function varint32read() {
	let b = this.buf[this.pos++];
	let result = b & 0x7f;
	if ((b & 0x80) == 0) {
		this.assertBounds();
		return result;
	}
	b = this.buf[this.pos++];
	result |= (b & 0x7f) << 7;
	if ((b & 0x80) == 0) {
		this.assertBounds();
		return result;
	}
	b = this.buf[this.pos++];
	result |= (b & 0x7f) << 14;
	if ((b & 0x80) == 0) {
		this.assertBounds();
		return result;
	}
	b = this.buf[this.pos++];
	result |= (b & 0x7f) << 21;
	if ((b & 0x80) == 0) {
		this.assertBounds();
		return result;
	}
	// Extract only last 4 bits
	b = this.buf[this.pos++];
	result |= (b & 0x0f) << 28;
	for (let readBytes = 5; (b & 0x80) !== 0 && readBytes < 10; readBytes++) b = this.buf[this.pos++];
	if ((b & 0x80) != 0) throw new Error("invalid varint");
	this.assertBounds();
	// Result can have 32 bits, convert it to unsigned
	return result >>> 0;
}

var define_process_env_default = {};
const protoInt64 = /* @__PURE__ */ makeInt64Support();
function makeInt64Support() {
	const dv = new DataView(new ArrayBuffer(8));
	const ok =
		typeof BigInt === "function" &&
		typeof dv.getBigInt64 === "function" &&
		typeof dv.getBigUint64 === "function" &&
		typeof dv.setBigInt64 === "function" &&
		typeof dv.setBigUint64 === "function" &&
		(!!globalThis.Deno || !!globalThis.Bun || typeof process != "object" || typeof define_process_env_default != "object" || define_process_env_default.BUF_BIGINT_DISABLE !== "1");
	if (ok) {
		const MIN = BigInt("-9223372036854775808");
		const MAX = BigInt("9223372036854775807");
		const UMIN = BigInt("0");
		const UMAX = BigInt("18446744073709551615");
		return {
			zero: BigInt(0),
			supported: true,
			parse(value) {
				const bi = typeof value == "bigint" ? value : BigInt(value);
				if (bi > MAX || bi < MIN) {
					throw new Error(`invalid int64: ${value}`);
				}
				return bi;
			},
			uParse(value) {
				const bi = typeof value == "bigint" ? value : BigInt(value);
				if (bi > UMAX || bi < UMIN) {
					throw new Error(`invalid uint64: ${value}`);
				}
				return bi;
			},
			enc(value) {
				dv.setBigInt64(0, this.parse(value), true);
				return {
					lo: dv.getInt32(0, true),
					hi: dv.getInt32(4, true),
				};
			},
			uEnc(value) {
				dv.setBigInt64(0, this.uParse(value), true);
				return {
					lo: dv.getInt32(0, true),
					hi: dv.getInt32(4, true),
				};
			},
			dec(lo, hi) {
				dv.setInt32(0, lo, true);
				dv.setInt32(4, hi, true);
				return dv.getBigInt64(0, true);
			},
			uDec(lo, hi) {
				dv.setInt32(0, lo, true);
				dv.setInt32(4, hi, true);
				return dv.getBigUint64(0, true);
			},
		};
	}
	return {
		zero: "0",
		supported: false,
		parse(value) {
			if (typeof value != "string") {
				value = value.toString();
			}
			assertInt64String(value);
			return value;
		},
		uParse(value) {
			if (typeof value != "string") {
				value = value.toString();
			}
			assertUInt64String(value);
			return value;
		},
		enc(value) {
			if (typeof value != "string") {
				value = value.toString();
			}
			assertInt64String(value);
			return int64FromString(value);
		},
		uEnc(value) {
			if (typeof value != "string") {
				value = value.toString();
			}
			assertUInt64String(value);
			return int64FromString(value);
		},
		dec(lo, hi) {
			return int64ToString(lo, hi);
		},
		uDec(lo, hi) {
			return uInt64ToString(lo, hi);
		},
	};
}
function assertInt64String(value) {
	if (!/^-?[0-9]+$/.test(value)) {
		throw new Error("invalid int64: " + value);
	}
}
function assertUInt64String(value) {
	if (!/^[0-9]+$/.test(value)) {
		throw new Error("invalid uint64: " + value);
	}
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Returns true if both scalar values are equal.
 *
 * For float and double, values are compared following IEEE semantics: -0
 * equals 0, and NaN does not equal NaN. This is value equality, not identity.
 *
 * It deliberately differs from isScalarZeroValue, which treats -0 as distinct
 * from 0. A value can equal the zero value without being a zero value
 * (scalarEquals(DOUBLE, -0, 0) is true while isScalarZeroValue(DOUBLE, -0) is
 * false) so this function must not be used to derive implicit presence.
 */
function scalarEquals(type, a, b) {
	if (a === b) {
		// This correctly matches equal values except BYTES and (possibly) 64-bit integers.
		return true;
	}
	// Special case BYTES - we need to compare each byte individually
	if (type == ScalarType.BYTES) {
		if (!(a instanceof Uint8Array) || !(b instanceof Uint8Array)) {
			return false;
		}
		if (a.length !== b.length) {
			return false;
		}
		for (let i = 0; i < a.length; i++) {
			if (a[i] !== b[i]) {
				return false;
			}
		}
		return true;
	}
	// Special case 64-bit integers - we support number, string and bigint representation.
	switch (type) {
		case ScalarType.UINT64:
		case ScalarType.FIXED64:
		case ScalarType.INT64:
		case ScalarType.SFIXED64:
		case ScalarType.SINT64:
			// Loose comparison will match between 0n, 0 and "0".
			return a == b;
	}
	// Anything that hasn't been caught by strict comparison or special cased
	// BYTES and 64-bit integers is not equal.
	return false;
}
/**
 * Returns the zero value for the given scalar type, the value a field of this
 * type has when unset: 0 for numeric types, "" for strings, false for
 * booleans, and an empty Uint8Array for bytes. For 64-bit integer types, the
 * result is "0" when longAsString is true, otherwise 0n.
 *
 * This is the type's zero value, not a proto2 custom field default. For float
 * and double it is +0; isScalarZeroValue treats only +0, not -0, as this value.
 */
function scalarZeroValue(type, longAsString) {
	switch (type) {
		case ScalarType.STRING:
			return "";
		case ScalarType.BOOL:
			return false;
		case ScalarType.DOUBLE:
		case ScalarType.FLOAT:
			return 0.0;
		case ScalarType.INT64:
		case ScalarType.UINT64:
		case ScalarType.SFIXED64:
		case ScalarType.FIXED64:
		case ScalarType.SINT64:
			return longAsString ? "0" : protoInt64.zero;
		case ScalarType.BYTES:
			return new Uint8Array(0);
		default:
			// Handles INT32, UINT32, SINT32, FIXED32, SFIXED32.
			// We do not use individual cases to save a few bytes code size.
			return 0;
	}
}
/**
 * Returns true if the value is the zero value for the given scalar type: `0`
 * for numeric types, `false` for booleans, `""` for strings, and an empty
 * Uint8Array for bytes.
 *
 * This is the implicit-presence default check. A singular field with implicit
 * presence is treated as unset, and omitted from the wire, when its value is
 * the zero value. With explicit presence, or in repeated and map fields,
 * presence is structural and this function does not apply.
 *
 * Note that -0 is NOT a zero value for float and double: under implicit
 * presence, +0 is omitted from the wire but -0 is written, following the
 * proto3 specification. As a result this can disagree with scalarEquals, which
 * compares by value and treats -0 as equal to 0.
 */
function isScalarZeroValue(type, value) {
	switch (type) {
		case ScalarType.BOOL:
			return value === false;
		case ScalarType.STRING:
			return value === "";
		case ScalarType.BYTES:
			return value instanceof Uint8Array && !value.byteLength;
		case ScalarType.DOUBLE:
		case ScalarType.FLOAT:
			// Object.is distinguishes -0 from 0.
			return Object.is(value, 0);
		default:
			// Loose comparison matches 0n, 0 and "0".
			return value == 0;
	}
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// bootstrap-inject google.protobuf.FeatureSet.FieldPresence.IMPLICIT: const $name: FeatureSet_FieldPresence.$localName = $number;
const IMPLICIT$2 = 2;
const unsafeLocal = Symbol.for("reflect unsafe local");
/**
 * Return the selected field of a oneof group.
 *
 * @private
 */
function unsafeOneofCase(
	// biome-ignore lint/suspicious/noExplicitAny: `any` is the best choice for dynamic access
	target,
	oneof,
) {
	const c = target[oneof.localName].case;
	if (c === undefined) {
		return c;
	}
	return oneof.fields.find((f) => f.localName === c);
}
/**
 * Returns true if the field is set.
 *
 * @private
 */
function unsafeIsSet(
	// biome-ignore lint/suspicious/noExplicitAny: `any` is the best choice for dynamic access
	target,
	field,
) {
	const name = field.localName;
	if (field.oneof) {
		return target[field.oneof.localName].case === name;
	}
	if (field.presence != IMPLICIT$2) {
		// Fields with explicit presence have properties on the prototype chain
		// for default / zero values (except for proto3).
		return target[name] !== undefined && Object.prototype.hasOwnProperty.call(target, name);
	}
	switch (field.fieldKind) {
		case "list":
			return target[name].length > 0;
		case "map":
			return Object.keys(target[name]).length > 0;
		case "scalar":
			return !isScalarZeroValue(field.scalar, target[name]);
		case "enum":
			return target[name] !== field.enum.values[0].number;
	}
	throw new Error("message field with implicit presence");
}
/**
 * Returns true if the field is set, but only for singular fields with explicit
 * presence (proto2).
 *
 * @private
 */
function unsafeIsSetExplicit(target, localName) {
	return Object.prototype.hasOwnProperty.call(target, localName) && target[localName] !== undefined;
}
/**
 * Return a field value, respecting oneof groups.
 *
 * @private
 */
function unsafeGet(target, field) {
	if (field.oneof) {
		const oneof = target[field.oneof.localName];
		if (oneof.case === field.localName) {
			return oneof.value;
		}
		return undefined;
	}
	return target[field.localName];
}
/**
 * Set a field value, respecting oneof groups.
 *
 * @private
 */
function unsafeSet(target, field, value) {
	if (field.oneof) {
		target[field.oneof.localName] = {
			case: field.localName,
			value: value,
		};
	} else {
		target[field.localName] = value;
	}
}
/**
 * Resets the field, so that unsafeIsSet() will return false.
 *
 * @private
 */
function unsafeClear(
	// biome-ignore lint/suspicious/noExplicitAny: `any` is the best choice for dynamic access
	target,
	field,
) {
	const name = field.localName;
	if (field.oneof) {
		const oneofLocalName = field.oneof.localName;
		if (target[oneofLocalName].case === name) {
			target[oneofLocalName] = { case: undefined };
		}
	} else if (field.presence != IMPLICIT$2) {
		// Fields with explicit presence have properties on the prototype chain
		// for default / zero values (except for proto3). By deleting their own
		// property, the field is reset.
		delete target[name];
	} else {
		switch (field.fieldKind) {
			case "map":
				target[name] = {};
				break;
			case "list":
				target[name] = [];
				break;
			case "enum":
				target[name] = field.enum.values[0].number;
				break;
			case "scalar":
				target[name] = scalarZeroValue(field.scalar, field.longAsString);
				break;
		}
	}
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
function isObject(arg) {
	return arg !== null && typeof arg == "object" && !Array.isArray(arg);
}
function isReflectList(arg, field) {
	var _a, _b, _c, _d;
	if (isObject(arg) && unsafeLocal in arg && "add" in arg && "field" in arg && typeof arg.field == "function") {
		if (field !== undefined) {
			const a = field;
			const b = arg.field();
			return (
				a.listKind == b.listKind &&
				a.scalar === b.scalar &&
				((_a = a.message) === null || _a === void 0 ? void 0 : _a.typeName) === ((_b = b.message) === null || _b === void 0 ? void 0 : _b.typeName) &&
				((_c = a.enum) === null || _c === void 0 ? void 0 : _c.typeName) === ((_d = b.enum) === null || _d === void 0 ? void 0 : _d.typeName)
			);
		}
		return true;
	}
	return false;
}
function isReflectMap(arg, field) {
	var _a, _b, _c, _d;
	if (isObject(arg) && unsafeLocal in arg && "has" in arg && "field" in arg && typeof arg.field == "function") {
		if (field !== undefined) {
			const a = field,
				b = arg.field();
			return (
				a.mapKey === b.mapKey &&
				a.mapKind == b.mapKind &&
				a.scalar === b.scalar &&
				((_a = a.message) === null || _a === void 0 ? void 0 : _a.typeName) === ((_b = b.message) === null || _b === void 0 ? void 0 : _b.typeName) &&
				((_c = a.enum) === null || _c === void 0 ? void 0 : _c.typeName) === ((_d = b.enum) === null || _d === void 0 ? void 0 : _d.typeName)
			);
		}
		return true;
	}
	return false;
}
function isReflectMessage(arg, messageDesc) {
	return isObject(arg) && unsafeLocal in arg && "desc" in arg && isObject(arg.desc) && arg.desc.kind === "message" && (messageDesc === undefined || arg.desc.typeName == messageDesc.typeName);
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
function isWrapper(arg) {
	return isWrapperTypeName(arg.$typeName);
}
function isWrapperDesc(messageDesc) {
	const f = messageDesc.fields[0];
	return isWrapperTypeName(messageDesc.typeName) && f !== undefined && f.fieldKind == "scalar" && f.name == "value" && f.number == 1;
}
function isWrapperTypeName(name) {
	return (
		name.startsWith("google.protobuf.") &&
		["DoubleValue", "FloatValue", "Int64Value", "UInt64Value", "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue"].includes(name.substring(16))
	);
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// bootstrap-inject google.protobuf.Edition.EDITION_PROTO3: const $name: Edition.$localName = $number;
const EDITION_PROTO3$1 = 999;
// bootstrap-inject google.protobuf.Edition.EDITION_PROTO2: const $name: Edition.$localName = $number;
const EDITION_PROTO2$1 = 998;
// bootstrap-inject google.protobuf.FeatureSet.FieldPresence.IMPLICIT: const $name: FeatureSet_FieldPresence.$localName = $number;
const IMPLICIT$1 = 2;
/**
 * Create a new message instance.
 *
 * The second argument is an optional initializer object, where all fields are
 * optional.
 */
function create(schema, init) {
	if (isMessage(init, schema)) {
		return init;
	}
	const message = createZeroMessage(schema);
	if (init !== undefined) {
		initMessage(schema, message, init);
	}
	return message;
}
/**
 * Sets field values from a MessageInitShape on a zero message.
 */
function initMessage(messageDesc, message, init) {
	for (const member of messageDesc.members) {
		let value = init[member.localName];
		if (value == null) {
			// intentionally ignore undefined and null
			continue;
		}
		let field;
		if (member.kind == "oneof") {
			const oneofField = unsafeOneofCase(init, member);
			if (!oneofField) {
				continue;
			}
			field = oneofField;
			value = unsafeGet(init, oneofField);
		} else {
			field = member;
		}
		switch (field.fieldKind) {
			case "message":
				value = toMessage(field, value);
				break;
			case "scalar":
				value = initScalar(field, value);
				break;
			case "list":
				value = initList(field, value);
				break;
			case "map":
				value = initMap(field, value);
				break;
		}
		unsafeSet(message, field, value);
	}
	return message;
}
function initScalar(field, value) {
	if (field.scalar == ScalarType.BYTES) {
		return toU8Arr(value);
	}
	return value;
}
function initMap(field, value) {
	if (isObject(value)) {
		if (field.scalar == ScalarType.BYTES) {
			return convertObjectValues(value, toU8Arr);
		}
		if (field.mapKind == "message") {
			return convertObjectValues(value, (val) => toMessage(field, val));
		}
	}
	return value;
}
function initList(field, value) {
	if (Array.isArray(value)) {
		if (field.scalar == ScalarType.BYTES) {
			return value.map(toU8Arr);
		}
		if (field.listKind == "message") {
			return value.map((item) => toMessage(field, item));
		}
	}
	return value;
}
function toMessage(field, value) {
	if (field.fieldKind == "message" && !field.oneof && isWrapperDesc(field.message)) {
		// Types from google/protobuf/wrappers.proto are unwrapped when used in
		// a singular field that is not part of a oneof group.
		return initScalar(field.message.fields[0], value);
	}
	if (isObject(value)) {
		if (field.message.typeName == "google.protobuf.Struct" && field.parent.typeName !== "google.protobuf.Value") {
			// google.protobuf.Struct is represented with JsonObject when used in a
			// field, except when used in google.protobuf.Value.
			return value;
		}
		if (!isMessage(value, field.message)) {
			return create(field.message, value);
		}
	}
	return value;
}
// converts any ArrayLike<number> to Uint8Array if necessary.
function toU8Arr(value) {
	return Array.isArray(value) ? new Uint8Array(value) : value;
}
function convertObjectValues(obj, fn) {
	const ret = {};
	for (const entry of Object.entries(obj)) {
		ret[entry[0]] = fn(entry[1]);
	}
	return ret;
}
const tokenZeroMessageField = Symbol();
const messagePrototypes = new WeakMap();
/**
 * Create a zero message.
 */
function createZeroMessage(desc) {
	let msg;
	if (!needsPrototypeChain(desc)) {
		msg = {
			$typeName: desc.typeName,
		};
		for (const member of desc.members) {
			if (member.kind == "oneof" || member.presence == IMPLICIT$1) {
				msg[member.localName] = createZeroField(member);
			}
		}
	} else {
		// Support default values and track presence via the prototype chain
		const cached = messagePrototypes.get(desc);
		let prototype;
		let members;
		if (cached) {
			({ prototype, members } = cached);
		} else {
			prototype = {};
			members = new Set();
			for (const member of desc.members) {
				if (member.kind == "oneof") {
					// we can only put immutable values on the prototype,
					// oneof ADTs are mutable
					continue;
				}
				if (member.fieldKind != "scalar" && member.fieldKind != "enum") {
					// only scalar and enum values are immutable, map, list, and message
					// are not
					continue;
				}
				if (member.presence == IMPLICIT$1) {
					// implicit presence tracks field presence by zero values - e.g. 0, false, "", are unset, 1, true, "x" are set.
					// message, map, list fields are mutable, and also have IMPLICIT presence.
					continue;
				}
				members.add(member);
				prototype[member.localName] = createZeroField(member);
			}
			messagePrototypes.set(desc, { prototype, members });
		}
		msg = Object.create(prototype);
		msg.$typeName = desc.typeName;
		for (const member of desc.members) {
			if (members.has(member)) {
				continue;
			}
			if (member.kind == "field") {
				if (member.fieldKind == "message") {
					continue;
				}
				if (member.fieldKind == "scalar" || member.fieldKind == "enum") {
					if (member.presence != IMPLICIT$1) {
						continue;
					}
				}
			}
			msg[member.localName] = createZeroField(member);
		}
	}
	return msg;
}
/**
 * Do we need the prototype chain to track field presence?
 */
function needsPrototypeChain(desc) {
	switch (desc.file.edition) {
		case EDITION_PROTO3$1:
			// proto3 always uses implicit presence, we never need the prototype chain.
			return false;
		case EDITION_PROTO2$1:
			// proto2 never uses implicit presence, we always need the prototype chain.
			return true;
		default:
			// If a message uses scalar or enum fields with explicit presence, we need
			// the prototype chain to track presence. This rule does not apply to fields
			// in a oneof group - they use a different mechanism to track presence.
			return desc.fields.some((f) => f.presence != IMPLICIT$1 && f.fieldKind != "message" && !f.oneof);
	}
}
/**
 * Returns a zero value for oneof groups, and for every field kind except
 * messages. Scalar and enum fields can have default values.
 */
function createZeroField(field) {
	if (field.kind == "oneof") {
		return { case: undefined };
	}
	if (field.fieldKind == "list") {
		return [];
	}
	if (field.fieldKind == "map") {
		return {}; // Object.create(null) would be desirable here, but is unsupported by react https://react.dev/reference/react/use-server#serializable-parameters-and-return-values
	}
	if (field.fieldKind == "message") {
		return tokenZeroMessageField;
	}
	const defaultValue = field.getDefaultValue();
	if (defaultValue !== undefined) {
		return field.fieldKind == "scalar" && field.longAsString ? defaultValue.toString() : defaultValue;
	}
	return field.fieldKind == "scalar" ? scalarZeroValue(field.scalar, field.longAsString) : field.enum.values[0].number;
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
class FieldError extends Error {
	constructor(fieldOrOneof, message, name = "FieldValueInvalidError") {
		super(message);
		this.name = name;
		this.field = () => fieldOrOneof;
	}
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const symbol = Symbol.for("@bufbuild/protobuf/text-encoding");
function getTextEncoding() {
	if (globalThis[symbol] == undefined) {
		const te = new globalThis.TextEncoder();
		const td = new globalThis.TextDecoder();
		let tdStrict;
		globalThis[symbol] = {
			encodeUtf8(text) {
				return te.encode(text);
			},
			decodeUtf8(bytes, strict) {
				if (strict) {
					if (tdStrict === undefined) {
						tdStrict = new globalThis.TextDecoder("utf-8", { fatal: true });
					}
					return tdStrict.decode(bytes);
				}
				return td.decode(bytes);
			},
			checkUtf8(text) {
				try {
					encodeURIComponent(text);
					return true;
				} catch (_) {
					return false;
				}
			},
		};
	}
	return globalThis[symbol];
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Protobuf binary format wire types.
 *
 * A wire type provides just enough information to find the length of the
 * following value.
 *
 * See https://developers.google.com/protocol-buffers/docs/encoding#structure
 */
var WireType;
(function (WireType) {
	/**
	 * Used for int32, int64, uint32, uint64, sint32, sint64, bool, enum
	 */
	WireType[(WireType["Varint"] = 0)] = "Varint";
	/**
	 * Used for fixed64, sfixed64, double.
	 * Always 8 bytes with little-endian byte order.
	 */
	WireType[(WireType["Bit64"] = 1)] = "Bit64";
	/**
	 * Used for string, bytes, embedded messages, packed repeated fields
	 *
	 * Only repeated numeric types (types which use the varint, 32-bit,
	 * or 64-bit wire types) can be packed. In proto3, such fields are
	 * packed by default.
	 */
	WireType[(WireType["LengthDelimited"] = 2)] = "LengthDelimited";
	/**
	 * Start of a tag-delimited aggregate, such as a proto2 group, or a message
	 * in editions with message_encoding = DELIMITED.
	 */
	WireType[(WireType["StartGroup"] = 3)] = "StartGroup";
	/**
	 * End of a tag-delimited aggregate.
	 */
	WireType[(WireType["EndGroup"] = 4)] = "EndGroup";
	/**
	 * Used for fixed32, sfixed32, float.
	 * Always 4 bytes with little-endian byte order.
	 */
	WireType[(WireType["Bit32"] = 5)] = "Bit32";
})(WireType || (WireType = {}));
/**
 * Maximum value for a 32-bit floating point value (Protobuf FLOAT).
 */
const FLOAT32_MAX = 3.4028234663852886e38;
/**
 * Minimum value for a 32-bit floating point value (Protobuf FLOAT).
 */
const FLOAT32_MIN = -34028234663852886e22;
/**
 * Maximum value for an unsigned 32-bit integer (Protobuf UINT32, FIXED32).
 */
const UINT32_MAX = 0xffffffff;
/**
 * Maximum value for a signed 32-bit integer (Protobuf INT32, SFIXED32, SINT32).
 */
const INT32_MAX = 0x7fffffff;
/**
 * Minimum value for a signed 32-bit integer (Protobuf INT32, SFIXED32, SINT32).
 */
const INT32_MIN = -2147483648;
class BinaryReader {
	constructor(buf, decodeUtf8 = getTextEncoding().decodeUtf8) {
		this.decodeUtf8 = decodeUtf8;
		this.varint64 = varint64read; // dirty cast for `this`
		/**
		 * Read a `uint32` field, an unsigned 32 bit varint.
		 */
		this.uint32 = varint32read;
		this.buf = buf;
		this.len = buf.length;
		this.pos = 0;
		this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
	}
	/**
	 * Reads a tag - field number and wire type. Tags are uint32 varints; values
	 * that do not fit in uint32 are rejected.
	 */
	tag() {
		const start = this.pos;
		const tag = this.uint32();
		const bytesRead = this.pos - start;
		if (bytesRead > 5 || (bytesRead == 5 && this.buf[this.pos - 1] > 0x0f)) {
			throw new Error("illegal tag: varint overflows uint32");
		}
		const fieldNo = tag >>> 3;
		const wireType = tag & 7;
		if (fieldNo <= 0 || wireType > 5) {
			throw new Error("illegal tag: field no " + fieldNo + " wire type " + wireType);
		}
		return [fieldNo, wireType];
	}
	/**
	 * Skip one element and return the skipped data.
	 *
	 * When skipping StartGroup, provide the tags field number to check for
	 * matching field number in the EndGroup tag. Recursion into nested groups
	 * is guarded by the `recursionLimit` argument: When the limit is reached,
	 * this method throws.
	 */
	skip(wireType, fieldNo, recursionLimit = 100) {
		let start = this.pos;
		switch (wireType) {
			case WireType.Varint:
				while (this.buf[this.pos++] & 0x80) {
					// ignore
				}
				break;
			// @ts-ignore TS7029: Fallthrough case in switch -- ignore instead of expect-error for compiler settings without noFallthroughCasesInSwitch: true
			case WireType.Bit64:
				this.pos += 4;
			case WireType.Bit32:
				this.pos += 4;
				break;
			case WireType.LengthDelimited:
				let len = this.uint32();
				this.pos += len;
				break;
			case WireType.StartGroup:
				if (recursionLimit <= 0) {
					throw new Error("maximum recursion depth reached");
				}
				for (;;) {
					const [fn, wt] = this.tag();
					if (wt === WireType.EndGroup) {
						if (fieldNo !== undefined && fn !== fieldNo) {
							throw new Error("invalid end group tag");
						}
						break;
					}
					this.skip(wt, fn, recursionLimit - 1);
				}
				break;
			default:
				throw new Error("cant skip wire type " + wireType);
		}
		this.assertBounds();
		return this.buf.subarray(start, this.pos);
	}
	/**
	 * Throws error if position in byte array is out of range.
	 */
	assertBounds() {
		if (this.pos > this.len) throw new RangeError("premature EOF");
	}
	/**
	 * Read a `int32` field, a signed 32 bit varint.
	 */
	int32() {
		return this.uint32() | 0;
	}
	/**
	 * Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
	 */
	sint32() {
		let zze = this.uint32();
		// decode zigzag
		return (zze >>> 1) ^ -(zze & 1);
	}
	/**
	 * Read a `int64` field, a signed 64-bit varint.
	 */
	int64() {
		return protoInt64.dec(...this.varint64());
	}
	/**
	 * Read a `uint64` field, an unsigned 64-bit varint.
	 */
	uint64() {
		return protoInt64.uDec(...this.varint64());
	}
	/**
	 * Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
	 */
	sint64() {
		let [lo, hi] = this.varint64();
		// decode zig zag
		let s = -(lo & 1);
		lo = ((lo >>> 1) | ((hi & 1) << 31)) ^ s;
		hi = (hi >>> 1) ^ s;
		return protoInt64.dec(lo, hi);
	}
	/**
	 * Read a `bool` field, a variant.
	 */
	bool() {
		let [lo, hi] = this.varint64();
		return lo !== 0 || hi !== 0;
	}
	/**
	 * Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.
	 */
	fixed32() {
		// biome-ignore lint/suspicious/noAssignInExpressions: no
		return this.view.getUint32((this.pos += 4) - 4, true);
	}
	/**
	 * Read a `sfixed32` field, a signed, fixed-length 32-bit integer.
	 */
	sfixed32() {
		// biome-ignore lint/suspicious/noAssignInExpressions: no
		return this.view.getInt32((this.pos += 4) - 4, true);
	}
	/**
	 * Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
	 */
	fixed64() {
		return protoInt64.uDec(this.sfixed32(), this.sfixed32());
	}
	/**
	 * Read a `fixed64` field, a signed, fixed-length 64-bit integer.
	 */
	sfixed64() {
		return protoInt64.dec(this.sfixed32(), this.sfixed32());
	}
	/**
	 * Read a `float` field, 32-bit floating point number.
	 */
	float() {
		// biome-ignore lint/suspicious/noAssignInExpressions: no
		return this.view.getFloat32((this.pos += 4) - 4, true);
	}
	/**
	 * Read a `double` field, a 64-bit floating point number.
	 */
	double() {
		// biome-ignore lint/suspicious/noAssignInExpressions: no
		return this.view.getFloat64((this.pos += 8) - 8, true);
	}
	/**
	 * Read a `bytes` field, length-delimited arbitrary data.
	 */
	bytes() {
		let len = this.uint32(),
			start = this.pos;
		this.pos += len;
		this.assertBounds();
		return this.buf.subarray(start, start + len);
	}
	/**
	 * Read a `string` field, length-delimited data converted to UTF-8 text. If
	 * `strict` is true, throw on invalid UTF-8 instead of substituting U+FFFD.
	 */
	string(strict) {
		return this.decodeUtf8(this.bytes(), strict);
	}
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Check whether the given field value is valid for the reflect API.
 */
function checkField(field, value) {
	const check =
		field.fieldKind == "list" ? isReflectList(value, field)
		: field.fieldKind == "map" ? isReflectMap(value, field)
		: checkSingular(field, value);
	if (check === true) {
		return undefined;
	}
	let reason;
	switch (field.fieldKind) {
		case "list":
			reason = `expected ${formatReflectList(field)}, got ${formatVal(value)}`;
			break;
		case "map":
			reason = `expected ${formatReflectMap(field)}, got ${formatVal(value)}`;
			break;
		default: {
			reason = reasonSingular(field, value, check);
		}
	}
	return new FieldError(field, reason);
}
/**
 * Check whether the given list item is valid for the reflect API.
 */
function checkListItem(field, index, value) {
	const check = checkSingular(field, value);
	if (check !== true) {
		return new FieldError(field, `list item #${index + 1}: ${reasonSingular(field, value, check)}`);
	}
	return undefined;
}
/**
 * Check whether the given map key and value are valid for the reflect API.
 */
function checkMapEntry(field, key, value) {
	const checkKey = checkScalarValue(key, field.mapKey);
	if (checkKey !== true) {
		return new FieldError(field, `invalid map key: ${reasonSingular({ scalar: field.mapKey }, key, checkKey)}`);
	}
	const checkVal = checkSingular(field, value);
	if (checkVal !== true) {
		return new FieldError(field, `map entry ${formatVal(key)}: ${reasonSingular(field, value, checkVal)}`);
	}
	return undefined;
}
function checkSingular(field, value) {
	if (field.scalar !== undefined) {
		return checkScalarValue(value, field.scalar);
	}
	if (field.enum !== undefined) {
		if (field.enum.open) {
			// Open enums accept unrecognized values, but enum values are always
			// int32 (see https://protobuf.dev/programming-guides/proto3/#enum).
			return checkScalarValue(value, ScalarType.INT32);
		}
		return field.enum.values.some((v) => v.number === value);
	}
	return isReflectMessage(value, field.message);
}
function checkScalarValue(value, scalar) {
	switch (scalar) {
		case ScalarType.DOUBLE:
			return typeof value == "number";
		case ScalarType.FLOAT:
			if (typeof value != "number") {
				return false;
			}
			if (Number.isNaN(value) || !Number.isFinite(value)) {
				return true;
			}
			if (value > FLOAT32_MAX || value < FLOAT32_MIN) {
				return `${value.toFixed()} out of range`;
			}
			return true;
		case ScalarType.INT32:
		case ScalarType.SFIXED32:
		case ScalarType.SINT32:
			// signed
			if (typeof value !== "number" || !Number.isInteger(value)) {
				return false;
			}
			if (value > INT32_MAX || value < INT32_MIN) {
				return `${value.toFixed()} out of range`;
			}
			return true;
		case ScalarType.FIXED32:
		case ScalarType.UINT32:
			// unsigned
			if (typeof value !== "number" || !Number.isInteger(value)) {
				return false;
			}
			if (value > UINT32_MAX || value < 0) {
				return `${value.toFixed()} out of range`;
			}
			return true;
		case ScalarType.BOOL:
			return typeof value == "boolean";
		case ScalarType.STRING:
			if (typeof value != "string") {
				return false;
			}
			return getTextEncoding().checkUtf8(value) || "invalid UTF8";
		case ScalarType.BYTES:
			return value instanceof Uint8Array;
		case ScalarType.INT64:
		case ScalarType.SFIXED64:
		case ScalarType.SINT64:
			// signed
			if (typeof value == "bigint" || typeof value == "number" || (typeof value == "string" && value.length > 0)) {
				try {
					protoInt64.parse(value);
					return true;
				} catch (_) {
					return `${value} out of range`;
				}
			}
			return false;
		case ScalarType.FIXED64:
		case ScalarType.UINT64:
			// unsigned
			if (typeof value == "bigint" || typeof value == "number" || (typeof value == "string" && value.length > 0)) {
				try {
					protoInt64.uParse(value);
					return true;
				} catch (_) {
					return `${value} out of range`;
				}
			}
			return false;
	}
}
function reasonSingular(field, val, details) {
	details = typeof details == "string" ? `: ${details}` : `, got ${formatVal(val)}`;
	if (field.scalar !== undefined) {
		return `expected ${scalarTypeDescription(field.scalar)}` + details;
	}
	if (field.enum !== undefined) {
		return `expected ${field.enum.toString()}` + details;
	}
	return `expected ${formatReflectMessage(field.message)}` + details;
}
function formatVal(val) {
	switch (typeof val) {
		case "object":
			if (val === null) {
				return "null";
			}
			if (val instanceof Uint8Array) {
				return `Uint8Array(${val.length})`;
			}
			if (Array.isArray(val)) {
				return `Array(${val.length})`;
			}
			if (isReflectList(val)) {
				return formatReflectList(val.field());
			}
			if (isReflectMap(val)) {
				return formatReflectMap(val.field());
			}
			if (isReflectMessage(val)) {
				return formatReflectMessage(val.desc);
			}
			if (isMessage(val)) {
				return `message ${val.$typeName}`;
			}
			return "object";
		case "string":
			return val.length > 30 ? "string" : `"${val.split('"').join('\\"')}"`;
		case "boolean":
			return String(val);
		case "number":
			return String(val);
		case "bigint":
			return String(val) + "n";
		default:
			// "symbol" | "undefined" | "object" | "function"
			return typeof val;
	}
}
function formatReflectMessage(desc) {
	return `ReflectMessage (${desc.typeName})`;
}
function formatReflectList(field) {
	switch (field.listKind) {
		case "message":
			return `ReflectList (${field.message.toString()})`;
		case "enum":
			return `ReflectList (${field.enum.toString()})`;
		case "scalar":
			return `ReflectList (${ScalarType[field.scalar]})`;
	}
}
function formatReflectMap(field) {
	switch (field.mapKind) {
		case "message":
			return `ReflectMap (${ScalarType[field.mapKey]}, ${field.message.toString()})`;
		case "enum":
			return `ReflectMap (${ScalarType[field.mapKey]}, ${field.enum.toString()})`;
		case "scalar":
			return `ReflectMap (${ScalarType[field.mapKey]}, ${ScalarType[field.scalar]})`;
	}
}
function scalarTypeDescription(scalar) {
	switch (scalar) {
		case ScalarType.STRING:
			return "string";
		case ScalarType.BOOL:
			return "boolean";
		case ScalarType.INT64:
		case ScalarType.SINT64:
		case ScalarType.SFIXED64:
			return "bigint (int64)";
		case ScalarType.UINT64:
		case ScalarType.FIXED64:
			return "bigint (uint64)";
		case ScalarType.BYTES:
			return "Uint8Array";
		case ScalarType.DOUBLE:
			return "number (float64)";
		case ScalarType.FLOAT:
			return "number (float32)";
		case ScalarType.FIXED32:
		case ScalarType.UINT32:
			return "number (uint32)";
		case ScalarType.INT32:
		case ScalarType.SFIXED32:
		case ScalarType.SINT32:
			return "number (int32)";
	}
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Create a ReflectMessage.
 */
function reflect(
	messageDesc,
	message,
	/**
	 * By default, field values are validated when setting them. For example,
	 * a value for an uint32 field must be a ECMAScript Number >= 0.
	 *
	 * When field values are trusted, performance can be improved by disabling
	 * checks.
	 */
	check = true,
) {
	return new ReflectMessageImpl(messageDesc, message, check);
}
const messageSortedFields = new WeakMap();
class ReflectMessageImpl {
	get sortedFields() {
		const cached = messageSortedFields.get(this.desc);
		if (cached) {
			return cached;
		}
		const sortedFields = this.desc.fields.concat().sort((a, b) => a.number - b.number);
		messageSortedFields.set(this.desc, sortedFields);
		return sortedFields;
	}
	constructor(messageDesc, message, check = true) {
		this.lists = new Map();
		this.maps = new Map();
		this.check = check;
		this.desc = messageDesc;
		this.message = this[unsafeLocal] = message !== null && message !== void 0 ? message : create(messageDesc);
		this.fields = messageDesc.fields;
		this.oneofs = messageDesc.oneofs;
		this.members = messageDesc.members;
	}
	findNumber(number) {
		if (!this._fieldsByNumber) {
			this._fieldsByNumber = new Map(this.desc.fields.map((f) => [f.number, f]));
		}
		return this._fieldsByNumber.get(number);
	}
	oneofCase(oneof) {
		assertOwn(this.message, oneof);
		return unsafeOneofCase(this.message, oneof);
	}
	isSet(field) {
		assertOwn(this.message, field);
		return unsafeIsSet(this.message, field);
	}
	clear(field) {
		assertOwn(this.message, field);
		unsafeClear(this.message, field);
	}
	get(field) {
		assertOwn(this.message, field);
		const value = unsafeGet(this.message, field);
		switch (field.fieldKind) {
			case "list":
				// eslint-disable-next-line no-case-declarations
				let list = this.lists.get(field);
				if (!list || list[unsafeLocal] !== value) {
					this.lists.set(
						field,
						// biome-ignore lint/suspicious/noAssignInExpressions: no
						(list = new ReflectListImpl(field, value, this.check)),
					);
				}
				return list;
			case "map":
				let map = this.maps.get(field);
				if (!map || map[unsafeLocal] !== value) {
					this.maps.set(
						field,
						// biome-ignore lint/suspicious/noAssignInExpressions: no
						(map = new ReflectMapImpl(field, value, this.check)),
					);
				}
				return map;
			case "message":
				return messageToReflect(field, value, this.check);
			case "scalar":
				return value === undefined ? scalarZeroValue(field.scalar, false) : longToReflect(field, value);
			case "enum":
				return value !== null && value !== void 0 ? value : field.enum.values[0].number;
		}
	}
	set(field, value) {
		assertOwn(this.message, field);
		if (this.check) {
			const err = checkField(field, value);
			if (err) {
				throw err;
			}
		}
		let local;
		if (field.fieldKind == "message") {
			local = messageToLocal(field, value);
		} else if (isReflectMap(value) || isReflectList(value)) {
			local = value[unsafeLocal];
		} else {
			local = longToLocal(field, value);
		}
		unsafeSet(this.message, field, local);
	}
	getUnknown() {
		return this.message.$unknown;
	}
	setUnknown(value) {
		this.message.$unknown = value;
	}
}
function assertOwn(owner, member) {
	if (member.parent.typeName !== owner.$typeName) {
		throw new FieldError(member, `cannot use ${member.toString()} with message ${owner.$typeName}`, "ForeignFieldError");
	}
}
class ReflectListImpl {
	field() {
		return this._field;
	}
	get size() {
		return this._arr.length;
	}
	constructor(field, unsafeInput, check) {
		this._field = field;
		this._arr = this[unsafeLocal] = unsafeInput;
		this.check = check;
	}
	get(index) {
		const item = this._arr[index];
		return item === undefined ? undefined : listItemToReflect(this._field, item, this.check);
	}
	set(index, item) {
		if (index < 0 || index >= this._arr.length) {
			throw new FieldError(this._field, `list item #${index + 1}: out of range`);
		}
		if (this.check) {
			const err = checkListItem(this._field, index, item);
			if (err) {
				throw err;
			}
		}
		this._arr[index] = listItemToLocal(this._field, item);
	}
	add(item) {
		if (this.check) {
			const err = checkListItem(this._field, this._arr.length, item);
			if (err) {
				throw err;
			}
		}
		this._arr.push(listItemToLocal(this._field, item));
		return undefined;
	}
	clear() {
		this._arr.splice(0, this._arr.length);
	}
	[Symbol.iterator]() {
		return this.values();
	}
	keys() {
		return this._arr.keys();
	}
	*values() {
		for (const item of this._arr) {
			yield listItemToReflect(this._field, item, this.check);
		}
	}
	*entries() {
		for (let i = 0; i < this._arr.length; i++) {
			yield [i, listItemToReflect(this._field, this._arr[i], this.check)];
		}
	}
}
class ReflectMapImpl {
	constructor(field, unsafeInput, check = true) {
		this.obj = this[unsafeLocal] = unsafeInput !== null && unsafeInput !== void 0 ? unsafeInput : {};
		this.check = check;
		this._field = field;
	}
	field() {
		return this._field;
	}
	set(key, value) {
		if (this.check) {
			const err = checkMapEntry(this._field, key, value);
			if (err) {
				throw err;
			}
		}
		this.obj[mapKeyToLocal(key)] = mapValueToLocal(this._field, value);
		return this;
	}
	delete(key) {
		const k = mapKeyToLocal(key);
		const has = Object.prototype.hasOwnProperty.call(this.obj, k);
		if (has) {
			delete this.obj[k];
		}
		return has;
	}
	clear() {
		for (const key of Object.keys(this.obj)) {
			delete this.obj[key];
		}
	}
	get(key) {
		let val = this.obj[mapKeyToLocal(key)];
		if (val !== undefined) {
			val = mapValueToReflect(this._field, val, this.check);
		}
		return val;
	}
	has(key) {
		return Object.prototype.hasOwnProperty.call(this.obj, mapKeyToLocal(key));
	}
	*keys() {
		for (const objKey of Object.keys(this.obj)) {
			yield mapKeyToReflect(objKey, this._field.mapKey);
		}
	}
	*entries() {
		for (const objEntry of Object.entries(this.obj)) {
			yield [mapKeyToReflect(objEntry[0], this._field.mapKey), mapValueToReflect(this._field, objEntry[1], this.check)];
		}
	}
	[Symbol.iterator]() {
		return this.entries();
	}
	get size() {
		return Object.keys(this.obj).length;
	}
	*values() {
		for (const val of Object.values(this.obj)) {
			yield mapValueToReflect(this._field, val, this.check);
		}
	}
	forEach(callbackfn, thisArg) {
		for (const mapEntry of this.entries()) {
			callbackfn.call(thisArg, mapEntry[1], mapEntry[0], this);
		}
	}
}
function messageToLocal(field, value) {
	if (!isReflectMessage(value)) {
		return value;
	}
	if (isWrapper(value.message) && !field.oneof && field.fieldKind == "message") {
		// Types from google/protobuf/wrappers.proto are unwrapped when used in
		// a singular field that is not part of a oneof group.
		return value.message.value;
	}
	if (value.desc.typeName == "google.protobuf.Struct" && field.parent.typeName != "google.protobuf.Value") {
		// google.protobuf.Struct is represented with JsonObject when used in a
		// field, except when used in google.protobuf.Value.
		return wktStructToLocal(value.message);
	}
	return value.message;
}
function messageToReflect(field, value, check) {
	if (value !== undefined) {
		if (isWrapperDesc(field.message) && !field.oneof && field.fieldKind == "message") {
			// Types from google/protobuf/wrappers.proto are unwrapped when used in
			// a singular field that is not part of a oneof group.
			value = {
				$typeName: field.message.typeName,
				value: longToReflect(field.message.fields[0], value),
			};
		} else if (field.message.typeName == "google.protobuf.Struct" && field.parent.typeName != "google.protobuf.Value" && isObject(value)) {
			// google.protobuf.Struct is represented with JsonObject when used in a
			// field, except when used in google.protobuf.Value.
			value = wktStructToReflect(value);
		}
	}
	return new ReflectMessageImpl(field.message, value, check);
}
function listItemToLocal(field, value) {
	if (field.listKind == "message") {
		return messageToLocal(field, value);
	}
	return longToLocal(field, value);
}
function listItemToReflect(field, value, check) {
	if (field.listKind == "message") {
		return messageToReflect(field, value, check);
	}
	return longToReflect(field, value);
}
function mapValueToLocal(field, value) {
	if (field.mapKind == "message") {
		return messageToLocal(field, value);
	}
	return longToLocal(field, value);
}
function mapValueToReflect(field, value, check) {
	if (field.mapKind == "message") {
		return messageToReflect(field, value, check);
	}
	return value;
}
function mapKeyToLocal(key) {
	return typeof key == "string" || typeof key == "number" ? key : String(key);
}
/**
 * Converts a map key (any scalar value except float, double, or bytes) from its
 * representation in a message (string or number, the only possible object key
 * types) to the closest possible type in ECMAScript.
 */
function mapKeyToReflect(key, type) {
	switch (type) {
		case ScalarType.STRING:
			return key;
		case ScalarType.INT32:
		case ScalarType.FIXED32:
		case ScalarType.UINT32:
		case ScalarType.SFIXED32:
		case ScalarType.SINT32: {
			const n = Number.parseInt(key);
			if (Number.isFinite(n)) {
				return n;
			}
			break;
		}
		case ScalarType.BOOL:
			switch (key) {
				case "true":
					return true;
				case "false":
					return false;
			}
			break;
		case ScalarType.UINT64:
		case ScalarType.FIXED64:
			try {
				return protoInt64.uParse(key);
			} catch (_a) {
				//
			}
			break;
		default:
			// INT64, SFIXED64, SINT64
			try {
				return protoInt64.parse(key);
			} catch (_b) {
				//
			}
			break;
	}
	return key;
}
function longToReflect(field, value) {
	switch (field.scalar) {
		case ScalarType.INT64:
		case ScalarType.SFIXED64:
		case ScalarType.SINT64:
			if ("longAsString" in field && field.longAsString && typeof value == "string") {
				value = protoInt64.parse(value);
			}
			break;
		case ScalarType.FIXED64:
		case ScalarType.UINT64:
			if ("longAsString" in field && field.longAsString && typeof value == "string") {
				value = protoInt64.uParse(value);
			}
			break;
	}
	return value;
}
function longToLocal(field, value) {
	switch (field.scalar) {
		case ScalarType.INT64:
		case ScalarType.SFIXED64:
		case ScalarType.SINT64:
			if ("longAsString" in field && field.longAsString) {
				value = String(value);
			} else if (typeof value == "string" || typeof value == "number") {
				value = protoInt64.parse(value);
			}
			break;
		case ScalarType.FIXED64:
		case ScalarType.UINT64:
			if ("longAsString" in field && field.longAsString) {
				value = String(value);
			} else if (typeof value == "string" || typeof value == "number") {
				value = protoInt64.uParse(value);
			}
			break;
	}
	return value;
}
function wktStructToReflect(json) {
	const struct = {
		$typeName: "google.protobuf.Struct",
		fields: {},
	};
	if (isObject(json)) {
		for (const [k, v] of Object.entries(json)) {
			struct.fields[k] = wktValueToReflect(v);
		}
	}
	return struct;
}
function wktStructToLocal(val) {
	const json = {};
	for (const [k, v] of Object.entries(val.fields)) {
		json[k] = wktValueToLocal(v);
	}
	return json;
}
function wktValueToLocal(val) {
	switch (val.kind.case) {
		case "structValue":
			return wktStructToLocal(val.kind.value);
		case "listValue":
			return val.kind.value.values.map(wktValueToLocal);
		case "nullValue":
		case undefined:
			return null;
		default:
			return val.kind.value;
	}
}
function wktValueToReflect(json) {
	const value = {
		$typeName: "google.protobuf.Value",
		kind: { case: undefined },
	};
	switch (typeof json) {
		case "number":
			value.kind = { case: "numberValue", value: json };
			break;
		case "string":
			value.kind = { case: "stringValue", value: json };
			break;
		case "boolean":
			value.kind = { case: "boolValue", value: json };
			break;
		case "object":
			if (json === null) {
				const nullValue = 0;
				value.kind = { case: "nullValue", value: nullValue };
			} else if (Array.isArray(json)) {
				const listValue = {
					$typeName: "google.protobuf.ListValue",
					values: [],
				};
				if (Array.isArray(json)) {
					for (const e of json) {
						listValue.values.push(wktValueToReflect(e));
					}
				}
				value.kind = {
					case: "listValue",
					value: listValue,
				};
			} else {
				value.kind = {
					case: "structValue",
					value: wktStructToReflect(json),
				};
			}
			break;
	}
	return value;
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Decodes a base64 string to a byte array.
 *
 * - ignores white-space, including line breaks and tabs
 * - allows inner padding (can decode concatenated base64 strings)
 * - does not require padding
 * - understands base64url encoding:
 *   "-" instead of "+",
 *   "_" instead of "/",
 *   no padding
 */
function base64Decode(base64Str) {
	const table = getDecodeTable();
	// estimate byte size, not accounting for inner padding and whitespace
	let es = (base64Str.length * 3) / 4;
	if (base64Str[base64Str.length - 2] == "=") es -= 2;
	else if (base64Str[base64Str.length - 1] == "=") es -= 1;
	let bytes = new Uint8Array(es),
		bytePos = 0, // position in byte array
		groupPos = 0, // position in base64 group
		b, // current byte
		p = 0; // previous byte
	for (let i = 0; i < base64Str.length; i++) {
		b = table[base64Str.charCodeAt(i)];
		if (b === undefined) {
			switch (base64Str[i]) {
				// @ts-ignore TS7029: Fallthrough case in switch -- ignore instead of expect-error for compiler settings without noFallthroughCasesInSwitch: true
				case "=":
					groupPos = 0; // reset state when padding found
				case "\n":
				case "\r":
				case "\t":
				case " ":
					continue; // skip white-space, and padding
				default:
					throw Error("invalid base64 string");
			}
		}
		switch (groupPos) {
			case 0:
				p = b;
				groupPos = 1;
				break;
			case 1:
				bytes[bytePos++] = (p << 2) | ((b & 48) >> 4);
				p = b;
				groupPos = 2;
				break;
			case 2:
				bytes[bytePos++] = ((p & 15) << 4) | ((b & 60) >> 2);
				p = b;
				groupPos = 3;
				break;
			case 3:
				bytes[bytePos++] = ((p & 3) << 6) | b;
				groupPos = 0;
				break;
		}
	}
	if (groupPos == 1) throw Error("invalid base64 string");
	return bytes.subarray(0, bytePos);
}
/**
 * Encode a byte array to a base64 string.
 *
 * By default, this function uses the standard base64 encoding with padding.
 *
 * To encode without padding, use encoding = "std_raw".
 *
 * To encode with the URL encoding, use encoding = "url", which replaces the
 * characters +/ by their URL-safe counterparts -_, and omits padding.
 */
function base64Encode(bytes, encoding = "std") {
	const table = getEncodeTable(encoding);
	const pad = encoding == "std";
	let base64 = "",
		groupPos = 0, // position in base64 group
		b, // current byte
		p = 0; // carry over from previous byte
	for (let i = 0; i < bytes.length; i++) {
		b = bytes[i];
		switch (groupPos) {
			case 0:
				base64 += table[b >> 2];
				p = (b & 3) << 4;
				groupPos = 1;
				break;
			case 1:
				base64 += table[p | (b >> 4)];
				p = (b & 15) << 2;
				groupPos = 2;
				break;
			case 2:
				base64 += table[p | (b >> 6)];
				base64 += table[b & 63];
				groupPos = 0;
				break;
		}
	}
	// add output padding
	if (groupPos) {
		base64 += table[p];
		if (pad) {
			base64 += "=";
			if (groupPos == 1) base64 += "=";
		}
	}
	return base64;
}
// lookup table from base64 character to byte
let encodeTableStd;
let encodeTableUrl;
// lookup table from base64 character *code* to byte because lookup by number is fast
let decodeTable;
function getEncodeTable(encoding) {
	if (!encodeTableStd) {
		encodeTableStd = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
		encodeTableUrl = encodeTableStd.slice(0, -2).concat("-", "_");
	}
	return encoding == "url" ?
			// biome-ignore lint/style/noNonNullAssertion: TS fails to narrow down
			encodeTableUrl
		:	encodeTableStd;
}
function getDecodeTable() {
	if (!decodeTable) {
		decodeTable = [];
		const encodeTable = getEncodeTable("std");
		for (let i = 0; i < encodeTable.length; i++) decodeTable[encodeTable[i].charCodeAt(0)] = i;
		// support base64url variants
		decodeTable["-".charCodeAt(0)] = encodeTable.indexOf("+");
		decodeTable["_".charCodeAt(0)] = encodeTable.indexOf("/");
	}
	return decodeTable;
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Return a fully-qualified name for a Protobuf descriptor.
 * For a file descriptor, return the original file path.
 *
 * See https://protobuf.com/docs/language-spec#fully-qualified-names
 */
/**
 * Converts snake_case to protoCamelCase according to the convention
 * used by protoc to convert a field name to a JSON name.
 *
 * See https://protobuf.com/docs/language-spec#default-json-names
 *
 * The function protoSnakeCase provides the reverse.
 */
function protoCamelCase(snakeCase) {
	let capNext = false;
	const b = [];
	for (let i = 0; i < snakeCase.length; i++) {
		let c = snakeCase.charAt(i);
		switch (c) {
			case "_":
				capNext = true;
				break;
			case "0":
			case "1":
			case "2":
			case "3":
			case "4":
			case "5":
			case "6":
			case "7":
			case "8":
			case "9":
				b.push(c);
				capNext = false;
				break;
			default:
				if (capNext) {
					capNext = false;
					c = c.toUpperCase();
				}
				b.push(c);
				break;
		}
	}
	return b.join("");
}
/**
 * Names that cannot be used for object properties because they are reserved
 * by built-in JavaScript properties.
 */
const reservedObjectProperties = new Set([
	// names reserved by JavaScript
	"constructor",
	"toString",
	"toJSON",
	"valueOf",
]);
/**
 * Escapes names that are reserved for ECMAScript built-in object properties.
 *
 * Also see safeIdentifier() from @bufbuild/protoplugin.
 */
function safeObjectProperty(name) {
	return reservedObjectProperties.has(name) ? name + "$" : name;
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * @private
 */
function restoreJsonNames(message) {
	for (const f of message.field) {
		if (!unsafeIsSetExplicit(f, "jsonName")) {
			f.jsonName = protoCamelCase(f.name);
		}
	}
	message.nestedType.forEach(restoreJsonNames);
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Parse an enum value from the Protobuf text format.
 *
 * @private
 */
function parseTextFormatEnumValue(descEnum, value) {
	const enumValue = descEnum.values.find((v) => v.name === value);
	if (!enumValue) {
		throw new Error(`cannot parse ${descEnum} default value: ${value}`);
	}
	return enumValue.number;
}
/**
 * Parse a scalar value from the Protobuf text format.
 *
 * @private
 */
function parseTextFormatScalarValue(type, value) {
	switch (type) {
		case ScalarType.STRING:
			return value;
		case ScalarType.BYTES: {
			const u = unescapeBytesDefaultValue(value);
			if (u === false) {
				throw new Error(`cannot parse ${ScalarType[type]} default value: ${value}`);
			}
			return u;
		}
		case ScalarType.INT64:
		case ScalarType.SFIXED64:
		case ScalarType.SINT64:
			return protoInt64.parse(value);
		case ScalarType.UINT64:
		case ScalarType.FIXED64:
			return protoInt64.uParse(value);
		case ScalarType.DOUBLE:
		case ScalarType.FLOAT:
			switch (value) {
				case "inf":
					return Number.POSITIVE_INFINITY;
				case "-inf":
					return Number.NEGATIVE_INFINITY;
				case "nan":
					return Number.NaN;
				default:
					return parseFloat(value);
			}
		case ScalarType.BOOL:
			return value === "true";
		case ScalarType.INT32:
		case ScalarType.UINT32:
		case ScalarType.SINT32:
		case ScalarType.FIXED32:
		case ScalarType.SFIXED32:
			return parseInt(value, 10);
	}
}
/**
 * Parses a text-encoded default value (proto2) of a BYTES field.
 */
function unescapeBytesDefaultValue(str) {
	const b = [];
	const input = {
		tail: str,
		c: "",
		next() {
			if (this.tail.length == 0) {
				return false;
			}
			this.c = this.tail[0];
			this.tail = this.tail.substring(1);
			return true;
		},
		take(n) {
			if (this.tail.length >= n) {
				const r = this.tail.substring(0, n);
				this.tail = this.tail.substring(n);
				return r;
			}
			return false;
		},
	};
	while (input.next()) {
		switch (input.c) {
			case "\\":
				if (input.next()) {
					switch (input.c) {
						case "\\":
							b.push(input.c.charCodeAt(0));
							break;
						case "b":
							b.push(0x08);
							break;
						case "f":
							b.push(0x0c);
							break;
						case "n":
							b.push(0x0a);
							break;
						case "r":
							b.push(0x0d);
							break;
						case "t":
							b.push(0x09);
							break;
						case "v":
							b.push(0x0b);
							break;
						case "0":
						case "1":
						case "2":
						case "3":
						case "4":
						case "5":
						case "6":
						case "7": {
							const s = input.c;
							const t = input.take(2);
							if (t === false) {
								return false;
							}
							const n = parseInt(s + t, 8);
							if (Number.isNaN(n)) {
								return false;
							}
							b.push(n);
							break;
						}
						case "x": {
							const s = input.c;
							const t = input.take(2);
							if (t === false) {
								return false;
							}
							const n = parseInt(s + t, 16);
							if (Number.isNaN(n)) {
								return false;
							}
							b.push(n);
							break;
						}
						case "u": {
							const s = input.c;
							const t = input.take(4);
							if (t === false) {
								return false;
							}
							const n = parseInt(s + t, 16);
							if (Number.isNaN(n)) {
								return false;
							}
							const chunk = new Uint8Array(4);
							const view = new DataView(chunk.buffer);
							view.setInt32(0, n, true);
							b.push(chunk[0], chunk[1], chunk[2], chunk[3]);
							break;
						}
						case "U": {
							const s = input.c;
							const t = input.take(8);
							if (t === false) {
								return false;
							}
							const tc = protoInt64.uEnc(s + t);
							const chunk = new Uint8Array(8);
							const view = new DataView(chunk.buffer);
							view.setInt32(0, tc.lo, true);
							view.setInt32(4, tc.hi, true);
							b.push(chunk[0], chunk[1], chunk[2], chunk[3], chunk[4], chunk[5], chunk[6], chunk[7]);
							break;
						}
					}
				}
				break;
			default:
				b.push(input.c.charCodeAt(0));
		}
	}
	return new Uint8Array(b);
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Iterate over all types - enumerations, extensions, services, messages -
 * and enumerations, extensions and messages nested in messages.
 */
function* nestedTypes(desc) {
	switch (desc.kind) {
		case "file":
			for (const message of desc.messages) {
				yield message;
				yield* nestedTypes(message);
			}
			yield* desc.enums;
			yield* desc.services;
			yield* desc.extensions;
			break;
		case "message":
			for (const message of desc.nestedMessages) {
				yield message;
				yield* nestedTypes(message);
			}
			yield* desc.nestedEnums;
			yield* desc.nestedExtensions;
			break;
	}
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
function createFileRegistry(...args) {
	const registry = createBaseRegistry();
	if (!args.length) {
		return registry;
	}
	if ("$typeName" in args[0] && args[0].$typeName == "google.protobuf.FileDescriptorSet") {
		for (const file of args[0].file) {
			addFile(file, registry);
		}
		return registry;
	}
	if ("$typeName" in args[0]) {
		const input = args[0];
		const resolve = args[1];
		const seen = new Set();
		function recurseDeps(file) {
			const deps = [];
			for (const protoFileName of file.dependency) {
				if (registry.getFile(protoFileName) != undefined) {
					continue;
				}
				if (seen.has(protoFileName)) {
					continue;
				}
				const dep = resolve(protoFileName);
				if (!dep) {
					throw new Error(`Unable to resolve ${protoFileName}, imported by ${file.name}`);
				}
				if ("kind" in dep) {
					registry.addFile(dep, false, true);
				} else {
					seen.add(dep.name);
					deps.push(dep);
				}
			}
			return deps.concat(...deps.map(recurseDeps));
		}
		for (const file of [input, ...recurseDeps(input)].reverse()) {
			addFile(file, registry);
		}
	} else {
		for (const fileReg of args) {
			for (const file of fileReg.files) {
				registry.addFile(file);
			}
		}
	}
	return registry;
}
/**
 * @private
 */
function createBaseRegistry() {
	const types = new Map();
	const extendees = new Map();
	const files = new Map();
	return {
		kind: "registry",
		types,
		extendees,
		[Symbol.iterator]() {
			return types.values();
		},
		get files() {
			return files.values();
		},
		addFile(file, skipTypes, withDeps) {
			files.set(file.proto.name, file);
			if (!skipTypes) {
				for (const type of nestedTypes(file)) {
					this.add(type);
				}
			}
			if (withDeps) {
				for (const f of file.dependencies) {
					this.addFile(f, skipTypes, withDeps);
				}
			}
		},
		add(desc) {
			if (desc.kind == "extension") {
				let numberToExt = extendees.get(desc.extendee.typeName);
				if (!numberToExt) {
					extendees.set(
						desc.extendee.typeName,
						// biome-ignore lint/suspicious/noAssignInExpressions: no
						(numberToExt = new Map()),
					);
				}
				numberToExt.set(desc.number, desc);
			}
			types.set(desc.typeName, desc);
		},
		get(typeName) {
			return types.get(typeName);
		},
		getFile(fileName) {
			return files.get(fileName);
		},
		getMessage(typeName) {
			const t = types.get(typeName);
			return (t === null || t === void 0 ? void 0 : t.kind) == "message" ? t : undefined;
		},
		getEnum(typeName) {
			const t = types.get(typeName);
			return (t === null || t === void 0 ? void 0 : t.kind) == "enum" ? t : undefined;
		},
		getExtension(typeName) {
			const t = types.get(typeName);
			return (t === null || t === void 0 ? void 0 : t.kind) == "extension" ? t : undefined;
		},
		getExtensionFor(extendee, no) {
			var _a;
			return (_a = extendees.get(extendee.typeName)) === null || _a === void 0 ? void 0 : _a.get(no);
		},
		getService(typeName) {
			const t = types.get(typeName);
			return (t === null || t === void 0 ? void 0 : t.kind) == "service" ? t : undefined;
		},
	};
}
// bootstrap-inject google.protobuf.Edition.EDITION_PROTO2: const $name: Edition.$localName = $number;
const EDITION_PROTO2 = 998;
// bootstrap-inject google.protobuf.Edition.EDITION_PROTO3: const $name: Edition.$localName = $number;
const EDITION_PROTO3 = 999;
// bootstrap-inject google.protobuf.Edition.EDITION_UNSTABLE: const $name: Edition.$localName = $number;
const EDITION_UNSTABLE = 9999;
// bootstrap-inject google.protobuf.FieldDescriptorProto.Type.TYPE_STRING: const $name: FieldDescriptorProto_Type.$localName = $number;
const TYPE_STRING = 9;
// bootstrap-inject google.protobuf.FieldDescriptorProto.Type.TYPE_GROUP: const $name: FieldDescriptorProto_Type.$localName = $number;
const TYPE_GROUP = 10;
// bootstrap-inject google.protobuf.FieldDescriptorProto.Type.TYPE_MESSAGE: const $name: FieldDescriptorProto_Type.$localName = $number;
const TYPE_MESSAGE = 11;
// bootstrap-inject google.protobuf.FieldDescriptorProto.Type.TYPE_BYTES: const $name: FieldDescriptorProto_Type.$localName = $number;
const TYPE_BYTES = 12;
// bootstrap-inject google.protobuf.FieldDescriptorProto.Type.TYPE_ENUM: const $name: FieldDescriptorProto_Type.$localName = $number;
const TYPE_ENUM = 14;
// bootstrap-inject google.protobuf.FieldDescriptorProto.Label.LABEL_REPEATED: const $name: FieldDescriptorProto_Label.$localName = $number;
const LABEL_REPEATED = 3;
// bootstrap-inject google.protobuf.FieldDescriptorProto.Label.LABEL_REQUIRED: const $name: FieldDescriptorProto_Label.$localName = $number;
const LABEL_REQUIRED = 2;
// bootstrap-inject google.protobuf.FieldOptions.JSType.JS_STRING: const $name: FieldOptions_JSType.$localName = $number;
const JS_STRING = 1;
// bootstrap-inject google.protobuf.MethodOptions.IdempotencyLevel.IDEMPOTENCY_UNKNOWN: const $name: MethodOptions_IdempotencyLevel.$localName = $number;
const IDEMPOTENCY_UNKNOWN = 0;
// bootstrap-inject google.protobuf.FeatureSet.FieldPresence.EXPLICIT: const $name: FeatureSet_FieldPresence.$localName = $number;
const EXPLICIT = 1;
// bootstrap-inject google.protobuf.FeatureSet.FieldPresence.IMPLICIT: const $name: FeatureSet_FieldPresence.$localName = $number;
const IMPLICIT = 2;
// bootstrap-inject google.protobuf.FeatureSet.FieldPresence.LEGACY_REQUIRED: const $name: FeatureSet_FieldPresence.$localName = $number;
const LEGACY_REQUIRED = 3;
// bootstrap-inject google.protobuf.FeatureSet.RepeatedFieldEncoding.PACKED: const $name: FeatureSet_RepeatedFieldEncoding.$localName = $number;
const PACKED = 1;
// bootstrap-inject google.protobuf.FeatureSet.MessageEncoding.DELIMITED: const $name: FeatureSet_MessageEncoding.$localName = $number;
const DELIMITED = 2;
// bootstrap-inject google.protobuf.FeatureSet.EnumType.OPEN: const $name: FeatureSet_EnumType.$localName = $number;
const OPEN = 1;
// bootstrap-inject google.protobuf.FeatureSet.Utf8Validation.VERIFY: const $name: FeatureSet_Utf8Validation.$localName = $number;
const VERIFY = 2;
// biome-ignore format: want this to read well
// bootstrap-inject defaults: EDITION_PROTO2 to EDITION_2024: export const minimumEdition: SupportedEdition = $minimumEdition, maximumEdition: SupportedEdition = $maximumEdition;
// generated from protoc v34.1
const maximumEdition = 1001;
const featureDefaults = {
	// EDITION_PROTO2
	998: {
		fieldPresence: 1, // EXPLICIT,
		enumType: 2, // CLOSED,
		repeatedFieldEncoding: 2, // EXPANDED,
		utf8Validation: 3, // NONE,
		messageEncoding: 1, // LENGTH_PREFIXED,
		jsonFormat: 2, // LEGACY_BEST_EFFORT,
		enforceNamingStyle: 2, // STYLE_LEGACY,
		defaultSymbolVisibility: 1, // EXPORT_ALL,
	},
	// EDITION_PROTO3
	999: {
		fieldPresence: 2, // IMPLICIT,
		enumType: 1, // OPEN,
		repeatedFieldEncoding: 1, // PACKED,
		utf8Validation: 2, // VERIFY,
		messageEncoding: 1, // LENGTH_PREFIXED,
		jsonFormat: 1, // ALLOW,
		enforceNamingStyle: 2, // STYLE_LEGACY,
		defaultSymbolVisibility: 1, // EXPORT_ALL,
	},
	// EDITION_2023
	1000: {
		fieldPresence: 1, // EXPLICIT,
		enumType: 1, // OPEN,
		repeatedFieldEncoding: 1, // PACKED,
		utf8Validation: 2, // VERIFY,
		messageEncoding: 1, // LENGTH_PREFIXED,
		jsonFormat: 1, // ALLOW,
		enforceNamingStyle: 2, // STYLE_LEGACY,
		defaultSymbolVisibility: 1, // EXPORT_ALL,
	},
	// EDITION_2024
	1001: {
		fieldPresence: 1, // EXPLICIT,
		enumType: 1, // OPEN,
		repeatedFieldEncoding: 1, // PACKED,
		utf8Validation: 2, // VERIFY,
		messageEncoding: 1, // LENGTH_PREFIXED,
		jsonFormat: 1, // ALLOW,
		enforceNamingStyle: 1, // STYLE2024,
		defaultSymbolVisibility: 2, // EXPORT_TOP_LEVEL,
	},
};
/**
 * Create a descriptor for a file, add it to the registry.
 */
function addFile(proto, reg) {
	var _a, _b;
	const file = {
		kind: "file",
		proto,
		deprecated: (_b = (_a = proto.options) === null || _a === void 0 ? void 0 : _a.deprecated) !== null && _b !== void 0 ? _b : false,
		edition: getFileEdition(proto),
		name: proto.name.replace(/\.proto$/, ""),
		dependencies: findFileDependencies(proto, reg),
		enums: [],
		messages: [],
		extensions: [],
		services: [],
		toString() {
			// eslint-disable-next-line @typescript-eslint/restrict-template-expressions -- we asserted above
			return `file ${proto.name}`;
		},
	};
	const mapEntriesStore = new Map();
	const mapEntries = {
		get(typeName) {
			return mapEntriesStore.get(typeName);
		},
		add(desc) {
			var _a;
			assert$1(((_a = desc.proto.options) === null || _a === void 0 ? void 0 : _a.mapEntry) === true);
			mapEntriesStore.set(desc.typeName, desc);
		},
	};
	for (const enumProto of proto.enumType) {
		addEnum(enumProto, file, undefined, reg);
	}
	for (const messageProto of proto.messageType) {
		addMessage(messageProto, file, undefined, reg, mapEntries);
	}
	for (const serviceProto of proto.service) {
		addService(serviceProto, file, reg);
	}
	addExtensions(file, reg);
	for (const mapEntry of mapEntriesStore.values()) {
		// to create a map field, we need access to the map entry's fields
		addFields(mapEntry, reg, mapEntries);
	}
	for (const message of file.messages) {
		addFields(message, reg, mapEntries);
		addExtensions(message, reg);
	}
	reg.addFile(file, true);
}
/**
 * Create descriptors for extensions, and add them to the message / file,
 * and to our cart.
 * Recurses into nested types.
 */
function addExtensions(desc, reg) {
	switch (desc.kind) {
		case "file":
			for (const proto of desc.proto.extension) {
				const ext = newField(proto, desc, reg);
				desc.extensions.push(ext);
				reg.add(ext);
			}
			break;
		case "message":
			for (const proto of desc.proto.extension) {
				const ext = newField(proto, desc, reg);
				desc.nestedExtensions.push(ext);
				reg.add(ext);
			}
			for (const message of desc.nestedMessages) {
				addExtensions(message, reg);
			}
			break;
	}
}
/**
 * Create descriptors for fields and oneof groups, and add them to the message.
 * Recurses into nested types.
 */
function addFields(message, reg, mapEntries) {
	const allOneofs = message.proto.oneofDecl.map((proto) => newOneof(proto, message));
	const oneofsSeen = new Set();
	for (const proto of message.proto.field) {
		const oneof = findOneof(proto, allOneofs);
		const field = newField(proto, message, reg, oneof, mapEntries);
		message.fields.push(field);
		message.field[field.localName] = field;
		if (oneof === undefined) {
			message.members.push(field);
		} else {
			oneof.fields.push(field);
			if (!oneofsSeen.has(oneof)) {
				oneofsSeen.add(oneof);
				message.members.push(oneof);
			}
		}
	}
	for (const oneof of allOneofs.filter((o) => oneofsSeen.has(o))) {
		message.oneofs.push(oneof);
	}
	for (const child of message.nestedMessages) {
		addFields(child, reg, mapEntries);
	}
}
/**
 * Create a descriptor for an enumeration, and add it our cart and to the
 * parent type, if any.
 */
function addEnum(proto, file, parent, reg) {
	var _a, _b, _c, _d, _e;
	const sharedPrefix = findEnumSharedPrefix(proto.name, proto.value);
	const desc = {
		kind: "enum",
		proto,
		deprecated: (_b = (_a = proto.options) === null || _a === void 0 ? void 0 : _a.deprecated) !== null && _b !== void 0 ? _b : false,
		file,
		parent,
		open: true,
		name: proto.name,
		typeName: makeTypeName(proto, parent, file),
		value: {},
		values: [],
		sharedPrefix,
		toString() {
			return `enum ${this.typeName}`;
		},
	};
	desc.open = isEnumOpen(desc);
	reg.add(desc);
	for (const p of proto.value) {
		const name = p.name;
		desc.values.push(
			// biome-ignore lint/suspicious/noAssignInExpressions: no
			(desc.value[p.number] = {
				kind: "enum_value",
				proto: p,
				deprecated: (_d = (_c = p.options) === null || _c === void 0 ? void 0 : _c.deprecated) !== null && _d !== void 0 ? _d : false,
				parent: desc,
				name,
				localName: safeObjectProperty(sharedPrefix == undefined ? name : name.substring(sharedPrefix.length)),
				number: p.number,
				toString() {
					return `enum value ${desc.typeName}.${name}`;
				},
			}),
		);
	}
	((_e = parent === null || parent === void 0 ? void 0 : parent.nestedEnums) !== null && _e !== void 0 ? _e : file.enums).push(desc);
}
/**
 * Create a descriptor for a message, including nested types, and add it to our
 * cart. Note that this does not create descriptors fields.
 */
function addMessage(proto, file, parent, reg, mapEntries) {
	var _a, _b, _c, _d;
	const desc = {
		kind: "message",
		proto,
		deprecated: (_b = (_a = proto.options) === null || _a === void 0 ? void 0 : _a.deprecated) !== null && _b !== void 0 ? _b : false,
		file,
		parent,
		name: proto.name,
		typeName: makeTypeName(proto, parent, file),
		fields: [],
		field: {},
		oneofs: [],
		members: [],
		nestedEnums: [],
		nestedMessages: [],
		nestedExtensions: [],
		toString() {
			return `message ${this.typeName}`;
		},
	};
	if (((_c = proto.options) === null || _c === void 0 ? void 0 : _c.mapEntry) === true) {
		mapEntries.add(desc);
	} else {
		((_d = parent === null || parent === void 0 ? void 0 : parent.nestedMessages) !== null && _d !== void 0 ? _d : file.messages).push(desc);
		reg.add(desc);
	}
	for (const enumProto of proto.enumType) {
		addEnum(enumProto, file, desc, reg);
	}
	for (const messageProto of proto.nestedType) {
		addMessage(messageProto, file, desc, reg, mapEntries);
	}
}
/**
 * Create a descriptor for a service, including methods, and add it to our
 * cart.
 */
function addService(proto, file, reg) {
	var _a, _b;
	const desc = {
		kind: "service",
		proto,
		deprecated: (_b = (_a = proto.options) === null || _a === void 0 ? void 0 : _a.deprecated) !== null && _b !== void 0 ? _b : false,
		file,
		name: proto.name,
		typeName: makeTypeName(proto, undefined, file),
		methods: [],
		method: {},
		toString() {
			return `service ${this.typeName}`;
		},
	};
	file.services.push(desc);
	reg.add(desc);
	for (const methodProto of proto.method) {
		const method = newMethod(methodProto, desc, reg);
		desc.methods.push(method);
		desc.method[method.localName] = method;
	}
}
/**
 * Create a descriptor for a method.
 */
function newMethod(proto, parent, reg) {
	var _a, _b, _c, _d;
	let methodKind;
	if (proto.clientStreaming && proto.serverStreaming) {
		methodKind = "bidi_streaming";
	} else if (proto.clientStreaming) {
		methodKind = "client_streaming";
	} else if (proto.serverStreaming) {
		methodKind = "server_streaming";
	} else {
		methodKind = "unary";
	}
	const input = reg.getMessage(trimLeadingDot(proto.inputType));
	const output = reg.getMessage(trimLeadingDot(proto.outputType));
	assert$1(input, `invalid MethodDescriptorProto: input_type ${proto.inputType} not found`);
	assert$1(output, `invalid MethodDescriptorProto: output_type ${proto.inputType} not found`);
	const name = proto.name;
	return {
		kind: "rpc",
		proto,
		deprecated: (_b = (_a = proto.options) === null || _a === void 0 ? void 0 : _a.deprecated) !== null && _b !== void 0 ? _b : false,
		parent,
		name,
		localName: safeObjectProperty(name.length ? safeObjectProperty(name[0].toLowerCase() + name.substring(1)) : name),
		methodKind,
		input,
		output,
		idempotency: (_d = (_c = proto.options) === null || _c === void 0 ? void 0 : _c.idempotencyLevel) !== null && _d !== void 0 ? _d : IDEMPOTENCY_UNKNOWN,
		toString() {
			return `rpc ${parent.typeName}.${name}`;
		},
	};
}
/**
 * Create a descriptor for a oneof group.
 */
function newOneof(proto, parent) {
	return {
		kind: "oneof",
		proto,
		deprecated: false,
		parent,
		fields: [],
		name: proto.name,
		localName: safeObjectProperty(protoCamelCase(proto.name)),
		toString() {
			return `oneof ${parent.typeName}.${this.name}`;
		},
	};
}
function newField(proto, parentOrFile, reg, oneof, mapEntries) {
	var _a, _b, _c;
	const isExtension = mapEntries === undefined;
	const field = {
		kind: "field",
		proto,
		deprecated: (_b = (_a = proto.options) === null || _a === void 0 ? void 0 : _a.deprecated) !== null && _b !== void 0 ? _b : false,
		name: proto.name,
		number: proto.number,
		scalar: undefined,
		message: undefined,
		enum: undefined,
		presence: getFieldPresence(proto, oneof, isExtension, parentOrFile),
		utf8Validation: isUtf8Validated(proto, parentOrFile),
		listKind: undefined,
		mapKind: undefined,
		mapKey: undefined,
		delimitedEncoding: undefined,
		packed: undefined,
		longAsString: false,
		getDefaultValue: undefined,
	};
	if (isExtension) {
		// extension field
		const file = parentOrFile.kind == "file" ? parentOrFile : parentOrFile.file;
		const parent = parentOrFile.kind == "file" ? undefined : parentOrFile;
		const typeName = makeTypeName(proto, parent, file);
		field.kind = "extension";
		field.file = file;
		field.parent = parent;
		field.oneof = undefined;
		field.typeName = typeName;
		field.jsonName = `[${typeName}]`; // option json_name is not allowed on extension fields
		field.toString = () => `extension ${typeName}`;
		const extendee = reg.getMessage(trimLeadingDot(proto.extendee));
		assert$1(extendee, `invalid FieldDescriptorProto: extendee ${proto.extendee} not found`);
		field.extendee = extendee;
	} else {
		// regular field
		const parent = parentOrFile;
		assert$1(parent.kind == "message");
		field.parent = parent;
		field.oneof = oneof;
		field.localName = oneof ? protoCamelCase(proto.name) : safeObjectProperty(protoCamelCase(proto.name));
		field.jsonName = proto.jsonName;
		field.toString = () => `field ${parent.typeName}.${proto.name}`;
	}
	const label = proto.label;
	const type = proto.type;
	const jstype = (_c = proto.options) === null || _c === void 0 ? void 0 : _c.jstype;
	if (label === LABEL_REPEATED) {
		// list or map field
		const mapEntry =
			type == TYPE_MESSAGE ?
				mapEntries === null || mapEntries === void 0 ?
					void 0
				:	mapEntries.get(trimLeadingDot(proto.typeName))
			:	undefined;
		if (mapEntry) {
			// map field
			field.fieldKind = "map";
			const { key, value } = findMapEntryFields(mapEntry);
			field.mapKey = key.scalar;
			field.mapKind = value.fieldKind;
			field.message = value.message;
			field.delimitedEncoding = false; // map fields are always LENGTH_PREFIXED
			field.enum = value.enum;
			field.scalar = value.scalar;
			return field;
		}
		// list field
		field.fieldKind = "list";
		switch (type) {
			case TYPE_MESSAGE:
			case TYPE_GROUP:
				field.listKind = "message";
				field.message = reg.getMessage(trimLeadingDot(proto.typeName));
				assert$1(field.message);
				field.delimitedEncoding = isDelimitedEncoding(proto, parentOrFile);
				break;
			case TYPE_ENUM:
				field.listKind = "enum";
				field.enum = reg.getEnum(trimLeadingDot(proto.typeName));
				assert$1(field.enum);
				break;
			default:
				field.listKind = "scalar";
				field.scalar = type;
				field.longAsString = jstype == JS_STRING;
				break;
		}
		field.packed = isPackedField(proto, parentOrFile);
		return field;
	}
	// singular
	switch (type) {
		case TYPE_MESSAGE:
		case TYPE_GROUP:
			field.fieldKind = "message";
			field.message = reg.getMessage(trimLeadingDot(proto.typeName));
			assert$1(field.message, `invalid FieldDescriptorProto: type_name ${proto.typeName} not found`);
			field.delimitedEncoding = isDelimitedEncoding(proto, parentOrFile);
			field.getDefaultValue = () => undefined;
			break;
		case TYPE_ENUM: {
			const enumeration = reg.getEnum(trimLeadingDot(proto.typeName));
			assert$1(enumeration !== undefined, `invalid FieldDescriptorProto: type_name ${proto.typeName} not found`);
			field.fieldKind = "enum";
			field.enum = reg.getEnum(trimLeadingDot(proto.typeName));
			field.getDefaultValue = () => {
				return unsafeIsSetExplicit(proto, "defaultValue") ? parseTextFormatEnumValue(enumeration, proto.defaultValue) : undefined;
			};
			break;
		}
		default: {
			field.fieldKind = "scalar";
			field.scalar = type;
			field.longAsString = jstype == JS_STRING;
			field.getDefaultValue = () => {
				return unsafeIsSetExplicit(proto, "defaultValue") ? parseTextFormatScalarValue(type, proto.defaultValue) : undefined;
			};
			break;
		}
	}
	return field;
}
/**
 * Parse the "syntax" and "edition" fields, returning one of the supported
 * editions.
 */
function getFileEdition(proto) {
	switch (proto.syntax) {
		case "":
		case "proto2":
			return EDITION_PROTO2;
		case "proto3":
			return EDITION_PROTO3;
		case "editions":
			// EDITION_UNSTABLE is a sandbox for in-development features. Collapse
			// it to maximumEdition so SupportedEdition and feature resolution do
			// not leak the test-only edition to users.
			if (proto.edition === EDITION_UNSTABLE) {
				return maximumEdition;
			}
			if (proto.edition in featureDefaults) {
				return proto.edition;
			}
			throw new Error(`${proto.name}: unsupported edition`);
		default:
			throw new Error(`${proto.name}: unsupported syntax "${proto.syntax}"`);
	}
}
/**
 * Resolve dependencies of FileDescriptorProto to DescFile.
 */
function findFileDependencies(proto, reg) {
	return proto.dependency.map((wantName) => {
		const dep = reg.getFile(wantName);
		if (!dep) {
			throw new Error(`Cannot find ${wantName}, imported by ${proto.name}`);
		}
		return dep;
	});
}
/**
 * Finds a prefix shared by enum values, for example `my_enum_` for
 * `enum MyEnum {MY_ENUM_A=0; MY_ENUM_B=1;}`.
 */
function findEnumSharedPrefix(enumName, values) {
	const prefix = camelToSnakeCase(enumName) + "_";
	for (const value of values) {
		if (!value.name.toLowerCase().startsWith(prefix)) {
			return undefined;
		}
		const shortName = value.name.substring(prefix.length);
		if (shortName.length == 0) {
			return undefined;
		}
		if (/^\d/.test(shortName)) {
			// identifiers must not start with numbers
			return undefined;
		}
	}
	return prefix;
}
/**
 * Converts lowerCamelCase or UpperCamelCase into lower_snake_case.
 * This is used to find shared prefixes in an enum.
 */
function camelToSnakeCase(camel) {
	return (camel.substring(0, 1) + camel.substring(1).replace(/[A-Z]/g, (c) => "_" + c)).toLowerCase();
}
/**
 * Create a fully qualified name for a protobuf type or extension field.
 *
 * The fully qualified name for messages, enumerations, and services is
 * constructed by concatenating the package name (if present), parent
 * message names (for nested types), and the type name. We omit the leading
 * dot added by protobuf compilers. Examples:
 * - mypackage.MyMessage
 * - mypackage.MyMessage.NestedMessage
 *
 * The fully qualified name for extension fields is constructed by
 * concatenating the package name (if present), parent message names (for
 * extensions declared within a message), and the field name. Examples:
 * - mypackage.extfield
 * - mypackage.MyMessage.extfield
 */
function makeTypeName(proto, parent, file) {
	let typeName;
	if (parent) {
		typeName = `${parent.typeName}.${proto.name}`;
	} else if (file.proto.package.length > 0) {
		typeName = `${file.proto.package}.${proto.name}`;
	} else {
		typeName = `${proto.name}`;
	}
	return typeName;
}
/**
 * Remove the leading dot from a fully qualified type name.
 */
function trimLeadingDot(typeName) {
	return typeName.startsWith(".") ? typeName.substring(1) : typeName;
}
/**
 * Did the user put the field in a oneof group?
 * Synthetic oneofs for proto3 optionals are ignored.
 */
function findOneof(proto, allOneofs) {
	if (!unsafeIsSetExplicit(proto, "oneofIndex")) {
		return undefined;
	}
	if (proto.proto3Optional) {
		return undefined;
	}
	const oneof = allOneofs[proto.oneofIndex];
	assert$1(oneof, `invalid FieldDescriptorProto: oneof #${proto.oneofIndex} for field #${proto.number} not found`);
	return oneof;
}
/**
 * Presence of the field.
 * See https://protobuf.dev/programming-guides/field_presence/
 */
function getFieldPresence(proto, oneof, isExtension, parent) {
	if (proto.label == LABEL_REQUIRED) {
		// proto2 required is LEGACY_REQUIRED
		return LEGACY_REQUIRED;
	}
	if (proto.label == LABEL_REPEATED) {
		// repeated fields (including maps) do not track presence
		return IMPLICIT;
	}
	if (!!oneof || proto.proto3Optional) {
		// oneof is always explicit
		return EXPLICIT;
	}
	if (isExtension) {
		// extensions always track presence
		return EXPLICIT;
	}
	const resolved = resolveFeature("fieldPresence", { proto, parent });
	if (resolved == IMPLICIT && (proto.type == TYPE_MESSAGE || proto.type == TYPE_GROUP)) {
		// singular message field cannot be implicit
		return EXPLICIT;
	}
	return resolved;
}
/**
 * Pack this repeated field?
 */
function isPackedField(proto, parent) {
	if (proto.label != LABEL_REPEATED) {
		return false;
	}
	switch (proto.type) {
		case TYPE_STRING:
		case TYPE_BYTES:
		case TYPE_GROUP:
		case TYPE_MESSAGE:
			// length-delimited types cannot be packed
			return false;
	}
	const o = proto.options;
	if (o && unsafeIsSetExplicit(o, "packed")) {
		// prefer the field option over edition features
		return o.packed;
	}
	return (
		PACKED ==
		resolveFeature("repeatedFieldEncoding", {
			proto,
			parent,
		})
	);
}
/**
 * Find the key and value fields of a synthetic map entry message.
 */
function findMapEntryFields(mapEntry) {
	const key = mapEntry.fields.find((f) => f.number === 1);
	const value = mapEntry.fields.find((f) => f.number === 2);
	assert$1(
		key &&
			key.fieldKind == "scalar" &&
			key.scalar != ScalarType.BYTES &&
			key.scalar != ScalarType.FLOAT &&
			key.scalar != ScalarType.DOUBLE &&
			value &&
			value.fieldKind != "list" &&
			value.fieldKind != "map",
	);
	return { key, value };
}
/**
 * Enumerations can be open or closed.
 * See https://protobuf.dev/programming-guides/enum/
 */
function isEnumOpen(desc) {
	var _a;
	return (
		OPEN ==
		resolveFeature("enumType", {
			proto: desc.proto,
			parent: (_a = desc.parent) !== null && _a !== void 0 ? _a : desc.file,
		})
	);
}
/**
 * Encode the message delimited (a.k.a. proto2 group encoding), or
 * length-prefixed?
 */
function isDelimitedEncoding(proto, parent) {
	if (proto.type == TYPE_GROUP) {
		return true;
	}
	return (
		DELIMITED ==
		resolveFeature("messageEncoding", {
			proto,
			parent,
		})
	);
}
/**
 * Reject invalid UTF-8 when reading string fields from the binary wire format?
 * Driven by the resolved `utf8_validation` feature: VERIFY (proto3 / editions
 * 2023+ default) enforces; NONE (proto2 default) does not.
 */
function isUtf8Validated(proto, parent) {
	return (
		VERIFY ==
		resolveFeature("utf8Validation", {
			proto,
			parent,
		})
	);
}
function resolveFeature(name, ref) {
	var _a, _b;
	const featureSet = (_a = ref.proto.options) === null || _a === void 0 ? void 0 : _a.features;
	if (featureSet) {
		const val = featureSet[name];
		if (val != 0) {
			return val;
		}
	}
	if ("kind" in ref) {
		if (ref.kind == "message") {
			return resolveFeature(name, (_b = ref.parent) !== null && _b !== void 0 ? _b : ref.file);
		}
		const editionDefaults = featureDefaults[ref.edition];
		if (!editionDefaults) {
			throw new Error(`feature default for edition ${ref.edition} not found`);
		}
		return editionDefaults[name];
	}
	return resolveFeature(name, ref.parent);
}
/**
 * Assert that condition is truthy or throw error (with message)
 */
function assert$1(condition, msg) {
	if (!condition) {
		throw new Error(msg);
	}
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Hydrate a file descriptor for google/protobuf/descriptor.proto from a plain
 * object.
 *
 * See createFileDescriptorProtoBoot() for details.
 *
 * @private
 */
function boot(boot) {
	const root = bootFileDescriptorProto(boot);
	root.messageType.forEach(restoreJsonNames);
	const reg = createFileRegistry(root, () => undefined);
	// biome-ignore lint/style/noNonNullAssertion: non-null assertion because we just created the registry from the file we look up
	return reg.getFile(root.name);
}
/**
 * Creates the message google.protobuf.FileDescriptorProto from an object literal.
 *
 * See createFileDescriptorProtoBoot() for details.
 *
 * @private
 */
function bootFileDescriptorProto(init) {
	const proto = Object.create({
		syntax: "",
		edition: 0,
	});
	return Object.assign(
		proto,
		Object.assign(
			Object.assign({ $typeName: "google.protobuf.FileDescriptorProto", dependency: [], publicDependency: [], weakDependency: [], optionDependency: [], service: [], extension: [] }, init),
			{ messageType: init.messageType.map(bootDescriptorProto), enumType: init.enumType.map(bootEnumDescriptorProto) },
		),
	);
}
function bootDescriptorProto(init) {
	var _a, _b, _c, _d, _e, _f, _g, _h;
	const proto = Object.create({
		visibility: 0,
	});
	return Object.assign(proto, {
		$typeName: "google.protobuf.DescriptorProto",
		name: init.name,
		field: (_b = (_a = init.field) === null || _a === void 0 ? void 0 : _a.map(bootFieldDescriptorProto)) !== null && _b !== void 0 ? _b : [],
		extension: [],
		nestedType: (_d = (_c = init.nestedType) === null || _c === void 0 ? void 0 : _c.map(bootDescriptorProto)) !== null && _d !== void 0 ? _d : [],
		enumType: (_f = (_e = init.enumType) === null || _e === void 0 ? void 0 : _e.map(bootEnumDescriptorProto)) !== null && _f !== void 0 ? _f : [],
		extensionRange:
			(
				(_h = (_g = init.extensionRange) === null || _g === void 0 ? void 0 : _g.map((e) => Object.assign({ $typeName: "google.protobuf.DescriptorProto.ExtensionRange" }, e))) !== null &&
				_h !== void 0
			) ?
				_h
			:	[],
		oneofDecl: [],
		reservedRange: [],
		reservedName: [],
	});
}
function bootFieldDescriptorProto(init) {
	const proto = Object.create({
		label: 1,
		typeName: "",
		extendee: "",
		defaultValue: "",
		oneofIndex: 0,
		jsonName: "",
		proto3Optional: false,
	});
	return Object.assign(proto, Object.assign(Object.assign({ $typeName: "google.protobuf.FieldDescriptorProto" }, init), { options: init.options ? bootFieldOptions(init.options) : undefined }));
}
function bootFieldOptions(init) {
	var _a, _b, _c;
	const proto = Object.create({
		ctype: 0,
		packed: false,
		jstype: 0,
		lazy: false,
		unverifiedLazy: false,
		deprecated: false,
		weak: false,
		debugRedact: false,
		retention: 0,
	});
	return Object.assign(
		proto,
		Object.assign(Object.assign({ $typeName: "google.protobuf.FieldOptions" }, init), {
			targets: (_a = init.targets) !== null && _a !== void 0 ? _a : [],
			editionDefaults:
				(
					(_c = (_b = init.editionDefaults) === null || _b === void 0 ? void 0 : _b.map((e) => Object.assign({ $typeName: "google.protobuf.FieldOptions.EditionDefault" }, e))) !== null &&
					_c !== void 0
				) ?
					_c
				:	[],
			uninterpretedOption: [],
		}),
	);
}
function bootEnumDescriptorProto(init) {
	const proto = Object.create({
		visibility: 0,
	});
	return Object.assign(proto, {
		$typeName: "google.protobuf.EnumDescriptorProto",
		name: init.name,
		reservedName: [],
		reservedRange: [],
		value: init.value.map((e) => Object.assign({ $typeName: "google.protobuf.EnumValueDescriptorProto" }, e)),
	});
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Hydrate a message descriptor.
 *
 * @private
 */
function messageDesc(file, path, ...paths) {
	return paths.reduce((acc, cur) => acc.nestedMessages[cur], file.messages[path]);
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Describes the file google/protobuf/descriptor.proto.
 */
const file_google_protobuf_descriptor = /*@__PURE__*/ boot({
	name: "google/protobuf/descriptor.proto",
	package: "google.protobuf",
	messageType: [
		{
			name: "FileDescriptorSet",
			field: [{ name: "file", number: 1, type: 11, label: 3, typeName: ".google.protobuf.FileDescriptorProto" }],
			extensionRange: [{ start: 536000000, end: 536000001 }],
		},
		{
			name: "FileDescriptorProto",
			field: [
				{ name: "name", number: 1, type: 9, label: 1 },
				{ name: "package", number: 2, type: 9, label: 1 },
				{ name: "dependency", number: 3, type: 9, label: 3 },
				{ name: "public_dependency", number: 10, type: 5, label: 3 },
				{ name: "weak_dependency", number: 11, type: 5, label: 3 },
				{ name: "option_dependency", number: 15, type: 9, label: 3 },
				{ name: "message_type", number: 4, type: 11, label: 3, typeName: ".google.protobuf.DescriptorProto" },
				{ name: "enum_type", number: 5, type: 11, label: 3, typeName: ".google.protobuf.EnumDescriptorProto" },
				{ name: "service", number: 6, type: 11, label: 3, typeName: ".google.protobuf.ServiceDescriptorProto" },
				{ name: "extension", number: 7, type: 11, label: 3, typeName: ".google.protobuf.FieldDescriptorProto" },
				{ name: "options", number: 8, type: 11, label: 1, typeName: ".google.protobuf.FileOptions" },
				{ name: "source_code_info", number: 9, type: 11, label: 1, typeName: ".google.protobuf.SourceCodeInfo" },
				{ name: "syntax", number: 12, type: 9, label: 1 },
				{ name: "edition", number: 14, type: 14, label: 1, typeName: ".google.protobuf.Edition" },
			],
		},
		{
			name: "DescriptorProto",
			field: [
				{ name: "name", number: 1, type: 9, label: 1 },
				{ name: "field", number: 2, type: 11, label: 3, typeName: ".google.protobuf.FieldDescriptorProto" },
				{ name: "extension", number: 6, type: 11, label: 3, typeName: ".google.protobuf.FieldDescriptorProto" },
				{ name: "nested_type", number: 3, type: 11, label: 3, typeName: ".google.protobuf.DescriptorProto" },
				{ name: "enum_type", number: 4, type: 11, label: 3, typeName: ".google.protobuf.EnumDescriptorProto" },
				{ name: "extension_range", number: 5, type: 11, label: 3, typeName: ".google.protobuf.DescriptorProto.ExtensionRange" },
				{ name: "oneof_decl", number: 8, type: 11, label: 3, typeName: ".google.protobuf.OneofDescriptorProto" },
				{ name: "options", number: 7, type: 11, label: 1, typeName: ".google.protobuf.MessageOptions" },
				{ name: "reserved_range", number: 9, type: 11, label: 3, typeName: ".google.protobuf.DescriptorProto.ReservedRange" },
				{ name: "reserved_name", number: 10, type: 9, label: 3 },
				{ name: "visibility", number: 11, type: 14, label: 1, typeName: ".google.protobuf.SymbolVisibility" },
			],
			nestedType: [
				{
					name: "ExtensionRange",
					field: [
						{ name: "start", number: 1, type: 5, label: 1 },
						{ name: "end", number: 2, type: 5, label: 1 },
						{ name: "options", number: 3, type: 11, label: 1, typeName: ".google.protobuf.ExtensionRangeOptions" },
					],
				},
				{
					name: "ReservedRange",
					field: [
						{ name: "start", number: 1, type: 5, label: 1 },
						{ name: "end", number: 2, type: 5, label: 1 },
					],
				},
			],
		},
		{
			name: "ExtensionRangeOptions",
			field: [
				{ name: "uninterpreted_option", number: 999, type: 11, label: 3, typeName: ".google.protobuf.UninterpretedOption" },
				{ name: "declaration", number: 2, type: 11, label: 3, typeName: ".google.protobuf.ExtensionRangeOptions.Declaration", options: { retention: 2 } },
				{ name: "features", number: 50, type: 11, label: 1, typeName: ".google.protobuf.FeatureSet" },
				{ name: "verification", number: 3, type: 14, label: 1, typeName: ".google.protobuf.ExtensionRangeOptions.VerificationState", defaultValue: "UNVERIFIED", options: { retention: 2 } },
			],
			nestedType: [
				{
					name: "Declaration",
					field: [
						{ name: "number", number: 1, type: 5, label: 1 },
						{ name: "full_name", number: 2, type: 9, label: 1 },
						{ name: "type", number: 3, type: 9, label: 1 },
						{ name: "reserved", number: 5, type: 8, label: 1 },
						{ name: "repeated", number: 6, type: 8, label: 1 },
					],
				},
			],
			enumType: [
				{
					name: "VerificationState",
					value: [
						{ name: "DECLARATION", number: 0 },
						{ name: "UNVERIFIED", number: 1 },
					],
				},
			],
			extensionRange: [{ start: 1000, end: 536870912 }],
		},
		{
			name: "FieldDescriptorProto",
			field: [
				{ name: "name", number: 1, type: 9, label: 1 },
				{ name: "number", number: 3, type: 5, label: 1 },
				{ name: "label", number: 4, type: 14, label: 1, typeName: ".google.protobuf.FieldDescriptorProto.Label" },
				{ name: "type", number: 5, type: 14, label: 1, typeName: ".google.protobuf.FieldDescriptorProto.Type" },
				{ name: "type_name", number: 6, type: 9, label: 1 },
				{ name: "extendee", number: 2, type: 9, label: 1 },
				{ name: "default_value", number: 7, type: 9, label: 1 },
				{ name: "oneof_index", number: 9, type: 5, label: 1 },
				{ name: "json_name", number: 10, type: 9, label: 1 },
				{ name: "options", number: 8, type: 11, label: 1, typeName: ".google.protobuf.FieldOptions" },
				{ name: "proto3_optional", number: 17, type: 8, label: 1 },
			],
			enumType: [
				{
					name: "Type",
					value: [
						{ name: "TYPE_DOUBLE", number: 1 },
						{ name: "TYPE_FLOAT", number: 2 },
						{ name: "TYPE_INT64", number: 3 },
						{ name: "TYPE_UINT64", number: 4 },
						{ name: "TYPE_INT32", number: 5 },
						{ name: "TYPE_FIXED64", number: 6 },
						{ name: "TYPE_FIXED32", number: 7 },
						{ name: "TYPE_BOOL", number: 8 },
						{ name: "TYPE_STRING", number: 9 },
						{ name: "TYPE_GROUP", number: 10 },
						{ name: "TYPE_MESSAGE", number: 11 },
						{ name: "TYPE_BYTES", number: 12 },
						{ name: "TYPE_UINT32", number: 13 },
						{ name: "TYPE_ENUM", number: 14 },
						{ name: "TYPE_SFIXED32", number: 15 },
						{ name: "TYPE_SFIXED64", number: 16 },
						{ name: "TYPE_SINT32", number: 17 },
						{ name: "TYPE_SINT64", number: 18 },
					],
				},
				{
					name: "Label",
					value: [
						{ name: "LABEL_OPTIONAL", number: 1 },
						{ name: "LABEL_REPEATED", number: 3 },
						{ name: "LABEL_REQUIRED", number: 2 },
					],
				},
			],
		},
		{
			name: "OneofDescriptorProto",
			field: [
				{ name: "name", number: 1, type: 9, label: 1 },
				{ name: "options", number: 2, type: 11, label: 1, typeName: ".google.protobuf.OneofOptions" },
			],
		},
		{
			name: "EnumDescriptorProto",
			field: [
				{ name: "name", number: 1, type: 9, label: 1 },
				{ name: "value", number: 2, type: 11, label: 3, typeName: ".google.protobuf.EnumValueDescriptorProto" },
				{ name: "options", number: 3, type: 11, label: 1, typeName: ".google.protobuf.EnumOptions" },
				{ name: "reserved_range", number: 4, type: 11, label: 3, typeName: ".google.protobuf.EnumDescriptorProto.EnumReservedRange" },
				{ name: "reserved_name", number: 5, type: 9, label: 3 },
				{ name: "visibility", number: 6, type: 14, label: 1, typeName: ".google.protobuf.SymbolVisibility" },
			],
			nestedType: [
				{
					name: "EnumReservedRange",
					field: [
						{ name: "start", number: 1, type: 5, label: 1 },
						{ name: "end", number: 2, type: 5, label: 1 },
					],
				},
			],
		},
		{
			name: "EnumValueDescriptorProto",
			field: [
				{ name: "name", number: 1, type: 9, label: 1 },
				{ name: "number", number: 2, type: 5, label: 1 },
				{ name: "options", number: 3, type: 11, label: 1, typeName: ".google.protobuf.EnumValueOptions" },
			],
		},
		{
			name: "ServiceDescriptorProto",
			field: [
				{ name: "name", number: 1, type: 9, label: 1 },
				{ name: "method", number: 2, type: 11, label: 3, typeName: ".google.protobuf.MethodDescriptorProto" },
				{ name: "options", number: 3, type: 11, label: 1, typeName: ".google.protobuf.ServiceOptions" },
			],
		},
		{
			name: "MethodDescriptorProto",
			field: [
				{ name: "name", number: 1, type: 9, label: 1 },
				{ name: "input_type", number: 2, type: 9, label: 1 },
				{ name: "output_type", number: 3, type: 9, label: 1 },
				{ name: "options", number: 4, type: 11, label: 1, typeName: ".google.protobuf.MethodOptions" },
				{ name: "client_streaming", number: 5, type: 8, label: 1, defaultValue: "false" },
				{ name: "server_streaming", number: 6, type: 8, label: 1, defaultValue: "false" },
			],
		},
		{
			name: "FileOptions",
			field: [
				{ name: "java_package", number: 1, type: 9, label: 1 },
				{ name: "java_outer_classname", number: 8, type: 9, label: 1 },
				{ name: "java_multiple_files", number: 10, type: 8, label: 1, defaultValue: "false", options: {} },
				{ name: "java_generate_equals_and_hash", number: 20, type: 8, label: 1, options: { deprecated: true } },
				{ name: "java_string_check_utf8", number: 27, type: 8, label: 1, defaultValue: "false" },
				{ name: "optimize_for", number: 9, type: 14, label: 1, typeName: ".google.protobuf.FileOptions.OptimizeMode", defaultValue: "SPEED" },
				{ name: "go_package", number: 11, type: 9, label: 1 },
				{ name: "cc_generic_services", number: 16, type: 8, label: 1, defaultValue: "false" },
				{ name: "java_generic_services", number: 17, type: 8, label: 1, defaultValue: "false" },
				{ name: "py_generic_services", number: 18, type: 8, label: 1, defaultValue: "false" },
				{ name: "deprecated", number: 23, type: 8, label: 1, defaultValue: "false" },
				{ name: "cc_enable_arenas", number: 31, type: 8, label: 1, defaultValue: "true" },
				{ name: "objc_class_prefix", number: 36, type: 9, label: 1 },
				{ name: "csharp_namespace", number: 37, type: 9, label: 1 },
				{ name: "swift_prefix", number: 39, type: 9, label: 1 },
				{ name: "php_class_prefix", number: 40, type: 9, label: 1 },
				{ name: "php_namespace", number: 41, type: 9, label: 1 },
				{ name: "php_metadata_namespace", number: 44, type: 9, label: 1 },
				{ name: "ruby_package", number: 45, type: 9, label: 1 },
				{ name: "features", number: 50, type: 11, label: 1, typeName: ".google.protobuf.FeatureSet" },
				{ name: "uninterpreted_option", number: 999, type: 11, label: 3, typeName: ".google.protobuf.UninterpretedOption" },
			],
			enumType: [
				{
					name: "OptimizeMode",
					value: [
						{ name: "SPEED", number: 1 },
						{ name: "CODE_SIZE", number: 2 },
						{ name: "LITE_RUNTIME", number: 3 },
					],
				},
			],
			extensionRange: [{ start: 1000, end: 536870912 }],
		},
		{
			name: "MessageOptions",
			field: [
				{ name: "message_set_wire_format", number: 1, type: 8, label: 1, defaultValue: "false" },
				{ name: "no_standard_descriptor_accessor", number: 2, type: 8, label: 1, defaultValue: "false" },
				{ name: "deprecated", number: 3, type: 8, label: 1, defaultValue: "false" },
				{ name: "map_entry", number: 7, type: 8, label: 1 },
				{ name: "deprecated_legacy_json_field_conflicts", number: 11, type: 8, label: 1, options: { deprecated: true } },
				{ name: "features", number: 12, type: 11, label: 1, typeName: ".google.protobuf.FeatureSet" },
				{ name: "uninterpreted_option", number: 999, type: 11, label: 3, typeName: ".google.protobuf.UninterpretedOption" },
			],
			extensionRange: [{ start: 1000, end: 536870912 }],
		},
		{
			name: "FieldOptions",
			field: [
				{ name: "ctype", number: 1, type: 14, label: 1, typeName: ".google.protobuf.FieldOptions.CType", defaultValue: "STRING" },
				{ name: "packed", number: 2, type: 8, label: 1 },
				{ name: "jstype", number: 6, type: 14, label: 1, typeName: ".google.protobuf.FieldOptions.JSType", defaultValue: "JS_NORMAL" },
				{ name: "lazy", number: 5, type: 8, label: 1, defaultValue: "false" },
				{ name: "unverified_lazy", number: 15, type: 8, label: 1, defaultValue: "false" },
				{ name: "deprecated", number: 3, type: 8, label: 1, defaultValue: "false" },
				{ name: "weak", number: 10, type: 8, label: 1, defaultValue: "false", options: { deprecated: true } },
				{ name: "debug_redact", number: 16, type: 8, label: 1, defaultValue: "false" },
				{ name: "retention", number: 17, type: 14, label: 1, typeName: ".google.protobuf.FieldOptions.OptionRetention" },
				{ name: "targets", number: 19, type: 14, label: 3, typeName: ".google.protobuf.FieldOptions.OptionTargetType" },
				{ name: "edition_defaults", number: 20, type: 11, label: 3, typeName: ".google.protobuf.FieldOptions.EditionDefault" },
				{ name: "features", number: 21, type: 11, label: 1, typeName: ".google.protobuf.FeatureSet" },
				{ name: "feature_support", number: 22, type: 11, label: 1, typeName: ".google.protobuf.FieldOptions.FeatureSupport" },
				{ name: "uninterpreted_option", number: 999, type: 11, label: 3, typeName: ".google.protobuf.UninterpretedOption" },
			],
			nestedType: [
				{
					name: "EditionDefault",
					field: [
						{ name: "edition", number: 3, type: 14, label: 1, typeName: ".google.protobuf.Edition" },
						{ name: "value", number: 2, type: 9, label: 1 },
					],
				},
				{
					name: "FeatureSupport",
					field: [
						{ name: "edition_introduced", number: 1, type: 14, label: 1, typeName: ".google.protobuf.Edition" },
						{ name: "edition_deprecated", number: 2, type: 14, label: 1, typeName: ".google.protobuf.Edition" },
						{ name: "deprecation_warning", number: 3, type: 9, label: 1 },
						{ name: "edition_removed", number: 4, type: 14, label: 1, typeName: ".google.protobuf.Edition" },
						{ name: "removal_error", number: 5, type: 9, label: 1 },
					],
				},
			],
			enumType: [
				{
					name: "CType",
					value: [
						{ name: "STRING", number: 0 },
						{ name: "CORD", number: 1 },
						{ name: "STRING_PIECE", number: 2 },
					],
				},
				{
					name: "JSType",
					value: [
						{ name: "JS_NORMAL", number: 0 },
						{ name: "JS_STRING", number: 1 },
						{ name: "JS_NUMBER", number: 2 },
					],
				},
				{
					name: "OptionRetention",
					value: [
						{ name: "RETENTION_UNKNOWN", number: 0 },
						{ name: "RETENTION_RUNTIME", number: 1 },
						{ name: "RETENTION_SOURCE", number: 2 },
					],
				},
				{
					name: "OptionTargetType",
					value: [
						{ name: "TARGET_TYPE_UNKNOWN", number: 0 },
						{ name: "TARGET_TYPE_FILE", number: 1 },
						{ name: "TARGET_TYPE_EXTENSION_RANGE", number: 2 },
						{ name: "TARGET_TYPE_MESSAGE", number: 3 },
						{ name: "TARGET_TYPE_FIELD", number: 4 },
						{ name: "TARGET_TYPE_ONEOF", number: 5 },
						{ name: "TARGET_TYPE_ENUM", number: 6 },
						{ name: "TARGET_TYPE_ENUM_ENTRY", number: 7 },
						{ name: "TARGET_TYPE_SERVICE", number: 8 },
						{ name: "TARGET_TYPE_METHOD", number: 9 },
					],
				},
			],
			extensionRange: [{ start: 1000, end: 536870912 }],
		},
		{
			name: "OneofOptions",
			field: [
				{ name: "features", number: 1, type: 11, label: 1, typeName: ".google.protobuf.FeatureSet" },
				{ name: "uninterpreted_option", number: 999, type: 11, label: 3, typeName: ".google.protobuf.UninterpretedOption" },
			],
			extensionRange: [{ start: 1000, end: 536870912 }],
		},
		{
			name: "EnumOptions",
			field: [
				{ name: "allow_alias", number: 2, type: 8, label: 1 },
				{ name: "deprecated", number: 3, type: 8, label: 1, defaultValue: "false" },
				{ name: "deprecated_legacy_json_field_conflicts", number: 6, type: 8, label: 1, options: { deprecated: true } },
				{ name: "features", number: 7, type: 11, label: 1, typeName: ".google.protobuf.FeatureSet" },
				{ name: "uninterpreted_option", number: 999, type: 11, label: 3, typeName: ".google.protobuf.UninterpretedOption" },
			],
			extensionRange: [{ start: 1000, end: 536870912 }],
		},
		{
			name: "EnumValueOptions",
			field: [
				{ name: "deprecated", number: 1, type: 8, label: 1, defaultValue: "false" },
				{ name: "features", number: 2, type: 11, label: 1, typeName: ".google.protobuf.FeatureSet" },
				{ name: "debug_redact", number: 3, type: 8, label: 1, defaultValue: "false" },
				{ name: "feature_support", number: 4, type: 11, label: 1, typeName: ".google.protobuf.FieldOptions.FeatureSupport" },
				{ name: "uninterpreted_option", number: 999, type: 11, label: 3, typeName: ".google.protobuf.UninterpretedOption" },
			],
			extensionRange: [{ start: 1000, end: 536870912 }],
		},
		{
			name: "ServiceOptions",
			field: [
				{ name: "features", number: 34, type: 11, label: 1, typeName: ".google.protobuf.FeatureSet" },
				{ name: "deprecated", number: 33, type: 8, label: 1, defaultValue: "false" },
				{ name: "uninterpreted_option", number: 999, type: 11, label: 3, typeName: ".google.protobuf.UninterpretedOption" },
			],
			extensionRange: [{ start: 1000, end: 536870912 }],
		},
		{
			name: "MethodOptions",
			field: [
				{ name: "deprecated", number: 33, type: 8, label: 1, defaultValue: "false" },
				{ name: "idempotency_level", number: 34, type: 14, label: 1, typeName: ".google.protobuf.MethodOptions.IdempotencyLevel", defaultValue: "IDEMPOTENCY_UNKNOWN" },
				{ name: "features", number: 35, type: 11, label: 1, typeName: ".google.protobuf.FeatureSet" },
				{ name: "uninterpreted_option", number: 999, type: 11, label: 3, typeName: ".google.protobuf.UninterpretedOption" },
			],
			enumType: [
				{
					name: "IdempotencyLevel",
					value: [
						{ name: "IDEMPOTENCY_UNKNOWN", number: 0 },
						{ name: "NO_SIDE_EFFECTS", number: 1 },
						{ name: "IDEMPOTENT", number: 2 },
					],
				},
			],
			extensionRange: [{ start: 1000, end: 536870912 }],
		},
		{
			name: "UninterpretedOption",
			field: [
				{ name: "name", number: 2, type: 11, label: 3, typeName: ".google.protobuf.UninterpretedOption.NamePart" },
				{ name: "identifier_value", number: 3, type: 9, label: 1 },
				{ name: "positive_int_value", number: 4, type: 4, label: 1 },
				{ name: "negative_int_value", number: 5, type: 3, label: 1 },
				{ name: "double_value", number: 6, type: 1, label: 1 },
				{ name: "string_value", number: 7, type: 12, label: 1 },
				{ name: "aggregate_value", number: 8, type: 9, label: 1 },
			],
			nestedType: [
				{
					name: "NamePart",
					field: [
						{ name: "name_part", number: 1, type: 9, label: 2 },
						{ name: "is_extension", number: 2, type: 8, label: 2 },
					],
				},
			],
		},
		{
			name: "FeatureSet",
			field: [
				{
					name: "field_presence",
					number: 1,
					type: 14,
					label: 1,
					typeName: ".google.protobuf.FeatureSet.FieldPresence",
					options: {
						retention: 1,
						targets: [4, 1],
						editionDefaults: [
							{ value: "EXPLICIT", edition: 900 },
							{ value: "IMPLICIT", edition: 999 },
							{ value: "EXPLICIT", edition: 1000 },
						],
					},
				},
				{
					name: "enum_type",
					number: 2,
					type: 14,
					label: 1,
					typeName: ".google.protobuf.FeatureSet.EnumType",
					options: {
						retention: 1,
						targets: [6, 1],
						editionDefaults: [
							{ value: "CLOSED", edition: 900 },
							{ value: "OPEN", edition: 999 },
						],
					},
				},
				{
					name: "repeated_field_encoding",
					number: 3,
					type: 14,
					label: 1,
					typeName: ".google.protobuf.FeatureSet.RepeatedFieldEncoding",
					options: {
						retention: 1,
						targets: [4, 1],
						editionDefaults: [
							{ value: "EXPANDED", edition: 900 },
							{ value: "PACKED", edition: 999 },
						],
					},
				},
				{
					name: "utf8_validation",
					number: 4,
					type: 14,
					label: 1,
					typeName: ".google.protobuf.FeatureSet.Utf8Validation",
					options: {
						retention: 1,
						targets: [4, 1],
						editionDefaults: [
							{ value: "NONE", edition: 900 },
							{ value: "VERIFY", edition: 999 },
						],
					},
				},
				{
					name: "message_encoding",
					number: 5,
					type: 14,
					label: 1,
					typeName: ".google.protobuf.FeatureSet.MessageEncoding",
					options: { retention: 1, targets: [4, 1], editionDefaults: [{ value: "LENGTH_PREFIXED", edition: 900 }] },
				},
				{
					name: "json_format",
					number: 6,
					type: 14,
					label: 1,
					typeName: ".google.protobuf.FeatureSet.JsonFormat",
					options: {
						retention: 1,
						targets: [3, 6, 1],
						editionDefaults: [
							{ value: "LEGACY_BEST_EFFORT", edition: 900 },
							{ value: "ALLOW", edition: 999 },
						],
					},
				},
				{
					name: "enforce_naming_style",
					number: 7,
					type: 14,
					label: 1,
					typeName: ".google.protobuf.FeatureSet.EnforceNamingStyle",
					options: {
						retention: 2,
						targets: [1, 2, 3, 4, 5, 6, 7, 8, 9],
						editionDefaults: [
							{ value: "STYLE_LEGACY", edition: 900 },
							{ value: "STYLE2024", edition: 1001 },
						],
					},
				},
				{
					name: "default_symbol_visibility",
					number: 8,
					type: 14,
					label: 1,
					typeName: ".google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility",
					options: {
						retention: 2,
						targets: [1],
						editionDefaults: [
							{ value: "EXPORT_ALL", edition: 900 },
							{ value: "EXPORT_TOP_LEVEL", edition: 1001 },
						],
					},
				},
			],
			nestedType: [
				{
					name: "VisibilityFeature",
					enumType: [
						{
							name: "DefaultSymbolVisibility",
							value: [
								{ name: "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN", number: 0 },
								{ name: "EXPORT_ALL", number: 1 },
								{ name: "EXPORT_TOP_LEVEL", number: 2 },
								{ name: "LOCAL_ALL", number: 3 },
								{ name: "STRICT", number: 4 },
							],
						},
					],
				},
			],
			enumType: [
				{
					name: "FieldPresence",
					value: [
						{ name: "FIELD_PRESENCE_UNKNOWN", number: 0 },
						{ name: "EXPLICIT", number: 1 },
						{ name: "IMPLICIT", number: 2 },
						{ name: "LEGACY_REQUIRED", number: 3 },
					],
				},
				{
					name: "EnumType",
					value: [
						{ name: "ENUM_TYPE_UNKNOWN", number: 0 },
						{ name: "OPEN", number: 1 },
						{ name: "CLOSED", number: 2 },
					],
				},
				{
					name: "RepeatedFieldEncoding",
					value: [
						{ name: "REPEATED_FIELD_ENCODING_UNKNOWN", number: 0 },
						{ name: "PACKED", number: 1 },
						{ name: "EXPANDED", number: 2 },
					],
				},
				{
					name: "Utf8Validation",
					value: [
						{ name: "UTF8_VALIDATION_UNKNOWN", number: 0 },
						{ name: "VERIFY", number: 2 },
						{ name: "NONE", number: 3 },
					],
				},
				{
					name: "MessageEncoding",
					value: [
						{ name: "MESSAGE_ENCODING_UNKNOWN", number: 0 },
						{ name: "LENGTH_PREFIXED", number: 1 },
						{ name: "DELIMITED", number: 2 },
					],
				},
				{
					name: "JsonFormat",
					value: [
						{ name: "JSON_FORMAT_UNKNOWN", number: 0 },
						{ name: "ALLOW", number: 1 },
						{ name: "LEGACY_BEST_EFFORT", number: 2 },
					],
				},
				{
					name: "EnforceNamingStyle",
					value: [
						{ name: "ENFORCE_NAMING_STYLE_UNKNOWN", number: 0 },
						{ name: "STYLE2024", number: 1 },
						{ name: "STYLE_LEGACY", number: 2 },
					],
				},
			],
			extensionRange: [
				{ start: 1000, end: 9995 },
				{ start: 9995, end: 10000 },
				{ start: 10000, end: 10001 },
			],
		},
		{
			name: "FeatureSetDefaults",
			field: [
				{ name: "defaults", number: 1, type: 11, label: 3, typeName: ".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault" },
				{ name: "minimum_edition", number: 4, type: 14, label: 1, typeName: ".google.protobuf.Edition" },
				{ name: "maximum_edition", number: 5, type: 14, label: 1, typeName: ".google.protobuf.Edition" },
			],
			nestedType: [
				{
					name: "FeatureSetEditionDefault",
					field: [
						{ name: "edition", number: 3, type: 14, label: 1, typeName: ".google.protobuf.Edition" },
						{ name: "overridable_features", number: 4, type: 11, label: 1, typeName: ".google.protobuf.FeatureSet" },
						{ name: "fixed_features", number: 5, type: 11, label: 1, typeName: ".google.protobuf.FeatureSet" },
					],
				},
			],
		},
		{
			name: "SourceCodeInfo",
			field: [{ name: "location", number: 1, type: 11, label: 3, typeName: ".google.protobuf.SourceCodeInfo.Location" }],
			nestedType: [
				{
					name: "Location",
					field: [
						{ name: "path", number: 1, type: 5, label: 3, options: { packed: true } },
						{ name: "span", number: 2, type: 5, label: 3, options: { packed: true } },
						{ name: "leading_comments", number: 3, type: 9, label: 1 },
						{ name: "trailing_comments", number: 4, type: 9, label: 1 },
						{ name: "leading_detached_comments", number: 6, type: 9, label: 3 },
					],
				},
			],
			extensionRange: [{ start: 536000000, end: 536000001 }],
		},
		{
			name: "GeneratedCodeInfo",
			field: [{ name: "annotation", number: 1, type: 11, label: 3, typeName: ".google.protobuf.GeneratedCodeInfo.Annotation" }],
			nestedType: [
				{
					name: "Annotation",
					field: [
						{ name: "path", number: 1, type: 5, label: 3, options: { packed: true } },
						{ name: "source_file", number: 2, type: 9, label: 1 },
						{ name: "begin", number: 3, type: 5, label: 1 },
						{ name: "end", number: 4, type: 5, label: 1 },
						{ name: "semantic", number: 5, type: 14, label: 1, typeName: ".google.protobuf.GeneratedCodeInfo.Annotation.Semantic" },
					],
					enumType: [
						{
							name: "Semantic",
							value: [
								{ name: "NONE", number: 0 },
								{ name: "SET", number: 1 },
								{ name: "ALIAS", number: 2 },
							],
						},
					],
				},
			],
		},
	],
	enumType: [
		{
			name: "Edition",
			value: [
				{ name: "EDITION_UNKNOWN", number: 0 },
				{ name: "EDITION_LEGACY", number: 900 },
				{ name: "EDITION_PROTO2", number: 998 },
				{ name: "EDITION_PROTO3", number: 999 },
				{ name: "EDITION_2023", number: 1000 },
				{ name: "EDITION_2024", number: 1001 },
				{ name: "EDITION_UNSTABLE", number: 9999 },
				{ name: "EDITION_1_TEST_ONLY", number: 1 },
				{ name: "EDITION_2_TEST_ONLY", number: 2 },
				{ name: "EDITION_99997_TEST_ONLY", number: 99997 },
				{ name: "EDITION_99998_TEST_ONLY", number: 99998 },
				{ name: "EDITION_99999_TEST_ONLY", number: 99999 },
				{ name: "EDITION_MAX", number: 2147483647 },
			],
		},
		{
			name: "SymbolVisibility",
			value: [
				{ name: "VISIBILITY_UNSET", number: 0 },
				{ name: "VISIBILITY_LOCAL", number: 1 },
				{ name: "VISIBILITY_EXPORT", number: 2 },
			],
		},
	],
});
/**
 * Describes the message google.protobuf.FileDescriptorProto.
 * Use `create(FileDescriptorProtoSchema)` to create a new message.
 */
const FileDescriptorProtoSchema = /*@__PURE__*/ messageDesc(file_google_protobuf_descriptor, 1);
/**
 * The verification state of the extension range.
 *
 * @generated from enum google.protobuf.ExtensionRangeOptions.VerificationState
 */
var ExtensionRangeOptions_VerificationState;
(function (ExtensionRangeOptions_VerificationState) {
	/**
	 * All the extensions of the range must be declared.
	 *
	 * @generated from enum value: DECLARATION = 0;
	 */
	ExtensionRangeOptions_VerificationState[(ExtensionRangeOptions_VerificationState["DECLARATION"] = 0)] = "DECLARATION";
	/**
	 * @generated from enum value: UNVERIFIED = 1;
	 */
	ExtensionRangeOptions_VerificationState[(ExtensionRangeOptions_VerificationState["UNVERIFIED"] = 1)] = "UNVERIFIED";
})(ExtensionRangeOptions_VerificationState || (ExtensionRangeOptions_VerificationState = {}));
/**
 * @generated from enum google.protobuf.FieldDescriptorProto.Type
 */
var FieldDescriptorProto_Type;
(function (FieldDescriptorProto_Type) {
	/**
	 * 0 is reserved for errors.
	 * Order is weird for historical reasons.
	 *
	 * @generated from enum value: TYPE_DOUBLE = 1;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["DOUBLE"] = 1)] = "DOUBLE";
	/**
	 * @generated from enum value: TYPE_FLOAT = 2;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["FLOAT"] = 2)] = "FLOAT";
	/**
	 * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
	 * negative values are likely.
	 *
	 * @generated from enum value: TYPE_INT64 = 3;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["INT64"] = 3)] = "INT64";
	/**
	 * @generated from enum value: TYPE_UINT64 = 4;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["UINT64"] = 4)] = "UINT64";
	/**
	 * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
	 * negative values are likely.
	 *
	 * @generated from enum value: TYPE_INT32 = 5;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["INT32"] = 5)] = "INT32";
	/**
	 * @generated from enum value: TYPE_FIXED64 = 6;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["FIXED64"] = 6)] = "FIXED64";
	/**
	 * @generated from enum value: TYPE_FIXED32 = 7;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["FIXED32"] = 7)] = "FIXED32";
	/**
	 * @generated from enum value: TYPE_BOOL = 8;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["BOOL"] = 8)] = "BOOL";
	/**
	 * @generated from enum value: TYPE_STRING = 9;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["STRING"] = 9)] = "STRING";
	/**
	 * Tag-delimited aggregate.
	 * Group type is deprecated and not supported after google.protobuf. However, Proto3
	 * implementations should still be able to parse the group wire format and
	 * treat group fields as unknown fields.  In Editions, the group wire format
	 * can be enabled via the `message_encoding` feature.
	 *
	 * @generated from enum value: TYPE_GROUP = 10;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["GROUP"] = 10)] = "GROUP";
	/**
	 * Length-delimited aggregate.
	 *
	 * @generated from enum value: TYPE_MESSAGE = 11;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["MESSAGE"] = 11)] = "MESSAGE";
	/**
	 * New in version 2.
	 *
	 * @generated from enum value: TYPE_BYTES = 12;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["BYTES"] = 12)] = "BYTES";
	/**
	 * @generated from enum value: TYPE_UINT32 = 13;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["UINT32"] = 13)] = "UINT32";
	/**
	 * @generated from enum value: TYPE_ENUM = 14;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["ENUM"] = 14)] = "ENUM";
	/**
	 * @generated from enum value: TYPE_SFIXED32 = 15;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["SFIXED32"] = 15)] = "SFIXED32";
	/**
	 * @generated from enum value: TYPE_SFIXED64 = 16;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["SFIXED64"] = 16)] = "SFIXED64";
	/**
	 * Uses ZigZag encoding.
	 *
	 * @generated from enum value: TYPE_SINT32 = 17;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["SINT32"] = 17)] = "SINT32";
	/**
	 * Uses ZigZag encoding.
	 *
	 * @generated from enum value: TYPE_SINT64 = 18;
	 */
	FieldDescriptorProto_Type[(FieldDescriptorProto_Type["SINT64"] = 18)] = "SINT64";
})(FieldDescriptorProto_Type || (FieldDescriptorProto_Type = {}));
/**
 * @generated from enum google.protobuf.FieldDescriptorProto.Label
 */
var FieldDescriptorProto_Label;
(function (FieldDescriptorProto_Label) {
	/**
	 * 0 is reserved for errors
	 *
	 * @generated from enum value: LABEL_OPTIONAL = 1;
	 */
	FieldDescriptorProto_Label[(FieldDescriptorProto_Label["OPTIONAL"] = 1)] = "OPTIONAL";
	/**
	 * @generated from enum value: LABEL_REPEATED = 3;
	 */
	FieldDescriptorProto_Label[(FieldDescriptorProto_Label["REPEATED"] = 3)] = "REPEATED";
	/**
	 * The required label is only allowed in google.protobuf.  In proto3 and Editions
	 * it's explicitly prohibited.  In Editions, the `field_presence` feature
	 * can be used to get this behavior.
	 *
	 * @generated from enum value: LABEL_REQUIRED = 2;
	 */
	FieldDescriptorProto_Label[(FieldDescriptorProto_Label["REQUIRED"] = 2)] = "REQUIRED";
})(FieldDescriptorProto_Label || (FieldDescriptorProto_Label = {}));
/**
 * Generated classes can be optimized for speed or code size.
 *
 * @generated from enum google.protobuf.FileOptions.OptimizeMode
 */
var FileOptions_OptimizeMode;
(function (FileOptions_OptimizeMode) {
	/**
	 * Generate complete code for parsing, serialization,
	 *
	 * @generated from enum value: SPEED = 1;
	 */
	FileOptions_OptimizeMode[(FileOptions_OptimizeMode["SPEED"] = 1)] = "SPEED";
	/**
	 * etc.
	 *
	 * Use ReflectionOps to implement these methods.
	 *
	 * @generated from enum value: CODE_SIZE = 2;
	 */
	FileOptions_OptimizeMode[(FileOptions_OptimizeMode["CODE_SIZE"] = 2)] = "CODE_SIZE";
	/**
	 * Generate code using MessageLite and the lite runtime.
	 *
	 * @generated from enum value: LITE_RUNTIME = 3;
	 */
	FileOptions_OptimizeMode[(FileOptions_OptimizeMode["LITE_RUNTIME"] = 3)] = "LITE_RUNTIME";
})(FileOptions_OptimizeMode || (FileOptions_OptimizeMode = {}));
/**
 * @generated from enum google.protobuf.FieldOptions.CType
 */
var FieldOptions_CType;
(function (FieldOptions_CType) {
	/**
	 * Default mode.
	 *
	 * @generated from enum value: STRING = 0;
	 */
	FieldOptions_CType[(FieldOptions_CType["STRING"] = 0)] = "STRING";
	/**
	 * The option [ctype=CORD] may be applied to a non-repeated field of type
	 * "bytes". It indicates that in C++, the data should be stored in a Cord
	 * instead of a string.  For very large strings, this may reduce memory
	 * fragmentation. It may also allow better performance when parsing from a
	 * Cord, or when parsing with aliasing enabled, as the parsed Cord may then
	 * alias the original buffer.
	 *
	 * @generated from enum value: CORD = 1;
	 */
	FieldOptions_CType[(FieldOptions_CType["CORD"] = 1)] = "CORD";
	/**
	 * @generated from enum value: STRING_PIECE = 2;
	 */
	FieldOptions_CType[(FieldOptions_CType["STRING_PIECE"] = 2)] = "STRING_PIECE";
})(FieldOptions_CType || (FieldOptions_CType = {}));
/**
 * @generated from enum google.protobuf.FieldOptions.JSType
 */
var FieldOptions_JSType;
(function (FieldOptions_JSType) {
	/**
	 * Use the default type.
	 *
	 * @generated from enum value: JS_NORMAL = 0;
	 */
	FieldOptions_JSType[(FieldOptions_JSType["JS_NORMAL"] = 0)] = "JS_NORMAL";
	/**
	 * Use JavaScript strings.
	 *
	 * @generated from enum value: JS_STRING = 1;
	 */
	FieldOptions_JSType[(FieldOptions_JSType["JS_STRING"] = 1)] = "JS_STRING";
	/**
	 * Use JavaScript numbers.
	 *
	 * @generated from enum value: JS_NUMBER = 2;
	 */
	FieldOptions_JSType[(FieldOptions_JSType["JS_NUMBER"] = 2)] = "JS_NUMBER";
})(FieldOptions_JSType || (FieldOptions_JSType = {}));
/**
 * If set to RETENTION_SOURCE, the option will be omitted from the binary.
 *
 * @generated from enum google.protobuf.FieldOptions.OptionRetention
 */
var FieldOptions_OptionRetention;
(function (FieldOptions_OptionRetention) {
	/**
	 * @generated from enum value: RETENTION_UNKNOWN = 0;
	 */
	FieldOptions_OptionRetention[(FieldOptions_OptionRetention["RETENTION_UNKNOWN"] = 0)] = "RETENTION_UNKNOWN";
	/**
	 * @generated from enum value: RETENTION_RUNTIME = 1;
	 */
	FieldOptions_OptionRetention[(FieldOptions_OptionRetention["RETENTION_RUNTIME"] = 1)] = "RETENTION_RUNTIME";
	/**
	 * @generated from enum value: RETENTION_SOURCE = 2;
	 */
	FieldOptions_OptionRetention[(FieldOptions_OptionRetention["RETENTION_SOURCE"] = 2)] = "RETENTION_SOURCE";
})(FieldOptions_OptionRetention || (FieldOptions_OptionRetention = {}));
/**
 * This indicates the types of entities that the field may apply to when used
 * as an option. If it is unset, then the field may be freely used as an
 * option on any kind of entity.
 *
 * @generated from enum google.protobuf.FieldOptions.OptionTargetType
 */
var FieldOptions_OptionTargetType;
(function (FieldOptions_OptionTargetType) {
	/**
	 * @generated from enum value: TARGET_TYPE_UNKNOWN = 0;
	 */
	FieldOptions_OptionTargetType[(FieldOptions_OptionTargetType["TARGET_TYPE_UNKNOWN"] = 0)] = "TARGET_TYPE_UNKNOWN";
	/**
	 * @generated from enum value: TARGET_TYPE_FILE = 1;
	 */
	FieldOptions_OptionTargetType[(FieldOptions_OptionTargetType["TARGET_TYPE_FILE"] = 1)] = "TARGET_TYPE_FILE";
	/**
	 * @generated from enum value: TARGET_TYPE_EXTENSION_RANGE = 2;
	 */
	FieldOptions_OptionTargetType[(FieldOptions_OptionTargetType["TARGET_TYPE_EXTENSION_RANGE"] = 2)] = "TARGET_TYPE_EXTENSION_RANGE";
	/**
	 * @generated from enum value: TARGET_TYPE_MESSAGE = 3;
	 */
	FieldOptions_OptionTargetType[(FieldOptions_OptionTargetType["TARGET_TYPE_MESSAGE"] = 3)] = "TARGET_TYPE_MESSAGE";
	/**
	 * @generated from enum value: TARGET_TYPE_FIELD = 4;
	 */
	FieldOptions_OptionTargetType[(FieldOptions_OptionTargetType["TARGET_TYPE_FIELD"] = 4)] = "TARGET_TYPE_FIELD";
	/**
	 * @generated from enum value: TARGET_TYPE_ONEOF = 5;
	 */
	FieldOptions_OptionTargetType[(FieldOptions_OptionTargetType["TARGET_TYPE_ONEOF"] = 5)] = "TARGET_TYPE_ONEOF";
	/**
	 * @generated from enum value: TARGET_TYPE_ENUM = 6;
	 */
	FieldOptions_OptionTargetType[(FieldOptions_OptionTargetType["TARGET_TYPE_ENUM"] = 6)] = "TARGET_TYPE_ENUM";
	/**
	 * @generated from enum value: TARGET_TYPE_ENUM_ENTRY = 7;
	 */
	FieldOptions_OptionTargetType[(FieldOptions_OptionTargetType["TARGET_TYPE_ENUM_ENTRY"] = 7)] = "TARGET_TYPE_ENUM_ENTRY";
	/**
	 * @generated from enum value: TARGET_TYPE_SERVICE = 8;
	 */
	FieldOptions_OptionTargetType[(FieldOptions_OptionTargetType["TARGET_TYPE_SERVICE"] = 8)] = "TARGET_TYPE_SERVICE";
	/**
	 * @generated from enum value: TARGET_TYPE_METHOD = 9;
	 */
	FieldOptions_OptionTargetType[(FieldOptions_OptionTargetType["TARGET_TYPE_METHOD"] = 9)] = "TARGET_TYPE_METHOD";
})(FieldOptions_OptionTargetType || (FieldOptions_OptionTargetType = {}));
/**
 * Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
 * or neither? HTTP based RPC implementation may choose GET verb for safe
 * methods, and PUT verb for idempotent methods instead of the default POST.
 *
 * @generated from enum google.protobuf.MethodOptions.IdempotencyLevel
 */
var MethodOptions_IdempotencyLevel;
(function (MethodOptions_IdempotencyLevel) {
	/**
	 * @generated from enum value: IDEMPOTENCY_UNKNOWN = 0;
	 */
	MethodOptions_IdempotencyLevel[(MethodOptions_IdempotencyLevel["IDEMPOTENCY_UNKNOWN"] = 0)] = "IDEMPOTENCY_UNKNOWN";
	/**
	 * implies idempotent
	 *
	 * @generated from enum value: NO_SIDE_EFFECTS = 1;
	 */
	MethodOptions_IdempotencyLevel[(MethodOptions_IdempotencyLevel["NO_SIDE_EFFECTS"] = 1)] = "NO_SIDE_EFFECTS";
	/**
	 * idempotent, but may have side effects
	 *
	 * @generated from enum value: IDEMPOTENT = 2;
	 */
	MethodOptions_IdempotencyLevel[(MethodOptions_IdempotencyLevel["IDEMPOTENT"] = 2)] = "IDEMPOTENT";
})(MethodOptions_IdempotencyLevel || (MethodOptions_IdempotencyLevel = {}));
/**
 * @generated from enum google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility
 */
var FeatureSet_VisibilityFeature_DefaultSymbolVisibility;
(function (FeatureSet_VisibilityFeature_DefaultSymbolVisibility) {
	/**
	 * @generated from enum value: DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0;
	 */
	FeatureSet_VisibilityFeature_DefaultSymbolVisibility[(FeatureSet_VisibilityFeature_DefaultSymbolVisibility["DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0)] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN";
	/**
	 * Default pre-EDITION_2024, all UNSET visibility are export.
	 *
	 * @generated from enum value: EXPORT_ALL = 1;
	 */
	FeatureSet_VisibilityFeature_DefaultSymbolVisibility[(FeatureSet_VisibilityFeature_DefaultSymbolVisibility["EXPORT_ALL"] = 1)] = "EXPORT_ALL";
	/**
	 * All top-level symbols default to export, nested default to local.
	 *
	 * @generated from enum value: EXPORT_TOP_LEVEL = 2;
	 */
	FeatureSet_VisibilityFeature_DefaultSymbolVisibility[(FeatureSet_VisibilityFeature_DefaultSymbolVisibility["EXPORT_TOP_LEVEL"] = 2)] = "EXPORT_TOP_LEVEL";
	/**
	 * All symbols default to local.
	 *
	 * @generated from enum value: LOCAL_ALL = 3;
	 */
	FeatureSet_VisibilityFeature_DefaultSymbolVisibility[(FeatureSet_VisibilityFeature_DefaultSymbolVisibility["LOCAL_ALL"] = 3)] = "LOCAL_ALL";
	/**
	 * All symbols local by default. Nested types cannot be exported.
	 * With special case caveat for message { enum {} reserved 1 to max; }
	 * This is the recommended setting for new protos.
	 *
	 * @generated from enum value: STRICT = 4;
	 */
	FeatureSet_VisibilityFeature_DefaultSymbolVisibility[(FeatureSet_VisibilityFeature_DefaultSymbolVisibility["STRICT"] = 4)] = "STRICT";
})(FeatureSet_VisibilityFeature_DefaultSymbolVisibility || (FeatureSet_VisibilityFeature_DefaultSymbolVisibility = {}));
/**
 * @generated from enum google.protobuf.FeatureSet.FieldPresence
 */
var FeatureSet_FieldPresence;
(function (FeatureSet_FieldPresence) {
	/**
	 * @generated from enum value: FIELD_PRESENCE_UNKNOWN = 0;
	 */
	FeatureSet_FieldPresence[(FeatureSet_FieldPresence["FIELD_PRESENCE_UNKNOWN"] = 0)] = "FIELD_PRESENCE_UNKNOWN";
	/**
	 * @generated from enum value: EXPLICIT = 1;
	 */
	FeatureSet_FieldPresence[(FeatureSet_FieldPresence["EXPLICIT"] = 1)] = "EXPLICIT";
	/**
	 * @generated from enum value: IMPLICIT = 2;
	 */
	FeatureSet_FieldPresence[(FeatureSet_FieldPresence["IMPLICIT"] = 2)] = "IMPLICIT";
	/**
	 * @generated from enum value: LEGACY_REQUIRED = 3;
	 */
	FeatureSet_FieldPresence[(FeatureSet_FieldPresence["LEGACY_REQUIRED"] = 3)] = "LEGACY_REQUIRED";
})(FeatureSet_FieldPresence || (FeatureSet_FieldPresence = {}));
/**
 * @generated from enum google.protobuf.FeatureSet.EnumType
 */
var FeatureSet_EnumType;
(function (FeatureSet_EnumType) {
	/**
	 * @generated from enum value: ENUM_TYPE_UNKNOWN = 0;
	 */
	FeatureSet_EnumType[(FeatureSet_EnumType["ENUM_TYPE_UNKNOWN"] = 0)] = "ENUM_TYPE_UNKNOWN";
	/**
	 * @generated from enum value: OPEN = 1;
	 */
	FeatureSet_EnumType[(FeatureSet_EnumType["OPEN"] = 1)] = "OPEN";
	/**
	 * @generated from enum value: CLOSED = 2;
	 */
	FeatureSet_EnumType[(FeatureSet_EnumType["CLOSED"] = 2)] = "CLOSED";
})(FeatureSet_EnumType || (FeatureSet_EnumType = {}));
/**
 * @generated from enum google.protobuf.FeatureSet.RepeatedFieldEncoding
 */
var FeatureSet_RepeatedFieldEncoding;
(function (FeatureSet_RepeatedFieldEncoding) {
	/**
	 * @generated from enum value: REPEATED_FIELD_ENCODING_UNKNOWN = 0;
	 */
	FeatureSet_RepeatedFieldEncoding[(FeatureSet_RepeatedFieldEncoding["REPEATED_FIELD_ENCODING_UNKNOWN"] = 0)] = "REPEATED_FIELD_ENCODING_UNKNOWN";
	/**
	 * @generated from enum value: PACKED = 1;
	 */
	FeatureSet_RepeatedFieldEncoding[(FeatureSet_RepeatedFieldEncoding["PACKED"] = 1)] = "PACKED";
	/**
	 * @generated from enum value: EXPANDED = 2;
	 */
	FeatureSet_RepeatedFieldEncoding[(FeatureSet_RepeatedFieldEncoding["EXPANDED"] = 2)] = "EXPANDED";
})(FeatureSet_RepeatedFieldEncoding || (FeatureSet_RepeatedFieldEncoding = {}));
/**
 * @generated from enum google.protobuf.FeatureSet.Utf8Validation
 */
var FeatureSet_Utf8Validation;
(function (FeatureSet_Utf8Validation) {
	/**
	 * @generated from enum value: UTF8_VALIDATION_UNKNOWN = 0;
	 */
	FeatureSet_Utf8Validation[(FeatureSet_Utf8Validation["UTF8_VALIDATION_UNKNOWN"] = 0)] = "UTF8_VALIDATION_UNKNOWN";
	/**
	 * @generated from enum value: VERIFY = 2;
	 */
	FeatureSet_Utf8Validation[(FeatureSet_Utf8Validation["VERIFY"] = 2)] = "VERIFY";
	/**
	 * @generated from enum value: NONE = 3;
	 */
	FeatureSet_Utf8Validation[(FeatureSet_Utf8Validation["NONE"] = 3)] = "NONE";
})(FeatureSet_Utf8Validation || (FeatureSet_Utf8Validation = {}));
/**
 * @generated from enum google.protobuf.FeatureSet.MessageEncoding
 */
var FeatureSet_MessageEncoding;
(function (FeatureSet_MessageEncoding) {
	/**
	 * @generated from enum value: MESSAGE_ENCODING_UNKNOWN = 0;
	 */
	FeatureSet_MessageEncoding[(FeatureSet_MessageEncoding["MESSAGE_ENCODING_UNKNOWN"] = 0)] = "MESSAGE_ENCODING_UNKNOWN";
	/**
	 * @generated from enum value: LENGTH_PREFIXED = 1;
	 */
	FeatureSet_MessageEncoding[(FeatureSet_MessageEncoding["LENGTH_PREFIXED"] = 1)] = "LENGTH_PREFIXED";
	/**
	 * @generated from enum value: DELIMITED = 2;
	 */
	FeatureSet_MessageEncoding[(FeatureSet_MessageEncoding["DELIMITED"] = 2)] = "DELIMITED";
})(FeatureSet_MessageEncoding || (FeatureSet_MessageEncoding = {}));
/**
 * @generated from enum google.protobuf.FeatureSet.JsonFormat
 */
var FeatureSet_JsonFormat;
(function (FeatureSet_JsonFormat) {
	/**
	 * @generated from enum value: JSON_FORMAT_UNKNOWN = 0;
	 */
	FeatureSet_JsonFormat[(FeatureSet_JsonFormat["JSON_FORMAT_UNKNOWN"] = 0)] = "JSON_FORMAT_UNKNOWN";
	/**
	 * @generated from enum value: ALLOW = 1;
	 */
	FeatureSet_JsonFormat[(FeatureSet_JsonFormat["ALLOW"] = 1)] = "ALLOW";
	/**
	 * @generated from enum value: LEGACY_BEST_EFFORT = 2;
	 */
	FeatureSet_JsonFormat[(FeatureSet_JsonFormat["LEGACY_BEST_EFFORT"] = 2)] = "LEGACY_BEST_EFFORT";
})(FeatureSet_JsonFormat || (FeatureSet_JsonFormat = {}));
/**
 * @generated from enum google.protobuf.FeatureSet.EnforceNamingStyle
 */
var FeatureSet_EnforceNamingStyle;
(function (FeatureSet_EnforceNamingStyle) {
	/**
	 * @generated from enum value: ENFORCE_NAMING_STYLE_UNKNOWN = 0;
	 */
	FeatureSet_EnforceNamingStyle[(FeatureSet_EnforceNamingStyle["ENFORCE_NAMING_STYLE_UNKNOWN"] = 0)] = "ENFORCE_NAMING_STYLE_UNKNOWN";
	/**
	 * @generated from enum value: STYLE2024 = 1;
	 */
	FeatureSet_EnforceNamingStyle[(FeatureSet_EnforceNamingStyle["STYLE2024"] = 1)] = "STYLE2024";
	/**
	 * @generated from enum value: STYLE_LEGACY = 2;
	 */
	FeatureSet_EnforceNamingStyle[(FeatureSet_EnforceNamingStyle["STYLE_LEGACY"] = 2)] = "STYLE_LEGACY";
})(FeatureSet_EnforceNamingStyle || (FeatureSet_EnforceNamingStyle = {}));
/**
 * Represents the identified object's effect on the element in the original
 * .proto file.
 *
 * @generated from enum google.protobuf.GeneratedCodeInfo.Annotation.Semantic
 */
var GeneratedCodeInfo_Annotation_Semantic;
(function (GeneratedCodeInfo_Annotation_Semantic) {
	/**
	 * There is no effect or the effect is indescribable.
	 *
	 * @generated from enum value: NONE = 0;
	 */
	GeneratedCodeInfo_Annotation_Semantic[(GeneratedCodeInfo_Annotation_Semantic["NONE"] = 0)] = "NONE";
	/**
	 * The element is set or otherwise mutated.
	 *
	 * @generated from enum value: SET = 1;
	 */
	GeneratedCodeInfo_Annotation_Semantic[(GeneratedCodeInfo_Annotation_Semantic["SET"] = 1)] = "SET";
	/**
	 * An alias to the element is returned.
	 *
	 * @generated from enum value: ALIAS = 2;
	 */
	GeneratedCodeInfo_Annotation_Semantic[(GeneratedCodeInfo_Annotation_Semantic["ALIAS"] = 2)] = "ALIAS";
})(GeneratedCodeInfo_Annotation_Semantic || (GeneratedCodeInfo_Annotation_Semantic = {}));
/**
 * The full set of known editions.
 *
 * @generated from enum google.protobuf.Edition
 */
var Edition;
(function (Edition) {
	/**
	 * A placeholder for an unknown edition value.
	 *
	 * @generated from enum value: EDITION_UNKNOWN = 0;
	 */
	Edition[(Edition["EDITION_UNKNOWN"] = 0)] = "EDITION_UNKNOWN";
	/**
	 * A placeholder edition for specifying default behaviors *before* a feature
	 * was first introduced.  This is effectively an "infinite past".
	 *
	 * @generated from enum value: EDITION_LEGACY = 900;
	 */
	Edition[(Edition["EDITION_LEGACY"] = 900)] = "EDITION_LEGACY";
	/**
	 * Legacy syntax "editions".  These pre-date editions, but behave much like
	 * distinct editions.  These can't be used to specify the edition of proto
	 * files, but feature definitions must supply proto2/proto3 defaults for
	 * backwards compatibility.
	 *
	 * @generated from enum value: EDITION_PROTO2 = 998;
	 */
	Edition[(Edition["EDITION_PROTO2"] = 998)] = "EDITION_PROTO2";
	/**
	 * @generated from enum value: EDITION_PROTO3 = 999;
	 */
	Edition[(Edition["EDITION_PROTO3"] = 999)] = "EDITION_PROTO3";
	/**
	 * Editions that have been released.  The specific values are arbitrary and
	 * should not be depended on, but they will always be time-ordered for easy
	 * comparison.
	 *
	 * @generated from enum value: EDITION_2023 = 1000;
	 */
	Edition[(Edition["EDITION_2023"] = 1000)] = "EDITION_2023";
	/**
	 * @generated from enum value: EDITION_2024 = 1001;
	 */
	Edition[(Edition["EDITION_2024"] = 1001)] = "EDITION_2024";
	/**
	 * A placeholder edition for developing and testing unscheduled features.
	 *
	 * @generated from enum value: EDITION_UNSTABLE = 9999;
	 */
	Edition[(Edition["EDITION_UNSTABLE"] = 9999)] = "EDITION_UNSTABLE";
	/**
	 * Placeholder editions for testing feature resolution.  These should not be
	 * used or relied on outside of tests.
	 *
	 * @generated from enum value: EDITION_1_TEST_ONLY = 1;
	 */
	Edition[(Edition["EDITION_1_TEST_ONLY"] = 1)] = "EDITION_1_TEST_ONLY";
	/**
	 * @generated from enum value: EDITION_2_TEST_ONLY = 2;
	 */
	Edition[(Edition["EDITION_2_TEST_ONLY"] = 2)] = "EDITION_2_TEST_ONLY";
	/**
	 * @generated from enum value: EDITION_99997_TEST_ONLY = 99997;
	 */
	Edition[(Edition["EDITION_99997_TEST_ONLY"] = 99997)] = "EDITION_99997_TEST_ONLY";
	/**
	 * @generated from enum value: EDITION_99998_TEST_ONLY = 99998;
	 */
	Edition[(Edition["EDITION_99998_TEST_ONLY"] = 99998)] = "EDITION_99998_TEST_ONLY";
	/**
	 * @generated from enum value: EDITION_99999_TEST_ONLY = 99999;
	 */
	Edition[(Edition["EDITION_99999_TEST_ONLY"] = 99999)] = "EDITION_99999_TEST_ONLY";
	/**
	 * Placeholder for specifying unbounded edition support.  This should only
	 * ever be used by plugins that can expect to never require any changes to
	 * support a new edition.
	 *
	 * @generated from enum value: EDITION_MAX = 2147483647;
	 */
	Edition[(Edition["EDITION_MAX"] = 2147483647)] = "EDITION_MAX";
})(Edition || (Edition = {}));
/**
 * Describes the 'visibility' of a symbol with respect to the proto import
 * system. Symbols can only be imported when the visibility rules do not prevent
 * it (ex: local symbols cannot be imported).  Visibility modifiers can only set
 * on `message` and `enum` as they are the only types available to be referenced
 * from other files.
 *
 * @generated from enum google.protobuf.SymbolVisibility
 */
var SymbolVisibility;
(function (SymbolVisibility) {
	/**
	 * @generated from enum value: VISIBILITY_UNSET = 0;
	 */
	SymbolVisibility[(SymbolVisibility["VISIBILITY_UNSET"] = 0)] = "VISIBILITY_UNSET";
	/**
	 * @generated from enum value: VISIBILITY_LOCAL = 1;
	 */
	SymbolVisibility[(SymbolVisibility["VISIBILITY_LOCAL"] = 1)] = "VISIBILITY_LOCAL";
	/**
	 * @generated from enum value: VISIBILITY_EXPORT = 2;
	 */
	SymbolVisibility[(SymbolVisibility["VISIBILITY_EXPORT"] = 2)] = "VISIBILITY_EXPORT";
})(SymbolVisibility || (SymbolVisibility = {}));

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * @private Only exported for getExtension()
 */
function makeReadContext(options) {
	return Object.assign(Object.assign({ readUnknownFields: true, recursionLimit: 100 }, options), { depth: 0 });
}
/**
 * Parse serialized binary data.
 */
function fromBinary(schema, bytes, options) {
	const msg = reflect(schema, undefined, false);
	readMessage(msg, new BinaryReader(bytes), makeReadContext(options), false, bytes.byteLength);
	return msg.message;
}
/**
 * If `delimited` is false, read the length given in `lengthOrDelimitedFieldNo`.
 *
 * If `delimited` is true, read until an EndGroup tag. `lengthOrDelimitedFieldNo`
 * is the expected field number.
 *
 * @private
 */
function readMessage(message, reader, ctx, delimited, lengthOrDelimitedFieldNo) {
	var _a;
	if (++ctx.depth > ctx.recursionLimit) {
		throw new Error(`cannot decode ${message.desc} from binary: maximum recursion depth of ${ctx.recursionLimit} reached`);
	}
	const end = delimited ? reader.len : reader.pos + lengthOrDelimitedFieldNo;
	let fieldNo;
	let wireType;
	const unknownFields = (_a = message.getUnknown()) !== null && _a !== void 0 ? _a : [];
	while (reader.pos < end) {
		[fieldNo, wireType] = reader.tag();
		if (delimited && wireType == WireType.EndGroup) {
			break;
		}
		const field = message.findNumber(fieldNo);
		if (!field) {
			// Use remaining recursion budget for skipping nested groups
			const recursionLimit = ctx.recursionLimit - ctx.depth;
			const data = reader.skip(wireType, fieldNo, recursionLimit);
			if (ctx.readUnknownFields) {
				unknownFields.push({ no: fieldNo, wireType, data });
			}
			continue;
		}
		readField(message, reader, field, wireType, ctx);
	}
	if (delimited) {
		if (wireType != WireType.EndGroup || fieldNo !== lengthOrDelimitedFieldNo) {
			throw new Error("invalid end group tag");
		}
	}
	if (unknownFields.length > 0) {
		message.setUnknown(unknownFields);
	}
	ctx.depth--;
}
/**
 * @private Only exported for getExtension()
 */
function readField(message, reader, field, wireType, ctx) {
	var _a;
	switch (field.fieldKind) {
		case "scalar":
			message.set(field, readScalar(reader, field.scalar, field.utf8Validation));
			break;
		case "enum":
			const val = readScalar(reader, ScalarType.INT32);
			if (field.enum.open) {
				message.set(field, val);
			} else {
				const ok = field.enum.values.some((v) => v.number === val);
				if (ok) {
					message.set(field, val);
				} else if (ctx.readUnknownFields) {
					const bytes = [];
					varint32write(val, bytes);
					const unknownFields = (_a = message.getUnknown()) !== null && _a !== void 0 ? _a : [];
					unknownFields.push({
						no: field.number,
						wireType,
						data: new Uint8Array(bytes),
					});
					message.setUnknown(unknownFields);
				}
			}
			break;
		case "message":
			message.set(field, readMessageField(reader, ctx, field, message.get(field)));
			break;
		case "list":
			readListField(reader, wireType, message.get(field), ctx);
			break;
		case "map":
			readMapEntry(reader, message.get(field), ctx);
			break;
	}
}
// Read a map field, expecting key field = 1, value field = 2
function readMapEntry(reader, map, ctx) {
	const field = map.field();
	let key;
	let val;
	// Read the length of the map entry, which is a varint.
	const len = reader.uint32();
	// WARNING: Calculate end AFTER advancing reader.pos (above), so that
	//          reader.pos is at the start of the map entry.
	const end = reader.pos + len;
	while (reader.pos < end) {
		const [fieldNo] = reader.tag();
		switch (fieldNo) {
			case 1:
				key = readScalar(reader, field.mapKey, field.utf8Validation);
				break;
			case 2:
				switch (field.mapKind) {
					case "scalar":
						val = readScalar(reader, field.scalar, field.utf8Validation);
						break;
					case "enum":
						val = reader.int32();
						break;
					case "message":
						val = readMessageField(reader, ctx, field);
						break;
				}
				break;
		}
	}
	if (key === undefined) {
		key = scalarZeroValue(field.mapKey, false);
	}
	if (val === undefined) {
		switch (field.mapKind) {
			case "scalar":
				val = scalarZeroValue(field.scalar, false);
				break;
			case "enum":
				val = field.enum.values[0].number;
				break;
			case "message":
				val = reflect(field.message, undefined, false);
				break;
		}
	}
	map.set(key, val);
}
function readListField(reader, wireType, list, ctx) {
	var _a;
	const field = list.field();
	if (field.listKind === "message") {
		list.add(readMessageField(reader, ctx, field));
		return;
	}
	const scalarType = (_a = field.scalar) !== null && _a !== void 0 ? _a : ScalarType.INT32;
	const packed = wireType == WireType.LengthDelimited && scalarType != ScalarType.STRING && scalarType != ScalarType.BYTES;
	if (!packed) {
		list.add(readScalar(reader, scalarType, field.utf8Validation));
		return;
	}
	const e = reader.uint32() + reader.pos;
	while (reader.pos < e) {
		list.add(readScalar(reader, scalarType, field.utf8Validation));
	}
}
function readMessageField(reader, ctx, field, mergeMessage) {
	const delimited = field.delimitedEncoding;
	const message = mergeMessage !== null && mergeMessage !== void 0 ? mergeMessage : reflect(field.message, undefined, false);
	readMessage(message, reader, ctx, delimited, delimited ? field.number : reader.uint32());
	return message;
}
function readScalar(reader, type, validateUtf8 = false) {
	switch (type) {
		case ScalarType.STRING:
			return reader.string(validateUtf8);
		case ScalarType.BOOL:
			return reader.bool();
		case ScalarType.DOUBLE:
			return reader.double();
		case ScalarType.FLOAT:
			return reader.float();
		case ScalarType.INT32:
			return reader.int32();
		case ScalarType.INT64:
			return reader.int64();
		case ScalarType.UINT64:
			return reader.uint64();
		case ScalarType.FIXED64:
			return reader.fixed64();
		case ScalarType.BYTES:
			return reader.bytes();
		case ScalarType.FIXED32:
			return reader.fixed32();
		case ScalarType.SFIXED32:
			return reader.sfixed32();
		case ScalarType.SFIXED64:
			return reader.sfixed64();
		case ScalarType.SINT64:
			return reader.sint64();
		case ScalarType.UINT32:
			return reader.uint32();
		case ScalarType.SINT32:
			return reader.sint32();
	}
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Hydrate a file descriptor.
 *
 * @private
 */
function fileDesc(b64, imports) {
	var _a;
	const root = fromBinary(FileDescriptorProtoSchema, base64Decode(b64));
	root.messageType.forEach(restoreJsonNames);
	root.dependency = (_a = imports === null || imports === void 0 ? void 0 : imports.map((f) => f.proto.name)) !== null && _a !== void 0 ? _a : [];
	const reg = createFileRegistry(root, (protoFileName) => (imports === null || imports === void 0 ? void 0 : imports.find((f) => f.proto.name === protoFileName)));
	// biome-ignore lint/style/noNonNullAssertion: non-null assertion because we just created the registry from the file we look up
	return reg.getFile(root.name);
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Describes the file google/protobuf/timestamp.proto.
 */
const file_google_protobuf_timestamp = /*@__PURE__*/ fileDesc(
	"Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJvdG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MYAiABKAVChQEKE2NvbS5nb29nbGUucHJvdG9idWZCDlRpbWVzdGFtcFByb3RvUAFaMmdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL3RpbWVzdGFtcHBi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM",
);

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
function anyIs(any, descOrTypeName) {
	if (any.typeUrl === "") {
		return false;
	}
	const want = typeof descOrTypeName == "string" ? descOrTypeName : descOrTypeName.typeName;
	const got = typeUrlToName(any.typeUrl);
	return want === got;
}
function anyUnpack(any, registryOrMessageDesc) {
	if (any.typeUrl === "") {
		return undefined;
	}
	const desc = registryOrMessageDesc.kind == "message" ? registryOrMessageDesc : registryOrMessageDesc.getMessage(typeUrlToName(any.typeUrl));
	if (!desc || !anyIs(any, desc)) {
		return undefined;
	}
	return fromBinary(desc, any.value);
}
function typeUrlToName(url) {
	const slash = url.lastIndexOf("/");
	const name = slash >= 0 ? url.substring(slash + 1) : url;
	if (!name.length) {
		throw new Error(`invalid type url: ${url}`);
	}
	return name;
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Describes the file google/protobuf/struct.proto.
 */
const file_google_protobuf_struct = /*@__PURE__*/ fileDesc(
	"Chxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvEg9nb29nbGUucHJvdG9idWYihAEKBlN0cnVjdBIzCgZmaWVsZHMYASADKAsyIy5nb29nbGUucHJvdG9idWYuU3RydWN0LkZpZWxkc0VudHJ5GkUKC0ZpZWxkc0VudHJ5EgsKA2tleRgBIAEoCRIlCgV2YWx1ZRgCIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZToCOAEi6gEKBVZhbHVlEjAKCm51bGxfdmFsdWUYASABKA4yGi5nb29nbGUucHJvdG9idWYuTnVsbFZhbHVlSAASFgoMbnVtYmVyX3ZhbHVlGAIgASgBSAASFgoMc3RyaW5nX3ZhbHVlGAMgASgJSAASFAoKYm9vbF92YWx1ZRgEIAEoCEgAEi8KDHN0cnVjdF92YWx1ZRgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RIABIwCgpsaXN0X3ZhbHVlGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RWYWx1ZUgAQgYKBGtpbmQiMwoJTGlzdFZhbHVlEiYKBnZhbHVlcxgBIAMoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSobCglOdWxsVmFsdWUSDgoKTlVMTF9WQUxVRRAAQn8KE2NvbS5nb29nbGUucHJvdG9idWZCC1N0cnVjdFByb3RvUAFaL2dvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL3N0cnVjdHBi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM",
);
/**
 * `NullValue` is a singleton enumeration to represent the null value for the
 * `Value` type union.
 *
 * The JSON representation for `NullValue` is JSON `null`.
 *
 * @generated from enum google.protobuf.NullValue
 */
var NullValue;
(function (NullValue) {
	/**
	 * Null value.
	 *
	 * @generated from enum value: NULL_VALUE = 0;
	 */
	NullValue[(NullValue["NULL_VALUE"] = 0)] = "NULL_VALUE";
})(NullValue || (NullValue = {}));

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Compare two messages of the same type for equality.
 *
 * Fields are compared one by one, but only when set: a field set in one message
 * but not the other makes them unequal, while fields set in both are compared
 * by value. Extensions and unknown fields are disregarded by default.
 *
 * Float and double values are compared with IEEE semantics: NaN does not equal
 * NaN, and -0 equals 0 (with the exception for singular fields with implicit
 * presence: -0 is set, +0 is unset).
 */
function equals$1(schema, a, b, options) {
	if (a.$typeName != schema.typeName || b.$typeName != schema.typeName) {
		return false;
	}
	if (a === b) {
		return true;
	}
	return reflectEquals(reflect(schema, a), reflect(schema, b), options);
}
function reflectEquals(a, b, opts) {
	if (a.desc.typeName === "google.protobuf.Any" && void 0 == true) {
		return anyUnpackedEquals(a.message, b.message, opts);
	}
	for (const f of a.fields) {
		if (!fieldEquals(f, a, b, opts)) {
			return false;
		}
	}
	return true;
}
// TODO(tstamm) add an option to consider NaN equal to NaN?
function fieldEquals(f, a, b, opts) {
	if (!a.isSet(f) && !b.isSet(f)) {
		return true;
	}
	if (!a.isSet(f) || !b.isSet(f)) {
		return false;
	}
	switch (f.fieldKind) {
		case "scalar":
			return scalarEquals(f.scalar, a.get(f), b.get(f));
		case "enum":
			return a.get(f) === b.get(f);
		case "message":
			return reflectEquals(a.get(f), b.get(f), opts);
		case "map": {
			// TODO(tstamm) can't we compare sizes first?
			const mapA = a.get(f);
			const mapB = b.get(f);
			const keys = [];
			for (const k of mapA.keys()) {
				if (!mapB.has(k)) {
					return false;
				}
				keys.push(k);
			}
			for (const k of mapB.keys()) {
				if (!mapA.has(k)) {
					return false;
				}
			}
			for (const key of keys) {
				const va = mapA.get(key);
				const vb = mapB.get(key);
				if (va === vb) {
					continue;
				}
				switch (f.mapKind) {
					case "enum":
						return false;
					case "message":
						if (!reflectEquals(va, vb, opts)) {
							return false;
						}
						break;
					case "scalar":
						if (!scalarEquals(f.scalar, va, vb)) {
							return false;
						}
						break;
				}
			}
			break;
		}
		case "list": {
			const listA = a.get(f);
			const listB = b.get(f);
			if (listA.size != listB.size) {
				return false;
			}
			for (let i = 0; i < listA.size; i++) {
				const va = listA.get(i);
				const vb = listB.get(i);
				if (va === vb) {
					continue;
				}
				switch (f.listKind) {
					case "enum":
						return false;
					case "message":
						if (!reflectEquals(va, vb, opts)) {
							return false;
						}
						break;
					case "scalar":
						if (!scalarEquals(f.scalar, va, vb)) {
							return false;
						}
						break;
				}
			}
			break;
		}
	}
	return true;
}
function anyUnpackedEquals(a, b, opts) {
	if (a.typeUrl !== b.typeUrl) {
		return false;
	}
	const unpackedA = anyUnpack(a, opts.registry);
	const unpackedB = anyUnpack(b, opts.registry);
	if (unpackedA && unpackedB) {
		const schema = opts.registry.getMessage(unpackedA.$typeName);
		if (schema) {
			return equals$1(schema, unpackedA, unpackedB, opts);
		}
	}
	return scalarEquals(ScalarType.BYTES, a.value, b.value);
}

// Copyright 2021-2023 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * For any given message, create an object that is suitable for a Query Key in
 * TanStack Query:
 *
 * - Default values are omitted (both implicit and explicit field presence).
 * - NaN, Infinity, and -Infinity are converted to a string.
 * - Uint8Array is encoded to a string with Base64.
 * - BigInt values are converted to a string.
 * - Properties are sorted by Protobuf source order.
 * - Map keys are sorted with Array.sort.
 *
 * If pageParamKey is provided, omit the field with this name from the key.
 */
function createMessageKey(schema, value, pageParamKey) {
	// eslint-disable-next-line @typescript-eslint/no-use-before-define -- circular reference
	return messageKey(reflect(schema, create(schema, value)), pageParamKey?.toString());
}
function scalarKey(value) {
	if (typeof value == "bigint") {
		return String(value);
	}
	if (typeof value == "number" && !isFinite(value)) {
		return String(value);
	}
	if (value instanceof Uint8Array) {
		return base64Encode(value, "std_raw");
	}
	return value;
}
function listKey(list) {
	const arr = Array.from(list);
	const { listKind } = list.field();
	if (listKind == "scalar") {
		return arr.map(scalarKey);
	}
	if (listKind == "message") {
		// eslint-disable-next-line @typescript-eslint/no-use-before-define -- circular reference
		return arr.map((m) => messageKey(m));
	}
	return arr;
}
function mapKey(map) {
	// eslint-disable-next-line @typescript-eslint/require-array-sort-compare -- we want the standard behavior
	return Array.from(map.keys())
		.sort()
		.reduce((result, k) => {
			switch (map.field().mapKind) {
				case "message":
					// eslint-disable-next-line @typescript-eslint/no-use-before-define -- circular reference
					result[k] = messageKey(map.get(k));
					break;
				case "scalar":
					result[k] = scalarKey(map.get(k));
					break;
				case "enum":
					result[k] = map.get(k);
					break;
			}
			return result;
		}, {});
}
function messageKey(message, pageParamKey) {
	const result = {};
	for (const f of message.sortedFields) {
		if (!message.isSet(f)) {
			continue;
		}
		if (f.localName === pageParamKey) {
			continue;
		}
		switch (f.fieldKind) {
			case "scalar":
				result[f.localName] = scalarKey(message.get(f));
				break;
			case "enum":
				result[f.localName] = message.get(f);
				break;
			case "list":
				result[f.localName] = listKey(message.get(f));
				break;
			case "map":
				result[f.localName] = mapKey(message.get(f));
				break;
			case "message":
				result[f.localName] = messageKey(message.get(f));
				break;
		}
	}
	return result;
}

// Copyright 2021-2023 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const staticKeySymbol = Symbol("static-key");
const transportKeys = new WeakMap();
let counter = 0;
/**
 * For a given Transport, create a string key that is suitable for a Query Key
 * in TanStack Query.
 *
 * This function will return a unique string for every reference.
 */
function createTransportKey(transport) {
	if (transport[staticKeySymbol] !== undefined) {
		return transport[staticKeySymbol];
	}
	let key = transportKeys.get(transport);
	if (key === undefined) {
		key = `t${++counter}`;
		transportKeys.set(transport, key);
	}
	return key;
}

// Copyright 2021-2023 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
function createConnectQueryKey(params) {
	const props =
		params.schema.kind == "rpc" ?
			{
				serviceName: params.schema.parent.typeName,
				methodName: params.schema.name,
			}
		:	{
				serviceName: params.schema.typeName,
			};
	if (params.transport !== undefined) {
		props.transport = createTransportKey(params.transport);
	}
	if (params.cardinality !== undefined) {
		props.cardinality = params.cardinality;
	}
	if (params.schema.kind == "rpc" && "input" in params) {
		if (typeof params.input == "symbol") {
			props.input = "skipped";
		} else if (params.input !== undefined) {
			props.input = createMessageKey(params.schema.input, params.input, params.pageParamKey);
		}
	}
	if (params.schema.kind === "rpc" && "headers" in params && params.headers !== undefined) {
		props.headers = createHeadersKey(params.headers);
	}
	return ["connect-query", props];
}
/**
 * Creates a record of headers from a HeadersInit object.
 *
 */
function createHeadersKey(headers) {
	const result = {};
	for (const [key, value] of new Headers(headers)) {
		result[key] = value;
	}
	return result;
}

// Copyright 2021-2023 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Throws an error with the provided message when the condition is `false`
 */
function assert(condition, message) {
	if (!condition) {
		throw new Error(`Invalid assertion: ${message}`);
	}
}

// Copyright 2021-2023 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Call a unary method given its signature and input.
 */
// eslint-disable-next-line @typescript-eslint/max-params -- 4th param is optional
async function callUnaryMethod(transport, schema, input, options) {
	const result = await transport.unary(schema, options?.signal, undefined, options?.headers, input ?? create(schema.input), undefined);
	return result.message;
}

// src/subscribable.ts
var Subscribable = class {
	constructor() {
		this.listeners = /* @__PURE__ */ new Set();
		this.subscribe = this.subscribe.bind(this);
	}
	subscribe(listener) {
		this.listeners.add(listener);
		this.onSubscribe();
		return () => {
			this.listeners.delete(listener);
			this.onUnsubscribe();
		};
	}
	hasListeners() {
		return this.listeners.size > 0;
	}
	onSubscribe() {}
	onUnsubscribe() {}
};

// src/focusManager.ts
var FocusManager = class extends Subscribable {
	#focused;
	#cleanup;
	#setup;
	constructor() {
		super();
		this.#setup = (onFocus) => {
			if (typeof window !== "undefined" && window.addEventListener) {
				const listener = () => onFocus();
				window.addEventListener("visibilitychange", listener, false);
				return () => {
					window.removeEventListener("visibilitychange", listener);
				};
			}
			return;
		};
	}
	onSubscribe() {
		if (!this.#cleanup) {
			this.setEventListener(this.#setup);
		}
	}
	onUnsubscribe() {
		if (!this.hasListeners()) {
			this.#cleanup?.();
			this.#cleanup = void 0;
		}
	}
	setEventListener(setup) {
		this.#setup = setup;
		this.#cleanup?.();
		this.#cleanup = setup((focused) => {
			if (typeof focused === "boolean") {
				this.setFocused(focused);
			} else {
				this.onFocus();
			}
		});
	}
	setFocused(focused) {
		const changed = this.#focused !== focused;
		if (changed) {
			this.#focused = focused;
			this.onFocus();
		}
	}
	onFocus() {
		const isFocused = this.isFocused();
		this.listeners.forEach((listener) => {
			listener(isFocused);
		});
	}
	isFocused() {
		if (typeof this.#focused === "boolean") {
			return this.#focused;
		}
		return globalThis.document?.visibilityState !== "hidden";
	}
};
var focusManager = new FocusManager();

var defaultTimeoutProvider = {
	// We need the wrapper function syntax below instead of direct references to
	// global setTimeout etc.
	//
	// BAD: `setTimeout: setTimeout`
	// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
	//
	// If we use direct references here, then anything that wants to spy on or
	// replace the global setTimeout (like tests) won't work since we'll already
	// have a hard reference to the original implementation at the time when this
	// file was imported.
	setTimeout: (callback, delay) => setTimeout(callback, delay),
	clearTimeout: (timeoutId) => clearTimeout(timeoutId),
	setInterval: (callback, delay) => setInterval(callback, delay),
	clearInterval: (intervalId) => clearInterval(intervalId),
};
var TimeoutManager = class {
	// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
	// type at app boot; and if we leave that type, then any new timer provider
	// would need to support the default provider's concrete timer ID, which is
	// infeasible across environments.
	//
	// We settle for type safety for the TimeoutProvider type, and accept that
	// this class is unsafe internally to allow for extension.
	#provider = defaultTimeoutProvider;
	#providerCalled = false;
	setTimeoutProvider(provider) {
		this.#provider = provider;
	}
	setTimeout(callback, delay) {
		return this.#provider.setTimeout(callback, delay);
	}
	clearTimeout(timeoutId) {
		this.#provider.clearTimeout(timeoutId);
	}
	setInterval(callback, delay) {
		return this.#provider.setInterval(callback, delay);
	}
	clearInterval(intervalId) {
		this.#provider.clearInterval(intervalId);
	}
};
var timeoutManager = new TimeoutManager();
function systemSetTimeoutZero(callback) {
	setTimeout(callback, 0);
}

var isServer = typeof window === "undefined" || "Deno" in globalThis;
function noop$1() {}
function isValidTimeout(value) {
	return typeof value === "number" && value >= 0 && value !== Infinity;
}
function timeUntilStale(updatedAt, staleTime) {
	return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
}
function resolveStaleTime(staleTime, query) {
	return typeof staleTime === "function" ? staleTime(query) : staleTime;
}
function resolveQueryBoolean(option, query) {
	return typeof option === "function" ? option(query) : option;
}
function hashKey(queryKey) {
	return JSON.stringify(queryKey, (_, val) =>
		isPlainObject(val) ?
			Object.keys(val)
				.sort()
				.reduce((result, key) => {
					result[key] = val[key];
					return result;
				}, {})
		:	val,
	);
}
var hasOwn = Object.prototype.hasOwnProperty;
function replaceEqualDeep(a, b, depth = 0) {
	if (a === b) {
		return a;
	}
	if (depth > 500) return b;
	const array = isPlainArray(a) && isPlainArray(b);
	if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
	const aItems = array ? a : Object.keys(a);
	const aSize = aItems.length;
	const bItems = array ? b : Object.keys(b);
	const bSize = bItems.length;
	const copy = array ? new Array(bSize) : {};
	let equalItems = 0;
	for (let i = 0; i < bSize; i++) {
		const key = array ? i : bItems[i];
		const aItem = a[key];
		const bItem = b[key];
		if (aItem === bItem) {
			copy[key] = aItem;
			if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
			continue;
		}
		if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
			copy[key] = bItem;
			continue;
		}
		const v = replaceEqualDeep(aItem, bItem, depth + 1);
		copy[key] = v;
		if (v === aItem) equalItems++;
	}
	return aSize === bSize && equalItems === aSize ? a : copy;
}
function shallowEqualObjects(a, b) {
	if (!b || Object.keys(a).length !== Object.keys(b).length) {
		return false;
	}
	for (const key in a) {
		if (a[key] !== b[key]) {
			return false;
		}
	}
	return true;
}
function isPlainArray(value) {
	return Array.isArray(value) && value.length === Object.keys(value).length;
}
function isPlainObject(o) {
	if (!hasObjectPrototype(o)) {
		return false;
	}
	const ctor = o.constructor;
	if (ctor === void 0) {
		return true;
	}
	const prot = ctor.prototype;
	if (!hasObjectPrototype(prot)) {
		return false;
	}
	if (!prot.hasOwnProperty("isPrototypeOf")) {
		return false;
	}
	if (Object.getPrototypeOf(o) !== Object.prototype) {
		return false;
	}
	return true;
}
function hasObjectPrototype(o) {
	return Object.prototype.toString.call(o) === "[object Object]";
}
function replaceData(prevData, data, options) {
	if (typeof options.structuralSharing === "function") {
		return options.structuralSharing(prevData, data);
	} else if (options.structuralSharing !== false) {
		return replaceEqualDeep(prevData, data);
	}
	return data;
}
function keepPreviousData(previousData) {
	return previousData;
}
var skipToken = /* @__PURE__ */ Symbol();
function shouldThrowError(throwOnError, params) {
	if (typeof throwOnError === "function") {
		return throwOnError(...params);
	}
	return !!throwOnError;
}

// src/environmentManager.ts
var environmentManager = /* @__PURE__ */ (() => {
	let isServerFn = () => isServer;
	return {
		/**
		 * Returns whether the current runtime should be treated as a server environment.
		 */
		isServer() {
			return isServerFn();
		},
		/**
		 * Overrides the server check globally.
		 */
		setIsServer(isServerValue) {
			isServerFn = isServerValue;
		},
	};
})();

// src/thenable.ts
function pendingThenable() {
	let resolve;
	let reject;
	const thenable = new Promise((_resolve, _reject) => {
		resolve = _resolve;
		reject = _reject;
	});
	thenable.status = "pending";
	thenable.catch(() => {});
	function finalize(data) {
		Object.assign(thenable, data);
		delete thenable.resolve;
		delete thenable.reject;
	}
	thenable.resolve = (value) => {
		finalize({
			status: "fulfilled",
			value,
		});
		resolve(value);
	};
	thenable.reject = (reason) => {
		finalize({
			status: "rejected",
			reason,
		});
		reject(reason);
	};
	return thenable;
}

// src/notifyManager.ts
var defaultScheduler = systemSetTimeoutZero;
function createNotifyManager() {
	let queue = [];
	let transactions = 0;
	let notifyFn = (callback) => {
		callback();
	};
	let batchNotifyFn = (callback) => {
		callback();
	};
	let scheduleFn = defaultScheduler;
	const schedule = (callback) => {
		if (transactions) {
			queue.push(callback);
		} else {
			scheduleFn(() => {
				notifyFn(callback);
			});
		}
	};
	const flush = () => {
		const originalQueue = queue;
		queue = [];
		if (originalQueue.length) {
			scheduleFn(() => {
				batchNotifyFn(() => {
					originalQueue.forEach((callback) => {
						notifyFn(callback);
					});
				});
			});
		}
	};
	return {
		batch: (callback) => {
			let result;
			transactions++;
			try {
				result = callback();
			} finally {
				transactions--;
				if (!transactions) {
					flush();
				}
			}
			return result;
		},
		/**
		 * All calls to the wrapped function will be batched.
		 */
		batchCalls: (callback) => {
			return (...args) => {
				schedule(() => {
					callback(...args);
				});
			};
		},
		schedule,
		/**
		 * Use this method to set a custom notify function.
		 * This can be used to for example wrap notifications with `React.act` while running tests.
		 */
		setNotifyFunction: (fn) => {
			notifyFn = fn;
		},
		/**
		 * Use this method to set a custom function to batch notifications together into a single tick.
		 * By default React Query will use the batch function provided by ReactDOM or React Native.
		 */
		setBatchNotifyFunction: (fn) => {
			batchNotifyFn = fn;
		},
		setScheduler: (fn) => {
			scheduleFn = fn;
		},
	};
}
var notifyManager = createNotifyManager();

// src/onlineManager.ts
var OnlineManager = class extends Subscribable {
	#online = true;
	#cleanup;
	#setup;
	constructor() {
		super();
		this.#setup = (onOnline) => {
			if (typeof window !== "undefined" && window.addEventListener) {
				const onlineListener = () => onOnline(true);
				const offlineListener = () => onOnline(false);
				window.addEventListener("online", onlineListener, false);
				window.addEventListener("offline", offlineListener, false);
				return () => {
					window.removeEventListener("online", onlineListener);
					window.removeEventListener("offline", offlineListener);
				};
			}
			return;
		};
	}
	onSubscribe() {
		if (!this.#cleanup) {
			this.setEventListener(this.#setup);
		}
	}
	onUnsubscribe() {
		if (!this.hasListeners()) {
			this.#cleanup?.();
			this.#cleanup = void 0;
		}
	}
	setEventListener(setup) {
		this.#setup = setup;
		this.#cleanup?.();
		this.#cleanup = setup(this.setOnline.bind(this));
	}
	setOnline(online) {
		const changed = this.#online !== online;
		if (changed) {
			this.#online = online;
			this.listeners.forEach((listener) => {
				listener(online);
			});
		}
	}
	isOnline() {
		return this.#online;
	}
};
var onlineManager = new OnlineManager();

// src/retryer.ts
function canFetch(networkMode) {
	return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
}

// src/infiniteQueryBehavior.ts
function getNextPageParam(options, { pages, pageParams }) {
	const lastIndex = pages.length - 1;
	return pages.length > 0 ? options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams) : void 0;
}
function getPreviousPageParam(options, { pages, pageParams }) {
	return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
}
function hasNextPage(options, data) {
	if (!data) return false;
	return getNextPageParam(options, data) != null;
}
function hasPreviousPage(options, data) {
	if (!data || !options.getPreviousPageParam) return false;
	return getPreviousPageParam(options, data) != null;
}

function fetchState(data, options) {
	return {
		fetchFailureCount: 0,
		fetchFailureReason: null,
		fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
		...(data === void 0 && {
			error: null,
			status: "pending",
		}),
	};
}

// src/queryObserver.ts
var QueryObserver = class extends Subscribable {
	constructor(client, options) {
		super();
		this.options = options;
		this.#client = client;
		this.#selectError = null;
		this.#currentThenable = pendingThenable();
		this.bindMethods();
		this.setOptions(options);
	}
	#client;
	#currentQuery = void 0;
	#currentQueryInitialState = void 0;
	#currentResult = void 0;
	#currentResultState;
	#currentResultOptions;
	#currentThenable;
	#selectError;
	#selectFn;
	#selectResult;
	// This property keeps track of the last query with defined data.
	// It will be used to pass the previous data and query to the placeholder function between renders.
	#lastQueryWithDefinedData;
	#staleTimeoutId;
	#refetchIntervalId;
	#currentRefetchInterval;
	#trackedProps = /* @__PURE__ */ new Set();
	bindMethods() {
		this.refetch = this.refetch.bind(this);
	}
	onSubscribe() {
		if (this.listeners.size === 1) {
			this.#currentQuery.addObserver(this);
			if (shouldFetchOnMount(this.#currentQuery, this.options)) {
				this.#executeFetch();
			} else {
				this.updateResult();
			}
			this.#updateTimers();
		}
	}
	onUnsubscribe() {
		if (!this.hasListeners()) {
			this.destroy();
		}
	}
	shouldFetchOnReconnect() {
		return shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnReconnect);
	}
	shouldFetchOnWindowFocus() {
		return shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnWindowFocus);
	}
	destroy() {
		this.listeners = /* @__PURE__ */ new Set();
		this.#clearStaleTimeout();
		this.#clearRefetchInterval();
		this.#currentQuery.removeObserver(this);
	}
	setOptions(options) {
		const prevOptions = this.options;
		const prevQuery = this.#currentQuery;
		this.options = this.#client.defaultQueryOptions(options);
		if (
			this.options.enabled !== void 0 &&
			typeof this.options.enabled !== "boolean" &&
			typeof this.options.enabled !== "function" &&
			typeof resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== "boolean"
		) {
			throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");
		}
		this.#updateQuery();
		this.#currentQuery.setOptions(this.options);
		if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {
			this.#client.getQueryCache().notify({
				type: "observerOptionsUpdated",
				query: this.#currentQuery,
				observer: this,
			});
		}
		const mounted = this.hasListeners();
		if (mounted && shouldFetchOptionally(this.#currentQuery, prevQuery, this.options, prevOptions)) {
			this.#executeFetch();
		}
		this.updateResult();
		if (
			mounted &&
			(this.#currentQuery !== prevQuery ||
				resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== resolveQueryBoolean(prevOptions.enabled, this.#currentQuery) ||
				resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))
		) {
			this.#updateStaleTimeout();
		}
		const nextRefetchInterval = this.#computeRefetchInterval();
		if (
			mounted &&
			(this.#currentQuery !== prevQuery ||
				resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== resolveQueryBoolean(prevOptions.enabled, this.#currentQuery) ||
				nextRefetchInterval !== this.#currentRefetchInterval)
		) {
			this.#updateRefetchInterval(nextRefetchInterval);
		}
	}
	getOptimisticResult(options) {
		const query = this.#client.getQueryCache().build(this.#client, options);
		const result = this.createResult(query, options);
		if (shouldAssignObserverCurrentProperties(this, result)) {
			this.#currentResult = result;
			this.#currentResultOptions = this.options;
			this.#currentResultState = this.#currentQuery.state;
		}
		return result;
	}
	getCurrentResult() {
		return this.#currentResult;
	}
	trackResult(result, onPropTracked) {
		return new Proxy(result, {
			get: (target, key) => {
				this.trackProp(key);
				onPropTracked?.(key);
				if (key === "promise") {
					this.trackProp("data");
					if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") {
						this.#currentThenable.reject(new Error("experimental_prefetchInRender feature flag is not enabled"));
					}
				}
				return Reflect.get(target, key);
			},
		});
	}
	trackProp(key) {
		this.#trackedProps.add(key);
	}
	getCurrentQuery() {
		return this.#currentQuery;
	}
	refetch({ ...options } = {}) {
		return this.fetch({
			...options,
		});
	}
	fetchOptimistic(options) {
		const defaultedOptions = this.#client.defaultQueryOptions(options);
		const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);
		return query.fetch().then(() => this.createResult(query, defaultedOptions));
	}
	fetch(fetchOptions) {
		return this.#executeFetch({
			...fetchOptions,
			cancelRefetch: fetchOptions.cancelRefetch ?? true,
		}).then(() => {
			this.updateResult();
			return this.#currentResult;
		});
	}
	#executeFetch(fetchOptions) {
		this.#updateQuery();
		let promise = this.#currentQuery.fetch(this.options, fetchOptions);
		if (!fetchOptions?.throwOnError) {
			promise = promise.catch(noop$1);
		}
		return promise;
	}
	#updateStaleTimeout() {
		this.#clearStaleTimeout();
		const staleTime = resolveStaleTime(this.options.staleTime, this.#currentQuery);
		if (environmentManager.isServer() || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
			return;
		}
		const time = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);
		const timeout = time + 1;
		this.#staleTimeoutId = timeoutManager.setTimeout(() => {
			if (!this.#currentResult.isStale) {
				this.updateResult();
			}
		}, timeout);
	}
	#computeRefetchInterval() {
		return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;
	}
	#updateRefetchInterval(nextInterval) {
		this.#clearRefetchInterval();
		this.#currentRefetchInterval = nextInterval;
		if (
			environmentManager.isServer() ||
			resolveQueryBoolean(this.options.enabled, this.#currentQuery) === false ||
			!isValidTimeout(this.#currentRefetchInterval) ||
			this.#currentRefetchInterval === 0
		) {
			return;
		}
		this.#refetchIntervalId = timeoutManager.setInterval(() => {
			if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
				this.#executeFetch();
			}
		}, this.#currentRefetchInterval);
	}
	#updateTimers() {
		this.#updateStaleTimeout();
		this.#updateRefetchInterval(this.#computeRefetchInterval());
	}
	#clearStaleTimeout() {
		if (this.#staleTimeoutId !== void 0) {
			timeoutManager.clearTimeout(this.#staleTimeoutId);
			this.#staleTimeoutId = void 0;
		}
	}
	#clearRefetchInterval() {
		if (this.#refetchIntervalId !== void 0) {
			timeoutManager.clearInterval(this.#refetchIntervalId);
			this.#refetchIntervalId = void 0;
		}
	}
	createResult(query, options) {
		const prevQuery = this.#currentQuery;
		const prevOptions = this.options;
		const prevResult = this.#currentResult;
		const prevResultState = this.#currentResultState;
		const prevResultOptions = this.#currentResultOptions;
		const queryChange = query !== prevQuery;
		const queryInitialState = queryChange ? query.state : this.#currentQueryInitialState;
		const { state } = query;
		let newState = { ...state };
		let isPlaceholderData = false;
		let data;
		if (options._optimisticResults) {
			const mounted = this.hasListeners();
			const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
			const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
			if (fetchOnMount || fetchOptionally) {
				newState = {
					...newState,
					...fetchState(state.data, query.options),
				};
			}
			if (options._optimisticResults === "isRestoring") {
				newState.fetchStatus = "idle";
			}
		}
		let { error, errorUpdatedAt, status } = newState;
		data = newState.data;
		let skipSelect = false;
		if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
			let placeholderData;
			if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {
				placeholderData = prevResult.data;
				skipSelect = true;
			} else {
				placeholderData =
					typeof options.placeholderData === "function" ? options.placeholderData(this.#lastQueryWithDefinedData?.state.data, this.#lastQueryWithDefinedData) : options.placeholderData;
			}
			if (placeholderData !== void 0) {
				status = "success";
				data = replaceData(prevResult?.data, placeholderData, options);
				isPlaceholderData = true;
			}
		}
		if (options.select && data !== void 0 && !skipSelect) {
			if (prevResult && data === prevResultState?.data && options.select === this.#selectFn) {
				data = this.#selectResult;
			} else {
				try {
					this.#selectFn = options.select;
					data = options.select(data);
					data = replaceData(prevResult?.data, data, options);
					this.#selectResult = data;
					this.#selectError = null;
				} catch (selectError) {
					this.#selectError = selectError;
				}
			}
		}
		if (this.#selectError) {
			error = this.#selectError;
			data = this.#selectResult;
			errorUpdatedAt = Date.now();
			status = "error";
		}
		const isFetching = newState.fetchStatus === "fetching";
		const isPending = status === "pending";
		const isError = status === "error";
		const isLoading = isPending && isFetching;
		const hasData = data !== void 0;
		const result = {
			status,
			fetchStatus: newState.fetchStatus,
			isPending,
			isSuccess: status === "success",
			isError,
			isInitialLoading: isLoading,
			isLoading,
			data,
			dataUpdatedAt: newState.dataUpdatedAt,
			error,
			errorUpdatedAt,
			failureCount: newState.fetchFailureCount,
			failureReason: newState.fetchFailureReason,
			errorUpdateCount: newState.errorUpdateCount,
			isFetched: query.isFetched(),
			isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
			isFetching,
			isRefetching: isFetching && !isPending,
			isLoadingError: isError && !hasData,
			isPaused: newState.fetchStatus === "paused",
			isPlaceholderData,
			isRefetchError: isError && hasData,
			isStale: isStale(query, options),
			refetch: this.refetch,
			promise: this.#currentThenable,
			isEnabled: resolveQueryBoolean(options.enabled, query) !== false,
		};
		const nextResult = result;
		if (this.options.experimental_prefetchInRender) {
			const hasResultData = nextResult.data !== void 0;
			const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
			const finalizeThenableIfPossible = (thenable) => {
				if (isErrorWithoutData) {
					thenable.reject(nextResult.error);
				} else if (hasResultData) {
					thenable.resolve(nextResult.data);
				}
			};
			const recreateThenable = () => {
				const pending = (this.#currentThenable = nextResult.promise = pendingThenable());
				finalizeThenableIfPossible(pending);
			};
			const prevThenable = this.#currentThenable;
			switch (prevThenable.status) {
				case "pending":
					if (query.queryHash === prevQuery.queryHash) {
						finalizeThenableIfPossible(prevThenable);
					}
					break;
				case "fulfilled":
					if (isErrorWithoutData || nextResult.data !== prevThenable.value) {
						recreateThenable();
					}
					break;
				case "rejected":
					if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) {
						recreateThenable();
					}
					break;
			}
		}
		return nextResult;
	}
	updateResult() {
		const prevResult = this.#currentResult;
		const nextResult = this.createResult(this.#currentQuery, this.options);
		this.#currentResultState = this.#currentQuery.state;
		this.#currentResultOptions = this.options;
		if (this.#currentResultState.data !== void 0) {
			this.#lastQueryWithDefinedData = this.#currentQuery;
		}
		if (shallowEqualObjects(nextResult, prevResult)) {
			return;
		}
		this.#currentResult = nextResult;
		const shouldNotifyListeners = () => {
			if (!prevResult) {
				return true;
			}
			const { notifyOnChangeProps } = this.options;
			const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
			if (notifyOnChangePropsValue === "all" || (!notifyOnChangePropsValue && !this.#trackedProps.size)) {
				return true;
			}
			const includedProps = new Set(notifyOnChangePropsValue ?? this.#trackedProps);
			if (this.options.throwOnError) {
				includedProps.add("error");
			}
			return Object.keys(this.#currentResult).some((key) => {
				const typedKey = key;
				const changed = this.#currentResult[typedKey] !== prevResult[typedKey];
				return changed && includedProps.has(typedKey);
			});
		};
		this.#notify({ listeners: shouldNotifyListeners() });
	}
	#updateQuery() {
		const query = this.#client.getQueryCache().build(this.#client, this.options);
		if (query === this.#currentQuery) {
			return;
		}
		const prevQuery = this.#currentQuery;
		this.#currentQuery = query;
		this.#currentQueryInitialState = query.state;
		if (this.hasListeners()) {
			prevQuery?.removeObserver(this);
			query.addObserver(this);
		}
	}
	onQueryUpdate() {
		this.updateResult();
		if (this.hasListeners()) {
			this.#updateTimers();
		}
	}
	#notify(notifyOptions) {
		notifyManager.batch(() => {
			if (notifyOptions.listeners) {
				this.listeners.forEach((listener) => {
					listener(this.#currentResult);
				});
			}
			this.#client.getQueryCache().notify({
				query: this.#currentQuery,
				type: "observerResultsUpdated",
			});
		});
	}
};
function shouldLoadOnMount(query, options) {
	return resolveQueryBoolean(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && resolveQueryBoolean(options.retryOnMount, query) === false);
}
function shouldFetchOnMount(query, options) {
	return shouldLoadOnMount(query, options) || (query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount));
}
function shouldFetchOn(query, options, field) {
	if (resolveQueryBoolean(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
		const value = typeof field === "function" ? field(query) : field;
		return value === "always" || (value !== false && isStale(query, options));
	}
	return false;
}
function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
	return (query !== prevQuery || resolveQueryBoolean(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
}
function isStale(query, options) {
	return resolveQueryBoolean(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
}
function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
	if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
		return true;
	}
	return false;
}

// src/infiniteQueryObserver.ts
var InfiniteQueryObserver = class extends QueryObserver {
	constructor(client, options) {
		super(client, options);
	}
	bindMethods() {
		super.bindMethods();
		this.fetchNextPage = this.fetchNextPage.bind(this);
		this.fetchPreviousPage = this.fetchPreviousPage.bind(this);
	}
	setOptions(options) {
		options._type = "infinite";
		super.setOptions(options);
	}
	getOptimisticResult(options) {
		options._type = "infinite";
		return super.getOptimisticResult(options);
	}
	fetchNextPage(options) {
		return this.fetch({
			...options,
			meta: {
				fetchMore: { direction: "forward" },
			},
		});
	}
	fetchPreviousPage(options) {
		return this.fetch({
			...options,
			meta: {
				fetchMore: { direction: "backward" },
			},
		});
	}
	createResult(query, options) {
		const { state } = query;
		const parentResult = super.createResult(query, options);
		const { isFetching, isRefetching, isError, isRefetchError } = parentResult;
		const fetchDirection = state.fetchMeta?.fetchMore?.direction;
		const isFetchNextPageError = isError && fetchDirection === "forward";
		const isFetchingNextPage = isFetching && fetchDirection === "forward";
		const isFetchPreviousPageError = isError && fetchDirection === "backward";
		const isFetchingPreviousPage = isFetching && fetchDirection === "backward";
		const result = {
			...parentResult,
			fetchNextPage: this.fetchNextPage,
			fetchPreviousPage: this.fetchPreviousPage,
			hasNextPage: hasNextPage(options, state.data),
			hasPreviousPage: hasPreviousPage(options, state.data),
			isFetchNextPageError,
			isFetchingNextPage,
			isFetchPreviousPageError,
			isFetchingPreviousPage,
			isRefetchError: isRefetchError && !isFetchNextPageError && !isFetchPreviousPageError,
			isRefetching: isRefetching && !isFetchingNextPage && !isFetchingPreviousPage,
		};
		return result;
	}
};

// src/mutation.ts
function getDefaultState() {
	return {
		context: void 0,
		data: void 0,
		error: null,
		failureCount: 0,
		failureReason: null,
		isPaused: false,
		status: "idle",
		variables: void 0,
		submittedAt: 0,
	};
}

// src/mutationObserver.ts
var MutationObserver = class extends Subscribable {
	#client;
	#currentResult = void 0;
	#currentMutation;
	#mutateOptions;
	constructor(client, options) {
		super();
		this.#client = client;
		this.setOptions(options);
		this.bindMethods();
		this.#updateResult();
	}
	bindMethods() {
		this.mutate = this.mutate.bind(this);
		this.reset = this.reset.bind(this);
	}
	setOptions(options) {
		const prevOptions = this.options;
		this.options = this.#client.defaultMutationOptions(options);
		if (!shallowEqualObjects(this.options, prevOptions)) {
			this.#client.getMutationCache().notify({
				type: "observerOptionsUpdated",
				mutation: this.#currentMutation,
				observer: this,
			});
		}
		if (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) {
			this.reset();
		} else if (this.#currentMutation?.state.status === "pending") {
			this.#currentMutation.setOptions(this.options);
		}
	}
	onUnsubscribe() {
		if (!this.hasListeners()) {
			this.#currentMutation?.removeObserver(this);
		}
	}
	onMutationUpdate(action) {
		this.#updateResult();
		this.#notify(action);
	}
	getCurrentResult() {
		return this.#currentResult;
	}
	reset() {
		this.#currentMutation?.removeObserver(this);
		this.#currentMutation = void 0;
		this.#updateResult();
		this.#notify();
	}
	mutate(variables, options) {
		this.#mutateOptions = options;
		this.#currentMutation?.removeObserver(this);
		this.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);
		this.#currentMutation.addObserver(this);
		return this.#currentMutation.execute(variables);
	}
	#updateResult() {
		const state = this.#currentMutation?.state ?? getDefaultState();
		this.#currentResult = {
			...state,
			isPending: state.status === "pending",
			isSuccess: state.status === "success",
			isError: state.status === "error",
			isIdle: state.status === "idle",
			mutate: this.mutate,
			reset: this.reset,
		};
	}
	#notify(action) {
		notifyManager.batch(() => {
			if (this.#mutateOptions && this.hasListeners()) {
				const variables = this.#currentResult.variables;
				const onMutateResult = this.#currentResult.context;
				const context = {
					client: this.#client,
					meta: this.options.meta,
					mutationKey: this.options.mutationKey,
				};
				if (action?.type === "success") {
					try {
						this.#mutateOptions.onSuccess?.(action.data, variables, onMutateResult, context);
					} catch (e) {
						void Promise.reject(e);
					}
					try {
						this.#mutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context);
					} catch (e) {
						void Promise.reject(e);
					}
				} else if (action?.type === "error") {
					try {
						this.#mutateOptions.onError?.(action.error, variables, onMutateResult, context);
					} catch (e) {
						void Promise.reject(e);
					}
					try {
						this.#mutateOptions.onSettled?.(void 0, action.error, variables, onMutateResult, context);
					} catch (e) {
						void Promise.reject(e);
					}
				}
			}
			this.listeners.forEach((listener) => {
				listener(this.#currentResult);
			});
		});
	}
};

// Copyright 2021-2023 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Returns a simplistic implementation for "structural sharing" for a Protobuf
 * message.
 *
 * To keep references intact between re-renders, we return the old version if it
 * equals the new version.
 *
 * See https://tanstack.com/query/latest/docs/framework/react/guides/render-optimizations#structural-sharing
 */
function createStructuralSharing(schema) {
	return function (oldData, newData) {
		if (!isMessage(oldData) || !isMessage(newData)) {
			return replaceEqualDeep(oldData, newData);
		}
		if (!equals$1(schema, oldData, newData)) {
			return newData;
		}
		return oldData;
	};
}

// Copyright 2021-2023 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// eslint-disable-next-line @typescript-eslint/max-params -- we have 4 required arguments
function createUnaryInfiniteQueryFn(transport, schema, input, { pageParamKey }) {
	return async (context) => {
		assert("pageParam" in context, "pageParam must be part of context");
		const inputCombinedWithPageParam = {
			...input,
			[pageParamKey]: context.pageParam,
		};
		return callUnaryMethod(transport, schema, inputCombinedWithPageParam, {
			signal: context.signal,
			headers: context.queryKey[1].headers,
		});
	};
}
function createInfiniteQueryOptions(schema, input, { transport, getNextPageParam, pageParamKey, headers }) {
	const queryKey = createConnectQueryKey({
		cardinality: "infinite",
		schema,
		transport,
		input,
		pageParamKey,
		headers,
	});
	const structuralSharing = createStructuralSharing(schema.output);
	const queryFn =
		input === skipToken ? skipToken : (
			createUnaryInfiniteQueryFn(transport, schema, input, {
				pageParamKey,
			})
		);
	return {
		getNextPageParam,
		initialPageParam: input === skipToken ? undefined : input[pageParamKey],
		queryKey,
		queryFn,
		structuralSharing,
	};
}

// Copyright 2021-2023 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
function createUnaryQueryFn(transport, schema, input) {
	return async (context) => {
		return callUnaryMethod(transport, schema, input, {
			signal: context.signal,
			headers: context.queryKey[1].headers,
		});
	};
}
function createQueryOptions(schema, input, { transport, headers }) {
	const queryKey = createConnectQueryKey({
		schema,
		input: input ?? create(schema.input),
		transport,
		cardinality: "finite",
		headers,
	});
	const structuralSharing = createStructuralSharing(schema.output);
	const queryFn = input === skipToken ? skipToken : createUnaryQueryFn(transport, schema, input);
	return {
		queryKey,
		queryFn,
		structuralSharing,
	};
}

// Copyright 2021-2026 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Connect represents categories of errors as codes, and each code maps to a
 * specific HTTP status code. The codes and their semantics were chosen to
 * match gRPC. Only the codes below are valid — there are no user-defined
 * codes.
 *
 * See the specification at https://connectrpc.com/docs/protocol#error-codes
 * for details.
 */
var Code;
(function (Code) {
	/**
	 * Canceled, usually by the user
	 */
	Code[(Code["Canceled"] = 1)] = "Canceled";
	/**
	 * Unknown error
	 */
	Code[(Code["Unknown"] = 2)] = "Unknown";
	/**
	 * Argument invalid regardless of system state
	 */
	Code[(Code["InvalidArgument"] = 3)] = "InvalidArgument";
	/**
	 * Operation expired, may or may not have completed.
	 */
	Code[(Code["DeadlineExceeded"] = 4)] = "DeadlineExceeded";
	/**
	 * Entity not found.
	 */
	Code[(Code["NotFound"] = 5)] = "NotFound";
	/**
	 * Entity already exists.
	 */
	Code[(Code["AlreadyExists"] = 6)] = "AlreadyExists";
	/**
	 * Operation not authorized.
	 */
	Code[(Code["PermissionDenied"] = 7)] = "PermissionDenied";
	/**
	 * Quota exhausted.
	 */
	Code[(Code["ResourceExhausted"] = 8)] = "ResourceExhausted";
	/**
	 * Argument invalid in current system state.
	 */
	Code[(Code["FailedPrecondition"] = 9)] = "FailedPrecondition";
	/**
	 * Operation aborted.
	 */
	Code[(Code["Aborted"] = 10)] = "Aborted";
	/**
	 * Out of bounds, use instead of FailedPrecondition.
	 */
	Code[(Code["OutOfRange"] = 11)] = "OutOfRange";
	/**
	 * Operation not implemented or disabled.
	 */
	Code[(Code["Unimplemented"] = 12)] = "Unimplemented";
	/**
	 * Internal error, reserved for "serious errors".
	 */
	Code[(Code["Internal"] = 13)] = "Internal";
	/**
	 * Unavailable, client should back off and retry.
	 */
	Code[(Code["Unavailable"] = 14)] = "Unavailable";
	/**
	 * Unrecoverable data loss or corruption.
	 */
	Code[(Code["DataLoss"] = 15)] = "DataLoss";
	/**
	 * Request isn't authenticated.
	 */
	Code[(Code["Unauthenticated"] = 16)] = "Unauthenticated";
})(Code || (Code = {}));

// Copyright 2021-2026 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * codeToString returns the string representation of a Code.
 *
 * @private Internal code, does not follow semantic versioning.
 */
function codeToString(value) {
	const name = Code[value];
	if (typeof name != "string") {
		return value.toString();
	}
	return name[0].toLowerCase() + name.substring(1).replace(/[A-Z]/g, (c) => "_" + c.toLowerCase());
}

// Copyright 2021-2026 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * ConnectError captures four pieces of information: a Code, an error
 * message, an optional cause of the error, and an optional collection of
 * arbitrary Protobuf messages called  "details".
 *
 * Because developer tools typically show just the error message, we prefix
 * it with the status code, so that the most important information is always
 * visible immediately.
 *
 * Error details are wrapped with google.protobuf.Any on the wire, so that
 * a server or middleware can attach arbitrary data to an error. Use the
 * method findDetails() to retrieve the details.
 */
class ConnectError extends Error {
	/**
	 * Create a new ConnectError.
	 * If no code is provided, code "unknown" is used.
	 * Outgoing details are only relevant for the server side - a service may
	 * raise an error with details, and it is up to the protocol implementation
	 * to encode and send the details along with the error.
	 */
	constructor(message, code = Code.Unknown, metadata, outgoingDetails, cause) {
		super(createMessage(message, code));
		this.name = "ConnectError";
		// see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#example
		Object.setPrototypeOf(this, new.target.prototype);
		this.rawMessage = message;
		this.code = code;
		this.metadata = new Headers(metadata !== null && metadata !== void 0 ? metadata : {});
		this.details = outgoingDetails !== null && outgoingDetails !== void 0 ? outgoingDetails : [];
		this.cause = cause;
	}
	/**
	 * Convert any value - typically a caught error into a ConnectError,
	 * following these rules:
	 * - If the value is already a ConnectError, return it as is.
	 * - If the value is an AbortError or TimeoutError from the fetch API, return
	 *   the message of the error with code Canceled.
	 * - For other Errors, return the error message with code Unknown by default.
	 * - For other values, return the values String representation as a message,
	 *   with the code Unknown by default.
	 * The original value will be used for the "cause" property for the new
	 * ConnectError.
	 */
	static from(reason, code = Code.Unknown) {
		if (reason instanceof ConnectError) {
			return reason;
		}
		if (reason instanceof Error) {
			if (reason.name == "AbortError" || reason.name == "TimeoutError") {
				// Fetch requests can only be canceled with an AbortController,
				// or with AbortSignal.timeout().
				return new ConnectError(reason.message, Code.Canceled);
			}
			return new ConnectError(reason.message, code, undefined, undefined, reason);
		}
		return new ConnectError(String(reason), code, undefined, undefined, reason);
	}
	static [Symbol.hasInstance](v) {
		if (!(v instanceof Error)) {
			return false;
		}
		if (Object.getPrototypeOf(v) === ConnectError.prototype) {
			return true;
		}
		return (
			v.name === "ConnectError" &&
			"code" in v &&
			typeof v.code === "number" &&
			"metadata" in v &&
			"details" in v &&
			Array.isArray(v.details) &&
			"rawMessage" in v &&
			typeof v.rawMessage == "string" &&
			"cause" in v
		);
	}
	findDetails(typeOrRegistry) {
		const registry =
			typeOrRegistry.kind === "message" ?
				{
					getMessage: (typeName) => (typeName === typeOrRegistry.typeName ? typeOrRegistry : undefined),
				}
			:	typeOrRegistry;
		const details = [];
		for (const data of this.details) {
			if ("desc" in data) {
				if (registry.getMessage(data.desc.typeName)) {
					details.push(create(data.desc, data.value));
				}
				continue;
			}
			const desc = registry.getMessage(data.type);
			if (desc) {
				try {
					details.push(fromBinary(desc, data.value));
				} catch (_) {
					// We silently give up if we are unable to parse the detail, because
					// that appears to be the least worst behavior.
					// It is very unlikely that a user surrounds a catch body handling the
					// error with another try-catch statement, and we do not want to
					// recommend doing so.
				}
			}
		}
		return details;
	}
}
/**
 * Create an error message, prefixing the given code.
 */
function createMessage(message, code) {
	return message.length ? `[${codeToString(code)}] ${message}` : `[${codeToString(code)}]`;
}

// Copyright 2021-2026 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Create any client for the given service.
 *
 * The given createMethod function is called for each method definition
 * of the service. The function it returns is added to the client object
 * as a method.
 */
function makeAnyClient(service, createMethod) {
	const client = {};
	for (const desc of service.methods) {
		const method = createMethod(desc);
		if (method != null) {
			client[desc.localName] = method;
		}
	}
	return client;
}

// Copyright 2021-2026 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
var __asyncValues$1 =
	(undefined && undefined.__asyncValues) ||
	function (o) {
		if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
		var m = o[Symbol.asyncIterator],
			i;
		return m ?
				m.call(o)
			:	((o = typeof __values === "function" ? __values(o) : o[Symbol.iterator]()),
				(i = {}),
				verb("next"),
				verb("throw"),
				verb("return"),
				(i[Symbol.asyncIterator] = function () {
					return this;
				}),
				i);
		function verb(n) {
			i[n] =
				o[n] &&
				function (v) {
					return new Promise(function (resolve, reject) {
						((v = o[n](v)), settle(resolve, reject, v.done, v.value));
					});
				};
		}
		function settle(resolve, reject, d, v) {
			Promise.resolve(v).then(function (v) {
				resolve({ value: v, done: d });
			}, reject);
		}
	};
var __await$1 =
	(undefined && undefined.__await) ||
	function (v) {
		return this instanceof __await$1 ? ((this.v = v), this) : new __await$1(v);
	};
var __asyncGenerator$1 =
	(undefined && undefined.__asyncGenerator) ||
	function (thisArg, _arguments, generator) {
		if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
		var g = generator.apply(thisArg, _arguments || []),
			i,
			q = [];
		return (
			(i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype)),
			verb("next"),
			verb("throw"),
			verb("return", awaitReturn),
			(i[Symbol.asyncIterator] = function () {
				return this;
			}),
			i
		);
		function awaitReturn(f) {
			return function (v) {
				return Promise.resolve(v).then(f, reject);
			};
		}
		function verb(n, f) {
			if (g[n]) {
				i[n] = function (v) {
					return new Promise(function (a, b) {
						q.push([n, v, a, b]) > 1 || resume(n, v);
					});
				};
				if (f) i[n] = f(i[n]);
			}
		}
		function resume(n, v) {
			try {
				step(g[n](v));
			} catch (e) {
				settle(q[0][3], e);
			}
		}
		function step(r) {
			r.value instanceof __await$1 ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
		}
		function fulfill(value) {
			resume("next", value);
		}
		function reject(value) {
			resume("throw", value);
		}
		function settle(f, v) {
			if ((f(v), q.shift(), q.length)) resume(q[0][0], q[0][1]);
		}
	};
var __asyncDelegator$1 =
	(undefined && undefined.__asyncDelegator) ||
	function (o) {
		var i, p;
		return (
			(i = {}),
			verb("next"),
			verb("throw", function (e) {
				throw e;
			}),
			verb("return"),
			(i[Symbol.iterator] = function () {
				return this;
			}),
			i
		);
		function verb(n, f) {
			i[n] =
				o[n] ?
					function (v) {
						return (
							(p = !p) ? { value: __await$1(o[n](v)), done: false }
							: f ? f(v)
							: v
						);
					}
				:	f;
		}
	};
/**
 * Create an asynchronous iterable from an array.
 *
 * @private Internal code, does not follow semantic versioning.
 */
function createAsyncIterable(items) {
	return __asyncGenerator$1(this, arguments, function* createAsyncIterable_1() {
		yield __await$1(yield* __asyncDelegator$1(__asyncValues$1(items)));
	});
}

// Copyright 2021-2026 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
var __asyncValues =
	(undefined && undefined.__asyncValues) ||
	function (o) {
		if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
		var m = o[Symbol.asyncIterator],
			i;
		return m ?
				m.call(o)
			:	((o = typeof __values === "function" ? __values(o) : o[Symbol.iterator]()),
				(i = {}),
				verb("next"),
				verb("throw"),
				verb("return"),
				(i[Symbol.asyncIterator] = function () {
					return this;
				}),
				i);
		function verb(n) {
			i[n] =
				o[n] &&
				function (v) {
					return new Promise(function (resolve, reject) {
						((v = o[n](v)), settle(resolve, reject, v.done, v.value));
					});
				};
		}
		function settle(resolve, reject, d, v) {
			Promise.resolve(v).then(function (v) {
				resolve({ value: v, done: d });
			}, reject);
		}
	};
var __await =
	(undefined && undefined.__await) ||
	function (v) {
		return this instanceof __await ? ((this.v = v), this) : new __await(v);
	};
var __asyncDelegator =
	(undefined && undefined.__asyncDelegator) ||
	function (o) {
		var i, p;
		return (
			(i = {}),
			verb("next"),
			verb("throw", function (e) {
				throw e;
			}),
			verb("return"),
			(i[Symbol.iterator] = function () {
				return this;
			}),
			i
		);
		function verb(n, f) {
			i[n] =
				o[n] ?
					function (v) {
						return (
							(p = !p) ? { value: __await(o[n](v)), done: false }
							: f ? f(v)
							: v
						);
					}
				:	f;
		}
	};
var __asyncGenerator =
	(undefined && undefined.__asyncGenerator) ||
	function (thisArg, _arguments, generator) {
		if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
		var g = generator.apply(thisArg, _arguments || []),
			i,
			q = [];
		return (
			(i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype)),
			verb("next"),
			verb("throw"),
			verb("return", awaitReturn),
			(i[Symbol.asyncIterator] = function () {
				return this;
			}),
			i
		);
		function awaitReturn(f) {
			return function (v) {
				return Promise.resolve(v).then(f, reject);
			};
		}
		function verb(n, f) {
			if (g[n]) {
				i[n] = function (v) {
					return new Promise(function (a, b) {
						q.push([n, v, a, b]) > 1 || resume(n, v);
					});
				};
				if (f) i[n] = f(i[n]);
			}
		}
		function resume(n, v) {
			try {
				step(g[n](v));
			} catch (e) {
				settle(q[0][3], e);
			}
		}
		function step(r) {
			r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
		}
		function fulfill(value) {
			resume("next", value);
		}
		function reject(value) {
			resume("throw", value);
		}
		function settle(f, v) {
			if ((f(v), q.shift(), q.length)) resume(q[0][0], q[0][1]);
		}
	};
/**
 * Create a Client for the given service, invoking RPCs through the
 * given transport.
 */
function createClient(service, transport) {
	return makeAnyClient(service, (method) => {
		switch (method.methodKind) {
			case "unary":
				return createUnaryFn(transport, method);
			case "server_streaming":
				return createServerStreamingFn(transport, method);
			case "client_streaming":
				return createClientStreamingFn(transport, method);
			case "bidi_streaming":
				return createBiDiStreamingFn(transport, method);
			default:
				return null;
		}
	});
}
function createUnaryFn(transport, method) {
	return async (input, options) => {
		var _a, _b;
		const response = await transport.unary(
			method,
			options === null || options === void 0 ? void 0 : options.signal,
			options === null || options === void 0 ? void 0 : options.timeoutMs,
			options === null || options === void 0 ? void 0 : options.headers,
			input,
			options === null || options === void 0 ? void 0 : options.contextValues,
		);
		(_a = options === null || options === void 0 ? void 0 : options.onHeader) === null || _a === void 0 ? void 0 : _a.call(options, response.header);
		(_b = options === null || options === void 0 ? void 0 : options.onTrailer) === null || _b === void 0 ? void 0 : _b.call(options, response.trailer);
		return response.message;
	};
}
function createServerStreamingFn(transport, method) {
	return (input, options) =>
		handleStreamResponse(
			transport.stream(
				method,
				options === null || options === void 0 ? void 0 : options.signal,
				options === null || options === void 0 ? void 0 : options.timeoutMs,
				options === null || options === void 0 ? void 0 : options.headers,
				createAsyncIterable([input]),
				options === null || options === void 0 ? void 0 : options.contextValues,
			),
			options,
		);
}
function createClientStreamingFn(transport, method) {
	return async (request, options) => {
		var _a, e_1, _b, _c;
		var _d, _e;
		const response = await transport.stream(
			method,
			options === null || options === void 0 ? void 0 : options.signal,
			options === null || options === void 0 ? void 0 : options.timeoutMs,
			options === null || options === void 0 ? void 0 : options.headers,
			request,
			options === null || options === void 0 ? void 0 : options.contextValues,
		);
		(_d = options === null || options === void 0 ? void 0 : options.onHeader) === null || _d === void 0 ? void 0 : _d.call(options, response.header);
		let singleMessage;
		let count = 0;
		try {
			for (var _f = true, _g = __asyncValues(response.message), _h; (_h = await _g.next()), (_a = _h.done), !_a; _f = true) {
				_c = _h.value;
				_f = false;
				const message = _c;
				singleMessage = message;
				count++;
			}
		} catch (e_1_1) {
			e_1 = { error: e_1_1 };
		} finally {
			try {
				if (!_f && !_a && (_b = _g.return)) await _b.call(_g);
			} finally {
				if (e_1) throw e_1.error;
			}
		}
		if (!singleMessage) {
			throw new ConnectError("protocol error: missing response message", Code.Unimplemented);
		}
		if (count > 1) {
			throw new ConnectError("protocol error: received extra messages for client streaming method", Code.Unimplemented);
		}
		(_e = options === null || options === void 0 ? void 0 : options.onTrailer) === null || _e === void 0 ? void 0 : _e.call(options, response.trailer);
		return singleMessage;
	};
}
function createBiDiStreamingFn(transport, method) {
	return (request, options) =>
		handleStreamResponse(
			transport.stream(
				method,
				options === null || options === void 0 ? void 0 : options.signal,
				options === null || options === void 0 ? void 0 : options.timeoutMs,
				options === null || options === void 0 ? void 0 : options.headers,
				request,
				options === null || options === void 0 ? void 0 : options.contextValues,
			),
			options,
		);
}
function handleStreamResponse(stream, options) {
	const it = (function () {
		return __asyncGenerator(this, arguments, function* () {
			var _a, _b;
			const response = yield __await(stream);
			(_a = options === null || options === void 0 ? void 0 : options.onHeader) === null || _a === void 0 ? void 0 : _a.call(options, response.header);
			yield __await(yield* __asyncDelegator(__asyncValues(response.message)));
			(_b = options === null || options === void 0 ? void 0 : options.onTrailer) === null || _b === void 0 ? void 0 : _b.call(options, response.trailer);
		});
	})()[Symbol.asyncIterator]();
	// Create a new iterable to omit throw/return.
	return {
		[Symbol.asyncIterator]: () => ({
			next: () => it.next(),
		}),
	};
}

// Copyright 2021-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Hydrate a service descriptor.
 *
 * @private
 */
function serviceDesc(file, path, ...paths) {
	if (paths.length > 0) {
		throw new Error();
	}
	return file.services[path];
}

const { createContext: createContext$2, useContext: useContext$2 } = await importShared("react");

const fallbackTransportError = new ConnectError(
	"To use Connect, you must provide a `Transport`: a simple object that handles `unary` and `stream` requests. `Transport` objects can easily be created by using `@connectrpc/connect-web`'s exports `createConnectTransport` and `createGrpcWebTransport`. see: https://connectrpc.com/docs/web/getting-started for more info.",
);
// istanbul ignore next
const fallbackTransport = {
	unary: () => {
		throw fallbackTransportError;
	},
	stream: () => {
		throw fallbackTransportError;
	},
};
const transportContext = createContext$2(fallbackTransport);
/**
 * Use this helper to get the default transport that's currently attached to the React context for the calling component.
 */
const useTransport = () => useContext$2(transportContext);

// src/QueryClientProvider.tsx
const React$9 = await importShared("react");
var QueryClientContext = React$9.createContext(void 0);
var useQueryClient = (queryClient) => {
	const client = React$9.useContext(QueryClientContext);
	if (!client) {
		throw new Error("No QueryClient set, use QueryClientProvider to set one");
	}
	return client;
};

// src/IsRestoringProvider.ts
const React$8 = await importShared("react");

var IsRestoringContext = React$8.createContext(false);
var useIsRestoring = () => React$8.useContext(IsRestoringContext);
IsRestoringContext.Provider;

// src/QueryErrorResetBoundary.tsx
const React$7 = await importShared("react");
function createValue() {
	let isReset = false;
	return {
		clearReset: () => {
			isReset = false;
		},
		reset: () => {
			isReset = true;
		},
		isReset: () => {
			return isReset;
		},
	};
}
var QueryErrorResetBoundaryContext = React$7.createContext(createValue());
var useQueryErrorResetBoundary = () => React$7.useContext(QueryErrorResetBoundaryContext);

// src/errorBoundaryUtils.ts
const React$6 = await importShared("react");
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
	const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
	if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
		if (!errorResetBoundary.isReset()) {
			options.retryOnMount = false;
		}
	}
};
var useClearResetErrorBoundary = (errorResetBoundary) => {
	React$6.useEffect(() => {
		errorResetBoundary.clearReset();
	}, [errorResetBoundary]);
};
var getHasError = ({ result, errorResetBoundary, throwOnError, query, suspense }) => {
	return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && ((suspense && result.data === void 0) || shouldThrowError(throwOnError, [result.error, query]));
};

// src/suspense.ts
var ensureSuspenseTimers = (defaultedOptions) => {
	if (defaultedOptions.suspense) {
		const MIN_SUSPENSE_TIME_MS = 1e3;
		const clamp = (value) => (value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS));
		const originalStaleTime = defaultedOptions.staleTime;
		defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
		if (typeof defaultedOptions.gcTime === "number") {
			defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, MIN_SUSPENSE_TIME_MS);
		}
	}
};
var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;
var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) =>
	observer.fetchOptimistic(defaultedOptions).catch(() => {
		errorResetBoundary.clearReset();
	});

const React$5 = await importShared("react");
function useBaseQuery(options, Observer, queryClient) {
	const isRestoring = useIsRestoring();
	const errorResetBoundary = useQueryErrorResetBoundary();
	const client = useQueryClient();
	const defaultedOptions = client.defaultQueryOptions(options);
	client.getDefaultOptions().queries?._experimental_beforeQuery?.(defaultedOptions);
	const query = client.getQueryCache().get(defaultedOptions.queryHash);
	const subscribed = options.subscribed !== false;
	defaultedOptions._optimisticResults =
		isRestoring ? "isRestoring"
		: subscribed ? "optimistic"
		: void 0;
	ensureSuspenseTimers(defaultedOptions);
	ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);
	useClearResetErrorBoundary(errorResetBoundary);
	const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
	const [observer] = React$5.useState(() => new Observer(client, defaultedOptions));
	const result = observer.getOptimisticResult(defaultedOptions);
	const shouldSubscribe = !isRestoring && subscribed;
	React$5.useSyncExternalStore(
		React$5.useCallback(
			(onStoreChange) => {
				const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop$1;
				observer.updateResult();
				return unsubscribe;
			},
			[observer, shouldSubscribe],
		),
		() => observer.getCurrentResult(),
		() => observer.getCurrentResult(),
	);
	React$5.useEffect(() => {
		observer.setOptions(defaultedOptions);
	}, [defaultedOptions, observer]);
	if (shouldSuspend(defaultedOptions, result)) {
		throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
	}
	if (
		getHasError({
			result,
			errorResetBoundary,
			throwOnError: defaultedOptions.throwOnError,
			query,
			suspense: defaultedOptions.suspense,
		})
	) {
		throw result.error;
	}
	client.getDefaultOptions().queries?._experimental_afterQuery?.(defaultedOptions, result);
	if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) {
		const promise =
			isNewCacheEntry ?
				// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
				fetchOptimistic(defaultedOptions, observer, errorResetBoundary)
				// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
			:	query?.promise;
		promise?.catch(noop$1).finally(() => {
			observer.updateResult();
		});
	}
	return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
}

function useQuery$1(options, queryClient) {
	return useBaseQuery(options, QueryObserver);
}

// src/useMutation.ts
const React$4 = await importShared("react");
function useMutation$1(options, queryClient) {
	const client = useQueryClient();
	const [observer] = React$4.useState(() => new MutationObserver(client, options));
	React$4.useEffect(() => {
		observer.setOptions(options);
	}, [observer, options]);
	const result = React$4.useSyncExternalStore(
		React$4.useCallback((onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]),
		() => observer.getCurrentResult(),
		() => observer.getCurrentResult(),
	);
	const mutate = React$4.useCallback(
		(variables, mutateOptions) => {
			observer.mutate(variables, mutateOptions).catch(noop$1);
		},
		[observer],
	);
	if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) {
		throw result.error;
	}
	return { ...result, mutate, mutateAsync: result.mutate };
}

function useInfiniteQuery$1(options, queryClient) {
	return useBaseQuery(options, InfiniteQueryObserver);
}

// Copyright 2021-2023 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Query the method provided. Maps to useInfiniteQuery on tanstack/react-query
 */
function useInfiniteQuery(schema, input, { transport, pageParamKey, getNextPageParam, ...queryOptions }) {
	const transportFromCtx = useTransport();
	const baseOptions = createInfiniteQueryOptions(schema, input, {
		transport: transport ?? transportFromCtx,
		getNextPageParam,
		pageParamKey,
	});
	return useInfiniteQuery$1({
		...baseOptions,
		...queryOptions,
	});
}

// Copyright 2021-2023 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
 * Query the method provided. Maps to useQuery on tanstack/react-query
 */
function useQuery(schema, input, { transport, ...queryOptions } = {}) {
	const transportFromCtx = useTransport();
	const baseOptions = createQueryOptions(schema, input, {
		transport: transport ?? transportFromCtx,
	});
	return useQuery$1({
		...baseOptions,
		...queryOptions,
	});
}

const { useCallback: useCallback$3 } = await importShared("react");
/**
 * Query the method provided. Maps to useMutation on tanstack/react-query
 */
function useMutation(schema, { transport, ...queryOptions } = {}) {
	const transportFromCtx = useTransport();
	const transportToUse = transport ?? transportFromCtx;
	const mutationFn = useCallback$3(async (input) => callUnaryMethod(transportToUse, schema, input), [transportToUse, schema]);
	return useMutation$1({
		...queryOptions,
		mutationFn,
	});
}

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/common.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/common.proto.
 */
const file_blockninja_v1_common = /*@__PURE__*/ fileDesc(
	"ChpibG9ja25pbmphL3YxL2NvbW1vbi5wcm90bxINYmxvY2tuaW5qYS52MSItCgpQYWdpbmF0aW9uEgwKBHBhZ2UYASABKAUSEQoJcGFnZV9zaXplGAIgASgFIlkKElBhZ2luYXRpb25SZXNwb25zZRINCgV0b3RhbBgBIAEoBRIMCgRwYWdlGAIgASgFEhEKCXBhZ2Vfc2l6ZRgDIAEoBRITCgt0b3RhbF9wYWdlcxgEIAEoBULBAQoRY29tLmJsb2NrbmluamEudjFCC0NvbW1vblByb3RvUAFaSmdpdC5kZXYuYWxleGR1bm1vdy5jb20vYmxvY2svbmluamEvaW50ZXJuYWwvYXBpL2Jsb2NrbmluamEvdjE7YmxvY2tuaW5qYXYxogIDQlhYqgINQmxvY2tuaW5qYS5WMcoCDUJsb2NrbmluamFcVjHiAhlCbG9ja25pbmphXFYxXEdQQk1ldGFkYXRh6gIOQmxvY2tuaW5qYTo6VjFiBnByb3RvMw",
);

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/auth.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/auth.proto.
 */
const file_blockninja_v1_auth = /*@__PURE__*/ fileDesc(
	"ChhibG9ja25pbmphL3YxL2F1dGgucHJvdG8SDWJsb2NrbmluamEudjEiLwoMTG9naW5SZXF1ZXN0Eg0KBWVtYWlsGAEgASgJEhAKCHBhc3N3b3JkGAIgASgJIjcKDUxvZ2luUmVzcG9uc2USJgoEdXNlchgBIAEoCzIYLmJsb2NrbmluamEudjEuQWRtaW5Vc2VyIg8KDUxvZ291dFJlcXVlc3QiEAoOTG9nb3V0UmVzcG9uc2UiFwoVUmVmcmVzaFNlc3Npb25SZXF1ZXN0IkAKFlJlZnJlc2hTZXNzaW9uUmVzcG9uc2USJgoEdXNlchgBIAEoCzIYLmJsb2NrbmluamEudjEuQWRtaW5Vc2VyIhcKFUdldEN1cnJlbnRVc2VyUmVxdWVzdCJAChZHZXRDdXJyZW50VXNlclJlc3BvbnNlEiYKBHVzZXIYASABKAsyGC5ibG9ja25pbmphLnYxLkFkbWluVXNlciIeChxMaXN0QXV0aG9yaXplZERldmljZXNSZXF1ZXN0IlEKHUxpc3RBdXRob3JpemVkRGV2aWNlc1Jlc3BvbnNlEjAKB2RldmljZXMYASADKAsyHy5ibG9ja25pbmphLnYxLkF1dGhvcml6ZWREZXZpY2UiOQodUmV2b2tlQXV0aG9yaXplZERldmljZVJlcXVlc3QSGAoQYXV0aG9yaXphdGlvbl9pZBgBIAEoCSIgCh5SZXZva2VBdXRob3JpemVkRGV2aWNlUmVzcG9uc2UirAIKEEF1dGhvcml6ZWREZXZpY2USCgoCaWQYASABKAkSEQoJY2xpZW50X2lkGAIgASgJEhcKCnVzZXJfYWdlbnQYAyABKAlIAIgBARIXCgppcF9hZGRyZXNzGAQgASgJSAGIAQESMQoNYXV0aG9yaXplZF9hdBgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASLgoKZXhwaXJlc19hdBgGIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASNQoMbGFzdF9zZWVuX2F0GAcgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEgCiAEBQg0KC191c2VyX2FnZW50Qg0KC19pcF9hZGRyZXNzQg8KDV9sYXN0X3NlZW5fYXQiRwoVQ2hhbmdlUGFzc3dvcmRSZXF1ZXN0EhgKEGN1cnJlbnRfcGFzc3dvcmQYASABKAkSFAoMbmV3X3Bhc3N3b3JkGAIgASgJIhgKFkNoYW5nZVBhc3N3b3JkUmVzcG9uc2UiLwoXU2V0TG9jYWxQYXNzd29yZFJlcXVlc3QSFAoMbmV3X3Bhc3N3b3JkGAEgASgJIhoKGFNldExvY2FsUGFzc3dvcmRSZXNwb25zZSIsChtSZXF1ZXN0UGFzc3dvcmRSZXNldFJlcXVlc3QSDQoFZW1haWwYASABKAkiHgocUmVxdWVzdFBhc3N3b3JkUmVzZXRSZXNwb25zZSI7ChRSZXNldFBhc3N3b3JkUmVxdWVzdBINCgV0b2tlbhgBIAEoCRIUCgxuZXdfcGFzc3dvcmQYAiABKAkiFwoVUmVzZXRQYXNzd29yZFJlc3BvbnNlIpIECglBZG1pblVzZXISCgoCaWQYASABKAkSDQoFZW1haWwYAiABKAkSIQoEcm9sZRgDIAEoDjITLmJsb2NrbmluamEudjEuUm9sZRISCgpmaXJzdF9uYW1lGAQgASgJEhEKCWxhc3RfbmFtZRgFIAEoCRIRCglpc19hY3RpdmUYBiABKAgSNgoNbGFzdF9sb2dpbl9hdBgHIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBIAIgBARIuCgpjcmVhdGVkX2F0GAggASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIuCgp1cGRhdGVkX2F0GAkgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIPCgdoYXNfc3NvGAogASgIEhoKEmhhc19sb2NhbF9wYXNzd29yZBgLIAEoCBISCgppc19wZW5kaW5nGAwgASgIEjMKCmludml0ZWRfYXQYDSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wSAGIAQESGgoNaW52aXRlZF9ieV9pZBgOIAEoCUgCiAEBEhwKD2ludml0ZWRfYnlfbmFtZRgPIAEoCUgDiAEBQhAKDl9sYXN0X2xvZ2luX2F0Qg0KC19pbnZpdGVkX2F0QhAKDl9pbnZpdGVkX2J5X2lkQhIKEF9pbnZpdGVkX2J5X25hbWUqUgoEUm9sZRIUChBST0xFX1VOU1BFQ0lGSUVEEAASDgoKUk9MRV9BRE1JThABEhMKD1JPTEVfU1VQRVJBRE1JThACEg8KC1JPTEVfVklFV0VSEAMy0gcKC0F1dGhTZXJ2aWNlEkIKBUxvZ2luEhsuYmxvY2tuaW5qYS52MS5Mb2dpblJlcXVlc3QaHC5ibG9ja25pbmphLnYxLkxvZ2luUmVzcG9uc2USRQoGTG9nb3V0EhwuYmxvY2tuaW5qYS52MS5Mb2dvdXRSZXF1ZXN0Gh0uYmxvY2tuaW5qYS52MS5Mb2dvdXRSZXNwb25zZRJdCg5SZWZyZXNoU2Vzc2lvbhIkLmJsb2NrbmluamEudjEuUmVmcmVzaFNlc3Npb25SZXF1ZXN0GiUuYmxvY2tuaW5qYS52MS5SZWZyZXNoU2Vzc2lvblJlc3BvbnNlEl0KDkdldEN1cnJlbnRVc2VyEiQuYmxvY2tuaW5qYS52MS5HZXRDdXJyZW50VXNlclJlcXVlc3QaJS5ibG9ja25pbmphLnYxLkdldEN1cnJlbnRVc2VyUmVzcG9uc2UScgoVTGlzdEF1dGhvcml6ZWREZXZpY2VzEisuYmxvY2tuaW5qYS52MS5MaXN0QXV0aG9yaXplZERldmljZXNSZXF1ZXN0GiwuYmxvY2tuaW5qYS52MS5MaXN0QXV0aG9yaXplZERldmljZXNSZXNwb25zZRJ1ChZSZXZva2VBdXRob3JpemVkRGV2aWNlEiwuYmxvY2tuaW5qYS52MS5SZXZva2VBdXRob3JpemVkRGV2aWNlUmVxdWVzdBotLmJsb2NrbmluamEudjEuUmV2b2tlQXV0aG9yaXplZERldmljZVJlc3BvbnNlEl0KDkNoYW5nZVBhc3N3b3JkEiQuYmxvY2tuaW5qYS52MS5DaGFuZ2VQYXNzd29yZFJlcXVlc3QaJS5ibG9ja25pbmphLnYxLkNoYW5nZVBhc3N3b3JkUmVzcG9uc2USYwoQU2V0TG9jYWxQYXNzd29yZBImLmJsb2NrbmluamEudjEuU2V0TG9jYWxQYXNzd29yZFJlcXVlc3QaJy5ibG9ja25pbmphLnYxLlNldExvY2FsUGFzc3dvcmRSZXNwb25zZRJvChRSZXF1ZXN0UGFzc3dvcmRSZXNldBIqLmJsb2NrbmluamEudjEuUmVxdWVzdFBhc3N3b3JkUmVzZXRSZXF1ZXN0GisuYmxvY2tuaW5qYS52MS5SZXF1ZXN0UGFzc3dvcmRSZXNldFJlc3BvbnNlEloKDVJlc2V0UGFzc3dvcmQSIy5ibG9ja25pbmphLnYxLlJlc2V0UGFzc3dvcmRSZXF1ZXN0GiQuYmxvY2tuaW5qYS52MS5SZXNldFBhc3N3b3JkUmVzcG9uc2VCvwEKEWNvbS5ibG9ja25pbmphLnYxQglBdXRoUHJvdG9QAVpKZ2l0LmRldi5hbGV4ZHVubW93LmNvbS9ibG9jay9uaW5qYS9pbnRlcm5hbC9hcGkvYmxvY2tuaW5qYS92MTtibG9ja25pbmphdjGiAgNCWFiqAg1CbG9ja25pbmphLlYxygINQmxvY2tuaW5qYVxWMeICGUJsb2NrbmluamFcVjFcR1BCTWV0YWRhdGHqAg5CbG9ja25pbmphOjpWMWIGcHJvdG8z",
	[file_blockninja_v1_common, file_google_protobuf_timestamp],
);
/**
 * @generated from enum blockninja.v1.Role
 */
var Role;
(function (Role) {
	/**
	 * @generated from enum value: ROLE_UNSPECIFIED = 0;
	 */
	Role[(Role["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: ROLE_ADMIN = 1;
	 */
	Role[(Role["ADMIN"] = 1)] = "ADMIN";
	/**
	 * @generated from enum value: ROLE_SUPERADMIN = 2;
	 */
	Role[(Role["SUPERADMIN"] = 2)] = "SUPERADMIN";
	/**
	 * @generated from enum value: ROLE_VIEWER = 3;
	 */
	Role[(Role["VIEWER"] = 3)] = "VIEWER";
})(Role || (Role = {}));
/**
 * @generated from service blockninja.v1.AuthService
 */
const AuthService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_auth, 0);

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/admin.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/admin.proto.
 */
const file_blockninja_v1_admin = /*@__PURE__*/ fileDesc(
	"ChlibG9ja25pbmphL3YxL2FkbWluLnByb3RvEg1ibG9ja25pbmphLnYxItkBChVMaXN0QWRtaW5Vc2Vyc1JlcXVlc3QSLQoKcGFnaW5hdGlvbhgBIAEoCzIZLmJsb2NrbmluamEudjEuUGFnaW5hdGlvbhItCgtyb2xlX2ZpbHRlchgCIAEoDjITLmJsb2NrbmluamEudjEuUm9sZUgAiAEBEh0KEGlzX2FjdGl2ZV9maWx0ZXIYAyABKAhIAYgBARITCgZzZWFyY2gYBCABKAlIAogBAUIOCgxfcm9sZV9maWx0ZXJCEwoRX2lzX2FjdGl2ZV9maWx0ZXJCCQoHX3NlYXJjaCJ4ChZMaXN0QWRtaW5Vc2Vyc1Jlc3BvbnNlEicKBXVzZXJzGAEgAygLMhguYmxvY2tuaW5qYS52MS5BZG1pblVzZXISNQoKcGFnaW5hdGlvbhgCIAEoCzIhLmJsb2NrbmluamEudjEuUGFnaW5hdGlvblJlc3BvbnNlIiEKE0dldEFkbWluVXNlclJlcXVlc3QSCgoCaWQYASABKAkiPgoUR2V0QWRtaW5Vc2VyUmVzcG9uc2USJgoEdXNlchgBIAEoCzIYLmJsb2NrbmluamEudjEuQWRtaW5Vc2VyInEKFkludml0ZUFkbWluVXNlclJlcXVlc3QSDQoFZW1haWwYASABKAkSIQoEcm9sZRgCIAEoDjITLmJsb2NrbmluamEudjEuUm9sZRISCgpmaXJzdF9uYW1lGAMgASgJEhEKCWxhc3RfbmFtZRgEIAEoCSJVChdJbnZpdGVBZG1pblVzZXJSZXNwb25zZRImCgR1c2VyGAEgASgLMhguYmxvY2tuaW5qYS52MS5BZG1pblVzZXISEgoKZW1haWxfc2VudBgCIAEoCCImChVWYWxpZGF0ZUludml0ZVJlcXVlc3QSDQoFdG9rZW4YASABKAkilAEKFlZhbGlkYXRlSW52aXRlUmVzcG9uc2USDQoFdmFsaWQYASABKAgSDQoFZW1haWwYAiABKAkSEgoKZmlyc3RfbmFtZRgDIAEoCRIRCglsYXN0X25hbWUYBCABKAkSIQoEcm9sZRgFIAEoDjITLmJsb2NrbmluamEudjEuUm9sZRISCgpleHBpcmVzX2F0GAYgASgJIjYKE0FjY2VwdEludml0ZVJlcXVlc3QSDQoFdG9rZW4YASABKAkSEAoIcGFzc3dvcmQYAiABKAkiPgoUQWNjZXB0SW52aXRlUmVzcG9uc2USJgoEdXNlchgBIAEoCzIYLmJsb2NrbmluamEudjEuQWRtaW5Vc2VyIiYKE1Jlc2VuZEludml0ZVJlcXVlc3QSDwoHdXNlcl9pZBgBIAEoCSI7ChRSZXNlbmRJbnZpdGVSZXNwb25zZRIPCgdzdWNjZXNzGAEgASgIEhIKCmVtYWlsX3NlbnQYAiABKAgiJgoTQ2FuY2VsSW52aXRlUmVxdWVzdBIPCgd1c2VyX2lkGAEgASgJIicKFENhbmNlbEludml0ZVJlc3BvbnNlEg8KB3N1Y2Nlc3MYASABKAgi5wEKFlVwZGF0ZUFkbWluVXNlclJlcXVlc3QSCgoCaWQYASABKAkSEgoFZW1haWwYAiABKAlIAIgBARImCgRyb2xlGAMgASgOMhMuYmxvY2tuaW5qYS52MS5Sb2xlSAGIAQESFwoKZmlyc3RfbmFtZRgEIAEoCUgCiAEBEhYKCWxhc3RfbmFtZRgFIAEoCUgDiAEBEhYKCWlzX2FjdGl2ZRgGIAEoCEgEiAEBQggKBl9lbWFpbEIHCgVfcm9sZUINCgtfZmlyc3RfbmFtZUIMCgpfbGFzdF9uYW1lQgwKCl9pc19hY3RpdmUiQQoXVXBkYXRlQWRtaW5Vc2VyUmVzcG9uc2USJgoEdXNlchgBIAEoCzIYLmJsb2NrbmluamEudjEuQWRtaW5Vc2VyIjcKFkRlbGV0ZUFkbWluVXNlclJlcXVlc3QSCgoCaWQYASABKAkSEQoJcGVybWFuZW50GAIgASgIIhkKF0RlbGV0ZUFkbWluVXNlclJlc3BvbnNlImQKFFVwZGF0ZVByb2ZpbGVSZXF1ZXN0EhcKCmZpcnN0X25hbWUYASABKAlIAIgBARIWCglsYXN0X25hbWUYAiABKAlIAYgBAUINCgtfZmlyc3RfbmFtZUIMCgpfbGFzdF9uYW1lIj8KFVVwZGF0ZVByb2ZpbGVSZXNwb25zZRImCgR1c2VyGAEgASgLMhguYmxvY2tuaW5qYS52MS5BZG1pblVzZXIysgcKDEFkbWluU2VydmljZRJdCg5MaXN0QWRtaW5Vc2VycxIkLmJsb2NrbmluamEudjEuTGlzdEFkbWluVXNlcnNSZXF1ZXN0GiUuYmxvY2tuaW5qYS52MS5MaXN0QWRtaW5Vc2Vyc1Jlc3BvbnNlElcKDEdldEFkbWluVXNlchIiLmJsb2NrbmluamEudjEuR2V0QWRtaW5Vc2VyUmVxdWVzdBojLmJsb2NrbmluamEudjEuR2V0QWRtaW5Vc2VyUmVzcG9uc2USYAoPVXBkYXRlQWRtaW5Vc2VyEiUuYmxvY2tuaW5qYS52MS5VcGRhdGVBZG1pblVzZXJSZXF1ZXN0GiYuYmxvY2tuaW5qYS52MS5VcGRhdGVBZG1pblVzZXJSZXNwb25zZRJgCg9EZWxldGVBZG1pblVzZXISJS5ibG9ja25pbmphLnYxLkRlbGV0ZUFkbWluVXNlclJlcXVlc3QaJi5ibG9ja25pbmphLnYxLkRlbGV0ZUFkbWluVXNlclJlc3BvbnNlEloKDVVwZGF0ZVByb2ZpbGUSIy5ibG9ja25pbmphLnYxLlVwZGF0ZVByb2ZpbGVSZXF1ZXN0GiQuYmxvY2tuaW5qYS52MS5VcGRhdGVQcm9maWxlUmVzcG9uc2USYAoPSW52aXRlQWRtaW5Vc2VyEiUuYmxvY2tuaW5qYS52MS5JbnZpdGVBZG1pblVzZXJSZXF1ZXN0GiYuYmxvY2tuaW5qYS52MS5JbnZpdGVBZG1pblVzZXJSZXNwb25zZRJdCg5WYWxpZGF0ZUludml0ZRIkLmJsb2NrbmluamEudjEuVmFsaWRhdGVJbnZpdGVSZXF1ZXN0GiUuYmxvY2tuaW5qYS52MS5WYWxpZGF0ZUludml0ZVJlc3BvbnNlElcKDEFjY2VwdEludml0ZRIiLmJsb2NrbmluamEudjEuQWNjZXB0SW52aXRlUmVxdWVzdBojLmJsb2NrbmluamEudjEuQWNjZXB0SW52aXRlUmVzcG9uc2USVwoMUmVzZW5kSW52aXRlEiIuYmxvY2tuaW5qYS52MS5SZXNlbmRJbnZpdGVSZXF1ZXN0GiMuYmxvY2tuaW5qYS52MS5SZXNlbmRJbnZpdGVSZXNwb25zZRJXCgxDYW5jZWxJbnZpdGUSIi5ibG9ja25pbmphLnYxLkNhbmNlbEludml0ZVJlcXVlc3QaIy5ibG9ja25pbmphLnYxLkNhbmNlbEludml0ZVJlc3BvbnNlQsABChFjb20uYmxvY2tuaW5qYS52MUIKQWRtaW5Qcm90b1ABWkpnaXQuZGV2LmFsZXhkdW5tb3cuY29tL2Jsb2NrL25pbmphL2ludGVybmFsL2FwaS9ibG9ja25pbmphL3YxO2Jsb2NrbmluamF2MaICA0JYWKoCDUJsb2NrbmluamEuVjHKAg1CbG9ja25pbmphXFYx4gIZQmxvY2tuaW5qYVxWMVxHUEJNZXRhZGF0YeoCDkJsb2NrbmluamE6OlYxYgZwcm90bzM",
	[file_blockninja_v1_common, file_blockninja_v1_auth],
);
/**
 * @generated from service blockninja.v1.AdminService
 */
const AdminService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_admin, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/admin.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.AdminService.ListAdminUsers
 */
AdminService.method.listAdminUsers;
/**
 * @generated from rpc blockninja.v1.AdminService.GetAdminUser
 */
AdminService.method.getAdminUser;
/**
 * @generated from rpc blockninja.v1.AdminService.UpdateAdminUser
 */
AdminService.method.updateAdminUser;
/**
 * @generated from rpc blockninja.v1.AdminService.DeleteAdminUser
 */
AdminService.method.deleteAdminUser;
/**
 * @generated from rpc blockninja.v1.AdminService.UpdateProfile
 */
AdminService.method.updateProfile;
/**
 * Invite-only workflow (replaces CreateAdminUser)
 *
 * @generated from rpc blockninja.v1.AdminService.InviteAdminUser
 */
AdminService.method.inviteAdminUser;
/**
 * @generated from rpc blockninja.v1.AdminService.ValidateInvite
 */
AdminService.method.validateInvite;
/**
 * @generated from rpc blockninja.v1.AdminService.AcceptInvite
 */
AdminService.method.acceptInvite;
/**
 * @generated from rpc blockninja.v1.AdminService.ResendInvite
 */
AdminService.method.resendInvite;
/**
 * @generated from rpc blockninja.v1.AdminService.CancelInvite
 */
AdminService.method.cancelInvite;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/ai.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/ai.proto.
 */
const file_blockninja_v1_ai = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_timestamp],
);
/**
 * AI provider types
 *
 * @generated from enum blockninja.v1.AIProvider
 */
var AIProvider;
(function (AIProvider) {
	/**
	 * @generated from enum value: AI_PROVIDER_UNSPECIFIED = 0;
	 */
	AIProvider[(AIProvider["AI_PROVIDER_UNSPECIFIED"] = 0)] = "AI_PROVIDER_UNSPECIFIED";
	/**
	 * @generated from enum value: AI_PROVIDER_OPENAI = 1;
	 */
	AIProvider[(AIProvider["AI_PROVIDER_OPENAI"] = 1)] = "AI_PROVIDER_OPENAI";
	/**
	 * @generated from enum value: AI_PROVIDER_ANTHROPIC = 2;
	 */
	AIProvider[(AIProvider["AI_PROVIDER_ANTHROPIC"] = 2)] = "AI_PROVIDER_ANTHROPIC";
})(AIProvider || (AIProvider = {}));
/**
 * AI Task types for the action matrix
 *
 * @generated from enum blockninja.v1.AITask
 */
var AITask;
(function (AITask) {
	/**
	 * @generated from enum value: AI_TASK_UNSPECIFIED = 0;
	 */
	AITask[(AITask["AI_TASK_UNSPECIFIED"] = 0)] = "AI_TASK_UNSPECIFIED";
	/**
	 * Generate alt text for images
	 *
	 * @generated from enum value: AI_TASK_IMAGE_ALT_TEXT = 1;
	 */
	AITask[(AITask["AI_TASK_IMAGE_ALT_TEXT"] = 1)] = "AI_TASK_IMAGE_ALT_TEXT";
	/**
	 * Generate tags for images
	 *
	 * @generated from enum value: AI_TASK_IMAGE_TAGS = 2;
	 */
	AITask[(AITask["AI_TASK_IMAGE_TAGS"] = 2)] = "AI_TASK_IMAGE_TAGS";
	/**
	 * Generate content ideas
	 *
	 * @generated from enum value: AI_TASK_CONTENT_SUGGESTIONS = 3;
	 */
	AITask[(AITask["AI_TASK_CONTENT_SUGGESTIONS"] = 3)] = "AI_TASK_CONTENT_SUGGESTIONS";
	/**
	 * Generate meta descriptions
	 *
	 * @generated from enum value: AI_TASK_META_DESCRIPTION = 4;
	 */
	AITask[(AITask["AI_TASK_META_DESCRIPTION"] = 4)] = "AI_TASK_META_DESCRIPTION";
	/**
	 * Generate smart blocks from prompts
	 *
	 * @generated from enum value: AI_TASK_SMART_BLOCK = 5;
	 */
	AITask[(AITask["AI_TASK_SMART_BLOCK"] = 5)] = "AI_TASK_SMART_BLOCK";
	/**
	 * Assist/modify existing smart blocks
	 *
	 * @generated from enum value: AI_TASK_SMART_BLOCK_ASSIST = 6;
	 */
	AITask[(AITask["AI_TASK_SMART_BLOCK_ASSIST"] = 6)] = "AI_TASK_SMART_BLOCK_ASSIST";
	/**
	 * Generate maintenance/coming soon messages
	 *
	 * @generated from enum value: AI_TASK_SITE_STATUS_MESSAGE = 7;
	 */
	AITask[(AITask["AI_TASK_SITE_STATUS_MESSAGE"] = 7)] = "AI_TASK_SITE_STATUS_MESSAGE";
	/**
	 * Generate block title from content
	 *
	 * @generated from enum value: AI_TASK_BLOCK_TITLE = 8;
	 */
	AITask[(AITask["AI_TASK_BLOCK_TITLE"] = 8)] = "AI_TASK_BLOCK_TITLE";
	/**
	 * Generate SEO meta (title, description, OG tags)
	 *
	 * @generated from enum value: AI_TASK_SEO_META = 9;
	 */
	AITask[(AITask["AI_TASK_SEO_META"] = 9)] = "AI_TASK_SEO_META";
})(AITask || (AITask = {}));
/**
 * SEO field types for generation
 *
 * @generated from enum blockninja.v1.SEOFieldType
 */
var SEOFieldType;
(function (SEOFieldType) {
	/**
	 * @generated from enum value: SEO_FIELD_TYPE_UNSPECIFIED = 0;
	 */
	SEOFieldType[(SEOFieldType["SEO_FIELD_TYPE_UNSPECIFIED"] = 0)] = "SEO_FIELD_TYPE_UNSPECIFIED";
	/**
	 * @generated from enum value: SEO_FIELD_TYPE_META_TITLE = 1;
	 */
	SEOFieldType[(SEOFieldType["SEO_FIELD_TYPE_META_TITLE"] = 1)] = "SEO_FIELD_TYPE_META_TITLE";
	/**
	 * @generated from enum value: SEO_FIELD_TYPE_META_DESCRIPTION = 2;
	 */
	SEOFieldType[(SEOFieldType["SEO_FIELD_TYPE_META_DESCRIPTION"] = 2)] = "SEO_FIELD_TYPE_META_DESCRIPTION";
	/**
	 * @generated from enum value: SEO_FIELD_TYPE_OG_TITLE = 3;
	 */
	SEOFieldType[(SEOFieldType["SEO_FIELD_TYPE_OG_TITLE"] = 3)] = "SEO_FIELD_TYPE_OG_TITLE";
	/**
	 * @generated from enum value: SEO_FIELD_TYPE_OG_DESCRIPTION = 4;
	 */
	SEOFieldType[(SEOFieldType["SEO_FIELD_TYPE_OG_DESCRIPTION"] = 4)] = "SEO_FIELD_TYPE_OG_DESCRIPTION";
})(SEOFieldType || (SEOFieldType = {}));
/**
 * AIService manages AI provider API keys and configuration
 *
 * @generated from service blockninja.v1.AIService
 */
const AIService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_ai, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/ai.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * List all AI provider keys (keys are masked)
 *
 * @generated from rpc blockninja.v1.AIService.ListAIKeys
 */
AIService.method.listAIKeys;
/**
 * Add or update an AI provider key
 *
 * @generated from rpc blockninja.v1.AIService.SetAIKey
 */
AIService.method.setAIKey;
/**
 * Delete an AI provider key
 *
 * @generated from rpc blockninja.v1.AIService.DeleteAIKey
 */
AIService.method.deleteAIKey;
/**
 * Test an AI provider key for validity
 *
 * @generated from rpc blockninja.v1.AIService.TestAIKey
 */
AIService.method.testAIKey;
/**
 * List available models for a provider (auto-refreshes if cache is stale)
 *
 * @generated from rpc blockninja.v1.AIService.ListAIModels
 */
AIService.method.listAIModels;
/**
 * Force refresh models cache from provider API
 *
 * @generated from rpc blockninja.v1.AIService.RefreshAIModels
 */
AIService.method.refreshAIModels;
/**
 * Get AI settings (active provider, model, etc.)
 *
 * @generated from rpc blockninja.v1.AIService.GetAISettings
 */
AIService.method.getAISettings;
/**
 * Update AI settings
 *
 * @generated from rpc blockninja.v1.AIService.UpdateAISettings
 */
AIService.method.updateAISettings;
/**
 * Get task-specific AI configuration
 *
 * @generated from rpc blockninja.v1.AIService.GetAITaskConfig
 */
AIService.method.getAITaskConfig;
/**
 * List all task configurations
 *
 * @generated from rpc blockninja.v1.AIService.ListAITaskConfigs
 */
AIService.method.listAITaskConfigs;
/**
 * Set task-specific AI configuration
 *
 * @generated from rpc blockninja.v1.AIService.SetAITaskConfig
 */
AIService.method.setAITaskConfig;
/**
 * Delete task-specific configuration (falls back to default)
 *
 * @generated from rpc blockninja.v1.AIService.DeleteAITaskConfig
 */
AIService.method.deleteAITaskConfig;
/**
 * Generate SEO meta data using AI
 *
 * @generated from rpc blockninja.v1.AIService.GenerateSEOMeta
 */
AIService.method.generateSEOMeta;
/**
 * List all AI actions registered by plugins (static metadata from plugin registry)
 *
 * @generated from rpc blockninja.v1.AIService.ListRegisteredAIActions
 */
AIService.method.listRegisteredAIActions;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/ai_agents.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/ai_agents.proto.
 */
const file_blockninja_v1_ai_agents = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_timestamp],
);
/**
 * @generated from service blockninja.v1.AIAgentService
 */
const AIAgentService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_ai_agents, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/ai_agents.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.AIAgentService.ListAgents
 */
AIAgentService.method.listAgents;
/**
 * @generated from rpc blockninja.v1.AIAgentService.GetAgent
 */
AIAgentService.method.getAgent;
/**
 * @generated from rpc blockninja.v1.AIAgentService.CreateAgent
 */
AIAgentService.method.createAgent;
/**
 * @generated from rpc blockninja.v1.AIAgentService.UpdateAgent
 */
AIAgentService.method.updateAgent;
/**
 * @generated from rpc blockninja.v1.AIAgentService.DeleteAgent
 */
AIAgentService.method.deleteAgent;
/**
 * @generated from rpc blockninja.v1.AIAgentService.ListTools
 */
AIAgentService.method.listTools;
/**
 * @generated from rpc blockninja.v1.AIAgentService.GetTool
 */
AIAgentService.method.getTool;
/**
 * @generated from rpc blockninja.v1.AIAgentService.CreateTool
 */
AIAgentService.method.createTool;
/**
 * @generated from rpc blockninja.v1.AIAgentService.UpdateTool
 */
AIAgentService.method.updateTool;
/**
 * @generated from rpc blockninja.v1.AIAgentService.DeleteTool
 */
AIAgentService.method.deleteTool;
/**
 * @generated from rpc blockninja.v1.AIAgentService.ListRAGCollections
 */
AIAgentService.method.listRAGCollections;
/**
 * @generated from rpc blockninja.v1.AIAgentService.GetRAGCollection
 */
AIAgentService.method.getRAGCollection;
/**
 * @generated from rpc blockninja.v1.AIAgentService.CreateRAGCollection
 */
AIAgentService.method.createRAGCollection;
/**
 * @generated from rpc blockninja.v1.AIAgentService.UpdateRAGCollection
 */
AIAgentService.method.updateRAGCollection;
/**
 * @generated from rpc blockninja.v1.AIAgentService.DeleteRAGCollection
 */
AIAgentService.method.deleteRAGCollection;
/**
 * @generated from rpc blockninja.v1.AIAgentService.IndexRAGCollection
 */
AIAgentService.method.indexRAGCollection;
/**
 * @generated from rpc blockninja.v1.AIAgentService.ListPublicAgents
 */
AIAgentService.method.listPublicAgents;
/**
 * @generated from rpc blockninja.v1.AIAgentService.ListConversations
 */
AIAgentService.method.listConversations;
/**
 * @generated from rpc blockninja.v1.AIAgentService.GetConversation
 */
AIAgentService.method.getConversation;
/**
 * @generated from rpc blockninja.v1.AIAgentService.CreateConversation
 */
AIAgentService.method.createConversation;
/**
 * @generated from rpc blockninja.v1.AIAgentService.DeleteConversation
 */
AIAgentService.method.deleteConversation;
/**
 * @generated from rpc blockninja.v1.AIAgentService.SendMessage
 */
AIAgentService.method.sendMessage;
/**
 * @generated from rpc blockninja.v1.AIAgentService.GetAgentStats
 */
AIAgentService.method.getAgentStats;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/pages.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/pages.proto.
 */
const file_blockninja_v1_pages = /*@__PURE__*/ fileDesc(
	" ",
	[file_blockninja_v1_common, file_google_protobuf_timestamp, file_google_protobuf_struct],
);
/**
 * @generated from enum blockninja.v1.PageStatus
 */
var PageStatus;
(function (PageStatus) {
	/**
	 * @generated from enum value: PAGE_STATUS_UNSPECIFIED = 0;
	 */
	PageStatus[(PageStatus["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: PAGE_STATUS_DRAFT = 1;
	 */
	PageStatus[(PageStatus["DRAFT"] = 1)] = "DRAFT";
	/**
	 * @generated from enum value: PAGE_STATUS_PUBLISHED = 2;
	 */
	PageStatus[(PageStatus["PUBLISHED"] = 2)] = "PUBLISHED";
})(PageStatus || (PageStatus = {}));
/**
 * @generated from enum blockninja.v1.PostType
 */
var PostType;
(function (PostType) {
	/**
	 * @generated from enum value: POST_TYPE_UNSPECIFIED = 0;
	 */
	PostType[(PostType["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: POST_TYPE_PAGE = 1;
	 */
	PostType[(PostType["PAGE"] = 1)] = "PAGE";
	/**
	 * @generated from enum value: POST_TYPE_POST = 2;
	 */
	PostType[(PostType["POST"] = 2)] = "POST";
	/**
	 * @generated from enum value: POST_TYPE_SYSTEM = 3;
	 */
	PostType[(PostType["SYSTEM"] = 3)] = "SYSTEM";
	/**
	 * @generated from enum value: POST_TYPE_REDIRECT = 4;
	 */
	PostType[(PostType["REDIRECT"] = 4)] = "REDIRECT";
	/**
	 * @generated from enum value: POST_TYPE_MASTER = 5;
	 */
	PostType[(PostType["MASTER"] = 5)] = "MASTER";
})(PostType || (PostType = {}));
/**
 * @generated from enum blockninja.v1.SystemPageType
 */
var SystemPageType;
(function (SystemPageType) {
	/**
	 * @generated from enum value: SYSTEM_PAGE_TYPE_UNSPECIFIED = 0;
	 */
	SystemPageType[(SystemPageType["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: SYSTEM_PAGE_TYPE_NOT_FOUND = 1;
	 */
	SystemPageType[(SystemPageType["NOT_FOUND"] = 1)] = "NOT_FOUND";
	/**
	 * @generated from enum value: SYSTEM_PAGE_TYPE_SERVER_ERROR = 2;
	 */
	SystemPageType[(SystemPageType["SERVER_ERROR"] = 2)] = "SERVER_ERROR";
	/**
	 * @generated from enum value: SYSTEM_PAGE_TYPE_MAINTENANCE = 3;
	 */
	SystemPageType[(SystemPageType["MAINTENANCE"] = 3)] = "MAINTENANCE";
	/**
	 * @generated from enum value: SYSTEM_PAGE_TYPE_COMING_SOON = 4;
	 */
	SystemPageType[(SystemPageType["COMING_SOON"] = 4)] = "COMING_SOON";
	/**
	 * @generated from enum value: SYSTEM_PAGE_TYPE_BLOG_POST_TEMPLATE = 5;
	 */
	SystemPageType[(SystemPageType["BLOG_POST_TEMPLATE"] = 5)] = "BLOG_POST_TEMPLATE";
	/**
	 * @generated from enum value: SYSTEM_PAGE_TYPE_AUTHOR = 6;
	 */
	SystemPageType[(SystemPageType["AUTHOR"] = 6)] = "AUTHOR";
	/**
	 * @generated from enum value: SYSTEM_PAGE_TYPE_BLOG_INDEX = 7;
	 */
	SystemPageType[(SystemPageType["BLOG_INDEX"] = 7)] = "BLOG_INDEX";
	/**
	 * @generated from enum value: SYSTEM_PAGE_TYPE_CATEGORY = 8;
	 */
	SystemPageType[(SystemPageType["CATEGORY"] = 8)] = "CATEGORY";
})(SystemPageType || (SystemPageType = {}));
/**
 * @generated from enum blockninja.v1.ChildHandling
 */
var ChildHandling;
(function (ChildHandling) {
	/**
	 * @generated from enum value: CHILD_HANDLING_UNSPECIFIED = 0;
	 */
	ChildHandling[(ChildHandling["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * Delete children with parent
	 *
	 * @generated from enum value: CHILD_HANDLING_CASCADE = 1;
	 */
	ChildHandling[(ChildHandling["CASCADE"] = 1)] = "CASCADE";
	/**
	 * Move children to root level (null parent_id)
	 *
	 * @generated from enum value: CHILD_HANDLING_MOVE_ROOT = 2;
	 */
	ChildHandling[(ChildHandling["MOVE_ROOT"] = 2)] = "MOVE_ROOT";
})(ChildHandling || (ChildHandling = {}));
/**
 * @generated from service blockninja.v1.PagesService
 */
const PagesService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_pages, 0);

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/ai_optimization.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/ai_optimization.proto.
 */
const file_blockninja_v1_ai_optimization = /*@__PURE__*/ fileDesc(
	" ",
	[file_blockninja_v1_pages],
);
/**
 * AIOptimizationService provides AI citation readiness monitoring and optimization
 *
 * @generated from service blockninja.v1.AIOptimizationService
 */
const AIOptimizationService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_ai_optimization, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/ai_optimization.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Get overall AI optimization statistics
 *
 * @generated from rpc blockninja.v1.AIOptimizationService.GetAIOptimizationOverview
 */
AIOptimizationService.method.getAIOptimizationOverview;
/**
 * List pages with AI optimization audit data
 *
 * @generated from rpc blockninja.v1.AIOptimizationService.ListAIOptimizationAudit
 */
AIOptimizationService.method.listAIOptimizationAudit;
/**
 * Analyze AI readiness for a specific page
 *
 * @generated from rpc blockninja.v1.AIOptimizationService.AnalyzePageAIReadiness
 */
AIOptimizationService.method.analyzePageAIReadiness;
/**
 * Update AI optimization fields for a page
 *
 * @generated from rpc blockninja.v1.AIOptimizationService.UpdatePageAIOptimization
 */
AIOptimizationService.method.updatePageAIOptimization;
/**
 * Generate AI summary using AI provider
 *
 * @generated from rpc blockninja.v1.AIOptimizationService.GenerateAISummary
 */
AIOptimizationService.method.generateAISummary;
/**
 * Generate FAQ suggestions using AI provider
 *
 * @generated from rpc blockninja.v1.AIOptimizationService.GenerateFAQSuggestions
 */
AIOptimizationService.method.generateFAQSuggestions;
/**
 * Get llms.txt content (for preview)
 *
 * @generated from rpc blockninja.v1.AIOptimizationService.GetLLMsTxt
 */
AIOptimizationService.method.getLLMsTxt;
/**
 * Generate llms.txt from site structure
 *
 * @generated from rpc blockninja.v1.AIOptimizationService.GenerateLLMsTxt
 */
AIOptimizationService.method.generateLLMsTxt;
/**
 * Extract FAQ items from a block's content
 *
 * @generated from rpc blockninja.v1.AIOptimizationService.ExtractFAQsFromBlock
 */
AIOptimizationService.method.extractFAQsFromBlock;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/analytics.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/analytics.proto.
 */
const file_blockninja_v1_analytics = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_timestamp],
);
/**
 * @generated from enum blockninja.v1.AnalyticsTimeRange
 */
var AnalyticsTimeRange;
(function (AnalyticsTimeRange) {
	/**
	 * @generated from enum value: ANALYTICS_TIME_RANGE_UNSPECIFIED = 0;
	 */
	AnalyticsTimeRange[(AnalyticsTimeRange["ANALYTICS_TIME_RANGE_UNSPECIFIED"] = 0)] = "ANALYTICS_TIME_RANGE_UNSPECIFIED";
	/**
	 * @generated from enum value: ANALYTICS_TIME_RANGE_TODAY = 1;
	 */
	AnalyticsTimeRange[(AnalyticsTimeRange["ANALYTICS_TIME_RANGE_TODAY"] = 1)] = "ANALYTICS_TIME_RANGE_TODAY";
	/**
	 * @generated from enum value: ANALYTICS_TIME_RANGE_YESTERDAY = 2;
	 */
	AnalyticsTimeRange[(AnalyticsTimeRange["ANALYTICS_TIME_RANGE_YESTERDAY"] = 2)] = "ANALYTICS_TIME_RANGE_YESTERDAY";
	/**
	 * @generated from enum value: ANALYTICS_TIME_RANGE_7_DAYS = 3;
	 */
	AnalyticsTimeRange[(AnalyticsTimeRange["ANALYTICS_TIME_RANGE_7_DAYS"] = 3)] = "ANALYTICS_TIME_RANGE_7_DAYS";
	/**
	 * @generated from enum value: ANALYTICS_TIME_RANGE_30_DAYS = 4;
	 */
	AnalyticsTimeRange[(AnalyticsTimeRange["ANALYTICS_TIME_RANGE_30_DAYS"] = 4)] = "ANALYTICS_TIME_RANGE_30_DAYS";
	/**
	 * @generated from enum value: ANALYTICS_TIME_RANGE_90_DAYS = 5;
	 */
	AnalyticsTimeRange[(AnalyticsTimeRange["ANALYTICS_TIME_RANGE_90_DAYS"] = 5)] = "ANALYTICS_TIME_RANGE_90_DAYS";
	/**
	 * @generated from enum value: ANALYTICS_TIME_RANGE_CUSTOM = 6;
	 */
	AnalyticsTimeRange[(AnalyticsTimeRange["ANALYTICS_TIME_RANGE_CUSTOM"] = 6)] = "ANALYTICS_TIME_RANGE_CUSTOM";
})(AnalyticsTimeRange || (AnalyticsTimeRange = {}));
/**
 * AnalyticsService provides analytics data for the admin dashboard
 *
 * @generated from service blockninja.v1.AnalyticsService
 */
const AnalyticsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_analytics, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/analytics.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Get overview stats (pageviews, visitors, sessions)
 *
 * @generated from rpc blockninja.v1.AnalyticsService.GetAnalyticsOverview
 */
AnalyticsService.method.getAnalyticsOverview;
/**
 * Get top pages by views
 *
 * @generated from rpc blockninja.v1.AnalyticsService.GetTopPages
 */
AnalyticsService.method.getTopPages;
/**
 * Get top referrers
 *
 * @generated from rpc blockninja.v1.AnalyticsService.GetTopReferrers
 */
AnalyticsService.method.getTopReferrers;
/**
 * Get top campaigns
 *
 * @generated from rpc blockninja.v1.AnalyticsService.GetTopCampaigns
 */
AnalyticsService.method.getTopCampaigns;
/**
 * Get top countries
 *
 * @generated from rpc blockninja.v1.AnalyticsService.GetTopCountries
 */
AnalyticsService.method.getTopCountries;
/**
 * Get device breakdown
 *
 * @generated from rpc blockninja.v1.AnalyticsService.GetDeviceBreakdown
 */
AnalyticsService.method.getDeviceBreakdown;
/**
 * Get browser breakdown
 *
 * @generated from rpc blockninja.v1.AnalyticsService.GetBrowserBreakdown
 */
AnalyticsService.method.getBrowserBreakdown;
/**
 * Get top search terms
 *
 * @generated from rpc blockninja.v1.AnalyticsService.GetTopSearchTerms
 */
AnalyticsService.method.getTopSearchTerms;
/**
 * Get pageviews timeseries
 *
 * @generated from rpc blockninja.v1.AnalyticsService.GetPageviewsTimeseries
 */
AnalyticsService.method.getPageviewsTimeseries;
/**
 * Get real-time active visitor count
 *
 * @generated from rpc blockninja.v1.AnalyticsService.GetActiveVisitorCount
 */
AnalyticsService.method.getActiveVisitorCount;
/**
 * Get analytics for a specific page
 *
 * @generated from rpc blockninja.v1.AnalyticsService.GetPageAnalytics
 */
AnalyticsService.method.getPageAnalytics;
/**
 * Get tracking source breakdown (server-only vs client-tracked)
 *
 * @generated from rpc blockninja.v1.AnalyticsService.GetTrackingSourceBreakdown
 */
AnalyticsService.method.getTrackingSourceBreakdown;
/**
 * Ignored IPs - exclude internal traffic from stats
 *
 * @generated from rpc blockninja.v1.AnalyticsService.ListIgnoredIPs
 */
AnalyticsService.method.listIgnoredIPs;
/**
 * @generated from rpc blockninja.v1.AnalyticsService.CreateIgnoredIP
 */
AnalyticsService.method.createIgnoredIP;
/**
 * @generated from rpc blockninja.v1.AnalyticsService.DeleteIgnoredIP
 */
AnalyticsService.method.deleteIgnoredIP;
/**
 * Get the caller's public IP address (for "Ignore Me" feature)
 *
 * @generated from rpc blockninja.v1.AnalyticsService.GetMyIP
 */
AnalyticsService.method.getMyIP;
/**
 * Reset all analytics data (superadmin only)
 *
 * @generated from rpc blockninja.v1.AnalyticsService.ResetAnalytics
 */
AnalyticsService.method.resetAnalytics;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/audit.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/audit.proto.
 */
const file_blockninja_v1_audit = /*@__PURE__*/ fileDesc(
	"ChlibG9ja25pbmphL3YxL2F1ZGl0LnByb3RvEg1ibG9ja25pbmphLnYxIsgECghBdWRpdExvZxIKCgJpZBgBIAEoCRIVCghhY3Rvcl9pZBgCIAEoCUgAiAEBEhgKC2FjdG9yX2VtYWlsGAMgASgJSAGIAQESKgoGYWN0aW9uGAQgASgOMhouYmxvY2tuaW5qYS52MS5BdWRpdEFjdGlvbhIuCghyZXNvdXJjZRgFIAEoDjIcLmJsb2NrbmluamEudjEuQXVkaXRSZXNvdXJjZRIYCgtyZXNvdXJjZV9pZBgGIAEoCUgCiAEBEhcKCmlwX2FkZHJlc3MYByABKAlIA4gBARIXCgp1c2VyX2FnZW50GAggASgJSASIAQESGwoOcmVxdWVzdF9tZXRob2QYCSABKAlIBYgBARIZCgxyZXF1ZXN0X3BhdGgYCiABKAlIBogBARIZCgxyZXF1ZXN0X2JvZHkYCyABKAlIB4gBARIcCg9yZXNwb25zZV9zdGF0dXMYDCABKAVICIgBARIVCghtZXRhZGF0YRgNIAEoCUgJiAEBEi4KCmNyZWF0ZWRfYXQYDiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgsKCV9hY3Rvcl9pZEIOCgxfYWN0b3JfZW1haWxCDgoMX3Jlc291cmNlX2lkQg0KC19pcF9hZGRyZXNzQg0KC191c2VyX2FnZW50QhEKD19yZXF1ZXN0X21ldGhvZEIPCg1fcmVxdWVzdF9wYXRoQg8KDV9yZXF1ZXN0X2JvZHlCEgoQX3Jlc3BvbnNlX3N0YXR1c0ILCglfbWV0YWRhdGEilQMKFExpc3RBdWRpdExvZ3NSZXF1ZXN0Ei0KCnBhZ2luYXRpb24YASABKAsyGS5ibG9ja25pbmphLnYxLlBhZ2luYXRpb24SFQoIYWN0b3JfaWQYAiABKAlIAIgBARIvCgZhY3Rpb24YAyABKA4yGi5ibG9ja25pbmphLnYxLkF1ZGl0QWN0aW9uSAGIAQESMwoIcmVzb3VyY2UYBCABKA4yHC5ibG9ja25pbmphLnYxLkF1ZGl0UmVzb3VyY2VIAogBARIYCgtyZXNvdXJjZV9pZBgFIAEoCUgDiAEBEjMKCnN0YXJ0X2RhdGUYBiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wSASIAQESMQoIZW5kX2RhdGUYByABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wSAWIAQFCCwoJX2FjdG9yX2lkQgkKB19hY3Rpb25CCwoJX3Jlc291cmNlQg4KDF9yZXNvdXJjZV9pZEINCgtfc3RhcnRfZGF0ZUILCglfZW5kX2RhdGUidQoVTGlzdEF1ZGl0TG9nc1Jlc3BvbnNlEiUKBGxvZ3MYASADKAsyFy5ibG9ja25pbmphLnYxLkF1ZGl0TG9nEjUKCnBhZ2luYXRpb24YAiABKAsyIS5ibG9ja25pbmphLnYxLlBhZ2luYXRpb25SZXNwb25zZSIgChJHZXRBdWRpdExvZ1JlcXVlc3QSCgoCaWQYASABKAkiOwoTR2V0QXVkaXRMb2dSZXNwb25zZRIkCgNsb2cYASABKAsyFy5ibG9ja25pbmphLnYxLkF1ZGl0TG9nKtsCCgtBdWRpdEFjdGlvbhIcChhBVURJVF9BQ1RJT05fVU5TUEVDSUZJRUQQABIeChpBVURJVF9BQ1RJT05fTE9HSU5fU1VDQ0VTUxABEh4KGkFVRElUX0FDVElPTl9MT0dJTl9GQUlMVVJFEAISFwoTQVVESVRfQUNUSU9OX0xPR09VVBADEiAKHEFVRElUX0FDVElPTl9QQVNTV09SRF9DSEFOR0UQBBInCiNBVURJVF9BQ1RJT05fUEFTU1dPUkRfUkVTRVRfUkVRVUVTVBAFEigKJEFVRElUX0FDVElPTl9QQVNTV09SRF9SRVNFVF9DT01QTEVURRAGEhcKE0FVRElUX0FDVElPTl9DUkVBVEUQBxIVChFBVURJVF9BQ1RJT05fUkVBRBAIEhcKE0FVRElUX0FDVElPTl9VUERBVEUQCRIXChNBVURJVF9BQ1RJT05fREVMRVRFEAoqngEKDUF1ZGl0UmVzb3VyY2USHgoaQVVESVRfUkVTT1VSQ0VfVU5TUEVDSUZJRUQQABIXChNBVURJVF9SRVNPVVJDRV9BVVRIEAESHQoZQVVESVRfUkVTT1VSQ0VfQURNSU5fVVNFUhACEhoKFkFVRElUX1JFU09VUkNFX0NPTlRFTlQQAxIZChVBVURJVF9SRVNPVVJDRV9TWVNURU0QBDLAAQoMQXVkaXRTZXJ2aWNlEloKDUxpc3RBdWRpdExvZ3MSIy5ibG9ja25pbmphLnYxLkxpc3RBdWRpdExvZ3NSZXF1ZXN0GiQuYmxvY2tuaW5qYS52MS5MaXN0QXVkaXRMb2dzUmVzcG9uc2USVAoLR2V0QXVkaXRMb2cSIS5ibG9ja25pbmphLnYxLkdldEF1ZGl0TG9nUmVxdWVzdBoiLmJsb2NrbmluamEudjEuR2V0QXVkaXRMb2dSZXNwb25zZULAAQoRY29tLmJsb2NrbmluamEudjFCCkF1ZGl0UHJvdG9QAVpKZ2l0LmRldi5hbGV4ZHVubW93LmNvbS9ibG9jay9uaW5qYS9pbnRlcm5hbC9hcGkvYmxvY2tuaW5qYS92MTtibG9ja25pbmphdjGiAgNCWFiqAg1CbG9ja25pbmphLlYxygINQmxvY2tuaW5qYVxWMeICGUJsb2NrbmluamFcVjFcR1BCTWV0YWRhdGHqAg5CbG9ja25pbmphOjpWMWIGcHJvdG8z",
	[file_blockninja_v1_common, file_google_protobuf_timestamp],
);
/**
 * @generated from enum blockninja.v1.AuditAction
 */
var AuditAction;
(function (AuditAction) {
	/**
	 * @generated from enum value: AUDIT_ACTION_UNSPECIFIED = 0;
	 */
	AuditAction[(AuditAction["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: AUDIT_ACTION_LOGIN_SUCCESS = 1;
	 */
	AuditAction[(AuditAction["LOGIN_SUCCESS"] = 1)] = "LOGIN_SUCCESS";
	/**
	 * @generated from enum value: AUDIT_ACTION_LOGIN_FAILURE = 2;
	 */
	AuditAction[(AuditAction["LOGIN_FAILURE"] = 2)] = "LOGIN_FAILURE";
	/**
	 * @generated from enum value: AUDIT_ACTION_LOGOUT = 3;
	 */
	AuditAction[(AuditAction["LOGOUT"] = 3)] = "LOGOUT";
	/**
	 * @generated from enum value: AUDIT_ACTION_PASSWORD_CHANGE = 4;
	 */
	AuditAction[(AuditAction["PASSWORD_CHANGE"] = 4)] = "PASSWORD_CHANGE";
	/**
	 * @generated from enum value: AUDIT_ACTION_PASSWORD_RESET_REQUEST = 5;
	 */
	AuditAction[(AuditAction["PASSWORD_RESET_REQUEST"] = 5)] = "PASSWORD_RESET_REQUEST";
	/**
	 * @generated from enum value: AUDIT_ACTION_PASSWORD_RESET_COMPLETE = 6;
	 */
	AuditAction[(AuditAction["PASSWORD_RESET_COMPLETE"] = 6)] = "PASSWORD_RESET_COMPLETE";
	/**
	 * @generated from enum value: AUDIT_ACTION_CREATE = 7;
	 */
	AuditAction[(AuditAction["CREATE"] = 7)] = "CREATE";
	/**
	 * @generated from enum value: AUDIT_ACTION_READ = 8;
	 */
	AuditAction[(AuditAction["READ"] = 8)] = "READ";
	/**
	 * @generated from enum value: AUDIT_ACTION_UPDATE = 9;
	 */
	AuditAction[(AuditAction["UPDATE"] = 9)] = "UPDATE";
	/**
	 * @generated from enum value: AUDIT_ACTION_DELETE = 10;
	 */
	AuditAction[(AuditAction["DELETE"] = 10)] = "DELETE";
})(AuditAction || (AuditAction = {}));
/**
 * @generated from enum blockninja.v1.AuditResource
 */
var AuditResource;
(function (AuditResource) {
	/**
	 * @generated from enum value: AUDIT_RESOURCE_UNSPECIFIED = 0;
	 */
	AuditResource[(AuditResource["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: AUDIT_RESOURCE_AUTH = 1;
	 */
	AuditResource[(AuditResource["AUTH"] = 1)] = "AUTH";
	/**
	 * @generated from enum value: AUDIT_RESOURCE_ADMIN_USER = 2;
	 */
	AuditResource[(AuditResource["ADMIN_USER"] = 2)] = "ADMIN_USER";
	/**
	 * @generated from enum value: AUDIT_RESOURCE_CONTENT = 3;
	 */
	AuditResource[(AuditResource["CONTENT"] = 3)] = "CONTENT";
	/**
	 * @generated from enum value: AUDIT_RESOURCE_SYSTEM = 4;
	 */
	AuditResource[(AuditResource["SYSTEM"] = 4)] = "SYSTEM";
})(AuditResource || (AuditResource = {}));
/**
 * @generated from service blockninja.v1.AuditService
 */
const AuditService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_audit, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/audit.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.AuditService.ListAuditLogs
 */
AuditService.method.listAuditLogs;
/**
 * @generated from rpc blockninja.v1.AuditService.GetAuditLog
 */
AuditService.method.getAuditLog;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/audit_log.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/audit_log.proto.
 */
const file_blockninja_v1_audit_log = /*@__PURE__*/ fileDesc(
	"Ch1ibG9ja25pbmphL3YxL2F1ZGl0X2xvZy5wcm90bxINYmxvY2tuaW5qYS52MSLrAgoNQXVkaXRMb2dFbnRyeRIKCgJpZBgBIAEoCRIaCg1hY3Rvcl91c2VyX2lkGAIgASgJSACIAQESEgoKYWN0b3JfdHlwZRgDIAEoCRIOCgZhY3Rpb24YBCABKAkSGgoNdGFyZ2V0X2VudGl0eRgFIAEoCUgBiAEBEhYKCXRhcmdldF9pZBgGIAEoCUgCiAEBEiEKFHJlcXVlc3Rfc3VtbWFyeV9qc29uGAcgASgJSAOIAQESDgoGcmVzdWx0GAggASgJEhoKDWVycm9yX21lc3NhZ2UYCSABKAlIBIgBARIuCgpjcmVhdGVkX2F0GAogASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEIQCg5fYWN0b3JfdXNlcl9pZEIQCg5fdGFyZ2V0X2VudGl0eUIMCgpfdGFyZ2V0X2lkQhcKFV9yZXF1ZXN0X3N1bW1hcnlfanNvbkIQCg5fZXJyb3JfbWVzc2FnZSLbAgoTTGlzdEF1ZGl0TG9nUmVxdWVzdBIVCghhY3Rvcl9pZBgBIAEoCUgAiAEBEhMKBmFjdGlvbhgCIAEoCUgBiAEBEhoKDXRhcmdldF9lbnRpdHkYAyABKAlIAogBARIWCgl0YXJnZXRfaWQYBCABKAlIA4gBARItCgRmcm9tGAUgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEgEiAEBEisKAnRvGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEgFiAEBEhEKBHBhZ2UYByABKAVIBogBARIWCglwYWdlX3NpemUYCCABKAVIB4gBAUILCglfYWN0b3JfaWRCCQoHX2FjdGlvbkIQCg5fdGFyZ2V0X2VudGl0eUIMCgpfdGFyZ2V0X2lkQgcKBV9mcm9tQgUKA190b0IHCgVfcGFnZUIMCgpfcGFnZV9zaXplIlQKFExpc3RBdWRpdExvZ1Jlc3BvbnNlEi0KB2VudHJpZXMYASADKAsyHC5ibG9ja25pbmphLnYxLkF1ZGl0TG9nRW50cnkSDQoFdG90YWwYAiABKAMiJQoXR2V0QXVkaXRMb2dFbnRyeVJlcXVlc3QSCgoCaWQYASABKAkiRwoYR2V0QXVkaXRMb2dFbnRyeVJlc3BvbnNlEisKBWVudHJ5GAEgASgLMhwuYmxvY2tuaW5qYS52MS5BdWRpdExvZ0VudHJ5Ms8BCg9BdWRpdExvZ1NlcnZpY2USVwoMTGlzdEF1ZGl0TG9nEiIuYmxvY2tuaW5qYS52MS5MaXN0QXVkaXRMb2dSZXF1ZXN0GiMuYmxvY2tuaW5qYS52MS5MaXN0QXVkaXRMb2dSZXNwb25zZRJjChBHZXRBdWRpdExvZ0VudHJ5EiYuYmxvY2tuaW5qYS52MS5HZXRBdWRpdExvZ0VudHJ5UmVxdWVzdBonLmJsb2NrbmluamEudjEuR2V0QXVkaXRMb2dFbnRyeVJlc3BvbnNlQsMBChFjb20uYmxvY2tuaW5qYS52MUINQXVkaXRMb2dQcm90b1ABWkpnaXQuZGV2LmFsZXhkdW5tb3cuY29tL2Jsb2NrL25pbmphL2ludGVybmFsL2FwaS9ibG9ja25pbmphL3YxO2Jsb2NrbmluamF2MaICA0JYWKoCDUJsb2NrbmluamEuVjHKAg1CbG9ja25pbmphXFYx4gIZQmxvY2tuaW5qYVxWMVxHUEJNZXRhZGF0YeoCDkJsb2NrbmluamE6OlYxYgZwcm90bzM",
	[file_google_protobuf_timestamp],
);
/**
 * @generated from service blockninja.v1.AuditLogService
 */
const AuditLogService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_audit_log, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/audit_log.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.AuditLogService.ListAuditLog
 */
AuditLogService.method.listAuditLog;
/**
 * @generated from rpc blockninja.v1.AuditLogService.GetAuditLogEntry
 */
AuditLogService.method.getAuditLogEntry;

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/auth.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.AuthService.Login
 */
AuthService.method.login;
/**
 * @generated from rpc blockninja.v1.AuthService.Logout
 */
AuthService.method.logout;
/**
 * @generated from rpc blockninja.v1.AuthService.RefreshSession
 */
AuthService.method.refreshSession;
/**
 * @generated from rpc blockninja.v1.AuthService.GetCurrentUser
 */
AuthService.method.getCurrentUser;
/**
 * @generated from rpc blockninja.v1.AuthService.ListAuthorizedDevices
 */
AuthService.method.listAuthorizedDevices;
/**
 * @generated from rpc blockninja.v1.AuthService.RevokeAuthorizedDevice
 */
AuthService.method.revokeAuthorizedDevice;
/**
 * @generated from rpc blockninja.v1.AuthService.ChangePassword
 */
AuthService.method.changePassword;
/**
 * @generated from rpc blockninja.v1.AuthService.SetLocalPassword
 */
AuthService.method.setLocalPassword;
/**
 * @generated from rpc blockninja.v1.AuthService.RequestPasswordReset
 */
AuthService.method.requestPasswordReset;
/**
 * @generated from rpc blockninja.v1.AuthService.ResetPassword
 */
AuthService.method.resetPassword;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/authors.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/authors.proto.
 */
const file_blockninja_v1_authors = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_timestamp, file_google_protobuf_struct],
);
/**
 * AuthorsService manages author profiles for blog posts
 *
 * @generated from service blockninja.v1.AuthorsService
 */
const AuthorsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_authors, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/authors.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * List all author profiles
 *
 * @generated from rpc blockninja.v1.AuthorsService.ListAuthorProfiles
 */
AuthorsService.method.listAuthorProfiles;
/**
 * Get a single author profile by ID
 *
 * @generated from rpc blockninja.v1.AuthorsService.GetAuthorProfile
 */
AuthorsService.method.getAuthorProfile;
/**
 * Get author profile by slug (for public author pages)
 *
 * @generated from rpc blockninja.v1.AuthorsService.GetAuthorProfileBySlug
 */
AuthorsService.method.getAuthorProfileBySlug;
/**
 * Create a new author profile (guest author or link to admin user)
 *
 * @generated from rpc blockninja.v1.AuthorsService.CreateAuthorProfile
 */
AuthorsService.method.createAuthorProfile;
/**
 * Update an author profile
 *
 * @generated from rpc blockninja.v1.AuthorsService.UpdateAuthorProfile
 */
AuthorsService.method.updateAuthorProfile;
/**
 * Delete an author profile
 *
 * @generated from rpc blockninja.v1.AuthorsService.DeleteAuthorProfile
 */
AuthorsService.method.deleteAuthorProfile;
/**
 * Get posts by author (for author page)
 *
 * @generated from rpc blockninja.v1.AuthorsService.GetAuthorPosts
 */
AuthorsService.method.getAuthorPosts;
/**
 * Set author profile for a page/post
 *
 * @generated from rpc blockninja.v1.AuthorsService.SetPageAuthor
 */
AuthorsService.method.setPageAuthor;
/**
 * Get the current user's author profile
 *
 * @generated from rpc blockninja.v1.AuthorsService.GetMyAuthorProfile
 */
AuthorsService.method.getMyAuthorProfile;
/**
 * Ensure the current user has an author profile (create if doesn't exist)
 *
 * @generated from rpc blockninja.v1.AuthorsService.EnsureMyAuthorProfile
 */
AuthorsService.method.ensureMyAuthorProfile;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/background_jobs.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/background_jobs.proto.
 */
const file_blockninja_v1_background_jobs = /*@__PURE__*/ fileDesc(
	"CiNibG9ja25pbmphL3YxL2JhY2tncm91bmRfam9icy5wcm90bxINYmxvY2tuaW5qYS52MSKlAwoRQmFja2dyb3VuZEpvYkluZm8SCgoCaWQYASABKAkSEwoLaW5zdGFuY2VfaWQYAiABKAkSEAoIam9iX3R5cGUYAyABKAkSJwoGY29uZmlnGAQgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdBIOCgZzdGF0dXMYBSABKAkSEgoFZXJyb3IYBiABKAlIAIgBARIuCgpjcmVhdGVkX2F0GAcgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIzCgpzdGFydGVkX2F0GAggASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEgBiAEBEjUKDGNvbXBsZXRlZF9hdBgJIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBIAogBARIYChBwcm9ncmVzc19jdXJyZW50GAogASgFEhYKDnByb2dyZXNzX3RvdGFsGAsgASgFEhgKEHByb2dyZXNzX21lc3NhZ2UYDCABKAlCCAoGX2Vycm9yQg0KC19zdGFydGVkX2F0Qg8KDV9jb21wbGV0ZWRfYXQiXwoZTGlzdEJhY2tncm91bmRKb2JzUmVxdWVzdBIVCghqb2JfdHlwZRgBIAEoCUgAiAEBEhMKBnN0YXR1cxgCIAEoCUgBiAEBQgsKCV9qb2JfdHlwZUIJCgdfc3RhdHVzIkwKGkxpc3RCYWNrZ3JvdW5kSm9ic1Jlc3BvbnNlEi4KBGpvYnMYASADKAsyIC5ibG9ja25pbmphLnYxLkJhY2tncm91bmRKb2JJbmZvIikKF0dldEJhY2tncm91bmRKb2JSZXF1ZXN0Eg4KBmpvYl9pZBgBIAEoCSJJChhHZXRCYWNrZ3JvdW5kSm9iUmVzcG9uc2USLQoDam9iGAEgASgLMiAuYmxvY2tuaW5qYS52MS5CYWNrZ3JvdW5kSm9iSW5mbyJXChpDcmVhdGVCYWNrZ3JvdW5kSm9iUmVxdWVzdBIQCghqb2JfdHlwZRgBIAEoCRInCgZjb25maWcYAiABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0IkwKG0NyZWF0ZUJhY2tncm91bmRKb2JSZXNwb25zZRItCgNqb2IYASABKAsyIC5ibG9ja25pbmphLnYxLkJhY2tncm91bmRKb2JJbmZvIiwKGkNhbmNlbEJhY2tncm91bmRKb2JSZXF1ZXN0Eg4KBmpvYl9pZBgBIAEoCSIwChtDYW5jZWxCYWNrZ3JvdW5kSm9iUmVzcG9uc2USEQoJY2FuY2VsbGVkGAEgASgIIioKGFN0cmVhbUpvYlByb2dyZXNzUmVxdWVzdBIOCgZqb2JfaWQYASABKAkiPgoLSm9iUHJvZ3Jlc3MSDwoHY3VycmVudBgBIAEoBRINCgV0b3RhbBgCIAEoBRIPCgdtZXNzYWdlGAMgASgJMp8EChVCYWNrZ3JvdW5kSm9ic1NlcnZpY2USaQoSTGlzdEJhY2tncm91bmRKb2JzEiguYmxvY2tuaW5qYS52MS5MaXN0QmFja2dyb3VuZEpvYnNSZXF1ZXN0GikuYmxvY2tuaW5qYS52MS5MaXN0QmFja2dyb3VuZEpvYnNSZXNwb25zZRJjChBHZXRCYWNrZ3JvdW5kSm9iEiYuYmxvY2tuaW5qYS52MS5HZXRCYWNrZ3JvdW5kSm9iUmVxdWVzdBonLmJsb2NrbmluamEudjEuR2V0QmFja2dyb3VuZEpvYlJlc3BvbnNlEmwKE0NyZWF0ZUJhY2tncm91bmRKb2ISKS5ibG9ja25pbmphLnYxLkNyZWF0ZUJhY2tncm91bmRKb2JSZXF1ZXN0GiouYmxvY2tuaW5qYS52MS5DcmVhdGVCYWNrZ3JvdW5kSm9iUmVzcG9uc2USbAoTQ2FuY2VsQmFja2dyb3VuZEpvYhIpLmJsb2NrbmluamEudjEuQ2FuY2VsQmFja2dyb3VuZEpvYlJlcXVlc3QaKi5ibG9ja25pbmphLnYxLkNhbmNlbEJhY2tncm91bmRKb2JSZXNwb25zZRJaChFTdHJlYW1Kb2JQcm9ncmVzcxInLmJsb2NrbmluamEudjEuU3RyZWFtSm9iUHJvZ3Jlc3NSZXF1ZXN0GhouYmxvY2tuaW5qYS52MS5Kb2JQcm9ncmVzczABQskBChFjb20uYmxvY2tuaW5qYS52MUITQmFja2dyb3VuZEpvYnNQcm90b1ABWkpnaXQuZGV2LmFsZXhkdW5tb3cuY29tL2Jsb2NrL25pbmphL2ludGVybmFsL2FwaS9ibG9ja25pbmphL3YxO2Jsb2NrbmluamF2MaICA0JYWKoCDUJsb2NrbmluamEuVjHKAg1CbG9ja25pbmphXFYx4gIZQmxvY2tuaW5qYVxWMVxHUEJNZXRhZGF0YeoCDkJsb2NrbmluamE6OlYxYgZwcm90bzM",
	[file_google_protobuf_timestamp, file_google_protobuf_struct],
);
/**
 * @generated from service blockninja.v1.BackgroundJobsService
 */
const BackgroundJobsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_background_jobs, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/background_jobs.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.BackgroundJobsService.ListBackgroundJobs
 */
BackgroundJobsService.method.listBackgroundJobs;
/**
 * @generated from rpc blockninja.v1.BackgroundJobsService.GetBackgroundJob
 */
BackgroundJobsService.method.getBackgroundJob;
/**
 * @generated from rpc blockninja.v1.BackgroundJobsService.CreateBackgroundJob
 */
BackgroundJobsService.method.createBackgroundJob;
/**
 * @generated from rpc blockninja.v1.BackgroundJobsService.CancelBackgroundJob
 */
BackgroundJobsService.method.cancelBackgroundJob;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/backup.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/backup.proto.
 */
const file_blockninja_v1_backup = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_timestamp],
);
/**
 * Schedule type for automated backups
 *
 * @generated from enum blockninja.v1.ScheduleType
 */
var ScheduleType;
(function (ScheduleType) {
	/**
	 * @generated from enum value: SCHEDULE_TYPE_UNSPECIFIED = 0;
	 */
	ScheduleType[(ScheduleType["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: SCHEDULE_TYPE_HOURLY = 1;
	 */
	ScheduleType[(ScheduleType["HOURLY"] = 1)] = "HOURLY";
	/**
	 * @generated from enum value: SCHEDULE_TYPE_DAILY = 2;
	 */
	ScheduleType[(ScheduleType["DAILY"] = 2)] = "DAILY";
	/**
	 * @generated from enum value: SCHEDULE_TYPE_WEEKLY = 3;
	 */
	ScheduleType[(ScheduleType["WEEKLY"] = 3)] = "WEEKLY";
	/**
	 * @generated from enum value: SCHEDULE_TYPE_MONTHLY = 4;
	 */
	ScheduleType[(ScheduleType["MONTHLY"] = 4)] = "MONTHLY";
})(ScheduleType || (ScheduleType = {}));
/**
 * Where to store backups
 *
 * @generated from enum blockninja.v1.StorageDestination
 */
var StorageDestination;
(function (StorageDestination) {
	/**
	 * @generated from enum value: STORAGE_DESTINATION_UNSPECIFIED = 0;
	 */
	StorageDestination[(StorageDestination["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: STORAGE_DESTINATION_LOCAL = 1;
	 */
	StorageDestination[(StorageDestination["LOCAL"] = 1)] = "LOCAL";
	/**
	 * @generated from enum value: STORAGE_DESTINATION_S3 = 2;
	 */
	StorageDestination[(StorageDestination["S3"] = 2)] = "S3";
	/**
	 * @generated from enum value: STORAGE_DESTINATION_BOTH = 3;
	 */
	StorageDestination[(StorageDestination["BOTH"] = 3)] = "BOTH";
})(StorageDestination || (StorageDestination = {}));
/**
 * BackupService handles full site backup and restore using pg_dump/pg_restore
 *
 * @generated from service blockninja.v1.BackupService
 */
const BackupService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_backup, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/backup.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Start an async backup (returns immediately, notifies via realtime when done)
 *
 * @generated from rpc blockninja.v1.BackupService.StartBackup
 */
BackupService.method.startBackup;
/**
 * List all available backups
 *
 * @generated from rpc blockninja.v1.BackupService.ListBackups
 */
BackupService.method.listBackups;
/**
 * Delete a backup
 *
 * @generated from rpc blockninja.v1.BackupService.DeleteBackup
 */
BackupService.method.deleteBackup;
/**
 * Download a completed backup
 *
 * @generated from rpc blockninja.v1.BackupService.DownloadBackup
 */
BackupService.method.downloadBackup;
/**
 * Preview what a backup contains before restoring
 *
 * @generated from rpc blockninja.v1.BackupService.PreviewBackup
 */
BackupService.method.previewBackup;
/**
 * Restore from a backup (destructive - replaces entire database)
 *
 * @generated from rpc blockninja.v1.BackupService.RestoreBackup
 */
BackupService.method.restoreBackup;
/**
 * Get backup schedule configuration
 *
 * @generated from rpc blockninja.v1.BackupService.GetBackupSchedule
 */
BackupService.method.getBackupSchedule;
/**
 * Save backup schedule configuration
 *
 * @generated from rpc blockninja.v1.BackupService.SaveBackupSchedule
 */
BackupService.method.saveBackupSchedule;
/**
 * Get retention policy
 *
 * @generated from rpc blockninja.v1.BackupService.GetRetentionPolicy
 */
BackupService.method.getRetentionPolicy;
/**
 * Save retention policy
 *
 * @generated from rpc blockninja.v1.BackupService.SaveRetentionPolicy
 */
BackupService.method.saveRetentionPolicy;
/**
 * Get notification settings
 *
 * @generated from rpc blockninja.v1.BackupService.GetBackupNotifications
 */
BackupService.method.getBackupNotifications;
/**
 * Save notification settings
 *
 * @generated from rpc blockninja.v1.BackupService.SaveBackupNotifications
 */
BackupService.method.saveBackupNotifications;
/**
 * Get pre-signed download URL for S3 backup
 *
 * @generated from rpc blockninja.v1.BackupService.GetBackupDownloadUrl
 */
BackupService.method.getBackupDownloadUrl;
/**
 * Run retention cleanup manually
 *
 * @generated from rpc blockninja.v1.BackupService.RunRetentionCleanup
 */
BackupService.method.runRetentionCleanup;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/billing.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/billing.proto.
 */
const file_blockninja_v1_billing = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_timestamp],
);
/**
 * @generated from service blockninja.v1.BillingService
 */
const BillingService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_billing, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/billing.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Stripe Connect
 *
 * @generated from rpc blockninja.v1.BillingService.GetStripeConnection
 */
BillingService.method.getStripeConnection;
/**
 * @generated from rpc blockninja.v1.BillingService.ConnectStripe
 */
BillingService.method.connectStripe;
/**
 * @generated from rpc blockninja.v1.BillingService.DisconnectStripe
 */
BillingService.method.disconnectStripe;
/**
 * @generated from rpc blockninja.v1.BillingService.GetStripeConnectURL
 */
BillingService.method.getStripeConnectURL;
/**
 * Plan mapping
 *
 * @generated from rpc blockninja.v1.BillingService.ListStripePlans
 */
BillingService.method.listStripePlans;
/**
 * @generated from rpc blockninja.v1.BillingService.CreateStripePlan
 */
BillingService.method.createStripePlan;
/**
 * @generated from rpc blockninja.v1.BillingService.UpdateStripePlan
 */
BillingService.method.updateStripePlan;
/**
 * @generated from rpc blockninja.v1.BillingService.DeleteStripePlan
 */
BillingService.method.deleteStripePlan;
/**
 * @generated from rpc blockninja.v1.BillingService.SyncStripePrices
 */
BillingService.method.syncStripePrices;
/**
 * Checkout
 *
 * @generated from rpc blockninja.v1.BillingService.CreateCheckoutSession
 */
BillingService.method.createCheckoutSession;
/**
 * Team billing (seat management)
 *
 * @generated from rpc blockninja.v1.BillingService.UpdateTeamSeats
 */
BillingService.method.updateTeamSeats;
/**
 * Events
 *
 * @generated from rpc blockninja.v1.BillingService.ListStripeEvents
 */
BillingService.method.listStripeEvents;
/**
 * Dashboard stats
 *
 * @generated from rpc blockninja.v1.BillingService.GetBillingStats
 */
BillingService.method.getBillingStats;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/blocks.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/blocks.proto.
 */
const file_blockninja_v1_blocks = /*@__PURE__*/ fileDesc(
	" ",
	[file_blockninja_v1_common, file_google_protobuf_timestamp, file_google_protobuf_struct],
);
/**
 * Block status for history view
 *
 * @generated from enum blockninja.v1.BlockStatus
 */
var BlockStatus;
(function (BlockStatus) {
	/**
	 * @generated from enum value: BLOCK_STATUS_UNSPECIFIED = 0;
	 */
	BlockStatus[(BlockStatus["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * Block exists and is assigned to pages
	 *
	 * @generated from enum value: BLOCK_STATUS_ACTIVE = 1;
	 */
	BlockStatus[(BlockStatus["ACTIVE"] = 1)] = "ACTIVE";
	/**
	 * Block exists but not assigned to any page
	 *
	 * @generated from enum value: BLOCK_STATUS_ORPHANED = 2;
	 */
	BlockStatus[(BlockStatus["ORPHANED"] = 2)] = "ORPHANED";
	/**
	 * Block deleted, only versions remain
	 *
	 * @generated from enum value: BLOCK_STATUS_DELETED = 3;
	 */
	BlockStatus[(BlockStatus["DELETED"] = 3)] = "DELETED";
})(BlockStatus || (BlockStatus = {}));
/**
 * @generated from service blockninja.v1.BlocksService
 */
const BlocksService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_blocks, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/blocks.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Block CRUD
 *
 * @generated from rpc blockninja.v1.BlocksService.ListBlocks
 */
BlocksService.method.listBlocks;
/**
 * @generated from rpc blockninja.v1.BlocksService.GetBlock
 */
BlocksService.method.getBlock;
/**
 * @generated from rpc blockninja.v1.BlocksService.CreateBlock
 */
BlocksService.method.createBlock;
/**
 * @generated from rpc blockninja.v1.BlocksService.UpdateBlock
 */
BlocksService.method.updateBlock;
/**
 * @generated from rpc blockninja.v1.BlocksService.DeleteBlock
 */
BlocksService.method.deleteBlock;
/**
 * Block versions
 *
 * @generated from rpc blockninja.v1.BlocksService.ListBlockVersions
 */
BlocksService.method.listBlockVersions;
/**
 * @generated from rpc blockninja.v1.BlocksService.RevertBlock
 */
BlocksService.method.revertBlock;
/**
 * @generated from rpc blockninja.v1.BlocksService.UpdateBlockVersionName
 */
BlocksService.method.updateBlockVersionName;
/**
 * Page-Block assignments
 *
 * @generated from rpc blockninja.v1.BlocksService.GetPageBlocks
 */
BlocksService.method.getPageBlocks;
/**
 * @generated from rpc blockninja.v1.BlocksService.AssignBlockToPage
 */
BlocksService.method.assignBlockToPage;
/**
 * @generated from rpc blockninja.v1.BlocksService.RemoveBlockFromPage
 */
BlocksService.method.removeBlockFromPage;
/**
 * @generated from rpc blockninja.v1.BlocksService.UpdatePageBlockOrder
 */
BlocksService.method.updatePageBlockOrder;
/**
 * Block types
 *
 * @generated from rpc blockninja.v1.BlocksService.ListBlockTypes
 */
BlocksService.method.listBlockTypes;
/**
 * Block templates (visual variants for blocks)
 *
 * @generated from rpc blockninja.v1.BlocksService.ListBlockTemplates
 */
BlocksService.method.listBlockTemplates;
/**
 * Block usage
 *
 * @generated from rpc blockninja.v1.BlocksService.GetPagesUsingBlock
 */
BlocksService.method.getPagesUsingBlock;
/**
 * AI-powered title generation
 *
 * @generated from rpc blockninja.v1.BlocksService.GenerateBlockTitle
 */
BlocksService.method.generateBlockTitle;
/**
 * Variable rename for HTML/smart blocks
 *
 * @generated from rpc blockninja.v1.BlocksService.RenameBlockVariable
 */
BlocksService.method.renameBlockVariable;
/**
 * Block History (admin feature for searching and recovering deleted/orphaned blocks)
 *
 * @generated from rpc blockninja.v1.BlocksService.ListBlockHistory
 */
BlocksService.method.listBlockHistory;
/**
 * @generated from rpc blockninja.v1.BlocksService.GetDeletedBlockVersions
 */
BlocksService.method.getDeletedBlockVersions;
/**
 * @generated from rpc blockninja.v1.BlocksService.RecoverDeletedBlock
 */
BlocksService.method.recoverDeletedBlock;
/**
 * @generated from rpc blockninja.v1.BlocksService.PurgeBlock
 */
BlocksService.method.purgeBlock;
/**
 * @generated from rpc blockninja.v1.BlocksService.GetBlockHistoryStats
 */
BlocksService.method.getBlockHistoryStats;
/**
 * @generated from rpc blockninja.v1.BlocksService.GetBlockHistoricalPages
 */
BlocksService.method.getBlockHistoricalPages;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/posts.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/posts.proto.
 */
const file_blockninja_v1_posts = /*@__PURE__*/ fileDesc(
	" ",
	[file_blockninja_v1_common, file_blockninja_v1_pages, file_google_protobuf_timestamp],
);
/**
 * @generated from service blockninja.v1.PostsService
 */
const PostsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_posts, 0);

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/blog_posts.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/blog_posts.proto.
 */
const file_blockninja_v1_blog_posts = /*@__PURE__*/ fileDesc(
	" ",
	[file_blockninja_v1_common, file_blockninja_v1_pages, file_blockninja_v1_posts, file_google_protobuf_timestamp, file_google_protobuf_struct],
);
/**
 * BlogPostsService handles blog post operations
 * Blog posts are stored in a dedicated blog_posts table and render via
 * the blog_post_template system page by default (no individual blocks).
 * To customize a specific post's layout, create a regular page at the same slug.
 *
 * @generated from service blockninja.v1.BlogPostsService
 */
const BlogPostsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_blog_posts, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/blog_posts.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * CRUD operations
 *
 * @generated from rpc blockninja.v1.BlogPostsService.ListBlogPosts
 */
BlogPostsService.method.listBlogPosts;
/**
 * @generated from rpc blockninja.v1.BlogPostsService.GetBlogPost
 */
BlogPostsService.method.getBlogPost;
/**
 * @generated from rpc blockninja.v1.BlogPostsService.CreateBlogPost
 */
BlogPostsService.method.createBlogPost;
/**
 * @generated from rpc blockninja.v1.BlogPostsService.UpdateBlogPost
 */
BlogPostsService.method.updateBlogPost;
/**
 * @generated from rpc blockninja.v1.BlogPostsService.DeleteBlogPost
 */
BlogPostsService.method.deleteBlogPost;
/**
 * Publishing
 *
 * @generated from rpc blockninja.v1.BlogPostsService.PublishBlogPost
 */
BlogPostsService.method.publishBlogPost;
/**
 * @generated from rpc blockninja.v1.BlogPostsService.UnpublishBlogPost
 */
BlogPostsService.method.unpublishBlogPost;
/**
 * @generated from rpc blockninja.v1.BlogPostsService.ScheduleBlogPost
 */
BlogPostsService.method.scheduleBlogPost;
/**
 * @generated from rpc blockninja.v1.BlogPostsService.UnscheduleBlogPost
 */
BlogPostsService.method.unscheduleBlogPost;
/**
 * Versioning
 *
 * @generated from rpc blockninja.v1.BlogPostsService.ListBlogPostVersions
 */
BlogPostsService.method.listBlogPostVersions;
/**
 * @generated from rpc blockninja.v1.BlogPostsService.RollbackBlogPost
 */
BlogPostsService.method.rollbackBlogPost;
/**
 * @generated from rpc blockninja.v1.BlogPostsService.UpdateBlogPostVersionName
 */
BlogPostsService.method.updateBlogPostVersionName;
/**
 * Categories
 *
 * @generated from rpc blockninja.v1.BlogPostsService.GetBlogPostCategories
 */
BlogPostsService.method.getBlogPostCategories;
/**
 * @generated from rpc blockninja.v1.BlogPostsService.SetBlogPostCategories
 */
BlogPostsService.method.setBlogPostCategories;
/**
 * Bulk operations
 *
 * @generated from rpc blockninja.v1.BlogPostsService.BulkDeleteBlogPosts
 */
BlogPostsService.method.bulkDeleteBlogPosts;
/**
 * @generated from rpc blockninja.v1.BlogPostsService.BulkPublishBlogPosts
 */
BlogPostsService.method.bulkPublishBlogPosts;
/**
 * Featured posts toggle
 *
 * @generated from rpc blockninja.v1.BlogPostsService.ToggleBlogPostFeatured
 */
BlogPostsService.method.toggleBlogPostFeatured;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/brand.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/brand.proto.
 */
const file_blockninja_v1_brand = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_timestamp],
);
/**
 * Source types for site icon
 *
 * @generated from enum blockninja.v1.BrandSourceType
 */
var BrandSourceType;
(function (BrandSourceType) {
	/**
	 * @generated from enum value: BRAND_SOURCE_TYPE_UNSPECIFIED = 0;
	 */
	BrandSourceType[(BrandSourceType["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * SVG or PNG uploaded via media
	 *
	 * @generated from enum value: BRAND_SOURCE_TYPE_UPLOAD = 1;
	 */
	BrandSourceType[(BrandSourceType["UPLOAD"] = 1)] = "UPLOAD";
	/**
	 * Unicode emoji character
	 *
	 * @generated from enum value: BRAND_SOURCE_TYPE_EMOJI = 2;
	 */
	BrandSourceType[(BrandSourceType["EMOJI"] = 2)] = "EMOJI";
	/**
	 * Text/initials
	 *
	 * @generated from enum value: BRAND_SOURCE_TYPE_TEXT = 3;
	 */
	BrandSourceType[(BrandSourceType["TEXT"] = 3)] = "TEXT";
})(BrandSourceType || (BrandSourceType = {}));
/**
 * Icon shape
 *
 * @generated from enum blockninja.v1.BrandShape
 */
var BrandShape;
(function (BrandShape) {
	/**
	 * @generated from enum value: BRAND_SHAPE_UNSPECIFIED = 0;
	 */
	BrandShape[(BrandShape["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: BRAND_SHAPE_SQUARE = 1;
	 */
	BrandShape[(BrandShape["SQUARE"] = 1)] = "SQUARE";
	/**
	 * @generated from enum value: BRAND_SHAPE_ROUNDED = 2;
	 */
	BrandShape[(BrandShape["ROUNDED"] = 2)] = "ROUNDED";
	/**
	 * @generated from enum value: BRAND_SHAPE_CIRCLE = 3;
	 */
	BrandShape[(BrandShape["CIRCLE"] = 3)] = "CIRCLE";
})(BrandShape || (BrandShape = {}));
/**
 * @generated from service blockninja.v1.BrandService
 */
const BrandService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_brand, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/brand.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Get current active brand spec
 *
 * @generated from rpc blockninja.v1.BrandService.GetBrandSpec
 */
BrandService.method.getBrandSpec;
/**
 * Save brand spec (create or update)
 *
 * @generated from rpc blockninja.v1.BrandService.SaveBrandSpec
 */
BrandService.method.saveBrandSpec;
/**
 * Generate brand assets from current spec
 *
 * @generated from rpc blockninja.v1.BrandService.GenerateBrandAssets
 */
BrandService.method.generateBrandAssets;
/**
 * Get generated brand assets (for template consumption)
 *
 * @generated from rpc blockninja.v1.BrandService.GetBrandAssets
 */
BrandService.method.getBrandAssets;
/**
 * List brand spec versions for revert
 *
 * @generated from rpc blockninja.v1.BrandService.ListBrandSpecVersions
 */
BrandService.method.listBrandSpecVersions;
/**
 * Revert to a previous version
 *
 * @generated from rpc blockninja.v1.BrandService.RevertBrandSpec
 */
BrandService.method.revertBrandSpec;
/**
 * Preview brand icon (returns base64 PNG preview without saving)
 *
 * @generated from rpc blockninja.v1.BrandService.PreviewBrandIcon
 */
BrandService.method.previewBrandIcon;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/buckets.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/buckets.proto.
 */
const file_blockninja_v1_buckets = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_struct, file_google_protobuf_timestamp, file_blockninja_v1_common],
);
/**
 * BucketMode distinguishes curated (fixed list) from query (dynamic)
 *
 * @generated from enum blockninja.v1.BucketMode
 */
var BucketMode;
(function (BucketMode) {
	/**
	 * @generated from enum value: BUCKET_MODE_UNSPECIFIED = 0;
	 */
	BucketMode[(BucketMode["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: BUCKET_MODE_CURATED = 1;
	 */
	BucketMode[(BucketMode["CURATED"] = 1)] = "CURATED";
	/**
	 * @generated from enum value: BUCKET_MODE_QUERY = 2;
	 */
	BucketMode[(BucketMode["QUERY"] = 2)] = "QUERY";
})(BucketMode || (BucketMode = {}));
/**
 * BucketsService manages on-demand buckets that query internal datasources
 *
 * @generated from service blockninja.v1.BucketsService
 */
const BucketsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_buckets, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/buckets.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * List available internal datasources (from registry)
 *
 * @generated from rpc blockninja.v1.BucketsService.ListDatasources
 */
BucketsService.method.listDatasources;
/**
 * Get a single datasource definition
 *
 * @generated from rpc blockninja.v1.BucketsService.GetDatasource
 */
BucketsService.method.getDatasource;
/**
 * List buckets with optional filtering
 *
 * @generated from rpc blockninja.v1.BucketsService.ListBuckets
 */
BucketsService.method.listBuckets;
/**
 * Get a single bucket
 *
 * @generated from rpc blockninja.v1.BucketsService.GetBucket
 */
BucketsService.method.getBucket;
/**
 * Create a new bucket
 *
 * @generated from rpc blockninja.v1.BucketsService.CreateBucket
 */
BucketsService.method.createBucket;
/**
 * Update a bucket
 *
 * @generated from rpc blockninja.v1.BucketsService.UpdateBucket
 */
BucketsService.method.updateBucket;
/**
 * Delete a bucket
 *
 * @generated from rpc blockninja.v1.BucketsService.DeleteBucket
 */
BucketsService.method.deleteBucket;
/**
 * Preview bucket data (for admin UI)
 *
 * @generated from rpc blockninja.v1.BucketsService.PreviewBucketData
 */
BucketsService.method.previewBucketData;
/**
 * List items available for curated selection
 *
 * @generated from rpc blockninja.v1.BucketsService.ListCuratedItems
 */
BucketsService.method.listCuratedItems;
/**
 * Get query schema for visual query builder
 *
 * @generated from rpc blockninja.v1.BucketsService.GetQuerySchema
 */
BucketsService.method.getQuerySchema;
/**
 * AI-powered query generation from natural language
 *
 * @generated from rpc blockninja.v1.BucketsService.GenerateBucketQuery
 */
BucketsService.method.generateBucketQuery;
/**
 * Invalidate cache for a bucket
 *
 * @generated from rpc blockninja.v1.BucketsService.InvalidateBucketCache
 */
BucketsService.method.invalidateBucketCache;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/cms_builder_service.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/cms_builder_service.proto.
 */
const file_blockninja_v1_cms_builder_service = /*@__PURE__*/ fileDesc(
	"CidibG9ja25pbmphL3YxL2Ntc19idWlsZGVyX3NlcnZpY2UucHJvdG8SDWJsb2NrbmluamEudjEiXgoJR2l0UGx1Z2luEgwKBG5hbWUYASABKAkSEAoIcmVwb191cmwYAiABKAkSDgoGYnJhbmNoGAMgASgJEg8KB3NzaF9rZXkYBCABKAkSEAoIc3NoX3BvcnQYBSABKAUiUgoPQnVpbGRDTVNSZXF1ZXN0Ei0KC2dpdF9wbHVnaW5zGAEgAygLMhguYmxvY2tuaW5qYS52MS5HaXRQbHVnaW4SEAoIYnVpbGRfaWQYAiABKAkingEKDUJ1aWxkUHJvZ3Jlc3MSDAoEc3RlcBgBIAEoCRIPCgdtZXNzYWdlGAIgASgJEg4KBnN0cmVhbRgDIAEoCRIQCghpc19lcnJvchgEIAEoCBITCgtpc19jb21wbGV0ZRgFIAEoCBITCgtjb21taXRfaGFzaBgGIAEoCRIQCghidWlsdF9hdBgHIAEoCRIQCghidWlsZF9pZBgIIAEoCSIUChJQaW5nQnVpbGRlclJlcXVlc3QiNQoTUGluZ0J1aWxkZXJSZXNwb25zZRINCgVyZWFkeRgBIAEoCBIPCgd2ZXJzaW9uGAIgASgJMq4BChFDTVNCdWlsZGVyU2VydmljZRJKCghCdWlsZENNUxIeLmJsb2NrbmluamEudjEuQnVpbGRDTVNSZXF1ZXN0GhwuYmxvY2tuaW5qYS52MS5CdWlsZFByb2dyZXNzMAESTQoEUGluZxIhLmJsb2NrbmluamEudjEuUGluZ0J1aWxkZXJSZXF1ZXN0GiIuYmxvY2tuaW5qYS52MS5QaW5nQnVpbGRlclJlc3BvbnNlQswBChFjb20uYmxvY2tuaW5qYS52MUIWQ21zQnVpbGRlclNlcnZpY2VQcm90b1ABWkpnaXQuZGV2LmFsZXhkdW5tb3cuY29tL2Jsb2NrL25pbmphL2ludGVybmFsL2FwaS9ibG9ja25pbmphL3YxO2Jsb2NrbmluamF2MaICA0JYWKoCDUJsb2NrbmluamEuVjHKAg1CbG9ja25pbmphXFYx4gIZQmxvY2tuaW5qYVxWMVxHUEJNZXRhZGF0YeoCDkJsb2NrbmluamE6OlYxYgZwcm90bzM",
	[file_google_protobuf_timestamp],
);
/**
 * CMSBuilderService runs inside the persistent builder container.
 * The CMS calls it over HTTP (Connect RPC) to compile CMS binaries with plugins.
 *
 * @generated from service blockninja.v1.CMSBuilderService
 */
const CMSBuilderService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_cms_builder_service, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/cms_builder_service.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Ping is a health/readiness check.
 *
 * @generated from rpc blockninja.v1.CMSBuilderService.Ping
 */
CMSBuilderService.method.ping;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/community_reviews.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/community_reviews.proto.
 */
const file_blockninja_v1_community_reviews = /*@__PURE__*/ fileDesc(
	"CiVibG9ja25pbmphL3YxL2NvbW11bml0eV9yZXZpZXdzLnByb3RvEg1ibG9ja25pbmphLnYxIpcFCg9Db21tdW5pdHlSZXZpZXcSCgoCaWQYASABKAkSEAoIdGFibGVfaWQYAiABKAkSDgoGcm93X2lkGAMgASgJEg8KB3VzZXJfaWQYBCABKAkSDgoGc3RhdHVzGAUgASgJEhYKDm92ZXJhbGxfcmF0aW5nGAYgASgFEhgKC3Jldmlld190ZXh0GAcgASgJSACIAQESKAoHcmF0aW5ncxgIIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QSDgoGcGhvdG9zGAkgAygJEhYKCXZpZGVvX3VybBgKIAEoCUgBiAEBEhUKDWhlbHBmdWxfY291bnQYCyABKAUSHQoQcmVqZWN0aW9uX3JlYXNvbhgMIAEoCUgCiAEBEi4KCmNyZWF0ZWRfYXQYDSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEi4KCnVwZGF0ZWRfYXQYDiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEiAKE2F1dGhvcl9kaXNwbGF5X25hbWUYDyABKAlIA4gBARIeChFhdXRob3JfYXZhdGFyX3VybBgQIAEoCUgEiAEBEhwKD2F1dGhvcl91c2VybmFtZRgRIAEoCUgFiAEBEhgKEHZpZXdlcl9oYXNfdm90ZWQYEiABKAgSEwoLaXNfZW5kb3JzZWQYEyABKAgSFwoPZWRpdGVkX2J5X2FkbWluGBQgASgIQg4KDF9yZXZpZXdfdGV4dEIMCgpfdmlkZW9fdXJsQhMKEV9yZWplY3Rpb25fcmVhc29uQhYKFF9hdXRob3JfZGlzcGxheV9uYW1lQhQKEl9hdXRob3JfYXZhdGFyX3VybEISChBfYXV0aG9yX3VzZXJuYW1lIj8KD1JhdGluZ0FnZ3JlZ2F0ZRIWCg5hdmVyYWdlX3JhdGluZxgBIAEoARIUCgxyZXZpZXdfY291bnQYAiABKAMi2QEKE1N1Ym1pdFJldmlld1JlcXVlc3QSEAoIdGFibGVfaWQYASABKAkSDgoGcm93X2lkGAIgASgJEhYKDm92ZXJhbGxfcmF0aW5nGAMgASgFEhgKC3Jldmlld190ZXh0GAQgASgJSACIAQESKAoHcmF0aW5ncxgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QSDgoGcGhvdG9zGAYgAygJEhYKCXZpZGVvX3VybBgHIAEoCUgBiAEBQg4KDF9yZXZpZXdfdGV4dEIMCgpfdmlkZW9fdXJsIkYKFFN1Ym1pdFJldmlld1Jlc3BvbnNlEi4KBnJldmlldxgBIAEoCzIeLmJsb2NrbmluamEudjEuQ29tbXVuaXR5UmV2aWV3Ih4KEEdldFJldmlld1JlcXVlc3QSCgoCaWQYASABKAkiQwoRR2V0UmV2aWV3UmVzcG9uc2USLgoGcmV2aWV3GAEgASgLMh4uYmxvY2tuaW5qYS52MS5Db21tdW5pdHlSZXZpZXcijgEKGUxpc3RSZXZpZXdzRm9ySXRlbVJlcXVlc3QSEAoIdGFibGVfaWQYASABKAkSDgoGcm93X2lkGAIgASgJEi0KCnBhZ2luYXRpb24YAyABKAsyGS5ibG9ja25pbmphLnYxLlBhZ2luYXRpb24SFAoHc29ydF9ieRgEIAEoCUgAiAEBQgoKCF9zb3J0X2J5IrcBChpMaXN0UmV2aWV3c0Zvckl0ZW1SZXNwb25zZRIvCgdyZXZpZXdzGAEgAygLMh4uYmxvY2tuaW5qYS52MS5Db21tdW5pdHlSZXZpZXcSNQoKcGFnaW5hdGlvbhgCIAEoCzIhLmJsb2NrbmluamEudjEuUGFnaW5hdGlvblJlc3BvbnNlEjEKCWFnZ3JlZ2F0ZRgDIAEoCzIeLmJsb2NrbmluamEudjEuUmF0aW5nQWdncmVnYXRlIloKGExpc3RSZXZpZXdzQnlVc2VyUmVxdWVzdBIPCgd1c2VyX2lkGAEgASgJEi0KCnBhZ2luYXRpb24YAiABKAsyGS5ibG9ja25pbmphLnYxLlBhZ2luYXRpb24igwEKGUxpc3RSZXZpZXdzQnlVc2VyUmVzcG9uc2USLwoHcmV2aWV3cxgBIAMoCzIeLmJsb2NrbmluamEudjEuQ29tbXVuaXR5UmV2aWV3EjUKCnBhZ2luYXRpb24YAiABKAsyIS5ibG9ja25pbmphLnYxLlBhZ2luYXRpb25SZXNwb25zZSInChJWb3RlSGVscGZ1bFJlcXVlc3QSEQoJcmV2aWV3X2lkGAEgASgJIiwKE1ZvdGVIZWxwZnVsUmVzcG9uc2USFQoNaGVscGZ1bF9jb3VudBgBIAEoBSImChFSZW1vdmVWb3RlUmVxdWVzdBIRCglyZXZpZXdfaWQYASABKAkiKwoSUmVtb3ZlVm90ZVJlc3BvbnNlEhUKDWhlbHBmdWxfY291bnQYASABKAUyvgQKF0NvbW11bml0eVJldmlld3NTZXJ2aWNlElcKDFN1Ym1pdFJldmlldxIiLmJsb2NrbmluamEudjEuU3VibWl0UmV2aWV3UmVxdWVzdBojLmJsb2NrbmluamEudjEuU3VibWl0UmV2aWV3UmVzcG9uc2USTgoJR2V0UmV2aWV3Eh8uYmxvY2tuaW5qYS52MS5HZXRSZXZpZXdSZXF1ZXN0GiAuYmxvY2tuaW5qYS52MS5HZXRSZXZpZXdSZXNwb25zZRJpChJMaXN0UmV2aWV3c0Zvckl0ZW0SKC5ibG9ja25pbmphLnYxLkxpc3RSZXZpZXdzRm9ySXRlbVJlcXVlc3QaKS5ibG9ja25pbmphLnYxLkxpc3RSZXZpZXdzRm9ySXRlbVJlc3BvbnNlEmYKEUxpc3RSZXZpZXdzQnlVc2VyEicuYmxvY2tuaW5qYS52MS5MaXN0UmV2aWV3c0J5VXNlclJlcXVlc3QaKC5ibG9ja25pbmphLnYxLkxpc3RSZXZpZXdzQnlVc2VyUmVzcG9uc2USVAoLVm90ZUhlbHBmdWwSIS5ibG9ja25pbmphLnYxLlZvdGVIZWxwZnVsUmVxdWVzdBoiLmJsb2NrbmluamEudjEuVm90ZUhlbHBmdWxSZXNwb25zZRJRCgpSZW1vdmVWb3RlEiAuYmxvY2tuaW5qYS52MS5SZW1vdmVWb3RlUmVxdWVzdBohLmJsb2NrbmluamEudjEuUmVtb3ZlVm90ZVJlc3BvbnNlQssBChFjb20uYmxvY2tuaW5qYS52MUIVQ29tbXVuaXR5UmV2aWV3c1Byb3RvUAFaSmdpdC5kZXYuYWxleGR1bm1vdy5jb20vYmxvY2svbmluamEvaW50ZXJuYWwvYXBpL2Jsb2NrbmluamEvdjE7YmxvY2tuaW5qYXYxogIDQlhYqgINQmxvY2tuaW5qYS5WMcoCDUJsb2NrbmluamFcVjHiAhlCbG9ja25pbmphXFYxXEdQQk1ldGFkYXRh6gIOQmxvY2tuaW5qYTo6VjFiBnByb3RvMw",
	[file_blockninja_v1_common, file_google_protobuf_struct, file_google_protobuf_timestamp],
);
/**
 * @generated from service blockninja.v1.CommunityReviewsService
 */
const CommunityReviewsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_community_reviews, 0);

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/community_moderation.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/community_moderation.proto.
 */
const file_blockninja_v1_community_moderation = /*@__PURE__*/ fileDesc(
	"CihibG9ja25pbmphL3YxL2NvbW11bml0eV9tb2RlcmF0aW9uLnByb3RvEg1ibG9ja25pbmphLnYxIm4KGUxpc3RQZW5kaW5nUmV2aWV3c1JlcXVlc3QSLQoKcGFnaW5hdGlvbhgBIAEoCzIZLmJsb2NrbmluamEudjEuUGFnaW5hdGlvbhIVCgh0YWJsZV9pZBgCIAEoCUgAiAEBQgsKCV90YWJsZV9pZCKEAQoaTGlzdFBlbmRpbmdSZXZpZXdzUmVzcG9uc2USLwoHcmV2aWV3cxgBIAMoCzIeLmJsb2NrbmluamEudjEuQ29tbXVuaXR5UmV2aWV3EjUKCnBhZ2luYXRpb24YAiABKAsyIS5ibG9ja25pbmphLnYxLlBhZ2luYXRpb25SZXNwb25zZSIiChRBcHByb3ZlUmV2aWV3UmVxdWVzdBIKCgJpZBgBIAEoCSJHChVBcHByb3ZlUmV2aWV3UmVzcG9uc2USLgoGcmV2aWV3GAEgASgLMh4uYmxvY2tuaW5qYS52MS5Db21tdW5pdHlSZXZpZXciQQoTUmVqZWN0UmV2aWV3UmVxdWVzdBIKCgJpZBgBIAEoCRITCgZyZWFzb24YAiABKAlIAIgBAUIJCgdfcmVhc29uIkYKFFJlamVjdFJldmlld1Jlc3BvbnNlEi4KBnJldmlldxgBIAEoCzIeLmJsb2NrbmluamEudjEuQ29tbXVuaXR5UmV2aWV3IiEKE0RlbGV0ZVJldmlld1JlcXVlc3QSCgoCaWQYASABKAkiFgoURGVsZXRlUmV2aWV3UmVzcG9uc2UiQAoaQ291bnRQZW5kaW5nUmV2aWV3c1JlcXVlc3QSFQoIdGFibGVfaWQYASABKAlIAIgBAUILCglfdGFibGVfaWQiLAobQ291bnRQZW5kaW5nUmV2aWV3c1Jlc3BvbnNlEg0KBWNvdW50GAEgASgDMoMEChpDb21tdW5pdHlNb2RlcmF0aW9uU2VydmljZRJpChJMaXN0UGVuZGluZ1Jldmlld3MSKC5ibG9ja25pbmphLnYxLkxpc3RQZW5kaW5nUmV2aWV3c1JlcXVlc3QaKS5ibG9ja25pbmphLnYxLkxpc3RQZW5kaW5nUmV2aWV3c1Jlc3BvbnNlEloKDUFwcHJvdmVSZXZpZXcSIy5ibG9ja25pbmphLnYxLkFwcHJvdmVSZXZpZXdSZXF1ZXN0GiQuYmxvY2tuaW5qYS52MS5BcHByb3ZlUmV2aWV3UmVzcG9uc2USVwoMUmVqZWN0UmV2aWV3EiIuYmxvY2tuaW5qYS52MS5SZWplY3RSZXZpZXdSZXF1ZXN0GiMuYmxvY2tuaW5qYS52MS5SZWplY3RSZXZpZXdSZXNwb25zZRJXCgxEZWxldGVSZXZpZXcSIi5ibG9ja25pbmphLnYxLkRlbGV0ZVJldmlld1JlcXVlc3QaIy5ibG9ja25pbmphLnYxLkRlbGV0ZVJldmlld1Jlc3BvbnNlEmwKE0NvdW50UGVuZGluZ1Jldmlld3MSKS5ibG9ja25pbmphLnYxLkNvdW50UGVuZGluZ1Jldmlld3NSZXF1ZXN0GiouYmxvY2tuaW5qYS52MS5Db3VudFBlbmRpbmdSZXZpZXdzUmVzcG9uc2VCzgEKEWNvbS5ibG9ja25pbmphLnYxQhhDb21tdW5pdHlNb2RlcmF0aW9uUHJvdG9QAVpKZ2l0LmRldi5hbGV4ZHVubW93LmNvbS9ibG9jay9uaW5qYS9pbnRlcm5hbC9hcGkvYmxvY2tuaW5qYS92MTtibG9ja25pbmphdjGiAgNCWFiqAg1CbG9ja25pbmphLlYxygINQmxvY2tuaW5qYVxWMeICGUJsb2NrbmluamFcVjFcR1BCTWV0YWRhdGHqAg5CbG9ja25pbmphOjpWMWIGcHJvdG8z",
	[file_blockninja_v1_common, file_blockninja_v1_community_reviews, file_google_protobuf_timestamp],
);
/**
 * CommunityModerationService provides admin moderation of community reviews
 *
 * @generated from service blockninja.v1.CommunityModerationService
 */
const CommunityModerationService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_community_moderation, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/community_moderation.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.CommunityModerationService.ListPendingReviews
 */
CommunityModerationService.method.listPendingReviews;
/**
 * @generated from rpc blockninja.v1.CommunityModerationService.ApproveReview
 */
CommunityModerationService.method.approveReview;
/**
 * @generated from rpc blockninja.v1.CommunityModerationService.RejectReview
 */
CommunityModerationService.method.rejectReview;
/**
 * @generated from rpc blockninja.v1.CommunityModerationService.DeleteReview
 */
CommunityModerationService.method.deleteReview;
/**
 * @generated from rpc blockninja.v1.CommunityModerationService.CountPendingReviews
 */
CommunityModerationService.method.countPendingReviews;

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/community_reviews.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.CommunityReviewsService.SubmitReview
 */
CommunityReviewsService.method.submitReview;
/**
 * @generated from rpc blockninja.v1.CommunityReviewsService.GetReview
 */
CommunityReviewsService.method.getReview;
/**
 * @generated from rpc blockninja.v1.CommunityReviewsService.ListReviewsForItem
 */
CommunityReviewsService.method.listReviewsForItem;
/**
 * @generated from rpc blockninja.v1.CommunityReviewsService.ListReviewsByUser
 */
CommunityReviewsService.method.listReviewsByUser;
/**
 * @generated from rpc blockninja.v1.CommunityReviewsService.VoteHelpful
 */
CommunityReviewsService.method.voteHelpful;
/**
 * @generated from rpc blockninja.v1.CommunityReviewsService.RemoveVote
 */
CommunityReviewsService.method.removeVote;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/content_search.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/content_search.proto.
 */
const file_blockninja_v1_content_search = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_timestamp],
);
/**
 * ContentSearchService provides semantic search over CMS content using pgvector embeddings
 *
 * @generated from service blockninja.v1.ContentSearchService
 */
const ContentSearchService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_content_search, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/content_search.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Search content using natural language query
 *
 * @generated from rpc blockninja.v1.ContentSearchService.Search
 */
ContentSearchService.method.search;
/**
 * Generate embedding for a single piece of content
 *
 * @generated from rpc blockninja.v1.ContentSearchService.GenerateEmbedding
 */
ContentSearchService.method.generateEmbedding;
/**
 * Bulk generate embeddings for multiple content items
 *
 * @generated from rpc blockninja.v1.ContentSearchService.BulkGenerateEmbeddings
 */
ContentSearchService.method.bulkGenerateEmbeddings;
/**
 * Get embedding coverage status across content types
 *
 * @generated from rpc blockninja.v1.ContentSearchService.GetEmbeddingStatus
 */
ContentSearchService.method.getEmbeddingStatus;
/**
 * List all indexable data sources with enabled/disabled status
 *
 * @generated from rpc blockninja.v1.ContentSearchService.ListEmbeddingSources
 */
ContentSearchService.method.listEmbeddingSources;
/**
 * Detailed per-source-type embedding status (counts, coverage, timestamps)
 *
 * @generated from rpc blockninja.v1.ContentSearchService.GetDetailedEmbeddingStatus
 */
ContentSearchService.method.getDetailedEmbeddingStatus;
/**
 * List configured search scopes
 *
 * @generated from rpc blockninja.v1.ContentSearchService.ListSearchScopes
 */
ContentSearchService.method.listSearchScopes;
/**
 * Create a named search scope
 *
 * @generated from rpc blockninja.v1.ContentSearchService.CreateSearchScope
 */
ContentSearchService.method.createSearchScope;
/**
 * Update a search scope
 *
 * @generated from rpc blockninja.v1.ContentSearchService.UpdateSearchScope
 */
ContentSearchService.method.updateSearchScope;
/**
 * Delete a search scope
 *
 * @generated from rpc blockninja.v1.ContentSearchService.DeleteSearchScope
 */
ContentSearchService.method.deleteSearchScope;
/**
 * Trigger re-indexing for a specific source type
 *
 * @generated from rpc blockninja.v1.ContentSearchService.ReindexSource
 */
ContentSearchService.method.reindexSource;
/**
 * Delete all embeddings for a source type
 *
 * @generated from rpc blockninja.v1.ContentSearchService.PurgeSourceEmbeddings
 */
ContentSearchService.method.purgeSourceEmbeddings;
/**
 * Trigger full reindexing of all embedding sources
 *
 * @generated from rpc blockninja.v1.ContentSearchService.ReindexAllEmbeddings
 */
ContentSearchService.method.reindexAllEmbeddings;
/**
 * Get embedding provider status and counts (lightweight admin check)
 *
 * @generated from rpc blockninja.v1.ContentSearchService.GetEmbeddingProviderStatus
 */
ContentSearchService.method.getEmbeddingProviderStatus;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/dashboard.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/dashboard.proto.
 */
const file_blockninja_v1_dashboard = /*@__PURE__*/ fileDesc(
	"Ch1ibG9ja25pbmphL3YxL2Rhc2hib2FyZC5wcm90bxINYmxvY2tuaW5qYS52MSIbChlHZXREYXNoYm9hcmRBbGVydHNSZXF1ZXN0InEKFERhc2hib2FyZEFsZXJ0Q291bnRzEhIKCmVycm9yc180MDQYASABKAMSGwoTdW5wdWJsaXNoZWRfY2hhbmdlcxgCIAEoAxITCgttaXNzaW5nX3NlbxgDIAEoAxITCgtsb3dfdHJhZmZpYxgEIAEoAyJRChpHZXREYXNoYm9hcmRBbGVydHNSZXNwb25zZRIzCgZjb3VudHMYASABKAsyIy5ibG9ja25pbmphLnYxLkRhc2hib2FyZEFsZXJ0Q291bnRzIhgKFkdldENvbnRlbnRTdGF0c1JlcXVlc3QizwEKF0dldENvbnRlbnRTdGF0c1Jlc3BvbnNlEhcKD3B1Ymxpc2hlZF9wYWdlcxgBIAEoAxITCgtkcmFmdF9wYWdlcxgCIAEoAxIXCg9wdWJsaXNoZWRfcG9zdHMYAyABKAMSEwoLZHJhZnRfcG9zdHMYBCABKAMSEwoLdG90YWxfcGFnZXMYBSABKAMSEwoLdG90YWxfcG9zdHMYBiABKAMSGQoRdG90YWxfc3Vic2NyaWJlcnMYByABKAMSEwoLdG90YWxfbWVkaWEYCCABKAMiKQoYR2V0UmVjZW50QWN0aXZpdHlSZXF1ZXN0Eg0KBWxpbWl0GAEgASgFIq4BCgxBY3Rpdml0eUl0ZW0SCgoCaWQYASABKAkSEwoLYWN0b3JfZW1haWwYAiABKAkSDgoGYWN0aW9uGAMgASgJEhAKCHJlc291cmNlGAQgASgJEhMKC3Jlc291cmNlX2lkGAUgASgJEhYKDnJlc291cmNlX3RpdGxlGAYgASgJEi4KCmNyZWF0ZWRfYXQYByABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wIkwKGUdldFJlY2VudEFjdGl2aXR5UmVzcG9uc2USLwoKYWN0aXZpdGllcxgBIAMoCzIbLmJsb2NrbmluamEudjEuQWN0aXZpdHlJdGVtIiQKE0dldDQwNEVycm9yc1JlcXVlc3QSDQoFbGltaXQYASABKAUiJgoIRXJyb3I0MDQSDAoEcGF0aBgBIAEoCRIMCgRoaXRzGAIgASgDIlQKFEdldDQwNEVycm9yc1Jlc3BvbnNlEicKBmVycm9ycxgBIAMoCzIXLmJsb2NrbmluamEudjEuRXJyb3I0MDQSEwoLdG90YWxfY291bnQYAiABKAMiPQoZR2V0TG93VHJhZmZpY1BhZ2VzUmVxdWVzdBIRCgltaW5fdmlld3MYASABKAUSDQoFbGltaXQYAiABKAUiSAoOTG93VHJhZmZpY1BhZ2USCgoCaWQYASABKAkSDQoFdGl0bGUYAiABKAkSDAoEc2x1ZxgDIAEoCRINCgV2aWV3cxgEIAEoAyJfChpHZXRMb3dUcmFmZmljUGFnZXNSZXNwb25zZRIsCgVwYWdlcxgBIAMoCzIdLmJsb2NrbmluamEudjEuTG93VHJhZmZpY1BhZ2USEwoLdG90YWxfY291bnQYAiABKAMiNgolR2V0UGFnZXNXaXRoVW5wdWJsaXNoZWRDaGFuZ2VzUmVxdWVzdBINCgVsaW1pdBgBIAEoBSJ9Cg9VbnB1Ymxpc2hlZFBhZ2USCgoCaWQYASABKAkSDQoFdGl0bGUYAiABKAkSDAoEc2x1ZxgDIAEoCRIRCglwb3N0X3R5cGUYBCABKAkSLgoKdXBkYXRlZF9hdBgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXAibAomR2V0UGFnZXNXaXRoVW5wdWJsaXNoZWRDaGFuZ2VzUmVzcG9uc2USLQoFcGFnZXMYASADKAsyHi5ibG9ja25pbmphLnYxLlVucHVibGlzaGVkUGFnZRITCgt0b3RhbF9jb3VudBgCIAEoAyIqChlHZXRQYWdlc01pc3NpbmdTRU9SZXF1ZXN0Eg0KBWxpbWl0GAEgASgFIo4BCg5NaXNzaW5nU0VPUGFnZRIKCgJpZBgBIAEoCRINCgV0aXRsZRgCIAEoCRIMCgRzbHVnGAMgASgJEhEKCXBvc3RfdHlwZRgEIAEoCRIgChhtaXNzaW5nX21ldGFfZGVzY3JpcHRpb24YBSABKAgSHgoWbWlzc2luZ19mZWF0dXJlZF9pbWFnZRgGIAEoCCJfChpHZXRQYWdlc01pc3NpbmdTRU9SZXNwb25zZRIsCgVwYWdlcxgBIAMoCzIdLmJsb2NrbmluamEudjEuTWlzc2luZ1NFT1BhZ2USEwoLdG90YWxfY291bnQYAiABKAMyhgYKEERhc2hib2FyZFNlcnZpY2USaQoSR2V0RGFzaGJvYXJkQWxlcnRzEiguYmxvY2tuaW5qYS52MS5HZXREYXNoYm9hcmRBbGVydHNSZXF1ZXN0GikuYmxvY2tuaW5qYS52MS5HZXREYXNoYm9hcmRBbGVydHNSZXNwb25zZRJgCg9HZXRDb250ZW50U3RhdHMSJS5ibG9ja25pbmphLnYxLkdldENvbnRlbnRTdGF0c1JlcXVlc3QaJi5ibG9ja25pbmphLnYxLkdldENvbnRlbnRTdGF0c1Jlc3BvbnNlEmYKEUdldFJlY2VudEFjdGl2aXR5EicuYmxvY2tuaW5qYS52MS5HZXRSZWNlbnRBY3Rpdml0eVJlcXVlc3QaKC5ibG9ja25pbmphLnYxLkdldFJlY2VudEFjdGl2aXR5UmVzcG9uc2USVwoMR2V0NDA0RXJyb3JzEiIuYmxvY2tuaW5qYS52MS5HZXQ0MDRFcnJvcnNSZXF1ZXN0GiMuYmxvY2tuaW5qYS52MS5HZXQ0MDRFcnJvcnNSZXNwb25zZRJpChJHZXRMb3dUcmFmZmljUGFnZXMSKC5ibG9ja25pbmphLnYxLkdldExvd1RyYWZmaWNQYWdlc1JlcXVlc3QaKS5ibG9ja25pbmphLnYxLkdldExvd1RyYWZmaWNQYWdlc1Jlc3BvbnNlEo0BCh5HZXRQYWdlc1dpdGhVbnB1Ymxpc2hlZENoYW5nZXMSNC5ibG9ja25pbmphLnYxLkdldFBhZ2VzV2l0aFVucHVibGlzaGVkQ2hhbmdlc1JlcXVlc3QaNS5ibG9ja25pbmphLnYxLkdldFBhZ2VzV2l0aFVucHVibGlzaGVkQ2hhbmdlc1Jlc3BvbnNlEmkKEkdldFBhZ2VzTWlzc2luZ1NFTxIoLmJsb2NrbmluamEudjEuR2V0UGFnZXNNaXNzaW5nU0VPUmVxdWVzdBopLmJsb2NrbmluamEudjEuR2V0UGFnZXNNaXNzaW5nU0VPUmVzcG9uc2VCxAEKEWNvbS5ibG9ja25pbmphLnYxQg5EYXNoYm9hcmRQcm90b1ABWkpnaXQuZGV2LmFsZXhkdW5tb3cuY29tL2Jsb2NrL25pbmphL2ludGVybmFsL2FwaS9ibG9ja25pbmphL3YxO2Jsb2NrbmluamF2MaICA0JYWKoCDUJsb2NrbmluamEuVjHKAg1CbG9ja25pbmphXFYx4gIZQmxvY2tuaW5qYVxWMVxHUEJNZXRhZGF0YeoCDkJsb2NrbmluamE6OlYxYgZwcm90bzM",
	[file_google_protobuf_timestamp],
);
/**
 * DashboardService provides aggregated data for the admin dashboard
 *
 * @generated from service blockninja.v1.DashboardService
 */
const DashboardService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_dashboard, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/dashboard.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Get all dashboard alerts in one call
 *
 * @generated from rpc blockninja.v1.DashboardService.GetDashboardAlerts
 */
DashboardService.method.getDashboardAlerts;
/**
 * Get content statistics
 *
 * @generated from rpc blockninja.v1.DashboardService.GetContentStats
 */
DashboardService.method.getContentStats;
/**
 * Get recent content activity
 *
 * @generated from rpc blockninja.v1.DashboardService.GetRecentActivity
 */
DashboardService.method.getRecentActivity;
/**
 * Get 404 errors
 *
 * @generated from rpc blockninja.v1.DashboardService.Get404Errors
 */
DashboardService.method.get404Errors;
/**
 * Get low traffic pages
 *
 * @generated from rpc blockninja.v1.DashboardService.GetLowTrafficPages
 */
DashboardService.method.getLowTrafficPages;
/**
 * Get pages with unpublished changes
 *
 * @generated from rpc blockninja.v1.DashboardService.GetPagesWithUnpublishedChanges
 */
DashboardService.method.getPagesWithUnpublishedChanges;
/**
 * Get pages missing SEO
 *
 * @generated from rpc blockninja.v1.DashboardService.GetPagesMissingSEO
 */
DashboardService.method.getPagesMissingSEO;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/data_suggestions.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/data_suggestions.proto.
 */
const file_blockninja_v1_data_suggestions = /*@__PURE__*/ fileDesc(
	"CiRibG9ja25pbmphL3YxL2RhdGFfc3VnZ2VzdGlvbnMucHJvdG8SDWJsb2NrbmluamEudjEimgQKDkRhdGFTdWdnZXN0aW9uEgoKAmlkGAEgASgJEhAKCHRhYmxlX2lkGAIgASgJEg4KBnJvd19pZBgDIAEoCRIPCgd1c2VyX2lkGAQgASgJEjIKEXN1Z2dlc3RlZF9jaGFuZ2VzGAUgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdBIOCgZyZWFzb24YBiABKAkSDgoGc3RhdHVzGAcgASgJEhgKC3Jldmlld2VkX2J5GAggASgJSACIAQESNAoLcmV2aWV3ZWRfYXQYCSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wSAGIAQESHQoQcmVqZWN0aW9uX3JlYXNvbhgKIAEoCUgCiAEBEi4KCmNyZWF0ZWRfYXQYCyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEi4KCnVwZGF0ZWRfYXQYDCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEjIKDnJvd192ZXJzaW9uX2F0GA0gASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIZChF1c2VyX2Rpc3BsYXlfbmFtZRgOIAEoCRIQCghyb3dfbmFtZRgPIAEoCRIQCghpc19zdGFsZRgQIAEoCEIOCgxfcmV2aWV3ZWRfYnlCDgoMX3Jldmlld2VkX2F0QhMKEV9yZWplY3Rpb25fcmVhc29uIn8KF1N1Ym1pdFN1Z2dlc3Rpb25SZXF1ZXN0EhAKCHRhYmxlX2lkGAEgASgJEg4KBnJvd19pZBgCIAEoCRIyChFzdWdnZXN0ZWRfY2hhbmdlcxgDIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QSDgoGcmVhc29uGAQgASgJImQKGFN1Ym1pdFN1Z2dlc3Rpb25SZXNwb25zZRIxCgpzdWdnZXN0aW9uGAEgASgLMh0uYmxvY2tuaW5qYS52MS5EYXRhU3VnZ2VzdGlvbhIVCg1hdXRvX2FwcHJvdmVkGAIgASgIImIKFkxpc3RTdWdnZXN0aW9uc1JlcXVlc3QSEAoIdGFibGVfaWQYASABKAkSFQoNc3RhdHVzX2ZpbHRlchgCIAEoCRIMCgRwYWdlGAMgASgFEhEKCXBhZ2Vfc2l6ZRgEIAEoBSJiChdMaXN0U3VnZ2VzdGlvbnNSZXNwb25zZRIyCgtzdWdnZXN0aW9ucxgBIAMoCzIdLmJsb2NrbmluamEudjEuRGF0YVN1Z2dlc3Rpb24SEwoLdG90YWxfY291bnQYAiABKAUiQAoYQXBwcm92ZVN1Z2dlc3Rpb25SZXF1ZXN0EhUKDXN1Z2dlc3Rpb25faWQYASABKAkSDQoFZm9yY2UYAiABKAgiYQoZQXBwcm92ZVN1Z2dlc3Rpb25SZXNwb25zZRIxCgpzdWdnZXN0aW9uGAEgASgLMh0uYmxvY2tuaW5qYS52MS5EYXRhU3VnZ2VzdGlvbhIRCgl3YXNfc3RhbGUYAiABKAgiQAoXUmVqZWN0U3VnZ2VzdGlvblJlcXVlc3QSFQoNc3VnZ2VzdGlvbl9pZBgBIAEoCRIOCgZyZWFzb24YAiABKAkiTQoYUmVqZWN0U3VnZ2VzdGlvblJlc3BvbnNlEjEKCnN1Z2dlc3Rpb24YASABKAsyHS5ibG9ja25pbmphLnYxLkRhdGFTdWdnZXN0aW9uIjsKGExpc3RNeVN1Z2dlc3Rpb25zUmVxdWVzdBIMCgRwYWdlGAEgASgFEhEKCXBhZ2Vfc2l6ZRgCIAEoBSJkChlMaXN0TXlTdWdnZXN0aW9uc1Jlc3BvbnNlEjIKC3N1Z2dlc3Rpb25zGAEgAygLMh0uYmxvY2tuaW5qYS52MS5EYXRhU3VnZ2VzdGlvbhITCgt0b3RhbF9jb3VudBgCIAEoBTKUBAoWRGF0YVN1Z2dlc3Rpb25zU2VydmljZRJjChBTdWJtaXRTdWdnZXN0aW9uEiYuYmxvY2tuaW5qYS52MS5TdWJtaXRTdWdnZXN0aW9uUmVxdWVzdBonLmJsb2NrbmluamEudjEuU3VibWl0U3VnZ2VzdGlvblJlc3BvbnNlEmAKD0xpc3RTdWdnZXN0aW9ucxIlLmJsb2NrbmluamEudjEuTGlzdFN1Z2dlc3Rpb25zUmVxdWVzdBomLmJsb2NrbmluamEudjEuTGlzdFN1Z2dlc3Rpb25zUmVzcG9uc2USZgoRQXBwcm92ZVN1Z2dlc3Rpb24SJy5ibG9ja25pbmphLnYxLkFwcHJvdmVTdWdnZXN0aW9uUmVxdWVzdBooLmJsb2NrbmluamEudjEuQXBwcm92ZVN1Z2dlc3Rpb25SZXNwb25zZRJjChBSZWplY3RTdWdnZXN0aW9uEiYuYmxvY2tuaW5qYS52MS5SZWplY3RTdWdnZXN0aW9uUmVxdWVzdBonLmJsb2NrbmluamEudjEuUmVqZWN0U3VnZ2VzdGlvblJlc3BvbnNlEmYKEUxpc3RNeVN1Z2dlc3Rpb25zEicuYmxvY2tuaW5qYS52MS5MaXN0TXlTdWdnZXN0aW9uc1JlcXVlc3QaKC5ibG9ja25pbmphLnYxLkxpc3RNeVN1Z2dlc3Rpb25zUmVzcG9uc2VCygEKEWNvbS5ibG9ja25pbmphLnYxQhREYXRhU3VnZ2VzdGlvbnNQcm90b1ABWkpnaXQuZGV2LmFsZXhkdW5tb3cuY29tL2Jsb2NrL25pbmphL2ludGVybmFsL2FwaS9ibG9ja25pbmphL3YxO2Jsb2NrbmluamF2MaICA0JYWKoCDUJsb2NrbmluamEuVjHKAg1CbG9ja25pbmphXFYx4gIZQmxvY2tuaW5qYVxWMVxHUEJNZXRhZGF0YeoCDkJsb2NrbmluamE6OlYxYgZwcm90bzM",
	[file_google_protobuf_struct, file_google_protobuf_timestamp],
);
/**
 * @generated from service blockninja.v1.DataSuggestionsService
 */
const DataSuggestionsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_data_suggestions, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/data_suggestions.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Submit a suggestion for field corrections (public auth required)
 *
 * @generated from rpc blockninja.v1.DataSuggestionsService.SubmitSuggestion
 */
DataSuggestionsService.method.submitSuggestion;
/**
 * List suggestions for a table (admin only)
 *
 * @generated from rpc blockninja.v1.DataSuggestionsService.ListSuggestions
 */
DataSuggestionsService.method.listSuggestions;
/**
 * Approve a suggestion — applies changes to the row (admin only)
 *
 * @generated from rpc blockninja.v1.DataSuggestionsService.ApproveSuggestion
 */
DataSuggestionsService.method.approveSuggestion;
/**
 * Reject a suggestion (admin only)
 *
 * @generated from rpc blockninja.v1.DataSuggestionsService.RejectSuggestion
 */
DataSuggestionsService.method.rejectSuggestion;
/**
 * List current user's own suggestions (public auth required)
 *
 * @generated from rpc blockninja.v1.DataSuggestionsService.ListMySuggestions
 */
DataSuggestionsService.method.listMySuggestions;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/data_tables.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/data_tables.proto.
 */
const file_blockninja_v1_data_tables = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_struct, file_google_protobuf_timestamp],
);
/**
 * @generated from enum blockninja.v1.FieldType
 */
var FieldType;
(function (FieldType) {
	/**
	 * @generated from enum value: FIELD_TYPE_UNSPECIFIED = 0;
	 */
	FieldType[(FieldType["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: FIELD_TYPE_STRING = 1;
	 */
	FieldType[(FieldType["STRING"] = 1)] = "STRING";
	/**
	 * @generated from enum value: FIELD_TYPE_TEXT = 2;
	 */
	FieldType[(FieldType["TEXT"] = 2)] = "TEXT";
	/**
	 * @generated from enum value: FIELD_TYPE_NUMBER = 3;
	 */
	FieldType[(FieldType["NUMBER"] = 3)] = "NUMBER";
	/**
	 * @generated from enum value: FIELD_TYPE_INTEGER = 4;
	 */
	FieldType[(FieldType["INTEGER"] = 4)] = "INTEGER";
	/**
	 * @generated from enum value: FIELD_TYPE_BOOLEAN = 5;
	 */
	FieldType[(FieldType["BOOLEAN"] = 5)] = "BOOLEAN";
	/**
	 * @generated from enum value: FIELD_TYPE_DATE = 6;
	 */
	FieldType[(FieldType["DATE"] = 6)] = "DATE";
	/**
	 * @generated from enum value: FIELD_TYPE_DATETIME = 7;
	 */
	FieldType[(FieldType["DATETIME"] = 7)] = "DATETIME";
	/**
	 * @generated from enum value: FIELD_TYPE_EMAIL = 8;
	 */
	FieldType[(FieldType["EMAIL"] = 8)] = "EMAIL";
	/**
	 * @generated from enum value: FIELD_TYPE_URL = 9;
	 */
	FieldType[(FieldType["URL"] = 9)] = "URL";
	/**
	 * @generated from enum value: FIELD_TYPE_SELECT = 10;
	 */
	FieldType[(FieldType["SELECT"] = 10)] = "SELECT";
	/**
	 * @generated from enum value: FIELD_TYPE_MEDIA = 11;
	 */
	FieldType[(FieldType["MEDIA"] = 11)] = "MEDIA";
	/**
	 * @generated from enum value: FIELD_TYPE_PAGE = 12;
	 */
	FieldType[(FieldType["PAGE"] = 12)] = "PAGE";
	/**
	 * @generated from enum value: FIELD_TYPE_JSON = 13;
	 */
	FieldType[(FieldType["JSON"] = 13)] = "JSON";
})(FieldType || (FieldType = {}));
/**
 * @generated from enum blockninja.v1.ImportMode
 */
var ImportMode;
(function (ImportMode) {
	/**
	 * @generated from enum value: IMPORT_MODE_UNSPECIFIED = 0;
	 */
	ImportMode[(ImportMode["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * Add new rows
	 *
	 * @generated from enum value: IMPORT_MODE_APPEND = 1;
	 */
	ImportMode[(ImportMode["APPEND"] = 1)] = "APPEND";
	/**
	 * Delete all, then insert
	 *
	 * @generated from enum value: IMPORT_MODE_REPLACE = 2;
	 */
	ImportMode[(ImportMode["REPLACE"] = 2)] = "REPLACE";
	/**
	 * Update existing, insert new (requires primary_key_field)
	 *
	 * @generated from enum value: IMPORT_MODE_UPSERT = 3;
	 */
	ImportMode[(ImportMode["UPSERT"] = 3)] = "UPSERT";
})(ImportMode || (ImportMode = {}));
/**
 * DataTablesService manages user-defined data tables with JSONB storage.
 * Tables have a schema defining fields, and rows store data matching that schema.
 *
 * @generated from service blockninja.v1.DataTablesService
 */
const DataTablesService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_data_tables, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/data_tables.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Table CRUD
 *
 * @generated from rpc blockninja.v1.DataTablesService.ListDataTables
 */
DataTablesService.method.listDataTables;
/**
 * @generated from rpc blockninja.v1.DataTablesService.GetDataTable
 */
DataTablesService.method.getDataTable;
/**
 * @generated from rpc blockninja.v1.DataTablesService.CreateDataTable
 */
DataTablesService.method.createDataTable;
/**
 * @generated from rpc blockninja.v1.DataTablesService.UpdateDataTable
 */
DataTablesService.method.updateDataTable;
/**
 * @generated from rpc blockninja.v1.DataTablesService.DeleteDataTable
 */
DataTablesService.method.deleteDataTable;
/**
 * Schema inference from sample data
 *
 * @generated from rpc blockninja.v1.DataTablesService.InferSchemaFromData
 */
DataTablesService.method.inferSchemaFromData;
/**
 * Row CRUD
 *
 * @generated from rpc blockninja.v1.DataTablesService.ListDataTableRows
 */
DataTablesService.method.listDataTableRows;
/**
 * @generated from rpc blockninja.v1.DataTablesService.GetDataTableRow
 */
DataTablesService.method.getDataTableRow;
/**
 * @generated from rpc blockninja.v1.DataTablesService.CreateDataTableRow
 */
DataTablesService.method.createDataTableRow;
/**
 * @generated from rpc blockninja.v1.DataTablesService.UpdateDataTableRow
 */
DataTablesService.method.updateDataTableRow;
/**
 * @generated from rpc blockninja.v1.DataTablesService.DeleteDataTableRow
 */
DataTablesService.method.deleteDataTableRow;
/**
 * @generated from rpc blockninja.v1.DataTablesService.BulkDeleteDataTableRows
 */
DataTablesService.method.bulkDeleteDataTableRows;
/**
 * @generated from rpc blockninja.v1.DataTablesService.ReorderDataTableRows
 */
DataTablesService.method.reorderDataTableRows;
/**
 * @generated from rpc blockninja.v1.DataTablesService.ClearDataTableRows
 */
DataTablesService.method.clearDataTableRows;
/**
 * Import/Export
 *
 * @generated from rpc blockninja.v1.DataTablesService.ImportCSVPreview
 */
DataTablesService.method.importCSVPreview;
/**
 * @generated from rpc blockninja.v1.DataTablesService.ImportCSV
 */
DataTablesService.method.importCSV;
/**
 * @generated from rpc blockninja.v1.DataTablesService.ExportCSV
 */
DataTablesService.method.exportCSV;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/embeds.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/embeds.proto.
 */
const file_blockninja_v1_embeds = /*@__PURE__*/ fileDesc(
	"ChpibG9ja25pbmphL3YxL2VtYmVkcy5wcm90bxINYmxvY2tuaW5qYS52MSKyAgoNRW1iZWRUZW1wbGF0ZRIKCgJpZBgBIAEoCRILCgNrZXkYAiABKAkSDQoFdGl0bGUYAyABKAkSEwoLZGVzY3JpcHRpb24YBCABKAkSDAoEaWNvbhgFIAEoCRIYChBkYXRhX3NvdXJjZV90eXBlGAYgASgJEhEKCXRhYmxlX2tleRgHIAEoCRIQCgh0YWJsZV9pZBgIIAEoCRITCgtsYWJlbF9maWVsZBgJIAEoCRIVCgh0ZW1wbGF0ZRgKIAEoCUgAiAEBEi4KCmNyZWF0ZWRfYXQYCyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEi4KCnVwZGF0ZWRfYXQYDCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgsKCV90ZW1wbGF0ZSIbChlMaXN0RW1iZWRUZW1wbGF0ZXNSZXF1ZXN0Ik0KGkxpc3RFbWJlZFRlbXBsYXRlc1Jlc3BvbnNlEi8KCXRlbXBsYXRlcxgBIAMoCzIcLmJsb2NrbmluamEudjEuRW1iZWRUZW1wbGF0ZSIlChdHZXRFbWJlZFRlbXBsYXRlUmVxdWVzdBIKCgJpZBgBIAEoCSJKChhHZXRFbWJlZFRlbXBsYXRlUmVzcG9uc2USLgoIdGVtcGxhdGUYASABKAsyHC5ibG9ja25pbmphLnYxLkVtYmVkVGVtcGxhdGUirwEKGkNyZWF0ZUVtYmVkVGVtcGxhdGVSZXF1ZXN0Eg0KBXRpdGxlGAEgASgJEgsKA2tleRgCIAEoCRIMCgRpY29uGAMgASgJEhMKC2Rlc2NyaXB0aW9uGAQgASgJEhgKEGRhdGFfc291cmNlX3R5cGUYBSABKAkSEQoJdGFibGVfa2V5GAYgASgJEhMKC2xhYmVsX2ZpZWxkGAcgASgJEhAKCHRlbXBsYXRlGAggASgJIk0KG0NyZWF0ZUVtYmVkVGVtcGxhdGVSZXNwb25zZRIuCgh0ZW1wbGF0ZRgBIAEoCzIcLmJsb2NrbmluamEudjEuRW1iZWRUZW1wbGF0ZSKuAQoaVXBkYXRlRW1iZWRUZW1wbGF0ZVJlcXVlc3QSCgoCaWQYASABKAkSDQoFdGl0bGUYAiABKAkSDAoEaWNvbhgDIAEoCRITCgtkZXNjcmlwdGlvbhgEIAEoCRIYChBkYXRhX3NvdXJjZV90eXBlGAUgASgJEhEKCXRhYmxlX2tleRgGIAEoCRITCgtsYWJlbF9maWVsZBgHIAEoCRIQCgh0ZW1wbGF0ZRgIIAEoCSJNChtVcGRhdGVFbWJlZFRlbXBsYXRlUmVzcG9uc2USLgoIdGVtcGxhdGUYASABKAsyHC5ibG9ja25pbmphLnYxLkVtYmVkVGVtcGxhdGUiKAoaRGVsZXRlRW1iZWRUZW1wbGF0ZVJlcXVlc3QSCgoCaWQYASABKAkiHQobRGVsZXRlRW1iZWRUZW1wbGF0ZVJlc3BvbnNlIkwKGlNlYXJjaERhdGFUYWJsZVJvd3NSZXF1ZXN0EhAKCHRhYmxlX2lkGAEgASgJEg0KBXF1ZXJ5GAIgASgJEg0KBWxpbWl0GAMgASgFIkcKEkRhdGFUYWJsZVJvd1Jlc3VsdBIKCgJpZBgBIAEoCRIlCgRkYXRhGAIgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdCJOChtTZWFyY2hEYXRhVGFibGVSb3dzUmVzcG9uc2USLwoEcm93cxgBIAMoCzIhLmJsb2NrbmluamEudjEuRGF0YVRhYmxlUm93UmVzdWx0MpcFCg1FbWJlZHNTZXJ2aWNlEmkKEkxpc3RFbWJlZFRlbXBsYXRlcxIoLmJsb2NrbmluamEudjEuTGlzdEVtYmVkVGVtcGxhdGVzUmVxdWVzdBopLmJsb2NrbmluamEudjEuTGlzdEVtYmVkVGVtcGxhdGVzUmVzcG9uc2USYwoQR2V0RW1iZWRUZW1wbGF0ZRImLmJsb2NrbmluamEudjEuR2V0RW1iZWRUZW1wbGF0ZVJlcXVlc3QaJy5ibG9ja25pbmphLnYxLkdldEVtYmVkVGVtcGxhdGVSZXNwb25zZRJsChNDcmVhdGVFbWJlZFRlbXBsYXRlEikuYmxvY2tuaW5qYS52MS5DcmVhdGVFbWJlZFRlbXBsYXRlUmVxdWVzdBoqLmJsb2NrbmluamEudjEuQ3JlYXRlRW1iZWRUZW1wbGF0ZVJlc3BvbnNlEmwKE1VwZGF0ZUVtYmVkVGVtcGxhdGUSKS5ibG9ja25pbmphLnYxLlVwZGF0ZUVtYmVkVGVtcGxhdGVSZXF1ZXN0GiouYmxvY2tuaW5qYS52MS5VcGRhdGVFbWJlZFRlbXBsYXRlUmVzcG9uc2USbAoTRGVsZXRlRW1iZWRUZW1wbGF0ZRIpLmJsb2NrbmluamEudjEuRGVsZXRlRW1iZWRUZW1wbGF0ZVJlcXVlc3QaKi5ibG9ja25pbmphLnYxLkRlbGV0ZUVtYmVkVGVtcGxhdGVSZXNwb25zZRJsChNTZWFyY2hEYXRhVGFibGVSb3dzEikuYmxvY2tuaW5qYS52MS5TZWFyY2hEYXRhVGFibGVSb3dzUmVxdWVzdBoqLmJsb2NrbmluamEudjEuU2VhcmNoRGF0YVRhYmxlUm93c1Jlc3BvbnNlQsEBChFjb20uYmxvY2tuaW5qYS52MUILRW1iZWRzUHJvdG9QAVpKZ2l0LmRldi5hbGV4ZHVubW93LmNvbS9ibG9jay9uaW5qYS9pbnRlcm5hbC9hcGkvYmxvY2tuaW5qYS92MTtibG9ja25pbmphdjGiAgNCWFiqAg1CbG9ja25pbmphLlYxygINQmxvY2tuaW5qYVxWMeICGUJsb2NrbmluamFcVjFcR1BCTWV0YWRhdGHqAg5CbG9ja25pbmphOjpWMWIGcHJvdG8z",
	[file_google_protobuf_struct, file_google_protobuf_timestamp],
);
/**
 * @generated from service blockninja.v1.EmbedsService
 */
const EmbedsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_embeds, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/embeds.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.EmbedsService.ListEmbedTemplates
 */
EmbedsService.method.listEmbedTemplates;
/**
 * @generated from rpc blockninja.v1.EmbedsService.GetEmbedTemplate
 */
EmbedsService.method.getEmbedTemplate;
/**
 * @generated from rpc blockninja.v1.EmbedsService.CreateEmbedTemplate
 */
EmbedsService.method.createEmbedTemplate;
/**
 * @generated from rpc blockninja.v1.EmbedsService.UpdateEmbedTemplate
 */
EmbedsService.method.updateEmbedTemplate;
/**
 * @generated from rpc blockninja.v1.EmbedsService.DeleteEmbedTemplate
 */
EmbedsService.method.deleteEmbedTemplate;
/**
 * @generated from rpc blockninja.v1.EmbedsService.SearchDataTableRows
 */
EmbedsService.method.searchDataTableRows;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/engagement.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/engagement.proto.
 */
const file_blockninja_v1_engagement = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_timestamp],
);
/**
 * @generated from enum blockninja.v1.EngagementTimeRange
 */
var EngagementTimeRange;
(function (EngagementTimeRange) {
	/**
	 * @generated from enum value: ENGAGEMENT_TIME_RANGE_UNSPECIFIED = 0;
	 */
	EngagementTimeRange[(EngagementTimeRange["ENGAGEMENT_TIME_RANGE_UNSPECIFIED"] = 0)] = "ENGAGEMENT_TIME_RANGE_UNSPECIFIED";
	/**
	 * @generated from enum value: ENGAGEMENT_TIME_RANGE_TODAY = 1;
	 */
	EngagementTimeRange[(EngagementTimeRange["ENGAGEMENT_TIME_RANGE_TODAY"] = 1)] = "ENGAGEMENT_TIME_RANGE_TODAY";
	/**
	 * @generated from enum value: ENGAGEMENT_TIME_RANGE_YESTERDAY = 2;
	 */
	EngagementTimeRange[(EngagementTimeRange["ENGAGEMENT_TIME_RANGE_YESTERDAY"] = 2)] = "ENGAGEMENT_TIME_RANGE_YESTERDAY";
	/**
	 * @generated from enum value: ENGAGEMENT_TIME_RANGE_7_DAYS = 3;
	 */
	EngagementTimeRange[(EngagementTimeRange["ENGAGEMENT_TIME_RANGE_7_DAYS"] = 3)] = "ENGAGEMENT_TIME_RANGE_7_DAYS";
	/**
	 * @generated from enum value: ENGAGEMENT_TIME_RANGE_30_DAYS = 4;
	 */
	EngagementTimeRange[(EngagementTimeRange["ENGAGEMENT_TIME_RANGE_30_DAYS"] = 4)] = "ENGAGEMENT_TIME_RANGE_30_DAYS";
	/**
	 * @generated from enum value: ENGAGEMENT_TIME_RANGE_90_DAYS = 5;
	 */
	EngagementTimeRange[(EngagementTimeRange["ENGAGEMENT_TIME_RANGE_90_DAYS"] = 5)] = "ENGAGEMENT_TIME_RANGE_90_DAYS";
	/**
	 * @generated from enum value: ENGAGEMENT_TIME_RANGE_CUSTOM = 6;
	 */
	EngagementTimeRange[(EngagementTimeRange["ENGAGEMENT_TIME_RANGE_CUSTOM"] = 6)] = "ENGAGEMENT_TIME_RANGE_CUSTOM";
})(EngagementTimeRange || (EngagementTimeRange = {}));
/**
 * EngagementService provides blog post reading engagement analytics
 *
 * @generated from service blockninja.v1.EngagementService
 */
const EngagementService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_engagement, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/engagement.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Get engagement overview for a specific post
 *
 * @generated from rpc blockninja.v1.EngagementService.GetPostEngagement
 */
EngagementService.method.getPostEngagement;
/**
 * Get scroll funnel breakdown (25%, 50%, 75%, 100%)
 *
 * @generated from rpc blockninja.v1.EngagementService.GetScrollFunnel
 */
EngagementService.method.getScrollFunnel;
/**
 * Get section-level engagement (per heading dwell times)
 *
 * @generated from rpc blockninja.v1.EngagementService.GetSectionEngagement
 */
EngagementService.method.getSectionEngagement;
/**
 * Get bounce point analysis (where readers exit)
 *
 * @generated from rpc blockninja.v1.EngagementService.GetBouncePoints
 */
EngagementService.method.getBouncePoints;
/**
 * Get interaction breakdown (clicks, selections, copies)
 *
 * @generated from rpc blockninja.v1.EngagementService.GetInteractionBreakdown
 */
EngagementService.method.getInteractionBreakdown;
/**
 * Get frustration signals (rage clicks, dead clicks, erratic scrolling)
 *
 * @generated from rpc blockninja.v1.EngagementService.GetFrustrationSignals
 */
EngagementService.method.getFrustrationSignals;
/**
 * Get navigation patterns (TOC usage, anchor jumps, print attempts)
 *
 * @generated from rpc blockninja.v1.EngagementService.GetNavigationPatterns
 */
EngagementService.method.getNavigationPatterns;
/**
 * Get top highlighted phrases (popular text selections)
 *
 * @generated from rpc blockninja.v1.EngagementService.GetTopHighlightedPhrases
 */
EngagementService.method.getTopHighlightedPhrases;
/**
 * Get return visitor statistics (multi-session tracking)
 *
 * @generated from rpc blockninja.v1.EngagementService.GetReturnVisitorStats
 */
EngagementService.method.getReturnVisitorStats;
/**
 * Get top engaging posts ranked by engagement score
 *
 * @generated from rpc blockninja.v1.EngagementService.GetTopEngagingPosts
 */
EngagementService.method.getTopEngagingPosts;
/**
 * Get engagement timeseries data
 *
 * @generated from rpc blockninja.v1.EngagementService.GetEngagementTimeseries
 */
EngagementService.method.getEngagementTimeseries;
/**
 * Get quality signals breakdown (bot detection, quality scores)
 *
 * @generated from rpc blockninja.v1.EngagementService.GetQualitySignals
 */
EngagementService.method.getQualitySignals;
/**
 * Get reader segments (scanners, readers, deep readers)
 *
 * @generated from rpc blockninja.v1.EngagementService.GetReaderSegments
 */
EngagementService.method.getReaderSegments;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/icons.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/icons.proto.
 */
const file_blockninja_v1_icons = /*@__PURE__*/ fileDesc(
	" ",
);
/**
 * IconsService manages icon packs and provides icon search functionality.
 *
 * @generated from service blockninja.v1.IconsService
 */
const IconsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_icons, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/icons.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Pack management
 *
 * @generated from rpc blockninja.v1.IconsService.ListIconPacks
 */
IconsService.method.listIconPacks;
/**
 * @generated from rpc blockninja.v1.IconsService.GetIconPack
 */
IconsService.method.getIconPack;
/**
 * @generated from rpc blockninja.v1.IconsService.EnableIconPack
 */
IconsService.method.enableIconPack;
/**
 * @generated from rpc blockninja.v1.IconsService.DisableIconPack
 */
IconsService.method.disableIconPack;
/**
 * Registry (download on demand)
 *
 * @generated from rpc blockninja.v1.IconsService.ListAvailablePacks
 */
IconsService.method.listAvailablePacks;
/**
 * @generated from rpc blockninja.v1.IconsService.InstallPack
 */
IconsService.method.installPack;
/**
 * @generated from rpc blockninja.v1.IconsService.UninstallPack
 */
IconsService.method.uninstallPack;
/**
 * Custom upload
 *
 * @generated from rpc blockninja.v1.IconsService.UploadIconPack
 */
IconsService.method.uploadIconPack;
/**
 * Icon search (for icon picker)
 *
 * @generated from rpc blockninja.v1.IconsService.SearchIcons
 */
IconsService.method.searchIcons;
/**
 * Get single icon SVG (for preview)
 *
 * @generated from rpc blockninja.v1.IconsService.GetIcon
 */
IconsService.method.getIcon;
/**
 * List categories for a pack
 *
 * @generated from rpc blockninja.v1.IconsService.ListIconCategories
 */
IconsService.method.listIconCategories;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/image_analysis.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/image_analysis.proto.
 */
const file_blockninja_v1_image_analysis = /*@__PURE__*/ fileDesc(
	"CiJibG9ja25pbmphL3YxL2ltYWdlX2FuYWx5c2lzLnByb3RvEg1ibG9ja25pbmphLnYxIlkKE0FuYWx5emVJbWFnZVJlcXVlc3QSEAoIbWVkaWFfaWQYASABKAkSGQoRZ2VuZXJhdGVfYWx0X3RleHQYAiABKAgSFQoNZ2VuZXJhdGVfdGFncxgDIAEoCCI2ChRBbmFseXplSW1hZ2VSZXNwb25zZRIQCghhbHRfdGV4dBgBIAEoCRIMCgR0YWdzGAIgAygJMm8KFEltYWdlQW5hbHlzaXNTZXJ2aWNlElcKDEFuYWx5emVJbWFnZRIiLmJsb2NrbmluamEudjEuQW5hbHl6ZUltYWdlUmVxdWVzdBojLmJsb2NrbmluamEudjEuQW5hbHl6ZUltYWdlUmVzcG9uc2VCyAEKEWNvbS5ibG9ja25pbmphLnYxQhJJbWFnZUFuYWx5c2lzUHJvdG9QAVpKZ2l0LmRldi5hbGV4ZHVubW93LmNvbS9ibG9jay9uaW5qYS9pbnRlcm5hbC9hcGkvYmxvY2tuaW5qYS92MTtibG9ja25pbmphdjGiAgNCWFiqAg1CbG9ja25pbmphLlYxygINQmxvY2tuaW5qYVxWMeICGUJsb2NrbmluamFcVjFcR1BCTWV0YWRhdGHqAg5CbG9ja25pbmphOjpWMWIGcHJvdG8z",
);
/**
 * ImageAnalysisService provides AI-powered image analysis capabilities
 *
 * @generated from service blockninja.v1.ImageAnalysisService
 */
const ImageAnalysisService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_image_analysis, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/image_analysis.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Analyze an image to generate alt text and/or tags
 *
 * @generated from rpc blockninja.v1.ImageAnalysisService.AnalyzeImage
 */
ImageAnalysisService.method.analyzeImage;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/import.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/import.proto.
 */
const file_blockninja_v1_import = /*@__PURE__*/ fileDesc(
	"ChpibG9ja25pbmphL3YxL2ltcG9ydC5wcm90bxINYmxvY2tuaW5qYS52MSIxCh1QcmV2aWV3V29yZFByZXNzSW1wb3J0UmVxdWVzdBIQCgh3eHJfZGF0YRgBIAEoDCKrAgoeUHJldmlld1dvcmRQcmVzc0ltcG9ydFJlc3BvbnNlEhIKCnNpdGVfdGl0bGUYASABKAkSEAoIc2l0ZV91cmwYAiABKAkSFQoNYXV0aG9yc19jb3VudBgDIAEoBRIYChBjYXRlZ29yaWVzX2NvdW50GAQgASgFEhIKCnRhZ3NfY291bnQYBSABKAUSEwoLdG90YWxfaXRlbXMYBiABKAUSVQoNaXRlbXNfYnlfdHlwZRgHIAMoCzI+LmJsb2NrbmluamEudjEuUHJldmlld1dvcmRQcmVzc0ltcG9ydFJlc3BvbnNlLkl0ZW1zQnlUeXBlRW50cnkaMgoQSXRlbXNCeVR5cGVFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAU6AjgBImIKFkltcG9ydFdvcmRQcmVzc1JlcXVlc3QSEAoId3hyX2RhdGEYASABKAwSNgoHb3B0aW9ucxgCIAEoCzIlLmJsb2NrbmluamEudjEuSW1wb3J0V29yZFByZXNzT3B0aW9ucyKcAQoWSW1wb3J0V29yZFByZXNzT3B0aW9ucxIXCg9pbXBvcnRfYXNfZHJhZnQYASABKAgSFwoPZG93bmxvYWRfaW1hZ2VzGAIgASgIEhUKDXNraXBfZXhpc3RpbmcYAyABKAgSHgoWY2FsY3VsYXRlX3JlYWRpbmdfdGltZRgEIAEoCBIZChFkZWZhdWx0X2F1dGhvcl9pZBgFIAEoCSKeAQoXSW1wb3J0V29yZFByZXNzUmVzcG9uc2USDwoHc3VjY2VzcxgBIAEoCBIWCg5wb3N0c19pbXBvcnRlZBgCIAEoBRIVCg1wb3N0c19za2lwcGVkGAMgASgFEhcKD2ltYWdlc19pbXBvcnRlZBgEIAEoBRIaChJjYXRlZ29yaWVzX2NyZWF0ZWQYBSABKAUSDgoGZXJyb3JzGAYgAygJMugBCg1JbXBvcnRTZXJ2aWNlEnUKFlByZXZpZXdXb3JkUHJlc3NJbXBvcnQSLC5ibG9ja25pbmphLnYxLlByZXZpZXdXb3JkUHJlc3NJbXBvcnRSZXF1ZXN0Gi0uYmxvY2tuaW5qYS52MS5QcmV2aWV3V29yZFByZXNzSW1wb3J0UmVzcG9uc2USYAoPSW1wb3J0V29yZFByZXNzEiUuYmxvY2tuaW5qYS52MS5JbXBvcnRXb3JkUHJlc3NSZXF1ZXN0GiYuYmxvY2tuaW5qYS52MS5JbXBvcnRXb3JkUHJlc3NSZXNwb25zZULBAQoRY29tLmJsb2NrbmluamEudjFCC0ltcG9ydFByb3RvUAFaSmdpdC5kZXYuYWxleGR1bm1vdy5jb20vYmxvY2svbmluamEvaW50ZXJuYWwvYXBpL2Jsb2NrbmluamEvdjE7YmxvY2tuaW5qYXYxogIDQlhYqgINQmxvY2tuaW5qYS5WMcoCDUJsb2NrbmluamFcVjHiAhlCbG9ja25pbmphXFYxXEdQQk1ldGFkYXRh6gIOQmxvY2tuaW5qYTo6VjFiBnByb3RvMw",
);
/**
 * ImportService handles importing content from external sources
 *
 * @generated from service blockninja.v1.ImportService
 */
const ImportService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_import, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/import.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Preview what a WordPress WXR export contains before importing
 *
 * @generated from rpc blockninja.v1.ImportService.PreviewWordPressImport
 */
ImportService.method.previewWordPressImport;
/**
 * Import content from WordPress WXR export
 *
 * @generated from rpc blockninja.v1.ImportService.ImportWordPress
 */
ImportService.method.importWordPress;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/ingestion.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/ingestion.proto.
 */
const file_blockninja_v1_ingestion = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_struct, file_google_protobuf_timestamp],
);
/**
 * @generated from enum blockninja.v1.IngestionType
 */
var IngestionType;
(function (IngestionType) {
	/**
	 * @generated from enum value: INGESTION_TYPE_UNSPECIFIED = 0;
	 */
	IngestionType[(IngestionType["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * No automation, rows added via UI
	 *
	 * @generated from enum value: INGESTION_TYPE_MANUAL = 1;
	 */
	IngestionType[(IngestionType["MANUAL"] = 1)] = "MANUAL";
	/**
	 * External systems push data
	 *
	 * @generated from enum value: INGESTION_TYPE_WEBHOOK = 2;
	 */
	IngestionType[(IngestionType["WEBHOOK"] = 2)] = "WEBHOOK";
	/**
	 * Pull from external APIs
	 *
	 * @generated from enum value: INGESTION_TYPE_API = 3;
	 */
	IngestionType[(IngestionType["API"] = 3)] = "API";
	/**
	 * Compose from internal datasources
	 *
	 * @generated from enum value: INGESTION_TYPE_DATA_MODEL = 4;
	 */
	IngestionType[(IngestionType["DATA_MODEL"] = 4)] = "DATA_MODEL";
})(IngestionType || (IngestionType = {}));
/**
 * @generated from enum blockninja.v1.IngestionSchedule
 */
var IngestionSchedule;
(function (IngestionSchedule) {
	/**
	 * @generated from enum value: INGESTION_SCHEDULE_UNSPECIFIED = 0;
	 */
	IngestionSchedule[(IngestionSchedule["INGESTION_SCHEDULE_UNSPECIFIED"] = 0)] = "INGESTION_SCHEDULE_UNSPECIFIED";
	/**
	 * @generated from enum value: INGESTION_SCHEDULE_MANUAL = 1;
	 */
	IngestionSchedule[(IngestionSchedule["INGESTION_SCHEDULE_MANUAL"] = 1)] = "INGESTION_SCHEDULE_MANUAL";
	/**
	 * @generated from enum value: INGESTION_SCHEDULE_5MIN = 2;
	 */
	IngestionSchedule[(IngestionSchedule["INGESTION_SCHEDULE_5MIN"] = 2)] = "INGESTION_SCHEDULE_5MIN";
	/**
	 * @generated from enum value: INGESTION_SCHEDULE_15MIN = 3;
	 */
	IngestionSchedule[(IngestionSchedule["INGESTION_SCHEDULE_15MIN"] = 3)] = "INGESTION_SCHEDULE_15MIN";
	/**
	 * @generated from enum value: INGESTION_SCHEDULE_30MIN = 4;
	 */
	IngestionSchedule[(IngestionSchedule["INGESTION_SCHEDULE_30MIN"] = 4)] = "INGESTION_SCHEDULE_30MIN";
	/**
	 * @generated from enum value: INGESTION_SCHEDULE_1HR = 5;
	 */
	IngestionSchedule[(IngestionSchedule["INGESTION_SCHEDULE_1HR"] = 5)] = "INGESTION_SCHEDULE_1HR";
	/**
	 * @generated from enum value: INGESTION_SCHEDULE_2HR = 6;
	 */
	IngestionSchedule[(IngestionSchedule["INGESTION_SCHEDULE_2HR"] = 6)] = "INGESTION_SCHEDULE_2HR";
	/**
	 * @generated from enum value: INGESTION_SCHEDULE_6HR = 7;
	 */
	IngestionSchedule[(IngestionSchedule["INGESTION_SCHEDULE_6HR"] = 7)] = "INGESTION_SCHEDULE_6HR";
	/**
	 * @generated from enum value: INGESTION_SCHEDULE_12HR = 8;
	 */
	IngestionSchedule[(IngestionSchedule["INGESTION_SCHEDULE_12HR"] = 8)] = "INGESTION_SCHEDULE_12HR";
	/**
	 * @generated from enum value: INGESTION_SCHEDULE_DAILY = 9;
	 */
	IngestionSchedule[(IngestionSchedule["INGESTION_SCHEDULE_DAILY"] = 9)] = "INGESTION_SCHEDULE_DAILY";
})(IngestionSchedule || (IngestionSchedule = {}));
/**
 * @generated from enum blockninja.v1.APIAuthType
 */
var APIAuthType;
(function (APIAuthType) {
	/**
	 * @generated from enum value: API_AUTH_TYPE_UNSPECIFIED = 0;
	 */
	APIAuthType[(APIAuthType["API_AUTH_TYPE_UNSPECIFIED"] = 0)] = "API_AUTH_TYPE_UNSPECIFIED";
	/**
	 * @generated from enum value: API_AUTH_TYPE_NONE = 1;
	 */
	APIAuthType[(APIAuthType["API_AUTH_TYPE_NONE"] = 1)] = "API_AUTH_TYPE_NONE";
	/**
	 * @generated from enum value: API_AUTH_TYPE_API_KEY_HEADER = 2;
	 */
	APIAuthType[(APIAuthType["API_AUTH_TYPE_API_KEY_HEADER"] = 2)] = "API_AUTH_TYPE_API_KEY_HEADER";
	/**
	 * @generated from enum value: API_AUTH_TYPE_API_KEY_QUERY = 3;
	 */
	APIAuthType[(APIAuthType["API_AUTH_TYPE_API_KEY_QUERY"] = 3)] = "API_AUTH_TYPE_API_KEY_QUERY";
	/**
	 * @generated from enum value: API_AUTH_TYPE_BEARER_TOKEN = 4;
	 */
	APIAuthType[(APIAuthType["API_AUTH_TYPE_BEARER_TOKEN"] = 4)] = "API_AUTH_TYPE_BEARER_TOKEN";
	/**
	 * @generated from enum value: API_AUTH_TYPE_BASIC_AUTH = 5;
	 */
	APIAuthType[(APIAuthType["API_AUTH_TYPE_BASIC_AUTH"] = 5)] = "API_AUTH_TYPE_BASIC_AUTH";
})(APIAuthType || (APIAuthType = {}));
/**
 * IngestionService manages ingestion pipelines that populate data tables.
 * Supports webhook (push), API (pull), and data model (internal compose) ingestion types.
 *
 * @generated from service blockninja.v1.IngestionService
 */
const IngestionService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_ingestion, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/ingestion.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Pipeline CRUD
 *
 * @generated from rpc blockninja.v1.IngestionService.ListIngestionPipelines
 */
IngestionService.method.listIngestionPipelines;
/**
 * @generated from rpc blockninja.v1.IngestionService.GetIngestionPipeline
 */
IngestionService.method.getIngestionPipeline;
/**
 * @generated from rpc blockninja.v1.IngestionService.CreateIngestionPipeline
 */
IngestionService.method.createIngestionPipeline;
/**
 * @generated from rpc blockninja.v1.IngestionService.UpdateIngestionPipeline
 */
IngestionService.method.updateIngestionPipeline;
/**
 * @generated from rpc blockninja.v1.IngestionService.DeleteIngestionPipeline
 */
IngestionService.method.deleteIngestionPipeline;
/**
 * Execution
 *
 * @generated from rpc blockninja.v1.IngestionService.RunIngestionNow
 */
IngestionService.method.runIngestionNow;
/**
 * @generated from rpc blockninja.v1.IngestionService.PreviewIngestion
 */
IngestionService.method.previewIngestion;
/**
 * Run history
 *
 * @generated from rpc blockninja.v1.IngestionService.ListIngestionRuns
 */
IngestionService.method.listIngestionRuns;
/**
 * @generated from rpc blockninja.v1.IngestionService.GetIngestionRun
 */
IngestionService.method.getIngestionRun;
/**
 * @generated from rpc blockninja.v1.IngestionService.GetIngestionStats
 */
IngestionService.method.getIngestionStats;
/**
 * Webhook-specific
 *
 * @generated from rpc blockninja.v1.IngestionService.RegenerateWebhookSecret
 */
IngestionService.method.regenerateWebhookSecret;
/**
 * @generated from rpc blockninja.v1.IngestionService.GetWebhookEndpoint
 */
IngestionService.method.getWebhookEndpoint;
/**
 * API-specific
 *
 * @generated from rpc blockninja.v1.IngestionService.TestAPIConnection
 */
IngestionService.method.testAPIConnection;
/**
 * State management
 *
 * @generated from rpc blockninja.v1.IngestionService.ResetPipelineState
 */
IngestionService.method.resetPipelineState;
/**
 * Translation workflow (draft/publish/test)
 *
 * @generated from rpc blockninja.v1.IngestionService.TestTranslation
 */
IngestionService.method.testTranslation;
/**
 * @generated from rpc blockninja.v1.IngestionService.SaveDraftTranslation
 */
IngestionService.method.saveDraftTranslation;
/**
 * @generated from rpc blockninja.v1.IngestionService.PublishTranslation
 */
IngestionService.method.publishTranslation;
/**
 * @generated from rpc blockninja.v1.IngestionService.DiscardDraft
 */
IngestionService.method.discardDraft;
/**
 * Pipeline activation (separate from enabled)
 *
 * @generated from rpc blockninja.v1.IngestionService.ActivatePipeline
 */
IngestionService.method.activatePipeline;
/**
 * @generated from rpc blockninja.v1.IngestionService.DeactivatePipeline
 */
IngestionService.method.deactivatePipeline;
/**
 * @generated from rpc blockninja.v1.IngestionService.GetPipelineActivationState
 */
IngestionService.method.getPipelineActivationState;
/**
 * Failure management
 *
 * @generated from rpc blockninja.v1.IngestionService.ListIngestionFailures
 */
IngestionService.method.listIngestionFailures;
/**
 * @generated from rpc blockninja.v1.IngestionService.GetIngestionFailure
 */
IngestionService.method.getIngestionFailure;
/**
 * @generated from rpc blockninja.v1.IngestionService.ReplayFailedRows
 */
IngestionService.method.replayFailedRows;
/**
 * @generated from rpc blockninja.v1.IngestionService.DeleteFailedRows
 */
IngestionService.method.deleteFailedRows;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/mailing_lists.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/mailing_lists.proto.
 */
const file_blockninja_v1_mailing_lists = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_struct, file_google_protobuf_timestamp, file_blockninja_v1_data_tables],
);
/**
 * @generated from service blockninja.v1.MailingListsService
 */
const MailingListsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_mailing_lists, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/mailing_lists.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * List CRUD
 *
 * @generated from rpc blockninja.v1.MailingListsService.CreateMailingList
 */
MailingListsService.method.createMailingList;
/**
 * @generated from rpc blockninja.v1.MailingListsService.GetMailingList
 */
MailingListsService.method.getMailingList;
/**
 * @generated from rpc blockninja.v1.MailingListsService.GetMailingListBySlug
 */
MailingListsService.method.getMailingListBySlug;
/**
 * @generated from rpc blockninja.v1.MailingListsService.ListMailingLists
 */
MailingListsService.method.listMailingLists;
/**
 * @generated from rpc blockninja.v1.MailingListsService.UpdateMailingList
 */
MailingListsService.method.updateMailingList;
/**
 * @generated from rpc blockninja.v1.MailingListsService.DeleteMailingList
 */
MailingListsService.method.deleteMailingList;
/**
 * Schema (custom fields)
 *
 * @generated from rpc blockninja.v1.MailingListsService.GetMailingListSchema
 */
MailingListsService.method.getMailingListSchema;
/**
 * @generated from rpc blockninja.v1.MailingListsService.UpdateMailingListSchema
 */
MailingListsService.method.updateMailingListSchema;
/**
 * @generated from rpc blockninja.v1.MailingListsService.AddCustomField
 */
MailingListsService.method.addCustomField;
/**
 * @generated from rpc blockninja.v1.MailingListsService.RemoveCustomField
 */
MailingListsService.method.removeCustomField;
/**
 * Subscribers (convenience wrappers around data table rows)
 *
 * @generated from rpc blockninja.v1.MailingListsService.ListSubscribers
 */
MailingListsService.method.listSubscribers;
/**
 * @generated from rpc blockninja.v1.MailingListsService.GetSubscriber
 */
MailingListsService.method.getSubscriber;
/**
 * @generated from rpc blockninja.v1.MailingListsService.CreateSubscriber
 */
MailingListsService.method.createSubscriber;
/**
 * @generated from rpc blockninja.v1.MailingListsService.UpdateSubscriber
 */
MailingListsService.method.updateSubscriber;
/**
 * @generated from rpc blockninja.v1.MailingListsService.DeleteSubscriber
 */
MailingListsService.method.deleteSubscriber;
/**
 * @generated from rpc blockninja.v1.MailingListsService.ImportSubscribers
 */
MailingListsService.method.importSubscribers;
/**
 * @generated from rpc blockninja.v1.MailingListsService.ExportSubscribers
 */
MailingListsService.method.exportSubscribers;
/**
 * Public endpoints (no auth required)
 *
 * @generated from rpc blockninja.v1.MailingListsService.PublicSubscribe
 */
MailingListsService.method.publicSubscribe;
/**
 * @generated from rpc blockninja.v1.MailingListsService.PublicConfirm
 */
MailingListsService.method.publicConfirm;
/**
 * @generated from rpc blockninja.v1.MailingListsService.PublicUnsubscribe
 */
MailingListsService.method.publicUnsubscribe;
/**
 * @generated from rpc blockninja.v1.MailingListsService.PublicUpdatePreferences
 */
MailingListsService.method.publicUpdatePreferences;
/**
 * Campaigns
 *
 * @generated from rpc blockninja.v1.MailingListsService.CreateCampaign
 */
MailingListsService.method.createCampaign;
/**
 * @generated from rpc blockninja.v1.MailingListsService.GetCampaign
 */
MailingListsService.method.getCampaign;
/**
 * @generated from rpc blockninja.v1.MailingListsService.ListCampaigns
 */
MailingListsService.method.listCampaigns;
/**
 * @generated from rpc blockninja.v1.MailingListsService.UpdateCampaign
 */
MailingListsService.method.updateCampaign;
/**
 * @generated from rpc blockninja.v1.MailingListsService.DeleteCampaign
 */
MailingListsService.method.deleteCampaign;
/**
 * @generated from rpc blockninja.v1.MailingListsService.ScheduleCampaign
 */
MailingListsService.method.scheduleCampaign;
/**
 * @generated from rpc blockninja.v1.MailingListsService.SendCampaign
 */
MailingListsService.method.sendCampaign;
/**
 * @generated from rpc blockninja.v1.MailingListsService.CancelCampaign
 */
MailingListsService.method.cancelCampaign;
/**
 * @generated from rpc blockninja.v1.MailingListsService.GetCampaignStats
 */
MailingListsService.method.getCampaignStats;
/**
 * Drip Sequences
 *
 * @generated from rpc blockninja.v1.MailingListsService.CreateDripSequence
 */
MailingListsService.method.createDripSequence;
/**
 * @generated from rpc blockninja.v1.MailingListsService.GetDripSequence
 */
MailingListsService.method.getDripSequence;
/**
 * @generated from rpc blockninja.v1.MailingListsService.ListDripSequences
 */
MailingListsService.method.listDripSequences;
/**
 * @generated from rpc blockninja.v1.MailingListsService.UpdateDripSequence
 */
MailingListsService.method.updateDripSequence;
/**
 * @generated from rpc blockninja.v1.MailingListsService.DeleteDripSequence
 */
MailingListsService.method.deleteDripSequence;
/**
 * Drip Sequence Steps
 *
 * @generated from rpc blockninja.v1.MailingListsService.CreateDripSequenceStep
 */
MailingListsService.method.createDripSequenceStep;
/**
 * @generated from rpc blockninja.v1.MailingListsService.UpdateDripSequenceStep
 */
MailingListsService.method.updateDripSequenceStep;
/**
 * @generated from rpc blockninja.v1.MailingListsService.DeleteDripSequenceStep
 */
MailingListsService.method.deleteDripSequenceStep;
/**
 * @generated from rpc blockninja.v1.MailingListsService.ReorderDripSequenceSteps
 */
MailingListsService.method.reorderDripSequenceSteps;
/**
 * RSS Campaigns
 *
 * @generated from rpc blockninja.v1.MailingListsService.CreateRSSCampaign
 */
MailingListsService.method.createRSSCampaign;
/**
 * @generated from rpc blockninja.v1.MailingListsService.GetRSSCampaign
 */
MailingListsService.method.getRSSCampaign;
/**
 * @generated from rpc blockninja.v1.MailingListsService.ListRSSCampaigns
 */
MailingListsService.method.listRSSCampaigns;
/**
 * @generated from rpc blockninja.v1.MailingListsService.UpdateRSSCampaign
 */
MailingListsService.method.updateRSSCampaign;
/**
 * @generated from rpc blockninja.v1.MailingListsService.DeleteRSSCampaign
 */
MailingListsService.method.deleteRSSCampaign;
/**
 * Stats & Analytics
 *
 * @generated from rpc blockninja.v1.MailingListsService.GetListStats
 */
MailingListsService.method.getListStats;
/**
 * @generated from rpc blockninja.v1.MailingListsService.GetSubscriberGrowth
 */
MailingListsService.method.getSubscriberGrowth;
/**
 * @generated from rpc blockninja.v1.MailingListsService.GetTrackingEvents
 */
MailingListsService.method.getTrackingEvents;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/management.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/management.proto.
 */
const file_blockninja_v1_management = /*@__PURE__*/ fileDesc(
	"Ch5ibG9ja25pbmphL3YxL21hbmFnZW1lbnQucHJvdG8SDWJsb2NrbmluamEudjEiSAoXTGlzdE1hbmFnZWRVc2Vyc1JlcXVlc3QSLQoKcGFnaW5hdGlvbhgBIAEoCzIZLmJsb2NrbmluamEudjEuUGFnaW5hdGlvbiJ8ChhMaXN0TWFuYWdlZFVzZXJzUmVzcG9uc2USKQoFdXNlcnMYASADKAsyGi5ibG9ja25pbmphLnYxLk1hbmFnZWRVc2VyEjUKCnBhZ2luYXRpb24YAiABKAsyIS5ibG9ja25pbmphLnYxLlBhZ2luYXRpb25SZXNwb25zZSJNChVHZXRNYW5hZ2VkVXNlclJlcXVlc3QSEgoFZW1haWwYASABKAlIAIgBARIPCgJpZBgCIAEoCUgBiAEBQggKBl9lbWFpbEIFCgNfaWQiQgoWR2V0TWFuYWdlZFVzZXJSZXNwb25zZRIoCgR1c2VyGAEgASgLMhouYmxvY2tuaW5qYS52MS5NYW5hZ2VkVXNlciKZAQoPU3luY1VzZXJSZXF1ZXN0Eg0KBWVtYWlsGAEgASgJEhIKCmZpcnN0X25hbWUYAiABKAkSEQoJbGFzdF9uYW1lGAMgASgJEiEKBHJvbGUYBCABKA4yEy5ibG9ja25pbmphLnYxLlJvbGUSHAoUb3JjaGVzdHJhdG9yX3VzZXJfaWQYBSABKAkSDwoHaGFzX3NzbxgGIAEoCCJNChBTeW5jVXNlclJlc3BvbnNlEigKBHVzZXIYASABKAsyGi5ibG9ja25pbmphLnYxLk1hbmFnZWRVc2VyEg8KB2NyZWF0ZWQYAiABKAgiXAoRUmVtb3ZlVXNlclJlcXVlc3QSEgoFZW1haWwYASABKAlIAIgBARIPCgJpZBgCIAEoCUgBiAEBEhEKCXBlcm1hbmVudBgDIAEoCEIICgZfZW1haWxCBQoDX2lkIhQKElJlbW92ZVVzZXJSZXNwb25zZSIWChRHZXRBdXRoQ29uZmlnUmVxdWVzdCKAAQoVR2V0QXV0aENvbmZpZ1Jlc3BvbnNlEhkKEW9yY2hlc3RyYXRvcl9tb2RlGAEgASgIEhgKEG9yY2hlc3RyYXRvcl91cmwYAiABKAkSHQoVbG9jYWxfbG9naW5fYXZhaWxhYmxlGAMgASgIEhMKC2luc3RhbmNlX2lkGAQgASgJItoDCgtNYW5hZ2VkVXNlchIKCgJpZBgBIAEoCRINCgVlbWFpbBgCIAEoCRIhCgRyb2xlGAMgASgOMhMuYmxvY2tuaW5qYS52MS5Sb2xlEhIKCmZpcnN0X25hbWUYBCABKAkSEQoJbGFzdF9uYW1lGAUgASgJEhEKCWlzX2FjdGl2ZRgGIAEoCBI2Cg1sYXN0X2xvZ2luX2F0GAcgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEgAiAEBEi4KCmNyZWF0ZWRfYXQYCCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEi4KCnVwZGF0ZWRfYXQYCSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEiEKFG9yY2hlc3RyYXRvcl91c2VyX2lkGAogASgJSAGIAQESDwoHaGFzX3NzbxgLIAEoCBIaChJoYXNfbG9jYWxfcGFzc3dvcmQYDSABKAgSMgoJc3luY2VkX2F0GAwgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEgCiAEBQhAKDl9sYXN0X2xvZ2luX2F0QhcKFV9vcmNoZXN0cmF0b3JfdXNlcl9pZEIMCgpfc3luY2VkX2F0InIKGE5vdGlmeVBsYW5DaGFuZ2VkUmVxdWVzdBIOCgZyZWFzb24YASABKAkSFAoHcGxhbl9pZBgCIAEoCUgAiAEBEhYKCXBsYW5fbmFtZRgDIAEoCUgBiAEBQgoKCF9wbGFuX2lkQgwKCl9wbGFuX25hbWUiTAoZTm90aWZ5UGxhbkNoYW5nZWRSZXNwb25zZRIPCgdzdWNjZXNzGAEgASgIEgwKBHRpZXIYAiABKAkSEAoIZmVhdHVyZXMYAyADKAkiPgoWU2V0VXNlclBhc3N3b3JkUmVxdWVzdBINCgVlbWFpbBgBIAEoCRIVCg1wYXNzd29yZF9oYXNoGAIgASgJIioKF1NldFVzZXJQYXNzd29yZFJlc3BvbnNlEg8KB3N1Y2Nlc3MYASABKAgynQUKEU1hbmFnZW1lbnRTZXJ2aWNlEmMKEExpc3RNYW5hZ2VkVXNlcnMSJi5ibG9ja25pbmphLnYxLkxpc3RNYW5hZ2VkVXNlcnNSZXF1ZXN0GicuYmxvY2tuaW5qYS52MS5MaXN0TWFuYWdlZFVzZXJzUmVzcG9uc2USXQoOR2V0TWFuYWdlZFVzZXISJC5ibG9ja25pbmphLnYxLkdldE1hbmFnZWRVc2VyUmVxdWVzdBolLmJsb2NrbmluamEudjEuR2V0TWFuYWdlZFVzZXJSZXNwb25zZRJLCghTeW5jVXNlchIeLmJsb2NrbmluamEudjEuU3luY1VzZXJSZXF1ZXN0Gh8uYmxvY2tuaW5qYS52MS5TeW5jVXNlclJlc3BvbnNlElEKClJlbW92ZVVzZXISIC5ibG9ja25pbmphLnYxLlJlbW92ZVVzZXJSZXF1ZXN0GiEuYmxvY2tuaW5qYS52MS5SZW1vdmVVc2VyUmVzcG9uc2USWgoNR2V0QXV0aENvbmZpZxIjLmJsb2NrbmluamEudjEuR2V0QXV0aENvbmZpZ1JlcXVlc3QaJC5ibG9ja25pbmphLnYxLkdldEF1dGhDb25maWdSZXNwb25zZRJmChFOb3RpZnlQbGFuQ2hhbmdlZBInLmJsb2NrbmluamEudjEuTm90aWZ5UGxhbkNoYW5nZWRSZXF1ZXN0GiguYmxvY2tuaW5qYS52MS5Ob3RpZnlQbGFuQ2hhbmdlZFJlc3BvbnNlEmAKD1NldFVzZXJQYXNzd29yZBIlLmJsb2NrbmluamEudjEuU2V0VXNlclBhc3N3b3JkUmVxdWVzdBomLmJsb2NrbmluamEudjEuU2V0VXNlclBhc3N3b3JkUmVzcG9uc2VCxQEKEWNvbS5ibG9ja25pbmphLnYxQg9NYW5hZ2VtZW50UHJvdG9QAVpKZ2l0LmRldi5hbGV4ZHVubW93LmNvbS9ibG9jay9uaW5qYS9pbnRlcm5hbC9hcGkvYmxvY2tuaW5qYS92MTtibG9ja25pbmphdjGiAgNCWFiqAg1CbG9ja25pbmphLlYxygINQmxvY2tuaW5qYVxWMeICGUJsb2NrbmluamFcVjFcR1BCTWV0YWRhdGHqAg5CbG9ja25pbmphOjpWMWIGcHJvdG8z",
	[file_blockninja_v1_auth, file_blockninja_v1_common, file_google_protobuf_timestamp],
);
/**
 * ManagementService provides orchestrator-to-CMS user management.
 * All methods require X-Orchestrator-Secret header authentication.
 *
 * @generated from service blockninja.v1.ManagementService
 */
const ManagementService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_management, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/management.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * List all admin users in this CMS instance
 *
 * @generated from rpc blockninja.v1.ManagementService.ListManagedUsers
 */
ManagementService.method.listManagedUsers;
/**
 * Get a specific user by email or ID
 *
 * @generated from rpc blockninja.v1.ManagementService.GetManagedUser
 */
ManagementService.method.getManagedUser;
/**
 * Sync (upsert) a user from orchestrator - creates or updates by email
 *
 * @generated from rpc blockninja.v1.ManagementService.SyncUser
 */
ManagementService.method.syncUser;
/**
 * Remove/deactivate a user
 *
 * @generated from rpc blockninja.v1.ManagementService.RemoveUser
 */
ManagementService.method.removeUser;
/**
 * Get authentication configuration for this instance
 *
 * @generated from rpc blockninja.v1.ManagementService.GetAuthConfig
 */
ManagementService.method.getAuthConfig;
/**
 * Notify CMS that plan/subscription has changed - triggers capabilities refresh
 *
 * @generated from rpc blockninja.v1.ManagementService.NotifyPlanChanged
 */
ManagementService.method.notifyPlanChanged;
/**
 * Set a user's password (called by orchestrator when password is changed there)
 *
 * @generated from rpc blockninja.v1.ManagementService.SetUserPassword
 */
ManagementService.method.setUserPassword;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/media.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/media.proto.
 */
const file_blockninja_v1_media = /*@__PURE__*/ fileDesc(
	" ",
	[file_blockninja_v1_common, file_google_protobuf_timestamp],
);
/**
 * @generated from service blockninja.v1.MediaService
 */
const MediaService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_media, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/media.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * List all media with optional filtering
 *
 * @generated from rpc blockninja.v1.MediaService.ListMedia
 */
const listMedia = MediaService.method.listMedia;
/**
 * Get a single media item
 *
 * @generated from rpc blockninja.v1.MediaService.GetMedia
 */
MediaService.method.getMedia;
/**
 * Update media metadata (filename, alt text, folder)
 *
 * @generated from rpc blockninja.v1.MediaService.UpdateMedia
 */
MediaService.method.updateMedia;
/**
 * Delete a media item
 *
 * @generated from rpc blockninja.v1.MediaService.DeleteMedia
 */
MediaService.method.deleteMedia;
/**
 * Get media usage information
 *
 * @generated from rpc blockninja.v1.MediaService.GetMediaUsage
 */
MediaService.method.getMediaUsage;
/**
 * Generate a one-time upload token for secure file uploads
 *
 * @generated from rpc blockninja.v1.MediaService.GenerateUploadToken
 */
const generateUploadToken = MediaService.method.generateUploadToken;
/**
 * Folder management
 *
 * @generated from rpc blockninja.v1.MediaService.ListFolders
 */
const listFolders = MediaService.method.listFolders;
/**
 * @generated from rpc blockninja.v1.MediaService.CreateFolder
 */
MediaService.method.createFolder;
/**
 * @generated from rpc blockninja.v1.MediaService.UpdateFolder
 */
MediaService.method.updateFolder;
/**
 * @generated from rpc blockninja.v1.MediaService.DeleteFolder
 */
MediaService.method.deleteFolder;
/**
 * Bulk operations
 *
 * @generated from rpc blockninja.v1.MediaService.BulkDeleteMedia
 */
MediaService.method.bulkDeleteMedia;
/**
 * @generated from rpc blockninja.v1.MediaService.BulkMoveMedia
 */
const bulkMoveMedia = MediaService.method.bulkMoveMedia;
/**
 * @generated from rpc blockninja.v1.MediaService.BulkTagMedia
 */
MediaService.method.bulkTagMedia;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/media_moderation.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/media_moderation.proto.
 */
const file_blockninja_v1_media_moderation = /*@__PURE__*/ fileDesc(
	" ",
	[file_blockninja_v1_common, file_google_protobuf_timestamp],
);
/**
 * @generated from service blockninja.v1.MediaModerationService
 */
const MediaModerationService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_media_moderation, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/media_moderation.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.MediaModerationService.ListModerationQueue
 */
MediaModerationService.method.listModerationQueue;
/**
 * @generated from rpc blockninja.v1.MediaModerationService.GetModerationDetail
 */
MediaModerationService.method.getModerationDetail;
/**
 * @generated from rpc blockninja.v1.MediaModerationService.ModerateMedia
 */
MediaModerationService.method.moderateMedia;
/**
 * @generated from rpc blockninja.v1.MediaModerationService.BulkModerateMedia
 */
MediaModerationService.method.bulkModerateMedia;
/**
 * @generated from rpc blockninja.v1.MediaModerationService.RequestEvidenceExport
 */
MediaModerationService.method.requestEvidenceExport;
/**
 * @generated from rpc blockninja.v1.MediaModerationService.GetModerationStats
 */
MediaModerationService.method.getModerationStats;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/menus.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/menus.proto.
 */
const file_blockninja_v1_menus = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_timestamp],
);
/**
 * MenusService handles menu management
 *
 * @generated from service blockninja.v1.MenusService
 */
const MenusService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_menus, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/menus.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * List all menus
 *
 * @generated from rpc blockninja.v1.MenusService.ListMenus
 */
MenusService.method.listMenus;
/**
 * Get a single menu by ID
 *
 * @generated from rpc blockninja.v1.MenusService.GetMenu
 */
MenusService.method.getMenu;
/**
 * Get a menu by name
 *
 * @generated from rpc blockninja.v1.MenusService.GetMenuByName
 */
MenusService.method.getMenuByName;
/**
 * Create a new menu
 *
 * @generated from rpc blockninja.v1.MenusService.CreateMenu
 */
MenusService.method.createMenu;
/**
 * Update a menu
 *
 * @generated from rpc blockninja.v1.MenusService.UpdateMenu
 */
MenusService.method.updateMenu;
/**
 * Delete a menu
 *
 * @generated from rpc blockninja.v1.MenusService.DeleteMenu
 */
MenusService.method.deleteMenu;
/**
 * Get menu items for a menu
 *
 * @generated from rpc blockninja.v1.MenusService.GetMenuItems
 */
MenusService.method.getMenuItems;
/**
 * Add a menu item
 *
 * @generated from rpc blockninja.v1.MenusService.AddMenuItem
 */
MenusService.method.addMenuItem;
/**
 * Update a menu item
 *
 * @generated from rpc blockninja.v1.MenusService.UpdateMenuItem
 */
MenusService.method.updateMenuItem;
/**
 * Delete a menu item
 *
 * @generated from rpc blockninja.v1.MenusService.DeleteMenuItem
 */
MenusService.method.deleteMenuItem;
/**
 * Reorder menu items
 *
 * @generated from rpc blockninja.v1.MenusService.ReorderMenuItems
 */
MenusService.method.reorderMenuItems;
/**
 * Get menu items as a tree (with children populated)
 *
 * @generated from rpc blockninja.v1.MenusService.GetMenuItemsTree
 */
MenusService.method.getMenuItemsTree;
/**
 * Fetch title from a URL (for auto-filling menu item labels)
 *
 * @generated from rpc blockninja.v1.MenusService.FetchUrlTitle
 */
MenusService.method.fetchUrlTitle;
/**
 * Duplicate a menu with all its items
 *
 * @generated from rpc blockninja.v1.MenusService.DuplicateMenu
 */
MenusService.method.duplicateMenu;

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/pages.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.PagesService.ListPages
 */
PagesService.method.listPages;
/**
 * @generated from rpc blockninja.v1.PagesService.GetPage
 */
PagesService.method.getPage;
/**
 * @generated from rpc blockninja.v1.PagesService.CreatePage
 */
PagesService.method.createPage;
/**
 * @generated from rpc blockninja.v1.PagesService.UpdatePage
 */
PagesService.method.updatePage;
/**
 * @generated from rpc blockninja.v1.PagesService.DeletePage
 */
PagesService.method.deletePage;
/**
 * @generated from rpc blockninja.v1.PagesService.PublishPage
 */
PagesService.method.publishPage;
/**
 * @generated from rpc blockninja.v1.PagesService.UnpublishPage
 */
PagesService.method.unpublishPage;
/**
 * @generated from rpc blockninja.v1.PagesService.ListPageVersions
 */
PagesService.method.listPageVersions;
/**
 * @generated from rpc blockninja.v1.PagesService.RollbackPage
 */
PagesService.method.rollbackPage;
/**
 * @generated from rpc blockninja.v1.PagesService.UpdatePageVersionName
 */
PagesService.method.updatePageVersionName;
/**
 * @generated from rpc blockninja.v1.PagesService.ListTemplates
 */
PagesService.method.listTemplates;
/**
 * System pages
 *
 * @generated from rpc blockninja.v1.PagesService.ListSystemPages
 */
PagesService.method.listSystemPages;
/**
 * @generated from rpc blockninja.v1.PagesService.ResetSystemPage
 */
PagesService.method.resetSystemPage;
/**
 * Draft management
 *
 * @generated from rpc blockninja.v1.PagesService.DiscardDraftChanges
 */
PagesService.method.discardDraftChanges;
/**
 * Bulk operations
 *
 * @generated from rpc blockninja.v1.PagesService.BulkDeletePages
 */
PagesService.method.bulkDeletePages;
/**
 * @generated from rpc blockninja.v1.PagesService.BulkMovePages
 */
PagesService.method.bulkMovePages;
/**
 * @generated from rpc blockninja.v1.PagesService.BulkPublishPages
 */
PagesService.method.bulkPublishPages;
/**
 * Preview tokens
 *
 * @generated from rpc blockninja.v1.PagesService.GeneratePreviewToken
 */
PagesService.method.generatePreviewToken;
/**
 * Scheduled publishing
 *
 * @generated from rpc blockninja.v1.PagesService.SchedulePage
 */
PagesService.method.schedulePage;
/**
 * @generated from rpc blockninja.v1.PagesService.UnschedulePage
 */
PagesService.method.unschedulePage;
/**
 * @generated from rpc blockninja.v1.PagesService.ListScheduledPages
 */
PagesService.method.listScheduledPages;
/**
 * Master pages
 *
 * @generated from rpc blockninja.v1.PagesService.ListMasterPages
 */
PagesService.method.listMasterPages;
/**
 * @generated from rpc blockninja.v1.PagesService.CreateMasterPage
 */
PagesService.method.createMasterPage;
/**
 * @generated from rpc blockninja.v1.PagesService.DuplicateMasterPage
 */
PagesService.method.duplicateMasterPage;
/**
 * @generated from rpc blockninja.v1.PagesService.SetDefaultMaster
 */
PagesService.method.setDefaultMaster;
/**
 * @generated from rpc blockninja.v1.PagesService.GetDefaultMaster
 */
PagesService.method.getDefaultMaster;
/**
 * @generated from rpc blockninja.v1.PagesService.SetPageMaster
 */
PagesService.method.setPageMaster;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/plugins.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/plugins.proto.
 */
const file_blockninja_v1_plugins = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_timestamp],
);
/**
 * PluginStatus represents the current status of a plugin
 *
 * @generated from enum blockninja.v1.PluginStatus
 */
var PluginStatus;
(function (PluginStatus) {
	/**
	 * @generated from enum value: PLUGIN_STATUS_UNSPECIFIED = 0;
	 */
	PluginStatus[(PluginStatus["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: PLUGIN_STATUS_LOADED = 1;
	 */
	PluginStatus[(PluginStatus["LOADED"] = 1)] = "LOADED";
	/**
	 * @generated from enum value: PLUGIN_STATUS_FAILED = 2;
	 */
	PluginStatus[(PluginStatus["FAILED"] = 2)] = "FAILED";
	/**
	 * @generated from enum value: PLUGIN_STATUS_DISABLED = 3;
	 */
	PluginStatus[(PluginStatus["DISABLED"] = 3)] = "DISABLED";
	/**
	 * @generated from enum value: PLUGIN_STATUS_REBUILDING = 4;
	 */
	PluginStatus[(PluginStatus["REBUILDING"] = 4)] = "REBUILDING";
	/**
	 * @generated from enum value: PLUGIN_STATUS_PENDING_RESTART = 5;
	 */
	PluginStatus[(PluginStatus["PENDING_RESTART"] = 5)] = "PENDING_RESTART";
})(PluginStatus || (PluginStatus = {}));
/**
 * PluginsService provides information about loaded plugins
 *
 * @generated from service blockninja.v1.PluginsService
 */
const PluginsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_plugins, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/plugins.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * List all plugins (loaded and failed)
 *
 * @generated from rpc blockninja.v1.PluginsService.ListPlugins
 */
PluginsService.method.listPlugins;
/**
 * Get details about a specific plugin
 *
 * @generated from rpc blockninja.v1.PluginsService.GetPlugin
 */
PluginsService.method.getPlugin;
/**
 * Enable a disabled plugin (requires restart to take effect)
 *
 * @generated from rpc blockninja.v1.PluginsService.EnablePlugin
 */
PluginsService.method.enablePlugin;
/**
 * Disable a loaded plugin (requires restart to take effect)
 *
 * @generated from rpc blockninja.v1.PluginsService.DisablePlugin
 */
PluginsService.method.disablePlugin;
/**
 * Uninstall a git plugin (stages removal for next restart)
 *
 * @generated from rpc blockninja.v1.PluginsService.UninstallPlugin
 */
PluginsService.method.uninstallPlugin;
/**
 * Save per-plugin SSH configuration (key + port for git operations)
 *
 * @generated from rpc blockninja.v1.PluginsService.SavePluginConfig
 */
PluginsService.method.savePluginConfig;
/**
 * Install a plugin from a git repository (stages for next restart)
 *
 * @generated from rpc blockninja.v1.PluginsService.InstallPlugin
 */
PluginsService.method.installPlugin;
/**
 * Update an installed plugin's branch/config (stages for next restart)
 *
 * @generated from rpc blockninja.v1.PluginsService.UpdatePlugin
 */
PluginsService.method.updatePlugin;
/**
 * Get the site-wide deploy key public key
 *
 * @generated from rpc blockninja.v1.PluginsService.GetDeployKey
 */
PluginsService.method.getDeployKey;
/**
 * Generate or regenerate the site-wide deploy key
 *
 * @generated from rpc blockninja.v1.PluginsService.GenerateDeployKey
 */
PluginsService.method.generateDeployKey;
/**
 * Get build log content for a plugin
 *
 * @generated from rpc blockninja.v1.PluginsService.GetPluginBuildLog
 */
PluginsService.method.getPluginBuildLog;
/**
 * List admin pages registered by plugins
 *
 * @generated from rpc blockninja.v1.PluginsService.ListPluginPages
 */
PluginsService.method.listPluginPages;
/**
 * SSH Key Management
 *
 * @generated from rpc blockninja.v1.PluginsService.ListSSHKeys
 */
PluginsService.method.listSSHKeys;
/**
 * @generated from rpc blockninja.v1.PluginsService.CreateSSHKey
 */
PluginsService.method.createSSHKey;
/**
 * @generated from rpc blockninja.v1.PluginsService.UpdateSSHKey
 */
PluginsService.method.updateSSHKey;
/**
 * @generated from rpc blockninja.v1.PluginsService.DeleteSSHKey
 */
PluginsService.method.deleteSSHKey;

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/posts.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.PostsService.ListPosts
 */
PostsService.method.listPosts;
/**
 * @generated from rpc blockninja.v1.PostsService.GetPost
 */
PostsService.method.getPost;
/**
 * @generated from rpc blockninja.v1.PostsService.ListPostArchive
 */
PostsService.method.listPostArchive;
/**
 * @generated from rpc blockninja.v1.PostsService.GetArchiveCounts
 */
PostsService.method.getArchiveCounts;
/**
 * @generated from rpc blockninja.v1.PostsService.GetRelatedPosts
 */
PostsService.method.getRelatedPosts;
/**
 * @generated from rpc blockninja.v1.PostsService.GetPostsByAuthor
 */
PostsService.method.getPostsByAuthor;
/**
 * @generated from rpc blockninja.v1.PostsService.ListCategories
 */
PostsService.method.listCategories;
/**
 * @generated from rpc blockninja.v1.PostsService.GetCategory
 */
PostsService.method.getCategory;
/**
 * @generated from rpc blockninja.v1.PostsService.CreateCategory
 */
PostsService.method.createCategory;
/**
 * @generated from rpc blockninja.v1.PostsService.UpdateCategory
 */
PostsService.method.updateCategory;
/**
 * @generated from rpc blockninja.v1.PostsService.DeleteCategory
 */
PostsService.method.deleteCategory;
/**
 * @generated from rpc blockninja.v1.PostsService.GetPostCategories
 */
PostsService.method.getPostCategories;
/**
 * @generated from rpc blockninja.v1.PostsService.AddCategoryToPost
 */
PostsService.method.addCategoryToPost;
/**
 * @generated from rpc blockninja.v1.PostsService.RemoveCategoryFromPost
 */
PostsService.method.removeCategoryFromPost;
/**
 * @generated from rpc blockninja.v1.PostsService.ToggleFeaturedPost
 */
PostsService.method.toggleFeaturedPost;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/redirects.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/redirects.proto.
 */
const file_blockninja_v1_redirects = /*@__PURE__*/ fileDesc(
	"Ch1ibG9ja25pbmphL3YxL3JlZGlyZWN0cy5wcm90bxINYmxvY2tuaW5qYS52MSLyAQoIUmVkaXJlY3QSCgoCaWQYASABKAkSEwoLc291cmNlX3BhdGgYAiABKAkSEwoLdGFyZ2V0X3BhdGgYAyABKAkSFQoNcmVkaXJlY3RfdHlwZRgEIAEoBRISCgppc19wYXR0ZXJuGAUgASgIEhEKCWhpdF9jb3VudBgGIAEoAxIuCgpjcmVhdGVkX2F0GAcgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIuCgp1cGRhdGVkX2F0GAggASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBISCgpjcmVhdGVkX2J5GAkgASgJImwKFUNyZWF0ZVJlZGlyZWN0UmVxdWVzdBITCgtzb3VyY2VfcGF0aBgBIAEoCRITCgt0YXJnZXRfcGF0aBgCIAEoCRIVCg1yZWRpcmVjdF90eXBlGAMgASgFEhIKCmlzX3BhdHRlcm4YBCABKAgiQwoWQ3JlYXRlUmVkaXJlY3RSZXNwb25zZRIpCghyZWRpcmVjdBgBIAEoCzIXLmJsb2NrbmluamEudjEuUmVkaXJlY3QiIAoSR2V0UmVkaXJlY3RSZXF1ZXN0EgoKAmlkGAEgASgJIkAKE0dldFJlZGlyZWN0UmVzcG9uc2USKQoIcmVkaXJlY3QYASABKAsyFy5ibG9ja25pbmphLnYxLlJlZGlyZWN0IjcKFExpc3RSZWRpcmVjdHNSZXF1ZXN0EgwKBHBhZ2UYASABKAUSEQoJcGFnZV9zaXplGAIgASgFIlIKFUxpc3RSZWRpcmVjdHNSZXNwb25zZRIqCglyZWRpcmVjdHMYASADKAsyFy5ibG9ja25pbmphLnYxLlJlZGlyZWN0Eg0KBXRvdGFsGAIgASgDIngKFVVwZGF0ZVJlZGlyZWN0UmVxdWVzdBIKCgJpZBgBIAEoCRITCgtzb3VyY2VfcGF0aBgCIAEoCRITCgt0YXJnZXRfcGF0aBgDIAEoCRIVCg1yZWRpcmVjdF90eXBlGAQgASgFEhIKCmlzX3BhdHRlcm4YBSABKAgiQwoWVXBkYXRlUmVkaXJlY3RSZXNwb25zZRIpCghyZWRpcmVjdBgBIAEoCzIXLmJsb2NrbmluamEudjEuUmVkaXJlY3QiIwoVRGVsZXRlUmVkaXJlY3RSZXF1ZXN0EgoKAmlkGAEgASgJIikKFkRlbGV0ZVJlZGlyZWN0UmVzcG9uc2USDwoHc3VjY2VzcxgBIAEoCCIiChNUZXN0UmVkaXJlY3RSZXF1ZXN0EgsKA3VybBgBIAEoCSKIAQoUVGVzdFJlZGlyZWN0UmVzcG9uc2USFgoOd291bGRfcmVkaXJlY3QYASABKAgSEgoKdGFyZ2V0X3VybBgCIAEoCRIVCg1yZWRpcmVjdF90eXBlGAMgASgFEi0KDG1hdGNoZWRfcnVsZRgEIAEoCzIXLmJsb2NrbmluamEudjEuUmVkaXJlY3QiGQoXR2V0UmVkaXJlY3RTdGF0c1JlcXVlc3QikAEKGEdldFJlZGlyZWN0U3RhdHNSZXNwb25zZRIXCg90b3RhbF9yZWRpcmVjdHMYASABKAMSEgoKdG90YWxfaGl0cxgCIAEoAxIXCg9wZXJtYW5lbnRfY291bnQYAyABKAMSFwoPdGVtcG9yYXJ5X2NvdW50GAQgASgDEhUKDXBhdHRlcm5fY291bnQYBSABKAMiGwoZQ2xlYXJSZWRpcmVjdENhY2hlUmVxdWVzdCItChpDbGVhclJlZGlyZWN0Q2FjaGVSZXNwb25zZRIPCgdzdWNjZXNzGAEgASgIMooGChBSZWRpcmVjdHNTZXJ2aWNlEl0KDkNyZWF0ZVJlZGlyZWN0EiQuYmxvY2tuaW5qYS52MS5DcmVhdGVSZWRpcmVjdFJlcXVlc3QaJS5ibG9ja25pbmphLnYxLkNyZWF0ZVJlZGlyZWN0UmVzcG9uc2USVAoLR2V0UmVkaXJlY3QSIS5ibG9ja25pbmphLnYxLkdldFJlZGlyZWN0UmVxdWVzdBoiLmJsb2NrbmluamEudjEuR2V0UmVkaXJlY3RSZXNwb25zZRJaCg1MaXN0UmVkaXJlY3RzEiMuYmxvY2tuaW5qYS52MS5MaXN0UmVkaXJlY3RzUmVxdWVzdBokLmJsb2NrbmluamEudjEuTGlzdFJlZGlyZWN0c1Jlc3BvbnNlEl0KDlVwZGF0ZVJlZGlyZWN0EiQuYmxvY2tuaW5qYS52MS5VcGRhdGVSZWRpcmVjdFJlcXVlc3QaJS5ibG9ja25pbmphLnYxLlVwZGF0ZVJlZGlyZWN0UmVzcG9uc2USXQoORGVsZXRlUmVkaXJlY3QSJC5ibG9ja25pbmphLnYxLkRlbGV0ZVJlZGlyZWN0UmVxdWVzdBolLmJsb2NrbmluamEudjEuRGVsZXRlUmVkaXJlY3RSZXNwb25zZRJXCgxUZXN0UmVkaXJlY3QSIi5ibG9ja25pbmphLnYxLlRlc3RSZWRpcmVjdFJlcXVlc3QaIy5ibG9ja25pbmphLnYxLlRlc3RSZWRpcmVjdFJlc3BvbnNlEmMKEEdldFJlZGlyZWN0U3RhdHMSJi5ibG9ja25pbmphLnYxLkdldFJlZGlyZWN0U3RhdHNSZXF1ZXN0GicuYmxvY2tuaW5qYS52MS5HZXRSZWRpcmVjdFN0YXRzUmVzcG9uc2USaQoSQ2xlYXJSZWRpcmVjdENhY2hlEiguYmxvY2tuaW5qYS52MS5DbGVhclJlZGlyZWN0Q2FjaGVSZXF1ZXN0GikuYmxvY2tuaW5qYS52MS5DbGVhclJlZGlyZWN0Q2FjaGVSZXNwb25zZULEAQoRY29tLmJsb2NrbmluamEudjFCDlJlZGlyZWN0c1Byb3RvUAFaSmdpdC5kZXYuYWxleGR1bm1vdy5jb20vYmxvY2svbmluamEvaW50ZXJuYWwvYXBpL2Jsb2NrbmluamEvdjE7YmxvY2tuaW5qYXYxogIDQlhYqgINQmxvY2tuaW5qYS5WMcoCDUJsb2NrbmluamFcVjHiAhlCbG9ja25pbmphXFYxXEdQQk1ldGFkYXRh6gIOQmxvY2tuaW5qYTo6VjFiBnByb3RvMw",
	[file_google_protobuf_timestamp],
);
/**
 * RedirectsService manages URL redirects
 *
 * @generated from service blockninja.v1.RedirectsService
 */
const RedirectsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_redirects, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/redirects.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Create a new redirect
 *
 * @generated from rpc blockninja.v1.RedirectsService.CreateRedirect
 */
RedirectsService.method.createRedirect;
/**
 * Get a single redirect by ID
 *
 * @generated from rpc blockninja.v1.RedirectsService.GetRedirect
 */
RedirectsService.method.getRedirect;
/**
 * List all redirects with pagination
 *
 * @generated from rpc blockninja.v1.RedirectsService.ListRedirects
 */
RedirectsService.method.listRedirects;
/**
 * Update an existing redirect
 *
 * @generated from rpc blockninja.v1.RedirectsService.UpdateRedirect
 */
RedirectsService.method.updateRedirect;
/**
 * Delete a redirect
 *
 * @generated from rpc blockninja.v1.RedirectsService.DeleteRedirect
 */
RedirectsService.method.deleteRedirect;
/**
 * Test a redirect (check what URL would redirect to)
 *
 * @generated from rpc blockninja.v1.RedirectsService.TestRedirect
 */
RedirectsService.method.testRedirect;
/**
 * Get redirect statistics
 *
 * @generated from rpc blockninja.v1.RedirectsService.GetRedirectStats
 */
RedirectsService.method.getRedirectStats;
/**
 * Clear redirect cache
 *
 * @generated from rpc blockninja.v1.RedirectsService.ClearRedirectCache
 */
RedirectsService.method.clearRedirectCache;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/seo.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/seo.proto.
 */
const file_blockninja_v1_seo = /*@__PURE__*/ fileDesc(
	" ",
	[file_blockninja_v1_pages, file_blockninja_v1_ai],
);
/**
 * SEOService provides SEO health monitoring and auditing
 *
 * @generated from service blockninja.v1.SEOService
 */
const SEOService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_seo, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/seo.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Get overall SEO health statistics
 *
 * @generated from rpc blockninja.v1.SEOService.GetSEOOverview
 */
SEOService.method.getSEOOverview;
/**
 * List pages/posts with SEO audit data
 *
 * @generated from rpc blockninja.v1.SEOService.ListSEOAudit
 */
SEOService.method.listSEOAudit;
/**
 * Analyze SEO for a specific page (on-demand)
 *
 * @generated from rpc blockninja.v1.SEOService.AnalyzePageSEO
 */
SEOService.method.analyzePageSEO;
/**
 * Bulk generate SEO meta for multiple pages (max 10)
 *
 * @generated from rpc blockninja.v1.SEOService.BulkGenerateSEOMeta
 */
SEOService.method.bulkGenerateSEOMeta;
/**
 * Update SEO fields for a page (from audit dashboard quick edit)
 *
 * @generated from rpc blockninja.v1.SEOService.UpdatePageSEO
 */
SEOService.method.updatePageSEO;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/series.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/series.proto.
 */
const file_blockninja_v1_series = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_timestamp],
);
/**
 * SeriesService manages post series for multi-part content
 *
 * @generated from service blockninja.v1.SeriesService
 */
const SeriesService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_series, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/series.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * List all series
 *
 * @generated from rpc blockninja.v1.SeriesService.ListSeries
 */
SeriesService.method.listSeries;
/**
 * Get a single series by ID
 *
 * @generated from rpc blockninja.v1.SeriesService.GetSeries
 */
SeriesService.method.getSeries;
/**
 * Get series by slug (for public series pages)
 *
 * @generated from rpc blockninja.v1.SeriesService.GetSeriesBySlug
 */
SeriesService.method.getSeriesBySlug;
/**
 * Create a new series
 *
 * @generated from rpc blockninja.v1.SeriesService.CreateSeries
 */
SeriesService.method.createSeries;
/**
 * Update a series
 *
 * @generated from rpc blockninja.v1.SeriesService.UpdateSeries
 */
SeriesService.method.updateSeries;
/**
 * Delete a series
 *
 * @generated from rpc blockninja.v1.SeriesService.DeleteSeries
 */
SeriesService.method.deleteSeries;
/**
 * Get posts in a series (ordered by position)
 *
 * @generated from rpc blockninja.v1.SeriesService.GetSeriesPosts
 */
SeriesService.method.getSeriesPosts;
/**
 * Add a post to a series
 *
 * @generated from rpc blockninja.v1.SeriesService.AddPostToSeries
 */
SeriesService.method.addPostToSeries;
/**
 * Remove a post from a series
 *
 * @generated from rpc blockninja.v1.SeriesService.RemovePostFromSeries
 */
SeriesService.method.removePostFromSeries;
/**
 * Reorder posts in a series
 *
 * @generated from rpc blockninja.v1.SeriesService.ReorderSeriesPosts
 */
SeriesService.method.reorderSeriesPosts;
/**
 * Get series navigation for a post (prev/next in series)
 *
 * @generated from rpc blockninja.v1.SeriesService.GetSeriesNavigation
 */
SeriesService.method.getSeriesNavigation;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/settings.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/settings.proto.
 */
const file_blockninja_v1_settings = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_struct, file_google_protobuf_timestamp],
);
/**
 * Well-known setting keys
 *
 * @generated from enum blockninja.v1.SettingKey
 */
var SettingKey;
(function (SettingKey) {
	/**
	 * @generated from enum value: SETTING_KEY_UNSPECIFIED = 0;
	 */
	SettingKey[(SettingKey["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * Site-wide settings (title, description, default_template)
	 *
	 * @generated from enum value: SETTING_KEY_SITE = 1;
	 */
	SettingKey[(SettingKey["SITE"] = 1)] = "SITE";
	/**
	 * AI provider settings
	 *
	 * @generated from enum value: SETTING_KEY_AI = 2;
	 */
	SettingKey[(SettingKey["AI"] = 2)] = "AI";
	/**
	 * Active theme configuration
	 *
	 * @generated from enum value: SETTING_KEY_THEME = 3;
	 */
	SettingKey[(SettingKey["THEME"] = 3)] = "THEME";
})(SettingKey || (SettingKey = {}));
/**
 * Site operating mode
 *
 * @generated from enum blockninja.v1.SiteMode
 */
var SiteMode;
(function (SiteMode) {
	/**
	 * Defaults to NORMAL
	 *
	 * @generated from enum value: SITE_MODE_UNSPECIFIED = 0;
	 */
	SiteMode[(SiteMode["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * Site operates normally
	 *
	 * @generated from enum value: SITE_MODE_NORMAL = 1;
	 */
	SiteMode[(SiteMode["NORMAL"] = 1)] = "NORMAL";
	/**
	 * Show maintenance page to visitors
	 *
	 * @generated from enum value: SITE_MODE_MAINTENANCE = 2;
	 */
	SiteMode[(SiteMode["MAINTENANCE"] = 2)] = "MAINTENANCE";
	/**
	 * Show coming soon page to visitors
	 *
	 * @generated from enum value: SITE_MODE_COMING_SOON = 3;
	 */
	SiteMode[(SiteMode["COMING_SOON"] = 3)] = "COMING_SOON";
})(SiteMode || (SiteMode = {}));
/**
 * Media moderation workflow mode
 *
 * @generated from enum blockninja.v1.ModerationMode
 */
var ModerationMode;
(function (ModerationMode) {
	/**
	 * Defaults to PRE_PUBLISH
	 *
	 * @generated from enum value: MODERATION_MODE_UNSPECIFIED = 0;
	 */
	ModerationMode[(ModerationMode["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * Clean uploads wait for moderator approval
	 *
	 * @generated from enum value: MODERATION_MODE_PRE_PUBLISH = 1;
	 */
	ModerationMode[(ModerationMode["PRE_PUBLISH"] = 1)] = "PRE_PUBLISH";
	/**
	 * Clean uploads are visible immediately, then reviewed
	 *
	 * @generated from enum value: MODERATION_MODE_POST_PUBLISH = 2;
	 */
	ModerationMode[(ModerationMode["POST_PUBLISH"] = 2)] = "POST_PUBLISH";
})(ModerationMode || (ModerationMode = {}));
/**
 * @generated from service blockninja.v1.SettingsService
 */
const SettingsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_settings, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/settings.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Get a single setting by key
 *
 * @generated from rpc blockninja.v1.SettingsService.GetSetting
 */
SettingsService.method.getSetting;
/**
 * Set a setting value
 *
 * @generated from rpc blockninja.v1.SettingsService.SetSetting
 */
SettingsService.method.setSetting;
/**
 * List all settings
 *
 * @generated from rpc blockninja.v1.SettingsService.ListSettings
 */
SettingsService.method.listSettings;
/**
 * Get site settings (convenience method)
 *
 * @generated from rpc blockninja.v1.SettingsService.GetSiteSettings
 */
SettingsService.method.getSiteSettings;
/**
 * Update site settings
 *
 * @generated from rpc blockninja.v1.SettingsService.UpdateSiteSettings
 */
SettingsService.method.updateSiteSettings;
/**
 * List available templates (loaded plugins)
 *
 * @generated from rpc blockninja.v1.SettingsService.ListAvailableTemplates
 */
SettingsService.method.listAvailableTemplates;
/**
 * Get template settings schema
 *
 * @generated from rpc blockninja.v1.SettingsService.GetTemplateSettingsSchema
 */
SettingsService.method.getTemplateSettingsSchema;
/**
 * Get template settings values
 *
 * @generated from rpc blockninja.v1.SettingsService.GetTemplateSettings
 */
SettingsService.method.getTemplateSettings;
/**
 * Update template settings
 *
 * @generated from rpc blockninja.v1.SettingsService.UpdateTemplateSettings
 */
SettingsService.method.updateTemplateSettings;
/**
 * List available page templates for a system template (theme)
 *
 * @generated from rpc blockninja.v1.SettingsService.ListPageTemplates
 */
SettingsService.method.listPageTemplates;
/**
 * Export all settings to encrypted JSON
 *
 * @generated from rpc blockninja.v1.SettingsService.ExportSettings
 */
SettingsService.method.exportSettings;
/**
 * Preview what an import would change (dry run)
 *
 * @generated from rpc blockninja.v1.SettingsService.PreviewImportSettings
 */
SettingsService.method.previewImportSettings;
/**
 * Import settings from encrypted JSON
 *
 * @generated from rpc blockninja.v1.SettingsService.ImportSettings
 */
SettingsService.method.importSettings;
/**
 * Get storage usage and limits (for storage gauge in media library)
 *
 * @generated from rpc blockninja.v1.SettingsService.GetStorageStatus
 */
const getStorageStatus = SettingsService.method.getStorageStatus;
/**
 * Get plan capabilities and enabled features
 *
 * @generated from rpc blockninja.v1.SettingsService.GetCapabilities
 */
SettingsService.method.getCapabilities;
/**
 * Enable a sidecar feature (requires Pro+ plan and orchestrator)
 *
 * @generated from rpc blockninja.v1.SettingsService.EnableSidecarFeature
 */
SettingsService.method.enableSidecarFeature;
/**
 * Disable a sidecar feature
 *
 * @generated from rpc blockninja.v1.SettingsService.DisableSidecarFeature
 */
SettingsService.method.disableSidecarFeature;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/setup.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/setup.proto.
 */
const file_blockninja_v1_setup = /*@__PURE__*/ fileDesc(
	"ChlibG9ja25pbmphL3YxL3NldHVwLnByb3RvEg1ibG9ja25pbmphLnYxIhcKFUdldFNldHVwU3RhdHVzUmVxdWVzdCKYAQoWR2V0U2V0dXBTdGF0dXNSZXNwb25zZRIWCg5zZXR1cF9yZXF1aXJlZBgBIAEoCBIZChFvcmNoZXN0cmF0b3JfbW9kZRgCIAEoCBIcChRvcmNoZXN0cmF0b3Jfc3NvX3VybBgDIAEoCRIaChJkZWZhdWx0X3NpdGVfdGl0bGUYBCABKAkSEQoJaGFzX3VzZXJzGAUgASgIIt0CChRDb21wbGV0ZVNldHVwUmVxdWVzdBINCgVlbWFpbBgBIAEoCRIQCghwYXNzd29yZBgCIAEoCRISCgpmaXJzdF9uYW1lGAMgASgJEhEKCWxhc3RfbmFtZRgEIAEoCRIXCgpzaXRlX3RpdGxlGAUgASgJSACIAQESHQoQc2l0ZV9kZXNjcmlwdGlvbhgGIAEoCUgBiAEBEhgKC3NpdGVfZG9tYWluGAcgASgJSAKIAQESGAoLYmFja3VwX2RhdGEYCCABKAxIA4gBARIcCg9iYWNrdXBfcGFzc3dvcmQYCSABKAlIBIgBARIbChNjcmVhdGVfc2VlZF9jb250ZW50GAogASgIQg0KC19zaXRlX3RpdGxlQhMKEV9zaXRlX2Rlc2NyaXB0aW9uQg4KDF9zaXRlX2RvbWFpbkIOCgxfYmFja3VwX2RhdGFCEgoQX2JhY2t1cF9wYXNzd29yZCJxChVDb21wbGV0ZVNldHVwUmVzcG9uc2USDwoHc3VjY2VzcxgBIAEoCBImCgR1c2VyGAIgASgLMhguYmxvY2tuaW5qYS52MS5BZG1pblVzZXISEAoId2FybmluZ3MYAyADKAkSDQoFZXJyb3IYBCABKAkivAEKF0NvbXBsZXRlU1NPU2V0dXBSZXF1ZXN0EhcKCnNpdGVfdGl0bGUYASABKAlIAIgBARIdChBzaXRlX2Rlc2NyaXB0aW9uGAIgASgJSAGIAQESGAoLc2l0ZV9kb21haW4YAyABKAlIAogBARIbChNjcmVhdGVfc2VlZF9jb250ZW50GAQgASgIQg0KC19zaXRlX3RpdGxlQhMKEV9zaXRlX2Rlc2NyaXB0aW9uQg4KDF9zaXRlX2RvbWFpbiJMChhDb21wbGV0ZVNTT1NldHVwUmVzcG9uc2USDwoHc3VjY2VzcxgBIAEoCBIQCgh3YXJuaW5ncxgCIAMoCRINCgVlcnJvchgDIAEoCSJCChlQcmV2aWV3U2V0dXBCYWNrdXBSZXF1ZXN0EhMKC2JhY2t1cF9kYXRhGAEgASgMEhAKCHBhc3N3b3JkGAIgASgJIs0BChpQcmV2aWV3U2V0dXBCYWNrdXBSZXNwb25zZRINCgV2YWxpZBgBIAEoCBINCgVlcnJvchgCIAEoCRIZChFzb3VyY2Vfc2l0ZV90aXRsZRgDIAEoCRIvCgtleHBvcnRlZF9hdBgEIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASFgoOZm9ybWF0X3ZlcnNpb24YBSABKAUSLQoHc3VtbWFyeRgGIAEoCzIcLmJsb2NrbmluamEudjEuQmFja3VwU3VtbWFyeTKZAwoMU2V0dXBTZXJ2aWNlEl0KDkdldFNldHVwU3RhdHVzEiQuYmxvY2tuaW5qYS52MS5HZXRTZXR1cFN0YXR1c1JlcXVlc3QaJS5ibG9ja25pbmphLnYxLkdldFNldHVwU3RhdHVzUmVzcG9uc2USWgoNQ29tcGxldGVTZXR1cBIjLmJsb2NrbmluamEudjEuQ29tcGxldGVTZXR1cFJlcXVlc3QaJC5ibG9ja25pbmphLnYxLkNvbXBsZXRlU2V0dXBSZXNwb25zZRJjChBDb21wbGV0ZVNTT1NldHVwEiYuYmxvY2tuaW5qYS52MS5Db21wbGV0ZVNTT1NldHVwUmVxdWVzdBonLmJsb2NrbmluamEudjEuQ29tcGxldGVTU09TZXR1cFJlc3BvbnNlEmkKElByZXZpZXdTZXR1cEJhY2t1cBIoLmJsb2NrbmluamEudjEuUHJldmlld1NldHVwQmFja3VwUmVxdWVzdBopLmJsb2NrbmluamEudjEuUHJldmlld1NldHVwQmFja3VwUmVzcG9uc2VCwAEKEWNvbS5ibG9ja25pbmphLnYxQgpTZXR1cFByb3RvUAFaSmdpdC5kZXYuYWxleGR1bm1vdy5jb20vYmxvY2svbmluamEvaW50ZXJuYWwvYXBpL2Jsb2NrbmluamEvdjE7YmxvY2tuaW5qYXYxogIDQlhYqgINQmxvY2tuaW5qYS5WMcoCDUJsb2NrbmluamFcVjHiAhlCbG9ja25pbmphXFYxXEdQQk1ldGFkYXRh6gIOQmxvY2tuaW5qYTo6VjFiBnByb3RvMw",
	[file_blockninja_v1_auth, file_blockninja_v1_backup, file_google_protobuf_timestamp],
);
/**
 * SetupService handles first-time setup when no admin users exist.
 * All endpoints are PUBLIC (no auth required) but CompleteSetup only works
 * when zero admin users exist in the database.
 * When orchestrator mode is enabled, setup requires SSO authentication.
 *
 * @generated from service blockninja.v1.SetupService
 */
const SetupService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_setup, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/setup.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Check if setup is required (no admin users exist)
 *
 * @generated from rpc blockninja.v1.SetupService.GetSetupStatus
 */
SetupService.method.getSetupStatus;
/**
 * Complete the initial setup - creates first admin and configures site
 * SECURITY: Only works when no admin users exist
 *
 * @generated from rpc blockninja.v1.SetupService.CompleteSetup
 */
SetupService.method.completeSetup;
/**
 * Complete SSO setup - applies site settings after SSO creates the user
 * SECURITY: Requires authentication, only works when exactly 1 admin exists
 *
 * @generated from rpc blockninja.v1.SetupService.CompleteSSOSetup
 */
SetupService.method.completeSSOSetup;
/**
 * Preview a backup during setup (before user exists)
 *
 * @generated from rpc blockninja.v1.SetupService.PreviewSetupBackup
 */
SetupService.method.previewSetupBackup;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/smart_block.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/smart_block.proto.
 */
const file_blockninja_v1_smart_block = /*@__PURE__*/ fileDesc(
	"Ch9ibG9ja25pbmphL3YxL3NtYXJ0X2Jsb2NrLnByb3RvEg1ibG9ja25pbmphLnYxIlsKGUdlbmVyYXRlU21hcnRCbG9ja1JlcXVlc3QSDgoGcHJvbXB0GAEgASgJEhUKDWV4aXN0aW5nX2h0bWwYAiABKAkSFwoPZXhpc3Rpbmdfc2NoZW1hGAMgASgJInQKGkdlbmVyYXRlU21hcnRCbG9ja1Jlc3BvbnNlEhUKDWdlbmVyYXRpb25faWQYASABKAkSEwoLc2NoZW1hX2pzb24YAiABKAkSFQoNaHRtbF90ZW1wbGF0ZRgDIAEoCRITCgtleHBsYW5hdGlvbhgEIAEoCSI0ChNDb252ZXJzYXRpb25NZXNzYWdlEgwKBHJvbGUYASABKAkSDwoHY29udGVudBgCIAEoCSKtAQoXQXNzaXN0U21hcnRCbG9ja1JlcXVlc3QSEwoLaW5zdHJ1Y3Rpb24YASABKAkSFAoMY3VycmVudF9odG1sGAIgASgJEhMKC3NjaGVtYV9qc29uGAMgASgJEkAKFGNvbnZlcnNhdGlvbl9oaXN0b3J5GAQgAygLMiIuYmxvY2tuaW5qYS52MS5Db252ZXJzYXRpb25NZXNzYWdlEhAKCGJsb2NrX2lkGAUgASgJInwKGEFzc2lzdFNtYXJ0QmxvY2tSZXNwb25zZRIVCg1odG1sX3RlbXBsYXRlGAEgASgJEhMKC2V4cGxhbmF0aW9uGAIgASgJEjQKEGRldGVjdGVkX3JlbmFtZXMYAyADKAsyGi5ibG9ja25pbmphLnYxLkZpZWxkUmVuYW1lIlYKF0dlbmVyYXRlVGVzdERhdGFSZXF1ZXN0EhMKC3NjaGVtYV9qc29uGAEgASgJEg8KB2NvbnRleHQYAiABKAkSFQoNaHRtbF90ZW1wbGF0ZRgDIAEoCSJHChhHZW5lcmF0ZVRlc3REYXRhUmVzcG9uc2USFgoOdGVzdF9kYXRhX2pzb24YASABKAkSEwoLZXhwbGFuYXRpb24YAiABKAkiWwoTR2VuZXJhdGVUZXh0UmVxdWVzdBIOCgZwcm9tcHQYASABKAkSDwoHY29udGV4dBgCIAEoCRIjCgR0YXNrGAMgASgOMhUuYmxvY2tuaW5qYS52MS5BSVRhc2siOQoUR2VuZXJhdGVUZXh0UmVzcG9uc2USDAoEdGV4dBgBIAEoCRITCgtleHBsYW5hdGlvbhgCIAEoCTKhAwoRU21hcnRCbG9ja1NlcnZpY2USaQoSR2VuZXJhdGVTbWFydEJsb2NrEiguYmxvY2tuaW5qYS52MS5HZW5lcmF0ZVNtYXJ0QmxvY2tSZXF1ZXN0GikuYmxvY2tuaW5qYS52MS5HZW5lcmF0ZVNtYXJ0QmxvY2tSZXNwb25zZRJjChBBc3Npc3RTbWFydEJsb2NrEiYuYmxvY2tuaW5qYS52MS5Bc3Npc3RTbWFydEJsb2NrUmVxdWVzdBonLmJsb2NrbmluamEudjEuQXNzaXN0U21hcnRCbG9ja1Jlc3BvbnNlEmMKEEdlbmVyYXRlVGVzdERhdGESJi5ibG9ja25pbmphLnYxLkdlbmVyYXRlVGVzdERhdGFSZXF1ZXN0GicuYmxvY2tuaW5qYS52MS5HZW5lcmF0ZVRlc3REYXRhUmVzcG9uc2USVwoMR2VuZXJhdGVUZXh0EiIuYmxvY2tuaW5qYS52MS5HZW5lcmF0ZVRleHRSZXF1ZXN0GiMuYmxvY2tuaW5qYS52MS5HZW5lcmF0ZVRleHRSZXNwb25zZULFAQoRY29tLmJsb2NrbmluamEudjFCD1NtYXJ0QmxvY2tQcm90b1ABWkpnaXQuZGV2LmFsZXhkdW5tb3cuY29tL2Jsb2NrL25pbmphL2ludGVybmFsL2FwaS9ibG9ja25pbmphL3YxO2Jsb2NrbmluamF2MaICA0JYWKoCDUJsb2NrbmluamEuVjHKAg1CbG9ja25pbmphXFYx4gIZQmxvY2tuaW5qYVxWMVxHUEJNZXRhZGF0YeoCDkJsb2NrbmluamE6OlYxYgZwcm90bzM",
	[file_blockninja_v1_ai, file_blockninja_v1_blocks],
);
/**
 * SmartBlockService handles AI-powered block generation and assistance
 *
 * @generated from service blockninja.v1.SmartBlockService
 */
const SmartBlockService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_smart_block, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/smart_block.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Generate schema + HTML template from a natural language prompt
 *
 * @generated from rpc blockninja.v1.SmartBlockService.GenerateSmartBlock
 */
SmartBlockService.method.generateSmartBlock;
/**
 * AI assist - modify HTML based on instruction
 *
 * @generated from rpc blockninja.v1.SmartBlockService.AssistSmartBlock
 */
SmartBlockService.method.assistSmartBlock;
/**
 * Generate realistic test/filler data based on schema
 *
 * @generated from rpc blockninja.v1.SmartBlockService.GenerateTestData
 */
SmartBlockService.method.generateTestData;
/**
 * Generate text content from a prompt (for site status messages, etc.)
 *
 * @generated from rpc blockninja.v1.SmartBlockService.GenerateText
 */
SmartBlockService.method.generateText;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/storage.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/storage.proto.
 */
const file_blockninja_v1_storage = /*@__PURE__*/ fileDesc(
	"ChtibG9ja25pbmphL3YxL3N0b3JhZ2UucHJvdG8SDWJsb2NrbmluamEudjEi3QEKCFMzQ29uZmlnEg4KBmJ1Y2tldBgBIAEoCRIOCgZyZWdpb24YAiABKAkSFQoNYWNjZXNzX2tleV9pZBgDIAEoCRIZChFzZWNyZXRfYWNjZXNzX2tleRgEIAEoCRIUCgxlbmRwb2ludF91cmwYBSABKAkSEgoKcGF0aF9zdHlsZRgGIAEoCBIPCgdjZG5fdXJsGAcgASgJEhAKCGlzX3ZhbGlkGAggASgIEjIKDmxhc3RfdGVzdGVkX2F0GAkgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcCIUChJHZXRTM0NvbmZpZ1JlcXVlc3QiUgoTR2V0UzNDb25maWdSZXNwb25zZRISCgpjb25maWd1cmVkGAEgASgIEicKBmNvbmZpZxgCIAEoCzIXLmJsb2NrbmluamEudjEuUzNDb25maWciPgoTU2F2ZVMzQ29uZmlnUmVxdWVzdBInCgZjb25maWcYASABKAsyFy5ibG9ja25pbmphLnYxLlMzQ29uZmlnIjYKFFNhdmVTM0NvbmZpZ1Jlc3BvbnNlEg8KB3N1Y2Nlc3MYASABKAgSDQoFZXJyb3IYAiABKAkiQgoXVGVzdFMzQ29ubmVjdGlvblJlcXVlc3QSJwoGY29uZmlnGAEgASgLMhcuYmxvY2tuaW5qYS52MS5TM0NvbmZpZyJTChhUZXN0UzNDb25uZWN0aW9uUmVzcG9uc2USDwoHc3VjY2VzcxgBIAEoCBINCgVlcnJvchgCIAEoCRIXCg9idWNrZXRfbG9jYXRpb24YAyABKAkiFwoVRGVsZXRlUzNDb25maWdSZXF1ZXN0IikKFkRlbGV0ZVMzQ29uZmlnUmVzcG9uc2USDwoHc3VjY2VzcxgBIAEoCDKDAwoOU3RvcmFnZVNlcnZpY2USVAoLR2V0UzNDb25maWcSIS5ibG9ja25pbmphLnYxLkdldFMzQ29uZmlnUmVxdWVzdBoiLmJsb2NrbmluamEudjEuR2V0UzNDb25maWdSZXNwb25zZRJXCgxTYXZlUzNDb25maWcSIi5ibG9ja25pbmphLnYxLlNhdmVTM0NvbmZpZ1JlcXVlc3QaIy5ibG9ja25pbmphLnYxLlNhdmVTM0NvbmZpZ1Jlc3BvbnNlEmMKEFRlc3RTM0Nvbm5lY3Rpb24SJi5ibG9ja25pbmphLnYxLlRlc3RTM0Nvbm5lY3Rpb25SZXF1ZXN0GicuYmxvY2tuaW5qYS52MS5UZXN0UzNDb25uZWN0aW9uUmVzcG9uc2USXQoORGVsZXRlUzNDb25maWcSJC5ibG9ja25pbmphLnYxLkRlbGV0ZVMzQ29uZmlnUmVxdWVzdBolLmJsb2NrbmluamEudjEuRGVsZXRlUzNDb25maWdSZXNwb25zZULCAQoRY29tLmJsb2NrbmluamEudjFCDFN0b3JhZ2VQcm90b1ABWkpnaXQuZGV2LmFsZXhkdW5tb3cuY29tL2Jsb2NrL25pbmphL2ludGVybmFsL2FwaS9ibG9ja25pbmphL3YxO2Jsb2NrbmluamF2MaICA0JYWKoCDUJsb2NrbmluamEuVjHKAg1CbG9ja25pbmphXFYx4gIZQmxvY2tuaW5qYVxWMVxHUEJNZXRhZGF0YeoCDkJsb2NrbmluamE6OlYxYgZwcm90bzM",
	[file_google_protobuf_timestamp],
);
/**
 * StorageService handles S3/cloud storage configuration
 *
 * @generated from service blockninja.v1.StorageService
 */
const StorageService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_storage, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/storage.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Get current S3 configuration (credentials masked)
 *
 * @generated from rpc blockninja.v1.StorageService.GetS3Config
 */
StorageService.method.getS3Config;
/**
 * Save S3 configuration (tests connection before saving)
 *
 * @generated from rpc blockninja.v1.StorageService.SaveS3Config
 */
StorageService.method.saveS3Config;
/**
 * Test S3 connection without saving
 *
 * @generated from rpc blockninja.v1.StorageService.TestS3Connection
 */
StorageService.method.testS3Connection;
/**
 * Delete S3 configuration
 *
 * @generated from rpc blockninja.v1.StorageService.DeleteS3Config
 */
StorageService.method.deleteS3Config;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/tags.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/tags.proto.
 */
const file_blockninja_v1_tags = /*@__PURE__*/ fileDesc(
	"ChhibG9ja25pbmphL3YxL3RhZ3MucHJvdG8SDWJsb2NrbmluamEudjEigQEKA1RhZxIKCgJpZBgBIAEoCRIMCgRuYW1lGAIgASgJEgwKBHNsdWcYAyABKAkSDQoFY29sb3IYBCABKAkSEwoLdXNhZ2VfY291bnQYBSABKAUSLgoKY3JlYXRlZF9hdBgGIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXAiVgoPTGlzdFRhZ3NSZXF1ZXN0EjMKC2VudGl0eV90eXBlGAEgASgOMhkuYmxvY2tuaW5qYS52MS5FbnRpdHlUeXBlSACIAQFCDgoMX2VudGl0eV90eXBlIjQKEExpc3RUYWdzUmVzcG9uc2USIAoEdGFncxgBIAMoCzISLmJsb2NrbmluamEudjEuVGFnIj4KEENyZWF0ZVRhZ1JlcXVlc3QSDAoEbmFtZRgBIAEoCRISCgVjb2xvchgCIAEoCUgAiAEBQggKBl9jb2xvciI0ChFDcmVhdGVUYWdSZXNwb25zZRIfCgN0YWcYASABKAsyEi5ibG9ja25pbmphLnYxLlRhZyJYChBVcGRhdGVUYWdSZXF1ZXN0EgoKAmlkGAEgASgJEhEKBG5hbWUYAiABKAlIAIgBARISCgVjb2xvchgDIAEoCUgBiAEBQgcKBV9uYW1lQggKBl9jb2xvciI0ChFVcGRhdGVUYWdSZXNwb25zZRIfCgN0YWcYASABKAsyEi5ibG9ja25pbmphLnYxLlRhZyIeChBEZWxldGVUYWdSZXF1ZXN0EgoKAmlkGAEgASgJIhMKEURlbGV0ZVRhZ1Jlc3BvbnNlIlkKFEdldEVudGl0eVRhZ3NSZXF1ZXN0Ei4KC2VudGl0eV90eXBlGAEgASgOMhkuYmxvY2tuaW5qYS52MS5FbnRpdHlUeXBlEhEKCWVudGl0eV9pZBgCIAEoCSI5ChVHZXRFbnRpdHlUYWdzUmVzcG9uc2USIAoEdGFncxgBIAMoCzISLmJsb2NrbmluamEudjEuVGFnImoKFFNldEVudGl0eVRhZ3NSZXF1ZXN0Ei4KC2VudGl0eV90eXBlGAEgASgOMhkuYmxvY2tuaW5qYS52MS5FbnRpdHlUeXBlEhEKCWVudGl0eV9pZBgCIAEoCRIPCgd0YWdfaWRzGAMgAygJIjkKFVNldEVudGl0eVRhZ3NSZXNwb25zZRIgCgR0YWdzGAEgAygLMhIuYmxvY2tuaW5qYS52MS5UYWcqbQoKRW50aXR5VHlwZRIbChdFTlRJVFlfVFlQRV9VTlNQRUNJRklFRBAAEhUKEUVOVElUWV9UWVBFX01FRElBEAESFAoQRU5USVRZX1RZUEVfUEFHRRACEhUKEUVOVElUWV9UWVBFX0JMT0NLEAMygQQKClRhZ1NlcnZpY2USSwoITGlzdFRhZ3MSHi5ibG9ja25pbmphLnYxLkxpc3RUYWdzUmVxdWVzdBofLmJsb2NrbmluamEudjEuTGlzdFRhZ3NSZXNwb25zZRJOCglDcmVhdGVUYWcSHy5ibG9ja25pbmphLnYxLkNyZWF0ZVRhZ1JlcXVlc3QaIC5ibG9ja25pbmphLnYxLkNyZWF0ZVRhZ1Jlc3BvbnNlEk4KCVVwZGF0ZVRhZxIfLmJsb2NrbmluamEudjEuVXBkYXRlVGFnUmVxdWVzdBogLmJsb2NrbmluamEudjEuVXBkYXRlVGFnUmVzcG9uc2USTgoJRGVsZXRlVGFnEh8uYmxvY2tuaW5qYS52MS5EZWxldGVUYWdSZXF1ZXN0GiAuYmxvY2tuaW5qYS52MS5EZWxldGVUYWdSZXNwb25zZRJaCg1HZXRFbnRpdHlUYWdzEiMuYmxvY2tuaW5qYS52MS5HZXRFbnRpdHlUYWdzUmVxdWVzdBokLmJsb2NrbmluamEudjEuR2V0RW50aXR5VGFnc1Jlc3BvbnNlEloKDVNldEVudGl0eVRhZ3MSIy5ibG9ja25pbmphLnYxLlNldEVudGl0eVRhZ3NSZXF1ZXN0GiQuYmxvY2tuaW5qYS52MS5TZXRFbnRpdHlUYWdzUmVzcG9uc2VCvwEKEWNvbS5ibG9ja25pbmphLnYxQglUYWdzUHJvdG9QAVpKZ2l0LmRldi5hbGV4ZHVubW93LmNvbS9ibG9jay9uaW5qYS9pbnRlcm5hbC9hcGkvYmxvY2tuaW5qYS92MTtibG9ja25pbmphdjGiAgNCWFiqAg1CbG9ja25pbmphLlYxygINQmxvY2tuaW5qYVxWMeICGUJsb2NrbmluamFcVjFcR1BCTWV0YWRhdGHqAg5CbG9ja25pbmphOjpWMWIGcHJvdG8z",
	[file_google_protobuf_timestamp],
);
/**
 * Entity types that can be tagged
 *
 * @generated from enum blockninja.v1.EntityType
 */
var EntityType;
(function (EntityType) {
	/**
	 * @generated from enum value: ENTITY_TYPE_UNSPECIFIED = 0;
	 */
	EntityType[(EntityType["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: ENTITY_TYPE_MEDIA = 1;
	 */
	EntityType[(EntityType["MEDIA"] = 1)] = "MEDIA";
	/**
	 * @generated from enum value: ENTITY_TYPE_PAGE = 2;
	 */
	EntityType[(EntityType["PAGE"] = 2)] = "PAGE";
	/**
	 * @generated from enum value: ENTITY_TYPE_BLOCK = 3;
	 */
	EntityType[(EntityType["BLOCK"] = 3)] = "BLOCK";
})(EntityType || (EntityType = {}));
/**
 * Generic tagging service for any entity type
 *
 * @generated from service blockninja.v1.TagService
 */
const TagService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_tags, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/tags.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * List all tags, optionally filtered by entity type
 *
 * @generated from rpc blockninja.v1.TagService.ListTags
 */
TagService.method.listTags;
/**
 * Create a new tag
 *
 * @generated from rpc blockninja.v1.TagService.CreateTag
 */
TagService.method.createTag;
/**
 * Update a tag
 *
 * @generated from rpc blockninja.v1.TagService.UpdateTag
 */
TagService.method.updateTag;
/**
 * Delete a tag
 *
 * @generated from rpc blockninja.v1.TagService.DeleteTag
 */
TagService.method.deleteTag;
/**
 * Get tags for a specific entity
 *
 * @generated from rpc blockninja.v1.TagService.GetEntityTags
 */
TagService.method.getEntityTags;
/**
 * Set tags for an entity (replaces all existing tags)
 *
 * @generated from rpc blockninja.v1.TagService.SetEntityTags
 */
TagService.method.setEntityTags;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/theme.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/theme.proto.
 */
const file_blockninja_v1_theme = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_timestamp],
);
/**
 * ThemeService manages site-wide theme settings
 *
 * @generated from service blockninja.v1.ThemeService
 */
const ThemeService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_theme, 0);
/**
 * FontService manages fonts (Google, uploaded, template-bundled)
 *
 * @generated from service blockninja.v1.FontService
 */
const FontService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_theme, 1);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/theme.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * List all installed fonts
 *
 * @generated from rpc blockninja.v1.FontService.ListFonts
 */
FontService.method.listFonts;
/**
 * Get a single font by ID
 *
 * @generated from rpc blockninja.v1.FontService.GetFont
 */
FontService.method.getFont;
/**
 * List curated Google Fonts (no API key needed)
 *
 * @generated from rpc blockninja.v1.FontService.ListGoogleFonts
 */
FontService.method.listGoogleFonts;
/**
 * Add a Google Font to the library
 *
 * @generated from rpc blockninja.v1.FontService.AddGoogleFont
 */
FontService.method.addGoogleFont;
/**
 * Delete a font (only user-uploaded fonts can be deleted)
 *
 * @generated from rpc blockninja.v1.FontService.DeleteFont
 */
FontService.method.deleteFont;

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/theme.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Get current theme settings
 *
 * @generated from rpc blockninja.v1.ThemeService.GetTheme
 */
ThemeService.method.getTheme;
/**
 * Update theme settings
 *
 * @generated from rpc blockninja.v1.ThemeService.UpdateTheme
 */
ThemeService.method.updateTheme;
/**
 * Reset theme to defaults
 *
 * @generated from rpc blockninja.v1.ThemeService.ResetTheme
 */
ThemeService.method.resetTheme;
/**
 * Generate CSS from theme settings (for preview)
 *
 * @generated from rpc blockninja.v1.ThemeService.GenerateThemeCSS
 */
ThemeService.method.generateThemeCSS;
/**
 * Get pre-resolved color swatches for the color picker
 * Resolves the correct colors based on site theme mode (not browser preference)
 *
 * @generated from rpc blockninja.v1.ThemeService.GetColorSwatches
 */
ThemeService.method.getColorSwatches;
/**
 * List theme presets for the active template
 *
 * @generated from rpc blockninja.v1.ThemeService.ListThemePresets
 */
ThemeService.method.listThemePresets;
/**
 * Apply a theme preset
 *
 * @generated from rpc blockninja.v1.ThemeService.ApplyThemePreset
 */
ThemeService.method.applyThemePreset;
/**
 * List user-created theme presets (stored in database)
 *
 * @generated from rpc blockninja.v1.ThemeService.ListUserThemePresets
 */
ThemeService.method.listUserThemePresets;
/**
 * Create a user theme preset from current settings
 *
 * @generated from rpc blockninja.v1.ThemeService.CreateUserThemePreset
 */
ThemeService.method.createUserThemePreset;
/**
 * Update a user theme preset
 *
 * @generated from rpc blockninja.v1.ThemeService.UpdateUserThemePreset
 */
ThemeService.method.updateUserThemePreset;
/**
 * Delete a user theme preset
 *
 * @generated from rpc blockninja.v1.ThemeService.DeleteUserThemePreset
 */
ThemeService.method.deleteUserThemePreset;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/user_engagement.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/user_engagement.proto.
 */
const file_blockninja_v1_user_engagement = /*@__PURE__*/ fileDesc(
	"CiNibG9ja25pbmphL3YxL3VzZXJfZW5nYWdlbWVudC5wcm90bxINYmxvY2tuaW5qYS52MSKNAQoJVXNlclZpc2l0EgoKAmlkGAEgASgJEhAKCHRhYmxlX2lkGAIgASgJEg4KBnJvd19pZBgDIAEoCRIVCghwaG90b19pZBgEIAEoCUgAiAEBEi4KCnZpc2l0ZWRfYXQYBSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgsKCV9waG90b19pZCJaChJNYXJrVmlzaXRlZFJlcXVlc3QSEAoIdGFibGVfaWQYASABKAkSDgoGcm93X2lkGAIgASgJEhUKCHBob3RvX2lkGAMgASgJSACIAQFCCwoJX3Bob3RvX2lkIj4KE01hcmtWaXNpdGVkUmVzcG9uc2USJwoFdmlzaXQYASABKAsyGC5ibG9ja25pbmphLnYxLlVzZXJWaXNpdCI2ChJSZW1vdmVWaXNpdFJlcXVlc3QSEAoIdGFibGVfaWQYASABKAkSDgoGcm93X2lkGAIgASgJIhUKE1JlbW92ZVZpc2l0UmVzcG9uc2UiZgoRTGlzdFZpc2l0c1JlcXVlc3QSLQoKcGFnaW5hdGlvbhgBIAEoCzIZLmJsb2NrbmluamEudjEuUGFnaW5hdGlvbhIVCgh0YWJsZV9pZBgCIAEoCUgAiAEBQgsKCV90YWJsZV9pZCJ1ChJMaXN0VmlzaXRzUmVzcG9uc2USKAoGdmlzaXRzGAEgAygLMhguYmxvY2tuaW5qYS52MS5Vc2VyVmlzaXQSNQoKcGFnaW5hdGlvbhgCIAEoCzIhLmJsb2NrbmluamEudjEuUGFnaW5hdGlvblJlc3BvbnNlImwKDFdpc2hsaXN0SXRlbRIKCgJpZBgBIAEoCRIQCgh0YWJsZV9pZBgCIAEoCRIOCgZyb3dfaWQYAyABKAkSLgoKY3JlYXRlZF9hdBgEIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXAiOAoUQWRkVG9XaXNobGlzdFJlcXVlc3QSEAoIdGFibGVfaWQYASABKAkSDgoGcm93X2lkGAIgASgJIkIKFUFkZFRvV2lzaGxpc3RSZXNwb25zZRIpCgRpdGVtGAEgASgLMhsuYmxvY2tuaW5qYS52MS5XaXNobGlzdEl0ZW0iPQoZUmVtb3ZlRnJvbVdpc2hsaXN0UmVxdWVzdBIQCgh0YWJsZV9pZBgBIAEoCRIOCgZyb3dfaWQYAiABKAkiHAoaUmVtb3ZlRnJvbVdpc2hsaXN0UmVzcG9uc2UiaAoTTGlzdFdpc2hsaXN0UmVxdWVzdBItCgpwYWdpbmF0aW9uGAEgASgLMhkuYmxvY2tuaW5qYS52MS5QYWdpbmF0aW9uEhUKCHRhYmxlX2lkGAIgASgJSACIAQFCCwoJX3RhYmxlX2lkInkKFExpc3RXaXNobGlzdFJlc3BvbnNlEioKBWl0ZW1zGAEgAygLMhsuYmxvY2tuaW5qYS52MS5XaXNobGlzdEl0ZW0SNQoKcGFnaW5hdGlvbhgCIAEoCzIhLmJsb2NrbmluamEudjEuUGFnaW5hdGlvblJlc3BvbnNlIj4KGkdldEVuZ2FnZW1lbnRTdGF0dXNSZXF1ZXN0EhAKCHRhYmxlX2lkGAEgASgJEg4KBnJvd19pZBgCIAEoCSKQAQobR2V0RW5nYWdlbWVudFN0YXR1c1Jlc3BvbnNlEg8KB3Zpc2l0ZWQYASABKAgSEgoKd2lzaGxpc3RlZBgCIAEoCBI4Cg9sYXN0X3Zpc2l0ZWRfYXQYAyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wSACIAQFCEgoQX2xhc3RfdmlzaXRlZF9hdCJDCh5CdWxrR2V0RW5nYWdlbWVudFN0YXR1c1JlcXVlc3QSEAoIdGFibGVfaWQYASABKAkSDwoHcm93X2lkcxgCIAMoCSLOAQofQnVsa0dldEVuZ2FnZW1lbnRTdGF0dXNSZXNwb25zZRJOCghzdGF0dXNlcxgBIAMoCzI8LmJsb2NrbmluamEudjEuQnVsa0dldEVuZ2FnZW1lbnRTdGF0dXNSZXNwb25zZS5TdGF0dXNlc0VudHJ5GlsKDVN0YXR1c2VzRW50cnkSCwoDa2V5GAEgASgJEjkKBXZhbHVlGAIgASgLMiouYmxvY2tuaW5qYS52MS5HZXRFbmdhZ2VtZW50U3RhdHVzUmVzcG9uc2U6AjgBMp4GChVVc2VyRW5nYWdlbWVudFNlcnZpY2USVAoLTWFya1Zpc2l0ZWQSIS5ibG9ja25pbmphLnYxLk1hcmtWaXNpdGVkUmVxdWVzdBoiLmJsb2NrbmluamEudjEuTWFya1Zpc2l0ZWRSZXNwb25zZRJUCgtSZW1vdmVWaXNpdBIhLmJsb2NrbmluamEudjEuUmVtb3ZlVmlzaXRSZXF1ZXN0GiIuYmxvY2tuaW5qYS52MS5SZW1vdmVWaXNpdFJlc3BvbnNlElEKCkxpc3RWaXNpdHMSIC5ibG9ja25pbmphLnYxLkxpc3RWaXNpdHNSZXF1ZXN0GiEuYmxvY2tuaW5qYS52MS5MaXN0VmlzaXRzUmVzcG9uc2USWgoNQWRkVG9XaXNobGlzdBIjLmJsb2NrbmluamEudjEuQWRkVG9XaXNobGlzdFJlcXVlc3QaJC5ibG9ja25pbmphLnYxLkFkZFRvV2lzaGxpc3RSZXNwb25zZRJpChJSZW1vdmVGcm9tV2lzaGxpc3QSKC5ibG9ja25pbmphLnYxLlJlbW92ZUZyb21XaXNobGlzdFJlcXVlc3QaKS5ibG9ja25pbmphLnYxLlJlbW92ZUZyb21XaXNobGlzdFJlc3BvbnNlElcKDExpc3RXaXNobGlzdBIiLmJsb2NrbmluamEudjEuTGlzdFdpc2hsaXN0UmVxdWVzdBojLmJsb2NrbmluamEudjEuTGlzdFdpc2hsaXN0UmVzcG9uc2USbAoTR2V0RW5nYWdlbWVudFN0YXR1cxIpLmJsb2NrbmluamEudjEuR2V0RW5nYWdlbWVudFN0YXR1c1JlcXVlc3QaKi5ibG9ja25pbmphLnYxLkdldEVuZ2FnZW1lbnRTdGF0dXNSZXNwb25zZRJ4ChdCdWxrR2V0RW5nYWdlbWVudFN0YXR1cxItLmJsb2NrbmluamEudjEuQnVsa0dldEVuZ2FnZW1lbnRTdGF0dXNSZXF1ZXN0Gi4uYmxvY2tuaW5qYS52MS5CdWxrR2V0RW5nYWdlbWVudFN0YXR1c1Jlc3BvbnNlQskBChFjb20uYmxvY2tuaW5qYS52MUITVXNlckVuZ2FnZW1lbnRQcm90b1ABWkpnaXQuZGV2LmFsZXhkdW5tb3cuY29tL2Jsb2NrL25pbmphL2ludGVybmFsL2FwaS9ibG9ja25pbmphL3YxO2Jsb2NrbmluamF2MaICA0JYWKoCDUJsb2NrbmluamEuVjHKAg1CbG9ja25pbmphXFYx4gIZQmxvY2tuaW5qYVxWMVxHUEJNZXRhZGF0YeoCDkJsb2NrbmluamE6OlYxYgZwcm90bzM",
	[file_blockninja_v1_common, file_google_protobuf_timestamp],
);
/**
 * UserEngagementService manages visit tracking and wishlists for community users
 *
 * @generated from service blockninja.v1.UserEngagementService
 */
const UserEngagementService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_user_engagement, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/user_engagement.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.UserEngagementService.MarkVisited
 */
UserEngagementService.method.markVisited;
/**
 * @generated from rpc blockninja.v1.UserEngagementService.RemoveVisit
 */
UserEngagementService.method.removeVisit;
/**
 * @generated from rpc blockninja.v1.UserEngagementService.ListVisits
 */
UserEngagementService.method.listVisits;
/**
 * @generated from rpc blockninja.v1.UserEngagementService.AddToWishlist
 */
UserEngagementService.method.addToWishlist;
/**
 * @generated from rpc blockninja.v1.UserEngagementService.RemoveFromWishlist
 */
UserEngagementService.method.removeFromWishlist;
/**
 * @generated from rpc blockninja.v1.UserEngagementService.ListWishlist
 */
UserEngagementService.method.listWishlist;
/**
 * @generated from rpc blockninja.v1.UserEngagementService.GetEngagementStatus
 */
UserEngagementService.method.getEngagementStatus;
/**
 * @generated from rpc blockninja.v1.UserEngagementService.BulkGetEngagementStatus
 */
UserEngagementService.method.bulkGetEngagementStatus;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/video.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/video.proto.
 */
const file_blockninja_v1_video = /*@__PURE__*/ fileDesc(
	"ChlibG9ja25pbmphL3YxL3ZpZGVvLnByb3RvEg1ibG9ja25pbmphLnYxItYBCglWaWRlb0l0ZW0SCgoCaWQYASABKAkSFQoNcHJvdmlkZXJfdHlwZRgCIAEoCRITCgtleHRlcm5hbF9pZBgDIAEoCRIRCgllbWJlZF91cmwYBCABKAkSDQoFdGl0bGUYBSABKAkSGAoQZHVyYXRpb25fc2Vjb25kcxgGIAEoBRIVCg10aHVtYm5haWxfdXJsGAcgASgJEg4KBnN0YXR1cxgIIAEoCRIuCgpjcmVhdGVkX2F0GAkgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcCKjAQoRVmlkZW9Qcm9ncmVzc0l0ZW0SEAoIdmlkZW9faWQYASABKAkSFwoPd2F0Y2hlZF9zZWNvbmRzGAIgASgFEhsKE21heF93YXRjaGVkX3NlY29uZHMYAyABKAUSEQoJY29tcGxldGVkGAQgASgIEjMKD2xhc3Rfd2F0Y2hlZF9hdBgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXAiQgoRTGlzdFZpZGVvc1JlcXVlc3QSLQoKcGFnaW5hdGlvbhgBIAEoCzIZLmJsb2NrbmluamEudjEuUGFnaW5hdGlvbiJTChJMaXN0VmlkZW9zUmVzcG9uc2USKAoGdmlkZW9zGAEgAygLMhguYmxvY2tuaW5qYS52MS5WaWRlb0l0ZW0SEwoLdG90YWxfY291bnQYAiABKAMiHQoPR2V0VmlkZW9SZXF1ZXN0EgoKAmlkGAEgASgJIjsKEEdldFZpZGVvUmVzcG9uc2USJwoFdmlkZW8YASABKAsyGC5ibG9ja25pbmphLnYxLlZpZGVvSXRlbSImChdDcmVhdGVFbWJlZFZpZGVvUmVxdWVzdBILCgN1cmwYASABKAkiQwoYQ3JlYXRlRW1iZWRWaWRlb1Jlc3BvbnNlEicKBXZpZGVvGAEgASgLMhguYmxvY2tuaW5qYS52MS5WaWRlb0l0ZW0iIAoSRGVsZXRlVmlkZW9SZXF1ZXN0EgoKAmlkGAEgASgJIhUKE0RlbGV0ZVZpZGVvUmVzcG9uc2UiQgoVVXBkYXRlUHJvZ3Jlc3NSZXF1ZXN0EhAKCHZpZGVvX2lkGAEgASgJEhcKD2N1cnJlbnRfc2Vjb25kcxgCIAEoBSJMChZVcGRhdGVQcm9ncmVzc1Jlc3BvbnNlEjIKCHByb2dyZXNzGAEgASgLMiAuYmxvY2tuaW5qYS52MS5WaWRlb1Byb2dyZXNzSXRlbSImChJHZXRQcm9ncmVzc1JlcXVlc3QSEAoIdmlkZW9faWQYASABKAkiWwoTR2V0UHJvZ3Jlc3NSZXNwb25zZRI3Cghwcm9ncmVzcxgBIAEoCzIgLmJsb2NrbmluamEudjEuVmlkZW9Qcm9ncmVzc0l0ZW1IAIgBAUILCglfcHJvZ3Jlc3MiFwoVTGlzdE15UHJvZ3Jlc3NSZXF1ZXN0IkwKFkxpc3RNeVByb2dyZXNzUmVzcG9uc2USMgoIcHJvZ3Jlc3MYASADKAsyIC5ibG9ja25pbmphLnYxLlZpZGVvUHJvZ3Jlc3NJdGVtMv0ECgxWaWRlb1NlcnZpY2USUQoKTGlzdFZpZGVvcxIgLmJsb2NrbmluamEudjEuTGlzdFZpZGVvc1JlcXVlc3QaIS5ibG9ja25pbmphLnYxLkxpc3RWaWRlb3NSZXNwb25zZRJLCghHZXRWaWRlbxIeLmJsb2NrbmluamEudjEuR2V0VmlkZW9SZXF1ZXN0Gh8uYmxvY2tuaW5qYS52MS5HZXRWaWRlb1Jlc3BvbnNlEmMKEENyZWF0ZUVtYmVkVmlkZW8SJi5ibG9ja25pbmphLnYxLkNyZWF0ZUVtYmVkVmlkZW9SZXF1ZXN0GicuYmxvY2tuaW5qYS52MS5DcmVhdGVFbWJlZFZpZGVvUmVzcG9uc2USVAoLRGVsZXRlVmlkZW8SIS5ibG9ja25pbmphLnYxLkRlbGV0ZVZpZGVvUmVxdWVzdBoiLmJsb2NrbmluamEudjEuRGVsZXRlVmlkZW9SZXNwb25zZRJdCg5VcGRhdGVQcm9ncmVzcxIkLmJsb2NrbmluamEudjEuVXBkYXRlUHJvZ3Jlc3NSZXF1ZXN0GiUuYmxvY2tuaW5qYS52MS5VcGRhdGVQcm9ncmVzc1Jlc3BvbnNlElQKC0dldFByb2dyZXNzEiEuYmxvY2tuaW5qYS52MS5HZXRQcm9ncmVzc1JlcXVlc3QaIi5ibG9ja25pbmphLnYxLkdldFByb2dyZXNzUmVzcG9uc2USXQoOTGlzdE15UHJvZ3Jlc3MSJC5ibG9ja25pbmphLnYxLkxpc3RNeVByb2dyZXNzUmVxdWVzdBolLmJsb2NrbmluamEudjEuTGlzdE15UHJvZ3Jlc3NSZXNwb25zZULAAQoRY29tLmJsb2NrbmluamEudjFCClZpZGVvUHJvdG9QAVpKZ2l0LmRldi5hbGV4ZHVubW93LmNvbS9ibG9jay9uaW5qYS9pbnRlcm5hbC9hcGkvYmxvY2tuaW5qYS92MTtibG9ja25pbmphdjGiAgNCWFiqAg1CbG9ja25pbmphLlYxygINQmxvY2tuaW5qYVxWMeICGUJsb2NrbmluamFcVjFcR1BCTWV0YWRhdGHqAg5CbG9ja25pbmphOjpWMWIGcHJvdG8z",
	[file_google_protobuf_timestamp, file_blockninja_v1_common],
);
/**
 * @generated from service blockninja.v1.VideoService
 */
const VideoService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_video, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/video.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from rpc blockninja.v1.VideoService.ListVideos
 */
VideoService.method.listVideos;
/**
 * @generated from rpc blockninja.v1.VideoService.GetVideo
 */
VideoService.method.getVideo;
/**
 * @generated from rpc blockninja.v1.VideoService.CreateEmbedVideo
 */
VideoService.method.createEmbedVideo;
/**
 * @generated from rpc blockninja.v1.VideoService.DeleteVideo
 */
VideoService.method.deleteVideo;
/**
 * @generated from rpc blockninja.v1.VideoService.UpdateProgress
 */
VideoService.method.updateProgress;
/**
 * @generated from rpc blockninja.v1.VideoService.GetProgress
 */
VideoService.method.getProgress;
/**
 * @generated from rpc blockninja.v1.VideoService.ListMyProgress
 */
VideoService.method.listMyProgress;

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/workflows.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Describes the file blockninja/v1/workflows.proto.
 */
const file_blockninja_v1_workflows = /*@__PURE__*/ fileDesc(
	" ",
	[file_google_protobuf_struct, file_google_protobuf_timestamp],
);
/**
 * @generated from enum blockninja.v1.WorkflowTriggerType
 */
var WorkflowTriggerType;
(function (WorkflowTriggerType) {
	/**
	 * @generated from enum value: WORKFLOW_TRIGGER_UNSPECIFIED = 0;
	 */
	WorkflowTriggerType[(WorkflowTriggerType["WORKFLOW_TRIGGER_UNSPECIFIED"] = 0)] = "WORKFLOW_TRIGGER_UNSPECIFIED";
	/**
	 * @generated from enum value: WORKFLOW_TRIGGER_ROW_INSERTED = 1;
	 */
	WorkflowTriggerType[(WorkflowTriggerType["WORKFLOW_TRIGGER_ROW_INSERTED"] = 1)] = "WORKFLOW_TRIGGER_ROW_INSERTED";
	/**
	 * @generated from enum value: WORKFLOW_TRIGGER_ROW_UPDATED = 2;
	 */
	WorkflowTriggerType[(WorkflowTriggerType["WORKFLOW_TRIGGER_ROW_UPDATED"] = 2)] = "WORKFLOW_TRIGGER_ROW_UPDATED";
	/**
	 * @generated from enum value: WORKFLOW_TRIGGER_ROW_DELETED = 3;
	 */
	WorkflowTriggerType[(WorkflowTriggerType["WORKFLOW_TRIGGER_ROW_DELETED"] = 3)] = "WORKFLOW_TRIGGER_ROW_DELETED";
	/**
	 * @generated from enum value: WORKFLOW_TRIGGER_FIELD_CHANGED = 4;
	 */
	WorkflowTriggerType[(WorkflowTriggerType["WORKFLOW_TRIGGER_FIELD_CHANGED"] = 4)] = "WORKFLOW_TRIGGER_FIELD_CHANGED";
	/**
	 * @generated from enum value: WORKFLOW_TRIGGER_SCHEDULED = 5;
	 */
	WorkflowTriggerType[(WorkflowTriggerType["WORKFLOW_TRIGGER_SCHEDULED"] = 5)] = "WORKFLOW_TRIGGER_SCHEDULED";
})(WorkflowTriggerType || (WorkflowTriggerType = {}));
/**
 * @generated from enum blockninja.v1.WorkflowStepType
 */
var WorkflowStepType;
(function (WorkflowStepType) {
	/**
	 * @generated from enum value: WORKFLOW_STEP_UNSPECIFIED = 0;
	 */
	WorkflowStepType[(WorkflowStepType["WORKFLOW_STEP_UNSPECIFIED"] = 0)] = "WORKFLOW_STEP_UNSPECIFIED";
	/**
	 * @generated from enum value: WORKFLOW_STEP_SEND_COMMUNICATION = 1;
	 */
	WorkflowStepType[(WorkflowStepType["WORKFLOW_STEP_SEND_COMMUNICATION"] = 1)] = "WORKFLOW_STEP_SEND_COMMUNICATION";
	/**
	 * @generated from enum value: WORKFLOW_STEP_UPDATE_ROW = 2;
	 */
	WorkflowStepType[(WorkflowStepType["WORKFLOW_STEP_UPDATE_ROW"] = 2)] = "WORKFLOW_STEP_UPDATE_ROW";
	/**
	 * @generated from enum value: WORKFLOW_STEP_CREATE_VERIFICATION = 3;
	 */
	WorkflowStepType[(WorkflowStepType["WORKFLOW_STEP_CREATE_VERIFICATION"] = 3)] = "WORKFLOW_STEP_CREATE_VERIFICATION";
	/**
	 * @generated from enum value: WORKFLOW_STEP_WAIT_TIME = 4;
	 */
	WorkflowStepType[(WorkflowStepType["WORKFLOW_STEP_WAIT_TIME"] = 4)] = "WORKFLOW_STEP_WAIT_TIME";
	/**
	 * @generated from enum value: WORKFLOW_STEP_WAIT_VERIFICATION = 5;
	 */
	WorkflowStepType[(WorkflowStepType["WORKFLOW_STEP_WAIT_VERIFICATION"] = 5)] = "WORKFLOW_STEP_WAIT_VERIFICATION";
	/**
	 * @generated from enum value: WORKFLOW_STEP_TRIGGER_WEBHOOK = 6;
	 */
	WorkflowStepType[(WorkflowStepType["WORKFLOW_STEP_TRIGGER_WEBHOOK"] = 6)] = "WORKFLOW_STEP_TRIGGER_WEBHOOK";
	/**
	 * @generated from enum value: WORKFLOW_STEP_BRANCH = 7;
	 */
	WorkflowStepType[(WorkflowStepType["WORKFLOW_STEP_BRANCH"] = 7)] = "WORKFLOW_STEP_BRANCH";
	/**
	 * @generated from enum value: WORKFLOW_STEP_CREATE_PREFILL_TOKEN = 8;
	 */
	WorkflowStepType[(WorkflowStepType["WORKFLOW_STEP_CREATE_PREFILL_TOKEN"] = 8)] = "WORKFLOW_STEP_CREATE_PREFILL_TOKEN";
})(WorkflowStepType || (WorkflowStepType = {}));
/**
 * @generated from enum blockninja.v1.WorkflowExecutionStatus
 */
var WorkflowExecutionStatus;
(function (WorkflowExecutionStatus) {
	/**
	 * @generated from enum value: WORKFLOW_EXECUTION_STATUS_UNSPECIFIED = 0;
	 */
	WorkflowExecutionStatus[(WorkflowExecutionStatus["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: WORKFLOW_EXECUTION_STATUS_PENDING = 1;
	 */
	WorkflowExecutionStatus[(WorkflowExecutionStatus["PENDING"] = 1)] = "PENDING";
	/**
	 * @generated from enum value: WORKFLOW_EXECUTION_STATUS_RUNNING = 2;
	 */
	WorkflowExecutionStatus[(WorkflowExecutionStatus["RUNNING"] = 2)] = "RUNNING";
	/**
	 * @generated from enum value: WORKFLOW_EXECUTION_STATUS_WAITING = 3;
	 */
	WorkflowExecutionStatus[(WorkflowExecutionStatus["WAITING"] = 3)] = "WAITING";
	/**
	 * @generated from enum value: WORKFLOW_EXECUTION_STATUS_COMPLETED = 4;
	 */
	WorkflowExecutionStatus[(WorkflowExecutionStatus["COMPLETED"] = 4)] = "COMPLETED";
	/**
	 * @generated from enum value: WORKFLOW_EXECUTION_STATUS_FAILED = 5;
	 */
	WorkflowExecutionStatus[(WorkflowExecutionStatus["FAILED"] = 5)] = "FAILED";
	/**
	 * @generated from enum value: WORKFLOW_EXECUTION_STATUS_CANCELLED = 6;
	 */
	WorkflowExecutionStatus[(WorkflowExecutionStatus["CANCELLED"] = 6)] = "CANCELLED";
})(WorkflowExecutionStatus || (WorkflowExecutionStatus = {}));
/**
 * @generated from enum blockninja.v1.VerificationTokenType
 */
var VerificationTokenType;
(function (VerificationTokenType) {
	/**
	 * @generated from enum value: VERIFICATION_TOKEN_TYPE_UNSPECIFIED = 0;
	 */
	VerificationTokenType[(VerificationTokenType["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: VERIFICATION_TOKEN_TYPE_MAGIC_LINK = 1;
	 */
	VerificationTokenType[(VerificationTokenType["MAGIC_LINK"] = 1)] = "MAGIC_LINK";
	/**
	 * @generated from enum value: VERIFICATION_TOKEN_TYPE_CODE_ENTRY = 2;
	 */
	VerificationTokenType[(VerificationTokenType["CODE_ENTRY"] = 2)] = "CODE_ENTRY";
})(VerificationTokenType || (VerificationTokenType = {}));
/**
 * WorkflowsService manages data table automation workflows
 *
 * @generated from service blockninja.v1.WorkflowsService
 */
const WorkflowsService = /*@__PURE__*/ serviceDesc(file_blockninja_v1_workflows, 0);

// @generated by protoc-gen-connect-query v2.2.0 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/workflows.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * Workflow CRUD
 *
 * @generated from rpc blockninja.v1.WorkflowsService.ListWorkflows
 */
WorkflowsService.method.listWorkflows;
/**
 * @generated from rpc blockninja.v1.WorkflowsService.GetWorkflow
 */
WorkflowsService.method.getWorkflow;
/**
 * @generated from rpc blockninja.v1.WorkflowsService.CreateWorkflow
 */
WorkflowsService.method.createWorkflow;
/**
 * @generated from rpc blockninja.v1.WorkflowsService.UpdateWorkflow
 */
WorkflowsService.method.updateWorkflow;
/**
 * @generated from rpc blockninja.v1.WorkflowsService.DeleteWorkflow
 */
WorkflowsService.method.deleteWorkflow;
/**
 * Step management
 *
 * @generated from rpc blockninja.v1.WorkflowsService.ListWorkflowSteps
 */
WorkflowsService.method.listWorkflowSteps;
/**
 * @generated from rpc blockninja.v1.WorkflowsService.CreateWorkflowStep
 */
WorkflowsService.method.createWorkflowStep;
/**
 * @generated from rpc blockninja.v1.WorkflowsService.UpdateWorkflowStep
 */
WorkflowsService.method.updateWorkflowStep;
/**
 * @generated from rpc blockninja.v1.WorkflowsService.DeleteWorkflowStep
 */
WorkflowsService.method.deleteWorkflowStep;
/**
 * @generated from rpc blockninja.v1.WorkflowsService.ReorderWorkflowSteps
 */
WorkflowsService.method.reorderWorkflowSteps;
/**
 * Execution management
 *
 * @generated from rpc blockninja.v1.WorkflowsService.ListWorkflowExecutions
 */
WorkflowsService.method.listWorkflowExecutions;
/**
 * @generated from rpc blockninja.v1.WorkflowsService.GetWorkflowExecution
 */
WorkflowsService.method.getWorkflowExecution;
/**
 * @generated from rpc blockninja.v1.WorkflowsService.CancelWorkflowExecution
 */
WorkflowsService.method.cancelWorkflowExecution;
/**
 * @generated from rpc blockninja.v1.WorkflowsService.RetryWorkflowExecution
 */
WorkflowsService.method.retryWorkflowExecution;
/**
 * Manual trigger
 *
 * @generated from rpc blockninja.v1.WorkflowsService.TriggerWorkflowManually
 */
WorkflowsService.method.triggerWorkflowManually;
/**
 * Testing
 *
 * @generated from rpc blockninja.v1.WorkflowsService.TestWorkflow
 */
WorkflowsService.method.testWorkflow;

const { useMemo: useMemo$1, useLayoutEffect, useEffect: useEffect$1, useRef: useRef$2, useCallback: useCallback$2 } = await importShared("react");

// https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js
const canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";

function isWindow(element) {
	const elementString = Object.prototype.toString.call(element);
	return (
		elementString === "[object Window]" || // In Electron context the Window object serializes to [object global]
		elementString === "[object global]"
	);
}

function isNode$1(node) {
	return "nodeType" in node;
}

function getWindow(target) {
	var _target$ownerDocument, _target$ownerDocument2;

	if (!target) {
		return window;
	}

	if (isWindow(target)) {
		return target;
	}

	if (!isNode$1(target)) {
		return window;
	}

	return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window;
}

function isDocument(node) {
	const { Document } = getWindow(node);
	return node instanceof Document;
}

function isHTMLElement(node) {
	if (isWindow(node)) {
		return false;
	}

	return node instanceof getWindow(node).HTMLElement;
}

function isSVGElement(node) {
	return node instanceof getWindow(node).SVGElement;
}

function getOwnerDocument(target) {
	if (!target) {
		return document;
	}

	if (isWindow(target)) {
		return target.document;
	}

	if (!isNode$1(target)) {
		return document;
	}

	if (isDocument(target)) {
		return target;
	}

	if (isHTMLElement(target) || isSVGElement(target)) {
		return target.ownerDocument;
	}

	return document;
}

/**
 * A hook that resolves to useEffect on the server and useLayoutEffect on the client
 * @param callback {function} Callback function that is invoked when the dependencies of the hook change
 */

const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect$1;

function useEvent(handler) {
	const handlerRef = useRef$2(handler);
	useIsomorphicLayoutEffect(() => {
		handlerRef.current = handler;
	});
	return useCallback$2(function () {
		for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
			args[_key] = arguments[_key];
		}

		return handlerRef.current == null ? void 0 : handlerRef.current(...args);
	}, []);
}

function useInterval() {
	const intervalRef = useRef$2(null);
	const set = useCallback$2((listener, duration) => {
		intervalRef.current = setInterval(listener, duration);
	}, []);
	const clear = useCallback$2(() => {
		if (intervalRef.current !== null) {
			clearInterval(intervalRef.current);
			intervalRef.current = null;
		}
	}, []);
	return [set, clear];
}

function useLatestValue(value, dependencies) {
	if (dependencies === void 0) {
		dependencies = [value];
	}

	const valueRef = useRef$2(value);
	useIsomorphicLayoutEffect(() => {
		if (valueRef.current !== value) {
			valueRef.current = value;
		}
	}, dependencies);
	return valueRef;
}

function useLazyMemo(callback, dependencies) {
	const valueRef = useRef$2();
	return useMemo$1(
		() => {
			const newValue = callback(valueRef.current);
			valueRef.current = newValue;
			return newValue;
		}, // eslint-disable-next-line react-hooks/exhaustive-deps
		[...dependencies],
	);
}

function useNodeRef(onChange) {
	const onChangeHandler = useEvent(onChange);
	const node = useRef$2(null);
	const setNodeRef = useCallback$2(
		(element) => {
			if (element !== node.current) {
				onChangeHandler == null ? void 0 : onChangeHandler(element, node.current);
			}

			node.current = element;
		}, //eslint-disable-next-line
		[],
	);
	return [node, setNodeRef];
}

function usePrevious(value) {
	const ref = useRef$2();
	useEffect$1(() => {
		ref.current = value;
	}, [value]);
	return ref.current;
}

let ids = {};
function useUniqueId(prefix, value) {
	return useMemo$1(() => {
		if (value) {
			return value;
		}

		const id = ids[prefix] == null ? 0 : ids[prefix] + 1;
		ids[prefix] = id;
		return prefix + "-" + id;
	}, [prefix, value]);
}

function createAdjustmentFn(modifier) {
	return function (object) {
		for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
			adjustments[_key - 1] = arguments[_key];
		}

		return adjustments.reduce(
			(accumulator, adjustment) => {
				const entries = Object.entries(adjustment);

				for (const [key, valueAdjustment] of entries) {
					const value = accumulator[key];

					if (value != null) {
						accumulator[key] = value + modifier * valueAdjustment;
					}
				}

				return accumulator;
			},
			{ ...object },
		);
	};
}

const add = /*#__PURE__*/ createAdjustmentFn(1);
const subtract = /*#__PURE__*/ createAdjustmentFn(-1);

function hasViewportRelativeCoordinates(event) {
	return "clientX" in event && "clientY" in event;
}

function isKeyboardEvent(event) {
	if (!event) {
		return false;
	}

	const { KeyboardEvent } = getWindow(event.target);
	return KeyboardEvent && event instanceof KeyboardEvent;
}

function isTouchEvent(event) {
	if (!event) {
		return false;
	}

	const { TouchEvent } = getWindow(event.target);
	return TouchEvent && event instanceof TouchEvent;
}

/**
 * Returns the normalized x and y coordinates for mouse and touch events.
 */

function getEventCoordinates(event) {
	if (isTouchEvent(event)) {
		if (event.touches && event.touches.length) {
			const { clientX: x, clientY: y } = event.touches[0];
			return {
				x,
				y,
			};
		} else if (event.changedTouches && event.changedTouches.length) {
			const { clientX: x, clientY: y } = event.changedTouches[0];
			return {
				x,
				y,
			};
		}
	}

	if (hasViewportRelativeCoordinates(event)) {
		return {
			x: event.clientX,
			y: event.clientY,
		};
	}

	return null;
}

const CSS = /*#__PURE__*/ Object.freeze({
	Translate: {
		toString(transform) {
			if (!transform) {
				return;
			}

			const { x, y } = transform;
			return "translate3d(" + (x ? Math.round(x) : 0) + "px, " + (y ? Math.round(y) : 0) + "px, 0)";
		},
	},
	Scale: {
		toString(transform) {
			if (!transform) {
				return;
			}

			const { scaleX, scaleY } = transform;
			return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")";
		},
	},
	Transform: {
		toString(transform) {
			if (!transform) {
				return;
			}

			return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(" ");
		},
	},
	Transition: {
		toString(_ref) {
			let { property, duration, easing } = _ref;
			return property + " " + duration + "ms " + easing;
		},
	},
});

const SELECTOR = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
function findFirstFocusableNode(element) {
	if (element.matches(SELECTOR)) {
		return element;
	}

	return element.querySelector(SELECTOR);
}

const React$3 = await importShared("react");
const { useState: useState$1, useCallback: useCallback$1 } = React$3;

const hiddenStyles = {
	display: "none",
};
function HiddenText(_ref) {
	let { id, value } = _ref;
	return React$3.createElement(
		"div",
		{
			id: id,
			style: hiddenStyles,
		},
		value,
	);
}

function LiveRegion(_ref) {
	let { id, announcement, ariaLiveType = "assertive" } = _ref;
	// Hide element visually but keep it readable by screen readers
	const visuallyHidden = {
		position: "fixed",
		top: 0,
		left: 0,
		width: 1,
		height: 1,
		margin: -1,
		border: 0,
		padding: 0,
		overflow: "hidden",
		clip: "rect(0 0 0 0)",
		clipPath: "inset(100%)",
		whiteSpace: "nowrap",
	};
	return React$3.createElement(
		"div",
		{
			"id": id,
			"style": visuallyHidden,
			"role": "status",
			"aria-live": ariaLiveType,
			"aria-atomic": true,
		},
		announcement,
	);
}

function useAnnouncement() {
	const [announcement, setAnnouncement] = useState$1("");
	const announce = useCallback$1((value) => {
		if (value != null) {
			setAnnouncement(value);
		}
	}, []);
	return {
		announce,
		announcement,
	};
}

const React$2 = await importShared("react");
const { createContext: createContext$1, useContext: useContext$1, useEffect, useState, useCallback, useMemo, useRef: useRef$1, memo: memo$1, useReducer, cloneElement, forwardRef } = React$2;

const { createPortal, unstable_batchedUpdates } = await importShared("react-dom");

const DndMonitorContext = /*#__PURE__*/ createContext$1(null);

function useDndMonitor(listener) {
	const registerListener = useContext$1(DndMonitorContext);
	useEffect(() => {
		if (!registerListener) {
			throw new Error("useDndMonitor must be used within a children of <DndContext>");
		}

		const unsubscribe = registerListener(listener);
		return unsubscribe;
	}, [listener, registerListener]);
}

function useDndMonitorProvider() {
	const [listeners] = useState(() => new Set());
	const registerListener = useCallback(
		(listener) => {
			listeners.add(listener);
			return () => listeners.delete(listener);
		},
		[listeners],
	);
	const dispatch = useCallback(
		(_ref) => {
			let { type, event } = _ref;
			listeners.forEach((listener) => {
				var _listener$type;

				return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event);
			});
		},
		[listeners],
	);
	return [dispatch, registerListener];
}

const defaultScreenReaderInstructions = {
	draggable:
		"\n    To pick up a draggable item, press the space bar.\n    While dragging, use the arrow keys to move the item.\n    Press space again to drop the item in its new position, or press escape to cancel.\n  ",
};
const defaultAnnouncements = {
	onDragStart(_ref) {
		let { active } = _ref;
		return "Picked up draggable item " + active.id + ".";
	},

	onDragOver(_ref2) {
		let { active, over } = _ref2;

		if (over) {
			return "Draggable item " + active.id + " was moved over droppable area " + over.id + ".";
		}

		return "Draggable item " + active.id + " is no longer over a droppable area.";
	},

	onDragEnd(_ref3) {
		let { active, over } = _ref3;

		if (over) {
			return "Draggable item " + active.id + " was dropped over droppable area " + over.id;
		}

		return "Draggable item " + active.id + " was dropped.";
	},

	onDragCancel(_ref4) {
		let { active } = _ref4;
		return "Dragging was cancelled. Draggable item " + active.id + " was dropped.";
	},
};

function Accessibility(_ref) {
	let { announcements = defaultAnnouncements, container, hiddenTextDescribedById, screenReaderInstructions = defaultScreenReaderInstructions } = _ref;
	const { announce, announcement } = useAnnouncement();
	const liveRegionId = useUniqueId("DndLiveRegion");
	const [mounted, setMounted] = useState(false);
	useEffect(() => {
		setMounted(true);
	}, []);
	useDndMonitor(
		useMemo(
			() => ({
				onDragStart(_ref2) {
					let { active } = _ref2;
					announce(
						announcements.onDragStart({
							active,
						}),
					);
				},

				onDragMove(_ref3) {
					let { active, over } = _ref3;

					if (announcements.onDragMove) {
						announce(
							announcements.onDragMove({
								active,
								over,
							}),
						);
					}
				},

				onDragOver(_ref4) {
					let { active, over } = _ref4;
					announce(
						announcements.onDragOver({
							active,
							over,
						}),
					);
				},

				onDragEnd(_ref5) {
					let { active, over } = _ref5;
					announce(
						announcements.onDragEnd({
							active,
							over,
						}),
					);
				},

				onDragCancel(_ref6) {
					let { active, over } = _ref6;
					announce(
						announcements.onDragCancel({
							active,
							over,
						}),
					);
				},
			}),
			[announce, announcements],
		),
	);

	if (!mounted) {
		return null;
	}

	const markup = React$2.createElement(
		React$2.Fragment,
		null,
		React$2.createElement(HiddenText, {
			id: hiddenTextDescribedById,
			value: screenReaderInstructions.draggable,
		}),
		React$2.createElement(LiveRegion, {
			id: liveRegionId,
			announcement: announcement,
		}),
	);
	return container ? createPortal(markup, container) : markup;
}

var Action;

(function (Action) {
	Action["DragStart"] = "dragStart";
	Action["DragMove"] = "dragMove";
	Action["DragEnd"] = "dragEnd";
	Action["DragCancel"] = "dragCancel";
	Action["DragOver"] = "dragOver";
	Action["RegisterDroppable"] = "registerDroppable";
	Action["SetDroppableDisabled"] = "setDroppableDisabled";
	Action["UnregisterDroppable"] = "unregisterDroppable";
})(Action || (Action = {}));

function noop() {}

function useSensor(sensor, options) {
	return useMemo(
		() => ({
			sensor,
			options: options != null ? options : {},
		}), // eslint-disable-next-line react-hooks/exhaustive-deps
		[sensor, options],
	);
}

function useSensors() {
	for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) {
		sensors[_key] = arguments[_key];
	}

	return useMemo(
		() => [...sensors].filter((sensor) => sensor != null), // eslint-disable-next-line react-hooks/exhaustive-deps
		[...sensors],
	);
}

const defaultCoordinates = /*#__PURE__*/ Object.freeze({
	x: 0,
	y: 0,
});

/**
 * Returns the distance between two points
 */
function distanceBetween(p1, p2) {
	return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
}

function getRelativeTransformOrigin(event, rect) {
	const eventCoordinates = getEventCoordinates(event);

	if (!eventCoordinates) {
		return "0 0";
	}

	const transformOrigin = {
		x: ((eventCoordinates.x - rect.left) / rect.width) * 100,
		y: ((eventCoordinates.y - rect.top) / rect.height) * 100,
	};
	return transformOrigin.x + "% " + transformOrigin.y + "%";
}

/**
 * Sort collisions from smallest to greatest value
 */
function sortCollisionsAsc(_ref, _ref2) {
	let {
		data: { value: a },
	} = _ref;
	let {
		data: { value: b },
	} = _ref2;
	return a - b;
}
/**
 * Sort collisions from greatest to smallest value
 */

function sortCollisionsDesc(_ref3, _ref4) {
	let {
		data: { value: a },
	} = _ref3;
	let {
		data: { value: b },
	} = _ref4;
	return b - a;
}
/**
 * Returns the coordinates of the corners of a given rectangle:
 * [TopLeft {x, y}, TopRight {x, y}, BottomLeft {x, y}, BottomRight {x, y}]
 */

function cornersOfRectangle(_ref5) {
	let { left, top, height, width } = _ref5;
	return [
		{
			x: left,
			y: top,
		},
		{
			x: left + width,
			y: top,
		},
		{
			x: left,
			y: top + height,
		},
		{
			x: left + width,
			y: top + height,
		},
	];
}
function getFirstCollision(collisions, property) {
	if (!collisions || collisions.length === 0) {
		return null;
	}

	const [firstCollision] = collisions;
	return firstCollision[property];
}

/**
 * Returns the intersecting rectangle area between two rectangles
 */

function getIntersectionRatio(entry, target) {
	const top = Math.max(target.top, entry.top);
	const left = Math.max(target.left, entry.left);
	const right = Math.min(target.left + target.width, entry.left + entry.width);
	const bottom = Math.min(target.top + target.height, entry.top + entry.height);
	const width = right - left;
	const height = bottom - top;

	if (left < right && top < bottom) {
		const targetArea = target.width * target.height;
		const entryArea = entry.width * entry.height;
		const intersectionArea = width * height;
		const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea);
		return Number(intersectionRatio.toFixed(4));
	} // Rectangles do not overlap, or overlap has an area of zero (edge/corner overlap)

	return 0;
}
/**
 * Returns the rectangles that has the greatest intersection area with a given
 * rectangle in an array of rectangles.
 */

const rectIntersection = (_ref) => {
	let { collisionRect, droppableRects, droppableContainers } = _ref;
	const collisions = [];

	for (const droppableContainer of droppableContainers) {
		const { id } = droppableContainer;
		const rect = droppableRects.get(id);

		if (rect) {
			const intersectionRatio = getIntersectionRatio(rect, collisionRect);

			if (intersectionRatio > 0) {
				collisions.push({
					id,
					data: {
						droppableContainer,
						value: intersectionRatio,
					},
				});
			}
		}
	}

	return collisions.sort(sortCollisionsDesc);
};

/**
 * Check if a given point is contained within a bounding rectangle
 */

function isPointWithinRect(point, rect) {
	const { top, left, bottom, right } = rect;
	return top <= point.y && point.y <= bottom && left <= point.x && point.x <= right;
}
/**
 * Returns the rectangles that the pointer is hovering over
 */

const pointerWithin = (_ref) => {
	let { droppableContainers, droppableRects, pointerCoordinates } = _ref;

	if (!pointerCoordinates) {
		return [];
	}

	const collisions = [];

	for (const droppableContainer of droppableContainers) {
		const { id } = droppableContainer;
		const rect = droppableRects.get(id);

		if (rect && isPointWithinRect(pointerCoordinates, rect)) {
			/* There may be more than a single rectangle intersecting
			 * with the pointer coordinates. In order to sort the
			 * colliding rectangles, we measure the distance between
			 * the pointer and the corners of the intersecting rectangle
			 */
			const corners = cornersOfRectangle(rect);
			const distances = corners.reduce((accumulator, corner) => {
				return accumulator + distanceBetween(pointerCoordinates, corner);
			}, 0);
			const effectiveDistance = Number((distances / 4).toFixed(4));
			collisions.push({
				id,
				data: {
					droppableContainer,
					value: effectiveDistance,
				},
			});
		}
	}

	return collisions.sort(sortCollisionsAsc);
};

function adjustScale(transform, rect1, rect2) {
	return { ...transform, scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1, scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1 };
}

function getRectDelta(rect1, rect2) {
	return rect1 && rect2 ?
			{
				x: rect1.left - rect2.left,
				y: rect1.top - rect2.top,
			}
		:	defaultCoordinates;
}

function createRectAdjustmentFn(modifier) {
	return function adjustClientRect(rect) {
		for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
			adjustments[_key - 1] = arguments[_key];
		}

		return adjustments.reduce(
			(acc, adjustment) => ({
				...acc,
				top: acc.top + modifier * adjustment.y,
				bottom: acc.bottom + modifier * adjustment.y,
				left: acc.left + modifier * adjustment.x,
				right: acc.right + modifier * adjustment.x,
			}),
			{ ...rect },
		);
	};
}
const getAdjustedRect = /*#__PURE__*/ createRectAdjustmentFn(1);

function parseTransform(transform) {
	if (transform.startsWith("matrix3d(")) {
		const transformArray = transform.slice(9, -1).split(/, /);
		return {
			x: +transformArray[12],
			y: +transformArray[13],
			scaleX: +transformArray[0],
			scaleY: +transformArray[5],
		};
	} else if (transform.startsWith("matrix(")) {
		const transformArray = transform.slice(7, -1).split(/, /);
		return {
			x: +transformArray[4],
			y: +transformArray[5],
			scaleX: +transformArray[0],
			scaleY: +transformArray[3],
		};
	}

	return null;
}

function inverseTransform(rect, transform, transformOrigin) {
	const parsedTransform = parseTransform(transform);

	if (!parsedTransform) {
		return rect;
	}

	const { scaleX, scaleY, x: translateX, y: translateY } = parsedTransform;
	const x = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);
	const y = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(" ") + 1));
	const w = scaleX ? rect.width / scaleX : rect.width;
	const h = scaleY ? rect.height / scaleY : rect.height;
	return {
		width: w,
		height: h,
		top: y,
		right: x + w,
		bottom: y + h,
		left: x,
	};
}

const defaultOptions$1 = {
	ignoreTransform: false,
};
/**
 * Returns the bounding client rect of an element relative to the viewport.
 */

function getClientRect(element, options) {
	if (options === void 0) {
		options = defaultOptions$1;
	}

	let rect = element.getBoundingClientRect();

	if (options.ignoreTransform) {
		const { transform, transformOrigin } = getWindow(element).getComputedStyle(element);

		if (transform) {
			rect = inverseTransform(rect, transform, transformOrigin);
		}
	}

	const { top, left, width, height, bottom, right } = rect;
	return {
		top,
		left,
		width,
		height,
		bottom,
		right,
	};
}
/**
 * Returns the bounding client rect of an element relative to the viewport.
 *
 * @remarks
 * The ClientRect returned by this method does not take into account transforms
 * applied to the element it measures.
 *
 */

function getTransformAgnosticClientRect(element) {
	return getClientRect(element, {
		ignoreTransform: true,
	});
}

function getWindowClientRect(element) {
	const width = element.innerWidth;
	const height = element.innerHeight;
	return {
		top: 0,
		left: 0,
		right: width,
		bottom: height,
		width,
		height,
	};
}

function isFixed(node, computedStyle) {
	if (computedStyle === void 0) {
		computedStyle = getWindow(node).getComputedStyle(node);
	}

	return computedStyle.position === "fixed";
}

function isScrollable(element, computedStyle) {
	if (computedStyle === void 0) {
		computedStyle = getWindow(element).getComputedStyle(element);
	}

	const overflowRegex = /(auto|scroll|overlay)/;
	const properties = ["overflow", "overflowX", "overflowY"];
	return properties.some((property) => {
		const value = computedStyle[property];
		return typeof value === "string" ? overflowRegex.test(value) : false;
	});
}

function getScrollableAncestors(element, limit) {
	const scrollParents = [];

	function findScrollableAncestors(node) {
		if (limit != null && scrollParents.length >= limit) {
			return scrollParents;
		}

		if (!node) {
			return scrollParents;
		}

		if (isDocument(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) {
			scrollParents.push(node.scrollingElement);
			return scrollParents;
		}

		if (!isHTMLElement(node) || isSVGElement(node)) {
			return scrollParents;
		}

		if (scrollParents.includes(node)) {
			return scrollParents;
		}

		const computedStyle = getWindow(element).getComputedStyle(node);

		if (node !== element) {
			if (isScrollable(node, computedStyle)) {
				scrollParents.push(node);
			}
		}

		if (isFixed(node, computedStyle)) {
			return scrollParents;
		}

		return findScrollableAncestors(node.parentNode);
	}

	if (!element) {
		return scrollParents;
	}

	return findScrollableAncestors(element);
}
function getFirstScrollableAncestor(node) {
	const [firstScrollableAncestor] = getScrollableAncestors(node, 1);
	return firstScrollableAncestor != null ? firstScrollableAncestor : null;
}

function getScrollableElement(element) {
	if (!canUseDOM || !element) {
		return null;
	}

	if (isWindow(element)) {
		return element;
	}

	if (!isNode$1(element)) {
		return null;
	}

	if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) {
		return window;
	}

	if (isHTMLElement(element)) {
		return element;
	}

	return null;
}

function getScrollXCoordinate(element) {
	if (isWindow(element)) {
		return element.scrollX;
	}

	return element.scrollLeft;
}
function getScrollYCoordinate(element) {
	if (isWindow(element)) {
		return element.scrollY;
	}

	return element.scrollTop;
}
function getScrollCoordinates(element) {
	return {
		x: getScrollXCoordinate(element),
		y: getScrollYCoordinate(element),
	};
}

var Direction;

(function (Direction) {
	Direction[(Direction["Forward"] = 1)] = "Forward";
	Direction[(Direction["Backward"] = -1)] = "Backward";
})(Direction || (Direction = {}));

function isDocumentScrollingElement(element) {
	if (!canUseDOM || !element) {
		return false;
	}

	return element === document.scrollingElement;
}

function getScrollPosition(scrollingContainer) {
	const minScroll = {
		x: 0,
		y: 0,
	};
	const dimensions =
		isDocumentScrollingElement(scrollingContainer) ?
			{
				height: window.innerHeight,
				width: window.innerWidth,
			}
		:	{
				height: scrollingContainer.clientHeight,
				width: scrollingContainer.clientWidth,
			};
	const maxScroll = {
		x: scrollingContainer.scrollWidth - dimensions.width,
		y: scrollingContainer.scrollHeight - dimensions.height,
	};
	const isTop = scrollingContainer.scrollTop <= minScroll.y;
	const isLeft = scrollingContainer.scrollLeft <= minScroll.x;
	const isBottom = scrollingContainer.scrollTop >= maxScroll.y;
	const isRight = scrollingContainer.scrollLeft >= maxScroll.x;
	return {
		isTop,
		isLeft,
		isBottom,
		isRight,
		maxScroll,
		minScroll,
	};
}

const defaultThreshold = {
	x: 0.2,
	y: 0.2,
};
function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) {
	let { top, left, right, bottom } = _ref;

	if (acceleration === void 0) {
		acceleration = 10;
	}

	if (thresholdPercentage === void 0) {
		thresholdPercentage = defaultThreshold;
	}

	const { isTop, isBottom, isLeft, isRight } = getScrollPosition(scrollContainer);
	const direction = {
		x: 0,
		y: 0,
	};
	const speed = {
		x: 0,
		y: 0,
	};
	const threshold = {
		height: scrollContainerRect.height * thresholdPercentage.y,
		width: scrollContainerRect.width * thresholdPercentage.x,
	};

	if (!isTop && top <= scrollContainerRect.top + threshold.height) {
		// Scroll Up
		direction.y = Direction.Backward;
		speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top) / threshold.height);
	} else if (!isBottom && bottom >= scrollContainerRect.bottom - threshold.height) {
		// Scroll Down
		direction.y = Direction.Forward;
		speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom) / threshold.height);
	}

	if (!isRight && right >= scrollContainerRect.right - threshold.width) {
		// Scroll Right
		direction.x = Direction.Forward;
		speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width);
	} else if (!isLeft && left <= scrollContainerRect.left + threshold.width) {
		// Scroll Left
		direction.x = Direction.Backward;
		speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left) / threshold.width);
	}

	return {
		direction,
		speed,
	};
}

function getScrollElementRect(element) {
	if (element === document.scrollingElement) {
		const { innerWidth, innerHeight } = window;
		return {
			top: 0,
			left: 0,
			right: innerWidth,
			bottom: innerHeight,
			width: innerWidth,
			height: innerHeight,
		};
	}

	const { top, left, right, bottom } = element.getBoundingClientRect();
	return {
		top,
		left,
		right,
		bottom,
		width: element.clientWidth,
		height: element.clientHeight,
	};
}

function getScrollOffsets(scrollableAncestors) {
	return scrollableAncestors.reduce((acc, node) => {
		return add(acc, getScrollCoordinates(node));
	}, defaultCoordinates);
}
function getScrollXOffset(scrollableAncestors) {
	return scrollableAncestors.reduce((acc, node) => {
		return acc + getScrollXCoordinate(node);
	}, 0);
}
function getScrollYOffset(scrollableAncestors) {
	return scrollableAncestors.reduce((acc, node) => {
		return acc + getScrollYCoordinate(node);
	}, 0);
}

function scrollIntoViewIfNeeded(element, measure) {
	if (measure === void 0) {
		measure = getClientRect;
	}

	if (!element) {
		return;
	}

	const { top, left, bottom, right } = measure(element);
	const firstScrollableAncestor = getFirstScrollableAncestor(element);

	if (!firstScrollableAncestor) {
		return;
	}

	if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) {
		element.scrollIntoView({
			block: "center",
			inline: "center",
		});
	}
}

const properties = [
	["x", ["left", "right"], getScrollXOffset],
	["y", ["top", "bottom"], getScrollYOffset],
];
class Rect {
	constructor(rect, element) {
		this.rect = void 0;
		this.width = void 0;
		this.height = void 0;
		this.top = void 0;
		this.bottom = void 0;
		this.right = void 0;
		this.left = void 0;
		const scrollableAncestors = getScrollableAncestors(element);
		const scrollOffsets = getScrollOffsets(scrollableAncestors);
		this.rect = { ...rect };
		this.width = rect.width;
		this.height = rect.height;

		for (const [axis, keys, getScrollOffset] of properties) {
			for (const key of keys) {
				Object.defineProperty(this, key, {
					get: () => {
						const currentOffsets = getScrollOffset(scrollableAncestors);
						const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets;
						return this.rect[key] + scrollOffsetsDeltla;
					},
					enumerable: true,
				});
			}
		}

		Object.defineProperty(this, "rect", {
			enumerable: false,
		});
	}
}

class Listeners {
	constructor(target) {
		this.target = void 0;
		this.listeners = [];

		this.removeAll = () => {
			this.listeners.forEach((listener) => {
				var _this$target;

				return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener);
			});
		};

		this.target = target;
	}

	add(eventName, handler, options) {
		var _this$target2;

		(_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options);
		this.listeners.push([eventName, handler, options]);
	}
}

function getEventListenerTarget(target) {
	// If the `event.target` element is removed from the document events will still be targeted
	// at it, and hence won't always bubble up to the window or document anymore.
	// If there is any risk of an element being removed while it is being dragged,
	// the best practice is to attach the event listeners directly to the target.
	// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
	const { EventTarget } = getWindow(target);
	return target instanceof EventTarget ? target : getOwnerDocument(target);
}

function hasExceededDistance(delta, measurement) {
	const dx = Math.abs(delta.x);
	const dy = Math.abs(delta.y);

	if (typeof measurement === "number") {
		return Math.sqrt(dx ** 2 + dy ** 2) > measurement;
	}

	if ("x" in measurement && "y" in measurement) {
		return dx > measurement.x && dy > measurement.y;
	}

	if ("x" in measurement) {
		return dx > measurement.x;
	}

	if ("y" in measurement) {
		return dy > measurement.y;
	}

	return false;
}

var EventName;

(function (EventName) {
	EventName["Click"] = "click";
	EventName["DragStart"] = "dragstart";
	EventName["Keydown"] = "keydown";
	EventName["ContextMenu"] = "contextmenu";
	EventName["Resize"] = "resize";
	EventName["SelectionChange"] = "selectionchange";
	EventName["VisibilityChange"] = "visibilitychange";
})(EventName || (EventName = {}));

function preventDefault(event) {
	event.preventDefault();
}
function stopPropagation(event) {
	event.stopPropagation();
}

var KeyboardCode;

(function (KeyboardCode) {
	KeyboardCode["Space"] = "Space";
	KeyboardCode["Down"] = "ArrowDown";
	KeyboardCode["Right"] = "ArrowRight";
	KeyboardCode["Left"] = "ArrowLeft";
	KeyboardCode["Up"] = "ArrowUp";
	KeyboardCode["Esc"] = "Escape";
	KeyboardCode["Enter"] = "Enter";
	KeyboardCode["Tab"] = "Tab";
})(KeyboardCode || (KeyboardCode = {}));

const defaultKeyboardCodes = {
	start: [KeyboardCode.Space, KeyboardCode.Enter],
	cancel: [KeyboardCode.Esc],
	end: [KeyboardCode.Space, KeyboardCode.Enter, KeyboardCode.Tab],
};
const defaultKeyboardCoordinateGetter = (event, _ref) => {
	let { currentCoordinates } = _ref;

	switch (event.code) {
		case KeyboardCode.Right:
			return { ...currentCoordinates, x: currentCoordinates.x + 25 };

		case KeyboardCode.Left:
			return { ...currentCoordinates, x: currentCoordinates.x - 25 };

		case KeyboardCode.Down:
			return { ...currentCoordinates, y: currentCoordinates.y + 25 };

		case KeyboardCode.Up:
			return { ...currentCoordinates, y: currentCoordinates.y - 25 };
	}

	return undefined;
};

class KeyboardSensor {
	constructor(props) {
		this.props = void 0;
		this.autoScrollEnabled = false;
		this.referenceCoordinates = void 0;
		this.listeners = void 0;
		this.windowListeners = void 0;
		this.props = props;
		const {
			event: { target },
		} = props;
		this.props = props;
		this.listeners = new Listeners(getOwnerDocument(target));
		this.windowListeners = new Listeners(getWindow(target));
		this.handleKeyDown = this.handleKeyDown.bind(this);
		this.handleCancel = this.handleCancel.bind(this);
		this.attach();
	}

	attach() {
		this.handleStart();
		this.windowListeners.add(EventName.Resize, this.handleCancel);
		this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
		setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));
	}

	handleStart() {
		const { activeNode, onStart } = this.props;
		const node = activeNode.node.current;

		if (node) {
			scrollIntoViewIfNeeded(node);
		}

		onStart(defaultCoordinates);
	}

	handleKeyDown(event) {
		if (isKeyboardEvent(event)) {
			const { active, context, options } = this.props;
			const { keyboardCodes = defaultKeyboardCodes, coordinateGetter = defaultKeyboardCoordinateGetter, scrollBehavior = "smooth" } = options;
			const { code } = event;

			if (keyboardCodes.end.includes(code)) {
				this.handleEnd(event);
				return;
			}

			if (keyboardCodes.cancel.includes(code)) {
				this.handleCancel(event);
				return;
			}

			const { collisionRect } = context.current;
			const currentCoordinates =
				collisionRect ?
					{
						x: collisionRect.left,
						y: collisionRect.top,
					}
				:	defaultCoordinates;

			if (!this.referenceCoordinates) {
				this.referenceCoordinates = currentCoordinates;
			}

			const newCoordinates = coordinateGetter(event, {
				active,
				context: context.current,
				currentCoordinates,
			});

			if (newCoordinates) {
				const coordinatesDelta = subtract(newCoordinates, currentCoordinates);
				const scrollDelta = {
					x: 0,
					y: 0,
				};
				const { scrollableAncestors } = context.current;

				for (const scrollContainer of scrollableAncestors) {
					const direction = event.code;
					const { isTop, isRight, isLeft, isBottom, maxScroll, minScroll } = getScrollPosition(scrollContainer);
					const scrollElementRect = getScrollElementRect(scrollContainer);
					const clampedCoordinates = {
						x: Math.min(
							direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right,
							Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x),
						),
						y: Math.min(
							direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom,
							Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y),
						),
					};
					const canScrollX = (direction === KeyboardCode.Right && !isRight) || (direction === KeyboardCode.Left && !isLeft);
					const canScrollY = (direction === KeyboardCode.Down && !isBottom) || (direction === KeyboardCode.Up && !isTop);

					if (canScrollX && clampedCoordinates.x !== newCoordinates.x) {
						const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x;
						const canScrollToNewCoordinates =
							(direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x) || (direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x);

						if (canScrollToNewCoordinates && !coordinatesDelta.y) {
							// We don't need to update coordinates, the scroll adjustment alone will trigger
							// logic to auto-detect the new container we are over
							scrollContainer.scrollTo({
								left: newScrollCoordinates,
								behavior: scrollBehavior,
							});
							return;
						}

						if (canScrollToNewCoordinates) {
							scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates;
						} else {
							scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x;
						}

						if (scrollDelta.x) {
							scrollContainer.scrollBy({
								left: -scrollDelta.x,
								behavior: scrollBehavior,
							});
						}

						break;
					} else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) {
						const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y;
						const canScrollToNewCoordinates =
							(direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y) || (direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y);

						if (canScrollToNewCoordinates && !coordinatesDelta.x) {
							// We don't need to update coordinates, the scroll adjustment alone will trigger
							// logic to auto-detect the new container we are over
							scrollContainer.scrollTo({
								top: newScrollCoordinates,
								behavior: scrollBehavior,
							});
							return;
						}

						if (canScrollToNewCoordinates) {
							scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates;
						} else {
							scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y;
						}

						if (scrollDelta.y) {
							scrollContainer.scrollBy({
								top: -scrollDelta.y,
								behavior: scrollBehavior,
							});
						}

						break;
					}
				}

				this.handleMove(event, add(subtract(newCoordinates, this.referenceCoordinates), scrollDelta));
			}
		}
	}

	handleMove(event, coordinates) {
		const { onMove } = this.props;
		event.preventDefault();
		onMove(coordinates);
	}

	handleEnd(event) {
		const { onEnd } = this.props;
		event.preventDefault();
		this.detach();
		onEnd();
	}

	handleCancel(event) {
		const { onCancel } = this.props;
		event.preventDefault();
		this.detach();
		onCancel();
	}

	detach() {
		this.listeners.removeAll();
		this.windowListeners.removeAll();
	}
}
KeyboardSensor.activators = [
	{
		eventName: "onKeyDown",
		handler: (event, _ref, _ref2) => {
			let { keyboardCodes = defaultKeyboardCodes, onActivation } = _ref;
			let { active } = _ref2;
			const { code } = event.nativeEvent;

			if (keyboardCodes.start.includes(code)) {
				const activator = active.activatorNode.current;

				if (activator && event.target !== activator) {
					return false;
				}

				event.preventDefault();
				onActivation == null ? void 0 : (
					onActivation({
						event: event.nativeEvent,
					})
				);
				return true;
			}

			return false;
		},
	},
];

function isDistanceConstraint(constraint) {
	return Boolean(constraint && "distance" in constraint);
}

function isDelayConstraint(constraint) {
	return Boolean(constraint && "delay" in constraint);
}

class AbstractPointerSensor {
	constructor(props, events, listenerTarget) {
		var _getEventCoordinates;

		if (listenerTarget === void 0) {
			listenerTarget = getEventListenerTarget(props.event.target);
		}

		this.props = void 0;
		this.events = void 0;
		this.autoScrollEnabled = true;
		this.document = void 0;
		this.activated = false;
		this.initialCoordinates = void 0;
		this.timeoutId = null;
		this.listeners = void 0;
		this.documentListeners = void 0;
		this.windowListeners = void 0;
		this.props = props;
		this.events = events;
		const { event } = props;
		const { target } = event;
		this.props = props;
		this.events = events;
		this.document = getOwnerDocument(target);
		this.documentListeners = new Listeners(this.document);
		this.listeners = new Listeners(listenerTarget);
		this.windowListeners = new Listeners(getWindow(target));
		this.initialCoordinates = (_getEventCoordinates = getEventCoordinates(event)) != null ? _getEventCoordinates : defaultCoordinates;
		this.handleStart = this.handleStart.bind(this);
		this.handleMove = this.handleMove.bind(this);
		this.handleEnd = this.handleEnd.bind(this);
		this.handleCancel = this.handleCancel.bind(this);
		this.handleKeydown = this.handleKeydown.bind(this);
		this.removeTextSelection = this.removeTextSelection.bind(this);
		this.attach();
	}

	attach() {
		const {
			events,
			props: {
				options: { activationConstraint, bypassActivationConstraint },
			},
		} = this;
		this.listeners.add(events.move.name, this.handleMove, {
			passive: false,
		});
		this.listeners.add(events.end.name, this.handleEnd);

		if (events.cancel) {
			this.listeners.add(events.cancel.name, this.handleCancel);
		}

		this.windowListeners.add(EventName.Resize, this.handleCancel);
		this.windowListeners.add(EventName.DragStart, preventDefault);
		this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
		this.windowListeners.add(EventName.ContextMenu, preventDefault);
		this.documentListeners.add(EventName.Keydown, this.handleKeydown);

		if (activationConstraint) {
			if (
				bypassActivationConstraint != null &&
				bypassActivationConstraint({
					event: this.props.event,
					activeNode: this.props.activeNode,
					options: this.props.options,
				})
			) {
				return this.handleStart();
			}

			if (isDelayConstraint(activationConstraint)) {
				this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay);
				this.handlePending(activationConstraint);
				return;
			}

			if (isDistanceConstraint(activationConstraint)) {
				this.handlePending(activationConstraint);
				return;
			}
		}

		this.handleStart();
	}

	detach() {
		this.listeners.removeAll();
		this.windowListeners.removeAll(); // Wait until the next event loop before removing document listeners
		// This is necessary because we listen for `click` and `selection` events on the document

		setTimeout(this.documentListeners.removeAll, 50);

		if (this.timeoutId !== null) {
			clearTimeout(this.timeoutId);
			this.timeoutId = null;
		}
	}

	handlePending(constraint, offset) {
		const { active, onPending } = this.props;
		onPending(active, constraint, this.initialCoordinates, offset);
	}

	handleStart() {
		const { initialCoordinates } = this;
		const { onStart } = this.props;

		if (initialCoordinates) {
			this.activated = true; // Stop propagation of click events once activation constraints are met

			this.documentListeners.add(EventName.Click, stopPropagation, {
				capture: true,
			}); // Remove any text selection from the document

			this.removeTextSelection(); // Prevent further text selection while dragging

			this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection);
			onStart(initialCoordinates);
		}
	}

	handleMove(event) {
		var _getEventCoordinates2;

		const { activated, initialCoordinates, props } = this;
		const {
			onMove,
			options: { activationConstraint },
		} = props;

		if (!initialCoordinates) {
			return;
		}

		const coordinates = (_getEventCoordinates2 = getEventCoordinates(event)) != null ? _getEventCoordinates2 : defaultCoordinates;
		const delta = subtract(initialCoordinates, coordinates); // Constraint validation

		if (!activated && activationConstraint) {
			if (isDistanceConstraint(activationConstraint)) {
				if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) {
					return this.handleCancel();
				}

				if (hasExceededDistance(delta, activationConstraint.distance)) {
					return this.handleStart();
				}
			}

			if (isDelayConstraint(activationConstraint)) {
				if (hasExceededDistance(delta, activationConstraint.tolerance)) {
					return this.handleCancel();
				}
			}

			this.handlePending(activationConstraint, delta);
			return;
		}

		if (event.cancelable) {
			event.preventDefault();
		}

		onMove(coordinates);
	}

	handleEnd() {
		const { onAbort, onEnd } = this.props;
		this.detach();

		if (!this.activated) {
			onAbort(this.props.active);
		}

		onEnd();
	}

	handleCancel() {
		const { onAbort, onCancel } = this.props;
		this.detach();

		if (!this.activated) {
			onAbort(this.props.active);
		}

		onCancel();
	}

	handleKeydown(event) {
		if (event.code === KeyboardCode.Esc) {
			this.handleCancel();
		}
	}

	removeTextSelection() {
		var _this$document$getSel;

		(_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges();
	}
}

const events = {
	cancel: {
		name: "pointercancel",
	},
	move: {
		name: "pointermove",
	},
	end: {
		name: "pointerup",
	},
};
class PointerSensor extends AbstractPointerSensor {
	constructor(props) {
		const { event } = props; // Pointer events stop firing if the target is unmounted while dragging
		// Therefore we attach listeners to the owner document instead

		const listenerTarget = getOwnerDocument(event.target);
		super(props, events, listenerTarget);
	}
}
PointerSensor.activators = [
	{
		eventName: "onPointerDown",
		handler: (_ref, _ref2) => {
			let { nativeEvent: event } = _ref;
			let { onActivation } = _ref2;

			if (!event.isPrimary || event.button !== 0) {
				return false;
			}

			onActivation == null ? void 0 : (
				onActivation({
					event,
				})
			);
			return true;
		},
	},
];

const events$1 = {
	move: {
		name: "mousemove",
	},
	end: {
		name: "mouseup",
	},
};
var MouseButton;

(function (MouseButton) {
	MouseButton[(MouseButton["RightClick"] = 2)] = "RightClick";
})(MouseButton || (MouseButton = {}));

class MouseSensor extends AbstractPointerSensor {
	constructor(props) {
		super(props, events$1, getOwnerDocument(props.event.target));
	}
}
MouseSensor.activators = [
	{
		eventName: "onMouseDown",
		handler: (_ref, _ref2) => {
			let { nativeEvent: event } = _ref;
			let { onActivation } = _ref2;

			if (event.button === MouseButton.RightClick) {
				return false;
			}

			onActivation == null ? void 0 : (
				onActivation({
					event,
				})
			);
			return true;
		},
	},
];

const events$2 = {
	cancel: {
		name: "touchcancel",
	},
	move: {
		name: "touchmove",
	},
	end: {
		name: "touchend",
	},
};
class TouchSensor extends AbstractPointerSensor {
	constructor(props) {
		super(props, events$2);
	}

	static setup() {
		// Adding a non-capture and non-passive `touchmove` listener in order
		// to force `event.preventDefault()` calls to work in dynamically added
		// touchmove event handlers. This is required for iOS Safari.
		window.addEventListener(events$2.move.name, noop, {
			capture: false,
			passive: false,
		});
		return function teardown() {
			window.removeEventListener(events$2.move.name, noop);
		}; // We create a new handler because the teardown function of another sensor
		// could remove our event listener if we use a referentially equal listener.

		function noop() {}
	}
}
TouchSensor.activators = [
	{
		eventName: "onTouchStart",
		handler: (_ref, _ref2) => {
			let { nativeEvent: event } = _ref;
			let { onActivation } = _ref2;
			const { touches } = event;

			if (touches.length > 1) {
				return false;
			}

			onActivation == null ? void 0 : (
				onActivation({
					event,
				})
			);
			return true;
		},
	},
];

var AutoScrollActivator;

(function (AutoScrollActivator) {
	AutoScrollActivator[(AutoScrollActivator["Pointer"] = 0)] = "Pointer";
	AutoScrollActivator[(AutoScrollActivator["DraggableRect"] = 1)] = "DraggableRect";
})(AutoScrollActivator || (AutoScrollActivator = {}));

var TraversalOrder;

(function (TraversalOrder) {
	TraversalOrder[(TraversalOrder["TreeOrder"] = 0)] = "TreeOrder";
	TraversalOrder[(TraversalOrder["ReversedTreeOrder"] = 1)] = "ReversedTreeOrder";
})(TraversalOrder || (TraversalOrder = {}));

function useAutoScroller(_ref) {
	let {
		acceleration,
		activator = AutoScrollActivator.Pointer,
		canScroll,
		draggingRect,
		enabled,
		interval = 5,
		order = TraversalOrder.TreeOrder,
		pointerCoordinates,
		scrollableAncestors,
		scrollableAncestorRects,
		delta,
		threshold,
	} = _ref;
	const scrollIntent = useScrollIntent({
		delta,
		disabled: !enabled,
	});
	const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval();
	const scrollSpeed = useRef$1({
		x: 0,
		y: 0,
	});
	const scrollDirection = useRef$1({
		x: 0,
		y: 0,
	});
	const rect = useMemo(() => {
		switch (activator) {
			case AutoScrollActivator.Pointer:
				return pointerCoordinates ?
						{
							top: pointerCoordinates.y,
							bottom: pointerCoordinates.y,
							left: pointerCoordinates.x,
							right: pointerCoordinates.x,
						}
					:	null;

			case AutoScrollActivator.DraggableRect:
				return draggingRect;
		}
	}, [activator, draggingRect, pointerCoordinates]);
	const scrollContainerRef = useRef$1(null);
	const autoScroll = useCallback(() => {
		const scrollContainer = scrollContainerRef.current;

		if (!scrollContainer) {
			return;
		}

		const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x;
		const scrollTop = scrollSpeed.current.y * scrollDirection.current.y;
		scrollContainer.scrollBy(scrollLeft, scrollTop);
	}, []);
	const sortedScrollableAncestors = useMemo(() => (order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors), [order, scrollableAncestors]);
	useEffect(
		() => {
			if (!enabled || !scrollableAncestors.length || !rect) {
				clearAutoScrollInterval();
				return;
			}

			for (const scrollContainer of sortedScrollableAncestors) {
				if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) {
					continue;
				}

				const index = scrollableAncestors.indexOf(scrollContainer);
				const scrollContainerRect = scrollableAncestorRects[index];

				if (!scrollContainerRect) {
					continue;
				}

				const { direction, speed } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold);

				for (const axis of ["x", "y"]) {
					if (!scrollIntent[axis][direction[axis]]) {
						speed[axis] = 0;
						direction[axis] = 0;
					}
				}

				if (speed.x > 0 || speed.y > 0) {
					clearAutoScrollInterval();
					scrollContainerRef.current = scrollContainer;
					setAutoScrollInterval(autoScroll, interval);
					scrollSpeed.current = speed;
					scrollDirection.current = direction;
					return;
				}
			}

			scrollSpeed.current = {
				x: 0,
				y: 0,
			};
			scrollDirection.current = {
				x: 0,
				y: 0,
			};
			clearAutoScrollInterval();
		}, // eslint-disable-next-line react-hooks/exhaustive-deps
		[
			acceleration,
			autoScroll,
			canScroll,
			clearAutoScrollInterval,
			enabled,
			interval, // eslint-disable-next-line react-hooks/exhaustive-deps
			JSON.stringify(rect), // eslint-disable-next-line react-hooks/exhaustive-deps
			JSON.stringify(scrollIntent),
			setAutoScrollInterval,
			scrollableAncestors,
			sortedScrollableAncestors,
			scrollableAncestorRects, // eslint-disable-next-line react-hooks/exhaustive-deps
			JSON.stringify(threshold),
		],
	);
}
const defaultScrollIntent = {
	x: {
		[Direction.Backward]: false,
		[Direction.Forward]: false,
	},
	y: {
		[Direction.Backward]: false,
		[Direction.Forward]: false,
	},
};

function useScrollIntent(_ref2) {
	let { delta, disabled } = _ref2;
	const previousDelta = usePrevious(delta);
	return useLazyMemo(
		(previousIntent) => {
			if (disabled || !previousDelta || !previousIntent) {
				// Reset scroll intent tracking when auto-scrolling is disabled
				return defaultScrollIntent;
			}

			const direction = {
				x: Math.sign(delta.x - previousDelta.x),
				y: Math.sign(delta.y - previousDelta.y),
			}; // Keep track of the user intent to scroll in each direction for both axis

			return {
				x: {
					[Direction.Backward]: previousIntent.x[Direction.Backward] || direction.x === -1,
					[Direction.Forward]: previousIntent.x[Direction.Forward] || direction.x === 1,
				},
				y: {
					[Direction.Backward]: previousIntent.y[Direction.Backward] || direction.y === -1,
					[Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1,
				},
			};
		},
		[disabled, delta, previousDelta],
	);
}

function useCachedNode(draggableNodes, id) {
	const draggableNode = id != null ? draggableNodes.get(id) : undefined;
	const node = draggableNode ? draggableNode.node.current : null;
	return useLazyMemo(
		(cachedNode) => {
			var _ref;

			if (id == null) {
				return null;
			} // In some cases, the draggable node can unmount while dragging
			// This is the case for virtualized lists. In those situations,
			// we fall back to the last known value for that node.

			return (_ref = node != null ? node : cachedNode) != null ? _ref : null;
		},
		[node, id],
	);
}

function useCombineActivators(sensors, getSyntheticHandler) {
	return useMemo(
		() =>
			sensors.reduce((accumulator, sensor) => {
				const { sensor: Sensor } = sensor;
				const sensorActivators = Sensor.activators.map((activator) => ({
					eventName: activator.eventName,
					handler: getSyntheticHandler(activator.handler, sensor),
				}));
				return [...accumulator, ...sensorActivators];
			}, []),
		[sensors, getSyntheticHandler],
	);
}

var MeasuringStrategy;

(function (MeasuringStrategy) {
	MeasuringStrategy[(MeasuringStrategy["Always"] = 0)] = "Always";
	MeasuringStrategy[(MeasuringStrategy["BeforeDragging"] = 1)] = "BeforeDragging";
	MeasuringStrategy[(MeasuringStrategy["WhileDragging"] = 2)] = "WhileDragging";
})(MeasuringStrategy || (MeasuringStrategy = {}));

var MeasuringFrequency;

(function (MeasuringFrequency) {
	MeasuringFrequency["Optimized"] = "optimized";
})(MeasuringFrequency || (MeasuringFrequency = {}));

const defaultValue = /*#__PURE__*/ new Map();
function useDroppableMeasuring(containers, _ref) {
	let { dragging, dependencies, config } = _ref;
	const [queue, setQueue] = useState(null);
	const { frequency, measure, strategy } = config;
	const containersRef = useRef$1(containers);
	const disabled = isDisabled();
	const disabledRef = useLatestValue(disabled);
	const measureDroppableContainers = useCallback(
		function (ids) {
			if (ids === void 0) {
				ids = [];
			}

			if (disabledRef.current) {
				return;
			}

			setQueue((value) => {
				if (value === null) {
					return ids;
				}

				return value.concat(ids.filter((id) => !value.includes(id)));
			});
		},
		[disabledRef],
	);
	const timeoutId = useRef$1(null);
	const droppableRects = useLazyMemo(
		(previousValue) => {
			if (disabled && !dragging) {
				return defaultValue;
			}

			if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) {
				const map = new Map();

				for (let container of containers) {
					if (!container) {
						continue;
					}

					if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) {
						// This container does not need to be re-measured
						map.set(container.id, container.rect.current);
						continue;
					}

					const node = container.node.current;
					const rect = node ? new Rect(measure(node), node) : null;
					container.rect.current = rect;

					if (rect) {
						map.set(container.id, rect);
					}
				}

				return map;
			}

			return previousValue;
		},
		[containers, queue, dragging, disabled, measure],
	);
	useEffect(() => {
		containersRef.current = containers;
	}, [containers]);
	useEffect(
		() => {
			if (disabled) {
				return;
			}

			measureDroppableContainers();
		}, // eslint-disable-next-line react-hooks/exhaustive-deps
		[dragging, disabled],
	);
	useEffect(
		() => {
			if (queue && queue.length > 0) {
				setQueue(null);
			}
		}, //eslint-disable-next-line react-hooks/exhaustive-deps
		[JSON.stringify(queue)],
	);
	useEffect(
		() => {
			if (disabled || typeof frequency !== "number" || timeoutId.current !== null) {
				return;
			}

			timeoutId.current = setTimeout(() => {
				measureDroppableContainers();
				timeoutId.current = null;
			}, frequency);
		}, // eslint-disable-next-line react-hooks/exhaustive-deps
		[frequency, disabled, measureDroppableContainers, ...dependencies],
	);
	return {
		droppableRects,
		measureDroppableContainers,
		measuringScheduled: queue != null,
	};

	function isDisabled() {
		switch (strategy) {
			case MeasuringStrategy.Always:
				return false;

			case MeasuringStrategy.BeforeDragging:
				return dragging;

			default:
				return !dragging;
		}
	}
}

function useInitialValue(value, computeFn) {
	return useLazyMemo(
		(previousValue) => {
			if (!value) {
				return null;
			}

			if (previousValue) {
				return previousValue;
			}

			return typeof computeFn === "function" ? computeFn(value) : value;
		},
		[computeFn, value],
	);
}

function useInitialRect(node, measure) {
	return useInitialValue(node, measure);
}

/**
 * Returns a new MutationObserver instance.
 * If `MutationObserver` is undefined in the execution environment, returns `undefined`.
 */

function useMutationObserver(_ref) {
	let { callback, disabled } = _ref;
	const handleMutations = useEvent(callback);
	const mutationObserver = useMemo(() => {
		if (disabled || typeof window === "undefined" || typeof window.MutationObserver === "undefined") {
			return undefined;
		}

		const { MutationObserver } = window;
		return new MutationObserver(handleMutations);
	}, [handleMutations, disabled]);
	useEffect(() => {
		return () => (mutationObserver == null ? void 0 : mutationObserver.disconnect());
	}, [mutationObserver]);
	return mutationObserver;
}

/**
 * Returns a new ResizeObserver instance bound to the `onResize` callback.
 * If `ResizeObserver` is undefined in the execution environment, returns `undefined`.
 */

function useResizeObserver(_ref) {
	let { callback, disabled } = _ref;
	const handleResize = useEvent(callback);
	const resizeObserver = useMemo(
		() => {
			if (disabled || typeof window === "undefined" || typeof window.ResizeObserver === "undefined") {
				return undefined;
			}

			const { ResizeObserver } = window;
			return new ResizeObserver(handleResize);
		}, // eslint-disable-next-line react-hooks/exhaustive-deps
		[disabled],
	);
	useEffect(() => {
		return () => (resizeObserver == null ? void 0 : resizeObserver.disconnect());
	}, [resizeObserver]);
	return resizeObserver;
}

function defaultMeasure(element) {
	return new Rect(getClientRect(element), element);
}

function useRect(element, measure, fallbackRect) {
	if (measure === void 0) {
		measure = defaultMeasure;
	}

	const [rect, setRect] = useState(null);

	function measureRect() {
		setRect((currentRect) => {
			if (!element) {
				return null;
			}

			if (element.isConnected === false) {
				var _ref;

				// Fall back to last rect we measured if the element is
				// no longer connected to the DOM.
				return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
			}

			const newRect = measure(element);

			if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {
				return currentRect;
			}

			return newRect;
		});
	}

	const mutationObserver = useMutationObserver({
		callback(records) {
			if (!element) {
				return;
			}

			for (const record of records) {
				const { type, target } = record;

				if (type === "childList" && target instanceof HTMLElement && target.contains(element)) {
					measureRect();
					break;
				}
			}
		},
	});
	const resizeObserver = useResizeObserver({
		callback: measureRect,
	});
	useIsomorphicLayoutEffect(() => {
		measureRect();

		if (element) {
			resizeObserver == null ? void 0 : resizeObserver.observe(element);
			mutationObserver == null ? void 0 : (
				mutationObserver.observe(document.body, {
					childList: true,
					subtree: true,
				})
			);
		} else {
			resizeObserver == null ? void 0 : resizeObserver.disconnect();
			mutationObserver == null ? void 0 : mutationObserver.disconnect();
		}
	}, [element]);
	return rect;
}

function useRectDelta(rect) {
	const initialRect = useInitialValue(rect);
	return getRectDelta(rect, initialRect);
}

const defaultValue$1 = [];
function useScrollableAncestors(node) {
	const previousNode = useRef$1(node);
	const ancestors = useLazyMemo(
		(previousValue) => {
			if (!node) {
				return defaultValue$1;
			}

			if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) {
				return previousValue;
			}

			return getScrollableAncestors(node);
		},
		[node],
	);
	useEffect(() => {
		previousNode.current = node;
	}, [node]);
	return ancestors;
}

function useScrollOffsets(elements) {
	const [scrollCoordinates, setScrollCoordinates] = useState(null);
	const prevElements = useRef$1(elements); // To-do: Throttle the handleScroll callback

	const handleScroll = useCallback((event) => {
		const scrollingElement = getScrollableElement(event.target);

		if (!scrollingElement) {
			return;
		}

		setScrollCoordinates((scrollCoordinates) => {
			if (!scrollCoordinates) {
				return null;
			}

			scrollCoordinates.set(scrollingElement, getScrollCoordinates(scrollingElement));
			return new Map(scrollCoordinates);
		});
	}, []);
	useEffect(() => {
		const previousElements = prevElements.current;

		if (elements !== previousElements) {
			cleanup(previousElements);
			const entries = elements
				.map((element) => {
					const scrollableElement = getScrollableElement(element);

					if (scrollableElement) {
						scrollableElement.addEventListener("scroll", handleScroll, {
							passive: true,
						});
						return [scrollableElement, getScrollCoordinates(scrollableElement)];
					}

					return null;
				})
				.filter((entry) => entry != null);
			setScrollCoordinates(entries.length ? new Map(entries) : null);
			prevElements.current = elements;
		}

		return () => {
			cleanup(elements);
			cleanup(previousElements);
		};

		function cleanup(elements) {
			elements.forEach((element) => {
				const scrollableElement = getScrollableElement(element);
				scrollableElement == null ? void 0 : scrollableElement.removeEventListener("scroll", handleScroll);
			});
		}
	}, [handleScroll, elements]);
	return useMemo(() => {
		if (elements.length) {
			return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements);
		}

		return defaultCoordinates;
	}, [elements, scrollCoordinates]);
}

function useScrollOffsetsDelta(scrollOffsets, dependencies) {
	if (dependencies === void 0) {
		dependencies = [];
	}

	const initialScrollOffsets = useRef$1(null);
	useEffect(
		() => {
			initialScrollOffsets.current = null;
		}, // eslint-disable-next-line react-hooks/exhaustive-deps
		dependencies,
	);
	useEffect(() => {
		const hasScrollOffsets = scrollOffsets !== defaultCoordinates;

		if (hasScrollOffsets && !initialScrollOffsets.current) {
			initialScrollOffsets.current = scrollOffsets;
		}

		if (!hasScrollOffsets && initialScrollOffsets.current) {
			initialScrollOffsets.current = null;
		}
	}, [scrollOffsets]);
	return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates;
}

function useSensorSetup(sensors) {
	useEffect(
		() => {
			if (!canUseDOM) {
				return;
			}

			const teardownFns = sensors.map((_ref) => {
				let { sensor } = _ref;
				return sensor.setup == null ? void 0 : sensor.setup();
			});
			return () => {
				for (const teardown of teardownFns) {
					teardown == null ? void 0 : teardown();
				}
			};
		}, // TO-DO: Sensors length could theoretically change which would not be a valid dependency
		// eslint-disable-next-line react-hooks/exhaustive-deps
		sensors.map((_ref2) => {
			let { sensor } = _ref2;
			return sensor;
		}),
	);
}

function useWindowRect(element) {
	return useMemo(() => (element ? getWindowClientRect(element) : null), [element]);
}

const defaultValue$2 = [];
function useRects(elements, measure) {
	if (measure === void 0) {
		measure = getClientRect;
	}

	const [firstElement] = elements;
	const windowRect = useWindowRect(firstElement ? getWindow(firstElement) : null);
	const [rects, setRects] = useState(defaultValue$2);

	function measureRects() {
		setRects(() => {
			if (!elements.length) {
				return defaultValue$2;
			}

			return elements.map((element) => (isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element)));
		});
	}

	const resizeObserver = useResizeObserver({
		callback: measureRects,
	});
	useIsomorphicLayoutEffect(() => {
		resizeObserver == null ? void 0 : resizeObserver.disconnect();
		measureRects();
		elements.forEach((element) => (resizeObserver == null ? void 0 : resizeObserver.observe(element)));
	}, [elements]);
	return rects;
}

function getMeasurableNode(node) {
	if (!node) {
		return null;
	}

	if (node.children.length > 1) {
		return node;
	}

	const firstChild = node.children[0];
	return isHTMLElement(firstChild) ? firstChild : node;
}

function useDragOverlayMeasuring(_ref) {
	let { measure } = _ref;
	const [rect, setRect] = useState(null);
	const handleResize = useCallback(
		(entries) => {
			for (const { target } of entries) {
				if (isHTMLElement(target)) {
					setRect((rect) => {
						const newRect = measure(target);
						return rect ? { ...rect, width: newRect.width, height: newRect.height } : newRect;
					});
					break;
				}
			}
		},
		[measure],
	);
	const resizeObserver = useResizeObserver({
		callback: handleResize,
	});
	const handleNodeChange = useCallback(
		(element) => {
			const node = getMeasurableNode(element);
			resizeObserver == null ? void 0 : resizeObserver.disconnect();

			if (node) {
				resizeObserver == null ? void 0 : resizeObserver.observe(node);
			}

			setRect(node ? measure(node) : null);
		},
		[measure, resizeObserver],
	);
	const [nodeRef, setRef] = useNodeRef(handleNodeChange);
	return useMemo(
		() => ({
			nodeRef,
			rect,
			setRef,
		}),
		[rect, nodeRef, setRef],
	);
}

const defaultSensors = [
	{
		sensor: PointerSensor,
		options: {},
	},
	{
		sensor: KeyboardSensor,
		options: {},
	},
];
const defaultData = {
	current: {},
};
const defaultMeasuringConfiguration = {
	draggable: {
		measure: getTransformAgnosticClientRect,
	},
	droppable: {
		measure: getTransformAgnosticClientRect,
		strategy: MeasuringStrategy.WhileDragging,
		frequency: MeasuringFrequency.Optimized,
	},
	dragOverlay: {
		measure: getClientRect,
	},
};

class DroppableContainersMap extends Map {
	get(id) {
		var _super$get;

		return (
			id != null ?
				(_super$get = super.get(id)) != null ?
					_super$get
				:	undefined
			:	undefined
		);
	}

	toArray() {
		return Array.from(this.values());
	}

	getEnabled() {
		return this.toArray().filter((_ref) => {
			let { disabled } = _ref;
			return !disabled;
		});
	}

	getNodeFor(id) {
		var _this$get$node$curren, _this$get;

		return (_this$get$node$curren = (_this$get = this.get(id)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : undefined;
	}
}

const defaultPublicContext = {
	activatorEvent: null,
	active: null,
	activeNode: null,
	activeNodeRect: null,
	collisions: null,
	containerNodeRect: null,
	draggableNodes: /*#__PURE__*/ new Map(),
	droppableRects: /*#__PURE__*/ new Map(),
	droppableContainers: /*#__PURE__*/ new DroppableContainersMap(),
	over: null,
	dragOverlay: {
		nodeRef: {
			current: null,
		},
		rect: null,
		setRef: noop,
	},
	scrollableAncestors: [],
	scrollableAncestorRects: [],
	measuringConfiguration: defaultMeasuringConfiguration,
	measureDroppableContainers: noop,
	windowRect: null,
	measuringScheduled: false,
};
const defaultInternalContext = {
	activatorEvent: null,
	activators: [],
	active: null,
	activeNodeRect: null,
	ariaDescribedById: {
		draggable: "",
	},
	dispatch: noop,
	draggableNodes: /*#__PURE__*/ new Map(),
	over: null,
	measureDroppableContainers: noop,
};
const InternalContext = /*#__PURE__*/ createContext$1(defaultInternalContext);
const PublicContext = /*#__PURE__*/ createContext$1(defaultPublicContext);

function getInitialState() {
	return {
		draggable: {
			active: null,
			initialCoordinates: {
				x: 0,
				y: 0,
			},
			nodes: new Map(),
			translate: {
				x: 0,
				y: 0,
			},
		},
		droppable: {
			containers: new DroppableContainersMap(),
		},
	};
}
function reducer(state, action) {
	switch (action.type) {
		case Action.DragStart:
			return { ...state, draggable: { ...state.draggable, initialCoordinates: action.initialCoordinates, active: action.active } };

		case Action.DragMove:
			if (state.draggable.active == null) {
				return state;
			}

			return {
				...state,
				draggable: {
					...state.draggable,
					translate: {
						x: action.coordinates.x - state.draggable.initialCoordinates.x,
						y: action.coordinates.y - state.draggable.initialCoordinates.y,
					},
				},
			};

		case Action.DragEnd:
		case Action.DragCancel:
			return {
				...state,
				draggable: {
					...state.draggable,
					active: null,
					initialCoordinates: {
						x: 0,
						y: 0,
					},
					translate: {
						x: 0,
						y: 0,
					},
				},
			};

		case Action.RegisterDroppable: {
			const { element } = action;
			const { id } = element;
			const containers = new DroppableContainersMap(state.droppable.containers);
			containers.set(id, element);
			return { ...state, droppable: { ...state.droppable, containers } };
		}

		case Action.SetDroppableDisabled: {
			const { id, key, disabled } = action;
			const element = state.droppable.containers.get(id);

			if (!element || key !== element.key) {
				return state;
			}

			const containers = new DroppableContainersMap(state.droppable.containers);
			containers.set(id, { ...element, disabled });
			return { ...state, droppable: { ...state.droppable, containers } };
		}

		case Action.UnregisterDroppable: {
			const { id, key } = action;
			const element = state.droppable.containers.get(id);

			if (!element || key !== element.key) {
				return state;
			}

			const containers = new DroppableContainersMap(state.droppable.containers);
			containers.delete(id);
			return { ...state, droppable: { ...state.droppable, containers } };
		}

		default: {
			return state;
		}
	}
}

function RestoreFocus(_ref) {
	let { disabled } = _ref;
	const { active, activatorEvent, draggableNodes } = useContext$1(InternalContext);
	const previousActivatorEvent = usePrevious(activatorEvent);
	const previousActiveId = usePrevious(active == null ? void 0 : active.id); // Restore keyboard focus on the activator node

	useEffect(() => {
		if (disabled) {
			return;
		}

		if (!activatorEvent && previousActivatorEvent && previousActiveId != null) {
			if (!isKeyboardEvent(previousActivatorEvent)) {
				return;
			}

			if (document.activeElement === previousActivatorEvent.target) {
				// No need to restore focus
				return;
			}

			const draggableNode = draggableNodes.get(previousActiveId);

			if (!draggableNode) {
				return;
			}

			const { activatorNode, node } = draggableNode;

			if (!activatorNode.current && !node.current) {
				return;
			}

			requestAnimationFrame(() => {
				for (const element of [activatorNode.current, node.current]) {
					if (!element) {
						continue;
					}

					const focusableNode = findFirstFocusableNode(element);

					if (focusableNode) {
						focusableNode.focus();
						break;
					}
				}
			});
		}
	}, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]);
	return null;
}

function applyModifiers(modifiers, _ref) {
	let { transform, ...args } = _ref;
	return modifiers != null && modifiers.length ?
			modifiers.reduce((accumulator, modifier) => {
				return modifier({
					transform: accumulator,
					...args,
				});
			}, transform)
		:	transform;
}

function useMeasuringConfiguration(config) {
	return useMemo(
		() => ({
			draggable: { ...defaultMeasuringConfiguration.draggable, ...(config == null ? void 0 : config.draggable) },
			droppable: { ...defaultMeasuringConfiguration.droppable, ...(config == null ? void 0 : config.droppable) },
			dragOverlay: { ...defaultMeasuringConfiguration.dragOverlay, ...(config == null ? void 0 : config.dragOverlay) },
		}), // eslint-disable-next-line react-hooks/exhaustive-deps
		[config == null ? void 0 : config.draggable, config == null ? void 0 : config.droppable, config == null ? void 0 : config.dragOverlay],
	);
}

function useLayoutShiftScrollCompensation(_ref) {
	let { activeNode, measure, initialRect, config = true } = _ref;
	const initialized = useRef$1(false);
	const { x, y } =
		typeof config === "boolean" ?
			{
				x: config,
				y: config,
			}
		:	config;
	useIsomorphicLayoutEffect(() => {
		const disabled = !x && !y;

		if (disabled || !activeNode) {
			initialized.current = false;
			return;
		}

		if (initialized.current || !initialRect) {
			// Return early if layout shift scroll compensation was already attempted
			// or if there is no initialRect to compare to.
			return;
		} // Get the most up to date node ref for the active draggable

		const node = activeNode == null ? void 0 : activeNode.node.current;

		if (!node || node.isConnected === false) {
			// Return early if there is no attached node ref or if the node is
			// disconnected from the document.
			return;
		}

		const rect = measure(node);
		const rectDelta = getRectDelta(rect, initialRect);

		if (!x) {
			rectDelta.x = 0;
		}

		if (!y) {
			rectDelta.y = 0;
		} // Only perform layout shift scroll compensation once

		initialized.current = true;

		if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) {
			const firstScrollableAncestor = getFirstScrollableAncestor(node);

			if (firstScrollableAncestor) {
				firstScrollableAncestor.scrollBy({
					top: rectDelta.y,
					left: rectDelta.x,
				});
			}
		}
	}, [activeNode, x, y, initialRect, measure]);
}

const ActiveDraggableContext = /*#__PURE__*/ createContext$1({ ...defaultCoordinates, scaleX: 1, scaleY: 1 });
var Status;

(function (Status) {
	Status[(Status["Uninitialized"] = 0)] = "Uninitialized";
	Status[(Status["Initializing"] = 1)] = "Initializing";
	Status[(Status["Initialized"] = 2)] = "Initialized";
})(Status || (Status = {}));

const DndContext = /*#__PURE__*/ memo$1(function DndContext(_ref) {
	var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect;

	let { id, accessibility, autoScroll = true, children, sensors = defaultSensors, collisionDetection = rectIntersection, measuring, modifiers, ...props } = _ref;
	const store = useReducer(reducer, undefined, getInitialState);
	const [state, dispatch] = store;
	const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider();
	const [status, setStatus] = useState(Status.Uninitialized);
	const isInitialized = status === Status.Initialized;
	const {
		draggable: { active: activeId, nodes: draggableNodes, translate },
		droppable: { containers: droppableContainers },
	} = state;
	const node = activeId != null ? draggableNodes.get(activeId) : null;
	const activeRects = useRef$1({
		initial: null,
		translated: null,
	});
	const active = useMemo(() => {
		var _node$data;

		return activeId != null ?
				{
					id: activeId,
					// It's possible for the active node to unmount while dragging
					data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData,
					rect: activeRects,
				}
			:	null;
	}, [activeId, node]);
	const activeRef = useRef$1(null);
	const [activeSensor, setActiveSensor] = useState(null);
	const [activatorEvent, setActivatorEvent] = useState(null);
	const latestProps = useLatestValue(props, Object.values(props));
	const draggableDescribedById = useUniqueId("DndDescribedBy", id);
	const enabledDroppableContainers = useMemo(() => droppableContainers.getEnabled(), [droppableContainers]);
	const measuringConfiguration = useMeasuringConfiguration(measuring);
	const { droppableRects, measureDroppableContainers, measuringScheduled } = useDroppableMeasuring(enabledDroppableContainers, {
		dragging: isInitialized,
		dependencies: [translate.x, translate.y],
		config: measuringConfiguration.droppable,
	});
	const activeNode = useCachedNode(draggableNodes, activeId);
	const activationCoordinates = useMemo(() => (activatorEvent ? getEventCoordinates(activatorEvent) : null), [activatorEvent]);
	const autoScrollOptions = getAutoScrollerOptions();
	const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);
	useLayoutShiftScrollCompensation({
		activeNode: activeId != null ? draggableNodes.get(activeId) : null,
		config: autoScrollOptions.layoutShiftCompensation,
		initialRect: initialActiveNodeRect,
		measure: measuringConfiguration.draggable.measure,
	});
	const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect);
	const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null);
	const sensorContext = useRef$1({
		activatorEvent: null,
		active: null,
		activeNode,
		collisionRect: null,
		collisions: null,
		droppableRects,
		draggableNodes,
		draggingNode: null,
		draggingNodeRect: null,
		droppableContainers,
		over: null,
		scrollableAncestors: [],
		scrollAdjustedTranslate: null,
	});
	const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id);
	const dragOverlay = useDragOverlayMeasuring({
		measure: measuringConfiguration.dragOverlay.measure,
	}); // Use the rect of the drag overlay if it is mounted

	const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode;
	const draggingNodeRect =
		isInitialized ?
			(_dragOverlay$rect = dragOverlay.rect) != null ?
				_dragOverlay$rect
			:	activeNodeRect
		:	null;
	const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect); // The delta between the previous and new position of the draggable node
	// is only relevant when there is no drag overlay

	const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect); // Get the window rect of the dragging node

	const windowRect = useWindowRect(draggingNode ? getWindow(draggingNode) : null); // Get scrollable ancestors of the dragging node

	const scrollableAncestors = useScrollableAncestors(
		isInitialized ?
			overNode != null ?
				overNode
			:	activeNode
		:	null,
	);
	const scrollableAncestorRects = useRects(scrollableAncestors); // Apply modifiers

	const modifiedTranslate = applyModifiers(modifiers, {
		transform: {
			x: translate.x - nodeRectDelta.x,
			y: translate.y - nodeRectDelta.y,
			scaleX: 1,
			scaleY: 1,
		},
		activatorEvent,
		active,
		activeNodeRect,
		containerNodeRect,
		draggingNodeRect,
		over: sensorContext.current.over,
		overlayNodeRect: dragOverlay.rect,
		scrollableAncestors,
		scrollableAncestorRects,
		windowRect,
	});
	const pointerCoordinates = activationCoordinates ? add(activationCoordinates, translate) : null;
	const scrollOffsets = useScrollOffsets(scrollableAncestors); // Represents the scroll delta since dragging was initiated

	const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets); // Represents the scroll delta since the last time the active node rect was measured

	const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]);
	const scrollAdjustedTranslate = add(modifiedTranslate, scrollAdjustment);
	const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null;
	const collisions =
		active && collisionRect ?
			collisionDetection({
				active,
				collisionRect,
				droppableRects,
				droppableContainers: enabledDroppableContainers,
				pointerCoordinates,
			})
		:	null;
	const overId = getFirstCollision(collisions, "id");
	const [over, setOver] = useState(null); // When there is no drag overlay used, we need to account for the
	// window scroll delta

	const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);
	const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);
	const activeSensorRef = useRef$1(null);
	const instantiateSensor = useCallback(
		(event, _ref2) => {
			let { sensor: Sensor, options } = _ref2;

			if (activeRef.current == null) {
				return;
			}

			const activeNode = draggableNodes.get(activeRef.current);

			if (!activeNode) {
				return;
			}

			const activatorEvent = event.nativeEvent;
			const sensorInstance = new Sensor({
				active: activeRef.current,
				activeNode,
				event: activatorEvent,
				options,
				// Sensors need to be instantiated with refs for arguments that change over time
				// otherwise they are frozen in time with the stale arguments
				context: sensorContext,

				onAbort(id) {
					const draggableNode = draggableNodes.get(id);

					if (!draggableNode) {
						return;
					}

					const { onDragAbort } = latestProps.current;
					const event = {
						id,
					};
					onDragAbort == null ? void 0 : onDragAbort(event);
					dispatchMonitorEvent({
						type: "onDragAbort",
						event,
					});
				},

				onPending(id, constraint, initialCoordinates, offset) {
					const draggableNode = draggableNodes.get(id);

					if (!draggableNode) {
						return;
					}

					const { onDragPending } = latestProps.current;
					const event = {
						id,
						constraint,
						initialCoordinates,
						offset,
					};
					onDragPending == null ? void 0 : onDragPending(event);
					dispatchMonitorEvent({
						type: "onDragPending",
						event,
					});
				},

				onStart(initialCoordinates) {
					const id = activeRef.current;

					if (id == null) {
						return;
					}

					const draggableNode = draggableNodes.get(id);

					if (!draggableNode) {
						return;
					}

					const { onDragStart } = latestProps.current;
					const event = {
						activatorEvent,
						active: {
							id,
							data: draggableNode.data,
							rect: activeRects,
						},
					};
					unstable_batchedUpdates(() => {
						onDragStart == null ? void 0 : onDragStart(event);
						setStatus(Status.Initializing);
						dispatch({
							type: Action.DragStart,
							initialCoordinates,
							active: id,
						});
						dispatchMonitorEvent({
							type: "onDragStart",
							event,
						});
						setActiveSensor(activeSensorRef.current);
						setActivatorEvent(activatorEvent);
					});
				},

				onMove(coordinates) {
					dispatch({
						type: Action.DragMove,
						coordinates,
					});
				},

				onEnd: createHandler(Action.DragEnd),
				onCancel: createHandler(Action.DragCancel),
			});
			activeSensorRef.current = sensorInstance;

			function createHandler(type) {
				return async function handler() {
					const { active, collisions, over, scrollAdjustedTranslate } = sensorContext.current;
					let event = null;

					if (active && scrollAdjustedTranslate) {
						const { cancelDrop } = latestProps.current;
						event = {
							activatorEvent,
							active: active,
							collisions,
							delta: scrollAdjustedTranslate,
							over,
						};

						if (type === Action.DragEnd && typeof cancelDrop === "function") {
							const shouldCancel = await Promise.resolve(cancelDrop(event));

							if (shouldCancel) {
								type = Action.DragCancel;
							}
						}
					}

					activeRef.current = null;
					unstable_batchedUpdates(() => {
						dispatch({
							type,
						});
						setStatus(Status.Uninitialized);
						setOver(null);
						setActiveSensor(null);
						setActivatorEvent(null);
						activeSensorRef.current = null;
						const eventName = type === Action.DragEnd ? "onDragEnd" : "onDragCancel";

						if (event) {
							const handler = latestProps.current[eventName];
							handler == null ? void 0 : handler(event);
							dispatchMonitorEvent({
								type: eventName,
								event,
							});
						}
					});
				};
			}
		}, // eslint-disable-next-line react-hooks/exhaustive-deps
		[draggableNodes],
	);
	const bindActivatorToSensorInstantiator = useCallback(
		(handler, sensor) => {
			return (event, active) => {
				const nativeEvent = event.nativeEvent;
				const activeDraggableNode = draggableNodes.get(active);

				if (
					// Another sensor is already instantiating
					activeRef.current !== null || // No active draggable
					!activeDraggableNode || // Event has already been captured
					nativeEvent.dndKit ||
					nativeEvent.defaultPrevented
				) {
					return;
				}

				const activationContext = {
					active: activeDraggableNode,
				};
				const shouldActivate = handler(event, sensor.options, activationContext);

				if (shouldActivate === true) {
					nativeEvent.dndKit = {
						capturedBy: sensor.sensor,
					};
					activeRef.current = active;
					instantiateSensor(event, sensor);
				}
			};
		},
		[draggableNodes, instantiateSensor],
	);
	const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator);
	useSensorSetup(sensors);
	useIsomorphicLayoutEffect(() => {
		if (activeNodeRect && status === Status.Initializing) {
			setStatus(Status.Initialized);
		}
	}, [activeNodeRect, status]);
	useEffect(
		() => {
			const { onDragMove } = latestProps.current;
			const { active, activatorEvent, collisions, over } = sensorContext.current;

			if (!active || !activatorEvent) {
				return;
			}

			const event = {
				active,
				activatorEvent,
				collisions,
				delta: {
					x: scrollAdjustedTranslate.x,
					y: scrollAdjustedTranslate.y,
				},
				over,
			};
			unstable_batchedUpdates(() => {
				onDragMove == null ? void 0 : onDragMove(event);
				dispatchMonitorEvent({
					type: "onDragMove",
					event,
				});
			});
		}, // eslint-disable-next-line react-hooks/exhaustive-deps
		[scrollAdjustedTranslate.x, scrollAdjustedTranslate.y],
	);
	useEffect(
		() => {
			const { active, activatorEvent, collisions, droppableContainers, scrollAdjustedTranslate } = sensorContext.current;

			if (!active || activeRef.current == null || !activatorEvent || !scrollAdjustedTranslate) {
				return;
			}

			const { onDragOver } = latestProps.current;
			const overContainer = droppableContainers.get(overId);
			const over =
				overContainer && overContainer.rect.current ?
					{
						id: overContainer.id,
						rect: overContainer.rect.current,
						data: overContainer.data,
						disabled: overContainer.disabled,
					}
				:	null;
			const event = {
				active,
				activatorEvent,
				collisions,
				delta: {
					x: scrollAdjustedTranslate.x,
					y: scrollAdjustedTranslate.y,
				},
				over,
			};
			unstable_batchedUpdates(() => {
				setOver(over);
				onDragOver == null ? void 0 : onDragOver(event);
				dispatchMonitorEvent({
					type: "onDragOver",
					event,
				});
			});
		}, // eslint-disable-next-line react-hooks/exhaustive-deps
		[overId],
	);
	useIsomorphicLayoutEffect(() => {
		sensorContext.current = {
			activatorEvent,
			active,
			activeNode,
			collisionRect,
			collisions,
			droppableRects,
			draggableNodes,
			draggingNode,
			draggingNodeRect,
			droppableContainers,
			over,
			scrollableAncestors,
			scrollAdjustedTranslate,
		};
		activeRects.current = {
			initial: draggingNodeRect,
			translated: collisionRect,
		};
	}, [active, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]);
	useAutoScroller({ ...autoScrollOptions, delta: translate, draggingRect: collisionRect, pointerCoordinates, scrollableAncestors, scrollableAncestorRects });
	const publicContext = useMemo(() => {
		const context = {
			active,
			activeNode,
			activeNodeRect,
			activatorEvent,
			collisions,
			containerNodeRect,
			dragOverlay,
			draggableNodes,
			droppableContainers,
			droppableRects,
			over,
			measureDroppableContainers,
			scrollableAncestors,
			scrollableAncestorRects,
			measuringConfiguration,
			measuringScheduled,
			windowRect,
		};
		return context;
	}, [
		active,
		activeNode,
		activeNodeRect,
		activatorEvent,
		collisions,
		containerNodeRect,
		dragOverlay,
		draggableNodes,
		droppableContainers,
		droppableRects,
		over,
		measureDroppableContainers,
		scrollableAncestors,
		scrollableAncestorRects,
		measuringConfiguration,
		measuringScheduled,
		windowRect,
	]);
	const internalContext = useMemo(() => {
		const context = {
			activatorEvent,
			activators,
			active,
			activeNodeRect,
			ariaDescribedById: {
				draggable: draggableDescribedById,
			},
			dispatch,
			draggableNodes,
			over,
			measureDroppableContainers,
		};
		return context;
	}, [activatorEvent, activators, active, activeNodeRect, dispatch, draggableDescribedById, draggableNodes, over, measureDroppableContainers]);
	return React$2.createElement(
		DndMonitorContext.Provider,
		{
			value: registerMonitorListener,
		},
		React$2.createElement(
			InternalContext.Provider,
			{
				value: internalContext,
			},
			React$2.createElement(
				PublicContext.Provider,
				{
					value: publicContext,
				},
				React$2.createElement(
					ActiveDraggableContext.Provider,
					{
						value: transform,
					},
					children,
				),
			),
			React$2.createElement(RestoreFocus, {
				disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false,
			}),
		),
		React$2.createElement(Accessibility, { ...accessibility, hiddenTextDescribedById: draggableDescribedById }),
	);

	function getAutoScrollerOptions() {
		const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false;
		const autoScrollGloballyDisabled = typeof autoScroll === "object" ? autoScroll.enabled === false : autoScroll === false;
		const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled;

		if (typeof autoScroll === "object") {
			return { ...autoScroll, enabled };
		}

		return {
			enabled,
		};
	}
});

function useDndContext() {
	return useContext$1(PublicContext);
}

function AnimationManager(_ref) {
	let { animation, children } = _ref;
	const [clonedChildren, setClonedChildren] = useState(null);
	const [element, setElement] = useState(null);
	const previousChildren = usePrevious(children);

	if (!children && !clonedChildren && previousChildren) {
		setClonedChildren(previousChildren);
	}

	useIsomorphicLayoutEffect(() => {
		if (!element) {
			return;
		}

		const key = clonedChildren == null ? void 0 : clonedChildren.key;
		const id = clonedChildren == null ? void 0 : clonedChildren.props.id;

		if (key == null || id == null) {
			setClonedChildren(null);
			return;
		}

		Promise.resolve(animation(id, element)).then(() => {
			setClonedChildren(null);
		});
	}, [animation, clonedChildren, element]);
	return React$2.createElement(
		React$2.Fragment,
		null,
		children,
		clonedChildren ?
			cloneElement(clonedChildren, {
				ref: setElement,
			})
		:	null,
	);
}

const defaultTransform = {
	x: 0,
	y: 0,
	scaleX: 1,
	scaleY: 1,
};
function NullifiedContextProvider(_ref) {
	let { children } = _ref;
	return React$2.createElement(
		InternalContext.Provider,
		{
			value: defaultInternalContext,
		},
		React$2.createElement(
			ActiveDraggableContext.Provider,
			{
				value: defaultTransform,
			},
			children,
		),
	);
}

const baseStyles = {
	position: "fixed",
	touchAction: "none",
};

const defaultTransition = (activatorEvent) => {
	const isKeyboardActivator = isKeyboardEvent(activatorEvent);
	return isKeyboardActivator ? "transform 250ms ease" : undefined;
};

const PositionedOverlay = /*#__PURE__*/ forwardRef((_ref, ref) => {
	let { as, activatorEvent, adjustScale, children, className, rect, style, transform, transition = defaultTransition } = _ref;

	if (!rect) {
		return null;
	}

	const scaleAdjustedTransform = adjustScale ? transform : { ...transform, scaleX: 1, scaleY: 1 };
	const styles = {
		...baseStyles,
		width: rect.width,
		height: rect.height,
		top: rect.top,
		left: rect.left,
		transform: CSS.Transform.toString(scaleAdjustedTransform),
		transformOrigin: adjustScale && activatorEvent ? getRelativeTransformOrigin(activatorEvent, rect) : undefined,
		transition: typeof transition === "function" ? transition(activatorEvent) : transition,
		...style,
	};
	return React$2.createElement(
		as,
		{
			className,
			style: styles,
			ref,
		},
		children,
	);
});

const defaultDropAnimationSideEffects = (options) => (_ref) => {
	let { active, dragOverlay } = _ref;
	const originalStyles = {};
	const { styles, className } = options;

	if (styles != null && styles.active) {
		for (const [key, value] of Object.entries(styles.active)) {
			if (value === undefined) {
				continue;
			}

			originalStyles[key] = active.node.style.getPropertyValue(key);
			active.node.style.setProperty(key, value);
		}
	}

	if (styles != null && styles.dragOverlay) {
		for (const [key, value] of Object.entries(styles.dragOverlay)) {
			if (value === undefined) {
				continue;
			}

			dragOverlay.node.style.setProperty(key, value);
		}
	}

	if (className != null && className.active) {
		active.node.classList.add(className.active);
	}

	if (className != null && className.dragOverlay) {
		dragOverlay.node.classList.add(className.dragOverlay);
	}

	return function cleanup() {
		for (const [key, value] of Object.entries(originalStyles)) {
			active.node.style.setProperty(key, value);
		}

		if (className != null && className.active) {
			active.node.classList.remove(className.active);
		}
	};
};

const defaultKeyframeResolver = (_ref2) => {
	let {
		transform: { initial, final },
	} = _ref2;
	return [
		{
			transform: CSS.Transform.toString(initial),
		},
		{
			transform: CSS.Transform.toString(final),
		},
	];
};

const defaultDropAnimationConfiguration = {
	duration: 250,
	easing: "ease",
	keyframes: defaultKeyframeResolver,
	sideEffects: /*#__PURE__*/ defaultDropAnimationSideEffects({
		styles: {
			active: {
				opacity: "0",
			},
		},
	}),
};
function useDropAnimation(_ref3) {
	let { config, draggableNodes, droppableContainers, measuringConfiguration } = _ref3;
	return useEvent((id, node) => {
		if (config === null) {
			return;
		}

		const activeDraggable = draggableNodes.get(id);

		if (!activeDraggable) {
			return;
		}

		const activeNode = activeDraggable.node.current;

		if (!activeNode) {
			return;
		}

		const measurableNode = getMeasurableNode(node);

		if (!measurableNode) {
			return;
		}

		const { transform } = getWindow(node).getComputedStyle(node);
		const parsedTransform = parseTransform(transform);

		if (!parsedTransform) {
			return;
		}

		const animation = typeof config === "function" ? config : createDefaultDropAnimation(config);
		scrollIntoViewIfNeeded(activeNode, measuringConfiguration.draggable.measure);
		return animation({
			active: {
				id,
				data: activeDraggable.data,
				node: activeNode,
				rect: measuringConfiguration.draggable.measure(activeNode),
			},
			draggableNodes,
			dragOverlay: {
				node,
				rect: measuringConfiguration.dragOverlay.measure(measurableNode),
			},
			droppableContainers,
			measuringConfiguration,
			transform: parsedTransform,
		});
	});
}

function createDefaultDropAnimation(options) {
	const { duration, easing, sideEffects, keyframes } = { ...defaultDropAnimationConfiguration, ...options };
	return (_ref4) => {
		let { active, dragOverlay, transform, ...rest } = _ref4;

		if (!duration) {
			// Do not animate if animation duration is zero.
			return;
		}

		const delta = {
			x: dragOverlay.rect.left - active.rect.left,
			y: dragOverlay.rect.top - active.rect.top,
		};
		const scale = {
			scaleX: transform.scaleX !== 1 ? (active.rect.width * transform.scaleX) / dragOverlay.rect.width : 1,
			scaleY: transform.scaleY !== 1 ? (active.rect.height * transform.scaleY) / dragOverlay.rect.height : 1,
		};
		const finalTransform = {
			x: transform.x - delta.x,
			y: transform.y - delta.y,
			...scale,
		};
		const animationKeyframes = keyframes({
			...rest,
			active,
			dragOverlay,
			transform: {
				initial: transform,
				final: finalTransform,
			},
		});
		const [firstKeyframe] = animationKeyframes;
		const lastKeyframe = animationKeyframes[animationKeyframes.length - 1];

		if (JSON.stringify(firstKeyframe) === JSON.stringify(lastKeyframe)) {
			// The start and end keyframes are the same, infer that there is no animation needed.
			return;
		}

		const cleanup =
			sideEffects == null ? void 0 : (
				sideEffects({
					active,
					dragOverlay,
					...rest,
				})
			);
		const animation = dragOverlay.node.animate(animationKeyframes, {
			duration,
			easing,
			fill: "forwards",
		});
		return new Promise((resolve) => {
			animation.onfinish = () => {
				cleanup == null ? void 0 : cleanup();
				resolve();
			};
		});
	};
}

let key = 0;
function useKey(id) {
	return useMemo(() => {
		if (id == null) {
			return;
		}

		key++;
		return key;
	}, [id]);
}

const DragOverlay = /*#__PURE__*/ React$2.memo((_ref) => {
	let { adjustScale = false, children, dropAnimation: dropAnimationConfig, style, transition, modifiers, wrapperElement = "div", className, zIndex = 999 } = _ref;
	const {
		activatorEvent,
		active,
		activeNodeRect,
		containerNodeRect,
		draggableNodes,
		droppableContainers,
		dragOverlay,
		over,
		measuringConfiguration,
		scrollableAncestors,
		scrollableAncestorRects,
		windowRect,
	} = useDndContext();
	const transform = useContext$1(ActiveDraggableContext);
	const key = useKey(active == null ? void 0 : active.id);
	const modifiedTransform = applyModifiers(modifiers, {
		activatorEvent,
		active,
		activeNodeRect,
		containerNodeRect,
		draggingNodeRect: dragOverlay.rect,
		over,
		overlayNodeRect: dragOverlay.rect,
		scrollableAncestors,
		scrollableAncestorRects,
		transform,
		windowRect,
	});
	const initialRect = useInitialValue(activeNodeRect);
	const dropAnimation = useDropAnimation({
		config: dropAnimationConfig,
		draggableNodes,
		droppableContainers,
		measuringConfiguration,
	}); // We need to wait for the active node to be measured before connecting the drag overlay ref
	// otherwise collisions can be computed against a mispositioned drag overlay

	const ref = initialRect ? dragOverlay.setRef : undefined;
	return React$2.createElement(
		NullifiedContextProvider,
		null,
		React$2.createElement(
			AnimationManager,
			{
				animation: dropAnimation,
			},
			active && key ?
				React$2.createElement(
					PositionedOverlay,
					{
						key: key,
						id: active.id,
						ref: ref,
						as: wrapperElement,
						activatorEvent: activatorEvent,
						adjustScale: adjustScale,
						className: className,
						transition: transition,
						rect: initialRect,
						style: {
							zIndex,
							...style,
						},
						transform: modifiedTransform,
					},
					children,
				)
			:	null,
		),
	);
});

/**
 * table-core
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
function functionalUpdate(updater, input) {
	return typeof updater === "function" ? updater(input) : updater;
}
function makeStateUpdater(key, instance) {
	return (updater) => {
		instance.setState((old) => {
			return {
				...old,
				[key]: functionalUpdate(updater, old[key]),
			};
		});
	};
}
function isFunction(d) {
	return d instanceof Function;
}
function isNumberArray(d) {
	return Array.isArray(d) && d.every((val) => typeof val === "number");
}
function flattenBy(arr, getChildren) {
	const flat = [];
	const recurse = (subArr) => {
		subArr.forEach((item) => {
			flat.push(item);
			const children = getChildren(item);
			if (children != null && children.length) {
				recurse(children);
			}
		});
	};
	recurse(arr);
	return flat;
}
function memo(getDeps, fn, opts) {
	let deps = [];
	let result;
	return (depArgs) => {
		let depTime;
		if (opts.key && opts.debug) depTime = Date.now();
		const newDeps = getDeps(depArgs);
		const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
		if (!depsChanged) {
			return result;
		}
		deps = newDeps;
		let resultTime;
		if (opts.key && opts.debug) resultTime = Date.now();
		result = fn(...newDeps);
		opts == null || opts.onChange == null || opts.onChange(result);
		if (opts.key && opts.debug) {
			if (opts != null && opts.debug()) {
				const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
				const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
				const resultFpsPercentage = resultEndTime / 16;
				const pad = (str, num) => {
					str = String(str);
					while (str.length < num) {
						str = " " + str;
					}
					return str;
				};
				console.info(
					`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
					`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`,
					opts == null ? void 0 : opts.key,
				);
			}
		}
		return result;
	};
}
function getMemoOptions(tableOptions, debugLevel, key, onChange) {
	return {
		debug: () => {
			var _tableOptions$debugAl;
			return (_tableOptions$debugAl = tableOptions == null ? void 0 : tableOptions.debugAll) != null ? _tableOptions$debugAl : tableOptions[debugLevel];
		},
		key: false,
		onChange,
	};
}
function createCell(table, row, column, columnId) {
	const getRenderValue = () => {
		var _cell$getValue;
		return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue;
	};
	const cell = {
		id: `${row.id}_${column.id}`,
		row,
		column,
		getValue: () => row.getValue(columnId),
		renderValue: getRenderValue,
		getContext: memo(
			() => [table, column, row, cell],
			(table2, column2, row2, cell2) => ({
				table: table2,
				column: column2,
				row: row2,
				cell: cell2,
				getValue: cell2.getValue,
				renderValue: cell2.renderValue,
			}),
			getMemoOptions(table.options, "debugCells"),
		),
	};
	table._features.forEach((feature) => {
		feature.createCell == null || feature.createCell(cell, column, row, table);
	}, {});
	return cell;
}
function createColumn(table, columnDef, depth, parent) {
	var _ref, _resolvedColumnDef$id;
	const defaultColumn = table._getDefaultColumnDef();
	const resolvedColumnDef = {
		...defaultColumn,
		...columnDef,
	};
	const accessorKey = resolvedColumnDef.accessorKey;
	let id =
		(
			(_ref =
				(_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id
				: accessorKey ?
					typeof String.prototype.replaceAll === "function" ?
						accessorKey.replaceAll(".", "_")
					:	accessorKey.replace(/\./g, "_")
				:	void 0) != null
		) ?
			_ref
		: typeof resolvedColumnDef.header === "string" ? resolvedColumnDef.header
		: void 0;
	let accessorFn;
	if (resolvedColumnDef.accessorFn) {
		accessorFn = resolvedColumnDef.accessorFn;
	} else if (accessorKey) {
		if (accessorKey.includes(".")) {
			accessorFn = (originalRow) => {
				let result = originalRow;
				for (const key of accessorKey.split(".")) {
					var _result;
					result = (_result = result) == null ? void 0 : _result[key];
				}
				return result;
			};
		} else {
			accessorFn = (originalRow) => originalRow[resolvedColumnDef.accessorKey];
		}
	}
	if (!id) {
		throw new Error();
	}
	let column = {
		id: `${String(id)}`,
		accessorFn,
		parent,
		depth,
		columnDef: resolvedColumnDef,
		columns: [],
		getFlatColumns: memo(
			() => [true],
			() => {
				var _column$columns;
				return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap((d) => d.getFlatColumns()))];
			},
			getMemoOptions(table.options, "debugColumns"),
		),
		getLeafColumns: memo(
			() => [table._getOrderColumnsFn()],
			(orderColumns2) => {
				var _column$columns2;
				if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
					let leafColumns = column.columns.flatMap((column2) => column2.getLeafColumns());
					return orderColumns2(leafColumns);
				}
				return [column];
			},
			getMemoOptions(table.options, "debugColumns"),
		),
	};
	for (const feature of table._features) {
		feature.createColumn == null || feature.createColumn(column, table);
	}
	return column;
}
const debug = "debugHeaders";
function createHeader(table, column, options) {
	var _options$id;
	const id = (_options$id = options.id) != null ? _options$id : column.id;
	let header = {
		id,
		column,
		index: options.index,
		isPlaceholder: !!options.isPlaceholder,
		placeholderId: options.placeholderId,
		depth: options.depth,
		subHeaders: [],
		colSpan: 0,
		rowSpan: 0,
		headerGroup: null,
		getLeafHeaders: () => {
			const leafHeaders = [];
			const recurseHeader = (h) => {
				if (h.subHeaders && h.subHeaders.length) {
					h.subHeaders.map(recurseHeader);
				}
				leafHeaders.push(h);
			};
			recurseHeader(header);
			return leafHeaders;
		},
		getContext: () => ({
			table,
			header,
			column,
		}),
	};
	table._features.forEach((feature) => {
		feature.createHeader == null || feature.createHeader(header, table);
	});
	return header;
}
const Headers$1 = {
	createTable: (table) => {
		table.getHeaderGroups = memo(
			() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right],
			(allColumns, leafColumns, left, right) => {
				var _left$map$filter, _right$map$filter;
				const leftColumns = (_left$map$filter = left == null ? void 0 : left.map((columnId) => leafColumns.find((d) => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
				const rightColumns =
					(_right$map$filter = right == null ? void 0 : right.map((columnId) => leafColumns.find((d) => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
				const centerColumns = leafColumns.filter((column) => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
				const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
				return headerGroups;
			},
			getMemoOptions(table.options, debug),
		);
		table.getCenterHeaderGroups = memo(
			() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right],
			(allColumns, leafColumns, left, right) => {
				leafColumns = leafColumns.filter((column) => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
				return buildHeaderGroups(allColumns, leafColumns, table, "center");
			},
			getMemoOptions(table.options, debug),
		);
		table.getLeftHeaderGroups = memo(
			() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left],
			(allColumns, leafColumns, left) => {
				var _left$map$filter2;
				const orderedLeafColumns =
					(_left$map$filter2 = left == null ? void 0 : left.map((columnId) => leafColumns.find((d) => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
				return buildHeaderGroups(allColumns, orderedLeafColumns, table, "left");
			},
			getMemoOptions(table.options, debug),
		);
		table.getRightHeaderGroups = memo(
			() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right],
			(allColumns, leafColumns, right) => {
				var _right$map$filter2;
				const orderedLeafColumns =
					(_right$map$filter2 = right == null ? void 0 : right.map((columnId) => leafColumns.find((d) => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
				return buildHeaderGroups(allColumns, orderedLeafColumns, table, "right");
			},
			getMemoOptions(table.options, debug),
		);
		table.getFooterGroups = memo(
			() => [table.getHeaderGroups()],
			(headerGroups) => {
				return [...headerGroups].reverse();
			},
			getMemoOptions(table.options, debug),
		);
		table.getLeftFooterGroups = memo(
			() => [table.getLeftHeaderGroups()],
			(headerGroups) => {
				return [...headerGroups].reverse();
			},
			getMemoOptions(table.options, debug),
		);
		table.getCenterFooterGroups = memo(
			() => [table.getCenterHeaderGroups()],
			(headerGroups) => {
				return [...headerGroups].reverse();
			},
			getMemoOptions(table.options, debug),
		);
		table.getRightFooterGroups = memo(
			() => [table.getRightHeaderGroups()],
			(headerGroups) => {
				return [...headerGroups].reverse();
			},
			getMemoOptions(table.options, debug),
		);
		table.getFlatHeaders = memo(
			() => [table.getHeaderGroups()],
			(headerGroups) => {
				return headerGroups
					.map((headerGroup) => {
						return headerGroup.headers;
					})
					.flat();
			},
			getMemoOptions(table.options, debug),
		);
		table.getLeftFlatHeaders = memo(
			() => [table.getLeftHeaderGroups()],
			(left) => {
				return left
					.map((headerGroup) => {
						return headerGroup.headers;
					})
					.flat();
			},
			getMemoOptions(table.options, debug),
		);
		table.getCenterFlatHeaders = memo(
			() => [table.getCenterHeaderGroups()],
			(left) => {
				return left
					.map((headerGroup) => {
						return headerGroup.headers;
					})
					.flat();
			},
			getMemoOptions(table.options, debug),
		);
		table.getRightFlatHeaders = memo(
			() => [table.getRightHeaderGroups()],
			(left) => {
				return left
					.map((headerGroup) => {
						return headerGroup.headers;
					})
					.flat();
			},
			getMemoOptions(table.options, debug),
		);
		table.getCenterLeafHeaders = memo(
			() => [table.getCenterFlatHeaders()],
			(flatHeaders) => {
				return flatHeaders.filter((header) => {
					var _header$subHeaders;
					return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
				});
			},
			getMemoOptions(table.options, debug),
		);
		table.getLeftLeafHeaders = memo(
			() => [table.getLeftFlatHeaders()],
			(flatHeaders) => {
				return flatHeaders.filter((header) => {
					var _header$subHeaders2;
					return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
				});
			},
			getMemoOptions(table.options, debug),
		);
		table.getRightLeafHeaders = memo(
			() => [table.getRightFlatHeaders()],
			(flatHeaders) => {
				return flatHeaders.filter((header) => {
					var _header$subHeaders3;
					return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
				});
			},
			getMemoOptions(table.options, debug),
		);
		table.getLeafHeaders = memo(
			() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()],
			(left, center, right) => {
				var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
				return [
					...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []),
					...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []),
					...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : []),
				]
					.map((header) => {
						return header.getLeafHeaders();
					})
					.flat();
			},
			getMemoOptions(table.options, debug),
		);
	},
};
function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
	var _headerGroups$0$heade, _headerGroups$;
	let maxDepth = 0;
	const findMaxDepth = function (columns, depth) {
		if (depth === void 0) {
			depth = 1;
		}
		maxDepth = Math.max(maxDepth, depth);
		columns
			.filter((column) => column.getIsVisible())
			.forEach((column) => {
				var _column$columns;
				if ((_column$columns = column.columns) != null && _column$columns.length) {
					findMaxDepth(column.columns, depth + 1);
				}
			}, 0);
	};
	findMaxDepth(allColumns);
	let headerGroups = [];
	const createHeaderGroup = (headersToGroup, depth) => {
		const headerGroup = {
			depth,
			id: [headerFamily, `${depth}`].filter(Boolean).join("_"),
			headers: [],
		};
		const pendingParentHeaders = [];
		headersToGroup.forEach((headerToGroup) => {
			const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0];
			const isLeafHeader = headerToGroup.column.depth === headerGroup.depth;
			let column;
			let isPlaceholder = false;
			if (isLeafHeader && headerToGroup.column.parent) {
				column = headerToGroup.column.parent;
			} else {
				column = headerToGroup.column;
				isPlaceholder = true;
			}
			if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
				latestPendingParentHeader.subHeaders.push(headerToGroup);
			} else {
				const header = createHeader(table, column, {
					id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join("_"),
					isPlaceholder,
					placeholderId: isPlaceholder ? `${pendingParentHeaders.filter((d) => d.column === column).length}` : void 0,
					depth,
					index: pendingParentHeaders.length,
				});
				header.subHeaders.push(headerToGroup);
				pendingParentHeaders.push(header);
			}
			headerGroup.headers.push(headerToGroup);
			headerToGroup.headerGroup = headerGroup;
		});
		headerGroups.push(headerGroup);
		if (depth > 0) {
			createHeaderGroup(pendingParentHeaders, depth - 1);
		}
	};
	const bottomHeaders = columnsToGroup.map((column, index) =>
		createHeader(table, column, {
			depth: maxDepth,
			index,
		}),
	);
	createHeaderGroup(bottomHeaders, maxDepth - 1);
	headerGroups.reverse();
	const recurseHeadersForSpans = (headers) => {
		const filteredHeaders = headers.filter((header) => header.column.getIsVisible());
		return filteredHeaders.map((header) => {
			let colSpan = 0;
			let rowSpan = 0;
			let childRowSpans = [0];
			if (header.subHeaders && header.subHeaders.length) {
				childRowSpans = [];
				recurseHeadersForSpans(header.subHeaders).forEach((_ref) => {
					let { colSpan: childColSpan, rowSpan: childRowSpan } = _ref;
					colSpan += childColSpan;
					childRowSpans.push(childRowSpan);
				});
			} else {
				colSpan = 1;
			}
			const minChildRowSpan = Math.min(...childRowSpans);
			rowSpan = rowSpan + minChildRowSpan;
			header.colSpan = colSpan;
			header.rowSpan = rowSpan;
			return {
				colSpan,
				rowSpan,
			};
		});
	};
	recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
	return headerGroups;
}
const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
	let row = {
		id,
		index: rowIndex,
		original,
		depth,
		parentId,
		_valuesCache: {},
		_uniqueValuesCache: {},
		getValue: (columnId) => {
			if (row._valuesCache.hasOwnProperty(columnId)) {
				return row._valuesCache[columnId];
			}
			const column = table.getColumn(columnId);
			if (!(column != null && column.accessorFn)) {
				return void 0;
			}
			row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
			return row._valuesCache[columnId];
		},
		getUniqueValues: (columnId) => {
			if (row._uniqueValuesCache.hasOwnProperty(columnId)) {
				return row._uniqueValuesCache[columnId];
			}
			const column = table.getColumn(columnId);
			if (!(column != null && column.accessorFn)) {
				return void 0;
			}
			if (!column.columnDef.getUniqueValues) {
				row._uniqueValuesCache[columnId] = [row.getValue(columnId)];
				return row._uniqueValuesCache[columnId];
			}
			row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex);
			return row._uniqueValuesCache[columnId];
		},
		renderValue: (columnId) => {
			var _row$getValue;
			return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
		},
		subRows: [],
		getLeafRows: () => flattenBy(row.subRows, (d) => d.subRows),
		getParentRow: () => (row.parentId ? table.getRow(row.parentId, true) : void 0),
		getParentRows: () => {
			let parentRows = [];
			let currentRow = row;
			while (true) {
				const parentRow = currentRow.getParentRow();
				if (!parentRow) break;
				parentRows.push(parentRow);
				currentRow = parentRow;
			}
			return parentRows.reverse();
		},
		getAllCells: memo(
			() => [table.getAllLeafColumns()],
			(leafColumns) => {
				return leafColumns.map((column) => {
					return createCell(table, row, column, column.id);
				});
			},
			getMemoOptions(table.options, "debugRows"),
		),
		_getAllCellsByColumnId: memo(
			() => [row.getAllCells()],
			(allCells) => {
				return allCells.reduce((acc, cell) => {
					acc[cell.column.id] = cell;
					return acc;
				}, {});
			},
			getMemoOptions(table.options, "debugRows"),
		),
	};
	for (let i = 0; i < table._features.length; i++) {
		const feature = table._features[i];
		feature == null || feature.createRow == null || feature.createRow(row, table);
	}
	return row;
};
const ColumnFaceting = {
	createColumn: (column, table) => {
		column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id);
		column.getFacetedRowModel = () => {
			if (!column._getFacetedRowModel) {
				return table.getPreFilteredRowModel();
			}
			return column._getFacetedRowModel();
		};
		column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id);
		column.getFacetedUniqueValues = () => {
			if (!column._getFacetedUniqueValues) {
				return /* @__PURE__ */ new Map();
			}
			return column._getFacetedUniqueValues();
		};
		column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id);
		column.getFacetedMinMaxValues = () => {
			if (!column._getFacetedMinMaxValues) {
				return void 0;
			}
			return column._getFacetedMinMaxValues();
		};
	},
};
const includesString = (row, columnId, filterValue) => {
	var _filterValue$toString, _row$getValue;
	const search = filterValue == null || (_filterValue$toString = filterValue.toString()) == null ? void 0 : _filterValue$toString.toLowerCase();
	return Boolean(
		(_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ?
			void 0
		:	_row$getValue.includes(search),
	);
};
includesString.autoRemove = (val) => testFalsey(val);
const includesStringSensitive = (row, columnId, filterValue) => {
	var _row$getValue2;
	return Boolean((_row$getValue2 = row.getValue(columnId)) == null || (_row$getValue2 = _row$getValue2.toString()) == null ? void 0 : _row$getValue2.includes(filterValue));
};
includesStringSensitive.autoRemove = (val) => testFalsey(val);
const equalsString = (row, columnId, filterValue) => {
	var _row$getValue3;
	return (
		((_row$getValue3 = row.getValue(columnId)) == null || (_row$getValue3 = _row$getValue3.toString()) == null ? void 0 : _row$getValue3.toLowerCase()) ===
		(filterValue == null ? void 0 : filterValue.toLowerCase())
	);
};
equalsString.autoRemove = (val) => testFalsey(val);
const arrIncludes = (row, columnId, filterValue) => {
	var _row$getValue4;
	return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);
};
arrIncludes.autoRemove = (val) => testFalsey(val);
const arrIncludesAll = (row, columnId, filterValue) => {
	return !filterValue.some((val) => {
		var _row$getValue5;
		return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));
	});
};
arrIncludesAll.autoRemove = (val) => testFalsey(val) || !(val != null && val.length);
const arrIncludesSome = (row, columnId, filterValue) => {
	return filterValue.some((val) => {
		var _row$getValue6;
		return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);
	});
};
arrIncludesSome.autoRemove = (val) => testFalsey(val) || !(val != null && val.length);
const equals = (row, columnId, filterValue) => {
	return row.getValue(columnId) === filterValue;
};
equals.autoRemove = (val) => testFalsey(val);
const weakEquals = (row, columnId, filterValue) => {
	return row.getValue(columnId) == filterValue;
};
weakEquals.autoRemove = (val) => testFalsey(val);
const inNumberRange = (row, columnId, filterValue) => {
	let [min2, max2] = filterValue;
	const rowValue = row.getValue(columnId);
	return rowValue >= min2 && rowValue <= max2;
};
inNumberRange.resolveFilterValue = (val) => {
	let [unsafeMin, unsafeMax] = val;
	let parsedMin = typeof unsafeMin !== "number" ? parseFloat(unsafeMin) : unsafeMin;
	let parsedMax = typeof unsafeMax !== "number" ? parseFloat(unsafeMax) : unsafeMax;
	let min2 = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin;
	let max2 = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax;
	if (min2 > max2) {
		const temp = min2;
		min2 = max2;
		max2 = temp;
	}
	return [min2, max2];
};
inNumberRange.autoRemove = (val) => testFalsey(val) || (testFalsey(val[0]) && testFalsey(val[1]));
const filterFns = {
	includesString,
	includesStringSensitive,
	equalsString,
	arrIncludes,
	arrIncludesAll,
	arrIncludesSome,
	equals,
	weakEquals,
	inNumberRange,
};
function testFalsey(val) {
	return val === void 0 || val === null || val === "";
}
const ColumnFiltering = {
	getDefaultColumnDef: () => {
		return {
			filterFn: "auto",
		};
	},
	getInitialState: (state) => {
		return {
			columnFilters: [],
			...state,
		};
	},
	getDefaultOptions: (table) => {
		return {
			onColumnFiltersChange: makeStateUpdater("columnFilters", table),
			filterFromLeafRows: false,
			maxLeafRowFilterDepth: 100,
		};
	},
	createColumn: (column, table) => {
		column.getAutoFilterFn = () => {
			const firstRow = table.getCoreRowModel().flatRows[0];
			const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
			if (typeof value === "string") {
				return filterFns.includesString;
			}
			if (typeof value === "number") {
				return filterFns.inNumberRange;
			}
			if (typeof value === "boolean") {
				return filterFns.equals;
			}
			if (value !== null && typeof value === "object") {
				return filterFns.equals;
			}
			if (Array.isArray(value)) {
				return filterFns.arrIncludes;
			}
			return filterFns.weakEquals;
		};
		column.getFilterFn = () => {
			var _table$options$filter, _table$options$filter2;
			return (
				isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn
				: column.columnDef.filterFn === "auto" ? column.getAutoFilterFn()
					// @ts-ignore
				: (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter
				: filterFns[column.columnDef.filterFn]
			);
		};
		column.getCanFilter = () => {
			var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
			return (
				((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) &&
				((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) &&
				((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) &&
				!!column.accessorFn
			);
		};
		column.getIsFiltered = () => column.getFilterIndex() > -1;
		column.getFilterValue = () => {
			var _table$getState$colum;
			return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find((d) => d.id === column.id)) == null ?
					void 0
				:	_table$getState$colum.value;
		};
		column.getFilterIndex = () => {
			var _table$getState$colum2, _table$getState$colum3;
			return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex((d) => d.id === column.id)) != null ?
					_table$getState$colum2
				:	-1;
		};
		column.setFilterValue = (value) => {
			table.setColumnFilters((old) => {
				const filterFn = column.getFilterFn();
				const previousFilter = old == null ? void 0 : old.find((d) => d.id === column.id);
				const newFilter = functionalUpdate(value, previousFilter ? previousFilter.value : void 0);
				if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {
					var _old$filter;
					return (_old$filter = old == null ? void 0 : old.filter((d) => d.id !== column.id)) != null ? _old$filter : [];
				}
				const newFilterObj = {
					id: column.id,
					value: newFilter,
				};
				if (previousFilter) {
					var _old$map;
					return (
							(_old$map =
								old == null ? void 0 : (
									old.map((d) => {
										if (d.id === column.id) {
											return newFilterObj;
										}
										return d;
									})
								)) != null
						) ?
							_old$map
						:	[];
				}
				if (old != null && old.length) {
					return [...old, newFilterObj];
				}
				return [newFilterObj];
			});
		};
	},
	createRow: (row, _table) => {
		row.columnFilters = {};
		row.columnFiltersMeta = {};
	},
	createTable: (table) => {
		table.setColumnFilters = (updater) => {
			const leafColumns = table.getAllLeafColumns();
			const updateFn = (old) => {
				var _functionalUpdate;
				return (_functionalUpdate = functionalUpdate(updater, old)) == null ?
						void 0
					:	_functionalUpdate.filter((filter) => {
							const column = leafColumns.find((d) => d.id === filter.id);
							if (column) {
								const filterFn = column.getFilterFn();
								if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {
									return false;
								}
							}
							return true;
						});
			};
			table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn);
		};
		table.resetColumnFilters = (defaultState) => {
			var _table$initialState$c, _table$initialState;
			table.setColumnFilters(
				defaultState ? []
				: (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c
				: [],
			);
		};
		table.getPreFilteredRowModel = () => table.getCoreRowModel();
		table.getFilteredRowModel = () => {
			if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {
				table._getFilteredRowModel = table.options.getFilteredRowModel(table);
			}
			if (table.options.manualFiltering || !table._getFilteredRowModel) {
				return table.getPreFilteredRowModel();
			}
			return table._getFilteredRowModel();
		};
	},
};
function shouldAutoRemoveFilter(filterFn, value, column) {
	return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === "undefined" || (typeof value === "string" && !value);
}
const sum = (columnId, _leafRows, childRows) => {
	return childRows.reduce((sum2, next) => {
		const nextValue = next.getValue(columnId);
		return sum2 + (typeof nextValue === "number" ? nextValue : 0);
	}, 0);
};
const min = (columnId, _leafRows, childRows) => {
	let min2;
	childRows.forEach((row) => {
		const value = row.getValue(columnId);
		if (value != null && (min2 > value || (min2 === void 0 && value >= value))) {
			min2 = value;
		}
	});
	return min2;
};
const max = (columnId, _leafRows, childRows) => {
	let max2;
	childRows.forEach((row) => {
		const value = row.getValue(columnId);
		if (value != null && (max2 < value || (max2 === void 0 && value >= value))) {
			max2 = value;
		}
	});
	return max2;
};
const extent = (columnId, _leafRows, childRows) => {
	let min2;
	let max2;
	childRows.forEach((row) => {
		const value = row.getValue(columnId);
		if (value != null) {
			if (min2 === void 0) {
				if (value >= value) min2 = max2 = value;
			} else {
				if (min2 > value) min2 = value;
				if (max2 < value) max2 = value;
			}
		}
	});
	return [min2, max2];
};
const mean = (columnId, leafRows) => {
	let count2 = 0;
	let sum2 = 0;
	leafRows.forEach((row) => {
		let value = row.getValue(columnId);
		if (value != null && (value = +value) >= value) {
			(++count2, (sum2 += value));
		}
	});
	if (count2) return sum2 / count2;
	return;
};
const median = (columnId, leafRows) => {
	if (!leafRows.length) {
		return;
	}
	const values = leafRows.map((row) => row.getValue(columnId));
	if (!isNumberArray(values)) {
		return;
	}
	if (values.length === 1) {
		return values[0];
	}
	const mid = Math.floor(values.length / 2);
	const nums = values.sort((a, b) => a - b);
	return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2;
};
const unique = (columnId, leafRows) => {
	return Array.from(new Set(leafRows.map((d) => d.getValue(columnId))).values());
};
const uniqueCount = (columnId, leafRows) => {
	return new Set(leafRows.map((d) => d.getValue(columnId))).size;
};
const count = (_columnId, leafRows) => {
	return leafRows.length;
};
const aggregationFns = {
	sum,
	min,
	max,
	extent,
	mean,
	median,
	unique,
	uniqueCount,
	count,
};
const ColumnGrouping = {
	getDefaultColumnDef: () => {
		return {
			aggregatedCell: (props) => {
				var _toString, _props$getValue;
				return (_toString = (_props$getValue = props.getValue()) == null || _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;
			},
			aggregationFn: "auto",
		};
	},
	getInitialState: (state) => {
		return {
			grouping: [],
			...state,
		};
	},
	getDefaultOptions: (table) => {
		return {
			onGroupingChange: makeStateUpdater("grouping", table),
			groupedColumnMode: "reorder",
		};
	},
	createColumn: (column, table) => {
		column.toggleGrouping = () => {
			table.setGrouping((old) => {
				if (old != null && old.includes(column.id)) {
					return old.filter((d) => d !== column.id);
				}
				return [...(old != null ? old : []), column.id];
			});
		};
		column.getCanGroup = () => {
			var _column$columnDef$ena, _table$options$enable;
			return (
				((_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) &&
				((_table$options$enable = table.options.enableGrouping) != null ? _table$options$enable : true) &&
				(!!column.accessorFn || !!column.columnDef.getGroupingValue)
			);
		};
		column.getIsGrouped = () => {
			var _table$getState$group;
			return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
		};
		column.getGroupedIndex = () => {
			var _table$getState$group2;
			return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
		};
		column.getToggleGroupingHandler = () => {
			const canGroup = column.getCanGroup();
			return () => {
				if (!canGroup) return;
				column.toggleGrouping();
			};
		};
		column.getAutoAggregationFn = () => {
			const firstRow = table.getCoreRowModel().flatRows[0];
			const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
			if (typeof value === "number") {
				return aggregationFns.sum;
			}
			if (Object.prototype.toString.call(value) === "[object Date]") {
				return aggregationFns.extent;
			}
		};
		column.getAggregationFn = () => {
			var _table$options$aggreg, _table$options$aggreg2;
			if (!column) {
				throw new Error();
			}
			return (
				isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn
				: column.columnDef.aggregationFn === "auto" ? column.getAutoAggregationFn()
				: (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ?
					_table$options$aggreg
				:	aggregationFns[column.columnDef.aggregationFn]
			);
		};
	},
	createTable: (table) => {
		table.setGrouping = (updater) => (table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater));
		table.resetGrouping = (defaultState) => {
			var _table$initialState$g, _table$initialState;
			table.setGrouping(
				defaultState ? []
				: (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g
				: [],
			);
		};
		table.getPreGroupedRowModel = () => table.getFilteredRowModel();
		table.getGroupedRowModel = () => {
			if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
				table._getGroupedRowModel = table.options.getGroupedRowModel(table);
			}
			if (table.options.manualGrouping || !table._getGroupedRowModel) {
				return table.getPreGroupedRowModel();
			}
			return table._getGroupedRowModel();
		};
	},
	createRow: (row, table) => {
		row.getIsGrouped = () => !!row.groupingColumnId;
		row.getGroupingValue = (columnId) => {
			if (row._groupingValuesCache.hasOwnProperty(columnId)) {
				return row._groupingValuesCache[columnId];
			}
			const column = table.getColumn(columnId);
			if (!(column != null && column.columnDef.getGroupingValue)) {
				return row.getValue(columnId);
			}
			row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original);
			return row._groupingValuesCache[columnId];
		};
		row._groupingValuesCache = {};
	},
	createCell: (cell, column, row, table) => {
		cell.getIsGrouped = () => column.getIsGrouped() && column.id === row.groupingColumnId;
		cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped();
		cell.getIsAggregated = () => {
			var _row$subRows;
			return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
		};
	},
};
function orderColumns(leafColumns, grouping, groupedColumnMode) {
	if (!(grouping != null && grouping.length) || !groupedColumnMode) {
		return leafColumns;
	}
	const nonGroupingColumns = leafColumns.filter((col) => !grouping.includes(col.id));
	if (groupedColumnMode === "remove") {
		return nonGroupingColumns;
	}
	const groupingColumns = grouping.map((g) => leafColumns.find((col) => col.id === g)).filter(Boolean);
	return [...groupingColumns, ...nonGroupingColumns];
}
const ColumnOrdering = {
	getInitialState: (state) => {
		return {
			columnOrder: [],
			...state,
		};
	},
	getDefaultOptions: (table) => {
		return {
			onColumnOrderChange: makeStateUpdater("columnOrder", table),
		};
	},
	createColumn: (column, table) => {
		column.getIndex = memo(
			(position) => [_getVisibleLeafColumns(table, position)],
			(columns) => columns.findIndex((d) => d.id === column.id),
			getMemoOptions(table.options, "debugColumns"),
		);
		column.getIsFirstColumn = (position) => {
			var _columns$;
			const columns = _getVisibleLeafColumns(table, position);
			return ((_columns$ = columns[0]) == null ? void 0 : _columns$.id) === column.id;
		};
		column.getIsLastColumn = (position) => {
			var _columns;
			const columns = _getVisibleLeafColumns(table, position);
			return ((_columns = columns[columns.length - 1]) == null ? void 0 : _columns.id) === column.id;
		};
	},
	createTable: (table) => {
		table.setColumnOrder = (updater) => (table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater));
		table.resetColumnOrder = (defaultState) => {
			var _table$initialState$c;
			table.setColumnOrder(
				defaultState ? []
				: (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c
				: [],
			);
		};
		table._getOrderColumnsFn = memo(
			() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode],
			(columnOrder, grouping, groupedColumnMode) => (columns) => {
				let orderedColumns = [];
				if (!(columnOrder != null && columnOrder.length)) {
					orderedColumns = columns;
				} else {
					const columnOrderCopy = [...columnOrder];
					const columnsCopy = [...columns];
					while (columnsCopy.length && columnOrderCopy.length) {
						const targetColumnId = columnOrderCopy.shift();
						const foundIndex = columnsCopy.findIndex((d) => d.id === targetColumnId);
						if (foundIndex > -1) {
							orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]);
						}
					}
					orderedColumns = [...orderedColumns, ...columnsCopy];
				}
				return orderColumns(orderedColumns, grouping, groupedColumnMode);
			},
			getMemoOptions(table.options, "debugTable"),
		);
	},
};
const getDefaultColumnPinningState = () => ({
	left: [],
	right: [],
});
const ColumnPinning = {
	getInitialState: (state) => {
		return {
			columnPinning: getDefaultColumnPinningState(),
			...state,
		};
	},
	getDefaultOptions: (table) => {
		return {
			onColumnPinningChange: makeStateUpdater("columnPinning", table),
		};
	},
	createColumn: (column, table) => {
		column.pin = (position) => {
			const columnIds = column
				.getLeafColumns()
				.map((d) => d.id)
				.filter(Boolean);
			table.setColumnPinning((old) => {
				var _old$left3, _old$right3;
				if (position === "right") {
					var _old$left, _old$right;
					return {
						left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter((d) => !(columnIds != null && columnIds.includes(d))),
						right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter((d) => !(columnIds != null && columnIds.includes(d))), ...columnIds],
					};
				}
				if (position === "left") {
					var _old$left2, _old$right2;
					return {
						left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter((d) => !(columnIds != null && columnIds.includes(d))), ...columnIds],
						right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter((d) => !(columnIds != null && columnIds.includes(d))),
					};
				}
				return {
					left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter((d) => !(columnIds != null && columnIds.includes(d))),
					right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter((d) => !(columnIds != null && columnIds.includes(d))),
				};
			});
		};
		column.getCanPin = () => {
			const leafColumns = column.getLeafColumns();
			return leafColumns.some((d) => {
				var _d$columnDef$enablePi, _ref, _table$options$enable;
				return (
					((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) &&
					((_ref = (_table$options$enable = table.options.enableColumnPinning) != null ? _table$options$enable : table.options.enablePinning) != null ? _ref : true)
				);
			});
		};
		column.getIsPinned = () => {
			const leafColumnIds = column.getLeafColumns().map((d) => d.id);
			const { left, right } = table.getState().columnPinning;
			const isLeft = leafColumnIds.some((d) => (left == null ? void 0 : left.includes(d)));
			const isRight = leafColumnIds.some((d) => (right == null ? void 0 : right.includes(d)));
			return (
				isLeft ? "left"
				: isRight ? "right"
				: false
			);
		};
		column.getPinnedIndex = () => {
			var _table$getState$colum, _table$getState$colum2;
			const position = column.getIsPinned();
			return (
				position ?
					(
						(_table$getState$colum =
							(_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ?
								void 0
							:	_table$getState$colum2.indexOf(column.id)) != null
					) ?
						_table$getState$colum
					:	-1
				:	0
			);
		};
	},
	createRow: (row, table) => {
		row.getCenterVisibleCells = memo(
			() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right],
			(allCells, left, right) => {
				const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
				return allCells.filter((d) => !leftAndRight.includes(d.column.id));
			},
			getMemoOptions(table.options, "debugRows"),
		);
		row.getLeftVisibleCells = memo(
			() => [row._getAllVisibleCells(), table.getState().columnPinning.left],
			(allCells, left) => {
				const cells = (left != null ? left : [])
					.map((columnId) => allCells.find((cell) => cell.column.id === columnId))
					.filter(Boolean)
					.map((d) => ({
						...d,
						position: "left",
					}));
				return cells;
			},
			getMemoOptions(table.options, "debugRows"),
		);
		row.getRightVisibleCells = memo(
			() => [row._getAllVisibleCells(), table.getState().columnPinning.right],
			(allCells, right) => {
				const cells = (right != null ? right : [])
					.map((columnId) => allCells.find((cell) => cell.column.id === columnId))
					.filter(Boolean)
					.map((d) => ({
						...d,
						position: "right",
					}));
				return cells;
			},
			getMemoOptions(table.options, "debugRows"),
		);
	},
	createTable: (table) => {
		table.setColumnPinning = (updater) => (table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater));
		table.resetColumnPinning = (defaultState) => {
			var _table$initialState$c, _table$initialState;
			return table.setColumnPinning(
				defaultState ? getDefaultColumnPinningState()
				: (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c
				: getDefaultColumnPinningState(),
			);
		};
		table.getIsSomeColumnsPinned = (position) => {
			var _pinningState$positio;
			const pinningState = table.getState().columnPinning;
			if (!position) {
				var _pinningState$left, _pinningState$right;
				return Boolean(
					((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) ||
					((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length),
				);
			}
			return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
		};
		table.getLeftLeafColumns = memo(
			() => [table.getAllLeafColumns(), table.getState().columnPinning.left],
			(allColumns, left) => {
				return (left != null ? left : []).map((columnId) => allColumns.find((column) => column.id === columnId)).filter(Boolean);
			},
			getMemoOptions(table.options, "debugColumns"),
		);
		table.getRightLeafColumns = memo(
			() => [table.getAllLeafColumns(), table.getState().columnPinning.right],
			(allColumns, right) => {
				return (right != null ? right : []).map((columnId) => allColumns.find((column) => column.id === columnId)).filter(Boolean);
			},
			getMemoOptions(table.options, "debugColumns"),
		);
		table.getCenterLeafColumns = memo(
			() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right],
			(allColumns, left, right) => {
				const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
				return allColumns.filter((d) => !leftAndRight.includes(d.id));
			},
			getMemoOptions(table.options, "debugColumns"),
		);
	},
};
function safelyAccessDocument(_document) {
	return _document || (typeof document !== "undefined" ? document : null);
}
const defaultColumnSizing = {
	size: 150,
	minSize: 20,
	maxSize: Number.MAX_SAFE_INTEGER,
};
const getDefaultColumnSizingInfoState = () => ({
	startOffset: null,
	startSize: null,
	deltaOffset: null,
	deltaPercentage: null,
	isResizingColumn: false,
	columnSizingStart: [],
});
const ColumnSizing = {
	getDefaultColumnDef: () => {
		return defaultColumnSizing;
	},
	getInitialState: (state) => {
		return {
			columnSizing: {},
			columnSizingInfo: getDefaultColumnSizingInfoState(),
			...state,
		};
	},
	getDefaultOptions: (table) => {
		return {
			columnResizeMode: "onEnd",
			columnResizeDirection: "ltr",
			onColumnSizingChange: makeStateUpdater("columnSizing", table),
			onColumnSizingInfoChange: makeStateUpdater("columnSizingInfo", table),
		};
	},
	createColumn: (column, table) => {
		column.getSize = () => {
			var _column$columnDef$min, _ref, _column$columnDef$max;
			const columnSize = table.getState().columnSizing[column.id];
			return Math.min(
				Math.max(
					(_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize,
					(_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size,
				),
				(_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize,
			);
		};
		column.getStart = memo(
			(position) => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing],
			(position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum2, column2) => sum2 + column2.getSize(), 0),
			getMemoOptions(table.options, "debugColumns"),
		);
		column.getAfter = memo(
			(position) => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing],
			(position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum2, column2) => sum2 + column2.getSize(), 0),
			getMemoOptions(table.options, "debugColumns"),
		);
		column.resetSize = () => {
			table.setColumnSizing((_ref2) => {
				let { [column.id]: _, ...rest } = _ref2;
				return rest;
			});
		};
		column.getCanResize = () => {
			var _column$columnDef$ena, _table$options$enable;
			return (
				((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) &&
				((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true)
			);
		};
		column.getIsResizing = () => {
			return table.getState().columnSizingInfo.isResizingColumn === column.id;
		};
	},
	createHeader: (header, table) => {
		header.getSize = () => {
			let sum2 = 0;
			const recurse = (header2) => {
				if (header2.subHeaders.length) {
					header2.subHeaders.forEach(recurse);
				} else {
					var _header$column$getSiz;
					sum2 += (_header$column$getSiz = header2.column.getSize()) != null ? _header$column$getSiz : 0;
				}
			};
			recurse(header);
			return sum2;
		};
		header.getStart = () => {
			if (header.index > 0) {
				const prevSiblingHeader = header.headerGroup.headers[header.index - 1];
				return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();
			}
			return 0;
		};
		header.getResizeHandler = (_contextDocument) => {
			const column = table.getColumn(header.column.id);
			const canResize = column == null ? void 0 : column.getCanResize();
			return (e) => {
				if (!column || !canResize) {
					return;
				}
				e.persist == null || e.persist();
				if (isTouchStartEvent(e)) {
					if (e.touches && e.touches.length > 1) {
						return;
					}
				}
				const startSize = header.getSize();
				const columnSizingStart = header ? header.getLeafHeaders().map((d) => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]];
				const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
				const newColumnSizing = {};
				const updateOffset = (eventType, clientXPos) => {
					if (typeof clientXPos !== "number") {
						return;
					}
					table.setColumnSizingInfo((old) => {
						var _old$startOffset, _old$startSize;
						const deltaDirection = table.options.columnResizeDirection === "rtl" ? -1 : 1;
						const deltaOffset = (clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0)) * deltaDirection;
						const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
						old.columnSizingStart.forEach((_ref3) => {
							let [columnId, headerSize] = _ref3;
							newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;
						});
						return {
							...old,
							deltaOffset,
							deltaPercentage,
						};
					});
					if (table.options.columnResizeMode === "onChange" || eventType === "end") {
						table.setColumnSizing((old) => ({
							...old,
							...newColumnSizing,
						}));
					}
				};
				const onMove = (clientXPos) => updateOffset("move", clientXPos);
				const onEnd = (clientXPos) => {
					updateOffset("end", clientXPos);
					table.setColumnSizingInfo((old) => ({
						...old,
						isResizingColumn: false,
						startOffset: null,
						startSize: null,
						deltaOffset: null,
						deltaPercentage: null,
						columnSizingStart: [],
					}));
				};
				const contextDocument = safelyAccessDocument(_contextDocument);
				const mouseEvents = {
					moveHandler: (e2) => onMove(e2.clientX),
					upHandler: (e2) => {
						contextDocument == null || contextDocument.removeEventListener("mousemove", mouseEvents.moveHandler);
						contextDocument == null || contextDocument.removeEventListener("mouseup", mouseEvents.upHandler);
						onEnd(e2.clientX);
					},
				};
				const touchEvents = {
					moveHandler: (e2) => {
						if (e2.cancelable) {
							e2.preventDefault();
							e2.stopPropagation();
						}
						onMove(e2.touches[0].clientX);
						return false;
					},
					upHandler: (e2) => {
						var _e$touches$;
						contextDocument == null || contextDocument.removeEventListener("touchmove", touchEvents.moveHandler);
						contextDocument == null || contextDocument.removeEventListener("touchend", touchEvents.upHandler);
						if (e2.cancelable) {
							e2.preventDefault();
							e2.stopPropagation();
						}
						onEnd((_e$touches$ = e2.touches[0]) == null ? void 0 : _e$touches$.clientX);
					},
				};
				const passiveIfSupported =
					passiveEventSupported() ?
						{
							passive: false,
						}
					:	false;
				if (isTouchStartEvent(e)) {
					contextDocument == null || contextDocument.addEventListener("touchmove", touchEvents.moveHandler, passiveIfSupported);
					contextDocument == null || contextDocument.addEventListener("touchend", touchEvents.upHandler, passiveIfSupported);
				} else {
					contextDocument == null || contextDocument.addEventListener("mousemove", mouseEvents.moveHandler, passiveIfSupported);
					contextDocument == null || contextDocument.addEventListener("mouseup", mouseEvents.upHandler, passiveIfSupported);
				}
				table.setColumnSizingInfo((old) => ({
					...old,
					startOffset: clientX,
					startSize,
					deltaOffset: 0,
					deltaPercentage: 0,
					columnSizingStart,
					isResizingColumn: column.id,
				}));
			};
		};
	},
	createTable: (table) => {
		table.setColumnSizing = (updater) => (table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater));
		table.setColumnSizingInfo = (updater) => (table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater));
		table.resetColumnSizing = (defaultState) => {
			var _table$initialState$c;
			table.setColumnSizing(
				defaultState ? {}
				: (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c
				: {},
			);
		};
		table.resetHeaderSizeInfo = (defaultState) => {
			var _table$initialState$c2;
			table.setColumnSizingInfo(
				defaultState ? getDefaultColumnSizingInfoState()
				: (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2
				: getDefaultColumnSizingInfoState(),
			);
		};
		table.getTotalSize = () => {
			var _table$getHeaderGroup, _table$getHeaderGroup2;
			return (
					(_table$getHeaderGroup =
						(_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ?
							void 0
						:	_table$getHeaderGroup2.headers.reduce((sum2, header) => {
								return sum2 + header.getSize();
							}, 0)) != null
				) ?
					_table$getHeaderGroup
				:	0;
		};
		table.getLeftTotalSize = () => {
			var _table$getLeftHeaderG, _table$getLeftHeaderG2;
			return (
					(_table$getLeftHeaderG =
						(_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ?
							void 0
						:	_table$getLeftHeaderG2.headers.reduce((sum2, header) => {
								return sum2 + header.getSize();
							}, 0)) != null
				) ?
					_table$getLeftHeaderG
				:	0;
		};
		table.getCenterTotalSize = () => {
			var _table$getCenterHeade, _table$getCenterHeade2;
			return (
					(_table$getCenterHeade =
						(_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ?
							void 0
						:	_table$getCenterHeade2.headers.reduce((sum2, header) => {
								return sum2 + header.getSize();
							}, 0)) != null
				) ?
					_table$getCenterHeade
				:	0;
		};
		table.getRightTotalSize = () => {
			var _table$getRightHeader, _table$getRightHeader2;
			return (
					(_table$getRightHeader =
						(_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ?
							void 0
						:	_table$getRightHeader2.headers.reduce((sum2, header) => {
								return sum2 + header.getSize();
							}, 0)) != null
				) ?
					_table$getRightHeader
				:	0;
		};
	},
};
let passiveSupported = null;
function passiveEventSupported() {
	if (typeof passiveSupported === "boolean") return passiveSupported;
	let supported = false;
	try {
		const options = {
			get passive() {
				supported = true;
				return false;
			},
		};
		const noop2 = () => {};
		window.addEventListener("test", noop2, options);
		window.removeEventListener("test", noop2);
	} catch (err) {
		supported = false;
	}
	passiveSupported = supported;
	return passiveSupported;
}
function isTouchStartEvent(e) {
	return e.type === "touchstart";
}
const ColumnVisibility = {
	getInitialState: (state) => {
		return {
			columnVisibility: {},
			...state,
		};
	},
	getDefaultOptions: (table) => {
		return {
			onColumnVisibilityChange: makeStateUpdater("columnVisibility", table),
		};
	},
	createColumn: (column, table) => {
		column.toggleVisibility = (value) => {
			if (column.getCanHide()) {
				table.setColumnVisibility((old) => ({
					...old,
					[column.id]: value != null ? value : !column.getIsVisible(),
				}));
			}
		};
		column.getIsVisible = () => {
			var _ref, _table$getState$colum;
			const childColumns = column.columns;
			return (
					(_ref =
						childColumns.length ? childColumns.some((c) => c.getIsVisible())
						: (_table$getState$colum = table.getState().columnVisibility) == null ? void 0
						: _table$getState$colum[column.id]) != null
				) ?
					_ref
				:	true;
		};
		column.getCanHide = () => {
			var _column$columnDef$ena, _table$options$enable;
			return (
				((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) &&
				((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true)
			);
		};
		column.getToggleVisibilityHandler = () => {
			return (e) => {
				column.toggleVisibility == null || column.toggleVisibility(e.target.checked);
			};
		};
	},
	createRow: (row, table) => {
		row._getAllVisibleCells = memo(
			() => [row.getAllCells(), table.getState().columnVisibility],
			(cells) => {
				return cells.filter((cell) => cell.column.getIsVisible());
			},
			getMemoOptions(table.options, "debugRows"),
		);
		row.getVisibleCells = memo(
			() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()],
			(left, center, right) => [...left, ...center, ...right],
			getMemoOptions(table.options, "debugRows"),
		);
	},
	createTable: (table) => {
		const makeVisibleColumnsMethod = (key, getColumns) => {
			return memo(
				() => [
					getColumns(),
					getColumns()
						.filter((d) => d.getIsVisible())
						.map((d) => d.id)
						.join("_"),
				],
				(columns) => {
					return columns.filter((d) => (d.getIsVisible == null ? void 0 : d.getIsVisible()));
				},
				getMemoOptions(table.options, "debugColumns"),
			);
		};
		table.getVisibleFlatColumns = makeVisibleColumnsMethod("getVisibleFlatColumns", () => table.getAllFlatColumns());
		table.getVisibleLeafColumns = makeVisibleColumnsMethod("getVisibleLeafColumns", () => table.getAllLeafColumns());
		table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod("getLeftVisibleLeafColumns", () => table.getLeftLeafColumns());
		table.getRightVisibleLeafColumns = makeVisibleColumnsMethod("getRightVisibleLeafColumns", () => table.getRightLeafColumns());
		table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod("getCenterVisibleLeafColumns", () => table.getCenterLeafColumns());
		table.setColumnVisibility = (updater) => (table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater));
		table.resetColumnVisibility = (defaultState) => {
			var _table$initialState$c;
			table.setColumnVisibility(
				defaultState ? {}
				: (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c
				: {},
			);
		};
		table.toggleAllColumnsVisible = (value) => {
			var _value;
			value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
			table.setColumnVisibility(
				table.getAllLeafColumns().reduce(
					(obj, column) => ({
						...obj,
						[column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value,
					}),
					{},
				),
			);
		};
		table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some((column) => !(column.getIsVisible != null && column.getIsVisible()));
		table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some((column) => (column.getIsVisible == null ? void 0 : column.getIsVisible()));
		table.getToggleAllColumnsVisibilityHandler = () => {
			return (e) => {
				var _target;
				table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
			};
		};
	},
};
function _getVisibleLeafColumns(table, position) {
	return (
		!position ? table.getVisibleLeafColumns()
		: position === "center" ? table.getCenterVisibleLeafColumns()
		: position === "left" ? table.getLeftVisibleLeafColumns()
		: table.getRightVisibleLeafColumns()
	);
}
const GlobalFaceting = {
	createTable: (table) => {
		table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, "__global__");
		table.getGlobalFacetedRowModel = () => {
			if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
				return table.getPreFilteredRowModel();
			}
			return table._getGlobalFacetedRowModel();
		};
		table._getGlobalFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, "__global__");
		table.getGlobalFacetedUniqueValues = () => {
			if (!table._getGlobalFacetedUniqueValues) {
				return /* @__PURE__ */ new Map();
			}
			return table._getGlobalFacetedUniqueValues();
		};
		table._getGlobalFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, "__global__");
		table.getGlobalFacetedMinMaxValues = () => {
			if (!table._getGlobalFacetedMinMaxValues) {
				return;
			}
			return table._getGlobalFacetedMinMaxValues();
		};
	},
};
const GlobalFiltering = {
	getInitialState: (state) => {
		return {
			globalFilter: void 0,
			...state,
		};
	},
	getDefaultOptions: (table) => {
		return {
			onGlobalFilterChange: makeStateUpdater("globalFilter", table),
			globalFilterFn: "auto",
			getColumnCanGlobalFilter: (column) => {
				var _table$getCoreRowMode;
				const value =
					(_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ?
						void 0
					:	_table$getCoreRowMode.getValue();
				return typeof value === "string" || typeof value === "number";
			},
		};
	},
	createColumn: (column, table) => {
		column.getCanGlobalFilter = () => {
			var _column$columnDef$ena, _table$options$enable, _table$options$enable2, _table$options$getCol;
			return (
				((_column$columnDef$ena = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) &&
				((_table$options$enable = table.options.enableGlobalFilter) != null ? _table$options$enable : true) &&
				((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) &&
				((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) &&
				!!column.accessorFn
			);
		};
	},
	createTable: (table) => {
		table.getGlobalAutoFilterFn = () => {
			return filterFns.includesString;
		};
		table.getGlobalFilterFn = () => {
			var _table$options$filter, _table$options$filter2;
			const { globalFilterFn } = table.options;
			return (
				isFunction(globalFilterFn) ? globalFilterFn
				: globalFilterFn === "auto" ? table.getGlobalAutoFilterFn()
				: (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter
				: filterFns[globalFilterFn]
			);
		};
		table.setGlobalFilter = (updater) => {
			table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater);
		};
		table.resetGlobalFilter = (defaultState) => {
			table.setGlobalFilter(defaultState ? void 0 : table.initialState.globalFilter);
		};
	},
};
const RowExpanding = {
	getInitialState: (state) => {
		return {
			expanded: {},
			...state,
		};
	},
	getDefaultOptions: (table) => {
		return {
			onExpandedChange: makeStateUpdater("expanded", table),
			paginateExpandedRows: true,
		};
	},
	createTable: (table) => {
		let registered = false;
		let queued = false;
		table._autoResetExpanded = () => {
			var _ref, _table$options$autoRe;
			if (!registered) {
				table._queue(() => {
					registered = true;
				});
				return;
			}
			if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
				if (queued) return;
				queued = true;
				table._queue(() => {
					table.resetExpanded();
					queued = false;
				});
			}
		};
		table.setExpanded = (updater) => (table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater));
		table.toggleAllRowsExpanded = (expanded) => {
			if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
				table.setExpanded(true);
			} else {
				table.setExpanded({});
			}
		};
		table.resetExpanded = (defaultState) => {
			var _table$initialState$e, _table$initialState;
			table.setExpanded(
				defaultState ? {}
				: (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e
				: {},
			);
		};
		table.getCanSomeRowsExpand = () => {
			return table.getPrePaginationRowModel().flatRows.some((row) => row.getCanExpand());
		};
		table.getToggleAllRowsExpandedHandler = () => {
			return (e) => {
				e.persist == null || e.persist();
				table.toggleAllRowsExpanded();
			};
		};
		table.getIsSomeRowsExpanded = () => {
			const expanded = table.getState().expanded;
			return expanded === true || Object.values(expanded).some(Boolean);
		};
		table.getIsAllRowsExpanded = () => {
			const expanded = table.getState().expanded;
			if (typeof expanded === "boolean") {
				return expanded === true;
			}
			if (!Object.keys(expanded).length) {
				return false;
			}
			if (table.getRowModel().flatRows.some((row) => !row.getIsExpanded())) {
				return false;
			}
			return true;
		};
		table.getExpandedDepth = () => {
			let maxDepth = 0;
			const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);
			rowIds.forEach((id) => {
				const splitId = id.split(".");
				maxDepth = Math.max(maxDepth, splitId.length);
			});
			return maxDepth;
		};
		table.getPreExpandedRowModel = () => table.getSortedRowModel();
		table.getExpandedRowModel = () => {
			if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
				table._getExpandedRowModel = table.options.getExpandedRowModel(table);
			}
			if (table.options.manualExpanding || !table._getExpandedRowModel) {
				return table.getPreExpandedRowModel();
			}
			return table._getExpandedRowModel();
		};
	},
	createRow: (row, table) => {
		row.toggleExpanded = (expanded) => {
			table.setExpanded((old) => {
				var _expanded;
				const exists = old === true ? true : !!(old != null && old[row.id]);
				let oldExpanded = {};
				if (old === true) {
					Object.keys(table.getRowModel().rowsById).forEach((rowId) => {
						oldExpanded[rowId] = true;
					});
				} else {
					oldExpanded = old;
				}
				expanded = (_expanded = expanded) != null ? _expanded : !exists;
				if (!exists && expanded) {
					return {
						...oldExpanded,
						[row.id]: true,
					};
				}
				if (exists && !expanded) {
					const { [row.id]: _, ...rest } = oldExpanded;
					return rest;
				}
				return old;
			});
		};
		row.getIsExpanded = () => {
			var _table$options$getIsR;
			const expanded = table.getState().expanded;
			return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ?
				_table$options$getIsR
			:	expanded === true || (expanded == null ? void 0 : expanded[row.id]));
		};
		row.getCanExpand = () => {
			var _table$options$getRow, _table$options$enable, _row$subRows;
			return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ?
					_table$options$getRow
				:	((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
		};
		row.getIsAllParentsExpanded = () => {
			let isFullyExpanded = true;
			let currentRow = row;
			while (isFullyExpanded && currentRow.parentId) {
				currentRow = table.getRow(currentRow.parentId, true);
				isFullyExpanded = currentRow.getIsExpanded();
			}
			return isFullyExpanded;
		};
		row.getToggleExpandedHandler = () => {
			const canExpand = row.getCanExpand();
			return () => {
				if (!canExpand) return;
				row.toggleExpanded();
			};
		};
	},
};
const defaultPageIndex = 0;
const defaultPageSize = 10;
const getDefaultPaginationState = () => ({
	pageIndex: defaultPageIndex,
	pageSize: defaultPageSize,
});
const RowPagination = {
	getInitialState: (state) => {
		return {
			...state,
			pagination: {
				...getDefaultPaginationState(),
				...(state == null ? void 0 : state.pagination),
			},
		};
	},
	getDefaultOptions: (table) => {
		return {
			onPaginationChange: makeStateUpdater("pagination", table),
		};
	},
	createTable: (table) => {
		let registered = false;
		let queued = false;
		table._autoResetPageIndex = () => {
			var _ref, _table$options$autoRe;
			if (!registered) {
				table._queue(() => {
					registered = true;
				});
				return;
			}
			if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
				if (queued) return;
				queued = true;
				table._queue(() => {
					table.resetPageIndex();
					queued = false;
				});
			}
		};
		table.setPagination = (updater) => {
			const safeUpdater = (old) => {
				let newState = functionalUpdate(updater, old);
				return newState;
			};
			return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
		};
		table.resetPagination = (defaultState) => {
			var _table$initialState$p;
			table.setPagination(
				defaultState ? getDefaultPaginationState()
				: (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p
				: getDefaultPaginationState(),
			);
		};
		table.setPageIndex = (updater) => {
			table.setPagination((old) => {
				let pageIndex = functionalUpdate(updater, old.pageIndex);
				const maxPageIndex = typeof table.options.pageCount === "undefined" || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
				pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex));
				return {
					...old,
					pageIndex,
				};
			});
		};
		table.resetPageIndex = (defaultState) => {
			var _table$initialState$p2, _table$initialState;
			table.setPageIndex(
				defaultState ? defaultPageIndex
				: (
					(_table$initialState$p2 =
						(_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null
				) ?
					_table$initialState$p2
				:	defaultPageIndex,
			);
		};
		table.resetPageSize = (defaultState) => {
			var _table$initialState$p3, _table$initialState2;
			table.setPageSize(
				defaultState ? defaultPageSize
				: (
					(_table$initialState$p3 =
						(_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null
				) ?
					_table$initialState$p3
				:	defaultPageSize,
			);
		};
		table.setPageSize = (updater) => {
			table.setPagination((old) => {
				const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));
				const topRowIndex = old.pageSize * old.pageIndex;
				const pageIndex = Math.floor(topRowIndex / pageSize);
				return {
					...old,
					pageIndex,
					pageSize,
				};
			});
		};
		table.setPageCount = (updater) =>
			table.setPagination((old) => {
				var _table$options$pageCo;
				let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);
				if (typeof newPageCount === "number") {
					newPageCount = Math.max(-1, newPageCount);
				}
				return {
					...old,
					pageCount: newPageCount,
				};
			});
		table.getPageOptions = memo(
			() => [table.getPageCount()],
			(pageCount) => {
				let pageOptions = [];
				if (pageCount && pageCount > 0) {
					pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);
				}
				return pageOptions;
			},
			getMemoOptions(table.options, "debugTable"),
		);
		table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0;
		table.getCanNextPage = () => {
			const { pageIndex } = table.getState().pagination;
			const pageCount = table.getPageCount();
			if (pageCount === -1) {
				return true;
			}
			if (pageCount === 0) {
				return false;
			}
			return pageIndex < pageCount - 1;
		};
		table.previousPage = () => {
			return table.setPageIndex((old) => old - 1);
		};
		table.nextPage = () => {
			return table.setPageIndex((old) => {
				return old + 1;
			});
		};
		table.firstPage = () => {
			return table.setPageIndex(0);
		};
		table.lastPage = () => {
			return table.setPageIndex(table.getPageCount() - 1);
		};
		table.getPrePaginationRowModel = () => table.getExpandedRowModel();
		table.getPaginationRowModel = () => {
			if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {
				table._getPaginationRowModel = table.options.getPaginationRowModel(table);
			}
			if (table.options.manualPagination || !table._getPaginationRowModel) {
				return table.getPrePaginationRowModel();
			}
			return table._getPaginationRowModel();
		};
		table.getPageCount = () => {
			var _table$options$pageCo2;
			return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getRowCount() / table.getState().pagination.pageSize);
		};
		table.getRowCount = () => {
			var _table$options$rowCou;
			return (_table$options$rowCou = table.options.rowCount) != null ? _table$options$rowCou : table.getPrePaginationRowModel().rows.length;
		};
	},
};
const getDefaultRowPinningState = () => ({
	top: [],
	bottom: [],
});
const RowPinning = {
	getInitialState: (state) => {
		return {
			rowPinning: getDefaultRowPinningState(),
			...state,
		};
	},
	getDefaultOptions: (table) => {
		return {
			onRowPinningChange: makeStateUpdater("rowPinning", table),
		};
	},
	createRow: (row, table) => {
		row.pin = (position, includeLeafRows, includeParentRows) => {
			const leafRowIds =
				includeLeafRows ?
					row.getLeafRows().map((_ref) => {
						let { id } = _ref;
						return id;
					})
				:	[];
			const parentRowIds =
				includeParentRows ?
					row.getParentRows().map((_ref2) => {
						let { id } = _ref2;
						return id;
					})
				:	[];
			const rowIds = /* @__PURE__ */ new Set([...parentRowIds, row.id, ...leafRowIds]);
			table.setRowPinning((old) => {
				var _old$top3, _old$bottom3;
				if (position === "bottom") {
					var _old$top, _old$bottom;
					return {
						top: ((_old$top = old == null ? void 0 : old.top) != null ? _old$top : []).filter((d) => !(rowIds != null && rowIds.has(d))),
						bottom: [...((_old$bottom = old == null ? void 0 : old.bottom) != null ? _old$bottom : []).filter((d) => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)],
					};
				}
				if (position === "top") {
					var _old$top2, _old$bottom2;
					return {
						top: [...((_old$top2 = old == null ? void 0 : old.top) != null ? _old$top2 : []).filter((d) => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)],
						bottom: ((_old$bottom2 = old == null ? void 0 : old.bottom) != null ? _old$bottom2 : []).filter((d) => !(rowIds != null && rowIds.has(d))),
					};
				}
				return {
					top: ((_old$top3 = old == null ? void 0 : old.top) != null ? _old$top3 : []).filter((d) => !(rowIds != null && rowIds.has(d))),
					bottom: ((_old$bottom3 = old == null ? void 0 : old.bottom) != null ? _old$bottom3 : []).filter((d) => !(rowIds != null && rowIds.has(d))),
				};
			});
		};
		row.getCanPin = () => {
			var _ref3;
			const { enableRowPinning, enablePinning } = table.options;
			if (typeof enableRowPinning === "function") {
				return enableRowPinning(row);
			}
			return (_ref3 = enableRowPinning != null ? enableRowPinning : enablePinning) != null ? _ref3 : true;
		};
		row.getIsPinned = () => {
			const rowIds = [row.id];
			const { top, bottom } = table.getState().rowPinning;
			const isTop = rowIds.some((d) => (top == null ? void 0 : top.includes(d)));
			const isBottom = rowIds.some((d) => (bottom == null ? void 0 : bottom.includes(d)));
			return (
				isTop ? "top"
				: isBottom ? "bottom"
				: false
			);
		};
		row.getPinnedIndex = () => {
			var _ref4, _visiblePinnedRowIds$;
			const position = row.getIsPinned();
			if (!position) return -1;
			const visiblePinnedRowIds =
				(_ref4 = position === "top" ? table.getTopRows() : table.getBottomRows()) == null ?
					void 0
				:	_ref4.map((_ref5) => {
						let { id } = _ref5;
						return id;
					});
			return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1;
		};
	},
	createTable: (table) => {
		table.setRowPinning = (updater) => (table.options.onRowPinningChange == null ? void 0 : table.options.onRowPinningChange(updater));
		table.resetRowPinning = (defaultState) => {
			var _table$initialState$r, _table$initialState;
			return table.setRowPinning(
				defaultState ? getDefaultRowPinningState()
				: (_table$initialState$r = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r
				: getDefaultRowPinningState(),
			);
		};
		table.getIsSomeRowsPinned = (position) => {
			var _pinningState$positio;
			const pinningState = table.getState().rowPinning;
			if (!position) {
				var _pinningState$top, _pinningState$bottom;
				return Boolean(
					((_pinningState$top = pinningState.top) == null ? void 0 : _pinningState$top.length) ||
					((_pinningState$bottom = pinningState.bottom) == null ? void 0 : _pinningState$bottom.length),
				);
			}
			return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
		};
		table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {
			var _table$options$keepPi;
			const rows =
				(
					(_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true
				) ?
					//get all rows that are pinned even if they would not be otherwise visible
					//account for expanded parent rows, but not pagination or filtering
					(pinnedRowIds != null ? pinnedRowIds : []).map((rowId) => {
						const row = table.getRow(rowId, true);
						return row.getIsAllParentsExpanded() ? row : null;
					})
					//else get only visible rows that are pinned
				:	(pinnedRowIds != null ? pinnedRowIds : []).map((rowId) => visibleRows.find((row) => row.id === rowId));
			return rows.filter(Boolean).map((d) => ({
				...d,
				position,
			}));
		};
		table.getTopRows = memo(
			() => [table.getRowModel().rows, table.getState().rowPinning.top],
			(allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, "top"),
			getMemoOptions(table.options, "debugRows"),
		);
		table.getBottomRows = memo(
			() => [table.getRowModel().rows, table.getState().rowPinning.bottom],
			(allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, "bottom"),
			getMemoOptions(table.options, "debugRows"),
		);
		table.getCenterRows = memo(
			() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom],
			(allRows, top, bottom) => {
				const topAndBottom = /* @__PURE__ */ new Set([...(top != null ? top : []), ...(bottom != null ? bottom : [])]);
				return allRows.filter((d) => !topAndBottom.has(d.id));
			},
			getMemoOptions(table.options, "debugRows"),
		);
	},
};
const RowSelection = {
	getInitialState: (state) => {
		return {
			rowSelection: {},
			...state,
		};
	},
	getDefaultOptions: (table) => {
		return {
			onRowSelectionChange: makeStateUpdater("rowSelection", table),
			enableRowSelection: true,
			enableMultiRowSelection: true,
			enableSubRowSelection: true,
			// enableGroupingRowSelection: false,
			// isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,
			// isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,
		};
	},
	createTable: (table) => {
		table.setRowSelection = (updater) => (table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater));
		table.resetRowSelection = (defaultState) => {
			var _table$initialState$r;
			return table.setRowSelection(
				defaultState ? {}
				: (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r
				: {},
			);
		};
		table.toggleAllRowsSelected = (value) => {
			table.setRowSelection((old) => {
				value = typeof value !== "undefined" ? value : !table.getIsAllRowsSelected();
				const rowSelection = {
					...old,
				};
				const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;
				if (value) {
					preGroupedFlatRows.forEach((row) => {
						if (!row.getCanSelect()) {
							return;
						}
						rowSelection[row.id] = true;
					});
				} else {
					preGroupedFlatRows.forEach((row) => {
						delete rowSelection[row.id];
					});
				}
				return rowSelection;
			});
		};
		table.toggleAllPageRowsSelected = (value) =>
			table.setRowSelection((old) => {
				const resolvedValue = typeof value !== "undefined" ? value : !table.getIsAllPageRowsSelected();
				const rowSelection = {
					...old,
				};
				table.getRowModel().rows.forEach((row) => {
					mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table);
				});
				return rowSelection;
			});
		table.getPreSelectedRowModel = () => table.getCoreRowModel();
		table.getSelectedRowModel = memo(
			() => [table.getState().rowSelection, table.getCoreRowModel()],
			(rowSelection, rowModel) => {
				if (!Object.keys(rowSelection).length) {
					return {
						rows: [],
						flatRows: [],
						rowsById: {},
					};
				}
				return selectRowsFn(table, rowModel);
			},
			getMemoOptions(table.options, "debugTable"),
		);
		table.getFilteredSelectedRowModel = memo(
			() => [table.getState().rowSelection, table.getFilteredRowModel()],
			(rowSelection, rowModel) => {
				if (!Object.keys(rowSelection).length) {
					return {
						rows: [],
						flatRows: [],
						rowsById: {},
					};
				}
				return selectRowsFn(table, rowModel);
			},
			getMemoOptions(table.options, "debugTable"),
		);
		table.getGroupedSelectedRowModel = memo(
			() => [table.getState().rowSelection, table.getSortedRowModel()],
			(rowSelection, rowModel) => {
				if (!Object.keys(rowSelection).length) {
					return {
						rows: [],
						flatRows: [],
						rowsById: {},
					};
				}
				return selectRowsFn(table, rowModel);
			},
			getMemoOptions(table.options, "debugTable"),
		);
		table.getIsAllRowsSelected = () => {
			const preGroupedFlatRows = table.getFilteredRowModel().flatRows;
			const { rowSelection } = table.getState();
			let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);
			if (isAllRowsSelected) {
				if (preGroupedFlatRows.some((row) => row.getCanSelect() && !rowSelection[row.id])) {
					isAllRowsSelected = false;
				}
			}
			return isAllRowsSelected;
		};
		table.getIsAllPageRowsSelected = () => {
			const paginationFlatRows = table.getPaginationRowModel().flatRows.filter((row) => row.getCanSelect());
			const { rowSelection } = table.getState();
			let isAllPageRowsSelected = !!paginationFlatRows.length;
			if (isAllPageRowsSelected && paginationFlatRows.some((row) => !rowSelection[row.id])) {
				isAllPageRowsSelected = false;
			}
			return isAllPageRowsSelected;
		};
		table.getIsSomeRowsSelected = () => {
			var _table$getState$rowSe;
			const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
			return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length;
		};
		table.getIsSomePageRowsSelected = () => {
			const paginationFlatRows = table.getPaginationRowModel().flatRows;
			return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter((row) => row.getCanSelect()).some((d) => d.getIsSelected() || d.getIsSomeSelected());
		};
		table.getToggleAllRowsSelectedHandler = () => {
			return (e) => {
				table.toggleAllRowsSelected(e.target.checked);
			};
		};
		table.getToggleAllPageRowsSelectedHandler = () => {
			return (e) => {
				table.toggleAllPageRowsSelected(e.target.checked);
			};
		};
	},
	createRow: (row, table) => {
		row.toggleSelected = (value, opts) => {
			const isSelected = row.getIsSelected();
			table.setRowSelection((old) => {
				var _opts$selectChildren;
				value = typeof value !== "undefined" ? value : !isSelected;
				if (row.getCanSelect() && isSelected === value) {
					return old;
				}
				const selectedRowIds = {
					...old,
				};
				mutateRowIsSelected(selectedRowIds, row.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table);
				return selectedRowIds;
			});
		};
		row.getIsSelected = () => {
			const { rowSelection } = table.getState();
			return isRowSelected(row, rowSelection);
		};
		row.getIsSomeSelected = () => {
			const { rowSelection } = table.getState();
			return isSubRowSelected(row, rowSelection) === "some";
		};
		row.getIsAllSubRowsSelected = () => {
			const { rowSelection } = table.getState();
			return isSubRowSelected(row, rowSelection) === "all";
		};
		row.getCanSelect = () => {
			var _table$options$enable;
			if (typeof table.options.enableRowSelection === "function") {
				return table.options.enableRowSelection(row);
			}
			return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;
		};
		row.getCanSelectSubRows = () => {
			var _table$options$enable2;
			if (typeof table.options.enableSubRowSelection === "function") {
				return table.options.enableSubRowSelection(row);
			}
			return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
		};
		row.getCanMultiSelect = () => {
			var _table$options$enable3;
			if (typeof table.options.enableMultiRowSelection === "function") {
				return table.options.enableMultiRowSelection(row);
			}
			return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;
		};
		row.getToggleSelectedHandler = () => {
			const canSelect = row.getCanSelect();
			return (e) => {
				var _target;
				if (!canSelect) return;
				row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);
			};
		};
	},
};
const mutateRowIsSelected = (selectedRowIds, id, value, includeChildren, table) => {
	var _row$subRows;
	const row = table.getRow(id, true);
	if (value) {
		if (!row.getCanMultiSelect()) {
			Object.keys(selectedRowIds).forEach((key) => delete selectedRowIds[key]);
		}
		if (row.getCanSelect()) {
			selectedRowIds[id] = true;
		}
	} else {
		delete selectedRowIds[id];
	}
	if (includeChildren && (_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) {
		row.subRows.forEach((row2) => mutateRowIsSelected(selectedRowIds, row2.id, value, includeChildren, table));
	}
};
function selectRowsFn(table, rowModel) {
	const rowSelection = table.getState().rowSelection;
	const newSelectedFlatRows = [];
	const newSelectedRowsById = {};
	const recurseRows = function (rows, depth) {
		return rows
			.map((row) => {
				var _row$subRows2;
				const isSelected = isRowSelected(row, rowSelection);
				if (isSelected) {
					newSelectedFlatRows.push(row);
					newSelectedRowsById[row.id] = row;
				}
				if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
					row = {
						...row,
						subRows: recurseRows(row.subRows),
					};
				}
				if (isSelected) {
					return row;
				}
			})
			.filter(Boolean);
	};
	return {
		rows: recurseRows(rowModel.rows),
		flatRows: newSelectedFlatRows,
		rowsById: newSelectedRowsById,
	};
}
function isRowSelected(row, selection) {
	var _selection$row$id;
	return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false;
}
function isSubRowSelected(row, selection, table) {
	var _row$subRows3;
	if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length)) return false;
	let allChildrenSelected = true;
	let someSelected = false;
	row.subRows.forEach((subRow) => {
		if (someSelected && !allChildrenSelected) {
			return;
		}
		if (subRow.getCanSelect()) {
			if (isRowSelected(subRow, selection)) {
				someSelected = true;
			} else {
				allChildrenSelected = false;
			}
		}
		if (subRow.subRows && subRow.subRows.length) {
			const subRowChildrenSelected = isSubRowSelected(subRow, selection);
			if (subRowChildrenSelected === "all") {
				someSelected = true;
			} else if (subRowChildrenSelected === "some") {
				someSelected = true;
				allChildrenSelected = false;
			} else {
				allChildrenSelected = false;
			}
		}
	});
	return (
		allChildrenSelected ? "all"
		: someSelected ? "some"
		: false
	);
}
const reSplitAlphaNumeric = /([0-9]+)/gm;
const alphanumeric = (rowA, rowB, columnId) => {
	return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
};
const alphanumericCaseSensitive = (rowA, rowB, columnId) => {
	return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
};
const text = (rowA, rowB, columnId) => {
	return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
};
const textCaseSensitive = (rowA, rowB, columnId) => {
	return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
};
const datetime = (rowA, rowB, columnId) => {
	const a = rowA.getValue(columnId);
	const b = rowB.getValue(columnId);
	return (
		a > b ? 1
		: a < b ? -1
		: 0
	);
};
const basic = (rowA, rowB, columnId) => {
	return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));
};
function compareBasic(a, b) {
	return (
		a === b ? 0
		: a > b ? 1
		: -1
	);
}
function toString(a) {
	if (typeof a === "number") {
		if (isNaN(a) || a === Infinity || a === -Infinity) {
			return "";
		}
		return String(a);
	}
	if (typeof a === "string") {
		return a;
	}
	return "";
}
function compareAlphanumeric(aStr, bStr) {
	const a = aStr.split(reSplitAlphaNumeric).filter(Boolean);
	const b = bStr.split(reSplitAlphaNumeric).filter(Boolean);
	while (a.length && b.length) {
		const aa = a.shift();
		const bb = b.shift();
		const an = parseInt(aa, 10);
		const bn = parseInt(bb, 10);
		const combo = [an, bn].sort();
		if (isNaN(combo[0])) {
			if (aa > bb) {
				return 1;
			}
			if (bb > aa) {
				return -1;
			}
			continue;
		}
		if (isNaN(combo[1])) {
			return isNaN(an) ? -1 : 1;
		}
		if (an > bn) {
			return 1;
		}
		if (bn > an) {
			return -1;
		}
	}
	return a.length - b.length;
}
const sortingFns = {
	alphanumeric,
	alphanumericCaseSensitive,
	text,
	textCaseSensitive,
	datetime,
	basic,
};
const RowSorting = {
	getInitialState: (state) => {
		return {
			sorting: [],
			...state,
		};
	},
	getDefaultColumnDef: () => {
		return {
			sortingFn: "auto",
			sortUndefined: 1,
		};
	},
	getDefaultOptions: (table) => {
		return {
			onSortingChange: makeStateUpdater("sorting", table),
			isMultiSortEvent: (e) => {
				return e.shiftKey;
			},
		};
	},
	createColumn: (column, table) => {
		column.getAutoSortingFn = () => {
			const firstRows = table.getFilteredRowModel().flatRows.slice(10);
			let isString = false;
			for (const row of firstRows) {
				const value = row == null ? void 0 : row.getValue(column.id);
				if (Object.prototype.toString.call(value) === "[object Date]") {
					return sortingFns.datetime;
				}
				if (typeof value === "string") {
					isString = true;
					if (value.split(reSplitAlphaNumeric).length > 1) {
						return sortingFns.alphanumeric;
					}
				}
			}
			if (isString) {
				return sortingFns.text;
			}
			return sortingFns.basic;
		};
		column.getAutoSortDir = () => {
			const firstRow = table.getFilteredRowModel().flatRows[0];
			const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
			if (typeof value === "string") {
				return "asc";
			}
			return "desc";
		};
		column.getSortingFn = () => {
			var _table$options$sortin, _table$options$sortin2;
			if (!column) {
				throw new Error();
			}
			return (
				isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn
				: column.columnDef.sortingFn === "auto" ? column.getAutoSortingFn()
				: (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin
				: sortingFns[column.columnDef.sortingFn]
			);
		};
		column.toggleSorting = (desc, multi) => {
			const nextSortingOrder = column.getNextSortingOrder();
			const hasManualValue = typeof desc !== "undefined" && desc !== null;
			table.setSorting((old) => {
				const existingSorting = old == null ? void 0 : old.find((d) => d.id === column.id);
				const existingIndex = old == null ? void 0 : old.findIndex((d) => d.id === column.id);
				let newSorting = [];
				let sortAction;
				let nextDesc = hasManualValue ? desc : nextSortingOrder === "desc";
				if (old != null && old.length && column.getCanMultiSort() && multi) {
					if (existingSorting) {
						sortAction = "toggle";
					} else {
						sortAction = "add";
					}
				} else {
					if (old != null && old.length && existingIndex !== old.length - 1) {
						sortAction = "replace";
					} else if (existingSorting) {
						sortAction = "toggle";
					} else {
						sortAction = "replace";
					}
				}
				if (sortAction === "toggle") {
					if (!hasManualValue) {
						if (!nextSortingOrder) {
							sortAction = "remove";
						}
					}
				}
				if (sortAction === "add") {
					var _table$options$maxMul;
					newSorting = [
						...old,
						{
							id: column.id,
							desc: nextDesc,
						},
					];
					newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
				} else if (sortAction === "toggle") {
					newSorting = old.map((d) => {
						if (d.id === column.id) {
							return {
								...d,
								desc: nextDesc,
							};
						}
						return d;
					});
				} else if (sortAction === "remove") {
					newSorting = old.filter((d) => d.id !== column.id);
				} else {
					newSorting = [
						{
							id: column.id,
							desc: nextDesc,
						},
					];
				}
				return newSorting;
			});
		};
		column.getFirstSortDir = () => {
			var _ref, _column$columnDef$sor;
			const sortDescFirst =
				(_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === "desc";
			return sortDescFirst ? "desc" : "asc";
		};
		column.getNextSortingOrder = (multi) => {
			var _table$options$enable, _table$options$enable2;
			const firstSortDirection = column.getFirstSortDir();
			const isSorted = column.getIsSorted();
			if (!isSorted) {
				return firstSortDirection;
			}
			if (
				isSorted !== firstSortDirection &&
				((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && // If enableSortRemove, enable in general
				(multi ?
					(_table$options$enable2 = table.options.enableMultiRemove) != null ?
						_table$options$enable2
					:	true
				:	true)
			) {
				return false;
			}
			return isSorted === "desc" ? "asc" : "desc";
		};
		column.getCanSort = () => {
			var _column$columnDef$ena, _table$options$enable3;
			return (
				((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) &&
				((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) &&
				!!column.accessorFn
			);
		};
		column.getCanMultiSort = () => {
			var _ref2, _column$columnDef$ena2;
			return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;
		};
		column.getIsSorted = () => {
			var _table$getState$sorti;
			const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find((d) => d.id === column.id);
			return (
				!columnSort ? false
				: columnSort.desc ? "desc"
				: "asc"
			);
		};
		column.getSortIndex = () => {
			var _table$getState$sorti2, _table$getState$sorti3;
			return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex((d) => d.id === column.id)) != null ?
					_table$getState$sorti2
				:	-1;
		};
		column.clearSorting = () => {
			table.setSorting((old) => (old != null && old.length ? old.filter((d) => d.id !== column.id) : []));
		};
		column.getToggleSortingHandler = () => {
			const canSort = column.getCanSort();
			return (e) => {
				if (!canSort) return;
				e.persist == null || e.persist();
				column.toggleSorting == null ||
					column.toggleSorting(
						void 0,
						column.getCanMultiSort() ?
							table.options.isMultiSortEvent == null ?
								void 0
							:	table.options.isMultiSortEvent(e)
						:	false,
					);
			};
		};
	},
	createTable: (table) => {
		table.setSorting = (updater) => (table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater));
		table.resetSorting = (defaultState) => {
			var _table$initialState$s, _table$initialState;
			table.setSorting(
				defaultState ? []
				: (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s
				: [],
			);
		};
		table.getPreSortedRowModel = () => table.getGroupedRowModel();
		table.getSortedRowModel = () => {
			if (!table._getSortedRowModel && table.options.getSortedRowModel) {
				table._getSortedRowModel = table.options.getSortedRowModel(table);
			}
			if (table.options.manualSorting || !table._getSortedRowModel) {
				return table.getPreSortedRowModel();
			}
			return table._getSortedRowModel();
		};
	},
};
const builtInFeatures = [
	Headers$1,
	ColumnVisibility,
	ColumnOrdering,
	ColumnPinning,
	ColumnFaceting,
	ColumnFiltering,
	GlobalFaceting,
	//depends on ColumnFaceting
	GlobalFiltering,
	//depends on ColumnFiltering
	RowSorting,
	ColumnGrouping,
	//depends on RowSorting
	RowExpanding,
	RowPagination,
	RowPinning,
	RowSelection,
	ColumnSizing,
];
function createTable(options) {
	var _options$_features, _options$initialState;
	const _features = [...builtInFeatures, ...((_options$_features = options._features) != null ? _options$_features : [])];
	let table = {
		_features,
	};
	const defaultOptions = table._features.reduce((obj, feature) => {
		return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table));
	}, {});
	const mergeOptions = (options2) => {
		if (table.options.mergeOptions) {
			return table.options.mergeOptions(defaultOptions, options2);
		}
		return {
			...defaultOptions,
			...options2,
		};
	};
	const coreInitialState = {};
	let initialState = {
		...coreInitialState,
		...((_options$initialState = options.initialState) != null ? _options$initialState : {}),
	};
	table._features.forEach((feature) => {
		var _feature$getInitialSt;
		initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState;
	});
	const queued = [];
	let queuedTimeout = false;
	const coreInstance = {
		_features,
		options: {
			...defaultOptions,
			...options,
		},
		initialState,
		_queue: (cb) => {
			queued.push(cb);
			if (!queuedTimeout) {
				queuedTimeout = true;
				Promise.resolve()
					.then(() => {
						while (queued.length) {
							queued.shift()();
						}
						queuedTimeout = false;
					})
					.catch((error) =>
						setTimeout(() => {
							throw error;
						}),
					);
			}
		},
		reset: () => {
			table.setState(table.initialState);
		},
		setOptions: (updater) => {
			const newOptions = functionalUpdate(updater, table.options);
			table.options = mergeOptions(newOptions);
		},
		getState: () => {
			return table.options.state;
		},
		setState: (updater) => {
			table.options.onStateChange == null || table.options.onStateChange(updater);
		},
		_getRowId: (row, index, parent) => {
			var _table$options$getRow;
			return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ?
					_table$options$getRow
				:	`${parent ? [parent.id, index].join(".") : index}`;
		},
		getCoreRowModel: () => {
			if (!table._getCoreRowModel) {
				table._getCoreRowModel = table.options.getCoreRowModel(table);
			}
			return table._getCoreRowModel();
		},
		// The final calls start at the bottom of the model,
		// expanded rows, which then work their way up
		getRowModel: () => {
			return table.getPaginationRowModel();
		},
		//in next version, we should just pass in the row model as the optional 2nd arg
		getRow: (id, searchAll) => {
			let row = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id];
			if (!row) {
				row = table.getCoreRowModel().rowsById[id];
				if (!row) {
					throw new Error();
				}
			}
			return row;
		},
		_getDefaultColumnDef: memo(
			() => [table.options.defaultColumn],
			(defaultColumn) => {
				var _defaultColumn;
				defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
				return {
					header: (props) => {
						const resolvedColumnDef = props.header.column.columnDef;
						if (resolvedColumnDef.accessorKey) {
							return resolvedColumnDef.accessorKey;
						}
						if (resolvedColumnDef.accessorFn) {
							return resolvedColumnDef.id;
						}
						return null;
					},
					// footer: props => props.header.column.id,
					cell: (props) => {
						var _props$renderValue$to, _props$renderValue;
						return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null || _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ?
								_props$renderValue$to
							:	null;
					},
					...table._features.reduce((obj, feature) => {
						return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
					}, {}),
					...defaultColumn,
				};
			},
			getMemoOptions(options, "debugColumns"),
		),
		_getColumnDefs: () => table.options.columns,
		getAllColumns: memo(
			() => [table._getColumnDefs()],
			(columnDefs) => {
				const recurseColumns = function (columnDefs2, parent, depth) {
					if (depth === void 0) {
						depth = 0;
					}
					return columnDefs2.map((columnDef) => {
						const column = createColumn(table, columnDef, depth, parent);
						const groupingColumnDef = columnDef;
						column.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column, depth + 1) : [];
						return column;
					});
				};
				return recurseColumns(columnDefs);
			},
			getMemoOptions(options, "debugColumns"),
		),
		getAllFlatColumns: memo(
			() => [table.getAllColumns()],
			(allColumns) => {
				return allColumns.flatMap((column) => {
					return column.getFlatColumns();
				});
			},
			getMemoOptions(options, "debugColumns"),
		),
		_getAllFlatColumnsById: memo(
			() => [table.getAllFlatColumns()],
			(flatColumns) => {
				return flatColumns.reduce((acc, column) => {
					acc[column.id] = column;
					return acc;
				}, {});
			},
			getMemoOptions(options, "debugColumns"),
		),
		getAllLeafColumns: memo(
			() => [table.getAllColumns(), table._getOrderColumnsFn()],
			(allColumns, orderColumns2) => {
				let leafColumns = allColumns.flatMap((column) => column.getLeafColumns());
				return orderColumns2(leafColumns);
			},
			getMemoOptions(options, "debugColumns"),
		),
		getColumn: (columnId) => {
			const column = table._getAllFlatColumnsById()[columnId];
			return column;
		},
	};
	Object.assign(table, coreInstance);
	for (let index = 0; index < table._features.length; index++) {
		const feature = table._features[index];
		feature == null || feature.createTable == null || feature.createTable(table);
	}
	return table;
}
function getCoreRowModel() {
	return (table) =>
		memo(
			() => [table.options.data],
			(data) => {
				const rowModel = {
					rows: [],
					flatRows: [],
					rowsById: {},
				};
				const accessRows = function (originalRows, depth, parentRow) {
					if (depth === void 0) {
						depth = 0;
					}
					const rows = [];
					for (let i = 0; i < originalRows.length; i++) {
						const row = createRow(table, table._getRowId(originalRows[i], i, parentRow), originalRows[i], i, depth, void 0, parentRow == null ? void 0 : parentRow.id);
						rowModel.flatRows.push(row);
						rowModel.rowsById[row.id] = row;
						rows.push(row);
						if (table.options.getSubRows) {
							var _row$originalSubRows;
							row.originalSubRows = table.options.getSubRows(originalRows[i], i);
							if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
								row.subRows = accessRows(row.originalSubRows, depth + 1, row);
							}
						}
					}
					return rows;
				};
				rowModel.rows = accessRows(data);
				return rowModel;
			},
			getMemoOptions(table.options, "debugTable", "getRowModel", () => table._autoResetPageIndex()),
		);
}
function expandRows(rowModel) {
	const expandedRows = [];
	const handleRow = (row) => {
		var _row$subRows;
		expandedRows.push(row);
		if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {
			row.subRows.forEach(handleRow);
		}
	};
	rowModel.rows.forEach(handleRow);
	return {
		rows: expandedRows,
		flatRows: rowModel.flatRows,
		rowsById: rowModel.rowsById,
	};
}
function filterRows(rows, filterRowImpl, table) {
	if (table.options.filterFromLeafRows) {
		return filterRowModelFromLeafs(rows, filterRowImpl, table);
	}
	return filterRowModelFromRoot(rows, filterRowImpl, table);
}
function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
	var _table$options$maxLea;
	const newFilteredFlatRows = [];
	const newFilteredRowsById = {};
	const maxDepth = (_table$options$maxLea = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea : 100;
	const recurseFilterRows = function (rowsToFilter2, depth) {
		if (depth === void 0) {
			depth = 0;
		}
		const rows = [];
		for (let i = 0; i < rowsToFilter2.length; i++) {
			var _row$subRows;
			let row = rowsToFilter2[i];
			const newRow = createRow(table, row.id, row.original, row.index, row.depth, void 0, row.parentId);
			newRow.columnFilters = row.columnFilters;
			if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) {
				newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
				row = newRow;
				if (filterRow(row) && !newRow.subRows.length) {
					rows.push(row);
					newFilteredRowsById[row.id] = row;
					newFilteredFlatRows.push(row);
					continue;
				}
				if (filterRow(row) || newRow.subRows.length) {
					rows.push(row);
					newFilteredRowsById[row.id] = row;
					newFilteredFlatRows.push(row);
					continue;
				}
			} else {
				row = newRow;
				if (filterRow(row)) {
					rows.push(row);
					newFilteredRowsById[row.id] = row;
					newFilteredFlatRows.push(row);
				}
			}
		}
		return rows;
	};
	return {
		rows: recurseFilterRows(rowsToFilter),
		flatRows: newFilteredFlatRows,
		rowsById: newFilteredRowsById,
	};
}
function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
	var _table$options$maxLea2;
	const newFilteredFlatRows = [];
	const newFilteredRowsById = {};
	const maxDepth = (_table$options$maxLea2 = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea2 : 100;
	const recurseFilterRows = function (rowsToFilter2, depth) {
		if (depth === void 0) {
			depth = 0;
		}
		const rows = [];
		for (let i = 0; i < rowsToFilter2.length; i++) {
			let row = rowsToFilter2[i];
			const pass = filterRow(row);
			if (pass) {
				var _row$subRows2;
				if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) {
					const newRow = createRow(table, row.id, row.original, row.index, row.depth, void 0, row.parentId);
					newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
					row = newRow;
				}
				rows.push(row);
				newFilteredFlatRows.push(row);
				newFilteredRowsById[row.id] = row;
			}
		}
		return rows;
	};
	return {
		rows: recurseFilterRows(rowsToFilter),
		flatRows: newFilteredFlatRows,
		rowsById: newFilteredRowsById,
	};
}
function getFilteredRowModel() {
	return (table) =>
		memo(
			() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter],
			(rowModel, columnFilters, globalFilter) => {
				if (!rowModel.rows.length || (!(columnFilters != null && columnFilters.length) && !globalFilter)) {
					for (let i = 0; i < rowModel.flatRows.length; i++) {
						rowModel.flatRows[i].columnFilters = {};
						rowModel.flatRows[i].columnFiltersMeta = {};
					}
					return rowModel;
				}
				const resolvedColumnFilters = [];
				const resolvedGlobalFilters = [];
				(columnFilters != null ? columnFilters : []).forEach((d) => {
					var _filterFn$resolveFilt;
					const column = table.getColumn(d.id);
					if (!column) {
						return;
					}
					const filterFn = column.getFilterFn();
					if (!filterFn) {
						return;
					}
					resolvedColumnFilters.push({
						id: d.id,
						filterFn,
						resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue == null ? void 0 : filterFn.resolveFilterValue(d.value)) != null ? _filterFn$resolveFilt : d.value,
					});
				});
				const filterableIds = (columnFilters != null ? columnFilters : []).map((d) => d.id);
				const globalFilterFn = table.getGlobalFilterFn();
				const globallyFilterableColumns = table.getAllLeafColumns().filter((column) => column.getCanGlobalFilter());
				if (globalFilter && globalFilterFn && globallyFilterableColumns.length) {
					filterableIds.push("__global__");
					globallyFilterableColumns.forEach((column) => {
						var _globalFilterFn$resol;
						resolvedGlobalFilters.push({
							id: column.id,
							filterFn: globalFilterFn,
							resolvedValue:
								(_globalFilterFn$resol = globalFilterFn.resolveFilterValue == null ? void 0 : globalFilterFn.resolveFilterValue(globalFilter)) != null ?
									_globalFilterFn$resol
								:	globalFilter,
						});
					});
				}
				let currentColumnFilter;
				let currentGlobalFilter;
				for (let j = 0; j < rowModel.flatRows.length; j++) {
					const row = rowModel.flatRows[j];
					row.columnFilters = {};
					if (resolvedColumnFilters.length) {
						for (let i = 0; i < resolvedColumnFilters.length; i++) {
							currentColumnFilter = resolvedColumnFilters[i];
							const id = currentColumnFilter.id;
							row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, (filterMeta) => {
								row.columnFiltersMeta[id] = filterMeta;
							});
						}
					}
					if (resolvedGlobalFilters.length) {
						for (let i = 0; i < resolvedGlobalFilters.length; i++) {
							currentGlobalFilter = resolvedGlobalFilters[i];
							const id = currentGlobalFilter.id;
							if (
								currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, (filterMeta) => {
									row.columnFiltersMeta[id] = filterMeta;
								})
							) {
								row.columnFilters.__global__ = true;
								break;
							}
						}
						if (row.columnFilters.__global__ !== true) {
							row.columnFilters.__global__ = false;
						}
					}
				}
				const filterRowsImpl = (row) => {
					for (let i = 0; i < filterableIds.length; i++) {
						if (row.columnFilters[filterableIds[i]] === false) {
							return false;
						}
					}
					return true;
				};
				return filterRows(rowModel.rows, filterRowsImpl, table);
			},
			getMemoOptions(table.options, "debugTable", "getFilteredRowModel", () => table._autoResetPageIndex()),
		);
}
function getPaginationRowModel(opts) {
	return (table) =>
		memo(
			() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? void 0 : table.getState().expanded],
			(pagination, rowModel) => {
				if (!rowModel.rows.length) {
					return rowModel;
				}
				const { pageSize, pageIndex } = pagination;
				let { rows, flatRows, rowsById } = rowModel;
				const pageStart = pageSize * pageIndex;
				const pageEnd = pageStart + pageSize;
				rows = rows.slice(pageStart, pageEnd);
				let paginatedRowModel;
				if (!table.options.paginateExpandedRows) {
					paginatedRowModel = expandRows({
						rows,
						flatRows,
						rowsById,
					});
				} else {
					paginatedRowModel = {
						rows,
						flatRows,
						rowsById,
					};
				}
				paginatedRowModel.flatRows = [];
				const handleRow = (row) => {
					paginatedRowModel.flatRows.push(row);
					if (row.subRows.length) {
						row.subRows.forEach(handleRow);
					}
				};
				paginatedRowModel.rows.forEach(handleRow);
				return paginatedRowModel;
			},
			getMemoOptions(table.options, "debugTable"),
		);
}
function getSortedRowModel() {
	return (table) =>
		memo(
			() => [table.getState().sorting, table.getPreSortedRowModel()],
			(sorting, rowModel) => {
				if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
					return rowModel;
				}
				const sortingState = table.getState().sorting;
				const sortedFlatRows = [];
				const availableSorting = sortingState.filter((sort) => {
					var _table$getColumn;
					return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort();
				});
				const columnInfoById = {};
				availableSorting.forEach((sortEntry) => {
					const column = table.getColumn(sortEntry.id);
					if (!column) return;
					columnInfoById[sortEntry.id] = {
						sortUndefined: column.columnDef.sortUndefined,
						invertSorting: column.columnDef.invertSorting,
						sortingFn: column.getSortingFn(),
					};
				});
				const sortData = (rows) => {
					const sortedData = rows.map((row) => ({
						...row,
					}));
					sortedData.sort((rowA, rowB) => {
						for (let i = 0; i < availableSorting.length; i += 1) {
							var _sortEntry$desc;
							const sortEntry = availableSorting[i];
							const columnInfo = columnInfoById[sortEntry.id];
							const sortUndefined = columnInfo.sortUndefined;
							const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false;
							let sortInt = 0;
							if (sortUndefined) {
								const aValue = rowA.getValue(sortEntry.id);
								const bValue = rowB.getValue(sortEntry.id);
								const aUndefined = aValue === void 0;
								const bUndefined = bValue === void 0;
								if (aUndefined || bUndefined) {
									if (sortUndefined === "first") return aUndefined ? -1 : 1;
									if (sortUndefined === "last") return aUndefined ? 1 : -1;
									sortInt =
										aUndefined && bUndefined ? 0
										: aUndefined ? sortUndefined
										: -sortUndefined;
								}
							}
							if (sortInt === 0) {
								sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id);
							}
							if (sortInt !== 0) {
								if (isDesc) {
									sortInt *= -1;
								}
								if (columnInfo.invertSorting) {
									sortInt *= -1;
								}
								return sortInt;
							}
						}
						return rowA.index - rowB.index;
					});
					sortedData.forEach((row) => {
						var _row$subRows;
						sortedFlatRows.push(row);
						if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
							row.subRows = sortData(row.subRows);
						}
					});
					return sortedData;
				};
				return {
					rows: sortData(rowModel.rows),
					flatRows: sortedFlatRows,
					rowsById: rowModel.rowsById,
				};
			},
			getMemoOptions(table.options, "debugTable", "getSortedRowModel", () => table._autoResetPageIndex()),
		);
}

/**
 * react-table
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
const React$1 = await importShared("react");

//

/**
 * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.
 */
function flexRender(Comp, props) {
	return (
		!Comp ? null
		: isReactComponent(Comp) ? /*#__PURE__*/ React$1.createElement(Comp, props)
		: Comp
	);
}
function isReactComponent(component) {
	return isClassComponent(component) || typeof component === "function" || isExoticComponent(component);
}
function isClassComponent(component) {
	return (
		typeof component === "function" &&
		(() => {
			const proto = Object.getPrototypeOf(component);
			return proto.prototype && proto.prototype.isReactComponent;
		})()
	);
}
function isExoticComponent(component) {
	return typeof component === "object" && typeof component.$$typeof === "symbol" && ["react.memo", "react.forward_ref"].includes(component.$$typeof.description);
}
function useReactTable(options) {
	// Compose in the generic options to the user options
	const resolvedOptions = {
		state: {},
		// Dummy state
		onStateChange: () => {},
		// noop
		renderFallbackValue: null,
		...options,
	};

	// Create a new table and store it in state
	const [tableRef] = React$1.useState(() => ({
		current: createTable(resolvedOptions),
	}));

	// By default, manage table state here using the table's initial state
	const [state, setState] = React$1.useState(() => tableRef.current.initialState);

	// Compose the default state above with any user state. This will allow the user
	// to only control a subset of the state if desired.
	tableRef.current.setOptions((prev) => ({
		...prev,
		...options,
		state: {
			...state,
			...options.state,
		},
		// Similarly, we'll maintain both our internal state and any user-provided
		// state.
		onStateChange: (updater) => {
			setState(updater);
			options.onStateChange == null || options.onStateChange(updater);
		},
	}));
	return tableRef.current;
}

var dist = { exports: {} };

var sister;
var hasRequiredSister;

function requireSister() {
	if (hasRequiredSister) return sister;
	hasRequiredSister = 1;

	var Sister;

	/**
	 * @link https://github.com/gajus/sister for the canonical source repository
	 * @license https://github.com/gajus/sister/blob/master/LICENSE BSD 3-Clause
	 */
	Sister = function () {
		var sister = {},
			events = {};

		/**
		 * @name handler
		 * @function
		 * @param {Object} data Event data.
		 */

		/**
		 * @param {String} name Event name.
		 * @param {handler} handler
		 * @return {listener}
		 */
		sister.on = function (name, handler) {
			var listener = { name: name, handler: handler };
			events[name] = events[name] || [];
			events[name].unshift(listener);
			return listener;
		};

		/**
		 * @param {listener}
		 */
		sister.off = function (listener) {
			var index = events[listener.name].indexOf(listener);

			if (index !== -1) {
				events[listener.name].splice(index, 1);
			}
		};

		/**
		 * @param {String} name Event name.
		 * @param {Object} data Event data.
		 */
		sister.trigger = function (name, data) {
			var listeners = events[name],
				i;

			if (listeners) {
				i = listeners.length;
				while (i--) {
					listeners[i].handler(data);
				}
			}
		};

		return sister;
	};

	sister = Sister;
	return sister;
}

var YouTubePlayer$1 = { exports: {} };

var browser = { exports: {} };

/**
 * Helpers.
 */

var ms;
var hasRequiredMs;

function requireMs() {
	if (hasRequiredMs) return ms;
	hasRequiredMs = 1;
	var s = 1000;
	var m = s * 60;
	var h = m * 60;
	var d = h * 24;
	var w = d * 7;
	var y = d * 365.25;

	/**
	 * Parse or format the given `val`.
	 *
	 * Options:
	 *
	 *  - `long` verbose formatting [false]
	 *
	 * @param {String|Number} val
	 * @param {Object} [options]
	 * @throws {Error} throw an error if val is not a non-empty string or a number
	 * @return {String|Number}
	 * @api public
	 */

	ms = function (val, options) {
		options = options || {};
		var type = typeof val;
		if (type === "string" && val.length > 0) {
			return parse(val);
		} else if (type === "number" && isFinite(val)) {
			return options.long ? fmtLong(val) : fmtShort(val);
		}
		throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
	};

	/**
	 * Parse the given `str` and return milliseconds.
	 *
	 * @param {String} str
	 * @return {Number}
	 * @api private
	 */

	function parse(str) {
		str = String(str);
		if (str.length > 100) {
			return;
		}
		var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
		if (!match) {
			return;
		}
		var n = parseFloat(match[1]);
		var type = (match[2] || "ms").toLowerCase();
		switch (type) {
			case "years":
			case "year":
			case "yrs":
			case "yr":
			case "y":
				return n * y;
			case "weeks":
			case "week":
			case "w":
				return n * w;
			case "days":
			case "day":
			case "d":
				return n * d;
			case "hours":
			case "hour":
			case "hrs":
			case "hr":
			case "h":
				return n * h;
			case "minutes":
			case "minute":
			case "mins":
			case "min":
			case "m":
				return n * m;
			case "seconds":
			case "second":
			case "secs":
			case "sec":
			case "s":
				return n * s;
			case "milliseconds":
			case "millisecond":
			case "msecs":
			case "msec":
			case "ms":
				return n;
			default:
				return undefined;
		}
	}

	/**
	 * Short format for `ms`.
	 *
	 * @param {Number} ms
	 * @return {String}
	 * @api private
	 */

	function fmtShort(ms) {
		var msAbs = Math.abs(ms);
		if (msAbs >= d) {
			return Math.round(ms / d) + "d";
		}
		if (msAbs >= h) {
			return Math.round(ms / h) + "h";
		}
		if (msAbs >= m) {
			return Math.round(ms / m) + "m";
		}
		if (msAbs >= s) {
			return Math.round(ms / s) + "s";
		}
		return ms + "ms";
	}

	/**
	 * Long format for `ms`.
	 *
	 * @param {Number} ms
	 * @return {String}
	 * @api private
	 */

	function fmtLong(ms) {
		var msAbs = Math.abs(ms);
		if (msAbs >= d) {
			return plural(ms, msAbs, d, "day");
		}
		if (msAbs >= h) {
			return plural(ms, msAbs, h, "hour");
		}
		if (msAbs >= m) {
			return plural(ms, msAbs, m, "minute");
		}
		if (msAbs >= s) {
			return plural(ms, msAbs, s, "second");
		}
		return ms + " ms";
	}

	/**
	 * Pluralization helper.
	 */

	function plural(ms, msAbs, n, name) {
		var isPlural = msAbs >= n * 1.5;
		return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
	}
	return ms;
}

var common;
var hasRequiredCommon;

function requireCommon() {
	if (hasRequiredCommon) return common;
	hasRequiredCommon = 1;
	/**
	 * This is the common logic for both the Node.js and web browser
	 * implementations of `debug()`.
	 */

	function setup(env) {
		createDebug.debug = createDebug;
		createDebug.default = createDebug;
		createDebug.coerce = coerce;
		createDebug.disable = disable;
		createDebug.enable = enable;
		createDebug.enabled = enabled;
		createDebug.humanize = requireMs();
		createDebug.destroy = destroy;

		Object.keys(env).forEach((key) => {
			createDebug[key] = env[key];
		});

		/**
		 * The currently active debug mode names, and names to skip.
		 */

		createDebug.names = [];
		createDebug.skips = [];

		/**
		 * Map of special "%n" handling functions, for the debug "format" argument.
		 *
		 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
		 */
		createDebug.formatters = {};

		/**
		 * Selects a color for a debug namespace
		 * @param {String} namespace The namespace string for the debug instance to be colored
		 * @return {Number|String} An ANSI color code for the given namespace
		 * @api private
		 */
		function selectColor(namespace) {
			let hash = 0;

			for (let i = 0; i < namespace.length; i++) {
				hash = (hash << 5) - hash + namespace.charCodeAt(i);
				hash |= 0; // Convert to 32bit integer
			}

			return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
		}
		createDebug.selectColor = selectColor;

		/**
		 * Create a debugger with the given `namespace`.
		 *
		 * @param {String} namespace
		 * @return {Function}
		 * @api public
		 */
		function createDebug(namespace) {
			let prevTime;
			let enableOverride = null;
			let namespacesCache;
			let enabledCache;

			function debug(...args) {
				// Disabled?
				if (!debug.enabled) {
					return;
				}

				const self = debug;

				// Set `diff` timestamp
				const curr = Number(new Date());
				const ms = curr - (prevTime || curr);
				self.diff = ms;
				self.prev = prevTime;
				self.curr = curr;
				prevTime = curr;

				args[0] = createDebug.coerce(args[0]);

				if (typeof args[0] !== "string") {
					// Anything else let's inspect with %O
					args.unshift("%O");
				}

				// Apply any `formatters` transformations
				let index = 0;
				args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
					// If we encounter an escaped % then don't increase the array index
					if (match === "%%") {
						return "%";
					}
					index++;
					const formatter = createDebug.formatters[format];
					if (typeof formatter === "function") {
						const val = args[index];
						match = formatter.call(self, val);

						// Now we need to remove `args[index]` since it's inlined in the `format`
						args.splice(index, 1);
						index--;
					}
					return match;
				});

				// Apply env-specific formatting (colors, etc.)
				createDebug.formatArgs.call(self, args);

				const logFn = self.log || createDebug.log;
				logFn.apply(self, args);
			}

			debug.namespace = namespace;
			debug.useColors = createDebug.useColors();
			debug.color = createDebug.selectColor(namespace);
			debug.extend = extend;
			debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.

			Object.defineProperty(debug, "enabled", {
				enumerable: true,
				configurable: false,
				get: () => {
					if (enableOverride !== null) {
						return enableOverride;
					}
					if (namespacesCache !== createDebug.namespaces) {
						namespacesCache = createDebug.namespaces;
						enabledCache = createDebug.enabled(namespace);
					}

					return enabledCache;
				},
				set: (v) => {
					enableOverride = v;
				},
			});

			// Env-specific initialization logic for debug instances
			if (typeof createDebug.init === "function") {
				createDebug.init(debug);
			}

			return debug;
		}

		function extend(namespace, delimiter) {
			const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
			newDebug.log = this.log;
			return newDebug;
		}

		/**
		 * Enables a debug mode by namespaces. This can include modes
		 * separated by a colon and wildcards.
		 *
		 * @param {String} namespaces
		 * @api public
		 */
		function enable(namespaces) {
			createDebug.save(namespaces);
			createDebug.namespaces = namespaces;

			createDebug.names = [];
			createDebug.skips = [];

			const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);

			for (const ns of split) {
				if (ns[0] === "-") {
					createDebug.skips.push(ns.slice(1));
				} else {
					createDebug.names.push(ns);
				}
			}
		}

		/**
		 * Checks if the given string matches a namespace template, honoring
		 * asterisks as wildcards.
		 *
		 * @param {String} search
		 * @param {String} template
		 * @return {Boolean}
		 */
		function matchesTemplate(search, template) {
			let searchIndex = 0;
			let templateIndex = 0;
			let starIndex = -1;
			let matchIndex = 0;

			while (searchIndex < search.length) {
				if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
					// Match character or proceed with wildcard
					if (template[templateIndex] === "*") {
						starIndex = templateIndex;
						matchIndex = searchIndex;
						templateIndex++; // Skip the '*'
					} else {
						searchIndex++;
						templateIndex++;
					}
				} else if (starIndex !== -1) {
					// eslint-disable-line no-negated-condition
					// Backtrack to the last '*' and try to match more characters
					templateIndex = starIndex + 1;
					matchIndex++;
					searchIndex = matchIndex;
				} else {
					return false; // No match
				}
			}

			// Handle trailing '*' in template
			while (templateIndex < template.length && template[templateIndex] === "*") {
				templateIndex++;
			}

			return templateIndex === template.length;
		}

		/**
		 * Disable debug output.
		 *
		 * @return {String} namespaces
		 * @api public
		 */
		function disable() {
			const namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
			createDebug.enable("");
			return namespaces;
		}

		/**
		 * Returns true if the given mode name is enabled, false otherwise.
		 *
		 * @param {String} name
		 * @return {Boolean}
		 * @api public
		 */
		function enabled(name) {
			for (const skip of createDebug.skips) {
				if (matchesTemplate(name, skip)) {
					return false;
				}
			}

			for (const ns of createDebug.names) {
				if (matchesTemplate(name, ns)) {
					return true;
				}
			}

			return false;
		}

		/**
		 * Coerce `val`.
		 *
		 * @param {Mixed} val
		 * @return {Mixed}
		 * @api private
		 */
		function coerce(val) {
			if (val instanceof Error) {
				return val.stack || val.message;
			}
			return val;
		}

		/**
		 * XXX DO NOT USE. This is a temporary stub function.
		 * XXX It WILL be removed in the next major release.
		 */
		function destroy() {
			console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
		}

		createDebug.enable(createDebug.load());

		return createDebug;
	}

	common = setup;
	return common;
}

var hasRequiredBrowser;

function requireBrowser() {
	if (hasRequiredBrowser) return browser.exports;
	hasRequiredBrowser = 1;
	(function (module, exports) {
		var define_process_env_default = {};
		exports.formatArgs = formatArgs;
		exports.save = save;
		exports.load = load;
		exports.useColors = useColors;
		exports.storage = localstorage();
		exports.destroy = /* @__PURE__ */ (() => {
			let warned = false;
			return () => {
				if (!warned) {
					warned = true;
					console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
				}
			};
		})();
		exports.colors = [
			"#0000CC",
			"#0000FF",
			"#0033CC",
			"#0033FF",
			"#0066CC",
			"#0066FF",
			"#0099CC",
			"#0099FF",
			"#00CC00",
			"#00CC33",
			"#00CC66",
			"#00CC99",
			"#00CCCC",
			"#00CCFF",
			"#3300CC",
			"#3300FF",
			"#3333CC",
			"#3333FF",
			"#3366CC",
			"#3366FF",
			"#3399CC",
			"#3399FF",
			"#33CC00",
			"#33CC33",
			"#33CC66",
			"#33CC99",
			"#33CCCC",
			"#33CCFF",
			"#6600CC",
			"#6600FF",
			"#6633CC",
			"#6633FF",
			"#66CC00",
			"#66CC33",
			"#9900CC",
			"#9900FF",
			"#9933CC",
			"#9933FF",
			"#99CC00",
			"#99CC33",
			"#CC0000",
			"#CC0033",
			"#CC0066",
			"#CC0099",
			"#CC00CC",
			"#CC00FF",
			"#CC3300",
			"#CC3333",
			"#CC3366",
			"#CC3399",
			"#CC33CC",
			"#CC33FF",
			"#CC6600",
			"#CC6633",
			"#CC9900",
			"#CC9933",
			"#CCCC00",
			"#CCCC33",
			"#FF0000",
			"#FF0033",
			"#FF0066",
			"#FF0099",
			"#FF00CC",
			"#FF00FF",
			"#FF3300",
			"#FF3333",
			"#FF3366",
			"#FF3399",
			"#FF33CC",
			"#FF33FF",
			"#FF6600",
			"#FF6633",
			"#FF9900",
			"#FF9933",
			"#FFCC00",
			"#FFCC33",
		];
		function useColors() {
			if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
				return true;
			}
			if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
				return false;
			}
			let m;
			return (
				(typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || // Is firebug? http://stackoverflow.com/a/398120/376773
				(typeof window !== "undefined" && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || // Is firefox >= v31?
				// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
				(typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) || // Double check webkit in userAgent just in case we are in a worker
				(typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))
			);
		}
		function formatArgs(args) {
			args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
			if (!this.useColors) {
				return;
			}
			const c = "color: " + this.color;
			args.splice(1, 0, c, "color: inherit");
			let index = 0;
			let lastC = 0;
			args[0].replace(/%[a-zA-Z%]/g, (match) => {
				if (match === "%%") {
					return;
				}
				index++;
				if (match === "%c") {
					lastC = index;
				}
			});
			args.splice(lastC, 0, c);
		}
		exports.log = console.debug || console.log || (() => {});
		function save(namespaces) {
			try {
				if (namespaces) {
					exports.storage.setItem("debug", namespaces);
				} else {
					exports.storage.removeItem("debug");
				}
			} catch (error) {}
		}
		function load() {
			let r;
			try {
				r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
			} catch (error) {}
			if (!r && typeof process !== "undefined" && "env" in process) {
				r = define_process_env_default.DEBUG;
			}
			return r;
		}
		function localstorage() {
			try {
				return localStorage;
			} catch (error) {}
		}
		module.exports = requireCommon()(exports);
		const { formatters } = module.exports;
		formatters.j = function (v) {
			try {
				return JSON.stringify(v);
			} catch (error) {
				return "[UnexpectedJSONParseError]: " + error.message;
			}
		};
	})(browser, browser.exports);
	return browser.exports;
}

var FunctionStateMap = { exports: {} };

var PlayerStates = { exports: {} };

var hasRequiredPlayerStates;

function requirePlayerStates() {
	if (hasRequiredPlayerStates) return PlayerStates.exports;
	hasRequiredPlayerStates = 1;
	(function (module, exports) {
		Object.defineProperty(exports, "__esModule", {
			value: true,
		});
		exports.default = {
			BUFFERING: 3,
			ENDED: 0,
			PAUSED: 2,
			PLAYING: 1,
			UNSTARTED: -1,
			VIDEO_CUED: 5,
		};
		module.exports = exports["default"];
	})(PlayerStates, PlayerStates.exports);
	return PlayerStates.exports;
}

var hasRequiredFunctionStateMap;

function requireFunctionStateMap() {
	if (hasRequiredFunctionStateMap) return FunctionStateMap.exports;
	hasRequiredFunctionStateMap = 1;
	(function (module, exports) {
		Object.defineProperty(exports, "__esModule", {
			value: true,
		});

		var _PlayerStates = requirePlayerStates();

		var _PlayerStates2 = _interopRequireDefault(_PlayerStates);

		function _interopRequireDefault(obj) {
			return obj && obj.__esModule ? obj : { default: obj };
		}

		exports.default = {
			pauseVideo: {
				acceptableStates: [_PlayerStates2.default.ENDED, _PlayerStates2.default.PAUSED],
				stateChangeRequired: false,
			},
			playVideo: {
				acceptableStates: [_PlayerStates2.default.ENDED, _PlayerStates2.default.PLAYING],
				stateChangeRequired: false,
			},
			seekTo: {
				acceptableStates: [_PlayerStates2.default.ENDED, _PlayerStates2.default.PLAYING, _PlayerStates2.default.PAUSED],
				stateChangeRequired: true,

				// TRICKY: `seekTo` may not cause a state change if no buffering is
				// required.
				// eslint-disable-next-line unicorn/numeric-separators-style
				timeout: 3000,
			},
		};
		module.exports = exports["default"];
	})(FunctionStateMap, FunctionStateMap.exports);
	return FunctionStateMap.exports;
}

var eventNames = { exports: {} };

var hasRequiredEventNames;

function requireEventNames() {
	if (hasRequiredEventNames) return eventNames.exports;
	hasRequiredEventNames = 1;
	(function (module, exports) {
		Object.defineProperty(exports, "__esModule", {
			value: true,
		});

		/**
		 * @see https://developers.google.com/youtube/iframe_api_reference#Events
		 * `volumeChange` is not officially supported but seems to work
		 * it emits an object: `{volume: 82.6923076923077, muted: false}`
		 */
		exports.default = ["ready", "stateChange", "playbackQualityChange", "playbackRateChange", "error", "apiChange", "volumeChange"];
		module.exports = exports["default"];
	})(eventNames, eventNames.exports);
	return eventNames.exports;
}

var functionNames = { exports: {} };

var hasRequiredFunctionNames;

function requireFunctionNames() {
	if (hasRequiredFunctionNames) return functionNames.exports;
	hasRequiredFunctionNames = 1;
	(function (module, exports) {
		Object.defineProperty(exports, "__esModule", {
			value: true,
		});

		/**
		 * @see https://developers.google.com/youtube/iframe_api_reference#Functions
		 */
		exports.default = [
			"cueVideoById",
			"loadVideoById",
			"cueVideoByUrl",
			"loadVideoByUrl",
			"playVideo",
			"pauseVideo",
			"stopVideo",
			"getVideoLoadedFraction",
			"cuePlaylist",
			"loadPlaylist",
			"nextVideo",
			"previousVideo",
			"playVideoAt",
			"setShuffle",
			"setLoop",
			"getPlaylist",
			"getPlaylistIndex",
			"setOption",
			"mute",
			"unMute",
			"isMuted",
			"setVolume",
			"getVolume",
			"seekTo",
			"getPlayerState",
			"getPlaybackRate",
			"setPlaybackRate",
			"getAvailablePlaybackRates",
			"getPlaybackQuality",
			"setPlaybackQuality",
			"getAvailableQualityLevels",
			"getCurrentTime",
			"getDuration",
			"removeEventListener",
			"getVideoUrl",
			"getVideoEmbedCode",
			"getOptions",
			"getOption",
			"addEventListener",
			"destroy",
			"setSize",
			"getIframe",
			"getSphericalProperties",
			"setSphericalProperties",
		];
		module.exports = exports["default"];
	})(functionNames, functionNames.exports);
	return functionNames.exports;
}

var hasRequiredYouTubePlayer;

function requireYouTubePlayer() {
	if (hasRequiredYouTubePlayer) return YouTubePlayer$1.exports;
	hasRequiredYouTubePlayer = 1;
	(function (module, exports) {
		Object.defineProperty(exports, "__esModule", {
			value: true,
		});

		var _debug = requireBrowser();

		var _debug2 = _interopRequireDefault(_debug);

		var _FunctionStateMap = requireFunctionStateMap();

		var _FunctionStateMap2 = _interopRequireDefault(_FunctionStateMap);

		var _eventNames = requireEventNames();

		var _eventNames2 = _interopRequireDefault(_eventNames);

		var _functionNames = requireFunctionNames();

		var _functionNames2 = _interopRequireDefault(_functionNames);

		function _interopRequireDefault(obj) {
			return obj && obj.__esModule ? obj : { default: obj };
		}

		/* eslint-disable promise/prefer-await-to-then */

		const debug = (0, _debug2.default)("youtube-player");

		const YouTubePlayer = {};

		/**
		 * Construct an object that defines an event handler for all of the YouTube
		 * player events. Proxy captured events through an event emitter.
		 *
		 * @todo Capture event parameters.
		 * @see https://developers.google.com/youtube/iframe_api_reference#Events
		 */
		YouTubePlayer.proxyEvents = (emitter) => {
			const events = {};

			for (const eventName of _eventNames2.default) {
				const onEventName = "on" + eventName.slice(0, 1).toUpperCase() + eventName.slice(1);

				events[onEventName] = (event) => {
					debug('event "%s"', onEventName, event);

					emitter.trigger(eventName, event);
				};
			}

			return events;
		};

		/**
		 * Delays player API method execution until player state is ready.
		 *
		 * @todo Proxy all of the methods using Object.keys.
		 * @todo See TRICKY below.
		 * @param playerAPIReady Promise that resolves when player is ready.
		 * @param strictState A flag designating whether or not to wait for
		 * an acceptable state when calling supported functions.
		 * @returns {object}
		 */
		YouTubePlayer.promisifyPlayer = (playerAPIReady, strictState = false) => {
			const functions = {};

			for (const functionName of _functionNames2.default) {
				if (strictState && _FunctionStateMap2.default[functionName]) {
					functions[functionName] = (...args) => {
						return playerAPIReady.then((player) => {
							const stateInfo = _FunctionStateMap2.default[functionName];
							const playerState = player.getPlayerState();

							// eslint-disable-next-line no-warning-comments
							// TODO: Just spread the args into the function once Babel is fixed:
							// https://github.com/babel/babel/issues/4270
							//
							// eslint-disable-next-line prefer-spread
							const value = player[functionName].apply(player, args);

							// TRICKY: For functions like `seekTo`, a change in state must be
							// triggered given that the resulting state could match the initial
							// state.
							if (
								stateInfo.stateChangeRequired ||
								// eslint-disable-next-line no-extra-parens
								(Array.isArray(stateInfo.acceptableStates) && !stateInfo.acceptableStates.includes(playerState))
							) {
								return new Promise((resolve) => {
									const onPlayerStateChange = () => {
										const playerStateAfterChange = player.getPlayerState();

										let timeout;

										if (typeof stateInfo.timeout === "number") {
											timeout = setTimeout(() => {
												player.removeEventListener("onStateChange", onPlayerStateChange);

												resolve();
											}, stateInfo.timeout);
										}

										if (Array.isArray(stateInfo.acceptableStates) && stateInfo.acceptableStates.includes(playerStateAfterChange)) {
											player.removeEventListener("onStateChange", onPlayerStateChange);

											clearTimeout(timeout);

											resolve();
										}
									};

									player.addEventListener("onStateChange", onPlayerStateChange);
								}).then(() => {
									return value;
								});
							}

							return value;
						});
					};
				} else {
					functions[functionName] = (...args) => {
						return playerAPIReady.then((player) => {
							// eslint-disable-next-line no-warning-comments
							// TODO: Just spread the args into the function once Babel is fixed:
							// https://github.com/babel/babel/issues/4270
							//
							// eslint-disable-next-line prefer-spread
							return player[functionName].apply(player, args);
						});
					};
				}
			}

			return functions;
		};

		exports.default = YouTubePlayer;
		module.exports = exports["default"];
	})(YouTubePlayer$1, YouTubePlayer$1.exports);
	return YouTubePlayer$1.exports;
}

var loadYouTubeIframeApi = { exports: {} };

var loadScript;
var hasRequiredLoadScript;

function requireLoadScript() {
	if (hasRequiredLoadScript) return loadScript;
	hasRequiredLoadScript = 1;
	loadScript = function load(src, opts, cb) {
		var head = document.head || document.getElementsByTagName("head")[0];
		var script = document.createElement("script");

		if (typeof opts === "function") {
			cb = opts;
			opts = {};
		}

		opts = opts || {};
		cb = cb || function () {};

		script.type = opts.type || "text/javascript";
		script.charset = opts.charset || "utf8";
		script.async = "async" in opts ? !!opts.async : true;
		script.src = src;

		if (opts.attrs) {
			setAttributes(script, opts.attrs);
		}

		if (opts.text) {
			script.text = "" + opts.text;
		}

		var onend = "onload" in script ? stdOnEnd : ieOnEnd;
		onend(script, cb);

		// some good legacy browsers (firefox) fail the 'in' detection above
		// so as a fallback we always set onload
		// old IE will ignore this and new IE will set onload
		if (!script.onload) {
			stdOnEnd(script, cb);
		}

		head.appendChild(script);
	};

	function setAttributes(script, attrs) {
		for (var attr in attrs) {
			script.setAttribute(attr, attrs[attr]);
		}
	}

	function stdOnEnd(script, cb) {
		script.onload = function () {
			this.onerror = this.onload = null;
			cb(null, script);
		};
		script.onerror = function () {
			// this.onload = null here is necessary
			// because even IE9 works not like others
			this.onerror = this.onload = null;
			cb(new Error("Failed to load " + this.src), script);
		};
	}

	function ieOnEnd(script, cb) {
		script.onreadystatechange = function () {
			if (this.readyState != "complete" && this.readyState != "loaded") return;
			this.onreadystatechange = null;
			cb(null, script); // there is no way to catch loading errors in IE8
		};
	}
	return loadScript;
}

var hasRequiredLoadYouTubeIframeApi;

function requireLoadYouTubeIframeApi() {
	if (hasRequiredLoadYouTubeIframeApi) return loadYouTubeIframeApi.exports;
	hasRequiredLoadYouTubeIframeApi = 1;
	(function (module, exports) {
		Object.defineProperty(exports, "__esModule", {
			value: true,
		});

		var _loadScript = requireLoadScript();

		var _loadScript2 = _interopRequireDefault(_loadScript);

		function _interopRequireDefault(obj) {
			return obj && obj.__esModule ? obj : { default: obj };
		}

		exports.default = (emitter) => {
			/**
			 * A promise that is resolved when window.onYouTubeIframeAPIReady is called.
			 * The promise is resolved with a reference to window.YT object.
			 */
			const iframeAPIReady = new Promise((resolve) => {
				if (window.YT && window.YT.Player && window.YT.Player instanceof Function) {
					resolve(window.YT);

					return;
				} else {
					const protocol = window.location.protocol === "http:" ? "http:" : "https:";

					(0, _loadScript2.default)(protocol + "//www.youtube.com/iframe_api", (error) => {
						if (error) {
							emitter.trigger("error", error);
						}
					});
				}

				const previous = window.onYouTubeIframeAPIReady;

				// The API will call this function when page has finished downloading
				// the JavaScript for the player API.
				window.onYouTubeIframeAPIReady = () => {
					if (previous) {
						previous();
					}

					resolve(window.YT);
				};
			});

			return iframeAPIReady;
		};

		module.exports = exports["default"];
	})(loadYouTubeIframeApi, loadYouTubeIframeApi.exports);
	return loadYouTubeIframeApi.exports;
}

var hasRequiredDist;

function requireDist() {
	if (hasRequiredDist) return dist.exports;
	hasRequiredDist = 1;
	(function (module, exports) {
		Object.defineProperty(exports, "__esModule", {
			value: true,
		});

		var _sister = requireSister();

		var _sister2 = _interopRequireDefault(_sister);

		var _YouTubePlayer = requireYouTubePlayer();

		var _YouTubePlayer2 = _interopRequireDefault(_YouTubePlayer);

		var _loadYouTubeIframeApi = requireLoadYouTubeIframeApi();

		var _loadYouTubeIframeApi2 = _interopRequireDefault(_loadYouTubeIframeApi);

		function _interopRequireDefault(obj) {
			return obj && obj.__esModule ? obj : { default: obj };
		}

		/**
		 * @typedef YT.Player
		 * @see https://developers.google.com/youtube/iframe_api_reference
		 */

		/**
		 * @see https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player
		 */
		let youtubeIframeAPI;

		/**
		 * A factory function used to produce an instance of YT.Player and queue function calls and proxy events of the resulting object.
		 *
		 * @param maybeElementId Either An existing YT.Player instance,
		 * the DOM element or the id of the HTML element where the API will insert an <iframe>.
		 * @param options See `options` (Ignored when using an existing YT.Player instance).
		 * @param strictState A flag designating whether or not to wait for
		 * an acceptable state when calling supported functions. Default: `false`.
		 * See `FunctionStateMap.js` for supported functions and acceptable states.
		 */

		exports.default = (maybeElementId, options = {}, strictState = false) => {
			const emitter = (0, _sister2.default)();

			if (!youtubeIframeAPI) {
				youtubeIframeAPI = (0, _loadYouTubeIframeApi2.default)(emitter);
			}

			if (options.events) {
				throw new Error("Event handlers cannot be overwritten.");
			}

			// eslint-disable-next-line unicorn/prefer-query-selector
			if (typeof maybeElementId === "string" && !document.getElementById(maybeElementId)) {
				throw new Error('Element "' + maybeElementId + '" does not exist.');
			}

			options.events = _YouTubePlayer2.default.proxyEvents(emitter);

			const playerAPIReady = new Promise((resolve) => {
				if (typeof maybeElementId === "object" && maybeElementId.playVideo instanceof Function) {
					const player = maybeElementId;

					resolve(player);
				} else {
					// asume maybeElementId can be rendered inside
					// eslint-disable-next-line promise/catch-or-return
					youtubeIframeAPI.then((YT) => {
						// eslint-disable-line promise/prefer-await-to-then
						const player = new YT.Player(maybeElementId, options);

						emitter.on("ready", () => {
							resolve(player);
						});

						return null;
					});
				}
			});

			const playerApi = _YouTubePlayer2.default.promisifyPlayer(playerAPIReady, strictState);

			playerApi.on = emitter.on;
			playerApi.off = emitter.off;

			return playerApi;
		};

		module.exports = exports["default"];
	})(dist, dist.exports);
	return dist.exports;
}

var distExports = requireDist();
const YouTubePlayer = /*@__PURE__*/ getDefaultExportFromCjs(distExports);

/*! @vimeo/player v2.30.4 | (c) 2026 Vimeo | MIT License | https://github.com/vimeo/player.js */
/**
 * @module lib/functions
 */

/**
 * Check to see this is a Node environment.
 * @type {boolean}
 */
/* global global */
const isNode = typeof global !== "undefined" && {}.toString.call(global) === "[object global]";

/**
 * Check to see if this is a Bun environment.
 * @see https://bun.sh/guides/util/detect-bun
 * @type {boolean}
 */
const isBun = typeof Bun !== "undefined";

/**
 * Check to see if this is a Deno environment.
 * @see https://docs.deno.com/api/deno/~/Deno
 * @type {boolean}
 */
const isDeno = typeof Deno !== "undefined";

/**
 * Check to see if this is a Cloudflare Worker environment.
 * @see https://community.cloudflare.com/t/how-to-detect-the-cloudflare-worker-runtime/293715
 * @type {boolean}
 */
const isCloudflareWorker = typeof WebSocketPair === "function" && typeof caches?.default !== "undefined";

/**
 * Check if this is a server runtime
 * @type {boolean}
 */
const isServerRuntime = isNode || isBun || isDeno || isCloudflareWorker;

/**
 * Get the name of the method for a given getter or setter.
 *
 * @param {string} prop The name of the property.
 * @param {string} type Either “get” or “set”.
 * @return {string}
 */
function getMethodName(prop, type) {
	if (prop.indexOf(type.toLowerCase()) === 0) {
		return prop;
	}
	return `${type.toLowerCase()}${prop.substr(0, 1).toUpperCase()}${prop.substr(1)}`;
}

/**
 * Check to see if the object is a DOM Element.
 *
 * @param {*} element The object to check.
 * @return {boolean}
 */
function isDomElement(element) {
	return Boolean(element && element.nodeType === 1 && "nodeName" in element && element.ownerDocument && element.ownerDocument.defaultView);
}

/**
 * Check to see whether the value is a number.
 *
 * @see http://dl.dropboxusercontent.com/u/35146/js/tests/isNumber.html
 * @param {*} value The value to check.
 * @param {boolean} integer Check if the value is an integer.
 * @return {boolean}
 */
function isInteger(value) {
	// eslint-disable-next-line eqeqeq
	return !isNaN(parseFloat(value)) && isFinite(value) && Math.floor(value) == value;
}

/**
 * Check to see if the URL is a Vimeo url.
 *
 * @param {string} url The url string.
 * @return {boolean}
 */
function isVimeoUrl(url) {
	return /^(https?:)?\/\/((((player|www)\.)?vimeo\.com)|((player\.)?[a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))(?=$|\/)/.test(url);
}

/**
 * Check to see if the URL is for a Vimeo embed.
 *
 * @param {string} url The url string.
 * @return {boolean}
 */
function isVimeoEmbed(url) {
	const expr = /^https:\/\/player\.((vimeo\.com)|([a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))\/video\/\d+/;
	return expr.test(url);
}
function getOembedDomain(url) {
	const match = (url || "").match(/^(?:https?:)?(?:\/\/)?([^/?]+)/);
	const domain = ((match && match[1]) || "").replace("player.", "");
	const customDomains = [".videoji.hk", ".vimeo.work", ".videoji.cn"];
	for (const customDomain of customDomains) {
		if (domain.endsWith(customDomain)) {
			return domain;
		}
	}
	return "vimeo.com";
}

/**
 * Get the Vimeo URL from an element.
 * The element must have either a data-vimeo-id or data-vimeo-url attribute.
 *
 * @param {object} oEmbedParameters The oEmbed parameters.
 * @return {string}
 */
function getVimeoUrl() {
	let oEmbedParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
	const id = oEmbedParameters.id;
	const url = oEmbedParameters.url;
	const idOrUrl = id || url;
	if (!idOrUrl) {
		throw new Error("An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.");
	}
	if (isInteger(idOrUrl)) {
		return `https://vimeo.com/${idOrUrl}`;
	}
	if (isVimeoUrl(idOrUrl)) {
		return idOrUrl.replace("http:", "https:");
	}
	if (id) {
		throw new TypeError(`“${id}” is not a valid video id.`);
	}
	throw new TypeError(`“${idOrUrl}” is not a vimeo.com url.`);
}

/* eslint-disable max-params */
/**
 * A utility method for attaching and detaching event handlers
 *
 * @param {EventTarget} target
 * @param {string | string[]} eventName
 * @param {function} callback
 * @param {'addEventListener' | 'on'} onName
 * @param {'removeEventListener' | 'off'} offName
 * @return {{cancel: (function(): void)}}
 */
const subscribe = function (target, eventName, callback) {
	let onName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "addEventListener";
	let offName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "removeEventListener";
	const eventNames = typeof eventName === "string" ? [eventName] : eventName;
	eventNames.forEach((evName) => {
		target[onName](evName, callback);
	});
	return {
		cancel: () => eventNames.forEach((evName) => target[offName](evName, callback)),
	};
};

/**
 * Find the iframe element that contains a specific source window
 *
 * @param {Window} sourceWindow The source window to find the iframe for
 * @param {Document} [doc=document] The document to search within
 * @return {HTMLIFrameElement|null} The iframe element if found, otherwise null
 */
function findIframeBySourceWindow(sourceWindow) {
	let doc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
	if (!sourceWindow || !doc || typeof doc.querySelectorAll !== "function") {
		return null;
	}
	const iframes = doc.querySelectorAll("iframe");
	for (let i = 0; i < iframes.length; i++) {
		if (iframes[i] && iframes[i].contentWindow === sourceWindow) {
			return iframes[i];
		}
	}
	return null;
}

const arrayIndexOfSupport = typeof Array.prototype.indexOf !== "undefined";
const postMessageSupport = typeof window !== "undefined" && typeof window.postMessage !== "undefined";
if (!isServerRuntime && (!arrayIndexOfSupport || !postMessageSupport)) {
	throw new Error("Sorry, the Vimeo Player API is not available in this browser.");
}

var commonjsGlobal =
	typeof globalThis !== "undefined" ? globalThis
	: typeof window !== "undefined" ? window
	: typeof global !== "undefined" ? global
	: typeof self !== "undefined" ? self
	: {};

function createCommonjsModule(fn, module) {
	return ((module = { exports: {} }), fn(module, module.exports), module.exports);
}

/*!
 * weakmap-polyfill v2.0.4 - ECMAScript6 WeakMap polyfill
 * https://github.com/polygonplanet/weakmap-polyfill
 * Copyright (c) 2015-2021 polygonplanet <polygon.planet.aqua@gmail.com>
 * @license MIT
 */

(function (self) {
	if (self.WeakMap) {
		return;
	}
	var hasOwnProperty = Object.prototype.hasOwnProperty;
	var hasDefine =
		Object.defineProperty &&
		(function () {
			try {
				// Avoid IE8's broken Object.defineProperty
				return (
					Object.defineProperty({}, "x", {
						value: 1,
					}).x === 1
				);
			} catch (e) {}
		})();
	var defineProperty = function (object, name, value) {
		if (hasDefine) {
			Object.defineProperty(object, name, {
				configurable: true,
				writable: true,
				value: value,
			});
		} else {
			object[name] = value;
		}
	};
	self.WeakMap = (function () {
		// ECMA-262 23.3 WeakMap Objects
		function WeakMap() {
			if (this === void 0) {
				throw new TypeError("Constructor WeakMap requires 'new'");
			}
			defineProperty(this, "_id", genId("_WeakMap"));

			// ECMA-262 23.3.1.1 WeakMap([iterable])
			if (arguments.length > 0) {
				// Currently, WeakMap `iterable` argument is not supported
				throw new TypeError("WeakMap iterable is not supported");
			}
		}

		// ECMA-262 23.3.3.2 WeakMap.prototype.delete(key)
		defineProperty(WeakMap.prototype, "delete", function (key) {
			checkInstance(this, "delete");
			if (!isObject(key)) {
				return false;
			}
			var entry = key[this._id];
			if (entry && entry[0] === key) {
				delete key[this._id];
				return true;
			}
			return false;
		});

		// ECMA-262 23.3.3.3 WeakMap.prototype.get(key)
		defineProperty(WeakMap.prototype, "get", function (key) {
			checkInstance(this, "get");
			if (!isObject(key)) {
				return void 0;
			}
			var entry = key[this._id];
			if (entry && entry[0] === key) {
				return entry[1];
			}
			return void 0;
		});

		// ECMA-262 23.3.3.4 WeakMap.prototype.has(key)
		defineProperty(WeakMap.prototype, "has", function (key) {
			checkInstance(this, "has");
			if (!isObject(key)) {
				return false;
			}
			var entry = key[this._id];
			if (entry && entry[0] === key) {
				return true;
			}
			return false;
		});

		// ECMA-262 23.3.3.5 WeakMap.prototype.set(key, value)
		defineProperty(WeakMap.prototype, "set", function (key, value) {
			checkInstance(this, "set");
			if (!isObject(key)) {
				throw new TypeError("Invalid value used as weak map key");
			}
			var entry = key[this._id];
			if (entry && entry[0] === key) {
				entry[1] = value;
				return this;
			}
			defineProperty(key, this._id, [key, value]);
			return this;
		});
		function checkInstance(x, methodName) {
			if (!isObject(x) || !hasOwnProperty.call(x, "_id")) {
				throw new TypeError(methodName + " method called on incompatible receiver " + typeof x);
			}
		}
		function genId(prefix) {
			return prefix + "_" + rand() + "." + rand();
		}
		function rand() {
			return Math.random().toString().substring(2);
		}
		defineProperty(WeakMap, "_polyfill", true);
		return WeakMap;
	})();
	function isObject(x) {
		return Object(x) === x;
	}
})(
	typeof globalThis !== "undefined" ? globalThis
	: typeof self !== "undefined" ? self
	: typeof window !== "undefined" ? window
	: typeof commonjsGlobal !== "undefined" ? commonjsGlobal
	: commonjsGlobal,
);

var npo_src = createCommonjsModule(function (module) {
	/*! Native Promise Only
    v0.8.1 (c) Kyle Simpson
    MIT License: http://getify.mit-license.org
*/

	(function UMD(name, context, definition) {
		// special form of UMD for polyfilling across evironments
		context[name] = context[name] || definition();
		if (module.exports) {
			module.exports = context[name];
		}
	})("Promise", typeof commonjsGlobal != "undefined" ? commonjsGlobal : commonjsGlobal, function DEF() {
		var builtInProp,
			cycle,
			scheduling_queue,
			ToString = Object.prototype.toString,
			timer =
				typeof setImmediate != "undefined" ?
					function timer(fn) {
						return setImmediate(fn);
					}
				:	setTimeout;

		// dammit, IE8.
		try {
			Object.defineProperty({}, "x", {});
			builtInProp = function builtInProp(obj, name, val, config) {
				return Object.defineProperty(obj, name, {
					value: val,
					writable: true,
					configurable: config !== false,
				});
			};
		} catch (err) {
			builtInProp = function builtInProp(obj, name, val) {
				obj[name] = val;
				return obj;
			};
		}

		// Note: using a queue instead of array for efficiency
		scheduling_queue = (function Queue() {
			var first, last, item;
			function Item(fn, self) {
				this.fn = fn;
				this.self = self;
				this.next = void 0;
			}
			return {
				add: function add(fn, self) {
					item = new Item(fn, self);
					if (last) {
						last.next = item;
					} else {
						first = item;
					}
					last = item;
					item = void 0;
				},
				drain: function drain() {
					var f = first;
					first = last = cycle = void 0;
					while (f) {
						f.fn.call(f.self);
						f = f.next;
					}
				},
			};
		})();
		function schedule(fn, self) {
			scheduling_queue.add(fn, self);
			if (!cycle) {
				cycle = timer(scheduling_queue.drain);
			}
		}

		// promise duck typing
		function isThenable(o) {
			var _then,
				o_type = typeof o;
			if (o != null && (o_type == "object" || o_type == "function")) {
				_then = o.then;
			}
			return typeof _then == "function" ? _then : false;
		}
		function notify() {
			for (var i = 0; i < this.chain.length; i++) {
				notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]);
			}
			this.chain.length = 0;
		}

		// NOTE: This is a separate function to isolate
		// the `try..catch` so that other code can be
		// optimized better
		function notifyIsolated(self, cb, chain) {
			var ret, _then;
			try {
				if (cb === false) {
					chain.reject(self.msg);
				} else {
					if (cb === true) {
						ret = self.msg;
					} else {
						ret = cb.call(void 0, self.msg);
					}
					if (ret === chain.promise) {
						chain.reject(TypeError("Promise-chain cycle"));
					} else if ((_then = isThenable(ret))) {
						_then.call(ret, chain.resolve, chain.reject);
					} else {
						chain.resolve(ret);
					}
				}
			} catch (err) {
				chain.reject(err);
			}
		}
		function resolve(msg) {
			var _then,
				self = this;

			// already triggered?
			if (self.triggered) {
				return;
			}
			self.triggered = true;

			// unwrap
			if (self.def) {
				self = self.def;
			}
			try {
				if ((_then = isThenable(msg))) {
					schedule(function () {
						var def_wrapper = new MakeDefWrapper(self);
						try {
							_then.call(
								msg,
								function $resolve$() {
									resolve.apply(def_wrapper, arguments);
								},
								function $reject$() {
									reject.apply(def_wrapper, arguments);
								},
							);
						} catch (err) {
							reject.call(def_wrapper, err);
						}
					});
				} else {
					self.msg = msg;
					self.state = 1;
					if (self.chain.length > 0) {
						schedule(notify, self);
					}
				}
			} catch (err) {
				reject.call(new MakeDefWrapper(self), err);
			}
		}
		function reject(msg) {
			var self = this;

			// already triggered?
			if (self.triggered) {
				return;
			}
			self.triggered = true;

			// unwrap
			if (self.def) {
				self = self.def;
			}
			self.msg = msg;
			self.state = 2;
			if (self.chain.length > 0) {
				schedule(notify, self);
			}
		}
		function iteratePromises(Constructor, arr, resolver, rejecter) {
			for (var idx = 0; idx < arr.length; idx++) {
				(function IIFE(idx) {
					Constructor.resolve(arr[idx]).then(function $resolver$(msg) {
						resolver(idx, msg);
					}, rejecter);
				})(idx);
			}
		}
		function MakeDefWrapper(self) {
			this.def = self;
			this.triggered = false;
		}
		function MakeDef(self) {
			this.promise = self;
			this.state = 0;
			this.triggered = false;
			this.chain = [];
			this.msg = void 0;
		}
		function Promise(executor) {
			if (typeof executor != "function") {
				throw TypeError("Not a function");
			}
			if (this.__NPO__ !== 0) {
				throw TypeError("Not a promise");
			}

			// instance shadowing the inherited "brand"
			// to signal an already "initialized" promise
			this.__NPO__ = 1;
			var def = new MakeDef(this);
			this["then"] = function then(success, failure) {
				var o = {
					success: typeof success == "function" ? success : true,
					failure: typeof failure == "function" ? failure : false,
				};
				// Note: `then(..)` itself can be borrowed to be used against
				// a different promise constructor for making the chained promise,
				// by substituting a different `this` binding.
				o.promise = new this.constructor(function extractChain(resolve, reject) {
					if (typeof resolve != "function" || typeof reject != "function") {
						throw TypeError("Not a function");
					}
					o.resolve = resolve;
					o.reject = reject;
				});
				def.chain.push(o);
				if (def.state !== 0) {
					schedule(notify, def);
				}
				return o.promise;
			};
			this["catch"] = function $catch$(failure) {
				return this.then(void 0, failure);
			};
			try {
				executor.call(
					void 0,
					function publicResolve(msg) {
						resolve.call(def, msg);
					},
					function publicReject(msg) {
						reject.call(def, msg);
					},
				);
			} catch (err) {
				reject.call(def, err);
			}
		}
		var PromisePrototype = builtInProp({}, "constructor", Promise, /*configurable=*/ false);

		// Note: Android 4 cannot use `Object.defineProperty(..)` here
		Promise.prototype = PromisePrototype;

		// built-in "brand" to signal an "uninitialized" promise
		builtInProp(PromisePrototype, "__NPO__", 0, /*configurable=*/ false);
		builtInProp(Promise, "resolve", function Promise$resolve(msg) {
			var Constructor = this;

			// spec mandated checks
			// note: best "isPromise" check that's practical for now
			if (msg && typeof msg == "object" && msg.__NPO__ === 1) {
				return msg;
			}
			return new Constructor(function executor(resolve, reject) {
				if (typeof resolve != "function" || typeof reject != "function") {
					throw TypeError("Not a function");
				}
				resolve(msg);
			});
		});
		builtInProp(Promise, "reject", function Promise$reject(msg) {
			return new this(function executor(resolve, reject) {
				if (typeof resolve != "function" || typeof reject != "function") {
					throw TypeError("Not a function");
				}
				reject(msg);
			});
		});
		builtInProp(Promise, "all", function Promise$all(arr) {
			var Constructor = this;

			// spec mandated checks
			if (ToString.call(arr) != "[object Array]") {
				return Constructor.reject(TypeError("Not an array"));
			}
			if (arr.length === 0) {
				return Constructor.resolve([]);
			}
			return new Constructor(function executor(resolve, reject) {
				if (typeof resolve != "function" || typeof reject != "function") {
					throw TypeError("Not a function");
				}
				var len = arr.length,
					msgs = Array(len),
					count = 0;
				iteratePromises(
					Constructor,
					arr,
					function resolver(idx, msg) {
						msgs[idx] = msg;
						if (++count === len) {
							resolve(msgs);
						}
					},
					reject,
				);
			});
		});
		builtInProp(Promise, "race", function Promise$race(arr) {
			var Constructor = this;

			// spec mandated checks
			if (ToString.call(arr) != "[object Array]") {
				return Constructor.reject(TypeError("Not an array"));
			}
			return new Constructor(function executor(resolve, reject) {
				if (typeof resolve != "function" || typeof reject != "function") {
					throw TypeError("Not a function");
				}
				iteratePromises(
					Constructor,
					arr,
					function resolver(idx, msg) {
						resolve(msg);
					},
					reject,
				);
			});
		});
		return Promise;
	});
});

/**
 * @module lib/callbacks
 */

const callbackMap = new WeakMap();

/**
 * Store a callback for a method or event for a player.
 *
 * @param {Player} player The player object.
 * @param {string} name The method or event name.
 * @param {(function(this:Player, *): void|{resolve: function, reject: function})} callback
 *        The callback to call or an object with resolve and reject functions for a promise.
 * @return {void}
 */
function storeCallback(player, name, callback) {
	const playerCallbacks = callbackMap.get(player.element) || {};
	if (!(name in playerCallbacks)) {
		playerCallbacks[name] = [];
	}
	playerCallbacks[name].push(callback);
	callbackMap.set(player.element, playerCallbacks);
}

/**
 * Get the callbacks for a player and event or method.
 *
 * @param {Player} player The player object.
 * @param {string} name The method or event name
 * @return {function[]}
 */
function getCallbacks(player, name) {
	const playerCallbacks = callbackMap.get(player.element) || {};
	return playerCallbacks[name] || [];
}

/**
 * Remove a stored callback for a method or event for a player.
 *
 * @param {Player} player The player object.
 * @param {string} name The method or event name
 * @param {function} [callback] The specific callback to remove.
 * @return {boolean} Was this the last callback?
 */
function removeCallback(player, name, callback) {
	const playerCallbacks = callbackMap.get(player.element) || {};
	if (!playerCallbacks[name]) {
		return true;
	}

	// If no callback is passed, remove all callbacks for the event
	if (!callback) {
		playerCallbacks[name] = [];
		callbackMap.set(player.element, playerCallbacks);
		return true;
	}
	const index = playerCallbacks[name].indexOf(callback);
	if (index !== -1) {
		playerCallbacks[name].splice(index, 1);
	}
	callbackMap.set(player.element, playerCallbacks);
	return playerCallbacks[name] && playerCallbacks[name].length === 0;
}

/**
 * Return the first stored callback for a player and event or method.
 *
 * @param {Player} player The player object.
 * @param {string} name The method or event name.
 * @return {function} The callback, or false if there were none
 */
function shiftCallbacks(player, name) {
	const playerCallbacks = getCallbacks(player, name);
	if (playerCallbacks.length < 1) {
		return false;
	}
	const callback = playerCallbacks.shift();
	removeCallback(player, name, callback);
	return callback;
}

/**
 * Move callbacks associated with an element to another element.
 *
 * @param {HTMLElement} oldElement The old element.
 * @param {HTMLElement} newElement The new element.
 * @return {void}
 */
function swapCallbacks(oldElement, newElement) {
	const playerCallbacks = callbackMap.get(oldElement);
	callbackMap.set(newElement, playerCallbacks);
	callbackMap.delete(oldElement);
}

/**
 * @module lib/postmessage
 */

/**
 * Parse a message received from postMessage.
 *
 * @param {*} data The data received from postMessage.
 * @return {object}
 */
function parseMessageData(data) {
	if (typeof data === "string") {
		try {
			data = JSON.parse(data);
		} catch (error) {
			// If the message cannot be parsed, throw the error as a warning
			console.warn(error);
			return {};
		}
	}
	return data;
}

/**
 * Post a message to the specified target.
 *
 * @param {Player} player The player object to use.
 * @param {string} method The API method to call.
 * @param {string|number|object|Array|undefined} params The parameters to send to the player.
 * @return {void}
 */
function postMessage(player, method, params) {
	if (!player.element.contentWindow || !player.element.contentWindow.postMessage) {
		return;
	}
	let message = {
		method,
	};
	if (params !== undefined) {
		message.value = params;
	}

	// IE 8 and 9 do not support passing messages, so stringify them
	const ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, "$1"));
	if (ieVersion >= 8 && ieVersion < 10) {
		message = JSON.stringify(message);
	}
	player.element.contentWindow.postMessage(message, player.origin);
}

/**
 * Parse the data received from a message event.
 *
 * @param {Player} player The player that received the message.
 * @param {(Object|string)} data The message data. Strings will be parsed into JSON.
 * @return {void}
 */
function processData(player, data) {
	data = parseMessageData(data);
	let callbacks = [];
	let param;
	if (data.event) {
		if (data.event === "error") {
			const promises = getCallbacks(player, data.data.method);
			promises.forEach((promise) => {
				const error = new Error(data.data.message);
				error.name = data.data.name;
				promise.reject(error);
				removeCallback(player, data.data.method, promise);
			});
		}
		callbacks = getCallbacks(player, `event:${data.event}`);
		param = data.data;
	} else if (data.method) {
		const callback = shiftCallbacks(player, data.method);
		if (callback) {
			callbacks.push(callback);
			param = data.value;
		}
	}
	callbacks.forEach((callback) => {
		try {
			if (typeof callback === "function") {
				callback.call(player, param);
				return;
			}
			callback.resolve(param);
		} catch (e) {
			// empty
		}
	});
}

/**
 * @module lib/embed
 */
const oEmbedParameters = [
	"airplay",
	"audio_tracks",
	"audiotrack",
	"autopause",
	"autoplay",
	"background",
	"byline",
	"cc",
	"chapter_id",
	"chapters",
	"chromecast",
	"color",
	"colors",
	"controls",
	"disable_context_menu",
	"dnt",
	"end_time",
	"fullscreen",
	"height",
	"id",
	"initial_quality",
	"interactive_params",
	"keyboard",
	"loop",
	"maxheight",
	"max_quality",
	"maxwidth",
	"min_quality",
	"muted",
	"play_button_position",
	"playsinline",
	"portrait",
	"preload",
	"progress_bar",
	"quality",
	"quality_selector",
	"responsive",
	"skipping_forward",
	"speed",
	"start_time",
	"texttrack",
	"thumbnail_id",
	"title",
	"transcript",
	"transparent",
	"unmute_button",
	"url",
	"vimeo_logo",
	"volume",
	"watch_full_video",
	"width",
];

/**
 * Get the 'data-vimeo'-prefixed attributes from an element as an object.
 *
 * @param {HTMLElement} element The element.
 * @param {Object} [defaults={}] The default values to use.
 * @return {Object<string, string>}
 */
function getOEmbedParameters(element) {
	let defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
	return oEmbedParameters.reduce((params, param) => {
		const value = element.getAttribute(`data-vimeo-${param}`);
		if (value || value === "") {
			params[param] = value === "" ? 1 : value;
		}
		return params;
	}, defaults);
}

/**
 * Create an embed from oEmbed data inside an element.
 *
 * @param {object} data The oEmbed data.
 * @param {HTMLElement} element The element to put the iframe in.
 * @return {HTMLIFrameElement} The iframe embed.
 */
function createEmbed(_ref, element) {
	let { html } = _ref;
	if (!element) {
		throw new TypeError("An element must be provided");
	}
	if (element.getAttribute("data-vimeo-initialized") !== null) {
		return element.querySelector("iframe");
	}
	const div = document.createElement("div");
	div.innerHTML = html;
	element.appendChild(div.firstChild);
	element.setAttribute("data-vimeo-initialized", "true");
	return element.querySelector("iframe");
}

/**
 * Make an oEmbed call for the specified URL.
 *
 * @param {string} videoUrl The vimeo.com url for the video.
 * @param {Object} [params] Parameters to pass to oEmbed.
 * @param {HTMLElement} element The element.
 * @return {Promise}
 */
function getOEmbedData(videoUrl) {
	let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
	let element = arguments.length > 2 ? arguments[2] : undefined;
	return new Promise((resolve, reject) => {
		if (!isVimeoUrl(videoUrl)) {
			throw new TypeError(`“${videoUrl}” is not a vimeo.com url.`);
		}
		const domain = getOembedDomain(videoUrl);
		let url = `https://${domain}/api/oembed.json?url=${encodeURIComponent(videoUrl)}`;
		for (const param in params) {
			if (params.hasOwnProperty(param)) {
				url += `&${param}=${encodeURIComponent(params[param])}`;
			}
		}
		const xhr = "XDomainRequest" in window ? new XDomainRequest() : new XMLHttpRequest();
		xhr.open("GET", url, true);
		xhr.onload = function () {
			if (xhr.status === 404) {
				reject(new Error(`“${videoUrl}” was not found.`));
				return;
			}
			if (xhr.status === 403) {
				reject(new Error(`“${videoUrl}” is not embeddable.`));
				return;
			}
			try {
				const json = JSON.parse(xhr.responseText);
				// Check api response for 403 on oembed
				if (json.domain_status_code === 403) {
					// We still want to create the embed to give users visual feedback
					createEmbed(json, element);
					reject(new Error(`“${videoUrl}” is not embeddable.`));
					return;
				}
				resolve(json);
			} catch (error) {
				reject(error);
			}
		};
		xhr.onerror = function () {
			const status = xhr.status ? ` (${xhr.status})` : "";
			reject(new Error(`There was an error fetching the embed code from Vimeo${status}.`));
		};
		xhr.send();
	});
}

/**
 * Initialize all embeds within a specific element
 *
 * @param {HTMLElement} [parent=document] The parent element.
 * @return {void}
 */
function initializeEmbeds() {
	let parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
	const elements = [].slice.call(parent.querySelectorAll("[data-vimeo-id], [data-vimeo-url]"));
	const handleError = (error) => {
		if ("console" in window && console.error) {
			console.error(`There was an error creating an embed: ${error}`);
		}
	};
	elements.forEach((element) => {
		try {
			// Skip any that have data-vimeo-defer
			if (element.getAttribute("data-vimeo-defer") !== null) {
				return;
			}
			const params = getOEmbedParameters(element);
			const url = getVimeoUrl(params);
			getOEmbedData(url, params, element)
				.then((data) => {
					return createEmbed(data, element);
				})
				.catch(handleError);
		} catch (error) {
			handleError(error);
		}
	});
}

/**
 * Resize embeds when messaged by the player.
 *
 * @param {HTMLElement} [parent=document] The parent element.
 * @return {void}
 */
function resizeEmbeds() {
	let parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
	// Prevent execution if users include the player.js script multiple times.
	if (window.VimeoPlayerResizeEmbeds_) {
		return;
	}
	window.VimeoPlayerResizeEmbeds_ = true;
	const onMessage = (event) => {
		if (!isVimeoUrl(event.origin)) {
			return;
		}

		// 'spacechange' is fired only on embeds with cards
		if (!event.data || event.data.event !== "spacechange") {
			return;
		}
		const senderIFrame = event.source ? findIframeBySourceWindow(event.source, parent) : null;
		if (senderIFrame) {
			// Change padding-bottom of the enclosing div to accommodate
			// card carousel without distorting aspect ratio
			const space = senderIFrame.parentElement;
			space.style.paddingBottom = `${event.data.data[0].bottom}px`;
		}
	};
	window.addEventListener("message", onMessage);
}

/**
 * Add chapters to existing metadata for Google SEO
 *
 * @param {HTMLElement} [parent=document] The parent element.
 * @return {void}
 */
function initAppendVideoMetadata() {
	let parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
	//  Prevent execution if users include the player.js script multiple times.
	if (window.VimeoSeoMetadataAppended) {
		return;
	}
	window.VimeoSeoMetadataAppended = true;
	const onMessage = (event) => {
		if (!isVimeoUrl(event.origin)) {
			return;
		}
		const data = parseMessageData(event.data);
		if (!data || data.event !== "ready") {
			return;
		}
		const senderIFrame = event.source ? findIframeBySourceWindow(event.source, parent) : null;

		// Initiate appendVideoMetadata if iframe is a Vimeo embed
		if (senderIFrame && isVimeoEmbed(senderIFrame.src)) {
			const player = new Player(senderIFrame);
			player.callMethod("appendVideoMetadata", window.location.href);
		}
	};
	window.addEventListener("message", onMessage);
}

/**
 * Seek to time indicated by vimeo_t query parameter if present in URL
 *
 * @param {HTMLElement} [parent=document] The parent element.
 * @return {void}
 */
function checkUrlTimeParam() {
	let parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
	//  Prevent execution if users include the player.js script multiple times.
	if (window.VimeoCheckedUrlTimeParam) {
		return;
	}
	window.VimeoCheckedUrlTimeParam = true;
	const handleError = (error) => {
		if ("console" in window && console.error) {
			console.error(`There was an error getting video Id: ${error}`);
		}
	};
	const onMessage = (event) => {
		if (!isVimeoUrl(event.origin)) {
			return;
		}
		const data = parseMessageData(event.data);
		if (!data || data.event !== "ready") {
			return;
		}
		const senderIFrame = event.source ? findIframeBySourceWindow(event.source, parent) : null;
		if (senderIFrame && isVimeoEmbed(senderIFrame.src)) {
			const player = new Player(senderIFrame);
			player
				.getVideoId()
				.then((videoId) => {
					const matches = new RegExp(`[?&]vimeo_t_${videoId}=([^&#]*)`).exec(window.location.href);
					if (matches && matches[1]) {
						const sec = decodeURI(matches[1]);
						player.setCurrentTime(sec);
					}
					return;
				})
				.catch(handleError);
		}
	};
	window.addEventListener("message", onMessage);
}

/**
 * Updates iframe embeds to support DRM content playback by adding the 'encrypted-media' permission
 * to the iframe's allow attribute when DRM initialization fails. This function acts as a fallback
 * mechanism to enable playback of DRM-protected content in embeds that weren't properly configured.
 *
 * @return {void}
 */
function updateDRMEmbeds() {
	if (window.VimeoDRMEmbedsUpdated) {
		return;
	}
	window.VimeoDRMEmbedsUpdated = true;

	/**
	 * Handle message events for DRM initialization failures
	 * @param {MessageEvent} event - The message event from the iframe
	 */
	const onMessage = (event) => {
		if (!isVimeoUrl(event.origin)) {
			return;
		}
		const data = parseMessageData(event.data);
		if (!data || data.event !== "drminitfailed") {
			return;
		}
		const senderIFrame = event.source ? findIframeBySourceWindow(event.source) : null;
		if (!senderIFrame) {
			return;
		}
		const currentAllow = senderIFrame.getAttribute("allow") || "";
		const allowSupportsDRM = currentAllow.includes("encrypted-media");
		if (!allowSupportsDRM) {
			// For DRM playback to successfully occur, the iframe `allow` attribute must include 'encrypted-media'.
			// If the video requires DRM but doesn't have the attribute, we try to add on behalf of the embed owner
			// as a temporary measure to enable playback until they're able to update their embeds.
			senderIFrame.setAttribute("allow", `${currentAllow}; encrypted-media`);
			const currentUrl = new URL(senderIFrame.getAttribute("src"));

			// Adding this forces the embed to reload once `allow` has been updated with `encrypted-media`.
			currentUrl.searchParams.set("forcereload", "drm");
			senderIFrame.setAttribute("src", currentUrl.toString());
			return;
		}
	};
	window.addEventListener("message", onMessage);
}

/* MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Terms */

function initializeScreenfull() {
	const fn = (function () {
		let val;
		const fnMap = [
			["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"],
			// New WebKit
			["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror"],
			// Old WebKit
			["webkitRequestFullScreen", "webkitCancelFullScreen", "webkitCurrentFullScreenElement", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitfullscreenerror"],
			["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror"],
			["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError"],
		];
		let i = 0;
		const l = fnMap.length;
		const ret = {};
		for (; i < l; i++) {
			val = fnMap[i];
			if (val && val[1] in document) {
				for (i = 0; i < val.length; i++) {
					ret[fnMap[0][i]] = val[i];
				}
				return ret;
			}
		}
		return false;
	})();
	const eventNameMap = {
		fullscreenchange: fn.fullscreenchange,
		fullscreenerror: fn.fullscreenerror,
	};
	const screenfull = {
		request(element) {
			return new Promise((resolve, reject) => {
				const onFullScreenEntered = function () {
					screenfull.off("fullscreenchange", onFullScreenEntered);
					resolve();
				};
				screenfull.on("fullscreenchange", onFullScreenEntered);
				element = element || document.documentElement;
				const returnPromise = element[fn.requestFullscreen]();
				if (returnPromise instanceof Promise) {
					returnPromise.then(onFullScreenEntered).catch(reject);
				}
			});
		},
		exit() {
			return new Promise((resolve, reject) => {
				if (!screenfull.isFullscreen) {
					resolve();
					return;
				}
				const onFullScreenExit = function () {
					screenfull.off("fullscreenchange", onFullScreenExit);
					resolve();
				};
				screenfull.on("fullscreenchange", onFullScreenExit);
				const returnPromise = document[fn.exitFullscreen]();
				if (returnPromise instanceof Promise) {
					returnPromise.then(onFullScreenExit).catch(reject);
				}
			});
		},
		on(event, callback) {
			const eventName = eventNameMap[event];
			if (eventName) {
				document.addEventListener(eventName, callback);
			}
		},
		off(event, callback) {
			const eventName = eventNameMap[event];
			if (eventName) {
				document.removeEventListener(eventName, callback);
			}
		},
	};
	Object.defineProperties(screenfull, {
		isFullscreen: {
			get() {
				return Boolean(document[fn.fullscreenElement]);
			},
		},
		element: {
			enumerable: true,
			get() {
				return document[fn.fullscreenElement];
			},
		},
		isEnabled: {
			enumerable: true,
			get() {
				// Coerce to boolean in case of old WebKit
				return Boolean(document[fn.fullscreenEnabled]);
			},
		},
	});
	return screenfull;
}

/** @typedef {import('./timing-src-connector.types').PlayerControls} PlayerControls */
/** @typedef {import('timing-object').ITimingObject} TimingObject */
/** @typedef {import('./timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */
/** @typedef {(msg: string) => any} Logger */
/** @typedef {import('timing-object').TConnectionState} TConnectionState */

/**
 * @type {TimingSrcConnectorOptions}
 *
 * For details on these properties and their effects, see the typescript definition referenced above.
 */
const defaultOptions = {
	role: "viewer",
	autoPlayMuted: true,
	allowedDrift: 0.3,
	maxAllowedDrift: 1,
	minCheckInterval: 0.1,
	maxRateAdjustment: 0.2,
	maxTimeToCatchUp: 1,
};

/**
 * There's a proposed W3C spec for the Timing Object which would introduce a new set of APIs that would simplify time-synchronization tasks for browser applications.
 *
 * Proposed spec: https://webtiming.github.io/timingobject/
 * V3 Spec: https://timingsrc.readthedocs.io/en/latest/
 * Demuxed talk: https://www.youtube.com/watch?v=cZSjDaGDmX8
 *
 * This class makes it easy to connect Vimeo.Player to a provided TimingObject via Vimeo.Player.setTimingSrc(myTimingObject, options) and the synchronization will be handled automatically.
 *
 * There are 5 general responsibilities in TimingSrcConnector:
 *
 * 1. `updatePlayer()` which sets the player's currentTime, playbackRate and pause/play state based on current state of the TimingObject.
 * 2. `updateTimingObject()` which sets the TimingObject's position and velocity from the player's state.
 * 3. `playerUpdater` which listens for change events on the TimingObject and will respond by calling updatePlayer.
 * 4. `timingObjectUpdater` which listens to the player events of seeked, play and pause and will respond by calling `updateTimingObject()`.
 * 5. `maintainPlaybackPosition` this is code that constantly monitors the player to make sure it's always in sync with the TimingObject. This is needed because videos will generally not play with precise time accuracy and there will be some drift which becomes more noticeable over longer periods (as noted in the timing-object spec). More details on this method below.
 */
class TimingSrcConnector extends EventTarget {
	logger;

	/**
	 * @param {PlayerControls} player
	 * @param {TimingObject} timingObject
	 * @param {TimingSrcConnectorOptions} options
	 * @param {Logger} logger
	 */
	constructor(player, timingObject) {
		let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
		let logger = arguments.length > 3 ? arguments[3] : undefined;
		super();
		this.logger = logger;
		this.init(timingObject, player, {
			...defaultOptions,
			...options,
		});
	}
	disconnect() {
		this.dispatchEvent(new Event("disconnect"));
	}

	/**
	 * @param {TimingObject} timingObject
	 * @param {PlayerControls} player
	 * @param {TimingSrcConnectorOptions} options
	 * @return {Promise<void>}
	 */
	async init(timingObject, player, options) {
		await this.waitForTOReadyState(timingObject, "open");
		if (options.role === "viewer") {
			await this.updatePlayer(timingObject, player, options);
			const playerUpdater = subscribe(timingObject, "change", () => this.updatePlayer(timingObject, player, options));
			const positionSync = this.maintainPlaybackPosition(timingObject, player, options);
			this.addEventListener("disconnect", () => {
				positionSync.cancel();
				playerUpdater.cancel();
			});
		} else {
			await this.updateTimingObject(timingObject, player);
			const timingObjectUpdater = subscribe(player, ["seeked", "play", "pause", "ratechange"], () => this.updateTimingObject(timingObject, player), "on", "off");
			this.addEventListener("disconnect", () => timingObjectUpdater.cancel());
		}
	}

	/**
	 * Sets the TimingObject's state to reflect that of the player
	 *
	 * @param {TimingObject} timingObject
	 * @param {PlayerControls} player
	 * @return {Promise<void>}
	 */
	async updateTimingObject(timingObject, player) {
		const [position, isPaused, playbackRate] = await Promise.all([player.getCurrentTime(), player.getPaused(), player.getPlaybackRate()]);
		timingObject.update({
			position,
			velocity: isPaused ? 0 : playbackRate,
		});
	}

	/**
	 * Sets the player's timing state to reflect that of the TimingObject
	 *
	 * @param {TimingObject} timingObject
	 * @param {PlayerControls} player
	 * @param {TimingSrcConnectorOptions} options
	 * @return {Promise<void>}
	 */
	async updatePlayer(timingObject, player, options) {
		const { position, velocity } = timingObject.query();
		if (typeof position === "number") {
			player.setCurrentTime(position);
		}
		if (typeof velocity === "number") {
			if (velocity === 0) {
				if ((await player.getPaused()) === false) {
					player.pause();
				}
			} else if (velocity > 0) {
				if ((await player.getPaused()) === true) {
					await player.play().catch(async (err) => {
						if (err.name === "NotAllowedError" && options.autoPlayMuted) {
							await player.setMuted(true);
							await player.play().catch((err2) => console.error("Couldn't play the video from TimingSrcConnector. Error:", err2));
						}
					});
					this.updatePlayer(timingObject, player, options);
				}
				if ((await player.getPlaybackRate()) !== velocity) {
					player.setPlaybackRate(velocity);
				}
			}
		}
	}

	/**
	 * Since video players do not play with 100% time precision, we need to closely monitor
	 * our player to be sure it remains in sync with the TimingObject.
	 *
	 * If out of sync, we use the current conditions and the options provided to determine
	 * whether to re-sync via setting currentTime or adjusting the playbackRate
	 *
	 * @param {TimingObject} timingObject
	 * @param {PlayerControls} player
	 * @param {TimingSrcConnectorOptions} options
	 * @return {{cancel: (function(): void)}}
	 */
	maintainPlaybackPosition(timingObject, player, options) {
		const { allowedDrift, maxAllowedDrift, minCheckInterval, maxRateAdjustment, maxTimeToCatchUp } = options;
		const syncInterval = Math.min(maxTimeToCatchUp, Math.max(minCheckInterval, maxAllowedDrift)) * 1000;
		const check = async () => {
			if (timingObject.query().velocity === 0 || (await player.getPaused()) === true) {
				return;
			}
			const diff = timingObject.query().position - (await player.getCurrentTime());
			const diffAbs = Math.abs(diff);
			this.log(`Drift: ${diff}`);
			if (diffAbs > maxAllowedDrift) {
				await this.adjustSpeed(player, 0);
				player.setCurrentTime(timingObject.query().position);
				this.log("Resync by currentTime");
			} else if (diffAbs > allowedDrift) {
				const min = diffAbs / maxTimeToCatchUp;
				const max = maxRateAdjustment;
				const adjustment = min < max ? (max - min) / 2 : max;
				await this.adjustSpeed(player, adjustment * Math.sign(diff));
				this.log("Resync by playbackRate");
			}
		};
		const interval = setInterval(() => check(), syncInterval);
		return {
			cancel: () => clearInterval(interval),
		};
	}

	/**
	 * @param {string} msg
	 */
	log(msg) {
		this.logger?.(`TimingSrcConnector: ${msg}`);
	}
	speedAdjustment = 0;

	/**
	 * @param {PlayerControls} player
	 * @param {number} newAdjustment
	 * @return {Promise<void>}
	 */
	adjustSpeed = async (player, newAdjustment) => {
		if (this.speedAdjustment === newAdjustment) {
			return;
		}
		const newPlaybackRate = (await player.getPlaybackRate()) - this.speedAdjustment + newAdjustment;
		this.log(`New playbackRate:  ${newPlaybackRate}`);
		await player.setPlaybackRate(newPlaybackRate);
		this.speedAdjustment = newAdjustment;
	};

	/**
	 * @param {TimingObject} timingObject
	 * @param {TConnectionState} state
	 * @return {Promise<void>}
	 */
	waitForTOReadyState(timingObject, state) {
		return new Promise((resolve) => {
			const check = () => {
				if (timingObject.readyState === state) {
					resolve();
				} else {
					timingObject.addEventListener("readystatechange", check, {
						once: true,
					});
				}
			};
			check();
		});
	}
}

const playerMap = new WeakMap();
const readyMap = new WeakMap();
let screenfull = {};
class Player {
	/**
	 * Create a Player.
	 *
	 * @param {(HTMLIFrameElement|HTMLElement|string|jQuery)} element A reference to the Vimeo
	 *        player iframe, and id, or a jQuery object.
	 * @param {object} [options] oEmbed parameters to use when creating an embed in the element.
	 * @return {Player}
	 */
	constructor(element) {
		let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
		/* global jQuery */
		if (window.jQuery && element instanceof jQuery) {
			if (element.length > 1 && window.console && console.warn) {
				console.warn("A jQuery object with multiple elements was passed, using the first element.");
			}
			element = element[0];
		}

		// Find an element by ID
		if (typeof document !== "undefined" && typeof element === "string") {
			element = document.getElementById(element);
		}

		// Not an element!
		if (!isDomElement(element)) {
			throw new TypeError("You must pass either a valid element or a valid id.");
		}

		// Already initialized an embed in this div, so grab the iframe
		if (element.nodeName !== "IFRAME") {
			const iframe = element.querySelector("iframe");
			if (iframe) {
				element = iframe;
			}
		}

		// iframe url is not a Vimeo url
		if (element.nodeName === "IFRAME" && !isVimeoUrl(element.getAttribute("src") || "")) {
			throw new Error("The player element passed isn’t a Vimeo embed.");
		}

		// If there is already a player object in the map, return that
		if (playerMap.has(element)) {
			return playerMap.get(element);
		}
		this._window = element.ownerDocument.defaultView;
		this.element = element;
		this.origin = "*";
		const readyPromise = new npo_src((resolve, reject) => {
			this._onMessage = (event) => {
				if (!isVimeoUrl(event.origin) || this.element.contentWindow !== event.source) {
					return;
				}
				if (this.origin === "*") {
					this.origin = event.origin;
				}
				const data = parseMessageData(event.data);
				const isError = data && data.event === "error";
				const isReadyError = isError && data.data && data.data.method === "ready";
				if (isReadyError) {
					const error = new Error(data.data.message);
					error.name = data.data.name;
					reject(error);
					return;
				}
				const isReadyEvent = data && data.event === "ready";
				const isPingResponse = data && data.method === "ping";
				if (isReadyEvent || isPingResponse) {
					this.element.setAttribute("data-ready", "true");
					resolve();
					return;
				}
				processData(this, data);
			};
			this._window.addEventListener("message", this._onMessage);
			if (this.element.nodeName !== "IFRAME") {
				const params = getOEmbedParameters(element, options);
				const url = getVimeoUrl(params);
				getOEmbedData(url, params, element)
					.then((data) => {
						const iframe = createEmbed(data, element);
						// Overwrite element with the new iframe,
						// but store reference to the original element
						this.element = iframe;
						this._originalElement = element;
						swapCallbacks(element, iframe);
						playerMap.set(this.element, this);
						return data;
					})
					.catch(reject);
			}
		});

		// Store a copy of this Player in the map
		readyMap.set(this, readyPromise);
		playerMap.set(this.element, this);

		// Send a ping to the iframe so the ready promise will be resolved if
		// the player is already ready.
		if (this.element.nodeName === "IFRAME") {
			postMessage(this, "ping");
		}
		if (screenfull.isEnabled) {
			const exitFullscreen = () => screenfull.exit();
			this.fullscreenchangeHandler = () => {
				if (screenfull.isFullscreen) {
					storeCallback(this, "event:exitFullscreen", exitFullscreen);
				} else {
					removeCallback(this, "event:exitFullscreen", exitFullscreen);
				}
				// eslint-disable-next-line
				this.ready().then(() => {
					postMessage(this, "fullscreenchange", screenfull.isFullscreen);
				});
			};
			screenfull.on("fullscreenchange", this.fullscreenchangeHandler);
		}
		return this;
	}

	/**
	 * Check to see if the URL is a Vimeo URL.
	 *
	 * @param {string} url The URL string.
	 * @return {boolean}
	 */
	static isVimeoUrl(url) {
		return isVimeoUrl(url);
	}

	/**
	 * Get a promise for a method.
	 *
	 * @param {string} name The API method to call.
	 * @param {...(string|number|object|Array)} args Arguments to send via postMessage.
	 * @return {Promise}
	 */
	callMethod(name) {
		for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
			args[_key - 1] = arguments[_key];
		}
		if (name === undefined || name === null) {
			throw new TypeError("You must pass a method name.");
		}
		return new npo_src((resolve, reject) => {
			// We are storing the resolve/reject handlers to call later, so we
			// can’t return here.
			return this.ready()
				.then(() => {
					storeCallback(this, name, {
						resolve,
						reject,
					});
					if (args.length === 0) {
						args = {};
					} else if (args.length === 1) {
						args = args[0];
					}
					postMessage(this, name, args);
				})
				.catch(reject);
		});
	}
	/**
	 * Get a promise for the value of a player property.
	 *
	 * @param {string} name The property name
	 * @return {Promise}
	 */
	get(name) {
		return new npo_src((resolve, reject) => {
			name = getMethodName(name, "get");

			// We are storing the resolve/reject handlers to call later, so we
			// can’t return here.
			return this.ready()
				.then(() => {
					storeCallback(this, name, {
						resolve,
						reject,
					});
					postMessage(this, name);
				})
				.catch(reject);
		});
	}

	/**
	 * Get a promise for setting the value of a player property.
	 *
	 * @param {string} name The API method to call.
	 * @param {mixed} value The value to set.
	 * @return {Promise}
	 */
	set(name, value) {
		return new npo_src((resolve, reject) => {
			name = getMethodName(name, "set");
			if (value === undefined || value === null) {
				throw new TypeError("There must be a value to set.");
			}

			// We are storing the resolve/reject handlers to call later, so we
			// can’t return here.
			return this.ready()
				.then(() => {
					storeCallback(this, name, {
						resolve,
						reject,
					});
					postMessage(this, name, value);
				})
				.catch(reject);
		});
	}

	/**
	 * Add an event listener for the specified event. Will call the
	 * callback with a single parameter, `data`, that contains the data for
	 * that event.
	 *
	 * @param {string} eventName The name of the event.
	 * @param {function(*)} callback The function to call when the event fires.
	 * @return {void}
	 */
	on(eventName, callback) {
		if (!eventName) {
			throw new TypeError("You must pass an event name.");
		}
		if (!callback) {
			throw new TypeError("You must pass a callback function.");
		}
		if (typeof callback !== "function") {
			throw new TypeError("The callback must be a function.");
		}
		const callbacks = getCallbacks(this, `event:${eventName}`);
		if (callbacks.length === 0) {
			this.callMethod("addEventListener", eventName).catch(() => {
				// Ignore the error. There will be an error event fired that
				// will trigger the error callback if they are listening.
			});
		}
		storeCallback(this, `event:${eventName}`, callback);
	}

	/**
	 * Remove an event listener for the specified event. Will remove all
	 * listeners for that event if a `callback` isn’t passed, or only that
	 * specific callback if it is passed.
	 *
	 * @param {string} eventName The name of the event.
	 * @param {function} [callback] The specific callback to remove.
	 * @return {void}
	 */
	off(eventName, callback) {
		if (!eventName) {
			throw new TypeError("You must pass an event name.");
		}
		if (callback && typeof callback !== "function") {
			throw new TypeError("The callback must be a function.");
		}
		const lastCallback = removeCallback(this, `event:${eventName}`, callback);

		// If there are no callbacks left, remove the listener
		if (lastCallback) {
			this.callMethod("removeEventListener", eventName).catch((e) => {
				// Ignore the error. There will be an error event fired that
				// will trigger the error callback if they are listening.
			});
		}
	}

	/**
	 * A promise to load a new video.
	 *
	 * @promise LoadVideoPromise
	 * @fulfill {number} The video with this id or url successfully loaded.
	 * @reject {TypeError} The id was not a number.
	 */
	/**
	 * Load a new video into this embed. The promise will be resolved if
	 * the video is successfully loaded, or it will be rejected if it could
	 * not be loaded.
	 *
	 * @param {number|string|object} options The id of the video, the url of the video, or an object with embed options.
	 * @return {LoadVideoPromise}
	 */
	loadVideo(options) {
		return this.callMethod("loadVideo", options);
	}

	/**
	 * A promise to perform an action when the Player is ready.
	 *
	 * @todo document errors
	 * @promise LoadVideoPromise
	 * @fulfill {void}
	 */
	/**
	 * Trigger a function when the player iframe has initialized. You do not
	 * need to wait for `ready` to trigger to begin adding event listeners
	 * or calling other methods.
	 *
	 * @return {ReadyPromise}
	 */
	ready() {
		const readyPromise =
			readyMap.get(this) ||
			new npo_src((resolve, reject) => {
				reject(new Error("Unknown player. Probably unloaded."));
			});
		return npo_src.resolve(readyPromise);
	}

	/**
	 * A promise to add a cue point to the player.
	 *
	 * @promise AddCuePointPromise
	 * @fulfill {string} The id of the cue point to use for removeCuePoint.
	 * @reject {RangeError} the time was less than 0 or greater than the
	 *         video’s duration.
	 * @reject {UnsupportedError} Cue points are not supported with the current
	 *         player or browser.
	 */
	/**
	 * Add a cue point to the player.
	 *
	 * @param {number} time The time for the cue point.
	 * @param {object} [data] Arbitrary data to be returned with the cue point.
	 * @return {AddCuePointPromise}
	 */
	addCuePoint(time) {
		let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
		return this.callMethod("addCuePoint", {
			time,
			data,
		});
	}

	/**
	 * A promise to remove a cue point from the player.
	 *
	 * @promise AddCuePointPromise
	 * @fulfill {string} The id of the cue point that was removed.
	 * @reject {InvalidCuePoint} The cue point with the specified id was not
	 *         found.
	 * @reject {UnsupportedError} Cue points are not supported with the current
	 *         player or browser.
	 */
	/**
	 * Remove a cue point from the video.
	 *
	 * @param {string} id The id of the cue point to remove.
	 * @return {RemoveCuePointPromise}
	 */
	removeCuePoint(id) {
		return this.callMethod("removeCuePoint", id);
	}

	/**
	 * A representation of a text track on a video.
	 *
	 * @typedef {Object} VimeoTextTrack
	 * @property {string} language The ISO language code.
	 * @property {string} kind The kind of track it is (captions or subtitles).
	 * @property {string} label The human‐readable label for the track.
	 */
	/**
	 * A promise to enable a text track.
	 *
	 * @promise EnableTextTrackPromise
	 * @fulfill {VimeoTextTrack} The text track that was enabled.
	 * @reject {InvalidTrackLanguageError} No track was available with the
	 *         specified language.
	 * @reject {InvalidTrackError} No track was available with the specified
	 *         language and kind.
	 */
	/**
	 * Enable the text track with the specified language, and optionally the
	 * specified kind (captions or subtitles).
	 *
	 * When set via the API, the track language will not change the viewer’s
	 * stored preference.
	 *
	 * @param {string} language The two‐letter language code.
	 * @param {string} [kind] The kind of track to enable (captions or subtitles).
	 * @param {boolean} [showing] Whether to enable display of closed captions for enabled text track within the player.
	 * @return {EnableTextTrackPromise}
	 */
	enableTextTrack(language) {
		let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
		let showing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
		if (!language) {
			throw new TypeError("You must pass a language.");
		}
		return this.callMethod("enableTextTrack", {
			language,
			kind,
			showing,
		});
	}

	/**
	 * A promise to disable the active text track.
	 *
	 * @promise DisableTextTrackPromise
	 * @fulfill {void} The track was disabled.
	 */
	/**
	 * Disable the currently-active text track.
	 *
	 * @return {DisableTextTrackPromise}
	 */
	disableTextTrack() {
		return this.callMethod("disableTextTrack");
	}

	/** @typedef {import('../types/formats.js').VimeoAudioTrack} VimeoAudioTrack */
	/** @typedef {import('../types/formats.js').AudioLanguage} AudioLanguage */
	/** @typedef {import('../types/formats.js').AudioKind} AudioKind */
	/**
	 * A promise to enable an audio track.
	 *
	 * @promise SelectAudioTrackPromise
	 * @fulfill {VimeoAudioTrack} The audio track that was enabled.
	 * @reject {NoAudioTracksError} No audio exists for the video.
	 * @reject {NoAlternateAudioTracksError} No alternate audio tracks exist for the video.
	 * @reject {NoMatchingAudioTrackError} No track was available with the specified
	 *         language and kind.
	 */
	/**
	 * Enable the audio track with the specified language, and optionally the
	 * specified kind (main, translation, descriptions, or commentary).
	 *
	 * When set via the API, the track language will not change the viewer’s
	 * stored preference.
	 *
	 * @param {AudioLanguage} language The two‐letter language code.
	 * @param {AudioKind} [kind] The kind of track to enable (main, translation, descriptions, commentary).
	 * @return {SelectAudioTrackPromise}
	 */
	selectAudioTrack(language, kind) {
		if (!language) {
			throw new TypeError("You must pass a language.");
		}
		return this.callMethod("selectAudioTrack", {
			language,
			kind,
		});
	}

	/**
	 * Enable the main audio track for the video.
	 *
	 * @return {SelectAudioTrackPromise}
	 */
	selectDefaultAudioTrack() {
		return this.callMethod("selectDefaultAudioTrack");
	}

	/**
	 * A promise to pause the video.
	 *
	 * @promise PausePromise
	 * @fulfill {void} The video was paused.
	 */
	/**
	 * Pause the video if it’s playing.
	 *
	 * @return {PausePromise}
	 */
	pause() {
		return this.callMethod("pause");
	}

	/**
	 * A promise to play the video.
	 *
	 * @promise PlayPromise
	 * @fulfill {void} The video was played.
	 */
	/**
	 * Play the video if it’s paused. **Note:** on iOS and some other
	 * mobile devices, you cannot programmatically trigger play. Once the
	 * viewer has tapped on the play button in the player, however, you
	 * will be able to use this function.
	 *
	 * @return {PlayPromise}
	 */
	play() {
		return this.callMethod("play");
	}

	/**
	 * Request that the player enters fullscreen.
	 * @return {Promise}
	 */
	requestFullscreen() {
		if (screenfull.isEnabled) {
			return screenfull.request(this.element);
		}
		return this.callMethod("requestFullscreen");
	}

	/**
	 * Request that the player exits fullscreen.
	 * @return {Promise}
	 */
	exitFullscreen() {
		if (screenfull.isEnabled) {
			return screenfull.exit();
		}
		return this.callMethod("exitFullscreen");
	}

	/**
	 * Returns true if the player is currently fullscreen.
	 * @return {Promise}
	 */
	getFullscreen() {
		if (screenfull.isEnabled) {
			return npo_src.resolve(screenfull.isFullscreen);
		}
		return this.get("fullscreen");
	}

	/**
	 * Request that the player enters picture-in-picture.
	 * @return {Promise}
	 */
	requestPictureInPicture() {
		return this.callMethod("requestPictureInPicture");
	}

	/**
	 * Request that the player exits picture-in-picture.
	 * @return {Promise}
	 */
	exitPictureInPicture() {
		return this.callMethod("exitPictureInPicture");
	}

	/**
	 * Returns true if the player is currently picture-in-picture.
	 * @return {Promise}
	 */
	getPictureInPicture() {
		return this.get("pictureInPicture");
	}

	/**
	 * A promise to prompt the viewer to initiate remote playback.
	 *
	 * @promise RemotePlaybackPromptPromise
	 * @fulfill {void}
	 * @reject {NotFoundError} No remote playback device is available.
	 */
	/**
	 * Request to prompt the user to initiate remote playback.
	 *
	 * @return {RemotePlaybackPromptPromise}
	 */
	remotePlaybackPrompt() {
		return this.callMethod("remotePlaybackPrompt");
	}

	/**
	 * A promise to unload the video.
	 *
	 * @promise UnloadPromise
	 * @fulfill {void} The video was unloaded.
	 */
	/**
	 * Return the player to its initial state.
	 *
	 * @return {UnloadPromise}
	 */
	unload() {
		return this.callMethod("unload");
	}

	/**
	 * Cleanup the player and remove it from the DOM
	 *
	 * It won't be usable and a new one should be constructed
	 *  in order to do any operations.
	 *
	 * @return {Promise}
	 */
	destroy() {
		return new npo_src((resolve) => {
			readyMap.delete(this);
			playerMap.delete(this.element);
			if (this._originalElement) {
				playerMap.delete(this._originalElement);
				this._originalElement.removeAttribute("data-vimeo-initialized");
			}
			if (this.element && this.element.nodeName === "IFRAME" && this.element.parentNode) {
				// If we've added an additional wrapper div, remove that from the DOM.
				// If not, just remove the iframe element.
				if (this.element.parentNode.parentNode && this._originalElement && this._originalElement !== this.element.parentNode) {
					this.element.parentNode.parentNode.removeChild(this.element.parentNode);
				} else {
					this.element.parentNode.removeChild(this.element);
				}
			}

			// If the clip is private there is a case where the element stays the
			// div element. Destroy should reset the div and remove the iframe child.
			if (this.element && this.element.nodeName === "DIV" && this.element.parentNode) {
				this.element.removeAttribute("data-vimeo-initialized");
				const iframe = this.element.querySelector("iframe");
				if (iframe && iframe.parentNode) {
					// If we've added an additional wrapper div, remove that from the DOM.
					// If not, just remove the iframe element.
					if (iframe.parentNode.parentNode && this._originalElement && this._originalElement !== iframe.parentNode) {
						iframe.parentNode.parentNode.removeChild(iframe.parentNode);
					} else {
						iframe.parentNode.removeChild(iframe);
					}
				}
			}
			this._window.removeEventListener("message", this._onMessage);
			if (screenfull.isEnabled) {
				screenfull.off("fullscreenchange", this.fullscreenchangeHandler);
			}
			resolve();
		});
	}

	/**
	 * A promise to get the autopause behavior of the video.
	 *
	 * @promise GetAutopausePromise
	 * @fulfill {boolean} Whether autopause is turned on or off.
	 * @reject {UnsupportedError} Autopause is not supported with the current
	 *         player or browser.
	 */
	/**
	 * Get the autopause behavior for this player.
	 *
	 * @return {GetAutopausePromise}
	 */
	getAutopause() {
		return this.get("autopause");
	}

	/**
	 * A promise to set the autopause behavior of the video.
	 *
	 * @promise SetAutopausePromise
	 * @fulfill {boolean} Whether autopause is turned on or off.
	 * @reject {UnsupportedError} Autopause is not supported with the current
	 *         player or browser.
	 */
	/**
	 * Enable or disable the autopause behavior of this player.
	 *
	 * By default, when another video is played in the same browser, this
	 * player will automatically pause. Unless you have a specific reason
	 * for doing so, we recommend that you leave autopause set to the
	 * default (`true`).
	 *
	 * @param {boolean} autopause
	 * @return {SetAutopausePromise}
	 */
	setAutopause(autopause) {
		return this.set("autopause", autopause);
	}

	/**
	 * A promise to get the buffered property of the video.
	 *
	 * @promise GetBufferedPromise
	 * @fulfill {Array} Buffered Timeranges converted to an Array.
	 */
	/**
	 * Get the buffered property of the video.
	 *
	 * @return {GetBufferedPromise}
	 */
	getBuffered() {
		return this.get("buffered");
	}

	/**
	 * @typedef {Object} CameraProperties
	 * @prop {number} props.yaw - Number between 0 and 360.
	 * @prop {number} props.pitch - Number between -90 and 90.
	 * @prop {number} props.roll - Number between -180 and 180.
	 * @prop {number} props.fov - The field of view in degrees.
	 */
	/**
	 * A promise to get the camera properties of the player.
	 *
	 * @promise GetCameraPromise
	 * @fulfill {CameraProperties} The camera properties.
	 */
	/**
	 * For 360° videos get the camera properties for this player.
	 *
	 * @return {GetCameraPromise}
	 */
	getCameraProps() {
		return this.get("cameraProps");
	}

	/**
	 * A promise to set the camera properties of the player.
	 *
	 * @promise SetCameraPromise
	 * @fulfill {Object} The camera was successfully set.
	 * @reject {RangeError} The range was out of bounds.
	 */
	/**
	 * For 360° videos set the camera properties for this player.
	 *
	 * @param {CameraProperties} camera The camera properties
	 * @return {SetCameraPromise}
	 */
	setCameraProps(camera) {
		return this.set("cameraProps", camera);
	}

	/**
	 * A representation of a chapter.
	 *
	 * @typedef {Object} VimeoChapter
	 * @property {number} startTime The start time of the chapter.
	 * @property {object} title The title of the chapter.
	 * @property {number} index The place in the order of Chapters. Starts at 1.
	 */
	/**
	 * A promise to get chapters for the video.
	 *
	 * @promise GetChaptersPromise
	 * @fulfill {VimeoChapter[]} The chapters for the video.
	 */
	/**
	 * Get an array of all the chapters for the video.
	 *
	 * @return {GetChaptersPromise}
	 */
	getChapters() {
		return this.get("chapters");
	}

	/**
	 * A promise to get the currently active chapter.
	 *
	 * @promise GetCurrentChaptersPromise
	 * @fulfill {VimeoChapter|undefined} The current chapter for the video.
	 */
	/**
	 * Get the currently active chapter for the video.
	 *
	 * @return {GetCurrentChaptersPromise}
	 */
	getCurrentChapter() {
		return this.get("currentChapter");
	}

	/**
	 * A promise to get the accent color of the player.
	 *
	 * @promise GetColorPromise
	 * @fulfill {string} The hex color of the player.
	 */
	/**
	 * Get the accent color for this player. Note this is deprecated in place of `getColorTwo`.
	 *
	 * @return {GetColorPromise}
	 */
	getColor() {
		return this.get("color");
	}

	/**
	 * A promise to get all colors for the player in an array.
	 *
	 * @promise GetColorsPromise
	 * @fulfill {string[]} The hex colors of the player.
	 */
	/**
	 * Get all the colors for this player in an array: [colorOne, colorTwo, colorThree, colorFour]
	 *
	 * @return {GetColorPromise}
	 */
	getColors() {
		return npo_src.all([this.get("colorOne"), this.get("colorTwo"), this.get("colorThree"), this.get("colorFour")]);
	}

	/**
	 * A promise to set the accent color of the player.
	 *
	 * @promise SetColorPromise
	 * @fulfill {string} The color was successfully set.
	 * @reject {TypeError} The string was not a valid hex or rgb color.
	 * @reject {ContrastError} The color was set, but the contrast is
	 *         outside of the acceptable range.
	 * @reject {EmbedSettingsError} The owner of the player has chosen to
	 *         use a specific color.
	 */
	/**
	 * Set the accent color of this player to a hex or rgb string. Setting the
	 * color may fail if the owner of the video has set their embed
	 * preferences to force a specific color.
	 * Note this is deprecated in place of `setColorTwo`.
	 *
	 * @param {string} color The hex or rgb color string to set.
	 * @return {SetColorPromise}
	 */
	setColor(color) {
		return this.set("color", color);
	}

	/**
	 * A promise to set all colors for the player.
	 *
	 * @promise SetColorsPromise
	 * @fulfill {string[]} The colors were successfully set.
	 * @reject {TypeError} The string was not a valid hex or rgb color.
	 * @reject {ContrastError} The color was set, but the contrast is
	 *         outside of the acceptable range.
	 * @reject {EmbedSettingsError} The owner of the player has chosen to
	 *         use a specific color.
	 */
	/**
	 * Set the colors of this player to a hex or rgb string. Setting the
	 * color may fail if the owner of the video has set their embed
	 * preferences to force a specific color.
	 * The colors should be passed in as an array: [colorOne, colorTwo, colorThree, colorFour].
	 * If a color should not be set, the index in the array can be left as null.
	 *
	 * @param {string[]} colors Array of the hex or rgb color strings to set.
	 * @return {SetColorsPromise}
	 */
	setColors(colors) {
		if (!Array.isArray(colors)) {
			return new npo_src((resolve, reject) => reject(new TypeError("Argument must be an array.")));
		}
		const nullPromise = new npo_src((resolve) => resolve(null));
		const colorPromises = [
			colors[0] ? this.set("colorOne", colors[0]) : nullPromise,
			colors[1] ? this.set("colorTwo", colors[1]) : nullPromise,
			colors[2] ? this.set("colorThree", colors[2]) : nullPromise,
			colors[3] ? this.set("colorFour", colors[3]) : nullPromise,
		];
		return npo_src.all(colorPromises);
	}

	/**
	 * A representation of a cue point.
	 *
	 * @typedef {Object} VimeoCuePoint
	 * @property {number} time The time of the cue point.
	 * @property {object} data The data passed when adding the cue point.
	 * @property {string} id The unique id for use with removeCuePoint.
	 */
	/**
	 * A promise to get the cue points of a video.
	 *
	 * @promise GetCuePointsPromise
	 * @fulfill {VimeoCuePoint[]} The cue points added to the video.
	 * @reject {UnsupportedError} Cue points are not supported with the current
	 *         player or browser.
	 */
	/**
	 * Get an array of the cue points added to the video.
	 *
	 * @return {GetCuePointsPromise}
	 */
	getCuePoints() {
		return this.get("cuePoints");
	}

	/**
	 * A promise to get the current time of the video.
	 *
	 * @promise GetCurrentTimePromise
	 * @fulfill {number} The current time in seconds.
	 */
	/**
	 * Get the current playback position in seconds.
	 *
	 * @return {GetCurrentTimePromise}
	 */
	getCurrentTime() {
		return this.get("currentTime");
	}

	/**
	 * A promise to set the current time of the video.
	 *
	 * @promise SetCurrentTimePromise
	 * @fulfill {number} The actual current time that was set.
	 * @reject {RangeError} the time was less than 0 or greater than the
	 *         video’s duration.
	 */
	/**
	 * Set the current playback position in seconds. If the player was
	 * paused, it will remain paused. Likewise, if the player was playing,
	 * it will resume playing once the video has buffered.
	 *
	 * You can provide an accurate time and the player will attempt to seek
	 * to as close to that time as possible. The exact time will be the
	 * fulfilled value of the promise.
	 *
	 * @param {number} currentTime
	 * @return {SetCurrentTimePromise}
	 */
	setCurrentTime(currentTime) {
		return this.set("currentTime", currentTime);
	}

	/**
	 * A promise to get the duration of the video.
	 *
	 * @promise GetDurationPromise
	 * @fulfill {number} The duration in seconds.
	 */
	/**
	 * Get the duration of the video in seconds. It will be rounded to the
	 * nearest second before playback begins, and to the nearest thousandth
	 * of a second after playback begins.
	 *
	 * @return {GetDurationPromise}
	 */
	getDuration() {
		return this.get("duration");
	}

	/**
	 * A promise to get the ended state of the video.
	 *
	 * @promise GetEndedPromise
	 * @fulfill {boolean} Whether or not the video has ended.
	 */
	/**
	 * Get the ended state of the video. The video has ended if
	 * `currentTime === duration`.
	 *
	 * @return {GetEndedPromise}
	 */
	getEnded() {
		return this.get("ended");
	}

	/**
	 * A promise to get the loop state of the player.
	 *
	 * @promise GetLoopPromise
	 * @fulfill {boolean} Whether or not the player is set to loop.
	 */
	/**
	 * Get the loop state of the player.
	 *
	 * @return {GetLoopPromise}
	 */
	getLoop() {
		return this.get("loop");
	}

	/**
	 * A promise to set the loop state of the player.
	 *
	 * @promise SetLoopPromise
	 * @fulfill {boolean} The loop state that was set.
	 */
	/**
	 * Set the loop state of the player. When set to `true`, the player
	 * will start over immediately once playback ends.
	 *
	 * @param {boolean} loop
	 * @return {SetLoopPromise}
	 */
	setLoop(loop) {
		return this.set("loop", loop);
	}

	/**
	 * A promise to set the muted state of the player.
	 *
	 * @promise SetMutedPromise
	 * @fulfill {boolean} The muted state that was set.
	 */
	/**
	 * Set the muted state of the player. When set to `true`, the player
	 * volume will be muted.
	 *
	 * @param {boolean} muted
	 * @return {SetMutedPromise}
	 */
	setMuted(muted) {
		return this.set("muted", muted);
	}

	/**
	 * A promise to get the muted state of the player.
	 *
	 * @promise GetMutedPromise
	 * @fulfill {boolean} Whether or not the player is muted.
	 */
	/**
	 * Get the muted state of the player.
	 *
	 * @return {GetMutedPromise}
	 */
	getMuted() {
		return this.get("muted");
	}

	/**
	 * A promise to get the paused state of the player.
	 *
	 * @promise GetLoopPromise
	 * @fulfill {boolean} Whether or not the video is paused.
	 */
	/**
	 * Get the paused state of the player.
	 *
	 * @return {GetLoopPromise}
	 */
	getPaused() {
		return this.get("paused");
	}

	/**
	 * A promise to get the playback rate of the player.
	 *
	 * @promise GetPlaybackRatePromise
	 * @fulfill {number} The playback rate of the player on a scale from 0 to 2.
	 */
	/**
	 * Get the playback rate of the player on a scale from `0` to `2`.
	 *
	 * @return {GetPlaybackRatePromise}
	 */
	getPlaybackRate() {
		return this.get("playbackRate");
	}

	/**
	 * A promise to set the playbackrate of the player.
	 *
	 * @promise SetPlaybackRatePromise
	 * @fulfill {number} The playback rate was set.
	 * @reject {RangeError} The playback rate was less than 0 or greater than 2.
	 */
	/**
	 * Set the playback rate of the player on a scale from `0` to `2`. When set
	 * via the API, the playback rate will not be synchronized to other
	 * players or stored as the viewer's preference.
	 *
	 * @param {number} playbackRate
	 * @return {SetPlaybackRatePromise}
	 */
	setPlaybackRate(playbackRate) {
		return this.set("playbackRate", playbackRate);
	}

	/**
	 * A promise to get the played property of the video.
	 *
	 * @promise GetPlayedPromise
	 * @fulfill {Array} Played Timeranges converted to an Array.
	 */
	/**
	 * Get the played property of the video.
	 *
	 * @return {GetPlayedPromise}
	 */
	getPlayed() {
		return this.get("played");
	}

	/**
	 * A promise to get the qualities available of the current video.
	 *
	 * @promise GetQualitiesPromise
	 * @fulfill {Array} The qualities of the video.
	 */
	/**
	 * Get the qualities of the current video.
	 *
	 * @return {GetQualitiesPromise}
	 */
	getQualities() {
		return this.get("qualities");
	}

	/**
	 * A promise to get the current set quality of the video.
	 *
	 * @promise GetQualityPromise
	 * @fulfill {string} The current set quality.
	 */
	/**
	 * Get the current set quality of the video.
	 *
	 * @return {GetQualityPromise}
	 */
	getQuality() {
		return this.get("quality");
	}

	/**
	 * A promise to set the video quality.
	 *
	 * @promise SetQualityPromise
	 * @fulfill {number} The quality was set.
	 * @reject {RangeError} The quality is not available.
	 */
	/**
	 * Set a video quality.
	 *
	 * @param {string} quality
	 * @return {SetQualityPromise}
	 */
	setQuality(quality) {
		return this.set("quality", quality);
	}

	/**
	 * A promise to get the remote playback availability.
	 *
	 * @promise RemotePlaybackAvailabilityPromise
	 * @fulfill {boolean} Whether remote playback is available.
	 */
	/**
	 * Get the availability of remote playback.
	 *
	 * @return {RemotePlaybackAvailabilityPromise}
	 */
	getRemotePlaybackAvailability() {
		return this.get("remotePlaybackAvailability");
	}

	/**
	 * A promise to get the current remote playback state.
	 *
	 * @promise RemotePlaybackStatePromise
	 * @fulfill {string} The state of the remote playback: connecting, connected, or disconnected.
	 */
	/**
	 * Get the current remote playback state.
	 *
	 * @return {RemotePlaybackStatePromise}
	 */
	getRemotePlaybackState() {
		return this.get("remotePlaybackState");
	}

	/**
	 * A promise to get the seekable property of the video.
	 *
	 * @promise GetSeekablePromise
	 * @fulfill {Array} Seekable Timeranges converted to an Array.
	 */
	/**
	 * Get the seekable property of the video.
	 *
	 * @return {GetSeekablePromise}
	 */
	getSeekable() {
		return this.get("seekable");
	}

	/**
	 * A promise to get the seeking property of the player.
	 *
	 * @promise GetSeekingPromise
	 * @fulfill {boolean} Whether or not the player is currently seeking.
	 */
	/**
	 * Get if the player is currently seeking.
	 *
	 * @return {GetSeekingPromise}
	 */
	getSeeking() {
		return this.get("seeking");
	}

	/**
	 * A promise to get the text tracks of a video.
	 *
	 * @promise GetTextTracksPromise
	 * @fulfill {VimeoTextTrack[]} The text tracks associated with the video.
	 */
	/**
	 * Get an array of the text tracks that exist for the video.
	 *
	 * @return {GetTextTracksPromise}
	 */
	getTextTracks() {
		return this.get("textTracks");
	}

	/**
	 * A promise to get the audio tracks of a video.
	 *
	 * @promise GetAudioTracksPromise
	 * @fulfill {VimeoAudioTrack[]} The audio tracks associated with the video.
	 */
	/**
	 * Get an array of the audio tracks that exist for the video.
	 *
	 * @return {GetAudioTracksPromise}
	 */
	getAudioTracks() {
		return this.get("audioTracks");
	}

	/**
	 * A promise to get the enabled audio track of a video.
	 *
	 * @promise GetAudioTrackPromise
	 * @fulfill {VimeoAudioTrack} The enabled audio track.
	 */
	/**
	 * Get the enabled audio track for a video.
	 *
	 * @return {GetAudioTrackPromise}
	 */
	getEnabledAudioTrack() {
		return this.get("enabledAudioTrack");
	}

	/**
	 * Get the main audio track for a video.
	 *
	 * @return {GetAudioTrackPromise}
	 */
	getDefaultAudioTrack() {
		return this.get("defaultAudioTrack");
	}

	/**
	 * A promise to get the embed code for the video.
	 *
	 * @promise GetVideoEmbedCodePromise
	 * @fulfill {string} The `<iframe>` embed code for the video.
	 */
	/**
	 * Get the `<iframe>` embed code for the video.
	 *
	 * @return {GetVideoEmbedCodePromise}
	 */
	getVideoEmbedCode() {
		return this.get("videoEmbedCode");
	}

	/**
	 * A promise to get the id of the video.
	 *
	 * @promise GetVideoIdPromise
	 * @fulfill {number} The id of the video.
	 */
	/**
	 * Get the id of the video.
	 *
	 * @return {GetVideoIdPromise}
	 */
	getVideoId() {
		return this.get("videoId");
	}

	/**
	 * A promise to get the title of the video.
	 *
	 * @promise GetVideoTitlePromise
	 * @fulfill {number} The title of the video.
	 */
	/**
	 * Get the title of the video.
	 *
	 * @return {GetVideoTitlePromise}
	 */
	getVideoTitle() {
		return this.get("videoTitle");
	}

	/**
	 * A promise to get the native width of the video.
	 *
	 * @promise GetVideoWidthPromise
	 * @fulfill {number} The native width of the video.
	 */
	/**
	 * Get the native width of the currently‐playing video. The width of
	 * the highest‐resolution available will be used before playback begins.
	 *
	 * @return {GetVideoWidthPromise}
	 */
	getVideoWidth() {
		return this.get("videoWidth");
	}

	/**
	 * A promise to get the native height of the video.
	 *
	 * @promise GetVideoHeightPromise
	 * @fulfill {number} The native height of the video.
	 */
	/**
	 * Get the native height of the currently‐playing video. The height of
	 * the highest‐resolution available will be used before playback begins.
	 *
	 * @return {GetVideoHeightPromise}
	 */
	getVideoHeight() {
		return this.get("videoHeight");
	}

	/**
	 * A promise to get the vimeo.com url for the video.
	 *
	 * @promise GetVideoUrlPromise
	 * @fulfill {number} The vimeo.com url for the video.
	 * @reject {PrivacyError} The url isn’t available because of the video’s privacy setting.
	 */
	/**
	 * Get the vimeo.com url for the video.
	 *
	 * @return {GetVideoUrlPromise}
	 */
	getVideoUrl() {
		return this.get("videoUrl");
	}

	/**
	 * A promise to get the volume level of the player.
	 *
	 * @promise GetVolumePromise
	 * @fulfill {number} The volume level of the player on a scale from 0 to 1.
	 */
	/**
	 * Get the current volume level of the player on a scale from `0` to `1`.
	 *
	 * Most mobile devices do not support an independent volume from the
	 * system volume. In those cases, this method will always return `1`.
	 *
	 * @return {GetVolumePromise}
	 */
	getVolume() {
		return this.get("volume");
	}

	/**
	 * A promise to set the volume level of the player.
	 *
	 * @promise SetVolumePromise
	 * @fulfill {number} The volume was set.
	 * @reject {RangeError} The volume was less than 0 or greater than 1.
	 */
	/**
	 * Set the volume of the player on a scale from `0` to `1`. When set
	 * via the API, the volume level will not be synchronized to other
	 * players or stored as the viewer’s preference.
	 *
	 * Most mobile devices do not support setting the volume. An error will
	 * *not* be triggered in that situation.
	 *
	 * @param {number} volume
	 * @return {SetVolumePromise}
	 */
	setVolume(volume) {
		return this.set("volume", volume);
	}

	/** @typedef {import('timing-object').ITimingObject} TimingObject */
	/** @typedef {import('./lib/timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */
	/** @typedef {import('./lib/timing-src-connector').TimingSrcConnector} TimingSrcConnector */

	/**
	 * Connects a TimingObject to the video player (https://webtiming.github.io/timingobject/)
	 *
	 * @param {TimingObject} timingObject
	 * @param {TimingSrcConnectorOptions} options
	 *
	 * @return {Promise<TimingSrcConnector>}
	 */
	async setTimingSrc(timingObject, options) {
		if (!timingObject) {
			throw new TypeError("A Timing Object must be provided.");
		}
		await this.ready();
		const connector = new TimingSrcConnector(this, timingObject, options);
		postMessage(this, "notifyTimingObjectConnect");
		connector.addEventListener("disconnect", () => postMessage(this, "notifyTimingObjectDisconnect"));
		return connector;
	}
}

// Setup embed only if this is not a server runtime
if (!isServerRuntime) {
	screenfull = initializeScreenfull();
	initializeEmbeds();
	resizeEmbeds();
	initAppendVideoMetadata();
	checkUrlTimeParam();
	updateDRMEmbeds();
}

// @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=none"
// @generated from file blockninja/v1/communications.proto (package blockninja.v1, syntax proto3)
/* eslint-disable */
/**
 * @generated from enum blockninja.v1.CommChannel
 */
var CommChannel;
(function (CommChannel) {
	/**
	 * @generated from enum value: COMM_CHANNEL_UNSPECIFIED = 0;
	 */
	CommChannel[(CommChannel["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: COMM_CHANNEL_EMAIL = 1;
	 */
	CommChannel[(CommChannel["EMAIL"] = 1)] = "EMAIL";
	/**
	 * @generated from enum value: COMM_CHANNEL_TELEGRAM = 2;
	 */
	CommChannel[(CommChannel["TELEGRAM"] = 2)] = "TELEGRAM";
	/**
	 * @generated from enum value: COMM_CHANNEL_WEBHOOK = 3;
	 */
	CommChannel[(CommChannel["WEBHOOK"] = 3)] = "WEBHOOK";
})(CommChannel || (CommChannel = {}));
/**
 * @generated from enum blockninja.v1.CommProviderType
 */
var CommProviderType;
(function (CommProviderType) {
	/**
	 * @generated from enum value: COMM_PROVIDER_TYPE_UNSPECIFIED = 0;
	 */
	CommProviderType[(CommProviderType["UNSPECIFIED"] = 0)] = "UNSPECIFIED";
	/**
	 * @generated from enum value: COMM_PROVIDER_TYPE_SMTP = 1;
	 */
	CommProviderType[(CommProviderType["SMTP"] = 1)] = "SMTP";
	/**
	 * @generated from enum value: COMM_PROVIDER_TYPE_POSTMARK = 2;
	 */
	CommProviderType[(CommProviderType["POSTMARK"] = 2)] = "POSTMARK";
	/**
	 * @generated from enum value: COMM_PROVIDER_TYPE_TELEGRAM = 3;
	 */
	CommProviderType[(CommProviderType["TELEGRAM"] = 3)] = "TELEGRAM";
	/**
	 * @generated from enum value: COMM_PROVIDER_TYPE_WEBHOOK = 4;
	 */
	CommProviderType[(CommProviderType["WEBHOOK"] = 4)] = "WEBHOOK";
})(CommProviderType || (CommProviderType = {}));

// src/index.ts
const { default: default2 } = await importShared("react");

// src/components/card.tsx
const React = await importShared("react");
function cn(...inputs) {
	return twMerge(clsx(inputs));
}
var Card = React.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		ref,
		className: cn("rounded-xl border bg-card text-card-foreground shadow", className),
		...props,
	}),
);
Card.displayName = "Card";
var CardHeader = React.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		ref,
		className: cn("flex flex-col space-y-1.5 p-6", className),
		...props,
	}),
);
CardHeader.displayName = "CardHeader";
var CardTitle = React.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		ref,
		className: cn("font-semibold leading-none tracking-tight", className),
		...props,
	}),
);
CardTitle.displayName = "CardTitle";
var CardDescription = React.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		ref,
		className: cn("text-sm text-muted-foreground", className),
		...props,
	}),
);
CardDescription.displayName = "CardDescription";
var CardContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
CardContent.displayName = "CardContent";
var CardFooter = React.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		ref,
		className: cn("flex items-center p-6 pt-0", className),
		...props,
	}),
);
CardFooter.displayName = "CardFooter";

// src/components/tabs.tsx
const React2 = await importShared("react");
var Tabs = Root2$1;
var TabsList = React2.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(List, {
		ref,
		className: cn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground", className),
		...props,
	}),
);
TabsList.displayName = List.displayName;
var TabsTrigger = React2.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(Trigger, {
		ref,
		className: cn(
			"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
			className,
		),
		...props,
	}),
);
TabsTrigger.displayName = Trigger.displayName;
var TabsContent = React2.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(Content, {
		ref,
		className: cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", className),
		...props,
	}),
);
TabsContent.displayName = Content.displayName;

// src/components/scroll-area.tsx
const React3 = await importShared("react");
var ScrollArea = React3.forwardRef(({ className, children, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsxs(Root$1, {
		ref,
		className: cn("relative overflow-hidden", className),
		...props,
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsx(Viewport, { className: "h-full w-full rounded-[inherit]", children }),
			/* @__PURE__ */ jsxRuntimeExports.jsx(ScrollBar, {}),
			/* @__PURE__ */ jsxRuntimeExports.jsx(Corner, {}),
		],
	}),
);
ScrollArea.displayName = Root$1.displayName;
var ScrollBar = React3.forwardRef(({ className, orientation = "vertical", ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaScrollbar, {
		ref,
		orientation,
		className: cn(
			"flex touch-none select-none transition-colors",
			orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
			orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
			className,
		),
		...props,
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" }),
	}),
);
ScrollBar.displayName = ScrollAreaScrollbar.displayName;

// src/components/separator.tsx
const React4 = await importShared("react");
var Separator = React4.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(Root, {
		ref,
		decorative,
		orientation,
		className: cn("shrink-0 bg-border", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className),
		...props,
	}),
);
Separator.displayName = Root.displayName;

// src/components/sheet.tsx
const React5 = await importShared("react");
var Sheet = Dialog$1;
var SheetTrigger = DialogTrigger$1;
var SheetClose = DialogClose$1;
var SheetPortal = DialogPortal$1;
var SheetOverlay = React5.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlay$1, {
		className: cn("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
		...props,
		ref,
	}),
);
SheetOverlay.displayName = DialogOverlay$1.displayName;
var sheetVariants = cva(
	"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
	{
		variants: {
			side: {
				top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
				bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
				left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
				right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
			},
		},
		defaultVariants: {
			side: "right",
		},
	},
);
var SheetContent = React5.forwardRef(({ side = "right", className, children, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsxs(SheetPortal, {
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsx(SheetOverlay, {}),
			/* @__PURE__ */ jsxRuntimeExports.jsxs(DialogContent$1, {
				ref,
				className: cn(sheetVariants({ side }), className),
				...props,
				children: [
					/* @__PURE__ */ jsxRuntimeExports.jsxs(DialogClose$1, {
						className:
							"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",
						children: [/* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }), /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Close" })],
					}),
					children,
				],
			}),
		],
	}),
);
SheetContent.displayName = DialogContent$1.displayName;
var SheetHeader = ({ className, ...props }) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		className: cn("flex flex-col space-y-2 text-center sm:text-left p-4", className),
		...props,
	});
SheetHeader.displayName = "SheetHeader";
var SheetBody = ({ className, ...props }) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		className: cn("flex flex-col space-y-2 text-center sm:text-left p-4", className),
		...props,
	});
SheetBody.displayName = "SheetBody";
var SheetFooter = ({ className, ...props }) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
		...props,
	});
SheetFooter.displayName = "SheetFooter";
var SheetTitle = React5.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle$1, {
		ref,
		className: cn("text-lg font-semibold text-foreground", className),
		...props,
	}),
);
SheetTitle.displayName = DialogTitle$1.displayName;
var SheetDescription = React5.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(DialogDescription$1, {
		ref,
		className: cn("text-sm text-muted-foreground", className),
		...props,
	}),
);
SheetDescription.displayName = DialogDescription$1.displayName;

// src/components/table.tsx
const React6 = await importShared("react");
var Table = React6.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		className: "relative w-full overflow-auto",
		children: /* @__PURE__ */ jsxRuntimeExports.jsx("table", {
			ref,
			className: cn("w-full caption-bottom text-sm", className),
			...props,
		}),
	}),
);
Table.displayName = "Table";
var TableHeader = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
TableHeader.displayName = "TableHeader";
var TableBody = React6.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("tbody", {
		ref,
		className: cn("[&_tr:last-child]:border-0", className),
		...props,
	}),
);
TableBody.displayName = "TableBody";
var TableFooter = React6.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("tfoot", {
		ref,
		className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
		...props,
	}),
);
TableFooter.displayName = "TableFooter";
var TableRow = React6.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("tr", {
		ref,
		className: cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className),
		...props,
	}),
);
TableRow.displayName = "TableRow";
var TableHead = React6.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("th", {
		ref,
		className: cn("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
		...props,
	}),
);
TableHead.displayName = "TableHead";
var TableCell = React6.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("td", {
		ref,
		className: cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
		...props,
	}),
);
TableCell.displayName = "TableCell";
var TableCaption = React6.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("caption", {
		ref,
		className: cn("mt-4 text-sm text-muted-foreground", className),
		...props,
	}),
);
TableCaption.displayName = "TableCaption";

// src/components/button.tsx
const React7 = await importShared("react");
var buttonVariants = cva(
	"inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
	{
		variants: {
			variant: {
				default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
				destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
				outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
				secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-accent hover:text-accent-foreground",
				ghost: "hover:bg-accent hover:text-accent-foreground",
				link: "text-primary underline-offset-4 hover:underline",
			},
			size: {
				default: "h-9 px-4 py-2",
				sm: "h-8 rounded-md px-3 text-xs",
				lg: "h-10 rounded-md px-8",
				icon: "h-9 w-9",
			},
		},
		defaultVariants: {
			variant: "default",
			size: "default",
		},
	},
);
var Button = React7.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
	const Comp = asChild ? Slot$1 : "button";
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Comp, {
		className: cn(buttonVariants({ variant, size, className })),
		ref,
		...props,
	});
});
Button.displayName = "Button";

// src/components/input.tsx
const React8 = await importShared("react");
var Input = React8.forwardRef(({ className, type, ...props }, ref) => {
	return /* @__PURE__ */ jsxRuntimeExports.jsx("input", {
		type,
		className: cn(
			"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
			className,
		),
		ref,
		...props,
	});
});
Input.displayName = "Input";

// src/components/textarea.tsx
const React9 = await importShared("react");
var Textarea = React9.forwardRef(({ className, ...props }, ref) => {
	return /* @__PURE__ */ jsxRuntimeExports.jsx("textarea", {
		className: cn(
			"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
			className,
		),
		ref,
		...props,
	});
});
Textarea.displayName = "Textarea";

// src/components/label.tsx
const React10 = await importShared("react");
var labelVariants = cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
var Label = React10.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(Root$2, {
		ref,
		className: cn(labelVariants(), className),
		...props,
	}),
);
Label.displayName = Root$2.displayName;

// src/components/switch.tsx
const React11 = await importShared("react");
var Switch = React11.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(Switch$1, {
		className: cn(
			"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
			className,
		),
		...props,
		ref,
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(SwitchThumb, {
			className: cn("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"),
		}),
	}),
);
Switch.displayName = Switch$1.displayName;

// src/components/checkbox.tsx
const React12 = await importShared("react");
var Checkbox = React12.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox$1, {
		ref,
		className: cn(
			"grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
			className,
		),
		...props,
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxIndicator, {
			className: cn("grid place-content-center text-current"),
			children: /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: "h-4 w-4" }),
		}),
	}),
);
Checkbox.displayName = Checkbox$1.displayName;

// src/components/select.tsx
const React13 = await importShared("react");
var Select = Select$1;
var SelectGroup = SelectGroup$1;
var SelectValue = SelectValue$1;
var SelectTrigger = React13.forwardRef(({ className, children, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectTrigger$1, {
		ref,
		className: cn(
			"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
			className,
		),
		...props,
		children: [children, /* @__PURE__ */ jsxRuntimeExports.jsx(SelectIcon, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "h-4 w-4 opacity-50" }) })],
	}),
);
SelectTrigger.displayName = SelectTrigger$1.displayName;
var SelectScrollUpButton = React13.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(SelectScrollUpButton$1, {
		ref,
		className: cn("flex cursor-default items-center justify-center py-1", className),
		...props,
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronUp, { className: "h-4 w-4" }),
	}),
);
SelectScrollUpButton.displayName = SelectScrollUpButton$1.displayName;
var SelectScrollDownButton = React13.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(SelectScrollDownButton$1, {
		ref,
		className: cn("flex cursor-default items-center justify-center py-1", className),
		...props,
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "h-4 w-4" }),
	}),
);
SelectScrollDownButton.displayName = SelectScrollDownButton$1.displayName;
var SelectContent = React13.forwardRef(({ className, children, position = "popper", ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(SelectPortal, {
		children: /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent$1, {
			ref,
			className: cn(
				"relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",
				position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
				className,
			),
			position,
			...props,
			children: [
				/* @__PURE__ */ jsxRuntimeExports.jsx(SelectScrollUpButton, {}),
				/* @__PURE__ */ jsxRuntimeExports.jsx(SelectViewport, {
					className: cn("p-1", position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),
					children,
				}),
				/* @__PURE__ */ jsxRuntimeExports.jsx(SelectScrollDownButton, {}),
			],
		}),
	}),
);
SelectContent.displayName = SelectContent$1.displayName;
var SelectLabel = React13.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(SelectLabel$1, {
		ref,
		className: cn("px-2 py-1.5 text-sm font-semibold", className),
		...props,
	}),
);
SelectLabel.displayName = SelectLabel$1.displayName;
var SelectItem = React13.forwardRef(({ className, children, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectItem$1, {
		ref,
		className: cn(
			"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
			className,
		),
		...props,
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
				className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center",
				children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItemIndicator, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: "h-4 w-4" }) }),
			}),
			/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItemText, { children }),
		],
	}),
);
SelectItem.displayName = SelectItem$1.displayName;
var SelectSeparator = React13.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(SelectSeparator$1, {
		ref,
		className: cn("-mx-1 my-1 h-px bg-muted", className),
		...props,
	}),
);
SelectSeparator.displayName = SelectSeparator$1.displayName;
var badgeVariants = cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", {
	variants: {
		variant: {
			default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
			secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
			destructive: "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
			outline: "text-foreground",
		},
	},
	defaultVariants: {
		variant: "default",
	},
});
function Badge({ className, variant, ...props }) {
	return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
}

// src/components/alert.tsx
const React14 = await importShared("react");
var alertVariants = cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7", {
	variants: {
		variant: {
			default: "bg-background text-foreground",
			destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
		},
	},
	defaultVariants: {
		variant: "default",
	},
});
var Alert = React14.forwardRef(({ className, variant, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		ref,
		role: "alert",
		className: cn(alertVariants({ variant }), className),
		...props,
	}),
);
Alert.displayName = "Alert";
var AlertTitle = React14.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("h5", {
		ref,
		className: cn("mb-1 font-medium leading-none tracking-tight", className),
		...props,
	}),
);
AlertTitle.displayName = "AlertTitle";
var AlertDescription = React14.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		ref,
		className: cn("text-sm [&_p]:leading-relaxed", className),
		...props,
	}),
);
AlertDescription.displayName = "AlertDescription";

// src/components/alert-dialog.tsx
const React15 = await importShared("react");
var AlertDialog = Root2;
var AlertDialogTrigger = Trigger2;
var AlertDialogPortal = Portal2;
var AlertDialogOverlay = React15.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(Overlay2, {
		className: cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
		...props,
		ref,
	}),
);
AlertDialogOverlay.displayName = Overlay2.displayName;
var AlertDialogContent = React15.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDialogPortal, {
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialogOverlay, {}),
			/* @__PURE__ */ jsxRuntimeExports.jsx(Content2, {
				ref,
				className: cn(
					"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
					className,
				),
				...props,
			}),
		],
	}),
);
AlertDialogContent.displayName = Content2.displayName;
var AlertDialogHeader = ({ className, ...props }) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		className: cn("flex flex-col space-y-2 text-center sm:text-left", className),
		...props,
	});
AlertDialogHeader.displayName = "AlertDialogHeader";
var AlertDialogFooter = ({ className, ...props }) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
		...props,
	});
AlertDialogFooter.displayName = "AlertDialogFooter";
var AlertDialogTitle = React15.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(Title2, {
		ref,
		className: cn("text-lg font-semibold", className),
		...props,
	}),
);
AlertDialogTitle.displayName = Title2.displayName;
var AlertDialogDescription = React15.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(Description2, {
		ref,
		className: cn("text-sm text-muted-foreground", className),
		...props,
	}),
);
AlertDialogDescription.displayName = Description2.displayName;
var AlertDialogAction = React15.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(Action$1, {
		ref,
		className: cn(buttonVariants(), className),
		...props,
	}),
);
AlertDialogAction.displayName = Action$1.displayName;
var AlertDialogCancel = React15.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(Cancel, {
		ref,
		className: cn(buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className),
		...props,
	}),
);
AlertDialogCancel.displayName = Cancel.displayName;

// src/components/alert-dialog/alert-dialog.tsx
const React17 = await importShared("react");

// src/components/alert-dialog/typed-confirm-dialog.tsx
const React16 = await importShared("react");
function TypedConfirmDialog({ isOpen, title, message, targetName, confirmLabel = "Confirm", variant = "destructive", onConfirm, onCancel }) {
	const [inputValue, setInputValue] = React16.useState("");
	React16.useEffect(() => {
		if (!isOpen) {
			setInputValue("");
		}
	}, [isOpen]);
	const isMatch = inputValue === targetName;
	const borderClassName =
		variant === "destructive" ? "border-destructive/50"
		: variant === "warning" ? "border-warning/50"
		: "";
	const iconClassName =
		variant === "destructive" ? "text-destructive"
		: variant === "warning" ? "text-warning"
		: "text-muted-foreground";
	const iconBgClassName =
		variant === "destructive" ? "bg-destructive/10"
		: variant === "warning" ? "bg-warning/10"
		: "bg-muted";
	const handleKeyDown = (e) => {
		if (e.key === "Enter" && isMatch) {
			onConfirm();
		}
	};
	return /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialog, {
		open: isOpen,
		onOpenChange: (open) => !open && onCancel(),
		children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDialogContent, {
			className: `sm:max-w-md ${borderClassName}`,
			children: [
				/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialogHeader, {
					children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
						className: "flex items-start gap-4",
						children: [
							/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
								className: "shrink-0 mt-0.5",
								children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
									className: `rounded-full p-2 ${iconBgClassName}`,
									children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleAlert, { className: `h-5 w-5 ${iconClassName}` }),
								}),
							}),
							/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
								className: "flex-1 space-y-1.5",
								children: [
									/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialogTitle, { children: title }),
									/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialogDescription, { className: "text-sm text-muted-foreground", children: message }),
								],
							}),
						],
					}),
				}),
				/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
					className: "mt-4 space-y-2",
					children: [
						/* @__PURE__ */ jsxRuntimeExports.jsxs(Label, {
							htmlFor: "typed-confirm-input",
							children: ["Type", " ", /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-mono font-semibold text-foreground", children: targetName }), " ", "to confirm"],
						}),
						/* @__PURE__ */ jsxRuntimeExports.jsx(Input, {
							"id": "typed-confirm-input",
							"value": inputValue,
							"onChange": (e) => setInputValue(e.target.value),
							"onKeyDown": handleKeyDown,
							"placeholder": targetName,
							"autoComplete": "off",
							"autoFocus": true,
							"aria-label": `Type "${targetName}" to confirm`,
							"aria-describedby": "typed-confirm-desc",
						}),
						/* @__PURE__ */ jsxRuntimeExports.jsx("p", { id: "typed-confirm-desc", className: "sr-only", children: `Enter exactly "${targetName}" to enable the confirm button` }),
					],
				}),
				/* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDialogFooter, {
					className: "mt-4 sm:space-x-2",
					children: [
						/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "outline", onClick: onCancel, children: "Cancel" }),
						/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
							"variant": variant === "destructive" ? "destructive" : "default",
							"onClick": onConfirm,
							"disabled": !isMatch,
							"aria-disabled": !isMatch,
							"children": confirmLabel,
						}),
					],
				}),
			],
		}),
	});
}

// src/components/alert-dialog/alert-dialog-context.ts
const { createContext } = await importShared("react");

var AlertDialogContext = createContext(null);
var initialState = {
	mode: "simple",
	isOpen: false,
	title: "",
	message: "",
	confirmLabel: "Confirm",
	cancelLabel: "Cancel",
	variant: "default",
	targetName: "",
	resolve: null,
};
var variantConfig = {
	default: {
		Icon: CircleHelp,
		iconClassName: "text-muted-foreground",
		iconBgClassName: "bg-muted",
		borderClassName: "",
	},
	destructive: {
		Icon: Trash2,
		iconClassName: "text-destructive",
		iconBgClassName: "bg-destructive/10",
		borderClassName: "border-destructive/50",
	},
	warning: {
		Icon: TriangleAlert,
		iconClassName: "text-warning",
		iconBgClassName: "bg-warning/10",
		borderClassName: "border-warning/50",
	},
};
function AlertDialogProvider({ children }) {
	const [state, setState] = React17.useState(initialState);
	const handleClose = React17.useCallback((confirmed) => {
		setState((prev) => {
			if (prev.resolve) {
				prev.resolve(confirmed);
			}
			return initialState;
		});
	}, []);
	const confirm = React17.useCallback((options) => {
		return new Promise((resolve) => {
			setState({
				mode: "simple",
				isOpen: true,
				title: options.title ?? "Confirm",
				message: options.message,
				confirmLabel: options.confirmLabel ?? "Confirm",
				cancelLabel: options.cancelLabel ?? "Cancel",
				variant: options.variant ?? "default",
				targetName: "",
				resolve,
			});
		});
	}, []);
	const confirmTyped = React17.useCallback((options) => {
		return new Promise((resolve) => {
			setState({
				mode: "typed",
				isOpen: true,
				title: options.title ?? "Confirm",
				message: options.message,
				confirmLabel: options.confirmLabel ?? "Confirm",
				cancelLabel: "Cancel",
				variant: options.variant ?? "destructive",
				targetName: options.targetName,
				resolve,
			});
		});
	}, []);
	const contextValue = React17.useMemo(() => ({ confirm, confirmTyped }), [confirm, confirmTyped]);
	const config = variantConfig[state.variant];
	return /* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDialogContext.Provider, {
		value: contextValue,
		children: [
			children,
			state.mode === "simple" &&
				/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialog, {
					open: state.isOpen,
					onOpenChange: (open) => !open && handleClose(false),
					children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDialogContent, {
						className: `sm:max-w-md ${config.borderClassName}`,
						children: [
							/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialogHeader, {
								children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
									className: "flex items-start gap-4",
									children: [
										/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
											className: "shrink-0 mt-0.5",
											children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
												className: `rounded-full p-2 ${config.iconBgClassName}`,
												children: /* @__PURE__ */ jsxRuntimeExports.jsx(config.Icon, { className: `h-5 w-5 ${config.iconClassName}` }),
											}),
										}),
										/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
											className: "flex-1 space-y-1.5",
											children: [
												/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialogTitle, { children: state.title }),
												/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialogDescription, { className: "text-sm text-muted-foreground", children: state.message }),
											],
										}),
									],
								}),
							}),
							/* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDialogFooter, {
								className: "mt-4 sm:space-x-2",
								children: [
									/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "outline", onClick: () => handleClose(false), children: state.cancelLabel }),
									/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
										variant: state.variant === "destructive" ? "destructive" : "default",
										onClick: () => handleClose(true),
										autoFocus: true,
										children: state.confirmLabel,
									}),
								],
							}),
						],
					}),
				}),
			state.mode === "typed" &&
				/* @__PURE__ */ jsxRuntimeExports.jsx(TypedConfirmDialog, {
					isOpen: state.isOpen,
					title: state.title,
					message: state.message,
					targetName: state.targetName,
					confirmLabel: state.confirmLabel,
					variant: state.variant,
					onConfirm: () => handleClose(true),
					onCancel: () => handleClose(false),
				}),
		],
	});
}

// src/components/alert-dialog/use-alert-dialog.ts
const { useContext } = await importShared("react");

function useAlertDialog() {
	const ctx = useContext(AlertDialogContext);
	if (!ctx) {
		throw new Error("useAlertDialog() must be used within an <AlertDialogProvider>");
	}
	return ctx;
}

// src/components/dialog.tsx
const React18 = await importShared("react");
var Dialog = Dialog$1;
var DialogTrigger = DialogTrigger$1;
var DialogPortal = DialogPortal$1;
var DialogClose = DialogClose$1;
var DialogOverlay = React18.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlay$1, {
		ref,
		className: cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
		...props,
	}),
);
DialogOverlay.displayName = DialogOverlay$1.displayName;
var DialogContent = React18.forwardRef(({ className, children, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsxs(DialogPortal, {
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlay, {}),
			/* @__PURE__ */ jsxRuntimeExports.jsxs(DialogContent$1, {
				ref,
				className: cn(
					"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
					className,
				),
				...props,
				children: [
					children,
					/* @__PURE__ */ jsxRuntimeExports.jsxs(DialogClose$1, {
						className:
							"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
						children: [/* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }), /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Close" })],
					}),
				],
			}),
		],
	}),
);
DialogContent.displayName = DialogContent$1.displayName;
var DialogHeader = ({ className, ...props }) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className),
		...props,
	});
DialogHeader.displayName = "DialogHeader";
var DialogFooter = ({ className, ...props }) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
		...props,
	});
DialogFooter.displayName = "DialogFooter";
var DialogTitle = React18.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle$1, {
		ref,
		className: cn("text-lg font-semibold leading-none tracking-tight", className),
		...props,
	}),
);
DialogTitle.displayName = DialogTitle$1.displayName;
var DialogDescription = React18.forwardRef(({ className, ...props }, ref) =>
	/* @__PURE__ */ jsxRuntimeExports.jsx(DialogDescription$1, {
		ref,
		className: cn("text-sm text-muted-foreground", className),
		...props,
	}),
);
DialogDescription.displayName = DialogDescription$1.displayName;
var Toaster = ({ position = "bottom-right", ...props }) => {
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Toaster$1, {
		position,
		className: "toaster group",
		toastOptions: {
			classNames: {
				toast: "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
				description: "group-[.toast]:text-muted-foreground",
				actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
				cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
			},
		},
		...props,
	});
};

// src/components/monaco.tsx
const { Suspense, lazy } = await importShared("react");
var Editor = lazy(() => __vitePreload(() => import("../index-D75C7LcR.js"), true ? [] : void 0));
function Monaco({ value, onChange, language = "html", height = "400px", theme = "vs-dark", options = {}, className }) {
	const defaultOptions = {
		minimap: { enabled: false },
		lineNumbers: "on",
		wordWrap: "on",
		fontSize: 14,
		tabSize: 2,
		automaticLayout: true,
		scrollBeyondLastLine: false,
		formatOnPaste: true,
		formatOnType: true,
		...options,
	};
	return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		className,
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, {
			fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
				className: "flex items-center justify-center bg-[#1e1e1e] rounded",
				style: { height },
				children: /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-8 w-8 animate-spin text-muted-foreground" }),
			}),
			children: /* @__PURE__ */ jsxRuntimeExports.jsx(Editor, {
				height,
				language,
				value,
				onChange,
				theme,
				options: defaultOptions,
			}),
		}),
	});
}

// src/components/monaco-html-editor/monaco-html-editor.tsx
const { Suspense: Suspense2, lazy: lazy2, useCallback: useCallback2, useRef, useEffect: useEffect2, useState: useState3 } = await importShared("react");

// src/i18n/en.json
var en_default = {
	authorPicker: {
		placeholder: "Select an author",
		searchPlaceholder: "Search authors...",
		searchLabel: "Search authors",
		loading: "Loading authors",
		noResults: "No authors found",
		guestLabel: "Guest",
		postCount: "{{count}} posts",
		clearSelection: "Clear selection",
		idSelected: "Author selected",
		createNew: "+ Create new author",
	},
	authorEditorDialog: {
		title: "Create new author",
		description: "Fill in the author details. Link to an existing user or create a guest author.",
		nameLabel: "Display name",
		namePlaceholder: "e.g. Jane Smith",
		nameRequired: "Display name is required.",
		bioLabel: "Bio",
		bioPlaceholder: "Short biography...",
		avatarLabel: "Avatar",
		avatarPlaceholder: "Select avatar image",
		isGuestLabel: "Guest author",
		isGuestHelp: "Guest authors are not linked to a user account.",
		linkedUserLabel: "Linked user",
		linkedUserPlaceholder: "Link to an existing user (optional)",
		linkedUserHelp: "Linking a user allows them to manage their author profile.",
		saveButton: "Create author",
		saveFailed: "Failed to create author.",
		unexpectedResponse: "Unexpected response from server.",
	},
	userPicker: {
		placeholder: "Select a user",
		placeholderMulti: "Select users",
		searchPlaceholder: "Search users...",
		searchLabel: "Search users",
		loading: "Loading users",
		noResults: "No users found",
		selectedCount: "{{count}} selected",
		removeUser: "Remove {{name}}",
		clearAll: "Clear selection",
		idSelected: "User selected",
		loadMore: "Load more",
	},
	monacoHtmlEditor: {
		ariaLabel: "HTML template editor",
		toolbarLabel: "Insert placeholder",
		placeholderSelectAriaLabel: "Select placeholder to insert",
		selectPlaceholder: "Choose a placeholder\u2026",
		insertButton: "Insert selected placeholder",
		insertButtonLabel: "Insert",
		previewTitle: "Certificate preview",
		previewAriaLabel: "Live certificate preview",
	},
	videoPlayer: {
		ariaLabel: "Video player",
		progressLabel: "Watch progress",
		resumeFrom: "Resume from {{time}}",
		loomEmbedTitle: "Loom video",
		loomInvalidUrl: "Invalid Loom URL",
	},
	common: {
		save: "Save",
		cancel: "Cancel",
		delete: "Delete",
		saving: "Saving...",
		loading: "Loading...",
		error: "Error",
		success: "Success",
	},
	dataTable: {
		searchPlaceholder: "Search...",
		searchLabel: "Search table rows",
		clearSearch: "Clear search",
		sortByLabel: "Sort by",
		sortByPlaceholder: "Sort by...",
		sortAscShort: "A\u2192Z",
		sortDescShort: "Z\u2192A",
		sortAscending: "Sort ascending",
		sortDescending: "Sort descending",
		clearSort: "Clear sort",
		rowsPerPage: "Rows per page",
		pageOf: "Page {{current}} of {{total}}",
		rowRange: "{{start}}\u2013{{end}} of {{total}}",
		selectedCount: "{{count}} selected",
		firstPage: "First page",
		previousPage: "Previous page",
		nextPage: "Next page",
		lastPage: "Last page",
		selectAll: "Select all rows on this page",
		selectRow: "Select row",
		selectAllMatching: "Select all {{count}} matching",
		allMatchingSelected: "All {{count}} matching selected.",
		clearSelection: "Clear selection",
		bulkActionsToolbar: "Bulk actions",
		emptyState: "No results",
		errorState: "Failed to load data. Please try again.",
		tableLabel: "Data table",
	},
};

// src/i18n/i18n.ts
function initI18n(resources = {}) {
	const merged = {
		en: { translation: en_default },
		...resources,
	};
	void instance.use(initReactI18next).init({
		resources: merged,
		lng: "en",
		fallbackLng: "en",
		interpolation: { escapeValue: false },
	});
	return instance;
}
var t = instance.t.bind(instance);

// src/components/monaco-html-editor/placeholder-completion.ts
var CERTIFICATE_PLACEHOLDERS = [
	{ name: "{{student_name}}", detail: "Student full name" },
	{ name: "{{course_title}}", detail: "Course title" },
	{ name: "{{completion_date}}", detail: "Completion date (ISO 8601)" },
	{ name: "{{instructor_name}}", detail: "Instructor full name" },
	{ name: "{{certificate_id}}", detail: "Unique certificate ID" },
	{ name: "{{institution_logo_url}}", detail: "Institution logo URL" },
];
function registerPlaceholderCompletion(monaco) {
	return monaco.languages.registerCompletionItemProvider("html", {
		triggerCharacters: ["{"],
		provideCompletionItems(model, position) {
			const lineContent = model.getLineContent(position.lineNumber);
			const textBefore = lineContent.substring(0, position.column - 1);
			if (!textBefore.endsWith("{{")) {
				return { suggestions: [] };
			}
			const range = {
				startLineNumber: position.lineNumber,
				startColumn: position.column - 2,
				// replace the `{{` the user typed
				endLineNumber: position.lineNumber,
				endColumn: position.column,
			};
			const suggestions = CERTIFICATE_PLACEHOLDERS.map((ph) => ({
				label: ph.name,
				kind: monaco.languages.CompletionItemKind.Variable,
				insertText: ph.name,
				detail: ph.detail,
				range,
			}));
			return { suggestions };
		},
	});
}
var MonacoEditor = lazy2(() => __vitePreload(() => import("../index-D75C7LcR.js"), true ? [] : void 0));
var DEFAULT_SAMPLE_DATA = {
	student_name: "Jane Smith",
	course_title: "Advanced Foo Bar",
	completion_date: "2026-04-13",
	instructor_name: "Prof. Qux",
	certificate_id: "CERT-ABC-1234",
	institution_logo_url: "https://example.com/logo.png",
};
function substitutePreview(html, sampleData) {
	return html.replace(/\{\{(\w+)\}\}/g, (match, key) => (Object.prototype.hasOwnProperty.call(sampleData, key) ? sampleData[key] : match));
}
function MonacoHtmlEditor({ value, onChange, sampleData = DEFAULT_SAMPLE_DATA, className }) {
	const editorRef = useRef(null);
	const completionDisposableRef = useRef(null);
	const [selectedPlaceholder, setSelectedPlaceholder] = useState3("");
	const previewHtml = substitutePreview(value, sampleData);
	const handleEditorDidMount = useCallback2((editor, monaco) => {
		editorRef.current = editor;
		completionDisposableRef.current?.dispose();
		completionDisposableRef.current = registerPlaceholderCompletion(monaco);
	}, []);
	useEffect2(() => {
		return () => {
			completionDisposableRef.current?.dispose();
		};
	}, []);
	const handleInsertPlaceholder = useCallback2(() => {
		if (!selectedPlaceholder || !editorRef.current) return;
		const editor = editorRef.current;
		const selection = editor.getSelection();
		if (!selection) return;
		editor.executeEdits("insert-placeholder", [
			{
				range: selection,
				text: selectedPlaceholder,
				forceMoveMarkers: true,
			},
		]);
		editor.focus();
		setSelectedPlaceholder("");
	}, [selectedPlaceholder]);
	return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
		"className": ["flex flex-col border border-border rounded-md overflow-hidden bg-background", className ?? ""].join(" ").trim(),
		"aria-label": t("monacoHtmlEditor.ariaLabel", "HTML template editor"),
		"children": [
			/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
				className: "flex items-center gap-2 border-b border-border bg-muted/40 px-3 py-2",
				children: [
					/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium text-foreground shrink-0", children: t("monacoHtmlEditor.toolbarLabel", "Insert placeholder") }),
					/* @__PURE__ */ jsxRuntimeExports.jsxs(Select, {
						value: selectedPlaceholder,
						onValueChange: setSelectedPlaceholder,
						children: [
							/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, {
								"className": "h-8 w-56 text-sm",
								"aria-label": t("monacoHtmlEditor.placeholderSelectAriaLabel", "Select placeholder to insert"),
								"children": /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, {
									placeholder: t("monacoHtmlEditor.selectPlaceholder", "Choose a placeholder\u2026"),
								}),
							}),
							/* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, {
								children: CERTIFICATE_PLACEHOLDERS.map((ph) =>
									/* @__PURE__ */ jsxRuntimeExports.jsxs(
										SelectItem,
										{
											value: ph.name,
											children: [
												/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-mono text-xs", children: ph.name }),
												/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2 text-muted-foreground text-xs", children: ph.detail }),
											],
										},
										ph.name,
									),
								),
							}),
						],
					}),
					/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
						"size": "sm",
						"variant": "outline",
						"onClick": handleInsertPlaceholder,
						"disabled": !selectedPlaceholder,
						"aria-label": t("monacoHtmlEditor.insertButton", "Insert selected placeholder"),
						"children": t("monacoHtmlEditor.insertButtonLabel", "Insert"),
					}),
				],
			}),
			/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
				className: "grid grid-cols-2 flex-1 min-h-0",
				style: { height: 480 },
				children: [
					/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
						className: "border-r border-border overflow-hidden",
						children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense2, {
							fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
								className: "flex h-full items-center justify-center bg-background",
								children: /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-6 w-6 animate-spin text-muted-foreground" }),
							}),
							children: /* @__PURE__ */ jsxRuntimeExports.jsx(MonacoEditor, {
								height: "100%",
								language: "html",
								value,
								onChange: (v) => onChange(v ?? ""),
								theme: "vs-dark",
								onMount: handleEditorDidMount,
								options: {
									minimap: { enabled: false },
									lineNumbers: "on",
									wordWrap: "on",
									fontSize: 13,
									tabSize: 2,
									automaticLayout: true,
									scrollBeyondLastLine: false,
									formatOnPaste: true,
									formatOnType: true,
								},
							}),
						}),
					}),
					/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
						className: "overflow-hidden bg-background",
						children: /* @__PURE__ */ jsxRuntimeExports.jsx("iframe", {
							"srcDoc": previewHtml,
							"sandbox": "allow-same-origin",
							"title": t("monacoHtmlEditor.previewTitle", "Certificate preview"),
							"className": "w-full h-full border-0",
							"aria-label": t("monacoHtmlEditor.previewAriaLabel", "Live certificate preview"),
						}),
					}),
				],
			}),
		],
	});
}
var allowedElements = ["p", "strong", "em", "ul", "ol", "li", "blockquote", "a", "br"];
function MarkdownDisplay({ value, className }) {
	if (!value) return null;
	return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		className,
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(Markdown, {
			allowedElements,
			unwrapDisallowed: true,
			components: {
				a: ({ href, children }) => {
					const safe = href?.startsWith("http:") || href?.startsWith("https:");
					return safe ? /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href, rel: "nofollow ugc", target: "_blank", children }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children });
				},
			},
			children: value,
		}),
	});
}

// src/components/markdown-editor.tsx
const { lazy: lazy3, Suspense: Suspense3 } = await importShared("react");
var LazyEditor = lazy3(() => __vitePreload(() => import("../markdown-editor-inner-UDKJCI6H-CeENUUs8.js"), true ? [] : void 0));
function MarkdownEditor(props) {
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense3, {
		fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-32 animate-pulse rounded-md bg-base-200" }),
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(LazyEditor, { ...props }),
	});
}

// src/hooks/use-ai-generate.ts
const { useState: useState4, useCallback: useCallback3 } = await importShared("react");

function useAIGenerate() {
	const [isLoading, setIsLoading] = useState4(false);
	const [error, setError] = useState4(null);
	const generate = useCallback3(async (prompt, existingHtml) => {
		setIsLoading(true);
		setError(null);
		try {
			const response = await fetch("/blockninja.v1.SmartBlockService/GenerateSmartBlock", {
				method: "POST",
				headers: {
					"Content-Type": "application/json",
				},
				body: JSON.stringify({
					prompt,
					existingHtml: existingHtml || "",
				}),
			});
			if (!response.ok) {
				throw new Error(`Generation failed: ${response.statusText}`);
			}
			const data = await response.json();
			return {
				generationId: data.generationId || `gen_${Date.now()}`,
				schema: data.schemaJson ? JSON.parse(data.schemaJson) : {},
				template: data.htmlTemplate || "",
				explanation: data.explanation || "Content generated successfully",
			};
		} catch (err) {
			const error2 = err instanceof Error ? err : new Error("Generation failed");
			setError(error2);
			throw error2;
		} finally {
			setIsLoading(false);
		}
	}, []);
	return { generate, isLoading, error };
}

// src/hooks/use-ai-assist.ts
const { useState: useState5, useCallback: useCallback4 } = await importShared("react");

function useAIAssist() {
	const [isLoading, setIsLoading] = useState5(false);
	const [error, setError] = useState5(null);
	const assist = useCallback4(async (instruction, currentHtml, schemaJson) => {
		setIsLoading(true);
		setError(null);
		try {
			const response = await fetch("/blockninja.v1.SmartBlockService/AssistSmartBlock", {
				method: "POST",
				headers: {
					"Content-Type": "application/json",
				},
				body: JSON.stringify({
					instruction,
					currentHtml,
					schemaJson: schemaJson || "",
				}),
			});
			if (!response.ok) {
				throw new Error(`Assist failed: ${response.statusText}`);
			}
			const data = await response.json();
			return {
				template: data.htmlTemplate || currentHtml,
				explanation: data.explanation || "Template updated successfully",
			};
		} catch (err) {
			const error2 = err instanceof Error ? err : new Error("Assist failed");
			setError(error2);
			throw error2;
		} finally {
			setIsLoading(false);
		}
	}, []);
	return { assist, isLoading, error };
}

// src/hooks/use-realtime.ts
const { useState: useState6, useEffect: useEffect3, useCallback: useCallback5, useRef: useRef2 } = await importShared("react");

function getRealtimeClient() {
	return globalThis.__BLOCKNINJA_REALTIME__ ?? null;
}
function useRealtimeStatus() {
	const [status, setStatus] = useState6("disconnected");
	useEffect3(() => {
		const client = getRealtimeClient();
		if (!client) {
			console.warn("[realtime] No realtime client available");
			return;
		}
		setStatus(client.getConnectionStatus());
		const unsubscribe = client.onConnectionStatusChange(setStatus);
		return unsubscribe;
	}, []);
	return status;
}
function useRealtimeTopic(topic, callback) {
	const callbackRef = useRef2(callback);
	callbackRef.current = callback;
	useEffect3(() => {
		if (!topic) return;
		const client = getRealtimeClient();
		if (!client) {
			console.warn("[realtime] No realtime client available, cannot subscribe to topic:", topic);
			return;
		}
		client.connect();
		const unsubscribe = client.subscribeTopic(topic, (payload, action, triggeredBy) => {
			callbackRef.current(payload, action, triggeredBy);
		});
		return unsubscribe;
	}, [topic]);
}
function useRealtimePublish() {
	return useCallback5(async (topic, action, payload = {}) => {
		try {
			const response = await fetch("/blockninja.v1.RealtimeService/PublishToTopic", {
				method: "POST",
				headers: {
					"Content-Type": "application/json",
				},
				body: JSON.stringify({ topic, action, payload }),
			});
			if (!response.ok) {
				throw new Error(`Failed to publish: ${response.statusText}`);
			}
		} catch (error) {
			console.error("[realtime] Failed to publish to topic:", topic, error);
			throw error;
		}
	}, []);
}

// src/components/media-library/use-media-picker.ts
const React22 = await importShared("react");

const { createContext: createContext2, useContext: useContext2, useState: useState7, useCallback: useCallback6, useMemo: useMemo2 } = await importShared("react");

var MediaPickerContext = createContext2(null);
function useMediaPicker() {
	const ctx = useContext2(MediaPickerContext);
	if (!ctx) {
		throw new Error("useMediaPicker() must be used within a <MediaPickerProvider>");
	}
	return ctx;
}
function MediaPickerProvider({ children }) {
	const [isOpen, setIsOpen] = useState7(false);
	const [mode, setMode] = useState7("browse");
	const [onSelectFn, setOnSelectFn] = useState7(void 0);
	const [allowedTypes, setAllowedTypes] = useState7(void 0);
	const [search, setSearch] = useState7("");
	const [sortBy, setSortBy] = useState7("created");
	const [sortOrder, setSortOrder] = useState7("desc");
	const [viewMode, setViewMode] = useState7("grid-md");
	const [folderId, setFolderId] = useState7(null);
	const [folders, setFolders] = useState7([]);
	const [pickedId, setPickedId] = useState7(null);
	const [selectedIds, setSelectedIds] = useState7(/* @__PURE__ */ new Set());
	const [lastSelectedId, setLastSelectedId] = useState7(null);
	const [detailId, setDetailId] = useState7(null);
	const [uploads, setUploads] = useState7([]);
	const openPicker = useCallback6((options) => {
		setOnSelectFn(() => options.onSelect);
		setAllowedTypes(options.allowedTypes);
		setMode("pick");
		setPickedId(null);
		setSelectedIds(/* @__PURE__ */ new Set());
		setDetailId(null);
		setSearch("");
		setFolderId(null);
		setIsOpen(true);
	}, []);
	const openBrowser = useCallback6(() => {
		setMode("browse");
		setOnSelectFn(void 0);
		setAllowedTypes(void 0);
		setPickedId(null);
		setSelectedIds(/* @__PURE__ */ new Set());
		setDetailId(null);
		setIsOpen(true);
	}, []);
	const closePicker = useCallback6(() => {
		setIsOpen(false);
		setMode("browse");
		setOnSelectFn(void 0);
		setAllowedTypes(void 0);
		setPickedId(null);
		setSelectedIds(/* @__PURE__ */ new Set());
		setLastSelectedId(null);
		setDetailId(null);
		setSearch("");
		setFolderId(null);
	}, []);
	const toggleSelection = useCallback6((id) => {
		setSelectedIds((prev) => {
			const next = new Set(prev);
			if (next.has(id)) {
				next.delete(id);
			} else {
				next.add(id);
			}
			return next;
		});
		setLastSelectedId(id);
		setDetailId(id);
	}, []);
	const selectSingle = useCallback6((id) => {
		setSelectedIds(/* @__PURE__ */ new Set([id]));
		setLastSelectedId(id);
		setDetailId(id);
	}, []);
	const selectRange = useCallback6(({ fromId, toId, mediaList }) => {
		const fromIndex = mediaList.findIndex((m) => m.id === fromId);
		const toIndex = mediaList.findIndex((m) => m.id === toId);
		if (fromIndex === -1 || toIndex === -1) return;
		const start = Math.min(fromIndex, toIndex);
		const end = Math.max(fromIndex, toIndex);
		setSelectedIds((prev) => {
			const next = new Set(prev);
			for (let i = start; i <= end; i++) {
				next.add(mediaList[i].id);
			}
			return next;
		});
		setLastSelectedId(toId);
	}, []);
	const clearSelection = useCallback6(() => {
		setSelectedIds(/* @__PURE__ */ new Set());
		setLastSelectedId(null);
	}, []);
	const addUpload = useCallback6((item) => {
		setUploads((prev) => [...prev, item]);
	}, []);
	const updateUpload = useCallback6(({ id, updates }) => {
		setUploads((prev) => prev.map((u) => (u.id === id ? { ...u, ...updates } : u)));
	}, []);
	const removeUpload = useCallback6((id) => {
		setUploads((prev) => {
			const upload = prev.find((u) => u.id === id);
			if (upload?.previewUrl) {
				URL.revokeObjectURL(upload.previewUrl);
			}
			return prev.filter((u) => u.id !== id);
		});
	}, []);
	const value = useMemo2(
		() => ({
			isOpen,
			mode,
			onSelect: onSelectFn,
			allowedTypes,
			search,
			sortBy,
			sortOrder,
			viewMode,
			folderId,
			folders,
			pickedId,
			selectedIds,
			lastSelectedId,
			detailId,
			uploads,
			openPicker,
			openBrowser,
			closePicker,
			setSearch,
			setSortBy,
			setSortOrder,
			setViewMode,
			setFolderId,
			setFolders,
			setPickedId,
			toggleSelection,
			selectSingle,
			selectRange,
			clearSelection,
			setSelectedIds,
			setDetailId,
			addUpload,
			updateUpload,
			removeUpload,
		}),
		[
			isOpen,
			mode,
			onSelectFn,
			allowedTypes,
			search,
			sortBy,
			sortOrder,
			viewMode,
			folderId,
			folders,
			pickedId,
			selectedIds,
			lastSelectedId,
			detailId,
			uploads,
			openPicker,
			openBrowser,
			closePicker,
			toggleSelection,
			selectSingle,
			selectRange,
			clearSelection,
			addUpload,
			updateUpload,
			removeUpload,
		],
	);
	return React22.createElement(MediaPickerContext.Provider, { value }, children);
}
function MediaPickerButton({ value, onChange, className, placeholder = "Select image", allowedTypes, previewClassName, imageClassName, wrapperClassName }) {
	const { openPicker } = useMediaPicker();
	const env = Reflect.get(import.meta, "env");
	const apiUrl = typeof env?.VITE_API_URL === "string" ? env.VITE_API_URL : "";
	const buildMediaUrl = (path) => {
		if (!path) return "";
		if (path.startsWith("/media/")) return `${apiUrl}${path}`;
		return `${apiUrl}/media/${path}`;
	};
	const handleClick = () => {
		openPicker({
			onSelect: (media) => {
				onChange(media.originalPath);
			},
			allowedTypes,
		});
	};
	const handleClear = (e) => {
		e.stopPropagation();
		onChange(null);
	};
	if (value) {
		return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
			className: cn("relative group", wrapperClassName, className),
			children: [
				/* @__PURE__ */ jsxRuntimeExports.jsxs("button", {
					type: "button",
					onClick: handleClick,
					className: cn("relative w-full aspect-video rounded-lg overflow-hidden border hover:border-primary/50 transition-colors", previewClassName),
					children: [
						/* @__PURE__ */ jsxRuntimeExports.jsx("img", {
							src: buildMediaUrl(value),
							alt: "Selected",
							className: cn("w-full h-full object-cover", imageClassName),
						}),
						/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors" }),
					],
				}),
				/* @__PURE__ */ jsxRuntimeExports.jsx("button", {
					type: "button",
					onClick: handleClear,
					className: "absolute -top-2 -right-2 p-1 bg-destructive text-destructive-foreground rounded-full opacity-0 group-hover:opacity-100 transition-opacity",
					children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
				}),
				/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
					type: "button",
					variant: "outline",
					size: "sm",
					onClick: handleClick,
					className: "mt-2 w-full",
					children: "Change",
				}),
			],
		});
	}
	return /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, {
		type: "button",
		variant: "outline",
		onClick: handleClick,
		className: cn("gap-2", className),
		children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Image, { className: "h-4 w-4" }), placeholder],
	});
}

// src/components/media-library/media-library-dialog.tsx
const { useCallback: useCallback7, useEffect: useEffect4, useMemo: useMemo3, useRef: useRef3, useState: useState8 } = await importShared("react");
var PAGE_SIZE = 48;
var SEARCH_DEBOUNCE_MS = 250;
var SORT_OPTIONS = [
	{ value: "created", label: "Date uploaded" },
	{ value: "taken", label: "Date taken" },
	{ value: "name", label: "Name" },
	{ value: "size", label: "Size" },
];
function SortMenu({ sortBy, setSortBy, sortOrder, onToggleSortOrder }) {
	const [open, setOpen] = useState8(false);
	const ref = useRef3(null);
	useEffect4(() => {
		if (!open) return;
		const handleClick = (e) => {
			if (ref.current && !ref.current.contains(e.target)) {
				setOpen(false);
			}
		};
		document.addEventListener("mousedown", handleClick);
		return () => document.removeEventListener("mousedown", handleClick);
	}, [open]);
	return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
		ref,
		className: "relative",
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, {
				variant: "outline",
				size: "sm",
				className: "gap-2",
				onClick: () => setOpen((v) => !v),
				children: [/* @__PURE__ */ jsxRuntimeExports.jsx(SlidersHorizontal, { className: "h-4 w-4" }), "Sort"],
			}),
			open &&
				/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
					className: "absolute right-0 top-full mt-1 z-50 w-44 rounded-md border bg-popover text-popover-foreground shadow-md",
					children: [
						/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-2 py-1.5 text-xs font-medium text-muted-foreground", children: "Sort by" }),
						/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-px bg-border my-1" }),
						SORT_OPTIONS.map((opt) =>
							/* @__PURE__ */ jsxRuntimeExports.jsx(
								"button",
								{
									onClick: () => {
										setSortBy(opt.value);
										setOpen(false);
									},
									className: "flex w-full items-center px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground" + (sortBy === opt.value ? " bg-accent" : ""),
									children: opt.label,
								},
								opt.value,
							),
						),
						/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-px bg-border my-1" }),
						/* @__PURE__ */ jsxRuntimeExports.jsx("button", {
							onClick: () => {
								onToggleSortOrder();
								setOpen(false);
							},
							className: "flex w-full items-center px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground",
							children: sortOrder === "asc" ? "\u2191 Ascending" : "\u2193 Descending",
						}),
					],
				}),
		],
	});
}
function ViewModeToggle({ viewMode, onChange }) {
	const isGrid = viewMode !== "list";
	return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
		className: "flex border rounded-md overflow-hidden",
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsx("button", {
				"type": "button",
				"aria-label": "Grid view",
				"onClick": () => onChange("grid-md"),
				"className": "px-3 py-1.5 transition-colors" + (isGrid ? " bg-accent text-accent-foreground" : " hover:bg-muted"),
				"children": /* @__PURE__ */ jsxRuntimeExports.jsx(Grid3x3, { className: "h-4 w-4" }),
			}),
			/* @__PURE__ */ jsxRuntimeExports.jsx("button", {
				"type": "button",
				"aria-label": "List view",
				"onClick": () => onChange("list"),
				"className": "px-3 py-1.5 transition-colors" + (!isGrid ? " bg-accent text-accent-foreground" : " hover:bg-muted"),
				"children": /* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { className: "h-4 w-4" }),
			}),
		],
	});
}
function PickerFooter({ picked, onCancel, onInsert, apiUrl }) {
	const formatBytes = (bytes) => {
		if (bytes < 1024) return `${bytes} B`;
		if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
		if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
		return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
	};
	const thumbUrl =
		picked ?
			picked.thumbnails?.sm ?
				`${apiUrl}/media/${picked.thumbnails.sm.replace(/^\/media\//, "")}`
			:	`${apiUrl}/media/${picked.originalPath.replace(/^\/media\//, "")}`
		:	null;
	return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
		className: "border-t bg-background flex items-center gap-3 px-6 py-3 flex-shrink-0",
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
				className: "flex items-center gap-3 flex-1 min-w-0",
				children:
					picked && thumbUrl ?
						/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
							children: [
								/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
									className: "h-12 w-12 rounded overflow-hidden bg-muted flex-shrink-0 border",
									children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", {
										src: thumbUrl,
										alt: picked.filename,
										className: "h-full w-full object-cover",
									}),
								}),
								/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
									className: "min-w-0 flex-1",
									children: [
										/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm font-medium truncate", children: picked.filename }),
										/* @__PURE__ */ jsxRuntimeExports.jsxs("p", {
											className: "text-xs text-muted-foreground truncate",
											children: [picked.width > 0 && picked.height > 0 ? `${picked.width}\xD7${picked.height} \xB7 ` : "", formatBytes(Number(picked.fileSize))],
										}),
									],
								}),
							],
						})
					:	/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
							className: "flex items-center gap-2 text-sm text-muted-foreground",
							children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Image, { className: "h-4 w-4" }), "Select an image to insert"],
						}),
			}),
			/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
				className: "flex items-center gap-2 flex-shrink-0",
				children: [
					/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "outline", onClick: onCancel, action: "cancel", children: "Cancel" }),
					/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
						onClick: onInsert,
						disabled: !picked,
						action: "submit",
						entity: "media",
						children: "Insert",
					}),
				],
			}),
		],
	});
}
function MediaLibraryDialog({ renderGrid, renderSidebar, renderDetails, renderBulkActions, renderUpload } = {}) {
	const {
		isOpen,
		mode,
		onSelect,
		allowedTypes,
		closePicker,
		search,
		setSearch,
		sortBy,
		setSortBy,
		sortOrder,
		setSortOrder,
		viewMode,
		setViewMode,
		folderId,
		setFolderId,
		setFolders,
		selectedIds,
		detailId,
		setDetailId,
		clearSelection,
		pickedId,
		setPickedId,
	} = useMediaPicker();
	const searchInputRef = useRef3(null);
	const [searchInput, setSearchInput] = useState8("");
	const debounceRef = useRef3(null);
	useEffect4(() => {
		setSearchInput(search);
	}, [search]);
	const handleSearchChange = (value) => {
		setSearchInput(value);
		if (debounceRef.current) clearTimeout(debounceRef.current);
		debounceRef.current = setTimeout(() => {
			setSearch(value);
		}, SEARCH_DEBOUNCE_MS);
	};
	const handleSearchClear = () => {
		setSearchInput("");
		if (debounceRef.current) clearTimeout(debounceRef.current);
		setSearch("");
	};
	useEffect4(() => {
		return () => {
			if (debounceRef.current) clearTimeout(debounceRef.current);
		};
	}, []);
	const sensors = useSensors(
		useSensor(PointerSensor, {
			activationConstraint: { distance: 8 },
		}),
	);
	const [draggedMediaId, setDraggedMediaId] = useState8(null);
	const moveMutation = useMutation(bulkMoveMedia);
	const {
		data: mediaData,
		isLoading,
		isFetching,
		isFetchingNextPage,
		isError,
		fetchNextPage,
		hasNextPage,
		refetch,
	} = useInfiniteQuery(
		listMedia,
		{
			pagination: { page: 1, pageSize: PAGE_SIZE },
			search: search || void 0,
			folderId: folderId || void 0,
			sortBy,
			sortOrder,
		},
		{
			pageParamKey: "pagination",
			getNextPageParam: (lastPage) => {
				const currentPage = lastPage.pagination?.page ?? 1;
				const totalPages = lastPage.pagination?.totalPages ?? 1;
				const nextPage = currentPage + 1;
				return nextPage <= totalPages ? { page: nextPage, pageSize: PAGE_SIZE } : void 0;
			},
			enabled: isOpen,
			staleTime: 3e4,
			placeholderData: keepPreviousData,
		},
	);
	const { data: foldersData, refetch: refetchFolders } = useQuery(listFolders, {}, { enabled: isOpen });
	useEffect4(() => {
		if (foldersData?.folders) {
			setFolders(foldersData.folders);
		}
	}, [foldersData, setFolders]);
	useRealtimeTopic(
		isOpen ? "media:updated" : null,
		useCallback7(() => {
			refetch();
		}, [refetch]),
	);
	const gridScrollRef = useRef3(null);
	useEffect4(() => {
		if (!isOpen) return;
		const handleKeyDown = (e) => {
			if ((e.ctrlKey || e.metaKey) && e.key === "f") {
				e.preventDefault();
				searchInputRef.current?.focus();
				searchInputRef.current?.select();
			}
			if (e.key === "Escape" && document.activeElement?.tagName !== "INPUT") {
				closePicker();
			}
		};
		window.addEventListener("keydown", handleKeyDown);
		return () => window.removeEventListener("keydown", handleKeyDown);
	}, [isOpen, closePicker]);
	const handleLoadMore = useCallback7(() => {
		if (!isFetchingNextPage && hasNextPage) {
			fetchNextPage();
		}
	}, [isFetchingNextPage, hasNextPage, fetchNextPage]);
	const handleUploadComplete = useCallback7(() => {
		refetch();
	}, [refetch]);
	const handleRefresh = useCallback7(() => {
		refetch();
		refetchFolders();
	}, [refetch, refetchFolders]);
	const handleRetry = useCallback7(() => {
		refetch();
	}, [refetch]);
	const toggleSortOrder = () => {
		setSortOrder(sortOrder === "asc" ? "desc" : "asc");
	};
	const allMedia = useMemo3(() => mediaData?.pages.flatMap((p) => p.media) ?? [], [mediaData]);
	const media = useMemo3(() => {
		if (mode !== "pick" || !allowedTypes || allowedTypes.length === 0) {
			return allMedia;
		}
		return allMedia.filter((m) =>
			allowedTypes.some((t2) => {
				if (t2.endsWith("/*")) return m.mimeType.startsWith(t2.slice(0, -1));
				return m.mimeType === t2;
			}),
		);
	}, [allMedia, mode, allowedTypes]);
	const folders = foldersData?.folders ?? [];
	const handlePick = useCallback7(
		(item) => {
			if (pickedId === item.id) {
				setPickedId(null);
				setDetailId(null);
			} else {
				setPickedId(item.id);
				setDetailId(item.id);
			}
		},
		[pickedId, setPickedId, setDetailId],
	);
	const handleInsert = useCallback7(
		(item) => {
			if (onSelect) {
				onSelect(item);
				closePicker();
			}
		},
		[onSelect, closePicker],
	);
	const handleInsertFromFooter = useCallback7(() => {
		if (!pickedId) return;
		const item = media.find((m) => m.id === pickedId);
		if (item) handleInsert(item);
	}, [pickedId, media, handleInsert]);
	useEffect4(() => {
		if (!isOpen || mode !== "pick") return;
		const handleKeyDown = (e) => {
			if (e.key === "Enter" && pickedId) {
				const target = e.target;
				if (target?.tagName === "INPUT" || target?.tagName === "TEXTAREA") return;
				e.preventDefault();
				handleInsertFromFooter();
			}
		};
		window.addEventListener("keydown", handleKeyDown);
		return () => window.removeEventListener("keydown", handleKeyDown);
	}, [isOpen, mode, pickedId, handleInsertFromFooter]);
	const handleDragStart = useCallback7((event) => {
		setDraggedMediaId(event.active.id);
	}, []);
	const handleDragEnd = useCallback7(
		async (event) => {
			const { active, over } = event;
			setDraggedMediaId(null);
			if (!over) return;
			const mediaId = active.id;
			const targetFolderId = over.id;
			const idsToMove = /* @__PURE__ */ new Set([mediaId]);
			if (selectedIds.has(mediaId)) {
				selectedIds.forEach((id) => idsToMove.add(id));
			}
			const targetFolder = targetFolderId === "folder-root" ? null : targetFolderId.replace("folder-", "");
			if (targetFolder === folderId) return;
			try {
				await moveMutation.mutateAsync({
					ids: Array.from(idsToMove),
					folderId: targetFolder || void 0,
				});
				const count = idsToMove.size;
				toast.success(`Moved ${count} item${count !== 1 ? "s" : ""} to folder`);
				clearSelection();
				handleRefresh();
			} catch {
				toast.error("Failed to move media");
			}
		},
		[selectedIds, folderId, moveMutation, clearSelection, handleRefresh],
	);
	const handleDragCancel = useCallback7(() => {
		setDraggedMediaId(null);
	}, []);
	const draggedMedia = draggedMediaId ? allMedia.find((m) => m.id === draggedMediaId) : null;
	const dragCount = draggedMediaId && selectedIds.has(draggedMediaId) ? selectedIds.size : 1;
	const env = Reflect.get(import.meta, "env");
	const apiUrl = typeof env?.VITE_API_URL === "string" ? env.VITE_API_URL : "";
	const picked = pickedId ? (media.find((m) => m.id === pickedId) ?? null) : null;
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Dialog, {
		open: isOpen,
		onOpenChange: (open) => !open && closePicker(),
		children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogContent, {
			className: "w-[95vw] max-w-7xl h-[90vh] flex flex-col p-0 gap-0",
			children: [
				/* @__PURE__ */ jsxRuntimeExports.jsx(DialogHeader, {
					className: "px-6 py-4 border-b flex-shrink-0",
					children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
						className: "flex items-center justify-between gap-4",
						children: [
							/* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { className: "text-xl", children: mode === "pick" ? "Choose an image" : "Media Library" }),
							/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
								className: "flex items-center gap-3 flex-1 max-w-2xl",
								children: [
									/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
										className: "relative flex-1",
										children: [
											/* @__PURE__ */ jsxRuntimeExports.jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
											/* @__PURE__ */ jsxRuntimeExports.jsx(Input, {
												ref: searchInputRef,
												placeholder: "Search media... (Ctrl+F)",
												value: searchInput,
												onChange: (e) => handleSearchChange(e.target.value),
												className: "pl-9 pr-8",
											}),
											searchInput &&
												/* @__PURE__ */ jsxRuntimeExports.jsx("button", {
													onClick: handleSearchClear,
													className: "absolute right-2 top-1/2 -translate-y-1/2 p-1 hover:bg-muted rounded",
													children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4 text-muted-foreground" }),
												}),
										],
									}),
									/* @__PURE__ */ jsxRuntimeExports.jsx(SortMenu, {
										sortBy,
										setSortBy,
										sortOrder,
										onToggleSortOrder: toggleSortOrder,
									}),
									/* @__PURE__ */ jsxRuntimeExports.jsx(ViewModeToggle, { viewMode, onChange: setViewMode }),
								],
							}),
						],
					}),
				}),
				isFetching && !isLoading && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-0.5 bg-primary/70 animate-pulse flex-shrink-0" }),
				/* @__PURE__ */ jsxRuntimeExports.jsxs(DndContext, {
					sensors,
					collisionDetection: pointerWithin,
					onDragStart: handleDragStart,
					onDragEnd: handleDragEnd,
					onDragCancel: handleDragCancel,
					children: [
						/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
							className: "flex flex-1 min-h-0",
							children: [
								/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
									className: "w-56 border-r flex flex-col flex-shrink-0",
									children: [
										renderUpload &&
											/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 border-b", children: renderUpload({ onUploadComplete: handleUploadComplete, folderId }) }),
										renderSidebar &&
											/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
												className: "flex-1 overflow-y-auto p-4",
												children: renderSidebar({
													folders,
													folderId,
													onFolderChange: setFolderId,
													onRefresh: handleRefresh,
													isDragging: !!draggedMediaId,
												}),
											}),
									],
								}),
								/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
									ref: gridScrollRef,
									className: "flex-1 min-w-0 flex flex-col",
									children:
										renderGrid &&
										renderGrid({
											media,
											isLoading,
											isFetching,
											isFetchingNextPage,
											hasMore: !!hasNextPage,
											onLoadMore: handleLoadMore,
											mode,
											pickedId,
											allowedTypes,
											onPick: handlePick,
											onInsert: handleInsert,
											isError,
											onRetry: handleRetry,
											searchActive: !!search,
											folderActive: !!folderId,
										}),
								}),
								detailId &&
									renderDetails &&
									/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
										className: "w-72 border-l flex-shrink-0 overflow-hidden",
										children: renderDetails({
											mediaId: detailId,
											onClose: () => setDetailId(null),
											onRefresh: handleRefresh,
										}),
									}),
							],
						}),
						/* @__PURE__ */ jsxRuntimeExports.jsx(DragOverlay, {
							dropAnimation: null,
							children:
								draggedMedia &&
								/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
									className: "relative",
									children: [
										/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
											className: "w-20 h-20 rounded-lg overflow-hidden border-2 border-primary shadow-lg bg-background",
											children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", {
												src: `${apiUrl}${draggedMedia.thumbnails?.sm ? `/media/${draggedMedia.thumbnails.sm.replace(/^\/media\//, "")}` : `/media/${draggedMedia.originalPath.replace(/^\/media\//, "")}`}`,
												alt: draggedMedia.filename,
												className: "w-full h-full object-cover",
											}),
										}),
										dragCount > 1 &&
											/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
												className: "absolute -top-2 -right-2 w-6 h-6 rounded-full bg-primary text-primary-foreground text-xs font-medium flex items-center justify-center",
												children: dragCount,
											}),
									],
								}),
						}),
					],
				}),
				mode === "browse" &&
					renderBulkActions &&
					renderBulkActions({
						selectedIds,
						selectedCount: selectedIds.size,
						onClearSelection: clearSelection,
						onRefresh: handleRefresh,
						folders,
					}),
				mode === "pick" &&
					/* @__PURE__ */ jsxRuntimeExports.jsx(PickerFooter, {
						picked,
						onCancel: closePicker,
						onInsert: handleInsertFromFooter,
						apiUrl,
					}),
			],
		}),
	});
}

// src/components/media-library/media-upload-area.tsx
const { useCallback: useCallback8, useState: useState9 } = await importShared("react");
function ProgressBar({ value }) {
	return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		className: "h-1 mt-1 w-full bg-muted rounded-full overflow-hidden",
		children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
			className: "h-full bg-primary rounded-full transition-all",
			style: { width: `${Math.min(100, Math.max(0, value))}%` },
		}),
	});
}
function MediaUploadArea({ onUploadComplete, folderId }) {
	const { uploads, addUpload, updateUpload, removeUpload } = useMediaPicker();
	const [isDragging, setIsDragging] = useState9(false);
	const [urlInput, setUrlInput] = useState9("");
	const [isUploadingUrl, setIsUploadingUrl] = useState9(false);
	const env = Reflect.get(import.meta, "env");
	const apiUrl = typeof env?.VITE_API_URL === "string" ? env.VITE_API_URL : "";
	const tokenMutation = useMutation(generateUploadToken);
	const { refetch: refetchStorage } = useQuery(getStorageStatus, {});
	const uploadFile = useCallback8(
		async (file) => {
			const id = crypto.randomUUID();
			const previewUrl = file.type.startsWith("image/") ? URL.createObjectURL(file) : void 0;
			const newUpload = {
				id,
				file,
				progress: 0,
				status: "uploading",
				previewUrl,
			};
			addUpload(newUpload);
			try {
				const tokenResponse = await tokenMutation.mutateAsync({});
				const token = tokenResponse.token;
				const formData = new FormData();
				formData.append("file", file);
				const params = new URLSearchParams({ token });
				if (folderId) {
					params.set("folder_id", folderId);
				}
				const response = await fetch(`${apiUrl}/api/media/upload?${params.toString()}`, {
					method: "POST",
					body: formData,
					credentials: "include",
				});
				if (!response.ok) {
					const text = await response.text();
					throw new Error(text || "Upload failed");
				}
				const data = await response.json();
				if (data.is_duplicate) {
					updateUpload({ id, updates: { status: "duplicate", progress: 100, mediaId: data.id } });
					toast.info("File already exists", { description: file.name });
				} else {
					updateUpload({ id, updates: { status: "complete", progress: 100, mediaId: data.id } });
					toast.success("Upload complete", { description: file.name });
				}
				refetchStorage();
				onUploadComplete();
				setTimeout(() => removeUpload(id), 3e3);
			} catch (error) {
				updateUpload({
					id,
					updates: {
						status: "error",
						error: error instanceof Error ? error.message : "Upload failed",
					},
				});
				toast.error("Upload failed", { description: file.name });
			}
		},
		[apiUrl, folderId, tokenMutation, addUpload, updateUpload, removeUpload, refetchStorage, onUploadComplete],
	);
	const handleDrop = useCallback8(
		(e) => {
			e.preventDefault();
			setIsDragging(false);
			const files = Array.from(e.dataTransfer.files).filter((f) => f.type.startsWith("image/") || f.type.startsWith("video/"));
			files.forEach(uploadFile);
		},
		[uploadFile],
	);
	const handleFileSelect = (e) => {
		const files = e.target.files;
		if (files) {
			Array.from(files).forEach(uploadFile);
		}
		e.target.value = "";
	};
	const uploadFromUrl = useCallback8(async () => {
		const url = urlInput.trim();
		if (!url) return;
		try {
			new URL(url);
		} catch {
			toast.error("Invalid URL");
			return;
		}
		setIsUploadingUrl(true);
		const id = crypto.randomUUID();
		const filename = url.split("/").pop()?.split("?")[0] || "image";
		const pseudoFile = new File([], filename);
		addUpload({
			id,
			file: pseudoFile,
			progress: 0,
			status: "uploading",
		});
		try {
			const tokenResponse = await tokenMutation.mutateAsync({});
			const token = tokenResponse.token;
			const params = new URLSearchParams({ token });
			if (folderId) {
				params.set("folder_id", folderId);
			}
			const response = await fetch(`${apiUrl}/api/media/upload-url?${params.toString()}`, {
				method: "POST",
				headers: { "Content-Type": "application/json" },
				body: JSON.stringify({ url }),
				credentials: "include",
			});
			if (!response.ok) {
				throw new Error((await response.text()) || "Upload failed");
			}
			const data = await response.json();
			if (data.is_duplicate) {
				updateUpload({ id, updates: { status: "duplicate", progress: 100, mediaId: data.id } });
			} else {
				updateUpload({ id, updates: { status: "complete", progress: 100, mediaId: data.id } });
			}
			setUrlInput("");
			refetchStorage();
			onUploadComplete();
			setTimeout(() => removeUpload(id), 3e3);
		} catch (error) {
			updateUpload({
				id,
				updates: { status: "error", error: error instanceof Error ? error.message : "Failed" },
			});
		} finally {
			setIsUploadingUrl(false);
		}
	}, [urlInput, apiUrl, folderId, tokenMutation, addUpload, updateUpload, removeUpload, refetchStorage, onUploadComplete]);
	return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
		className: "space-y-3",
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsxs("label", {
				onDrop: handleDrop,
				onDragOver: (e) => {
					e.preventDefault();
					setIsDragging(true);
				},
				onDragLeave: () => setIsDragging(false),
				className: cn(
					"flex flex-col items-center justify-center p-6 border-2 border-dashed rounded-lg cursor-pointer transition-all",
					isDragging ? "border-primary bg-primary/5 scale-[1.02]" : "border-muted-foreground/25 hover:border-primary/50 hover:bg-muted/50",
				),
				children: [
					/* @__PURE__ */ jsxRuntimeExports.jsx(Upload, {
						className: cn("h-8 w-8 mb-2 transition-colors", isDragging ? "text-primary" : "text-muted-foreground"),
					}),
					/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-muted-foreground text-center", children: "Drop files here" }),
					/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-muted-foreground mt-1", children: "or click to browse" }),
					/* @__PURE__ */ jsxRuntimeExports.jsx("input", {
						type: "file",
						className: "hidden",
						accept: "image/*,video/mp4,video/webm,video/ogg,video/quicktime",
						multiple: true,
						onChange: handleFileSelect,
					}),
				],
			}),
			/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
				className: "flex gap-2",
				children: [
					/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
						className: "relative flex-1",
						children: [
							/* @__PURE__ */ jsxRuntimeExports.jsx(Link, { className: "absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
							/* @__PURE__ */ jsxRuntimeExports.jsx(Input, {
								type: "url",
								placeholder: "Paste URL...",
								value: urlInput,
								onChange: (e) => setUrlInput(e.target.value),
								onKeyDown: (e) => e.key === "Enter" && uploadFromUrl(),
								className: "pl-8 h-8 text-sm",
								disabled: isUploadingUrl,
							}),
						],
					}),
					/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
						size: "sm",
						variant: "secondary",
						onClick: uploadFromUrl,
						disabled: !urlInput.trim() || isUploadingUrl,
						className: "h-8 w-8 p-0",
						children:
							isUploadingUrl ?
								/* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-4 w-4 animate-spin" })
							:	/* @__PURE__ */ jsxRuntimeExports.jsx(ArrowRight, { className: "h-4 w-4" }),
					}),
				],
			}),
			uploads.length > 0 &&
				/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
					className: "space-y-2",
					children: uploads.map((upload) =>
						/* @__PURE__ */ jsxRuntimeExports.jsxs(
							"div",
							{
								className: "flex items-center gap-2 text-xs p-2 bg-muted rounded-lg",
								children: [
									upload.previewUrl && /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: upload.previewUrl, alt: "", className: "w-8 h-8 rounded object-cover" }),
									/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
										className: "flex-1 min-w-0",
										children: [
											/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate font-medium", children: upload.file.name }),
											upload.status === "uploading" && /* @__PURE__ */ jsxRuntimeExports.jsx(ProgressBar, { value: upload.progress }),
											upload.status === "error" && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-destructive truncate", children: upload.error }),
										],
									}),
									upload.status === "uploading" && /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-4 w-4 animate-spin text-primary" }),
									upload.status === "complete" && /* @__PURE__ */ jsxRuntimeExports.jsx(CircleCheckBig, { className: "h-4 w-4 text-success" }),
									upload.status === "duplicate" && /* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { className: "h-4 w-4 text-warning" }),
									upload.status === "error" && /* @__PURE__ */ jsxRuntimeExports.jsx(CircleX, { className: "h-4 w-4 text-destructive" }),
								],
							},
							upload.id,
						),
					),
				}),
		],
	});
}

// src/components/data-table/data-table.tsx
const React25 = await importShared("react");

// src/components/data-table/data-table-toolbar.tsx
const React23 = await importShared("react");
function DataTableToolbar({ table, globalFilter, onGlobalFilterChange, filterSlot, showSortDropdown = false, className }) {
	const [inputValue, setInputValue] = React23.useState(globalFilter);
	const debounceRef = React23.useRef(null);
	React23.useEffect(() => {
		setInputValue(globalFilter);
	}, [globalFilter]);
	const handleChange = (value) => {
		setInputValue(value);
		if (debounceRef.current) clearTimeout(debounceRef.current);
		debounceRef.current = setTimeout(() => {
			onGlobalFilterChange(value);
		}, 300);
	};
	const handleClear = () => {
		setInputValue("");
		if (debounceRef.current) clearTimeout(debounceRef.current);
		onGlobalFilterChange("");
	};
	const sortableColumns = table.getAllColumns().filter((col) => col.getCanSort() && col.columnDef.header);
	const currentSort = table.getState().sorting[0];
	const sortValue = currentSort ? `${currentSort.id}:${currentSort.desc ? "desc" : "asc"}` : "";
	const handleSortChange = (value) => {
		if (!value) {
			table.resetSorting();
			return;
		}
		const [id, dir] = value.split(":");
		table.setSorting([{ id, desc: dir === "desc" }]);
	};
	const isFiltered = inputValue.length > 0;
	return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
		className: cn("flex flex-wrap items-center gap-2 py-2", className),
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
				className: "relative flex-1 min-w-[180px] max-w-sm",
				children: [
					/* @__PURE__ */ jsxRuntimeExports.jsx(Search, {
						"className": "absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none",
						"aria-hidden": "true",
					}),
					/* @__PURE__ */ jsxRuntimeExports.jsx(Input, {
						"placeholder": t("dataTable.searchPlaceholder", "Search..."),
						"value": inputValue,
						"onChange": (e) => handleChange(e.target.value),
						"className": "pl-8 pr-8 h-9",
						"aria-label": t("dataTable.searchLabel", "Search table rows"),
					}),
					isFiltered &&
						/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
							"variant": "ghost",
							"size": "icon",
							"className": "absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6",
							"onClick": handleClear,
							"aria-label": t("dataTable.clearSearch", "Clear search"),
							"children": /* @__PURE__ */ jsxRuntimeExports.jsx(X, { "className": "h-3.5 w-3.5", "aria-hidden": "true" }),
						}),
				],
			}),
			filterSlot,
			showSortDropdown &&
				sortableColumns.length > 0 &&
				/* @__PURE__ */ jsxRuntimeExports.jsxs(Select, {
					value: sortValue,
					onValueChange: handleSortChange,
					children: [
						/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, {
							"className": "h-9 w-[180px]",
							"aria-label": t("dataTable.sortByLabel", "Sort by"),
							"children": /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: t("dataTable.sortByPlaceholder", "Sort by...") }),
						}),
						/* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, {
							children: sortableColumns.map((col) => {
								const header = typeof col.columnDef.header === "string" ? col.columnDef.header : col.id;
								return /* @__PURE__ */ jsxRuntimeExports.jsxs(
									React23.Fragment,
									{
										children: [
											/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectItem, { value: `${col.id}:asc`, children: [header, " (", t("dataTable.sortAscShort", "A\u2192Z"), ")"] }),
											/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectItem, { value: `${col.id}:desc`, children: [header, " (", t("dataTable.sortDescShort", "Z\u2192A"), ")"] }),
										],
									},
									col.id,
								);
							}),
						}),
					],
				}),
		],
	});
}

// src/components/data-table/use-data-table.ts
const React24 = await importShared("react");
var PAGE_SIZE_OPTIONS = [10, 25, 50, 100];
function useDataTable({
	data,
	columns,
	pageCount,
	manualPagination = false,
	manualSorting = false,
	manualFiltering = false,
	initialPageSize = 25,
	onPaginationChange,
	onSortingChange,
	onFilterChange,
	onSearchChange,
}) {
	const [sorting, setSorting] = React24.useState([]);
	const [columnFilters, setColumnFilters] = React24.useState([]);
	const [columnVisibility, setColumnVisibility] = React24.useState({});
	const [rowSelection, setRowSelection] = React24.useState({});
	const [globalFilter, setGlobalFilterState] = React24.useState("");
	const [pagination, setPaginationState] = React24.useState({
		pageIndex: 0,
		pageSize: initialPageSize,
	});
	const [selectAllMatching, setSelectAllMatching] = React24.useState(false);
	const handleSortingChange = React24.useCallback(
		(updater) => {
			setSorting((prev) => {
				const next = typeof updater === "function" ? updater(prev) : updater;
				onSortingChange?.(next);
				return next;
			});
		},
		[onSortingChange],
	);
	const handleColumnFiltersChange = React24.useCallback(
		(updater) => {
			setColumnFilters((prev) => {
				const next = typeof updater === "function" ? updater(prev) : updater;
				onFilterChange?.(next);
				return next;
			});
		},
		[onFilterChange],
	);
	const handlePaginationChange = React24.useCallback(
		(updater) => {
			setPaginationState((prev) => {
				const next = typeof updater === "function" ? updater(prev) : updater;
				onPaginationChange?.(next);
				return next;
			});
		},
		[onPaginationChange],
	);
	const setGlobalFilter = React24.useCallback(
		(value) => {
			setGlobalFilterState(value);
			onSearchChange?.(value);
			setPaginationState((prev) => ({ ...prev, pageIndex: 0 }));
		},
		[onSearchChange],
	);
	const table = useReactTable({
		data: data ?? [],
		columns,
		state: {
			sorting,
			columnFilters,
			columnVisibility,
			rowSelection,
			globalFilter,
			pagination,
		},
		manualPagination,
		manualSorting,
		manualFiltering,
		pageCount: manualPagination ? (pageCount ?? -1) : void 0,
		enableRowSelection: true,
		onRowSelectionChange: setRowSelection,
		onSortingChange: handleSortingChange,
		onColumnFiltersChange: handleColumnFiltersChange,
		onColumnVisibilityChange: setColumnVisibility,
		onGlobalFilterChange: setGlobalFilter,
		onPaginationChange: handlePaginationChange,
		getCoreRowModel: getCoreRowModel(),
		getSortedRowModel: manualSorting ? void 0 : getSortedRowModel(),
		getFilteredRowModel: manualFiltering ? void 0 : getFilteredRowModel(),
		getPaginationRowModel: getPaginationRowModel(),
	});
	React24.useEffect(() => {
		setSelectAllMatching(false);
	}, [rowSelection, pagination.pageIndex]);
	return {
		table,
		globalFilter,
		setGlobalFilter,
		rowSelection,
		setRowSelection,
		selectAllMatching,
		setSelectAllMatching,
	};
}
function DataTablePagination({ table, total, className }) {
	const { pageIndex, pageSize } = table.getState().pagination;
	const pageCount = table.getPageCount();
	const rowCount = total ?? table.getFilteredRowModel().rows.length;
	const selectedCount = Object.keys(table.getState().rowSelection).length;
	const startRow = pageCount === 0 ? 0 : pageIndex * pageSize + 1;
	const endRow = Math.min((pageIndex + 1) * pageSize, rowCount);
	return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
		className: cn("flex flex-wrap items-center justify-between gap-4 px-2 py-3", className),
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
				className: "text-sm text-muted-foreground min-w-[140px]",
				children:
					selectedCount > 0 ?
						t("dataTable.selectedCount", `${selectedCount} of ${rowCount} row(s) selected`)
					:	t("dataTable.rowRange", rowCount === 0 ? "0 results" : `${startRow}\u2013${endRow} of ${rowCount}`),
			}),
			/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
				className: "flex items-center gap-4 flex-wrap",
				children: [
					/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
						className: "flex items-center gap-2",
						children: [
							/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-muted-foreground whitespace-nowrap", children: t("dataTable.rowsPerPage", "Rows per page") }),
							/* @__PURE__ */ jsxRuntimeExports.jsxs(Select, {
								value: String(pageSize),
								onValueChange: (value) => {
									table.setPageSize(Number(value));
								},
								children: [
									/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, {
										"className": "h-8 w-[70px]",
										"aria-label": t("dataTable.rowsPerPage", "Rows per page"),
										"children": /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: String(pageSize) }),
									}),
									/* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, {
										side: "top",
										children: PAGE_SIZE_OPTIONS.map((size) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: String(size), children: size }, size)),
									}),
								],
							}),
						],
					}),
					/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
						className: "text-sm text-muted-foreground whitespace-nowrap",
						children: pageCount === 0 ? t("dataTable.pageOf", "Page 1 of 1") : t("dataTable.pageOf", `Page ${pageIndex + 1} of ${Math.max(pageCount, 1)}`),
					}),
					/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
						className: "flex items-center gap-1",
						children: [
							/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
								"variant": "outline",
								"size": "icon",
								"className": "h-8 w-8",
								"onClick": () => table.setPageIndex(0),
								"disabled": !table.getCanPreviousPage(),
								"aria-label": t("dataTable.firstPage", "First page"),
								"children": /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronsLeft, { "className": "h-4 w-4", "aria-hidden": "true" }),
							}),
							/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
								"variant": "outline",
								"size": "icon",
								"className": "h-8 w-8",
								"onClick": () => table.previousPage(),
								"disabled": !table.getCanPreviousPage(),
								"aria-label": t("dataTable.previousPage", "Previous page"),
								"children": /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronLeft, { "className": "h-4 w-4", "aria-hidden": "true" }),
							}),
							/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
								"variant": "outline",
								"size": "icon",
								"className": "h-8 w-8",
								"onClick": () => table.nextPage(),
								"disabled": !table.getCanNextPage(),
								"aria-label": t("dataTable.nextPage", "Next page"),
								"children": /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { "className": "h-4 w-4", "aria-hidden": "true" }),
							}),
							/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
								"variant": "outline",
								"size": "icon",
								"className": "h-8 w-8",
								"onClick": () => table.setPageIndex(pageCount - 1),
								"disabled": !table.getCanNextPage(),
								"aria-label": t("dataTable.lastPage", "Last page"),
								"children": /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronsRight, { "className": "h-4 w-4", "aria-hidden": "true" }),
							}),
						],
					}),
				],
			}),
		],
	});
}
function DataTableBulkActions({ selectedCount, totalMatchingCount, selectAllMatching, onSelectAllMatchingChange, actions, onAction, className }) {
	if (selectedCount === 0) return null;
	const showEscalation = !selectAllMatching && totalMatchingCount !== void 0 && selectedCount < totalMatchingCount;
	return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
		"className": cn("flex flex-wrap items-center gap-2 rounded-md border bg-muted/50 px-3 py-2", className),
		"role": "toolbar",
		"aria-label": t("dataTable.bulkActionsToolbar", "Bulk actions"),
		"children": [
			/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium text-foreground", children: t("dataTable.selectedCount", `${selectedCount} selected`) }),
			showEscalation &&
				/* @__PURE__ */ jsxRuntimeExports.jsx("button", {
					type: "button",
					className: "text-sm text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
					onClick: () => onSelectAllMatchingChange(true),
					children: t("dataTable.selectAllMatching", `Select all ${totalMatchingCount} matching`),
				}),
			selectAllMatching &&
				totalMatchingCount !== void 0 &&
				/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
					children: [
						/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
							className: "text-sm text-foreground",
							children: t("dataTable.allMatchingSelected", `All ${totalMatchingCount} matching selected.`),
						}),
						/* @__PURE__ */ jsxRuntimeExports.jsx("button", {
							type: "button",
							className: "text-sm text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
							onClick: () => onSelectAllMatchingChange(false),
							children: t("dataTable.clearSelection", "Clear selection"),
						}),
					],
				}),
			/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
				className: "ml-auto flex flex-wrap items-center gap-2",
				children: actions.map((action) =>
					/* @__PURE__ */ jsxRuntimeExports.jsxs(
						Button,
						{
							"variant": action.destructive ? "destructive" : "outline",
							"size": "sm",
							"disabled": action.disabled,
							"onClick": () => onAction(action.id),
							"aria-label": action.label,
							"children": [action.icon && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": "true", "children": action.icon }), action.label],
						},
						action.id,
					),
				),
			}),
		],
	});
}
var SKELETON_ROW_COUNT = 8;
function DataTable({
	columns: columnsProp,
	data,
	manualPagination,
	manualSorting,
	manualFiltering,
	pageCount,
	total,
	onPaginationChange,
	onSortingChange,
	onFilterChange,
	onSearchChange,
	bulkActions,
	onBulkAction,
	onSelectAllMatching,
	onRowClick,
	isRowDisabled,
	isLoading,
	isError,
	errorStateContent,
	emptyStateContent,
	initialPageSize = 25,
	filterSlot,
	showSortDropdown = false,
	className,
	tableAriaLabel,
}) {
	const columns = React25.useMemo(() => {
		if (!bulkActions || bulkActions.length === 0) return columnsProp;
		const selectCol = {
			id: "_select",
			header: ({ table: table2 }) =>
				/* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, {
					"checked":
						table2.getIsAllPageRowsSelected() ? true
						: table2.getIsSomePageRowsSelected() ? "indeterminate"
						: false,
					"onCheckedChange": (value) => table2.toggleAllPageRowsSelected(!!value),
					"aria-label": t("dataTable.selectAll", "Select all rows on this page"),
				}),
			cell: ({ row }) =>
				/* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, {
					"checked": row.getIsSelected(),
					"onCheckedChange": (value) => row.toggleSelected(!!value),
					"aria-label": t("dataTable.selectRow", "Select row"),
					"disabled": isRowDisabled?.(row),
					"onClick": (e) => e.stopPropagation(),
				}),
			enableSorting: false,
			enableHiding: false,
			size: 40,
		};
		return [selectCol, ...columnsProp];
	}, [columnsProp, bulkActions, isRowDisabled]);
	const { table, globalFilter, setGlobalFilter, rowSelection, selectAllMatching, setSelectAllMatching } = useDataTable({
		data: isLoading ? void 0 : data,
		columns,
		pageCount,
		manualPagination,
		manualSorting,
		manualFiltering,
		initialPageSize,
		onPaginationChange,
		onSortingChange,
		onFilterChange,
		onSearchChange,
	});
	const selectedRows = table.getSelectedRowModel().rows;
	const selectedCount = Object.keys(rowSelection).length;
	const totalMatchingCount = total ?? table.getFilteredRowModel().rows.length;
	const tbodyRef = React25.useRef(null);
	const focusableRows = React25.useCallback(() => {
		if (!tbodyRef.current) return [];
		return Array.from(tbodyRef.current.querySelectorAll("tr[tabindex]"));
	}, []);
	const handleKeyDown = React25.useCallback(
		(e) => {
			const rows = focusableRows();
			const active = document.activeElement;
			const idx = rows.indexOf(active);
			if (e.key === "j" || e.key === "ArrowDown") {
				e.preventDefault();
				const next = rows[idx + 1];
				if (next) next.focus();
			} else if (e.key === "k" || e.key === "ArrowUp") {
				e.preventDefault();
				const prev = rows[idx - 1];
				if (prev) prev.focus();
			} else if (e.key === "Enter" && idx >= 0) {
				e.preventDefault();
				const tanstackRow = table.getRowModel().rows[idx];
				if (tanstackRow && onRowClick) {
					onRowClick(tanstackRow);
				}
			}
		},
		[focusableRows, table, onRowClick],
	);
	const renderSkeletonRows = () =>
		Array.from({ length: SKELETON_ROW_COUNT }).map((_, i) =>
			/* @__PURE__ */ jsxRuntimeExports.jsx(
				TableRow,
				{
					"aria-hidden": "true",
					"children": table
						.getVisibleLeafColumns()
						.map((col) =>
							/* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-4 rounded bg-muted animate-pulse" }) }, col.id),
						),
				},
				`skeleton-${i}`,
			),
		);
	const renderEmptyState = () =>
		/* @__PURE__ */ jsxRuntimeExports.jsx(TableRow, {
			children: /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, {
				colSpan: table.getVisibleLeafColumns().length,
				className: "h-40 text-center",
				children: emptyStateContent ?? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground text-sm", children: t("dataTable.emptyState", "No results") }),
			}),
		});
	const renderErrorState = () =>
		/* @__PURE__ */ jsxRuntimeExports.jsx(TableRow, {
			children: /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, {
				colSpan: table.getVisibleLeafColumns().length,
				className: "py-4",
				children:
					errorStateContent ??
					/* @__PURE__ */ jsxRuntimeExports.jsx(Alert, {
						variant: "destructive",
						className: "mx-auto max-w-sm",
						children: /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, { children: t("dataTable.errorState", "Failed to load data. Please try again.") }),
					}),
			}),
		});
	const toolbarProps = {
		table,
		globalFilter,
		onGlobalFilterChange: setGlobalFilter,
		filterSlot,
		showSortDropdown,
	};
	return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
		className: cn("flex flex-col gap-2", className),
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsx(DataTableToolbar, { ...toolbarProps }),
			bulkActions &&
				bulkActions.length > 0 &&
				selectedCount > 0 &&
				/* @__PURE__ */ jsxRuntimeExports.jsx(DataTableBulkActions, {
					selectedCount,
					totalMatchingCount,
					selectAllMatching,
					onSelectAllMatchingChange: (value) => {
						setSelectAllMatching(value);
						if (value) onSelectAllMatching?.();
					},
					actions: bulkActions,
					onAction: (actionId) => {
						onBulkAction?.(actionId, selectedRows, selectAllMatching);
					},
				}),
			/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
				className: "rounded-md border overflow-auto",
				children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Table, {
					"aria-label": tableAriaLabel ?? t("dataTable.tableLabel", "Data table"),
					"children": [
						/* @__PURE__ */ jsxRuntimeExports.jsx(TableHeader, {
							className: "sticky top-0 z-10 bg-background shadow-[0_1px_0_0_hsl(var(--border))]",
							children: table.getHeaderGroups().map((headerGroup) =>
								/* @__PURE__ */ jsxRuntimeExports.jsx(
									TableRow,
									{
										className: "hover:bg-transparent",
										children: headerGroup.headers.map((header) =>
											/* @__PURE__ */ jsxRuntimeExports.jsx(
												TableHead,
												{
													style: { width: header.getSize() !== 150 ? header.getSize() : void 0 },
													children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()),
												},
												header.id,
											),
										),
									},
									headerGroup.id,
								),
							),
						}),
						/* @__PURE__ */ jsxRuntimeExports.jsx(TableBody, {
							"ref": tbodyRef,
							"onKeyDown": handleKeyDown,
							"aria-live": isLoading ? "polite" : void 0,
							"aria-busy": isLoading ? "true" : void 0,
							"children":
								isError ? renderErrorState()
								: isLoading ? renderSkeletonRows()
								: table.getRowModel().rows.length === 0 ? renderEmptyState()
								: table.getRowModel().rows.map((row) => {
										const disabled = isRowDisabled?.(row);
										return /* @__PURE__ */ jsxRuntimeExports.jsx(
											TableRow,
											{
												"data-state": row.getIsSelected() ? "selected" : void 0,
												"data-disabled": disabled ? "true" : void 0,
												"className": cn(onRowClick && !disabled && "cursor-pointer", disabled && "opacity-50 pointer-events-none"),
												"tabIndex": onRowClick && !disabled ? 0 : void 0,
												"onClick": () => {
													if (onRowClick && !disabled) onRowClick(row);
												},
												"onKeyDown": (e) => {
													if (e.key === "Enter" && onRowClick && !disabled) {
														onRowClick(row);
													}
												},
												"aria-selected": row.getIsSelected(),
												"children": row
													.getVisibleCells()
													.map((cell) => /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)),
											},
											row.id,
										);
									}),
						}),
					],
				}),
			}),
			/* @__PURE__ */ jsxRuntimeExports.jsx(DataTablePagination, { table, total }),
		],
	});
}
function DataTableColumnHeader({ column, title, className }) {
	if (!column.getCanSort()) {
		return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn(className), children: title });
	}
	const sorted = column.getIsSorted();
	const ariaSort =
		sorted === "asc" ? "ascending"
		: sorted === "desc" ? "descending"
		: "none";
	return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		"className": cn("flex items-center gap-1", className),
		"aria-sort": ariaSort,
		"children": /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, {
			"variant": "ghost",
			"size": "sm",
			"className": "-ml-3 h-8 font-medium text-muted-foreground hover:text-foreground data-[state=sorted]:text-foreground",
			"data-state": sorted ? "sorted" : void 0,
			"onClick": () => column.toggleSorting(sorted === "asc"),
			"aria-label":
				sorted === "asc" ? t("dataTable.sortDescending", "Sort descending")
				: sorted === "desc" ? t("dataTable.clearSort", "Clear sort")
				: t("dataTable.sortAscending", "Sort ascending"),
			"children": [
				title,
				sorted === "asc" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ArrowUp, { "className": "h-4 w-4", "aria-hidden": "true" })
				: sorted === "desc" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ArrowDown, { "className": "h-4 w-4", "aria-hidden": "true" })
				: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronsUpDown, { "className": "h-4 w-4 opacity-40", "aria-hidden": "true" }),
			],
		}),
	});
}

// src/components/blocknote-editor/blocknote-editor.tsx
const { lazy: lazy4, Suspense: Suspense4 } = await importShared("react");
var LazyBlockNoteEditorInner = lazy4(() => __vitePreload(() => import("../blocknote-editor-inner-TDURYXE3-M26_XwGL.js"), true ? [] : void 0).then((m) => ({ default: m.BlockNoteEditorInner })));
function BlockNoteEditor(props) {
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense4, {
		fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
			"className": "min-h-32 animate-pulse rounded-md bg-muted " + (props.className ?? ""),
			"aria-busy": "true",
			"aria-label": "Loading editor",
		}),
		children: /* @__PURE__ */ jsxRuntimeExports.jsx(LazyBlockNoteEditorInner, { ...props }),
	});
}

// src/components/video-player/video-player.tsx
const { useEffect: useEffect10, useRef: useRef10, useState: useState12, useCallback: useCallback12, forwardRef: forwardRef17, useImperativeHandle: useImperativeHandle4 } = await importShared("react");

// src/components/video-player/html5-source.tsx
const { useEffect: useEffect7, useImperativeHandle, useRef: useRef7 } = await importShared("react");

// src/components/video-player/use-watch-progress.ts
const { useCallback: useCallback11, useRef: useRef6 } = await importShared("react");

var DEBOUNCE_INTERVAL_SECONDS = 5;
function useWatchProgress(onProgress) {
	const lastReportedPositionRef = useRef6(-1);
	const lastTickPositionRef = useRef6(null);
	const totalWatchedRef = useRef6(0);
	const onTick = useCallback11(
		(positionSeconds) => {
			const prev = lastTickPositionRef.current;
			if (prev !== null && positionSeconds > prev) {
				totalWatchedRef.current += positionSeconds - prev;
			}
			lastTickPositionRef.current = positionSeconds;
			if (!onProgress) return;
			const lastReported = lastReportedPositionRef.current;
			if (lastReported === -1 || positionSeconds - lastReported >= DEBOUNCE_INTERVAL_SECONDS) {
				lastReportedPositionRef.current = positionSeconds;
				onProgress(positionSeconds, totalWatchedRef.current);
			}
		},
		[onProgress],
	);
	const reset = useCallback11(() => {
		lastReportedPositionRef.current = -1;
		lastTickPositionRef.current = null;
		totalWatchedRef.current = 0;
	}, []);
	return { onTick, reset, totalWatchedRef };
}
function Html5Source({ source, initialPositionSeconds = 0, onProgress, onComplete, onError, poster, autoPlay = false, imperativeRef }) {
	const videoRef = useRef7(null);
	const { onTick, reset } = useWatchProgress(onProgress);
	useImperativeHandle(imperativeRef, () => ({
		play: () => videoRef.current?.play(),
		pause: () => videoRef.current?.pause(),
		seek: (seconds) => {
			if (videoRef.current) videoRef.current.currentTime = seconds;
		},
		requestFullscreen: () => {
			videoRef.current?.requestFullscreen?.();
		},
		toggleMute: () => {
			if (videoRef.current) videoRef.current.muted = !videoRef.current.muted;
		},
	}));
	useEffect7(() => {
		const video = videoRef.current;
		if (!video) return;
		reset();
		const onLoaded = () => {
			if (initialPositionSeconds > 0) {
				video.currentTime = initialPositionSeconds;
			}
		};
		video.addEventListener("loadedmetadata", onLoaded);
		return () => video.removeEventListener("loadedmetadata", onLoaded);
	}, [source.url, initialPositionSeconds, reset]);
	const handleTimeUpdate = () => {
		const video = videoRef.current;
		if (!video) return;
		onTick(video.currentTime);
	};
	const handleEnded = () => {
		if (onComplete) onComplete();
	};
	const handleError = () => {
		const video = videoRef.current;
		const msg = video?.error?.message ?? "Video failed to load";
		if (onError) onError(new Error(msg));
	};
	return /* @__PURE__ */ jsxRuntimeExports.jsx("video", {
		ref: videoRef,
		src: source.url,
		poster,
		autoPlay,
		controls: true,
		onTimeUpdate: handleTimeUpdate,
		onEnded: handleEnded,
		onError: handleError,
		className: "w-full h-full object-contain",
		playsInline: true,
	});
}

// src/components/video-player/youtube-source.tsx
const { useEffect: useEffect8, useImperativeHandle: useImperativeHandle2, useRef: useRef8 } = await importShared("react");
var YT_ENDED = 0;
var YT_PLAYING = 1;
function YouTubeSource({ source, initialPositionSeconds = 0, onProgress, onComplete, onError, autoPlay = false, imperativeRef }) {
	const containerRef = useRef8(null);
	const playerRef = useRef8(null);
	const tickerRef = useRef8(null);
	const mutedRef = useRef8(false);
	const { onTick, reset } = useWatchProgress(onProgress);
	useImperativeHandle2(imperativeRef, () => ({
		play: () => {
			playerRef.current?.playVideo();
		},
		pause: () => {
			playerRef.current?.pauseVideo();
		},
		seek: (seconds) => {
			playerRef.current?.seekTo(seconds, true);
		},
		requestFullscreen: () => {
			const iframe = containerRef.current?.querySelector("iframe");
			iframe?.requestFullscreen?.();
		},
		toggleMute: () => {
			if (!playerRef.current) return;
			if (mutedRef.current) {
				playerRef.current.unMute();
				mutedRef.current = false;
			} else {
				playerRef.current.mute();
				mutedRef.current = true;
			}
		},
	}));
	useEffect8(() => {
		if (!containerRef.current) return;
		reset();
		const player = YouTubePlayer(containerRef.current, {
			videoId: source.mediaId ?? extractYouTubeId(source.url),
			playerVars: {
				autoplay: autoPlay ? 1 : 0,
				start: initialPositionSeconds > 0 ? Math.floor(initialPositionSeconds) : void 0,
				rel: 0,
				modestbranding: 1,
			},
		});
		playerRef.current = player;
		player.on("stateChange", (event) => {
			if (event.data === YT_PLAYING) {
				if (tickerRef.current) clearInterval(tickerRef.current);
				tickerRef.current = setInterval(async () => {
					try {
						const currentTime = await player.getCurrentTime();
						onTick(currentTime);
					} catch {}
				}, 1e3);
			} else {
				if (tickerRef.current) {
					clearInterval(tickerRef.current);
					tickerRef.current = null;
				}
				if (event.data === YT_ENDED && onComplete) {
					onComplete();
				}
			}
		});
		player.on("error", (event) => {
			if (onError) onError(new Error(`YouTube player error code ${event.data}`));
		});
		return () => {
			if (tickerRef.current) clearInterval(tickerRef.current);
			player.destroy();
			playerRef.current = null;
		};
	}, [autoPlay, initialPositionSeconds, onComplete, onError, onTick, reset, source.mediaId, source.url]);
	return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		ref: containerRef,
		className: "w-full h-full [&>div]:w-full [&>div]:h-full [&_iframe]:w-full [&_iframe]:h-full",
	});
}
function extractYouTubeId(url) {
	const match = url.match(/[?&]v=([^&#]+)/) ?? url.match(/youtu\.be\/([^?&#]+)/);
	return match?.[1] ?? url;
}

// src/components/video-player/vimeo-source.tsx
const { useEffect: useEffect9, useImperativeHandle: useImperativeHandle3, useRef: useRef9 } = await importShared("react");
function VimeoSource({ source, initialPositionSeconds = 0, onProgress, onComplete, onError, autoPlay = false, imperativeRef }) {
	const containerRef = useRef9(null);
	const playerRef = useRef9(null);
	const { onTick, reset } = useWatchProgress(onProgress);
	useImperativeHandle3(imperativeRef, () => ({
		play: () => {
			playerRef.current?.play();
		},
		pause: () => {
			playerRef.current?.pause();
		},
		seek: (seconds) => {
			playerRef.current?.setCurrentTime(seconds);
		},
		requestFullscreen: () => {
			const iframe = containerRef.current?.querySelector("iframe");
			iframe?.requestFullscreen?.();
		},
		toggleMute: async () => {
			if (!playerRef.current) return;
			const volume = await playerRef.current.getVolume();
			await playerRef.current.setVolume(volume > 0 ? 0 : 1);
		},
	}));
	useEffect9(() => {
		if (!containerRef.current) return;
		reset();
		const videoId = source.mediaId ?? extractVimeoId(source.url);
		const player = new Player(containerRef.current, {
			id: videoId ? Number(videoId) : void 0,
			url: videoId ? void 0 : source.url,
			autoplay: autoPlay,
			responsive: true,
		});
		playerRef.current = player;
		if (initialPositionSeconds > 0) {
			player
				.ready()
				.then(() => {
					player.setCurrentTime(initialPositionSeconds).catch(() => {});
				})
				.catch(() => {});
		}
		player.on("timeupdate", (data) => {
			onTick(data.seconds);
		});
		player.on("ended", () => {
			if (onComplete) onComplete();
		});
		player.on("error", (err) => {
			if (onError) onError(err);
		});
		return () => {
			player.off("timeupdate");
			player.off("ended");
			player.off("error");
			player.destroy().catch(() => {});
			playerRef.current = null;
		};
	}, [autoPlay, initialPositionSeconds, onComplete, onError, onTick, reset, source.mediaId, source.url]);
	return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		ref: containerRef,
		className: "w-full h-full [&>div]:w-full [&>div]:h-full [&_iframe]:w-full [&_iframe]:h-full",
	});
}
function extractVimeoId(url) {
	const match = url.match(/vimeo\.com\/(?:video\/)?(\d+)/);
	return match?.[1] ?? null;
}
function LoomSource({ source, onError }) {
	const embedUrl = buildLoomEmbedUrl(source.url, source.mediaId);
	if (!embedUrl) {
		if (onError) onError(new Error("Could not determine Loom embed URL"));
		return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
			className: "w-full h-full flex items-center justify-center text-muted-foreground text-sm",
			children: t("videoPlayer.loomInvalidUrl", "Invalid Loom URL"),
		});
	}
	return /* @__PURE__ */ jsxRuntimeExports.jsx("iframe", {
		src: embedUrl,
		className: "w-full h-full border-0",
		allowFullScreen: true,
		allow: "fullscreen",
		title: t("videoPlayer.loomEmbedTitle", "Loom video"),
	});
}
function buildLoomEmbedUrl(url, mediaId) {
	const id = mediaId ?? extractLoomId(url);
	if (!id) return null;
	return `https://www.loom.com/embed/${id}`;
}
function extractLoomId(url) {
	const match = url.match(/loom\.com\/(?:share|embed)\/([a-zA-Z0-9]+)/);
	return match?.[1] ?? null;
}
var RESUME_INDICATOR_DURATION_MS = 3e3;
function formatSeconds(seconds) {
	const m = Math.floor(seconds / 60);
	const s = Math.floor(seconds % 60);
	return `${m}:${String(s).padStart(2, "0")}`;
}
var VideoPlayer = forwardRef17(function VideoPlayer2({ source, initialPositionSeconds = 0, durationSeconds, onProgress, onComplete, onError, poster, autoPlay = false, className }, ref) {
	const subRef = useRef10(null);
	const containerRef = useRef10(null);
	const [watchedSeconds, setWatchedSeconds] = useState12(0);
	const [showResume, setShowResume] = useState12(initialPositionSeconds > 0);
	useImperativeHandle4(ref, () => ({
		play: () => subRef.current?.play(),
		pause: () => subRef.current?.pause(),
		seek: (seconds) => subRef.current?.seek(seconds),
		requestFullscreen: () => subRef.current?.requestFullscreen(),
		toggleMute: () => subRef.current?.toggleMute(),
	}));
	useEffect10(() => {
		if (!showResume) return;
		const timer = setTimeout(() => setShowResume(false), RESUME_INDICATOR_DURATION_MS);
		return () => clearTimeout(timer);
	}, [showResume]);
	useEffect10(() => {
		setWatchedSeconds(0);
		setShowResume(initialPositionSeconds > 0);
	}, [source.url, source.mediaId, initialPositionSeconds]);
	const handleProgress = useCallback12(
		(positionSeconds, totalWatchedSeconds) => {
			setWatchedSeconds(totalWatchedSeconds);
			onProgress?.(positionSeconds, totalWatchedSeconds);
		},
		[onProgress],
	);
	const isPlayingRef = useRef10(autoPlay);
	const currentPositionRef = useRef10(initialPositionSeconds);
	const trackedOnProgress = useCallback12(
		(positionSeconds, totalWatchedSeconds) => {
			currentPositionRef.current = positionSeconds;
			handleProgress(positionSeconds, totalWatchedSeconds);
		},
		[handleProgress],
	);
	const seekByDelta = useCallback12((deltaSec) => {
		const player = subRef.current;
		if (!player) return;
		const next = Math.max(0, currentPositionRef.current + deltaSec);
		player.seek(next);
		currentPositionRef.current = next;
	}, []);
	const handleKeyDown = useCallback12(
		(e) => {
			const player = subRef.current;
			if (!player) return;
			switch (e.key) {
				case " ":
				case "Space":
					e.preventDefault();
					if (isPlayingRef.current) {
						player.pause();
						isPlayingRef.current = false;
					} else {
						player.play();
						isPlayingRef.current = true;
					}
					break;
				case "ArrowLeft":
					e.preventDefault();
					seekByDelta(-5);
					break;
				case "ArrowRight":
					e.preventDefault();
					seekByDelta(5);
					break;
				case "f":
				case "F":
					e.preventDefault();
					player.requestFullscreen();
					break;
				case "m":
				case "M":
					e.preventDefault();
					player.toggleMute();
					break;
			}
		},
		[seekByDelta],
	);
	const progressPercent = durationSeconds && durationSeconds > 0 ? Math.min(100, (watchedSeconds / durationSeconds) * 100) : 0;
	const showProgressBar = durationSeconds != null && durationSeconds > 0;
	return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
		"ref": containerRef,
		"role": "region",
		"aria-label": t("videoPlayer.ariaLabel", "Video player"),
		"tabIndex": 0,
		"onKeyDown": handleKeyDown,
		"className": ["relative w-full overflow-hidden bg-black outline-none focus-visible:ring-2 focus-visible:ring-ring", className ?? ""].join(" ").trim(),
		"children": [
			source.platform === "html5" &&
				/* @__PURE__ */ jsxRuntimeExports.jsx(Html5Source, {
					source,
					initialPositionSeconds,
					onProgress: trackedOnProgress,
					onComplete,
					onError,
					poster,
					autoPlay,
					imperativeRef: subRef,
				}),
			source.platform === "youtube" &&
				/* @__PURE__ */ jsxRuntimeExports.jsx(YouTubeSource, {
					source,
					initialPositionSeconds,
					onProgress: trackedOnProgress,
					onComplete,
					onError,
					autoPlay,
					imperativeRef: subRef,
				}),
			source.platform === "vimeo" &&
				/* @__PURE__ */ jsxRuntimeExports.jsx(VimeoSource, {
					source,
					initialPositionSeconds,
					onProgress: trackedOnProgress,
					onComplete,
					onError,
					autoPlay,
					imperativeRef: subRef,
				}),
			source.platform === "loom" && /* @__PURE__ */ jsxRuntimeExports.jsx(LoomSource, { source, onError }),
			showResume &&
				initialPositionSeconds > 0 &&
				/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
					"role": "status",
					"aria-live": "polite",
					"className": "absolute top-3 left-3 rounded bg-black/70 px-3 py-1.5 text-xs text-white pointer-events-none",
					"children": t("videoPlayer.resumeFrom", "Resume from {{time}}", {
						time: formatSeconds(initialPositionSeconds),
					}),
				}),
			showProgressBar &&
				/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
					"role": "progressbar",
					"aria-label": t("videoPlayer.progressLabel", "Watch progress"),
					"aria-valuenow": Math.round(progressPercent),
					"aria-valuemin": 0,
					"aria-valuemax": 100,
					"className": "absolute bottom-0 left-0 w-full h-1 bg-white/20",
					"children": /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
						className: "h-full bg-primary transition-all duration-500",
						style: { width: `${progressPercent}%` },
					}),
				}),
		],
	});
});
VideoPlayer.displayName = "VideoPlayer";

// src/components/pickers/user-picker.tsx
const React31 = await importShared("react");
function getInitials(user) {
	const first = user.firstName?.trim();
	const last = user.lastName?.trim();
	if (first && last) return `${first[0]}${last[0]}`.toUpperCase();
	if (first) return first.slice(0, 2).toUpperCase();
	const emailPart = user.email.split("@")[0] ?? "";
	return emailPart.slice(0, 2).toUpperCase();
}
function getDisplayName(user) {
	const parts = [user.firstName?.trim(), user.lastName?.trim()].filter(Boolean);
	return parts.length > 0 ? parts.join(" ") : user.email;
}
function UserAvatar({ user, size = 6 }) {
	const initials = getInitials(user);
	const sizeClass = `h-${size} w-${size}`;
	return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
		"aria-hidden": "true",
		"className": cn("inline-flex shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground text-[10px] font-medium select-none", sizeClass),
		"children": initials,
	});
}
function toProtoRole(roleFilter) {
	if (roleFilter === "admin") return Role.ADMIN;
	if (roleFilter === "public") return Role.VIEWER;
	return void 0;
}
function Dropdown({ isOpen, children }) {
	if (!isOpen) return null;
	return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		"role": "listbox",
		"aria-multiselectable": true,
		"className": cn(
			"absolute z-50 mt-1 w-full rounded-md border bg-popover text-popover-foreground shadow-md",
			"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
		),
		children,
	});
}
var DEBOUNCE_MS = 300;
var PAGE_SIZE2 = 25;
function UserPicker(props) {
	const { transport, roleFilter = "all", excludeIds = [], placeholder, disabled = false, className } = props;
	const selectedIds =
		props.multi ? (props.value ?? [])
		: props.value ? [props.value]
		: [];
	const [open, setOpen] = React31.useState(false);
	const [searchInput, setSearchInput] = React31.useState("");
	const [debouncedSearch, setDebouncedSearch] = React31.useState("");
	const [users, setUsers] = React31.useState([]);
	const [loading, setLoading] = React31.useState(false);
	const [hasMore, setHasMore] = React31.useState(false);
	const [page, setPage] = React31.useState(1);
	const debounceRef = React31.useRef(null);
	const containerRef = React31.useRef(null);
	const searchRef = React31.useRef(null);
	const client = React31.useMemo(() => createClient(AdminService, transport), [transport]);
	const handleSearchChange = (value) => {
		setSearchInput(value);
		if (debounceRef.current) clearTimeout(debounceRef.current);
		debounceRef.current = setTimeout(() => {
			setDebouncedSearch(value);
			setPage(1);
			setUsers([]);
		}, DEBOUNCE_MS);
	};
	React31.useEffect(() => {
		if (!open) return;
		let cancelled = false;
		const fetchUsers = async () => {
			setLoading(true);
			try {
				const protoRole = toProtoRole(roleFilter);
				const response = await client.listAdminUsers({
					search: debouncedSearch || void 0,
					roleFilter: protoRole,
					isActiveFilter: true,
					pagination: { page, pageSize: PAGE_SIZE2 },
				});
				if (cancelled) return;
				const fetched = (response.users ?? []).filter((u) => !excludeIds.includes(u.id));
				setUsers((prev) => {
					const nextUsers = page === 1 ? fetched : [...prev, ...fetched];
					const paginationTotal = response.pagination?.total ?? 0;
					setHasMore(nextUsers.length < paginationTotal && fetched.length === PAGE_SIZE2);
					return nextUsers;
				});
			} catch {
			} finally {
				if (!cancelled) setLoading(false);
			}
		};
		void fetchUsers();
		return () => {
			cancelled = true;
		};
	}, [client, debouncedSearch, excludeIds, open, page, roleFilter]);
	React31.useEffect(() => {
		if (open) {
			setTimeout(() => searchRef.current?.focus(), 50);
		} else {
			setSearchInput("");
			setDebouncedSearch("");
			setPage(1);
			setUsers([]);
		}
	}, [open]);
	React31.useEffect(() => {
		if (!open) return;
		const handleOutside = (e) => {
			if (containerRef.current && !containerRef.current.contains(e.target)) {
				setOpen(false);
			}
		};
		document.addEventListener("mousedown", handleOutside);
		return () => document.removeEventListener("mousedown", handleOutside);
	}, [open]);
	const handleKeyDown = (e) => {
		if (e.key === "Escape") {
			setOpen(false);
		}
	};
	const toggleUser = (user) => {
		if (props.multi) {
			const ids = selectedIds.includes(user.id) ? selectedIds.filter((id) => id !== user.id) : [...selectedIds, user.id];
			props.onChange(ids.length > 0 ? ids : void 0);
		} else {
			const newId = selectedIds.includes(user.id) ? void 0 : user.id;
			props.onChange(newId);
			setOpen(false);
		}
	};
	const removeSelected = (id, e) => {
		e.stopPropagation();
		if (props.multi) {
			const ids = selectedIds.filter((sid) => sid !== id);
			props.onChange(ids.length > 0 ? ids : void 0);
		} else {
			props.onChange(void 0);
		}
	};
	const clearAll = (e) => {
		e.stopPropagation();
		if (props.multi) {
			props.onChange(void 0);
		} else {
			props.onChange(void 0);
		}
	};
	const selectedUsers = selectedIds.map((id) => users.find((u) => u.id === id)).filter((u) => u !== void 0);
	const defaultPlaceholder = props.multi ? t("userPicker.placeholderMulti", "Select users") : t("userPicker.placeholder", "Select a user");
	const triggerLabel = placeholder ?? defaultPlaceholder;
	return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
		ref: containerRef,
		className: cn("relative w-full", className),
		onKeyDown: handleKeyDown,
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsxs("button", {
				"type": "button",
				"role": "combobox",
				"aria-haspopup": "listbox",
				"aria-expanded": open,
				"aria-autocomplete": "list",
				disabled,
				"onClick": () => setOpen((v) => !v),
				"className": cn(
					"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm",
					"focus:outline-none focus:ring-1 focus:ring-ring",
					"disabled:cursor-not-allowed disabled:opacity-50",
					!selectedIds.length && "text-muted-foreground",
				),
				"children": [
					selectedIds.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: triggerLabel })
					: props.multi ?
						/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
							className: "flex items-center gap-1 flex-wrap min-w-0 flex-1 overflow-hidden",
							children: [
								/* @__PURE__ */ jsxRuntimeExports.jsx(Users, { "className": "h-4 w-4 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
								selectedUsers.length > 0 ?
									selectedUsers.length <= 2 ?
										selectedUsers.map((u) =>
											/* @__PURE__ */ jsxRuntimeExports.jsxs(
												Badge,
												{
													variant: "secondary",
													className: "text-xs gap-1 pr-1",
													children: [
														getDisplayName(u),
														/* @__PURE__ */ jsxRuntimeExports.jsx("button", {
															"type": "button",
															"aria-label": t("userPicker.removeUser", "Remove {{name}}", {
																name: getDisplayName(u),
															}),
															"onClick": (e) => removeSelected(u.id, e),
															"className": "rounded-full hover:bg-muted-foreground/20 focus:outline-none focus:ring-1 focus:ring-ring",
															"children": /* @__PURE__ */ jsxRuntimeExports.jsx(X, { "className": "h-2.5 w-2.5", "aria-hidden": "true" }),
														}),
													],
												},
												u.id,
											),
										)
									:	/* @__PURE__ */ jsxRuntimeExports.jsx(Badge, {
											variant: "secondary",
											className: "text-xs",
											children: t("userPicker.selectedCount", "{{count}} selected", {
												count: selectedUsers.length,
											}),
										})
								:	/* @__PURE__ */ jsxRuntimeExports.jsx(Badge, {
										variant: "secondary",
										className: "text-xs",
										children: t("userPicker.selectedCount", "{{count}} selected", {
											count: selectedIds.length,
										}),
									}),
							],
						})
					: selectedUsers[0] ?
						/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
							className: "flex items-center gap-2 min-w-0 flex-1",
							children: [
								/* @__PURE__ */ jsxRuntimeExports.jsx(UserAvatar, { user: selectedUsers[0], size: 5 }),
								/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate", children: getDisplayName(selectedUsers[0]) }),
								/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-1 truncate text-muted-foreground text-xs", children: selectedUsers[0].email }),
							],
						})
					:	/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground text-xs truncate", children: t("userPicker.idSelected", "User selected") }),
					/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
						className: "flex items-center gap-1 shrink-0 ml-2",
						children: [
							selectedIds.length > 0 &&
								/* @__PURE__ */ jsxRuntimeExports.jsx("button", {
									"type": "button",
									"aria-label": t("userPicker.clearAll", "Clear selection"),
									"onClick": clearAll,
									"className": "rounded-full p-0.5 hover:bg-muted focus:outline-none focus:ring-1 focus:ring-ring",
									"children": /* @__PURE__ */ jsxRuntimeExports.jsx(X, { "className": "h-3.5 w-3.5 opacity-50", "aria-hidden": "true" }),
								}),
							/* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, {
								"className": cn("h-4 w-4 opacity-50 transition-transform duration-150", open && "rotate-180"),
								"aria-hidden": "true",
							}),
						],
					}),
				],
			}),
			/* @__PURE__ */ jsxRuntimeExports.jsxs(Dropdown, {
				isOpen: open,
				children: [
					/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
						className: "flex items-center border-b px-3 py-2 gap-2",
						children: [
							/* @__PURE__ */ jsxRuntimeExports.jsx(Search, { "className": "h-4 w-4 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
							/* @__PURE__ */ jsxRuntimeExports.jsx(Input, {
								"ref": searchRef,
								"value": searchInput,
								"onChange": (e) => handleSearchChange(e.target.value),
								"placeholder": t("userPicker.searchPlaceholder", "Search users..."),
								"className": "h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0 text-sm",
								"aria-label": t("userPicker.searchLabel", "Search users"),
								"aria-autocomplete": "list",
								"aria-controls": "user-picker-list",
							}),
							loading &&
								/* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, {
									"className": "h-4 w-4 shrink-0 text-muted-foreground animate-spin",
									"aria-label": t("userPicker.loading", "Loading users"),
								}),
						],
					}),
					/* @__PURE__ */ jsxRuntimeExports.jsxs(ScrollArea, {
						className: "max-h-[240px]",
						id: "user-picker-list",
						children: [
							!loading && users.length === 0 ?
								/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
									className: "px-3 py-6 text-center text-sm text-muted-foreground",
									children: t("userPicker.noResults", "No users found"),
								})
							:	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
									className: "p-1",
									role: "group",
									children: users.map((user) => {
										const selected = selectedIds.includes(user.id);
										const displayName = getDisplayName(user);
										return /* @__PURE__ */ jsxRuntimeExports.jsxs(
											"button",
											{
												"type": "button",
												"role": "option",
												"aria-selected": selected,
												"onClick": () => toggleUser(user),
												"className": cn(
													"flex w-full items-center gap-3 rounded-sm px-2 py-1.5 text-sm outline-none",
													"cursor-pointer select-none",
													"hover:bg-accent hover:text-accent-foreground",
													"focus:bg-accent focus:text-accent-foreground focus:outline-none",
													selected && "bg-accent/50",
												),
												"children": [
													/* @__PURE__ */ jsxRuntimeExports.jsx(UserAvatar, { user, size: 6 }),
													/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
														className: "flex-1 min-w-0 text-left",
														children: [
															/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "truncate font-medium", children: displayName }),
															/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "truncate text-xs text-muted-foreground", children: user.email }),
														],
													}),
													selected &&
														/* @__PURE__ */ jsxRuntimeExports.jsx(Check, {
															"className": "h-4 w-4 shrink-0 text-primary",
															"aria-hidden": "true",
														}),
												],
											},
											user.id,
										);
									}),
								}),
							hasMore &&
								!loading &&
								/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
									className: "px-3 py-2 border-t",
									children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
										type: "button",
										variant: "ghost",
										size: "sm",
										className: "w-full text-xs",
										onClick: () => setPage((p) => p + 1),
										children: t("userPicker.loadMore", "Load more"),
									}),
								}),
							loading &&
								users.length > 0 &&
								/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
									className: "flex items-center justify-center px-3 py-2 border-t",
									children: /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, {
										"className": "h-4 w-4 animate-spin text-muted-foreground",
										"aria-hidden": "true",
									}),
								}),
						],
					}),
				],
			}),
		],
	});
}

// src/components/pickers/author-picker.tsx
const React33 = await importShared("react");

// src/components/pickers/author-editor-dialog.tsx
const React32 = await importShared("react");
var initialFormState = {
	displayName: "",
	bio: "",
	avatarUrl: void 0,
	linkedUserId: void 0,
	isGuest: false,
};
function AuthorEditorDialog({ open, onOpenChange, transport, onAuthorCreated }) {
	const [form, setForm] = React32.useState(initialFormState);
	const [saving, setSaving] = React32.useState(false);
	const [error, setError] = React32.useState(null);
	const client = React32.useMemo(() => createClient(AuthorsService, transport), [transport]);
	React32.useEffect(() => {
		if (open) {
			setForm(initialFormState);
			setError(null);
			setSaving(false);
		}
	}, [open]);
	const updateField = (key, value) => {
		setForm((prev) => ({ ...prev, [key]: value }));
	};
	const handleIsGuestChange = (checked) => {
		setForm((prev) => ({
			...prev,
			isGuest: checked,
			linkedUserId: checked ? void 0 : prev.linkedUserId,
		}));
	};
	const handleSave = async () => {
		setError(null);
		if (!form.displayName.trim()) {
			setError(t("authorEditorDialog.nameRequired", "Display name is required."));
			return;
		}
		setSaving(true);
		try {
			const response = await client.createAuthorProfile({
				displayName: form.displayName.trim(),
				bio: form.bio.trim(),
				avatarUrl: form.avatarUrl ?? "",
				adminUserId: form.isGuest ? "" : (form.linkedUserId ?? ""),
			});
			const newId = response.author?.id;
			if (!newId) {
				throw new Error(t("authorEditorDialog.unexpectedResponse", "Unexpected response from server."));
			}
			onAuthorCreated(newId);
			onOpenChange(false);
		} catch (err) {
			const msg = err instanceof Error ? err.message.replace(/^\[[\w_]+\]\s*/, "") : t("authorEditorDialog.saveFailed", "Failed to create author.");
			setError(msg);
		} finally {
			setSaving(false);
		}
	};
	const handleCancel = () => {
		if (!saving) {
			onOpenChange(false);
		}
	};
	const handleKeyDown = (e) => {
		if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
			void handleSave();
		}
	};
	return /* @__PURE__ */ jsxRuntimeExports.jsx(Dialog, {
		open,
		onOpenChange,
		children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogContent, {
			"className": "sm:max-w-[480px]",
			"onKeyDown": handleKeyDown,
			"aria-describedby": "author-editor-description",
			"children": [
				/* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, {
					children: [
						/* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: t("authorEditorDialog.title", "Create new author") }),
						/* @__PURE__ */ jsxRuntimeExports.jsx(DialogDescription, {
							id: "author-editor-description",
							children: t("authorEditorDialog.description", "Fill in the author details. Link to an existing user or create a guest author."),
						}),
					],
				}),
				/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
					className: "grid gap-4 py-2",
					children: [
						/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
							className: "grid gap-1.5",
							children: [
								/* @__PURE__ */ jsxRuntimeExports.jsxs(Label, {
									htmlFor: "author-display-name",
									children: [
										t("authorEditorDialog.nameLabel", "Display name"),
										/* @__PURE__ */ jsxRuntimeExports.jsx("span", { "className": "text-destructive ml-1", "aria-hidden": "true", "children": "*" }),
									],
								}),
								/* @__PURE__ */ jsxRuntimeExports.jsx(Input, {
									"id": "author-display-name",
									"value": form.displayName,
									"onChange": (e) => updateField("displayName", e.target.value),
									"placeholder": t("authorEditorDialog.namePlaceholder", "e.g. Jane Smith"),
									"disabled": saving,
									"autoFocus": true,
									"aria-required": "true",
								}),
							],
						}),
						/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
							className: "grid gap-1.5",
							children: [
								/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "author-bio", children: t("authorEditorDialog.bioLabel", "Bio") }),
								/* @__PURE__ */ jsxRuntimeExports.jsx(Textarea, {
									id: "author-bio",
									value: form.bio,
									onChange: (e) => updateField("bio", e.target.value),
									placeholder: t("authorEditorDialog.bioPlaceholder", "Short biography..."),
									rows: 3,
									disabled: saving,
									className: "resize-none",
								}),
							],
						}),
						/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
							className: "grid gap-1.5",
							children: [
								/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { children: t("authorEditorDialog.avatarLabel", "Avatar") }),
								/* @__PURE__ */ jsxRuntimeExports.jsx(MediaPickerButton, {
									value: form.avatarUrl,
									onChange: (v) => updateField("avatarUrl", v ?? void 0),
									placeholder: t("authorEditorDialog.avatarPlaceholder", "Select avatar image"),
									allowedTypes: ["image"],
									previewClassName: "aspect-square max-w-[80px]",
								}),
							],
						}),
						/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
							className: "flex items-center gap-3",
							children: [
								/* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, {
									id: "author-is-guest",
									checked: form.isGuest,
									onCheckedChange: (checked) => handleIsGuestChange(checked === true),
									disabled: saving,
								}),
								/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
									className: "grid gap-0.5",
									children: [
										/* @__PURE__ */ jsxRuntimeExports.jsx(Label, {
											htmlFor: "author-is-guest",
											className: "cursor-pointer",
											children: t("authorEditorDialog.isGuestLabel", "Guest author"),
										}),
										/* @__PURE__ */ jsxRuntimeExports.jsx("p", {
											className: "text-xs text-muted-foreground",
											children: t("authorEditorDialog.isGuestHelp", "Guest authors are not linked to a user account."),
										}),
									],
								}),
							],
						}),
						!form.isGuest &&
							/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "author-linked-user", children: t("authorEditorDialog.linkedUserLabel", "Linked user") }),
									/* @__PURE__ */ jsxRuntimeExports.jsx(UserPicker, {
										value: form.linkedUserId,
										onChange: (v) => updateField("linkedUserId", v),
										transport,
										roleFilter: "all",
										placeholder: t("authorEditorDialog.linkedUserPlaceholder", "Link to an existing user (optional)"),
										disabled: saving,
									}),
									/* @__PURE__ */ jsxRuntimeExports.jsx("p", {
										id: "author-linked-user-help",
										className: "text-xs text-muted-foreground",
										children: t("authorEditorDialog.linkedUserHelp", "Linking a user allows them to manage their author profile."),
									}),
								],
							}),
						error &&
							/* @__PURE__ */ jsxRuntimeExports.jsx("p", {
								role: "alert",
								className: cn("text-sm text-destructive"),
								children: error,
							}),
					],
				}),
				/* @__PURE__ */ jsxRuntimeExports.jsxs(DialogFooter, {
					children: [
						/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
							type: "button",
							variant: "outline",
							onClick: handleCancel,
							disabled: saving,
							children: t("common.cancel", "Cancel"),
						}),
						/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
							type: "button",
							onClick: () => void handleSave(),
							disabled: saving || !form.displayName.trim(),
							children:
								saving ?
									/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
										children: [
											/* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, {
												"className": "mr-2 h-4 w-4 animate-spin",
												"aria-hidden": "true",
											}),
											t("common.saving", "Saving..."),
										],
									})
								:	t("authorEditorDialog.saveButton", "Create author"),
						}),
					],
				}),
			],
		}),
	});
}
function getAuthorInitials(displayName) {
	return displayName
		.split(" ")
		.map((n) => n[0])
		.join("")
		.toUpperCase()
		.slice(0, 2);
}
function AuthorAvatar({ author, size = 6 }) {
	const initials = getAuthorInitials(author.displayName);
	const sizeClass = `h-${size} w-${size}`;
	if (author.avatarUrl) {
		return /* @__PURE__ */ jsxRuntimeExports.jsx("img", {
			"src": author.avatarUrl,
			"alt": "",
			"aria-hidden": "true",
			"className": cn("inline-block shrink-0 rounded-full object-cover", sizeClass),
		});
	}
	return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
		"aria-hidden": "true",
		"className": cn("inline-flex shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground text-[10px] font-medium select-none", sizeClass),
		"children": initials,
	});
}
function Dropdown2({ isOpen, children }) {
	if (!isOpen) return null;
	return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
		role: "listbox",
		className: cn("absolute z-50 mt-1 w-full rounded-md border bg-popover text-popover-foreground shadow-md"),
		children,
	});
}
function AuthorPicker({ value, onChange, transport, allowCreate = true, placeholder, disabled = false, className }) {
	const [open, setOpen] = React33.useState(false);
	const [searchInput, setSearchInput] = React33.useState("");
	const [authors, setAuthors] = React33.useState([]);
	const [loading, setLoading] = React33.useState(false);
	const [createDialogOpen, setCreateDialogOpen] = React33.useState(false);
	const containerRef = React33.useRef(null);
	const searchRef = React33.useRef(null);
	const client = React33.useMemo(() => createClient(AuthorsService, transport), [transport]);
	React33.useEffect(() => {
		if (!open) return;
		let cancelled = false;
		const fetchAuthors = async () => {
			setLoading(true);
			try {
				const response = await client.listAuthorProfiles({
					includePostCount: true,
				});
				if (cancelled) return;
				setAuthors(response.authors ?? []);
			} catch {
			} finally {
				if (!cancelled) setLoading(false);
			}
		};
		void fetchAuthors();
		return () => {
			cancelled = true;
		};
	}, [open, client]);
	React33.useEffect(() => {
		if (open) {
			setTimeout(() => searchRef.current?.focus(), 50);
		} else {
			setSearchInput("");
		}
	}, [open]);
	React33.useEffect(() => {
		if (!open) return;
		const handleOutside = (e) => {
			if (containerRef.current && !containerRef.current.contains(e.target)) {
				setOpen(false);
			}
		};
		document.addEventListener("mousedown", handleOutside);
		return () => document.removeEventListener("mousedown", handleOutside);
	}, [open]);
	const handleKeyDown = (e) => {
		if (e.key === "Escape") {
			setOpen(false);
		}
	};
	const filteredAuthors = React33.useMemo(() => {
		if (!searchInput.trim()) return authors;
		const q = searchInput.toLowerCase();
		return authors.filter((a) => a.displayName.toLowerCase().includes(q) || a.email.toLowerCase().includes(q));
	}, [authors, searchInput]);
	const selectedAuthor = authors.find((a) => a.id === value);
	const selectAuthor = (author) => {
		const newId = value === author.id ? void 0 : author.id;
		onChange(newId);
		setOpen(false);
	};
	const clearSelection = (e) => {
		e.stopPropagation();
		onChange(void 0);
	};
	const handleAuthorCreated = (newAuthorId) => {
		onChange(newAuthorId);
		client
			.listAuthorProfiles({ includePostCount: true })
			.then((r) => {
				setAuthors(r.authors ?? []);
			})
			.catch(() => {});
	};
	const triggerLabel = placeholder ?? t("authorPicker.placeholder", "Select an author");
	return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
		children: [
			/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
				ref: containerRef,
				className: cn("relative w-full", className),
				onKeyDown: handleKeyDown,
				children: [
					/* @__PURE__ */ jsxRuntimeExports.jsxs("button", {
						"type": "button",
						"role": "combobox",
						"aria-haspopup": "listbox",
						"aria-expanded": open,
						"aria-autocomplete": "list",
						disabled,
						"onClick": () => setOpen((v) => !v),
						"className": cn(
							"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm",
							"focus:outline-none focus:ring-1 focus:ring-ring",
							"disabled:cursor-not-allowed disabled:opacity-50",
							!value && "text-muted-foreground",
						),
						"children": [
							selectedAuthor ?
								/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
									className: "flex items-center gap-2 min-w-0 flex-1",
									children: [
										/* @__PURE__ */ jsxRuntimeExports.jsx(AuthorAvatar, { author: selectedAuthor, size: 5 }),
										/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate", children: selectedAuthor.displayName }),
										selectedAuthor.isGuest &&
											/* @__PURE__ */ jsxRuntimeExports.jsx(Badge, {
												variant: "outline",
												className: "text-xs font-normal shrink-0",
												children: t("authorPicker.guestLabel", "Guest"),
											}),
									],
								})
							: value ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground text-xs truncate", children: t("authorPicker.idSelected", "Author selected") })
							: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: triggerLabel }),
							/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
								className: "flex items-center gap-1 shrink-0 ml-2",
								children: [
									value &&
										/* @__PURE__ */ jsxRuntimeExports.jsx("button", {
											"type": "button",
											"aria-label": t("authorPicker.clearSelection", "Clear selection"),
											"onClick": clearSelection,
											"className": "rounded-full p-0.5 hover:bg-muted focus:outline-none focus:ring-1 focus:ring-ring",
											"children": /* @__PURE__ */ jsxRuntimeExports.jsx(X, { "className": "h-3.5 w-3.5 opacity-50", "aria-hidden": "true" }),
										}),
									/* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, {
										"className": cn("h-4 w-4 opacity-50 transition-transform duration-150", open && "rotate-180"),
										"aria-hidden": "true",
									}),
								],
							}),
						],
					}),
					/* @__PURE__ */ jsxRuntimeExports.jsxs(Dropdown2, {
						isOpen: open,
						children: [
							/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
								className: "flex items-center border-b px-3 py-2 gap-2",
								children: [
									/* @__PURE__ */ jsxRuntimeExports.jsx(Search, {
										"className": "h-4 w-4 shrink-0 text-muted-foreground",
										"aria-hidden": "true",
									}),
									/* @__PURE__ */ jsxRuntimeExports.jsx(Input, {
										"ref": searchRef,
										"value": searchInput,
										"onChange": (e) => setSearchInput(e.target.value),
										"placeholder": t("authorPicker.searchPlaceholder", "Search authors..."),
										"className": "h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0 text-sm",
										"aria-label": t("authorPicker.searchLabel", "Search authors"),
										"aria-autocomplete": "list",
										"aria-controls": "author-picker-list",
									}),
									loading &&
										/* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, {
											"className": "h-4 w-4 shrink-0 text-muted-foreground animate-spin",
											"aria-label": t("authorPicker.loading", "Loading authors"),
										}),
								],
							}),
							/* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, {
								className: "max-h-[240px]",
								id: "author-picker-list",
								children:
									!loading && filteredAuthors.length === 0 ?
										/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
											className: "px-3 py-6 text-center text-sm text-muted-foreground",
											children: t("authorPicker.noResults", "No authors found"),
										})
									:	/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
											className: "p-1",
											role: "group",
											children: filteredAuthors.map((author) => {
												const selected = author.id === value;
												return /* @__PURE__ */ jsxRuntimeExports.jsxs(
													"button",
													{
														"type": "button",
														"role": "option",
														"aria-selected": selected,
														"onClick": () => selectAuthor(author),
														"className": cn(
															"flex w-full items-center gap-3 rounded-sm px-2 py-1.5 text-sm outline-none",
															"cursor-pointer select-none",
															"hover:bg-accent hover:text-accent-foreground",
															"focus:bg-accent focus:text-accent-foreground focus:outline-none",
															selected && "bg-accent/50",
														),
														"children": [
															/* @__PURE__ */ jsxRuntimeExports.jsx(AuthorAvatar, { author, size: 6 }),
															/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
																className: "flex-1 min-w-0 text-left",
																children: [
																	/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
																		className: "flex items-center gap-2",
																		children: [
																			/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-medium", children: author.displayName }),
																			author.isGuest &&
																				/* @__PURE__ */ jsxRuntimeExports.jsx(Badge, {
																					variant: "outline",
																					className: "text-xs font-normal shrink-0",
																					children: t("authorPicker.guestLabel", "Guest"),
																				}),
																		],
																	}),
																	author.email &&
																		/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "truncate text-xs text-muted-foreground", children: author.email }),
																],
															}),
															/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
																className: "flex items-center gap-2 shrink-0",
																children: [
																	author.postCount > 0 &&
																		/* @__PURE__ */ jsxRuntimeExports.jsx(Badge, {
																			variant: "secondary",
																			className: "text-xs font-normal",
																			children: t("authorPicker.postCount", "{{count}} posts", {
																				count: author.postCount,
																			}),
																		}),
																	selected &&
																		/* @__PURE__ */ jsxRuntimeExports.jsx(Check, {
																			"className": "h-4 w-4 text-primary",
																			"aria-hidden": "true",
																		}),
																],
															}),
														],
													},
													author.id,
												);
											}),
										}),
							}),
							allowCreate &&
								/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
									className: "border-t p-1",
									children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", {
										type: "button",
										onClick: () => {
											setOpen(false);
											setCreateDialogOpen(true);
										},
										className: cn(
											"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-muted-foreground",
											"cursor-pointer select-none",
											"hover:bg-accent hover:text-accent-foreground",
											"focus:bg-accent focus:text-accent-foreground focus:outline-none",
										),
										children: [
											/* @__PURE__ */ jsxRuntimeExports.jsx(Plus, { "className": "h-4 w-4 shrink-0", "aria-hidden": "true" }),
											/* @__PURE__ */ jsxRuntimeExports.jsx(CircleUserRound, { "className": "h-4 w-4 shrink-0", "aria-hidden": "true" }),
											t("authorPicker.createNew", "+ Create new author"),
										],
									}),
								}),
						],
					}),
				],
			}),
			allowCreate &&
				/* @__PURE__ */ jsxRuntimeExports.jsx(AuthorEditorDialog, {
					open: createDialogOpen,
					onOpenChange: setCreateDialogOpen,
					transport,
					onAuthorCreated: handleAuthorCreated,
				}),
		],
	});
}

export {
	Alert,
	CircleAlert as AlertCircle,
	AlertDescription,
	AlertDialog,
	AlertDialogAction,
	AlertDialogCancel,
	AlertDialogContent,
	AlertDialogDescription,
	AlertDialogFooter,
	AlertDialogHeader,
	AlertDialogOverlay,
	AlertDialogPortal,
	AlertDialogProvider,
	AlertDialogTitle,
	AlertDialogTrigger,
	AlertTitle,
	TriangleAlert as AlertTriangle,
	AuthorEditorDialog,
	AuthorPicker,
	Badge,
	BlockNoteEditor,
	Button,
	CERTIFICATE_PLACEHOLDERS,
	Card,
	CardContent,
	CardDescription,
	CardFooter,
	CardHeader,
	CardTitle,
	Check,
	CircleCheckBig as CheckCircle,
	CircleCheck as CheckCircle2,
	Checkbox,
	ChevronDown,
	ChevronLeft,
	ChevronRight,
	ChevronUp,
	Code$1 as Code,
	Copy,
	DataTable,
	DataTableBulkActions,
	DataTableColumnHeader,
	DataTablePagination,
	DataTableToolbar,
	Dialog,
	DialogClose,
	DialogContent,
	DialogDescription,
	DialogFooter,
	DialogHeader,
	DialogOverlay,
	DialogPortal,
	DialogTitle,
	DialogTrigger,
	Download,
	PenLine as Edit3,
	ExternalLink,
	Eye,
	EyeOff,
	File$1 as File,
	Filter,
	Folder,
	History,
	Image,
	Info,
	Input,
	Key,
	Label,
	LoaderCircle as Loader2,
	MarkdownDisplay,
	MarkdownEditor,
	MediaLibraryDialog,
	MediaPickerButton,
	MediaPickerContext,
	MediaPickerProvider,
	MediaUploadArea,
	Menu,
	Minus,
	Monaco,
	MonacoHtmlEditor,
	Ellipsis as MoreHorizontal,
	EllipsisVertical as MoreVertical,
	PAGE_SIZE_OPTIONS,
	Plus,
	default2 as React,
	RefreshCw,
	ScrollArea,
	ScrollBar,
	Search,
	Select,
	SelectContent,
	SelectGroup,
	SelectItem,
	SelectLabel,
	SelectSeparator,
	SelectTrigger,
	SelectValue,
	Send,
	Separator,
	Settings,
	Sheet,
	SheetBody,
	SheetClose,
	SheetContent,
	SheetDescription,
	SheetFooter,
	SheetHeader,
	SheetOverlay,
	SheetPortal,
	SheetTitle,
	SheetTrigger,
	Sparkles,
	Switch,
	Table,
	TableBody,
	TableCaption,
	TableCell,
	TableFooter,
	TableHead,
	TableHeader,
	TableRow,
	Tabs,
	TabsContent,
	TabsList,
	TabsTrigger,
	Textarea,
	Toaster,
	Trash2,
	TypedConfirmDialog,
	Upload,
	UserPicker,
	VideoPlayer,
	WandSparkles as Wand2,
	X,
	CircleX as XCircle,
	Zap,
	badgeVariants,
	buttonVariants,
	initI18n,
	registerPlaceholderCompletion,
	t,
	toast,
	useAIAssist,
	useAIGenerate,
	useAlertDialog,
	useDataTable,
	useMediaPicker,
	useRealtimePublish,
	useRealtimeStatus,
	useRealtimeTopic,
	useTranslation,
};
