"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
(()=>{
    __webpack_require__.r = function(exports1) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    QuickAccessAction: ()=>QuickAccessAction
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const external_react_namespaceObject = require("react");
const schema_namespaceObject = require("@tachybase/schema");
const external_antd_namespaceObject = require("antd");
const external_antd_style_namespaceObject = require("antd-style");
const index_js_namespaceObject = require("../../application/index.js");
const external_icon_index_js_namespaceObject = require("../../icon/index.js");
const external_schema_component_index_js_namespaceObject = require("../../schema-component/index.js");
const external_Block_js_namespaceObject = require("./Block.js");
const external_blockSettings_js_namespaceObject = require("./blockSettings.js");
function _tagged_template_literal(strings, raw) {
    if (!raw) raw = strings.slice(0);
    return Object.freeze(Object.defineProperties(strings, {
        raw: {
            value: Object.freeze(raw)
        }
    }));
}
function _templateObject() {
    const data = _tagged_template_literal([
        "\n    background-color: transparent;\n    border: 0;\n    height: auto;\n    box-shadow: none;\n  "
    ]);
    _templateObject = function() {
        return data;
    };
    return data;
}
function _templateObject1() {
    const data = _tagged_template_literal([
        "\n    margin-top: ",
        "px;\n    text-overflow: ellipsis;\n    overflow: hidden;\n  "
    ]);
    _templateObject1 = function() {
        return data;
    };
    return data;
}
const useStyles = (0, external_antd_style_namespaceObject.createStyles)((param)=>{
    let { token, css } = param;
    return {
        action: css(_templateObject()),
        title: css(_templateObject1(), token.marginSM)
    };
});
function Button() {
    var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
    const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
    const icon = null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops['icon'];
    const backgroundColor = null === (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops1 ? void 0 : _fieldSchema_xcomponentprops1['iconColor'];
    const { layout } = (0, external_react_namespaceObject.useContext)(external_Block_js_namespaceObject.QuickAccessBlockContext);
    const { styles, cx } = useStyles();
    return layout === external_blockSettings_js_namespaceObject.QuickAccessLayout.Grid ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
        title: fieldSchema.title,
        style: {
            width: '70px',
            overflow: 'hidden'
        },
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Avatar, {
                style: {
                    backgroundColor
                },
                size: 54,
                icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_icon_index_js_namespaceObject.Icon, {
                    type: icon
                })
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                className: cx(styles.title),
                children: fieldSchema.title
            })
        ]
    }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("a", {
        children: fieldSchema.title
    });
}
const QuickAccessAction = (0, index_js_namespaceObject.withDynamicSchemaProps)((props)=>{
    const { className, ...others } = props;
    const { styles, cx } = useStyles();
    const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
    const Component = (0, external_schema_component_index_js_namespaceObject.useComponent)(null == props ? void 0 : props.targetComponent) || external_schema_component_index_js_namespaceObject.Action;
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Component, {
        className: cx(className, styles.action),
        ...others,
        icon: null,
        title: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Button, {}),
        confirmTitle: fieldSchema.title
    });
});
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
