require("./TableView.css");
var $6e265ff388155b91$exports = require("./ActionButton.cjs");
var $e1016b8947dbadb8$exports = require("./ButtonGroup.cjs");
var $af04e099a53d3e85$exports = require("./Checkbox.cjs");
var $c3e72d94a25defe0$exports = require("../icons/Checkmark.cjs");
var $1df9f1c9262ce5df$exports = require("./Chevron.cjs");
var $8ecd53081d7d50cc$exports = require("../icons/Close.cjs");
var $a05aa0b0345f1846$exports = require("./CustomDialog.cjs");
var $fc196655d58ce18c$exports = require("./DialogContainer.cjs");
var $bde97c91243ed164$exports = require("../icons/Icon.cjs");
var $4526404114e78c80$exports = require("./intlStrings.cjs");
var $e741ea6b88ce4866$exports = require("./Menu.cjs");
var $23350f45c699333e$exports = require("./S2_MoveHorizontalTableWidget.cjs");
var $1c116ea4b0d2d023$exports = require("./ProgressCircle.cjs");
var $22bf2407c3628a21$exports = require("../icons/SortDown.cjs");
var $2197830b90e71c31$exports = require("../icons/SortUp.cjs");
var $25d06cf8d4e72761$exports = require("./Button.cjs");
var $85bf454149fe9ddc$exports = require("./ActionBar.cjs");
var $ee7b4c497f520c08$exports = require("./utils.cjs");
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
var $iLVc8$reactjsxruntime = require("react/jsx-runtime");
var $iLVc8$reactariacomponents = require("react-aria-components");
var $iLVc8$reactariautils = require("@react-aria/utils");
var $iLVc8$react = require("react");
var $iLVc8$reactspectrumutils = require("@react-spectrum/utils");
var $iLVc8$reactariai18n = require("@react-aria/i18n");
var $iLVc8$reactaria = require("react-aria");


function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}

function $parcel$export(e, n, v, s) {
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}

$parcel$export(module.exports, "TableContext", () => $bed37377ec7a3a9e$export$93e4b0b2cc49b648);
$parcel$export(module.exports, "TableView", () => $bed37377ec7a3a9e$export$b3c27e869d856b7);
$parcel$export(module.exports, "TableBody", () => $bed37377ec7a3a9e$export$76ccd210b9029917);
$parcel$export(module.exports, "Column", () => $bed37377ec7a3a9e$export$816b5d811295e6bc);
$parcel$export(module.exports, "TableHeader", () => $bed37377ec7a3a9e$export$f850895b287ef28e);
$parcel$export(module.exports, "Cell", () => $bed37377ec7a3a9e$export$f6f0c3fe4ec306ea);
$parcel$export(module.exports, "EditableCell", () => $bed37377ec7a3a9e$export$d27c35c47f085992);
$parcel$export(module.exports, "Row", () => $bed37377ec7a3a9e$export$b59bdbef9ce70de2);
/*
 * Copyright 2024 Adobe. All rights reserved.
 * This file is licensed to you 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 REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */ 
























