"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (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 = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (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__, {
    inputPreviewComponentFieldSettings: ()=>inputPreviewComponentFieldSettings
});
const schema_namespaceObject = require("@tachybase/schema");
const external_react_i18next_namespaceObject = require("react-i18next");
const SchemaSettings_js_namespaceObject = require("../../../../application/schema-settings/SchemaSettings.js");
const index_js_namespaceObject = require("../../../../schema-component/index.js");
const createSettingsItem = (config)=>({
        name: config.name,
        type: 'select',
        useComponentProps () {
            var _fieldSchema_xcomponentprops;
            const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
            const field = (0, schema_namespaceObject.useField)();
            const schema = (0, schema_namespaceObject.useFieldSchema)();
            const { fieldSchema: tableColumnSchema } = (0, index_js_namespaceObject.useColumnSchema)();
            const fieldSchema = tableColumnSchema || schema;
            const { dn } = (0, index_js_namespaceObject.useDesignable)();
            return {
                title: t(config.title),
                options: config.options(t),
                value: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops[config.name]) || config.defaultValue,
                onChange (value) {
                    const schema = {
                        ['x-uid']: fieldSchema['x-uid']
                    };
                    fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                    fieldSchema['x-component-props'][config.name] = value;
                    schema['x-component-props'] = fieldSchema['x-component-props'];
                    field.componentProps = field.componentProps || {};
                    field.componentProps[config.name] = value;
                    dn.emit('patch', {
                        schema
                    });
                }
            };
        }
    });
const getSizeOptions = (t)=>[
        {
            value: 'small',
            label: t('Small')
        },
        {
            value: 'middle',
            label: t('Middle')
        },
        {
            value: 'large',
            label: t('Large')
        },
        {
            value: 'oversized',
            label: t('Oversized')
        },
        {
            value: 'auto',
            label: t('Auto')
        }
    ];
const getObjectFitOptions = (t)=>[
        {
            value: 'cover',
            label: t('Cover')
        },
        {
            value: 'fill',
            label: t('Fill')
        },
        {
            value: 'contain',
            label: t('Contain')
        },
        {
            value: 'scale-down',
            label: t('Scale Down')
        },
        {
            value: 'none',
            label: t('None')
        }
    ];
const size = createSettingsItem({
    name: 'size',
    title: 'Size',
    options: getSizeOptions,
    defaultValue: 'small'
});
const objectFit = createSettingsItem({
    name: 'objectFit',
    title: 'Object Fit',
    options: getObjectFitOptions,
    defaultValue: 'cover'
});
const inputPreviewComponentFieldSettings = new SchemaSettings_js_namespaceObject.SchemaSettings({
    name: 'fieldSettings:component:Input.Preview',
    items: [
        size,
        objectFit
    ]
});
exports.inputPreviewComponentFieldSettings = __webpack_exports__.inputPreviewComponentFieldSettings;
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
    "inputPreviewComponentFieldSettings"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
Object.defineProperty(exports, '__esModule', {
    value: true
});
