let notifyCounter = 0;
/**
 * 获取（或创建）固定通知容器，按位置分区
 */
function getContainer(position) {
    const containerClass = `hb-notification-container hb-notification-container--${position}`;
    let container = document.querySelector(`.${containerClass.replace(/\s+/g, '.')}`);
    if (!container) {
        container = document.createElement('div');
        container.className = containerClass;
        const isTop = position.startsWith('top');
        const isRight = position.endsWith('right');
        const cssText = [
            'position:fixed',
            isTop ? 'top:20px' : 'bottom:20px',
            isRight ? 'right:20px' : 'left:20px',
            'z-index:1100',
            'display:flex',
            'flex-direction:column',
            'gap:12px',
            'pointer-events:none',
        ].join(';');
        container.style.cssText = cssText;
        document.body.appendChild(container);
    }
    return container;
}
/**
 * 命令式 API：显示通知提醒
 * @example
 * import { notify } from 'huibo-ui/dist/components/Notification/notify.js';
 * notify({ title: '成功', message: '操作完成', type: 'success' });
 */
export function notify(options) {
    const position = options.position || 'top-right';
    const container = getContainer(position);
    const id = options.id || `hb-notification-${++notifyCounter}`;
    const el = document.createElement('hb-notification');
    el.id = id;
    el.type = options.type || 'info';
    el.title = options.title || '';
    el.message = options.message || '';
    el.duration = options.duration ?? 4500;
    el.position = position;
    el.showClose = options.showClose ?? true;
    // 关闭后自动从容器移除
    el.addEventListener('hbClose', () => {
        setTimeout(() => el.remove(), 300);
    });
    container.appendChild(el);
    return el;
}
//# sourceMappingURL=notify.js.map
