/**
 * @since Last modified: 2024-09-04 18:04:49
 * @function support
 * @description Determine if the browser supports the CSS and JavaScript features required by this UI framework..
 * @param {boolean} [useCont=false]  - Whether to use text prompts.
 * @param {function} [cb]  - Call back after confirm.
 * @returns {boolean} Return true or false.
 * @see {@link https://codepen.io/axui/pen/BagYyjN|demo @ codepen}
 * @example
 * ax.support();
 * <!--return boolean-->
 */
'use strict';
import { T_el, T_fn, T_sel } from '../../../types/ax';
import ax from '../ax';
import config from '../global/config';
import Drawer from '../modules/Drawer';
import createEl from './createEl';
import getDataType from './getDataType';
import getEl from './getEl';
import isEmpty from './isEmpty';
import storage from './storage';
import trim from './trim';
const support = (useCont: boolean = false,cb?:T_fn): boolean => {
    try {
        createEl('div').querySelector(':has');
    } catch (e) {
        if (useCont && !storage.get('AXUI_GOT_SUPPORT')) {
            new Drawer(undefined, {
                content: config.lang.support.content,
                footer: {
                    children: [
                        {
                            name: 'cancel',
                            label: config.lang.support.cancel,
                        },
                        {
                            name: 'confirm',
                            label: config.lang.support.confirm,
                        },
                    ]
                },
                onConfirm: () => {
                    storage.set('AXUI_GOT_SUPPORT', true);
                    cb && cb();
                }
            }).show();
        }
        return false;
    }
    return true;
}
export default support;