let $bed37377ec7a3a9e$var$InternalTableContext = /*#__PURE__*/ (0, $iLVc8$react.createContext)({});
const $bed37377ec7a3a9e$var$tableWrapper = function anonymous(props, overrides) {
    let rules = " ";
    let minHeight = false;
    let minWidth = false;
    let position = false;
    let matches = String(overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|_6|Z|N|L|F|M|K)[^\s]+/g);
    for (let p of matches){
        if (p[1] === "M") minHeight = true;
        if (p[1] === "N") minWidth = true;
        if (p[1] === "_P") position = true;
        rules += p[0];
    }
    if (!minHeight) rules += ' Ma12';
    if (!minWidth) rules += ' Na12';
    rules += ' sd12';
    rules += ' _Bb12';
    rules += ' __ca12';
    if (!position) rules += ' _Pc12';
    rules += ' _Nb12';
    rules += ' Pb12';
    return rules;
};
const $bed37377ec7a3a9e$var$table = function anonymous(props) {
    let rules = " ";
    rules += ' Za12';
    rules += ' Fb12';
    rules += ' _oa12';
    rules += ' _4c12';
    rules += ' Ma12';
    rules += ' Na12';
    rules += ' uk12';
    rules += ' ucJ9TBTb12';
    rules += ' ud3Euai12';
    rules += ' uea12';
    rules += ' ugb12';
    rules += ' uhd12';
    rules += ' uje12';
    rules += ' u2NhKxcl12';
    rules += ' uic12';
    rules += ' xb12';
    rules += ' _xa12';
    rules += ' _Na12';
    rules += ' Pa12';
    if (props.isQuiet) rules += ' g912';
    else rules += ' gX12';
    rules += ' gla12';
    rules += ' iq12';
    rules += ' _jf12';
    if (props.isQuiet) rules += ' _ka12';
    else rules += ' _kb12';
    if (props.isQuiet) rules += ' ha12';
    else rules += ' hb12';
    if (props.isQuiet) rules += ' ma12';
    else rules += ' mb12';
    if (props.isQuiet) rules += ' la12';
    else rules += ' lb12';
    if (props.isFocusVisible) rules += ' _Lf12';
    else rules += ' _Le12';
    rules += ' Oh12';
    rules += ' Olc12';
    rules += ' _Mc12';
    rules += ' _Ka12';
    if (props.isQuiet) rules += ' od12';
    else rules += ' of12';
    if (props.isQuiet) rules += ' nd12';
    else rules += ' nf12';
    if (props.isQuiet) rules += ' kd12';
    else rules += ' kf12';
    if (props.isQuiet) rules += ' jd12';
    else rules += ' jf12';
    rules += ' _Um12';
    if (props.isCheckboxSelection) rules += ' _Tk12';
    return rules;
};
// component-height-100
const $bed37377ec7a3a9e$var$DEFAULT_HEADER_HEIGHT = {
    medium: 32,
    large: 40
};
const $bed37377ec7a3a9e$var$ROW_HEIGHTS = {
    compact: {
        medium: 32,
        large: 40
    },
    regular: {
        medium: 40,
        large: 50
    },
    spacious: {
        medium: 48,
        large: 60
    }
};
class $bed37377ec7a3a9e$export$4e03bdf0174fd602 extends (0, $iLVc8$reactariacomponents.TableLayout) {
    isStickyColumn(node) {
        return node.props.isSticky;
    }
    buildCollection() {
        let [header, body] = super.buildCollection();
        if (!header) return [];
        let { layoutInfo: layoutInfo } = body;
        // TableLayout's buildCollection always sets the body width to the max width between the header width, but
        // we want the body to be sticky and only as wide as the table so it is always in view if loading/empty
        let isEmptyOrLoading = this.virtualizer?.collection.size === 0;
        if (isEmptyOrLoading) layoutInfo.rect.width = this.virtualizer.visibleRect.width - 80;
        return [
            header,
            body
        ];
    }
    buildLoader(node, x, y) {
        let layoutNode = super.buildLoader(node, x, y);
        let { layoutInfo: layoutInfo } = layoutNode;
        layoutInfo.allowOverflow = true;
        layoutInfo.rect.width = this.virtualizer.visibleRect.width;
        // If performing first load or empty, the body will be sticky so we don't want to apply sticky to the loader, otherwise it will
        // affect the positioning of the empty state renderer
        let collection = this.virtualizer.collection;
        let isEmptyOrLoading = collection?.size === 0;
        layoutInfo.isSticky = !isEmptyOrLoading;
        return layoutNode;
    }
    // y is the height of the headers
    buildBody(y) {
        let layoutNode = super.buildBody(y);
        let { layoutInfo: layoutInfo } = layoutNode;
        // Needs overflow for sticky loader
        layoutInfo.allowOverflow = true;
        // If loading or empty, we'll want the body to be sticky and centered
        let isEmptyOrLoading = this.virtualizer?.collection.size === 0;
        if (isEmptyOrLoading) {
            layoutInfo.rect = new (0, $iLVc8$reactariacomponents.Rect)(40, 40, this.virtualizer.visibleRect.width - 80, this.virtualizer.visibleRect.height - 80);
            layoutInfo.isSticky = true;
        }
        return {
            ...layoutNode,
            layoutInfo: layoutInfo
        };
    }
    buildRow(node, x, y) {
        let layoutNode = super.buildRow(node, x, y);
        layoutNode.layoutInfo.allowOverflow = true;
        // Needs overflow for sticky selection/drag cells
        return layoutNode;
    }
    buildTableHeader() {
        let layoutNode = super.buildTableHeader();
        // Needs overflow for sticky selection/drag column
        layoutNode.layoutInfo.allowOverflow = true;
        return layoutNode;
    }
    buildColumn(node, x, y) {
        let layoutNode = super.buildColumn(node, x, y);
        // Needs overflow for the resize handle
        layoutNode.layoutInfo.allowOverflow = true;
        return layoutNode;
    }
}
const $bed37377ec7a3a9e$export$93e4b0b2cc49b648 = /*#__PURE__*/ (0, $iLVc8$react.createContext)(null);
const $bed37377ec7a3a9e$export$b3c27e869d856b7 = /*#__PURE__*/ (0, $iLVc8$react.forwardRef)(function TableView(props, ref) {
    [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $bed37377ec7a3a9e$export$93e4b0b2cc49b648);
    let { UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className, isQuiet: isQuiet = false, density: density = 'regular', overflowMode: overflowMode = 'truncate', styles: styles, loadingState: loadingState, onResize: propsOnResize, onResizeStart: propsOnResizeStart, onResizeEnd: propsOnResizeEnd, onAction: onAction, onLoadMore: onLoadMore, selectionMode: selectionMode = 'none', ...otherProps } = props;
    let domRef = (0, $iLVc8$reactspectrumutils.useDOMRef)(ref);
    let scale = (0, $ee7b4c497f520c08$exports.useScale)();
    // Starts when the user selects resize from the menu, ends when resizing ends
    // used to control the visibility of the resizer Nubbin
    let [isInResizeMode, setIsInResizeMode] = (0, $iLVc8$react.useState)(false);
    let onResizeStart = (0, $iLVc8$react.useCallback)((widths)=>{
        propsOnResizeStart?.(widths);
    }, [
        propsOnResizeStart
    ]);
    let onResizeEnd = (0, $iLVc8$react.useCallback)((widths)=>{
        setIsInResizeMode(false);
        propsOnResizeEnd?.(widths);
    }, [
        propsOnResizeEnd,
        setIsInResizeMode
    ]);
    let context = (0, $iLVc8$react.useMemo)(()=>({
            isQuiet: isQuiet,
            density: density,
            overflowMode: overflowMode,
            loadingState: loadingState,
            onLoadMore: onLoadMore,
            isInResizeMode: isInResizeMode,
            setIsInResizeMode: setIsInResizeMode,
            selectionMode: selectionMode
        }), [
        isQuiet,
        density,
        overflowMode,
        loadingState,
        onLoadMore,
        isInResizeMode,
        setIsInResizeMode,
        selectionMode
    ]);
    let scrollRef = (0, $iLVc8$react.useRef)(null);
    let isCheckboxSelection = selectionMode === 'multiple' || selectionMode === 'single';
    let { selectedKeys: selectedKeys, onSelectionChange: onSelectionChange, actionBar: actionBar, actionBarHeight: actionBarHeight } = (0, $85bf454149fe9ddc$exports.useActionBarContainer)({
        ...props,
        scrollRef: scrollRef
    });
    return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactariacomponents.ResizableTableContainer), {
        // TODO: perhaps this ref should be attached to the RACTable but it expects a table type ref which isn't true in the virtualized case
        ref: domRef,
        onResize: propsOnResize,
        onResizeEnd: onResizeEnd,
        onResizeStart: onResizeStart,
        className: (UNSAFE_className || '') + $bed37377ec7a3a9e$var$tableWrapper(null, styles),
        style: UNSAFE_style,
        children: [
            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Virtualizer), {
                layout: $bed37377ec7a3a9e$export$4e03bdf0174fd602,
                layoutOptions: {
                    rowHeight: overflowMode === 'wrap' ? undefined : $bed37377ec7a3a9e$var$ROW_HEIGHTS[density][scale],
                    estimatedRowHeight: overflowMode === 'wrap' ? $bed37377ec7a3a9e$var$ROW_HEIGHTS[density][scale] : undefined,
                    // No need for estimated headingHeight since the headers aren't affected by overflow mode: wrap
                    headingHeight: $bed37377ec7a3a9e$var$DEFAULT_HEADER_HEIGHT[scale],
                    loaderHeight: 60
                },
                children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$InternalTableContext.Provider, {
                    value: context,
                    children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Table), {
                        ref: scrollRef,
                        style: {
                            // Fix webkit bug where scrollbars appear above the checkboxes/other table elements
                            WebkitTransform: 'translateZ(0)',
                            // Add padding at the bottom when the action bar is visible so users can scroll to the last items.
                            // Also add scroll padding so navigating with the keyboard doesn't go behind the action bar.
                            paddingBottom: actionBarHeight > 0 ? actionBarHeight + 8 : 0,
                            scrollPaddingBottom: actionBarHeight > 0 ? actionBarHeight + 8 : 0
                        },
                        className: (renderProps)=>$bed37377ec7a3a9e$var$table({
                                ...renderProps,
                                isCheckboxSelection: isCheckboxSelection,
                                isQuiet: isQuiet
                            }),
                        selectionBehavior: "toggle",
                        selectionMode: selectionMode,
                        onRowAction: onAction,
                        ...otherProps,
                        selectedKeys: selectedKeys,
                        defaultSelectedKeys: undefined,
                        onSelectionChange: onSelectionChange
                    })
                })
            }),
            actionBar
        ]
    });
});
const $bed37377ec7a3a9e$var$centeredWrapper = " sd12 eb12 _Ca12 Za12 Fb12";
const $bed37377ec7a3a9e$export$76ccd210b9029917 = /*#__PURE__*/ (0, $iLVc8$react.forwardRef)(function TableBody(props, ref) {
    let { items: items, renderEmptyState: renderEmptyState, children: children, dependencies: dependencies = [] } = props;
    let domRef = (0, $iLVc8$reactspectrumutils.useDOMRef)(ref);
    let { loadingState: loadingState, onLoadMore: onLoadMore } = (0, $iLVc8$react.useContext)($bed37377ec7a3a9e$var$InternalTableContext);
    let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
    let emptyRender;
    let renderer = children;
    let stringFormatter = (0, $iLVc8$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
    // TODO: still is offset strangely if loadingMore when there aren't any items in the table, see http://localhost:6006/?path=/story/tableview--empty-state&args=loadingState:loadingMore
    // This is because we don't distinguish between loadingMore and loading in the layout, resulting in a different rect being used to build the body. Perhaps can be considered as a user error
    // if they pass loadingMore without having any other items in the table. Alternatively, could update the layout so it knows the current loading state.
    let loadMoreSpinner = /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.TableLoadMoreItem), {
        isLoading: loadingState === 'loadingMore',
        onLoadMore: onLoadMore,
        className: " Fb12 Za12",
        children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)("div", {
            className: $bed37377ec7a3a9e$var$centeredWrapper,
            children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $1c116ea4b0d2d023$exports.ProgressCircle), {
                isIndeterminate: true,
                "aria-label": stringFormatter.format('table.loadingMore')
            })
        })
    });
    // If the user is rendering their rows in dynamic fashion, wrap their render function in Collection so we can inject
    // the loader. Otherwise it is a static renderer and thus we can simply add the table loader after
    // TODO: this assumes that the user isn't providing their children in some wrapper though and/or isn't doing a map of children
    // (though I guess they wouldn't provide items then so the check for this is still valid in the latter case)...
    if (typeof children === 'function' && items) renderer = /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
        children: [
            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Collection), {
                items: items,
                dependencies: dependencies,
                children: children
            }),
            loadMoreSpinner
        ]
    });
    else renderer = /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
        children: [
            children,
            loadMoreSpinner
        ]
    });
    if (renderEmptyState != null && !isLoading) emptyRender = (props)=>/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)("div", {
            className: $bed37377ec7a3a9e$var$centeredWrapper,
            children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.CollectionRendererContext).Provider, {
                value: (0, $iLVc8$reactariacomponents.DefaultCollectionRenderer),
                children: renderEmptyState(props)
            })
        });
    else if (loadingState === 'loading') emptyRender = ()=>/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)("div", {
            className: $bed37377ec7a3a9e$var$centeredWrapper,
            children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $1c116ea4b0d2d023$exports.ProgressCircle), {
                isIndeterminate: true,
                "aria-label": stringFormatter.format('table.loading')
            })
        });
    return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.TableBody), {
        // @ts-ignore
        ref: domRef,
        className: " Fb12",
        ...props,
        renderEmptyState: emptyRender,
        dependencies: [
            loadingState
        ],
        children: renderer
    });
});
const $bed37377ec7a3a9e$var$cellFocus = {
    outlineStyle: {
        default: 'none',
        isFocusVisible: 'solid'
    },
    outlineOffset: -2,
    outlineWidth: 2,
    outlineColor: 'focus-ring',
    borderRadius: '[6px]'
};
function $bed37377ec7a3a9e$var$CellFocusRing() {
    return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)("div", {
        role: "presentation",
        className: function anonymous(props) {
            let rules = " ";
            if (props.isFocusVisible) rules += ' _Lf12';
            else rules += ' _Le12';
            rules += ' _Kb12';
            rules += ' _Mc12';
            rules += ' Oh12';
            rules += ' of12';
            rules += ' nf12';
            rules += ' kf12';
            rules += ' jf12';
            rules += ' _Pa12';
            rules += ' Wr12';
            rules += ' _lr12';
            rules += ' _Ar12';
            rules += ' _zr12';
            rules += ' _Ob12';
            return rules;
        }({
            isFocusVisible: true
        })
    });
}
const $bed37377ec7a3a9e$var$columnStyles = function anonymous(props) {
    let rules = " ";
    rules += ' F40ub4c12';
    rules += ' _oa12';
    if (props.isPressed) rules += ' po12';
    else if (props.isFocusVisible) rules += ' po12';
    else if (props.isHovered) rules += ' po12';
    else rules += ' pt12';
    rules += ' plb12';
    if (props.isMenu) rules += ' Sd12';
    else rules += ' Sf12';
    if (props.isMenu) rules += ' Rd12';
    else rules += ' Rf12';
    if (props.align === "end") rules += ' _Wb12';
    else if (props.align === "center") rules += ' _Wa12';
    else if (props.align === "start") rules += ' _Wd12';
    rules += ' _Le12';
    rules += ' _Pc12';
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e12';
        rules += ' vx12';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d12';
        rules += ' vx12';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b12';
        rules += ' vx12';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a12';
        rules += ' vx12';
    } else {
        rules += ' -_6BNtrc-c12';
        rules += ' vx12';
    }
    rules += ' uk12';
    rules += ' ucJ9TBTb12';
    rules += ' ud3Euai12';
    rules += ' uea12';
    rules += ' ugb12';
    rules += ' uhd12';
    rules += ' uje12';
    rules += ' u2NhKxcl12';
    rules += ' uic12';
    rules += ' xd12';
    rules += ' _xa12';
    rules += ' xX0cczbc12';
    rules += ' _xX0cczba12';
    rules += ' sd12';
    rules += ' iq12';
    rules += ' ila12';
    if (props.isQuiet) rules += ' _kb12';
    else rules += ' _ka12';
    rules += ' hb12';
    rules += ' ma12';
    if (props.isMenu) rules += ' lb12';
    else rules += ' la12';
    rules += ' _jf12';
    rules += ' _yb12';
    return rules;
};
const $bed37377ec7a3a9e$export$816b5d811295e6bc = /*#__PURE__*/ (0, $iLVc8$react.forwardRef)(function Column(props, ref) {
    let { isQuiet: isQuiet } = (0, $iLVc8$react.useContext)($bed37377ec7a3a9e$var$InternalTableContext);
    let { allowsResizing: allowsResizing, children: children, align: align = 'start' } = props;
    let domRef = (0, $iLVc8$reactspectrumutils.useDOMRef)(ref);
    let isMenu = allowsResizing || !!props.menuItems;
    return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Column), {
        ...props,
        ref: domRef,
        style: {
            borderInlineEndColor: 'transparent'
        },
        className: (renderProps)=>$bed37377ec7a3a9e$var$columnStyles({
                ...renderProps,
                isMenu: isMenu,
                align: align,
                isQuiet: isQuiet
            }),
        children: ({ allowsSorting: allowsSorting, sortDirection: sortDirection, isFocusVisible: isFocusVisible, sort: sort, startResize: startResize })=>/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
                children: [
                    isFocusVisible && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$CellFocusRing, {}),
                    isMenu ? /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$ColumnWithMenu, {
                        isColumnResizable: allowsResizing,
                        menuItems: props.menuItems,
                        allowsSorting: allowsSorting,
                        sortDirection: sortDirection,
                        sort: sort,
                        startResize: startResize,
                        align: align,
                        children: children
                    }) : /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$ColumnContents, {
                        align: align,
                        allowsSorting: allowsSorting,
                        sortDirection: sortDirection,
                        children: children
                    })
                ]
            })
    });
});
const $bed37377ec7a3a9e$var$columnContentWrapper = function anonymous(props) {
    let rules = " ";
    rules += ' Na12';
    rules += ' sd12';
    rules += ' eb12';
    rules += ' Za12';
    if (props.align === "end") rules += ' _Cb12';
    else if (props.align === "center") rules += ' _Ca12';
    else if (props.align === "default") rules += ' _Cg12';
    return rules;
};
const $bed37377ec7a3a9e$var$sortIcon = function anonymous(props) {
    let rules = " ";
    rules += ' ZXJkxGe12';
    rules += ' FXJkxGe12';
    rules += ' _va12';
    if (props.isButton) {
        rules += ' Ht12';
        rules += ' Hsu12';
    } else rules += ' Hv12';
    rules += ' _5b12';
    rules += ' -_8sjo0b-t5ZbAob12';
    return rules;
};
function $bed37377ec7a3a9e$var$ColumnContents(props) {
    let { align: align, allowsSorting: allowsSorting, sortDirection: sortDirection, children: children } = props;
    return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)("div", {
        className: $bed37377ec7a3a9e$var$columnContentWrapper({
            align: align
        }),
        children: [
            allowsSorting && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Provider), {
                values: [
                    [
                        (0, $bde97c91243ed164$exports.IconContext),
                        {
                            styles: $bed37377ec7a3a9e$var$sortIcon({})
                        }
                    ]
                ],
                children: sortDirection != null && (sortDirection === 'ascending' ? /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $2197830b90e71c31$exports.default), {}) : /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $22bf2407c3628a21$exports.default), {}))
            }),
            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)("span", {
                className: $bed37377ec7a3a9e$var$columnHeaderText,
                children: children
            })
        ]
    });
}
const $bed37377ec7a3a9e$var$resizableMenuButtonWrapper = function anonymous(props) {
    let rules = " ";
    if (props.isFocusVisible) rules += ' _Lf12';
    else rules += ' _Le12';
    rules += ' _Kb12';
    rules += ' _Mc12';
    rules += ' Oh12';
    rules += ' of12';
    rules += ' nf12';
    rules += ' kf12';
    rules += ' jf12';
    rules += ' pt12';
    rules += ' Za12';
    rules += ' _Pc12';
    rules += ' sd12';
    rules += ' eb12';
    if (props.align === "end") rules += ' _Cb12';
    else if (props.align === "center") rules += ' _Ca12';
    else if (props.align === "default") rules += ' _Cg12';
    rules += ' Sf12';
    rules += ' Rf12';
    rules += ' g912';
    rules += ' _je12';
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e12';
        rules += ' vx12';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d12';
        rules += ' vx12';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b12';
        rules += ' vx12';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a12';
        rules += ' vx12';
    } else {
        rules += ' -_6BNtrc-c12';
        rules += ' vx12';
    }
    rules += ' uk12';
    rules += ' ucJ9TBTb12';
    rules += ' ud3Euai12';
    rules += ' uea12';
    rules += ' ugb12';
    rules += ' uhd12';
    rules += ' uje12';
    rules += ' u2NhKxcl12';
    rules += ' uic12';
    rules += ' xd12';
    rules += ' _xa12';
    rules += ' xX0cczbc12';
    rules += ' _xX0cczba12';
    return rules;
};
const $bed37377ec7a3a9e$var$resizerHandleContainer = function anonymous(props) {
    let rules = " ";
    if (props.isInResizeMode) rules += ' sb12';
    else if (props.isResizing) rules += ' sb12';
    else rules += ' sjBAxlb12';
    rules += ' Zj12';
    rules += ' Fb12';
    rules += ' _Pa12';
    rules += ' Wr12';
    rules += ' _zdYbyj12';
    if (props.resizableDirection === "both") rules += ' rk12';
    else if (props.resizableDirection === "right") rules += ' rF12';
    else if (props.resizableDirection === "left") rules += ' rj12';
    else rules += ' rt12';
    return rules;
};
const $bed37377ec7a3a9e$var$resizerHandle = function anonymous(props) {
    let rules = " ";
    if (props.isResizing) rules += ' g5qAiPc12';
    else if (props.isFocusVisible) rules += ' g5qAiPc12';
    else rules += ' gE12';
    if (props.isResizing) rules += ' gle12';
    else if (props.isFocusVisible) rules += ' gle12';
    else rules += ' gla12';
    if (props.isResizing) rules += ' Fc12';
    else rules += ' Fb12';
    if (props.isResizing) rules += ' Zf12';
    else rules += ' Ze12';
    rules += ' _Pa12';
    rules += ' _AWJpoB12';
    return rules;
};
const $bed37377ec7a3a9e$var$columnHeaderText = " _Nc12 Pc12 _Yb12 _7c12 NXJkxGe12 _ua12 _vb12 _sd12";
const $bed37377ec7a3a9e$var$chevronIcon = " _Sd12 It12 Isu12 NXJkxGe12 _va12 -_8sjo0b-t5ZbAob12";
const $bed37377ec7a3a9e$var$nubbin = " _Pa12 Wr12 _AlhfIS12 ZXJkxGe12 FXJkxGe12 t5qAiPc12 tla12 -_8sjo0b-tw12 -_8sjo0b-lt8pvGJ12";
function $bed37377ec7a3a9e$var$ColumnWithMenu(props) {
    let { allowsSorting: allowsSorting, sortDirection: sortDirection, sort: sort, startResize: startResize, children: children, align: align, isColumnResizable: isColumnResizable, menuItems: menuItems } = props;
    let { setIsInResizeMode: setIsInResizeMode, isInResizeMode: isInResizeMode } = (0, $iLVc8$react.useContext)($bed37377ec7a3a9e$var$InternalTableContext);
    let stringFormatter = (0, $iLVc8$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
    const onMenuSelect = (key)=>{
        switch(key){
            case 'sort-asc':
                sort('ascending');
                break;
            case 'sort-desc':
                sort('descending');
                break;
            case 'resize':
                setIsInResizeMode?.(true);
                startResize();
                break;
        }
    };
    let items = (0, $iLVc8$react.useMemo)(()=>{
        let options = [];
        if (isColumnResizable) options = [
            {
                label: stringFormatter.format('table.resizeColumn'),
                id: 'resize'
            }
        ];
        if (allowsSorting) options = [
            {
                label: stringFormatter.format('table.sortAscending'),
                id: 'sort-asc'
            },
            {
                label: stringFormatter.format('table.sortDescending'),
                id: 'sort-desc'
            },
            ...options
        ];
        return options;
    // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [
        allowsSorting,
        isColumnResizable
    ]);
    let buttonAlignment = 'start';
    let menuAlign = 'start';
    if (align === 'center') buttonAlignment = 'center';
    else if (align === 'end') {
        buttonAlignment = 'end';
        menuAlign = 'end';
    }
    return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
        children: [
            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $e741ea6b88ce4866$exports.MenuTrigger), {
                align: menuAlign,
                children: [
                    /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactariacomponents.Button), {
                        className: (renderProps)=>$bed37377ec7a3a9e$var$resizableMenuButtonWrapper({
                                ...renderProps,
                                align: buttonAlignment
                            }),
                        children: [
                            allowsSorting && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Provider), {
                                values: [
                                    [
                                        (0, $bde97c91243ed164$exports.IconContext),
                                        {
                                            styles: $bed37377ec7a3a9e$var$sortIcon({
                                                isButton: true
                                            })
                                        }
                                    ]
                                ],
                                children: sortDirection != null && (sortDirection === 'ascending' ? /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $2197830b90e71c31$exports.default), {}) : /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $22bf2407c3628a21$exports.default), {}))
                            }),
                            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)("div", {
                                className: $bed37377ec7a3a9e$var$columnHeaderText,
                                children: children
                            }),
                            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $1df9f1c9262ce5df$exports.default), {
                                size: "M",
                                className: $bed37377ec7a3a9e$var$chevronIcon
                            })
                        ]
                    }),
                    /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $e741ea6b88ce4866$exports.Menu), {
                        onAction: onMenuSelect,
                        styles: " Nn12",
                        children: [
                            items.length > 0 && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $e741ea6b88ce4866$exports.MenuSection), {
                                children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Collection), {
                                    items: items,
                                    children: (item)=>/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $e741ea6b88ce4866$exports.MenuItem), {
                                            children: item?.label
                                        })
                                })
                            }),
                            menuItems
                        ]
                    })
                ]
            }),
            isColumnResizable && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)("div", {
                "data-react-aria-prevent-focus": "true",
                children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.ColumnResizer), {
                    "data-react-aria-prevent-focus": "true",
                    className: ({ resizableDirection: resizableDirection, isResizing: isResizing })=>$bed37377ec7a3a9e$var$resizerHandleContainer({
                            resizableDirection: resizableDirection,
                            isResizing: isResizing,
                            isInResizeMode: isInResizeMode
                        }),
                    children: ({ isFocusVisible: isFocusVisible, isResizing: isResizing })=>/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
                            children: [
                                /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$ResizerIndicator, {
                                    isFocusVisible: isFocusVisible,
                                    isResizing: isResizing
                                }),
                                (isFocusVisible || isInResizeMode) && isResizing && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)("div", {
                                    className: $bed37377ec7a3a9e$var$nubbin,
                                    children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $23350f45c699333e$exports.default), {})
                                })
                            ]
                        })
                })
            })
        ]
    });
}
function $bed37377ec7a3a9e$var$ResizerIndicator({ isFocusVisible: isFocusVisible, isResizing: isResizing }) {
    return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)("div", {
        className: $bed37377ec7a3a9e$var$resizerHandle({
            isFocusVisible: isFocusVisible,
            isResizing: isResizing
        })
    });
}
const $bed37377ec7a3a9e$var$tableHeader = function anonymous(props) {
    let rules = " ";
    rules += ' Fb12';
    rules += ' Za12';
    rules += ' gL12';
    rules += ' JLPOtrc12';
    if (props.isHovered) rules += ' -xLp2wc-sb12';
    else rules += ' -xLp2wc-sk12';
    return rules;
};
const $bed37377ec7a3a9e$var$selectAllCheckbox = " IC12";
const $bed37377ec7a3a9e$var$selectAllCheckboxColumn = function anonymous(props) {
    let rules = " ";
    rules += ' Td12';
    rules += ' Qd12';
    rules += ' Sd12';
    rules += ' Rd12';
    rules += ' Fb12';
    rules += ' _oa12';
    rules += ' _Le12';
    rules += ' _Pc12';
    rules += ' _cb12';
    rules += ' iq12';
    rules += ' ila12';
    rules += ' ma12';
    rules += ' la12';
    if (props.isQuiet) rules += ' _kb12';
    else rules += ' _ka12';
    rules += ' hb12';
    rules += ' _jf12';
    rules += ' gL12';
    return rules;
};
const $bed37377ec7a3a9e$export$f850895b287ef28e = /*#__PURE__*/ (0, $iLVc8$react.forwardRef)(function TableHeader({ columns: columns, dependencies: dependencies, children: children }, ref) {
    let scale = (0, $ee7b4c497f520c08$exports.useScale)();
    let { selectionBehavior: selectionBehavior, selectionMode: selectionMode } = (0, $iLVc8$reactariacomponents.useTableOptions)();
    let { isQuiet: isQuiet } = (0, $iLVc8$react.useContext)($bed37377ec7a3a9e$var$InternalTableContext);
    let domRef = (0, $iLVc8$reactspectrumutils.useDOMRef)(ref);
    return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactariacomponents.TableHeader), {
        // @ts-ignore
        ref: domRef,
        className: $bed37377ec7a3a9e$var$tableHeader,
        children: [
            selectionBehavior === 'toggle' && // Also isSticky prop is applied just for the layout, will decide what the RAC api should be later
            // @ts-ignore
            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Column), {
                isSticky: true,
                width: scale === 'medium' ? 40 : 52,
                minWidth: scale === 'medium' ? 40 : 52,
                className: $bed37377ec7a3a9e$var$selectAllCheckboxColumn({
                    isQuiet: isQuiet
                }),
                children: ({ isFocusVisible: isFocusVisible })=>/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
                        children: [
                            selectionMode === 'single' && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
                                children: [
                                    isFocusVisible && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$CellFocusRing, {}),
                                    /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$VisuallyHiddenSelectAllLabel, {})
                                ]
                            }),
                            selectionMode === 'multiple' && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $af04e099a53d3e85$exports.Checkbox), {
                                styles: $bed37377ec7a3a9e$var$selectAllCheckbox,
                                slot: "selection"
                            })
                        ]
                    })
            }),
            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Collection), {
                items: columns,
                dependencies: dependencies,
                children: children
            })
        ]
    });
});
function $bed37377ec7a3a9e$var$VisuallyHiddenSelectAllLabel() {
    let checkboxProps = (0, $iLVc8$reactariacomponents.useSlottedContext)((0, $iLVc8$reactariacomponents.CheckboxContext), 'selection');
    return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactaria.VisuallyHidden), {
        children: checkboxProps?.['aria-label']
    });
}
const $bed37377ec7a3a9e$var$commonCellStyles = {
    borderColor: 'transparent',
    borderBottomWidth: 1,
    borderTopWidth: 0,
    borderXWidth: 0,
    borderStyle: 'solid',
    position: 'relative',
    color: '--rowTextColor',
    outlineStyle: 'none',
    paddingX: 16 // table-edge-to-content
};
const $bed37377ec7a3a9e$var$cell = function anonymous(props) {
    let rules = " ";
    rules += ' iq12';
    rules += ' ila12';
    rules += ' hXMFGYc12';
    rules += ' _kJ8iPYd12';
    rules += ' ma12';
    if (props.isDivider) rules += ' lb12';
    else rules += ' la12';
    if (props.isDivider) rules += ' _jf12';
    else rules += ' _je12';
    rules += ' _Pc12';
    rules += ' pBvFblc12';
    rules += ' _Le12';
    rules += ' Sf12';
    rules += ' Rf12';
    rules += ' Tu7Fubd12';
    rules += ' Qu7Fubd12';
    rules += ' MAyFGYc12';
    rules += ' _oa12';
    rules += ' Fb12';
    rules += ' Za12';
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e12';
        rules += ' vx12';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d12';
        rules += ' vx12';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b12';
        rules += ' vx12';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a12';
        rules += ' vx12';
    } else {
        rules += ' -_6BNtrc-c12';
        rules += ' vx12';
    }
    rules += ' eb12';
    rules += ' sd12';
    if (props.density === "spacious") rules += ' -M_-Mk12';
    else if (props.density === "compact") rules += ' -M_-Mi12';
    else rules += ' -M_-Mh12';
    rules += ' -_k_-_ka12';
    rules += ' -h_-hb12';
    return rules;
};
const $bed37377ec7a3a9e$var$stickyCell = {
    backgroundColor: 'gray-25'
};
const $bed37377ec7a3a9e$var$checkboxCellStyle = " iA12 ha12 _ka12 ma12 la12 _jf12 _Pc12 pBvFblc12 _Le12 Sf12 Rf12 gs9yXOb12 _cb12 FBJsHLe12";
const $bed37377ec7a3a9e$var$cellContent = function anonymous(props) {
    let rules = " ";
    rules += ' _Nc12';
    rules += ' Pc12';
    rules += ' _Yb12';
    if (props.overflowMode === "wrap") rules += ' _7b12';
    else rules += ' _7c12';
    if (props.align === "end") rules += ' _Wb12';
    else if (props.align === "center") rules += ' _Wa12';
    else if (props.align === "start") rules += ' _Wd12';
    rules += ' Za12';
    rules += ' _Bb12';
    if (props.isSticky) rules += ' Td12';
    else rules += ' Tp12';
    if (props.isSticky) rules += ' Qd12';
    else rules += ' Qp12';
    if (props.isSticky) rules += ' Sd12';
    else rules += ' Sp12';
    if (props.isSticky) rules += ' Rd12';
    else rules += ' Rp12';
    if (props.isSticky) rules += ' Jy12';
    else rules += ' Jb12';
    if (props.isSticky) rules += ' Gy12';
    else rules += ' Gb12';
    if (props.isSticky) rules += ' Iy12';
    else rules += ' Ib12';
    if (props.isSticky) rules += ' Hy12';
    else rules += ' Hb12';
    if (props.isSticky) rules += ' gs9yXOb12';
    else rules += ' g912';
    return rules;
};
const $bed37377ec7a3a9e$export$f6f0c3fe4ec306ea = /*#__PURE__*/ (0, $iLVc8$react.forwardRef)(function Cell(props, ref) {
    let { children: children, isSticky: isSticky, showDivider: showDivider = false, align: align, textValue: textValue, ...otherProps } = props;
    let domRef = (0, $iLVc8$reactspectrumutils.useDOMRef)(ref);
    let tableVisualOptions = (0, $iLVc8$react.useContext)($bed37377ec7a3a9e$var$InternalTableContext);
    textValue ||= typeof children === 'string' ? children : undefined;
    return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Cell), {
        ref: domRef,
        // Also isSticky prop is applied just for the layout, will decide what the RAC api should be later
        // @ts-ignore
        isSticky: isSticky,
        className: (renderProps)=>$bed37377ec7a3a9e$var$cell({
                ...renderProps,
                ...tableVisualOptions,
                isDivider: showDivider
            }),
        textValue: textValue,
        ...otherProps,
        children: ({ isFocusVisible: isFocusVisible })=>/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactjsxruntime.Fragment), {
                children: [
                    /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)("span", {
                        className: $bed37377ec7a3a9e$var$cellContent({
                            ...tableVisualOptions,
                            isSticky: isSticky,
                            align: align || 'start'
                        }),
                        children: children
                    }),
                    isFocusVisible && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$CellFocusRing, {})
                ]
            })
    });
});
const $bed37377ec7a3a9e$var$editableCell = function anonymous(props) {
    let rules = " ";
    rules += ' iq12';
    rules += ' ila12';
    rules += ' hXMFGYc12';
    rules += ' _kJ8iPYd12';
    rules += ' ma12';
    if (props.isDivider) rules += ' lb12';
    else rules += ' la12';
    if (props.isDivider) rules += ' _jf12';
    else rules += ' _je12';
    rules += ' _Pc12';
    if (props.isSaving) {
        if (props.isPressed) rules += ' pt12';
        else if (props.isFocusVisible) rules += ' pt12';
        else if (props.isHovered) rules += ' pt12';
        else rules += ' pv12';
    } else {
        if (props.isPressed) rules += ' po12';
        else if (props.isFocusVisible) rules += ' po12';
        else if (props.isHovered) rules += ' po12';
        else rules += ' pt12';
    }
    rules += ' _Le12';
    rules += ' Sf12';
    rules += ' Rf12';
    rules += ' Tu7Fubd12';
    rules += ' Qu7Fubd12';
    rules += ' _oa12';
    rules += ' FBJsHLe12';
    rules += ' Za12';
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e12';
        rules += ' vx12';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d12';
        rules += ' vx12';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b12';
        rules += ' vx12';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a12';
        rules += ' vx12';
    } else {
        rules += ' -_6BNtrc-c12';
        rules += ' vx12';
    }
    rules += ' eb12';
    rules += ' sd12';
    rules += ' -_k_-_ka12';
    rules += ' -h_-hb12';
    return rules;
};
let $bed37377ec7a3a9e$var$editPopover = function anonymous(props, overrides) {
    let rules = " ";
    let minWidth = false;
    let matches = String(overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|_6|Z|N|L)[^\s]+/g);
    for (let p of matches){
        if (p[1] === "N") minWidth = true;
        rules += p[0];
    }
    if (props.colorScheme === "dark") rules += ' _pa12';
    else if (props.colorScheme === "light") rules += ' _pb12';
    else if (props.colorScheme === "light dark") rules += ' _pc12';
    else rules += ' _pN79Hzc12';
    rules += ' -Ovbhqd-g_g12';
    rules += ' gEzkoQe12';
    rules += ' kb12';
    rules += ' jb12';
    rules += ' _nLeasBb12';
    rules += ' _jf12';
    rules += ' _kb12';
    rules += ' hb12';
    rules += ' mb12';
    rules += ' lb12';
    rules += ' ir12';
    rules += ' ila12';
    rules += ' _ob12';
    rules += ' _Bb12';
    if (props.isExiting) rules += ' _Ob12';
    rules += ' _Le12';
    if (!minWidth) rules += ' NuHSBze12';
    rules += ' Tt12';
    rules += ' Qt12';
    rules += ' St12';
    rules += ' Rt12';
    rules += ' sd12';
    rules += ' eb12';
    return rules;
};
const $bed37377ec7a3a9e$export$d27c35c47f085992 = /*#__PURE__*/ (0, $iLVc8$react.forwardRef)(function EditableCell(props, ref) {
    let { children: children, showDivider: showDivider = false, textValue: textValue, isSaving: isSaving, ...otherProps } = props;
    let tableVisualOptions = (0, $iLVc8$react.useContext)($bed37377ec7a3a9e$var$InternalTableContext);
    let domRef = (0, $iLVc8$reactariautils.useObjectRef)(ref);
    textValue ||= typeof children === 'string' ? children : undefined;
    return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Cell), {
        ref: domRef,
        className: (renderProps)=>$bed37377ec7a3a9e$var$editableCell({
                ...renderProps,
                ...tableVisualOptions,
                isDivider: showDivider,
                isSaving: isSaving
            }),
        textValue: textValue,
        ...otherProps,
        children: ({ isFocusVisible: isFocusVisible })=>/*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$EditableCellInner, {
                ...props,
                isFocusVisible: isFocusVisible,
                cellRef: domRef
            })
    });
});
const $bed37377ec7a3a9e$var$nonTextInputTypes = new Set([
    'checkbox',
    'radio',
    'range',
    'color',
    'file',
    'image',
    'button',
    'submit',
    'reset'
]);
function $bed37377ec7a3a9e$var$EditableCellInner(props1) {
    let { children: children, align: align, renderEditing: renderEditing, isSaving: isSaving, onSubmit: onSubmit, isFocusVisible: isFocusVisible, cellRef: cellRef, action: action, onCancel: onCancel } = props1;
    let [isOpen, setIsOpen] = (0, $iLVc8$react.useState)(false);
    let popoverRef = (0, $iLVc8$react.useRef)(null);
    let formRef = (0, $iLVc8$react.useRef)(null);
    let [triggerWidth, setTriggerWidth] = (0, $iLVc8$react.useState)(0);
    let [tableWidth, setTableWidth] = (0, $iLVc8$react.useState)(0);
    let [verticalOffset, setVerticalOffset] = (0, $iLVc8$react.useState)(0);
    let tableVisualOptions = (0, $iLVc8$react.useContext)($bed37377ec7a3a9e$var$InternalTableContext);
    let stringFormatter = (0, $iLVc8$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
    let dialogRef = (0, $iLVc8$react.useRef)(null);
    let { density: density } = (0, $iLVc8$react.useContext)($bed37377ec7a3a9e$var$InternalTableContext);
    let size = 'M';
    if (density === 'compact') size = 'S';
    else if (density === 'spacious') size = 'L';
    // Popover positioning
    (0, $iLVc8$reactariautils.useLayoutEffect)(()=>{
        if (!isOpen) return;
        let width = cellRef.current?.clientWidth || 0;
        let cell = cellRef.current;
        let boundingRect = cell?.parentElement?.getBoundingClientRect();
        let verticalOffset = (boundingRect?.top ?? 0) - (boundingRect?.bottom ?? 0);
        let tableWidth = cellRef.current?.closest('[role="grid"]')?.clientWidth || 0;
        setTriggerWidth(width);
        setVerticalOffset(verticalOffset);
        setTableWidth(tableWidth);
    }, [
        cellRef,
        density,
        isOpen
    ]);
    // Auto select the entire text range of the autofocused input on overlay opening
    // Maybe replace with FocusScope or one of those utilities
    (0, $iLVc8$react.useEffect)(()=>{
        if (isOpen) {
            let activeElement = (0, $iLVc8$reactariautils.getActiveElement)((0, $iLVc8$reactariautils.getOwnerDocument)(formRef.current));
            if (activeElement && (0, $iLVc8$reactariautils.nodeContains)(formRef.current, activeElement) && (activeElement instanceof HTMLInputElement && !$bed37377ec7a3a9e$var$nonTextInputTypes.has(activeElement.type) || activeElement instanceof HTMLTextAreaElement) && typeof activeElement.select === 'function') activeElement.select();
        }
    }, [
        isOpen
    ]);
    let cancel = (0, $iLVc8$react.useCallback)(()=>{
        setIsOpen(false);
        onCancel?.();
    }, [
        onCancel
    ]);
    let isMobile = !(0, $iLVc8$reactspectrumutils.useMediaQuery)('(hover: hover) and (pointer: fine)');
    // Can't differentiate between Dialog click outside dismissal and Escape key dismissal
    let prevIsOpen = (0, $iLVc8$react.useRef)(isOpen);
    (0, $iLVc8$react.useEffect)(()=>{
        let dialog = dialogRef.current?.UNSAFE_getDOMNode();
        if (isOpen && dialog && !prevIsOpen.current) {
            let handler = (e)=>{
                if (e.key === 'Escape') {
                    cancel();
                    e.stopPropagation();
                    e.preventDefault();
                }
            };
            dialog.addEventListener('keydown', handler);
            prevIsOpen.current = isOpen;
            return ()=>{
                dialog.removeEventListener('keydown', handler);
            };
        }
        prevIsOpen.current = isOpen;
    }, [
        isOpen,
        cancel
    ]);
    return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactariacomponents.Provider), {
        values: [
            [
                (0, $iLVc8$reactariacomponents.ButtonContext),
                null
            ],
            [
                (0, $6e265ff388155b91$exports.ActionButtonContext),
                {
                    slots: {
                        [(0, $iLVc8$reactariacomponents.DEFAULT_SLOT)]: {},
                        edit: {
                            onPress: ()=>setIsOpen(true),
                            isPending: isSaving,
                            isQuiet: !isSaving,
                            size: size,
                            excludeFromTabOrder: true,
                            styles: function anonymous(props) {
                                let rules = " ";
                                if (props.isForcedVisible) rules += ' _6c12';
                                else rules += ' _6b12';
                                rules += ' _6JGzCfcc12';
                                rules += ' _6hcIDbbc12';
                                rules += ' _6sc12';
                                return rules;
                            }({
                                isForcedVisible: isOpen || !!isSaving
                            })
                        }
                    }
                }
            ]
        ],
        children: [
            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)("span", {
                className: $bed37377ec7a3a9e$var$cellContent({
                    ...tableVisualOptions,
                    align: align || 'start'
                }),
                children: children
            }),
            isFocusVisible && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$var$CellFocusRing, {}),
            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactariacomponents.Provider), {
                values: [
                    [
                        (0, $6e265ff388155b91$exports.ActionButtonContext),
                        null
                    ]
                ],
                children: [
                    !isMobile && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Popover), {
                        isOpen: isOpen,
                        onOpenChange: setIsOpen,
                        ref: popoverRef,
                        shouldCloseOnInteractOutside: ()=>{
                            if (!(0, $iLVc8$reactariautils.isFocusWithin)(popoverRef.current)) return false;
                            formRef.current?.requestSubmit();
                            return false;
                        },
                        triggerRef: cellRef,
                        "aria-label": props1['aria-label'] ?? stringFormatter.format('table.editCell'),
                        offset: verticalOffset,
                        placement: "bottom start",
                        style: {
                            minWidth: `min(${triggerWidth}px, ${tableWidth}px)`,
                            maxWidth: `${tableWidth}px`,
                            // Override default z-index from useOverlayPosition. We use isolation: isolate instead.
                            zIndex: undefined
                        },
                        className: $bed37377ec7a3a9e$var$editPopover,
                        children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Provider), {
                            values: [
                                [
                                    (0, $iLVc8$reactariacomponents.OverlayTriggerStateContext),
                                    null
                                ]
                            ],
                            children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactariacomponents.Form), {
                                ref: formRef,
                                action: action,
                                onSubmit: (e)=>{
                                    onSubmit?.(e);
                                    setIsOpen(false);
                                },
                                className: " Za12 sd12 ed12 Ul12 ql12",
                                style: {
                                    '--input-width': `calc(${triggerWidth}px - 32px)`
                                },
                                children: [
                                    renderEditing(),
                                    /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)("div", {
                                        className: " sd12 _tc12 ea12 _va12 _ua12",
                                        children: [
                                            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $6e265ff388155b91$exports.ActionButton), {
                                                isQuiet: true,
                                                onPress: cancel,
                                                "aria-label": stringFormatter.format('table.cancel'),
                                                children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $8ecd53081d7d50cc$exports.default), {})
                                            }),
                                            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $6e265ff388155b91$exports.ActionButton), {
                                                isQuiet: true,
                                                type: "submit",
                                                "aria-label": stringFormatter.format('table.save'),
                                                children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $c3e72d94a25defe0$exports.default), {})
                                            })
                                        ]
                                    })
                                ]
                            })
                        })
                    }),
                    isMobile && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $fc196655d58ce18c$exports.DialogContainer), {
                        onDismiss: ()=>formRef.current?.requestSubmit(),
                        children: isOpen && /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $a05aa0b0345f1846$exports.CustomDialog), {
                            ref: dialogRef,
                            isDismissible: true,
                            isKeyboardDismissDisabled: true,
                            "aria-label": props1['aria-label'] ?? stringFormatter.format('table.editCell'),
                            children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactariacomponents.Form), {
                                ref: formRef,
                                action: action,
                                onSubmit: (e)=>{
                                    onSubmit?.(e);
                                    setIsOpen(false);
                                },
                                className: " Za12 sd12 _ta12 ed12 Ul12 ql12",
                                children: [
                                    renderEditing(),
                                    /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $e1016b8947dbadb8$exports.ButtonGroup), {
                                        align: "end",
                                        styles: " _dd12",
                                        children: [
                                            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $25d06cf8d4e72761$exports.Button), {
                                                onPress: cancel,
                                                variant: "secondary",
                                                fillStyle: "outline",
                                                children: "Cancel"
                                            }),
                                            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $25d06cf8d4e72761$exports.Button), {
                                                type: "submit",
                                                variant: "accent",
                                                children: "Save"
                                            })
                                        ]
                                    })
                                ]
                            })
                        })
                    })
                ]
            })
        ]
    });
}
// Use color-mix instead of transparency so sticky cells work correctly.
const $bed37377ec7a3a9e$var$selectedBackground = "[color-mix(in srgb, light-dark(rgb(255, 255, 255), rgb(17, 17, 17)), light-dark(rgb(19, 19, 19), rgb(242, 242, 242)) 7%)]";
const $bed37377ec7a3a9e$var$selectedActiveBackground = "[color-mix(in srgb, light-dark(rgb(255, 255, 255), rgb(17, 17, 17)), light-dark(rgb(19, 19, 19), rgb(242, 242, 242)) 10%)]";
const $bed37377ec7a3a9e$var$rowBackgroundColor = {
    default: {
        default: 'gray-25',
        isQuiet: '--s2-container-bg'
    },
    isFocusVisibleWithin: "[color-mix(in srgb, light-dark(rgb(255, 255, 255), rgb(17, 17, 17)), light-dark(rgb(19, 19, 19), rgb(242, 242, 242)) 7%)]",
    isHovered: "[color-mix(in srgb, light-dark(rgb(255, 255, 255), rgb(17, 17, 17)), light-dark(rgb(19, 19, 19), rgb(242, 242, 242)) 7%)]",
    isPressed: "[color-mix(in srgb, light-dark(rgb(255, 255, 255), rgb(17, 17, 17)), light-dark(rgb(19, 19, 19), rgb(242, 242, 242)) 10%)]",
    isSelected: {
        default: $bed37377ec7a3a9e$var$selectedBackground,
        isFocusVisibleWithin: $bed37377ec7a3a9e$var$selectedActiveBackground,
        isHovered: $bed37377ec7a3a9e$var$selectedActiveBackground,
        isPressed: $bed37377ec7a3a9e$var$selectedActiveBackground // table-selected-row-background-color, opacity /15
    },
    forcedColors: {
        default: 'Background'
    }
};
const $bed37377ec7a3a9e$var$rowTextColor = {
    default: {
        "default": "neutral-subdued",
        isHovered: "neutral-subdued:hovered",
        isFocusVisible: "neutral-subdued:focused",
        isPressed: "neutral-subdued:pressed"
    },
    isSelected: {
        "default": "neutral",
        isHovered: "neutral:hovered",
        isFocusVisible: "neutral:focused",
        isPressed: "neutral:pressed"
    },
    isDisabled: {
        default: 'disabled',
        forcedColors: 'GrayText'
    },
    forcedColors: 'ButtonText'
};
const $bed37377ec7a3a9e$var$row = function anonymous(props) {
    let rules = " ";
    rules += ' Fb12';
    rules += ' _Pc12';
    rules += ' _oa12';
    rules += ' gs9yXOb12';
    if (props.isSelected) {
        if (props.isPressed) rules += ' -qH4xad-gRfT7e12';
        else if (props.isHovered) rules += ' -qH4xad-gRfT7e12';
        else if (props.isFocusVisibleWithin) rules += ' -qH4xad-gRfT7e12';
        else rules += ' -qH4xad-gj1B7i12';
    } else if (props.isPressed) rules += ' -qH4xad-gRfT7e12';
    else if (props.isHovered) rules += ' -qH4xad-gj1B7i12';
    else if (props.isFocusVisibleWithin) rules += ' -qH4xad-gj1B7i12';
    else if (props.isQuiet) rules += ' -qH4xad-gEzkoQe12';
    else rules += ' -qH4xad-gX12';
    rules += ' -qH4xad-lga12';
    if (props.isDisabled) rules += ' -Fadoyc-pp12';
    else if (props.isSelected) {
        if (props.isPressed) rules += ' -Fadoyc-po12';
        else if (props.isFocusVisible) rules += ' -Fadoyc-po12';
        else if (props.isHovered) rules += ' -Fadoyc-po12';
        else rules += ' -Fadoyc-pt12';
    } else {
        if (props.isPressed) rules += ' -Fadoyc-pt12';
        else if (props.isFocusVisible) rules += ' -Fadoyc-pt12';
        else if (props.isHovered) rules += ' -Fadoyc-pt12';
        else rules += ' -Fadoyc-pv12';
    }
    rules += ' -Fadoyc-lpb12';
    rules += ' -_34HbNb-Oh12';
    rules += ' -_34HbNb-lOc12';
    rules += ' _Le12';
    rules += ' _ka12';
    rules += ' hb12';
    rules += ' ma12';
    rules += ' la12';
    rules += ' _jf12';
    rules += ' iq12';
    rules += ' ila12';
    rules += ' _yb12';
    return rules;
};
const $bed37377ec7a3a9e$var$selectionCheckbox = " _6c12 _6Lcn87b12";
const $bed37377ec7a3a9e$export$b59bdbef9ce70de2 = /*#__PURE__*/ (0, $iLVc8$react.forwardRef)(function Row({ id: id, columns: columns, children: children, dependencies: dependencies = [], ...otherProps }, ref) {
    let { selectionBehavior: selectionBehavior, selectionMode: selectionMode } = (0, $iLVc8$reactariacomponents.useTableOptions)();
    let tableVisualOptions = (0, $iLVc8$react.useContext)($bed37377ec7a3a9e$var$InternalTableContext);
    let domRef = (0, $iLVc8$reactspectrumutils.useDOMRef)(ref);
    return /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsxs)((0, $iLVc8$reactariacomponents.Row), {
        // @ts-ignore
        ref: domRef,
        id: id,
        dependencies: [
            ...dependencies,
            columns
        ],
        className: (renderProps)=>$bed37377ec7a3a9e$var$row({
                ...renderProps,
                ...tableVisualOptions
            }) + (renderProps.isFocusVisible ? " hFh6wc" : ''),
        ...otherProps,
        children: [
            selectionMode !== 'none' && selectionBehavior === 'toggle' && // Not sure what we want to do with this className, in Cell it currently overrides the className that would have been applied.
            // The `spread` otherProps must be after className in Cell.
            // @ts-ignore
            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)($bed37377ec7a3a9e$export$f6f0c3fe4ec306ea, {
                isSticky: true,
                className: $bed37377ec7a3a9e$var$checkboxCellStyle,
                children: /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $af04e099a53d3e85$exports.Checkbox), {
                    slot: "selection",
                    styles: $bed37377ec7a3a9e$var$selectionCheckbox
                })
            }),
            /*#__PURE__*/ (0, $iLVc8$reactjsxruntime.jsx)((0, $iLVc8$reactariacomponents.Collection), {
                items: columns,
                dependencies: [
                    ...dependencies,
                    columns
                ],
                children: children
            })
        ]
    });
});


//# sourceMappingURL=TableView.cjs.map
