import { __esDecorate, __runInitializers } from "tslib";
import { customElement } from 'lit/decorators.js';
import Element from './internals/DomainAutoFieldsDialog.js';
import styles from './internals/styles/DomainAutoFieldsDialog.js';
import typography from '../styles/m3/typography.module.js';
import { DialogBuilder } from '../builders/DialogBuilder.js';
import '../md/button/ui-button.js';
import '../md/checkbox/ui-checkbox.js';
import '../md/list/ui-list.js';
import '../md/list/ui-list-item.js';
let DomainAutoFieldsDialog = (() => {
    let _classDecorators = [customElement('domain-auto-fields-dialog')];
    let _classDescriptor;
    let _classExtraInitializers = [];
    let _classThis;
    let _classSuper = Element;
    var DomainAutoFieldsDialog = class extends _classSuper {
        static { _classThis = this; }
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
            DomainAutoFieldsDialog = _classThis = _classDescriptor.value;
            if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        }
        static styles = [styles, typography];
        static {
            __runInitializers(_classThis, _classExtraInitializers);
        }
    };
    return DomainAutoFieldsDialog = _classThis;
})();
export { DomainAutoFieldsDialog };
/**
 * Creates and opens an auto fields selection dialog
 * @param parent The parent activity or fragment (optional)
 * @param onSelect Callback when fields are selected
 * @returns The dialog builder instance
 */
export function openAutoFieldsDialog(onSelect) {
    // Create the content component
    const content = new DomainAutoFieldsDialog();
    // Create the dialog using DialogBuilder
    const dialog = new DialogBuilder().setTitle('Add Auto Fields').setBody(content).setRenderAs('picker').setModal(true);
    // Listen for selection events
    content.addEventListener('select', (event) => {
        const { selectedFields } = event.detail;
        onSelect(selectedFields);
        dialog.close();
    });
    // Listen for cancel events
    content.addEventListener('cancel', () => {
        dialog.close();
    });
    // Open the dialog
    dialog.open();
    return dialog;
}
//# sourceMappingURL=domain-auto-fields-dialog.js.map