{o[e]&&(o[e]={})},getSupportedLocales:H,isLocaleSupported:D,getLocaleName:Y,getLocaleDirection:N,getLocaleInfo:O,getAllLocaleInfo:()=>H().map(O),formatNumber:(e,t={})=>{try{return new Intl.NumberFormat(A,t).format(e)}catch(t){return e.toString()}},formatCurrency:(e,t="USD",n={})=>{try{return new Intl.NumberFormat(A,{style:"currency",currency:t,...n}).format(e)}catch(t){return e.toString()}},formatPercent:(e,t={})=>{try{return new Intl.NumberFormat(A,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:2,...t}).format(e/100)}catch(t){return`${e}%`}},formatDate:R,formatTime:(e,t={})=>R(e,{hour:"numeric",minute:"numeric",second:"numeric",...t}),formatRelativeTime:(e,t={})=>{try{const n=(e instanceof Date?e:new Date(e))-new Date,o=new Intl.RelativeTimeFormat(A,{numeric:"auto",...t}),i=[{unit:"year",ms:31536e6},{unit:"month",ms:2592e6},{unit:"week",ms:6048e5},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}];for(const{unit:e,ms:t}of i)if(Math.abs(n)>=t||"second"===e){const i=Math.round(n/t);return o.format(i,e)}return e.toString()}catch(t){return e.toString()}},formatList:(e,t={})=>{try{return new Intl.ListFormat(A,t).format(e)}catch(t){return e.join(", ")}},formatPlural:V,addLocaleListener:e=>(z.add(e),()=>{z.delete(e)}),removeLocaleListener:e=>{z.delete(e)},clearLocaleListeners:()=>{z.clear()},initI18n:()=>{const e=X();L(e)},saveLocale:q,loadLocale:X,getDefaultLocale:U};o["zh-CN"],o["en-US"];const G=new Map,K=(e,t="default")=>{const[n,o]=e;return"string"==typeof n?{...o,type:o?.type||t,message:n}:n&&"object"==typeof n?{...n,type:n.type||t}:{type:t,message:""}};class Z{static _hooks=new Map;static on(e,t){return this._hooks.has(e)||this._hooks.set(e,[]),this._hooks.get(e).push(t),()=>this.off(e,t)}static off(e,t){const n=this._hooks.get(e);n&&this._hooks.set(e,n.filter(e=>e!==t))}static trigger(e,t){const n=this._hooks.get(e);n&&n.forEach(e=>{try{e(t)}catch(e){}})}constructor(e){this.id=e.id||"met-"+Date.now().toString(36)+"-"+Math.random().toString(36).slice(2,8),this.type=e.type||"default",this.title=e.title||"",this.message=e.message??e.content??"",this.html=e.html||"",this.iconHTML=e.iconHTML||"",this.config={...i,...e},e.style&&"object"==typeof e.style&&(this.config.style={...e.style}),this.el=null,this.barEl=null,this.rafId=null,this.remaining=this.config.duration,this.startedAt=0,this.paused=!1,this.closing=!1,this._cleanups=[],this.group=e.group||null}_palette(){const e=(e=>m(e))(this.config.theme),t=r[this.type]||r.default,n=a[e]||a.light;return{theme:e,c:t,t:{bg:n.bg,border:n.border,shadow:n.shadow}}}create(){if("undefined"==typeof window||"undefined"==typeof document)return this;Z.trigger("beforeShow",this),((e=a.light)=>{if("undefined"==typeof document)return;if(l&&document.getElementById("metona-toast-styles"))return;const t=(e=>`\n /* MetonaToast 基础样式 */\n .met-container {\n pointer-events: none;\n display: flex;\n flex-direction: column;\n gap: 12px;\n box-sizing: border-box;\n padding: 24px;\n max-width: 100vw;\n position: fixed;\n z-index: 9999;\n }\n \n /* 位置样式 — 顶部位置用 column-reverse,新 toast 出现在最上方 */\n .met-container.top-left {\n top: 0;\n left: 0;\n align-items: flex-start;\n flex-direction: column-reverse;\n }\n \n .met-container.top-center {\n top: 0;\n left: 0;\n right: 0;\n align-items: center;\n flex-direction: column-reverse;\n }\n \n .met-container.top-right {\n top: 0;\n right: 0;\n align-items: flex-end;\n flex-direction: column-reverse;\n }\n \n .met-container.bottom-left {\n bottom: 0;\n left: 0;\n align-items: flex-start;\n flex-direction: column-reverse;\n }\n \n .met-container.bottom-center {\n bottom: 0;\n left: 0;\n right: 0;\n align-items: center;\n flex-direction: column-reverse;\n }\n \n .met-container.bottom-right {\n bottom: 0;\n right: 0;\n align-items: flex-end;\n flex-direction: column-reverse;\n }\n \n /* Toast基础样式 */\n .met-toast {\n position: relative;\n display: flex;\n align-items: flex-start;\n gap: 12px;\n padding: 14px 16px;\n border-radius: 12px;\n box-sizing: border-box;\n backdrop-filter: blur(14px) saturate(180%);\n -webkit-backdrop-filter: blur(14px) saturate(180%);\n font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;\n user-select: none;\n -webkit-user-select: none;\n transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), \n box-shadow 0.25s ease, \n opacity 0.25s ease;\n will-change: transform, opacity;\n flex-shrink: 0;\n pointer-events: auto;\n min-width: 240px;\n max-width: calc(100vw - 48px);\n width: 360px;\n border: 1px solid var(--met-border, rgba(0,0,0,0.06));\n background: var(--met-bg, rgba(255,255,255,0.96));\n color: var(--met-text, #1f2937);\n box-shadow: var(--met-shadow, 0 10px 36px -10px rgba(0,0,0,0.18), 0 4px 14px -4px rgba(0,0,0,0.08));\n }\n \n /* 悬停效果 */\n .met-toast:hover {\n box-shadow: var(--met-hover-shadow, 0 14px 48px -10px rgba(0,0,0,0.22), 0 6px 18px -4px rgba(0,0,0,0.10)) !important;\n }\n \n /* 可点击状态 */\n .met-toast.met-clickable {\n cursor: pointer;\n }\n \n /* 图标样式 */\n .met-icon {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n margin-top: 1px;\n }\n \n /* 内容样式 */\n .met-content {\n flex: 1;\n min-width: 0;\n word-wrap: break-word;\n overflow-wrap: break-word;\n }\n \n /* 标题样式 */\n .met-title {\n font-weight: 600;\n font-size: 14px;\n letter-spacing: 0.1px;\n }\n \n /* 消息样式 */\n .met-message {\n font-size: 13px;\n opacity: 0.85;\n margin-top: 2px;\n }\n \n /* 关闭按钮样式 */\n .met-close {\n flex-shrink: 0;\n background: transparent;\n border: 0;\n padding: 4px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 6px;\n transition: background 0.2s, color 0.2s;\n line-height: 0;\n color: inherit;\n opacity: 0.5;\n }\n \n .met-close:hover {\n opacity: 1;\n background: var(--met-close-hover-bg, rgba(0,0,0,0.06));\n }\n \n /* 进度条样式 - 水平 */\n .met-progress {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n height: 3px;\n overflow: hidden;\n background: var(--met-progress-bg, rgba(0,0,0,0.06));\n border-radius: 0 0 12px 12px;\n }\n \n /* 进度条样式 - 垂直 */\n .met-progress-v {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 3px;\n overflow: hidden;\n background: var(--met-progress-bg, rgba(0,0,0,0.06));\n border-radius: 12px 0 0 12px;\n }\n \n /* 进度条指示器 - 水平 */\n .met-bar {\n position: absolute;\n left: 0;\n top: 0;\n height: 100%;\n width: 100%;\n transform-origin: left;\n transform: scaleX(1);\n }\n \n /* 进度条指示器 - 垂直 */\n .met-bar-v {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n transform-origin: bottom;\n transform: scaleY(1);\n }\n \n /* 侧边指示器 */\n .met-side {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 4px;\n border-radius: 12px 0 0 12px;\n }\n \n /* 加载动画 */\n .met-spin {\n animation: met-rot 1s linear infinite;\n transform-origin: 50% 50%;\n }\n \n /* 离开状态 */\n .met-toast.met-leaving {\n pointer-events: none;\n z-index: 1;\n }\n \n /* 动画关键帧 */\n @keyframes met-rot {\n to {\n transform: rotate(360deg);\n }\n }\n \n /* === 进入动画:初始隐藏态 === */\n .met-anim-slide.met-toast,\n .met-anim-fade.met-toast,\n .met-anim-scale.met-toast,\n .met-anim-bounce.met-toast,\n .met-anim-flip.met-toast,\n .met-anim-rotate.met-toast,\n .met-anim-zoom.met-toast,\n .met-anim-slideUp.met-toast,\n .met-anim-slideDown.met-toast,\n .met-anim-slideLeft.met-toast,\n .met-anim-slideRight.met-toast {\n opacity: 0;\n }\n \n /* === 进入动画:@keyframes 定义 === */\n @keyframes met-slide-in {\n 0% { transform: translateX(80px); opacity: 0; }\n 65% { transform: translateX(-6px); opacity: 1; }\n 100% { transform: translateX(0); opacity: 1; }\n }\n @keyframes met-fade-in {\n 0% { opacity: 0; filter: blur(3px); }\n 100% { opacity: 1; filter: blur(0); }\n }\n @keyframes met-scale-in {\n 0% { transform: scale(0.55); opacity: 0; }\n 65% { transform: scale(1.07); opacity: 1; }\n 100% { transform: scale(1); opacity: 1; }\n }\n @keyframes met-bounce-in {\n 0% { transform: translateY(-80px); opacity: 0; animation-timing-function: ease-in; }\n 45% { transform: translateY(14px); opacity: 1; animation-timing-function: ease-out; }\n 65% { transform: translateY(-12px); animation-timing-function: ease-in; }\n 82% { transform: translateY(4px); animation-timing-function: ease-out; }\n 100% { transform: translateY(0); opacity: 1; }\n }\n @keyframes met-flip-in {\n 0% { transform: perspective(500px) rotateX(-90deg); opacity: 0; }\n 60% { transform: perspective(500px) rotateX(8deg); opacity: 1; }\n 85% { transform: perspective(500px) rotateX(-2deg); }\n 100% { transform: perspective(500px) rotateX(0); opacity: 1; }\n }\n @keyframes met-rotate-in {\n 0% { transform: rotate(-25deg) scale(0.6); opacity: 0; }\n 60% { transform: rotate(4deg) scale(1.05); opacity: 1; }\n 85% { transform: rotate(-1deg) scale(0.98); }\n 100% { transform: rotate(0) scale(1); opacity: 1; }\n }\n @keyframes met-zoom-in {\n 0% { transform: scale(0.1); opacity: 0; }\n 50% { transform: scale(1.12); opacity: 1; }\n 75% { transform: scale(0.94); }\n 100% { transform: scale(1); opacity: 1; }\n }\n @keyframes met-slideUp-in {\n 0% { transform: translateY(60px); opacity: 0; }\n 70% { transform: translateY(-6px); opacity: 1; }\n 100% { transform: translateY(0); opacity: 1; }\n }\n @keyframes met-slideDown-in {\n 0% { transform: translateY(-60px); opacity: 0; }\n 70% { transform: translateY(6px); opacity: 1; }\n 100% { transform: translateY(0); opacity: 1; }\n }\n @keyframes met-slideLeft-in {\n 0% { transform: translateX(-90px); opacity: 0; }\n 65% { transform: translateX(6px); opacity: 1; }\n 100% { transform: translateX(0); opacity: 1; }\n }\n @keyframes met-slideRight-in {\n 0% { transform: translateX(90px); opacity: 0; }\n 65% { transform: translateX(-6px); opacity: 1; }\n 100% { transform: translateX(0); opacity: 1; }\n }\n \n /* === 进入动画:绑定到 .met-show === */\n .met-anim-slide.met-toast.met-show { animation: met-slide-in 0.40s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n .met-anim-fade.met-toast.met-show { animation: met-fade-in 0.50s ease forwards; }\n .met-anim-scale.met-toast.met-show { animation: met-scale-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }\n .met-anim-bounce.met-toast.met-show { animation: met-bounce-in 0.65s ease forwards; }\n .met-anim-flip.met-toast.met-show { animation: met-flip-in 0.50s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n .met-anim-rotate.met-toast.met-show { animation: met-rotate-in 0.50s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n .met-anim-zoom.met-toast.met-show { animation: met-zoom-in 0.50s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }\n .met-anim-slideUp.met-toast.met-show { animation: met-slideUp-in 0.40s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n .met-anim-slideDown.met-toast.met-show { animation: met-slideDown-in 0.40s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n .met-anim-slideLeft.met-toast.met-show { animation: met-slideLeft-in 0.40s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n .met-anim-slideRight.met-toast.met-show { animation: met-slideRight-in 0.40s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }\n \n /* 响应式设计 */\n @media (prefers-reduced-motion: reduce) {\n .met-toast {\n transition: opacity 0.15s !important;\n }\n \n .met-toast.met-show {\n animation: none !important;\n opacity: 1 !important;\n }\n \n .met-spin {\n animation-duration: 2.5s !important;\n }\n }\n \n @media (max-width: 480px) {\n .met-container {\n padding: 12px !important;\n }\n \n .met-toast {\n width: 100% !important;\n min-width: 0 !important;\n }\n }\n \n /* 暗色主题特定样式 */\n .met-toast.met-theme-dark {\n background: rgba(28, 32, 40, 0.94);\n color: #e6e8eb;\n border-color: rgba(255, 255, 255, 0.08);\n box-shadow: 0 10px 36px -10px rgba(0, 0, 0, 0.6), \n 0 4px 14px -4px rgba(0, 0, 0, 0.4);\n }\n \n .met-toast.met-theme-dark:hover {\n box-shadow: 0 14px 48px -8px rgba(0, 0, 0, 0.6), \n 0 6px 18px -4px rgba(0, 0, 0, 0.4) !important;\n }\n \n .met-toast.met-theme-dark .met-close:hover {\n background: rgba(255, 255, 255, 0.08);\n }\n \n .met-toast.met-theme-dark .met-progress,\n .met-toast.met-theme-dark .met-progress-v {\n background: rgba(255, 255, 255, 0.08);\n }\n \n /* 亮色主题特定样式 */\n .met-toast.met-theme-light {\n background: rgba(255, 255, 255, 0.96);\n color: #1f2937;\n border-color: rgba(0, 0, 0, 0.06);\n box-shadow: 0 10px 36px -10px rgba(0, 0, 0, 0.18), \n 0 4px 14px -4px rgba(0, 0, 0, 0.08);\n }\n \n .met-toast.met-theme-light:hover {\n box-shadow: 0 14px 48px -10px rgba(0, 0, 0, 0.22), \n 0 6px 18px -4px rgba(0, 0, 0, 0.10) !important;\n }\n \n .met-toast.met-theme-light .met-close:hover {\n background: rgba(0, 0, 0, 0.06);\n }\n \n .met-toast.met-theme-light .met-progress,\n .met-toast.met-theme-light .met-progress-v {\n background: rgba(0, 0, 0, 0.06);\n }\n \n /* 自定义主题支持 */\n .met-toast[data-theme] {\n --met-bg: var(--met-theme-bg);\n --met-text: var(--met-theme-text);\n --met-border: var(--met-theme-border);\n --met-shadow: var(--met-theme-shadow);\n }\n \n /* 动画性能优化 */\n .met-toast {\n backface-visibility: hidden;\n -webkit-backface-visibility: hidden;\n perspective: 1000;\n }\n \n /* 滚动条样式 */\n .met-container::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n }\n \n .met-container::-webkit-scrollbar-track {\n background: transparent;\n }\n \n .met-container::-webkit-scrollbar-thumb {\n background: rgba(0, 0, 0, 0.2);\n border-radius: 3px;\n }\n \n .met-container::-webkit-scrollbar-thumb:hover {\n background: rgba(0, 0, 0, 0.3);\n }\n \n /* 打印样式 */\n @media print {\n .met-container {\n display: none !important;\n }\n .met-toast {\n display: none !important;\n }\n }\n \n /* 高对比度模式 */\n @media (forced-colors: active) {\n .met-toast {\n border: 2px solid ButtonText;\n }\n \n .met-close {\n border: 1px solid ButtonText;\n }\n }\n \n /* 焦点样式 */\n .met-toast:focus-visible {\n outline: 2px solid #3b82f6;\n outline-offset: 2px;\n }\n \n .met-close:focus-visible {\n outline: 2px solid #3b82f6;\n outline-offset: 2px;\n }\n \n /* 禁用状态 */\n .met-toast:disabled,\n .met-toast[disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n }\n \n /* 加载状态 */\n .met-toast.met-loading {\n cursor: wait;\n }\n \n /* 成功状态 */\n .met-toast.met-success {\n border-left: 4px solid #10b981;\n }\n \n /* 错误状态 */\n .met-toast.met-error {\n border-left: 4px solid #ef4444;\n }\n \n /* 警告状态 */\n .met-toast.met-warning {\n border-left: 4px solid #f59e0b;\n }\n \n /* 信息状态 */\n .met-toast.met-info {\n border-left: 4px solid #3b82f6;\n }\n \n /* 加载状态 */\n .met-toast.met-loading {\n border-left: 4px solid #6366f1;\n }\n \n /* 进度条动画 */\n .met-bar,\n .met-bar-v {\n transition: transform 0.1s linear;\n }\n \n /* 容器动画 */\n .met-container {\n transition: all 0.3s ease;\n }\n \n /* Toast进入动画 */\n .met-toast.met-enter {\n animation: met-enter 0.3s ease forwards;\n }\n \n /* Toast离开动画 */\n .met-toast.met-leave {\n animation: met-leave 0.3s ease forwards;\n }\n \n @keyframes met-enter {\n from {\n opacity: 0;\n transform: translateY(-20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n \n @keyframes met-leave {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-20px);\n }\n }\n \n /* 响应式字体大小 */\n @media (max-width: 768px) {\n .met-toast {\n font-size: 13px;\n }\n \n .met-title {\n font-size: 13px;\n }\n \n .met-message {\n font-size: 12px;\n }\n }\n \n @media (max-width: 480px) {\n .met-toast {\n font-size: 12px;\n padding: 12px 14px;\n }\n \n .met-title {\n font-size: 12px;\n }\n \n .met-message {\n font-size: 11px;\n }\n }\n \n /* 无障碍支持 */\n .met-toast[role="alert"] {\n /* 警告类型Toast的特殊样式 */\n }\n \n .met-toast[role="status"] {\n /* 状态类型Toast的特殊样式 */\n }\n \n /* 高对比度模式增强 */\n @media (prefers-contrast: high) {\n .met-toast {\n border-width: 2px;\n }\n \n .met-close {\n border: 1px solid currentColor;\n }\n }\n \n /* 暗色模式自动检测 */\n @media (prefers-color-scheme: dark) {\n .met-theme-auto .met-toast {\n background: rgba(28, 32, 40, 0.94);\n color: #e6e8eb;\n border-color: rgba(255, 255, 255, 0.08);\n box-shadow: 0 10px 36px -10px rgba(0, 0, 0, 0.6), \n 0 4px 14px -4px rgba(0, 0, 0, 0.4);\n }\n \n .met-theme-auto .met-toast:hover {\n box-shadow: 0 14px 48px -8px rgba(0, 0, 0, 0.6), \n 0 6px 18px -4px rgba(0, 0, 0, 0.4) !important;\n }\n \n .met-theme-auto .met-close:hover {\n background: rgba(255, 255, 255, 0.08);\n }\n \n .met-theme-auto .met-progress,\n .met-theme-auto .met-progress-v {\n background: rgba(255, 255, 255, 0.08);\n }\n }\n \n /* 亮色模式自动检测 */\n @media (prefers-color-scheme: light) {\n .met-theme-auto .met-toast {\n background: rgba(255, 255, 255, 0.96);\n color: #1f2937;\n border-color: rgba(0, 0, 0, 0.06);\n box-shadow: 0 10px 36px -10px rgba(0, 0, 0, 0.18), \n 0 4px 14px -4px rgba(0, 0, 0, 0.08);\n }\n \n .met-theme-auto .met-toast:hover {\n box-shadow: 0 14px 48px -10px rgba(0, 0, 0, 0.22), \n 0 6px 18px -4px rgba(0, 0, 0, 0.10) !important;\n }\n \n .met-theme-auto .met-close:hover {\n background: rgba(0, 0, 0, 0.06);\n }\n \n .met-theme-auto .met-progress,\n .met-theme-auto .met-progress-v {\n background: rgba(0, 0, 0, 0.06);\n }\n }\n \n /* 动画性能优化 */\n .met-toast {\n transform: translateZ(0);\n -webkit-transform: translateZ(0);\n }\n \n /* 触摸设备优化 */\n @media (hover: none) {\n .met-toast:hover {\n box-shadow: inherit;\n }\n }\n \n /* 滚动时固定位置 */\n .met-container {\n position: fixed;\n z-index: 9999;\n }\n \n /* 全屏模式 */\n :fullscreen .met-container {\n z-index: 2147483647;\n }\n \n /* 画中画模式 */\n :picture-in-picture .met-container {\n z-index: 2147483647;\n }\n \n /* 安全区域适配 */\n @supports (padding: max(0px)) {\n .met-container {\n padding: max(24px, env(safe-area-inset-top)) \n max(24px, env(safe-area-inset-right)) \n max(24px, env(safe-area-inset-bottom)) \n max(24px, env(safe-area-inset-left));\n }\n }\n \n /* 暗色模式安全区域 */\n @media (prefers-color-scheme: dark) {\n @supports (padding: max(0px)) {\n .met-container {\n padding: max(24px, env(safe-area-inset-top)) \n max(24px, env(safe-area-inset-right)) \n max(24px, env(safe-area-inset-bottom)) \n max(24px, env(safe-area-inset-left));\n }\n }\n }\n \n /* 高分辨率屏幕优化 */\n @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {\n .met-toast {\n border-width: 0.5px;\n }\n }\n \n /* 触摸设备优化 */\n @media (hover: none) and (pointer: coarse) {\n .met-toast {\n min-height: 48px;\n }\n \n .met-close {\n min-width: 48px;\n min-height: 48px;\n }\n }\n \n /* 键盘导航优化 */\n .met-toast:focus {\n outline: 2px solid #3b82f6;\n outline-offset: 2px;\n }\n \n .met-toast:focus:not(:focus-visible) {\n outline: none;\n }\n \n .met-toast:focus-visible {\n outline: 2px solid #3b82f6;\n outline-offset: 2px;\n }\n \n /* 减少动画模式 */\n @media (prefers-reduced-motion: reduce) {\n .met-toast {\n transition: opacity 0.15s ease !important;\n animation: none !important;\n }\n \n .met-bar,\n .met-bar-v {\n transition: none !important;\n }\n \n .met-container {\n transition: none !important;\n }\n }\n \n /* 高对比度模式 */\n @media (prefers-contrast: high) {\n .met-toast {\n border-width: 3px;\n border-style: solid;\n }\n \n .met-close {\n border: 2px solid currentColor;\n border-radius: 4px;\n }\n \n .met-progress,\n .met-progress-v {\n height: 4px;\n }\n \n .met-bar,\n .met-bar-v {\n height: 100%;\n }\n }\n \n /* 低分辨率屏幕优化 */\n @media (max-resolution: 1dppx) {\n .met-toast {\n border-width: 1px;\n }\n }\n \n /* 触摸设备优化 */\n @media (hover: none) and (pointer: coarse) {\n .met-toast {\n min-height: 52px;\n padding: 16px 18px;\n }\n \n .met-close {\n min-width: 52px;\n min-height: 52px;\n padding: 8px;\n }\n \n .met-icon {\n width: 28px;\n height: 28px;\n }\n }\n \n /* 大屏幕优化 */\n @media (min-width: 1200px) {\n .met-toast {\n width: 400px;\n }\n }\n \n /* 超大屏幕优化 */\n @media (min-width: 1920px) {\n .met-toast {\n width: 440px;\n }\n }\n \n /* 小屏幕优化 */\n @media (max-width: 320px) {\n .met-toast {\n width: 100%;\n min-width: 0;\n padding: 12px 14px;\n }\n \n .met-container {\n padding: 8px;\n }\n }\n \n /* 横屏优化 */\n @media (orientation: landscape) and (max-height: 500px) {\n .met-container {\n padding: 12px 24px;\n }\n \n .met-toast {\n min-height: 44px;\n padding: 10px 14px;\n }\n }\n \n /* 竖屏优化 */\n @media (orientation: portrait) and (max-width: 500px) {\n .met-container {\n padding: 12px;\n }\n \n .met-toast {\n width: 100%;\n min-width: 0;\n }\n }\n \n /* 无障碍支持 */\n .met-toast[aria-live="assertive"] {\n /* 紧急通知样式 */\n }\n \n .met-toast[aria-live="polite"] {\n /* 普通通知样式 */\n }\n \n /* 焦点陷阱 */\n .met-toast:focus-within {\n /* 包含焦点元素的Toast样式 */\n }\n \n /* 加载状态 */\n .met-toast[aria-busy="true"] {\n cursor: wait;\n }\n \n /* 禁用状态 */\n .met-toast[aria-disabled="true"] {\n opacity: 0.5;\n cursor: not-allowed;\n pointer-events: none;\n }\n \n /* 隐藏状态 */\n .met-toast[aria-hidden="true"] {\n display: none;\n }\n \n /* 展开状态 */\n .met-toast[aria-expanded="true"] {\n /* 展开状态样式 */\n }\n \n /* 选中状态 */\n .met-toast[aria-selected="true"] {\n /* 选中状态样式 */\n }\n \n /* 按下状态 */\n .met-toast:active {\n transform: scale(0.98);\n }\n \n /* 加载状态动画 */\n .met-toast.met-loading::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: linear-gradient(\n 90deg,\n transparent,\n rgba(255, 255, 255, 0.1),\n transparent\n );\n animation: met-loading 1.5s infinite;\n }\n \n @keyframes met-loading {\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(100%);\n }\n }\n \n /* 成功状态动画 */\n .met-toast.met-success::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 4px;\n height: 100%;\n background: #10b981;\n border-radius: 12px 0 0 12px;\n animation: met-success 0.3s ease;\n }\n \n @keyframes met-success {\n from {\n transform: scaleY(0);\n }\n to {\n transform: scaleY(1);\n }\n }\n \n /* 错误状态动画 */\n .met-toast.met-error::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 4px;\n height: 100%;\n background: #ef4444;\n border-radius: 12px 0 0 12px;\n animation: met-error 0.3s ease;\n }\n \n @keyframes met-error {\n from {\n transform: scaleY(0);\n }\n to {\n transform: scaleY(1);\n }\n }\n \n /* 警告状态动画 */\n .met-toast.met-warning::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 4px;\n height: 100%;\n background: #f59e0b;\n border-radius: 12px 0 0 12px;\n animation: met-warning 0.3s ease;\n }\n \n @keyframes met-warning {\n from {\n transform: scaleY(0);\n }\n to {\n transform: scaleY(1);\n }\n }\n \n /* 信息状态动画 */\n .met-toast.met-info::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 4px;\n height: 100%;\n background: #3b82f6;\n border-radius: 12px 0 0 12px;\n animation: met-info 0.3s ease;\n }\n \n @keyframes met-info {\n from {\n transform: scaleY(0);\n }\n to {\n transform: scaleY(1);\n }\n }\n \n /* 加载状态动画 */\n .met-toast.met-loading::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 4px;\n height: 100%;\n background: #6366f1;\n border-radius: 12px 0 0 12px;\n animation: met-loading-bar 1s infinite;\n }\n \n @keyframes met-loading-bar {\n 0% {\n transform: scaleY(0);\n transform-origin: top;\n }\n 50% {\n transform: scaleY(1);\n transform-origin: top;\n }\n 51% {\n transform-origin: bottom;\n }\n 100% {\n transform: scaleY(0);\n transform-origin: bottom;\n }\n }\n \n /* 进度条脉冲动画 */\n .met-bar,\n .met-bar-v {\n animation: met-pulse 2s infinite;\n }\n \n @keyframes met-pulse {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.8;\n }\n }\n \n /* Toast堆叠效果 */\n .met-toast + .met-toast {\n margin-top: 8px;\n }\n \n /* Toast分组 */\n .met-toast-group {\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n \n /* Toast头部 */\n .met-toast-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n \n /* Toast底部 */\n .met-toast-footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n margin-top: 12px;\n }\n \n /* Toast操作按钮 */\n .met-toast-action {\n background: transparent;\n border: 1px solid currentColor;\n padding: 6px 12px;\n border-radius: 6px;\n cursor: pointer;\n font-size: 12px;\n opacity: 0.7;\n transition: opacity 0.2s;\n }\n \n .met-toast-action:hover {\n opacity: 1;\n }\n \n /* Toast进度文本 */\n .met-toast-progress-text {\n font-size: 12px;\n opacity: 0.7;\n margin-left: 8px;\n }\n \n /* Toast时间戳 */\n .met-toast-timestamp {\n font-size: 11px;\n opacity: 0.5;\n margin-left: auto;\n }\n \n /* Toast头像 */\n .met-toast-avatar {\n width: 32px;\n height: 32px;\n border-radius: 50%;\n object-fit: cover;\n flex-shrink: 0;\n }\n \n /* Toast图片 */\n .met-toast-image {\n max-width: 100%;\n max-height: 200px;\n border-radius: 8px;\n margin-top: 8px;\n object-fit: cover;\n }\n \n /* Toast视频 */\n .met-toast-video {\n max-width: 100%;\n max-height: 200px;\n border-radius: 8px;\n margin-top: 8px;\n }\n \n /* Toast音频 */\n .met-toast-audio {\n width: 100%;\n margin-top: 8px;\n }\n \n /* Toast代码块 */\n .met-toast-code {\n background: rgba(0, 0, 0, 0.05);\n padding: 8px 12px;\n border-radius: 6px;\n font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;\n font-size: 12px;\n margin-top: 8px;\n overflow-x: auto;\n }\n \n .met-theme-dark .met-toast-code {\n background: rgba(255, 255, 255, 0.05);\n }\n \n /* Toast引用 */\n .met-toast-quote {\n border-left: 3px solid currentColor;\n padding-left: 12px;\n margin-top: 8px;\n opacity: 0.8;\n }\n \n /* Toast列表 */\n .met-toast-list {\n margin: 8px 0 0 0;\n padding-left: 20px;\n }\n \n .met-toast-list li {\n margin-bottom: 4px;\n }\n \n /* Toast表格 */\n .met-toast-table {\n width: 100%;\n border-collapse: collapse;\n margin-top: 8px;\n font-size: 12px;\n }\n \n .met-toast-table th,\n .met-toast-table td {\n border: 1px solid rgba(0, 0, 0, 0.1);\n padding: 6px 8px;\n text-align: left;\n }\n \n .met-theme-dark .met-toast-table th,\n .met-theme-dark .met-toast-table td {\n border-color: rgba(255, 255, 255, 0.1);\n }\n \n .met-toast-table th {\n background: rgba(0, 0, 0, 0.05);\n font-weight: 600;\n }\n \n .met-theme-dark .met-toast-table th {\n background: rgba(255, 255, 255, 0.05);\n }\n \n /* Toast分割线 */\n .met-toast-divider {\n height: 1px;\n background: rgba(0, 0, 0, 0.1);\n margin: 12px 0;\n }\n \n .met-theme-dark .met-toast-divider {\n background: rgba(255, 255, 255, 0.1);\n }\n \n /* Toast标签 */\n .met-toast-tag {\n display: inline-block;\n background: rgba(0, 0, 0, 0.05);\n padding: 2px 8px;\n border-radius: 4px;\n font-size: 11px;\n margin-right: 4px;\n margin-bottom: 4px;\n }\n \n .met-theme-dark .met-toast-tag {\n background: rgba(255, 255, 255, 0.05);\n }\n \n /* Toast徽章 */\n .met-toast-badge {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: #3b82f6;\n color: white;\n padding: 2px 8px;\n border-radius: 10px;\n font-size: 11px;\n font-weight: 600;\n min-width: 20px;\n height: 20px;\n }\n \n /* Toast进度环 */\n .met-toast-progress-ring {\n width: 40px;\n height: 40px;\n transform: rotate(-90deg);\n }\n \n .met-toast-progress-ring circle {\n fill: none;\n stroke-width: 3;\n stroke-linecap: round;\n }\n \n .met-toast-progress-ring .met-progress-ring-bg {\n stroke: rgba(0, 0, 0, 0.1);\n }\n \n .met-theme-dark .met-toast-progress-ring .met-progress-ring-bg {\n stroke: rgba(255, 255, 255, 0.1);\n }\n \n .met-toast-progress-ring .met-progress-ring-fill {\n stroke: #3b82f6;\n stroke-dasharray: 100;\n stroke-dashoffset: 100;\n transition: stroke-dashoffset 0.3s ease;\n }\n \n /* Toast滑块 */\n .met-toast-slider {\n width: 100%;\n height: 4px;\n background: rgba(0, 0, 0, 0.1);\n border-radius: 2px;\n margin-top: 8px;\n position: relative;\n }\n \n .met-theme-dark .met-toast-slider {\n background: rgba(255, 255, 255, 0.1);\n }\n \n .met-toast-slider-fill {\n position: absolute;\n left: 0;\n top: 0;\n height: 100%;\n background: #3b82f6;\n border-radius: 2px;\n transition: width 0.3s ease;\n }\n \n /* Toast开关 */\n .met-toast-switch {\n position: relative;\n display: inline-block;\n width: 36px;\n height: 20px;\n margin-top: 8px;\n }\n \n .met-toast-switch input {\n opacity: 0;\n width: 0;\n height: 0;\n }\n \n .met-toast-switch-slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.1);\n border-radius: 20px;\n transition: 0.3s;\n }\n \n .met-theme-dark .met-toast-switch-slider {\n background: rgba(255, 255, 255, 0.1);\n }\n \n .met-toast-switch-slider:before {\n content: '';\n position: absolute;\n height: 16px;\n width: 16px;\n left: 2px;\n bottom: 2px;\n background: white;\n border-radius: 50%;\n transition: 0.3s;\n }\n \n .met-toast-switch input:checked + .met-toast-switch-slider {\n background: #3b82f6;\n }\n \n .met-toast-switch input:checked + .met-toast-switch-slider:before {\n transform: translateX(16px);\n }\n \n /* Toast复选框 */\n .met-toast-checkbox {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-top: 8px;\n cursor: pointer;\n }\n \n .met-toast-checkbox input {\n width: 16px;\n height: 16px;\n cursor: pointer;\n }\n \n /* Toast单选框 */\n .met-toast-radio {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-top: 8px;\n cursor: pointer;\n }\n \n .met-toast-radio input {\n width: 16px;\n height: 16px;\n cursor: pointer;\n }\n \n /* Toast输入框 */\n .met-toast-input {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-radius: 6px;\n font-size: 13px;\n margin-top: 8px;\n background: transparent;\n color: inherit;\n }\n \n .met-theme-dark .met-toast-input {\n border-color: rgba(255, 255, 255, 0.1);\n }\n \n .met-toast-input:focus {\n outline: none;\n border-color: #3b82f6;\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);\n }\n \n /* Toast文本域 */\n .met-toast-textarea {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-radius: 6px;\n font-size: 13px;\n margin-top: 8px;\n background: transparent;\n color: inherit;\n resize: vertical;\n min-height: 80px;\n }\n \n .met-theme-dark .met-toast-textarea {\n border-color: rgba(255, 255, 255, 0.1);\n }\n \n .met-toast-textarea:focus {\n outline: none;\n border-color: #3b82f6;\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);\n }\n \n /* Toast选择框 */\n .met-toast-select {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-radius: 6px;\n font-size: 13px;\n margin-top: 8px;\n background: transparent;\n color: inherit;\n cursor: pointer;\n }\n \n .met-theme-dark .met-toast-select {\n border-color: rgba(255, 255, 255, 0.1);\n }\n \n .met-toast-select:focus {\n outline: none;\n border-color: #3b82f6;\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);\n }\n \n /* Toast下拉菜单 */\n .met-toast-dropdown {\n position: relative;\n display: inline-block;\n }\n \n .met-toast-dropdown-content {\n display: none;\n position: absolute;\n background: ${e.bg};\n min-width: 160px;\n box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);\n border-radius: 8px;\n z-index: 1;\n padding: 8px 0;\n margin-top: 4px;\n }\n \n .met-theme-dark .met-toast-dropdown-content {\n box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);\n }\n \n .met-toast-dropdown:hover .met-toast-dropdown-content {\n display: block;\n }\n \n .met-toast-dropdown-item {\n padding: 8px 16px;\n cursor: pointer;\n font-size: 13px;\n }\n \n .met-toast-dropdown-item:hover {\n background: rgba(0, 0, 0, 0.05);\n }\n \n .met-theme-dark .met-toast-dropdown-item:hover {\n background: rgba(255, 255, 255, 0.05);\n }\n \n /* Toast工具提示 */\n .met-toast-tooltip {\n position: relative;\n display: inline-block;\n }\n \n .met-toast-tooltip .met-toast-tooltip-text {\n visibility: hidden;\n width: 120px;\n background: ${e.bg};\n color: ${e.text};\n text-align: center;\n border-radius: 6px;\n padding: 6px 8px;\n position: absolute;\n z-index: 1;\n bottom: 125%;\n left: 50%;\n margin-left: -60px;\n opacity: 0;\n transition: opacity 0.3s;\n font-size: 12px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);\n }\n \n .met-theme-dark .met-toast-tooltip .met-toast-tooltip-text {\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);\n }\n \n .met-toast-tooltip:hover .met-toast-tooltip-text {\n visibility: visible;\n opacity: 1;\n }\n \n /* Toast弹出框 */\n .met-toast-popover {\n position: relative;\n display: inline-block;\n }\n \n .met-toast-popover .met-toast-popover-content {\n visibility: hidden;\n background: ${e.bg};\n color: ${e.text};\n border-radius: 8px;\n padding: 12px 16px;\n position: absolute;\n z-index: 1;\n bottom: 125%;\n left: 50%;\n transform: translateX(-50%);\n opacity: 0;\n transition: opacity 0.3s;\n min-width: 200px;\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);\n }\n \n .met-theme-dark .met-toast-popover .met-toast-popover-content {\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);\n }\n \n .met-toast-popover:hover .met-toast-popover-content {\n visibility: visible;\n opacity: 1;\n }\n \n /* Toast模态框 */\n .met-toast-modal {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10000;\n }\n \n .met-toast-modal-content {\n background: ${e.bg};\n color: ${e.text};\n border-radius: 12px;\n padding: 24px;\n max-width: 500px;\n width: 90%;\n max-height: 80vh;\n overflow-y: auto;\n }\n \n /* Toast抽屉 */\n .met-toast-drawer {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10000;\n }\n \n .met-toast-drawer-content {\n position: absolute;\n top: 0;\n right: 0;\n width: 300px;\n height: 100%;\n background: ${e.bg};\n color: ${e.text};\n padding: 24px;\n transform: translateX(100%);\n transition: transform 0.3s ease;\n }\n \n .met-toast-drawer.open .met-toast-drawer-content {\n transform: translateX(0);\n }\n \n /* Toast通知栏 */\n .met-toast-notification-bar {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n background: ${e.bg};\n color: ${e.text};\n padding: 12px 24px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n z-index: 9999;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n }\n \n /* Toast状态栏 */\n .met-toast-status-bar {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n background: ${e.bg};\n color: ${e.text};\n padding: 8px 24px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n z-index: 9999;\n font-size: 12px;\n box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);\n }\n `)(e);l=document.createElement("style"),l.id="metona-toast-styles",l.textContent=t.replace(/\s+/g," "),document.head.appendChild(l)})();const e=this._getContainer(),{theme:t,c:n,t:o}=this._palette();this._limitToasts(e);const i=document.createElement("div");if(i.className=this._buildClassName(t),i.setAttribute("role","error"===this.type||"warning"===this.type?"alert":"status"),i.setAttribute("aria-live","error"===this.type?"assertive":"polite"),i.dataset.id=this.id,this._applyStyles(i,t,o),this._buildContent(i,n),this.el=i,(this.config.position||"top-right").startsWith("top")?e.insertBefore(i,e.firstChild):e.appendChild(i),this._bindEvents(i),this._startTimer(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i.classList.add("met-show")})}),"function"==typeof this.config.onShow)try{this.config.onShow(this)}catch(e){}return Z.trigger("afterShow",this),this}_getContainer(){const e=this.config.position||"top-right",t=this.config.zIndex||9999;if(G.has(document.body)){const t=G.get(document.body);if(t.has(e))return t.get(e)}else G.set(document.body,new Map);const n=document.createElement("div");return n.className=`met-container ${e}`,n.setAttribute("aria-label","Notifications"),n.setAttribute("role","region"),n.style.cssText=`\n display:flex;\n flex-direction:column;\n gap:${this.config.gap||12}px;\n box-sizing:border-box;\n padding:${this.config.offset||24}px;\n max-width:100vw;\n position:fixed;\n z-index:${t};\n pointer-events:none;\n ${{"top-left":"top:0;left:0;align-items:flex-start","top-center":"top:0;left:0;right:0;align-items:center","top-right":"top:0;right:0;align-items:flex-end","bottom-left":"bottom:0;left:0;align-items:flex-start","bottom-center":"bottom:0;left:0;right:0;align-items:center","bottom-right":"bottom:0;right:0;align-items:flex-end"}[e]||"top:0;right:0;align-items:flex-end"}\n `,document.body.appendChild(n),G.get(document.body).set(e,n),n}_limitToasts(e){const t=this.config.max||6,n=Array.from(e.querySelectorAll(".met-toast"));if(n.length>=t){const e=n[0],t=e&&e.dataset.id;if(t){const e=oe._toasts.get(t);e&&e.close(!0)}}}_buildClassName(e){const t=["slide","fade","scale","bounce","flip","rotate","zoom","slideUp","slideDown","slideLeft","slideRight"].includes(this.config.animation)?this.config.animation:"slide";return["met-toast",`met-${this.type}`,`met-theme-${e}`,`met-anim-${t}`,this.config.closeOnClick||this.config.draggable?"met-clickable":"",this.config.className||""].filter(Boolean).join(" ")}_applyStyles(e,t,n){const o="number"==typeof this.config.width?`${this.config.width}px`:"string"==typeof this.config.width?this.config.width:"360px",i=(t,n)=>e.style.setProperty(t,n,"important");i("position","relative"),i("flex-shrink","0"),i("min-width","240px"),i("max-width","calc(100vw - 48px)"),i("width",o),this.config.style&&Object.keys(this.config.style).length>0&&Object.entries(this.config.style).forEach(([t,n])=>{e.style[t]=n})}_buildContent(e,o){if("function"==typeof this.config.render)return e.innerHTML=this.config.render(this),void(this.barEl=e.querySelector(".met-bar, .met-bar-v"));const i=!1!==this.config.icon&&(this.iconHTML||n[this.type]),r=!1!==this.config.closeButton,s=!1!==this.config.showProgress&&this.config.duration>0,a=!i&&"default"!==this.type,l=this.title?`${t(this.title)}
`:"",c=this.html?`${this.html}
`:this.message?`${t(this.message)}
`:"",d=i?`${this.iconHTML||n[this.type]}
`:"",h=r?``:"",g=s?"vertical"===this.config.progressDirection?``:``:"",p=a?``:"";e.innerHTML=`\n ${d}\n ${p}\n \n ${l}\n ${c}\n
\n ${h}\n ${g}\n `,this.barEl=e.querySelector(".met-bar, .met-bar-v")}_bindEvents(e){const t=e=>{const t=e.target;if(t.closest(".met-close"))return e.stopPropagation(),void this.close();if(!this.config.closeOnClick||t.closest(".met-close"));else{if("function"==typeof this.config.onClick)try{this.config.onClick(this)}catch(e){}this.close()}};if(e.addEventListener("click",t),this._cleanups.push(()=>e.removeEventListener("click",t)),this.config.pauseOnHover&&this.config.duration>0){const t=()=>this._pause(),n=()=>this._resume();e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n),this._cleanups.push(()=>{e.removeEventListener("mouseenter",t),e.removeEventListener("mouseleave",n)})}this.config.draggable&&this._bindDrag(e)}_bindDrag(e){let t=0,n=0,o=0,i=0,r=!1;const s=o=>{o.target.closest(".met-close")||(r=!0,t=o.clientX,n=o.clientY,e.setPointerCapture(o.pointerId),e.style.transition="none",this._pause())},a=s=>{r&&(o=s.clientX-t,i=s.clientY-n,e.style.transform=`translate(${o}px, ${i}px) rotate(${.1*o}deg)`,e.style.opacity=String(Math.max(0,1-Math.abs(o)/200)))},l=t=>{r&&(r=!1,e.releasePointerCapture(t.pointerId),e.style.transition="",Math.abs(o)>120?(e.style.transform=`translate(${2*o}px, ${i}px) rotate(${.2*o}deg)`,e.style.opacity="0",setTimeout(()=>this.close(!0),250)):(e.style.transform="",e.style.opacity="",this._resume()),o=i=0)};e.addEventListener("pointerdown",s),e.addEventListener("pointermove",a),e.addEventListener("pointerup",l),e.addEventListener("pointercancel",l),this._cleanups.push(()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",a),e.removeEventListener("pointerup",l),e.removeEventListener("pointercancel",l)})}_startTimer(){if(this.config.duration<=0)return;this.startedAt=Date.now(),this.remaining=this.config.duration;const e=()=>{if(this.paused||this.closing)return;const t=Date.now()-this.startedAt;if(this.remaining=Math.max(0,this.config.duration-t),this.barEl){const e=this.remaining/this.config.duration,t="vertical"===this.config.progressDirection?`scaleY(${e})`:`scaleX(${e})`;this.barEl.style.transform=t}this.remaining<=0?this.close():this.rafId=requestAnimationFrame(e)};this.rafId=requestAnimationFrame(e)}_pause(){this.paused||this.config.duration<=0||(this.paused=!0,cancelAnimationFrame(this.rafId),this.remaining=Math.max(0,this.config.duration-(Date.now()-this.startedAt)))}_resume(){this.paused&&(this.paused=!1,this.startedAt=Date.now()-(this.config.duration-this.remaining),this._startTimer())}update(e){if(Z.trigger("beforeUpdate",this),e.type&&(this.type=e.type),void 0!==e.title&&(this.title=e.title),void 0!==e.message&&(this.message=e.message),void 0!==e.html&&(this.html=e.html),!this.el)return Z.trigger("afterUpdate",this),this;const n=this.el.querySelector(".met-content");if(n){const e=this.title?`${t(this.title)}
`:"",o=this.html?`${this.html}
`:this.message?`${t(this.message)}
`:"";n.innerHTML=`${e}${o}`}if(this.config.resetTimerOnUpdate&&this.config.duration>0&&(cancelAnimationFrame(this.rafId),this.startedAt=Date.now(),this.remaining=this.config.duration,this._startTimer()),"function"==typeof this.config.onUpdate)try{this.config.onUpdate(this)}catch(e){}return Z.trigger("afterUpdate",this),this}close(e=!1){if(this.closing)return;this.closing=!0,Z.trigger("beforeClose",this),cancelAnimationFrame(this.rafId),this._cleanups.forEach(e=>{try{e()}catch(e){}}),this._cleanups=[];const t=this.el;if(!t)return void oe._remove(this.id);const n=t.parentNode;if(n&&!e){const e=t.getBoundingClientRect(),o=n.getBoundingClientRect();t.style.position="absolute",t.style.top=e.top-o.top+"px",t.style.left=e.left-o.left+"px",t.style.width=e.width+"px",t.style.margin="0"}t.classList.add("met-leaving"),t.classList.remove("met-show");const o=this.config.position||"top-right",i="rtl"===N(S());let r="scale(.96)";r=o.includes("right")?i?"translateX(-120%)":"translateX(120%)":o.includes("left")?i?"translateX(120%)":"translateX(-120%)":o.startsWith("top")?"translateY(-20px)":"translateY(20px)",t.style.transform=r,t.style.opacity="0",setTimeout(()=>this._destroy(),e?0:300)}_destroy(){if(this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=null,"function"==typeof this.config.onClose)try{this.config.onClose(this)}catch(e){}Z.trigger("afterClose",this),oe._remove(this.id)}}const J=e=>`\n \n ${e}\n
`,Q=e=>{const n=e.confirmText||_("confirm"),o=e.cancelText||_("cancel"),i=e.confirmColor||"#10b981",r=e.cancelColor||"#6b7280";return J(`\n \n \n `)},ee=e=>{const n=e.submitText||_("confirm"),o=e.cancelText||_("cancel"),i=e.submitColor||"#3b82f6",r=e.cancelColor||"#6b7280";return`\n \n ${J(`\n \n \n `)}\n `},te=e=>`\n \n 0%
\n `,ne=e=>{if(!Array.isArray(e)||0===e.length)return"";const n=e.map((e,n)=>``).join("");return J(n)},oe={_toasts:new Map,_config:{...i},version:"2.0.0",configure(e){return e&&"object"==typeof e?(this._config={...this._config,...e},e.theme&&f(e.theme),e.locale&&L(e.locale),this):this},_emit(e){const t={...this._config,...e};t.content&&!t.message&&(t.message=t.content);const n=new Z(t);return n.create(),this._toasts.set(n.id,n),n},_remove(e){this._toasts.delete(e)},find(e){if(e)return this._toasts.get(e)},show(e,t={}){const n=K([e,t],"default");return this._emit(n)},success(e,t={}){const n=K([e,t],"success");return this._emit(n)},error(e,t={}){const n=K([e,t],"error");return this._emit(n)},warning(e,t={}){const n=K([e,t],"warning");return this._emit(n)},info(e,t={}){const n=K([e,t],"info");return this._emit(n)},loading(e,t={}){const n=K([e,t],"loading");n.duration=0,n.closeButton=!1,n.showProgress=!1;const o=this._emit(n);return{id:o.id,success:(e,t={})=>this._resolve(o,"success",e,t),error:(e,t={})=>this._resolve(o,"error",e,t),info:(e,t={})=>this._resolve(o,"info",e,t),warning:(e,t={})=>this._resolve(o,"warning",e,t),update:e=>(o.update(e),this),dismiss:()=>o.close()}},promise(e,t={}){if(!e||"function"!=typeof e.then)return Promise.reject(new Error("Invalid promise"));const n=t.loading||_("loading"),o=t.success||_("success"),i=t.error||_("error"),r=this.loading(n);return Promise.resolve(e).then(e=>(r.success(o),e)).catch(e=>{throw r.error(i),e})},_resolve(e,t,n,o){const i=e.id,r=this._toasts.get(i);if(!r)return null;const s=r.config.position;return r.close(),this._emit({...o,type:t,message:n,position:s})},confirm(e,t={}){return"string"!=typeof e?Promise.resolve(!1):new Promise(n=>{let o=!1;const i=e=>{o||(o=!0,clearTimeout(r),n(e))},r=setTimeout(()=>i(!1),1e4),s=this._emit({...t,type:t.type||"warning",message:e,duration:0,closeButton:!1,closeOnClick:!1,draggable:!1,html:Q(t)});setTimeout(()=>{const e=s.el?.querySelector(".met-confirm-btn"),t=s.el?.querySelector(".met-cancel-btn");e&&e.addEventListener("click",()=>{s.close(),i(!0)}),t&&t.addEventListener("click",()=>{s.close(),i(!1)})},0)})},prompt(e,t={}){return"string"!=typeof e?Promise.resolve(null):new Promise(n=>{let o=!1;const i=e=>{o||(o=!0,clearTimeout(r),n(e))},r=setTimeout(()=>i(null),1e4),s=this._emit({...t,type:t.type||"info",message:e,duration:0,closeButton:!1,closeOnClick:!1,draggable:!1,html:ee(t)});setTimeout(()=>{const e=s.el?.querySelector(".met-input"),t=s.el?.querySelector(".met-submit-btn"),n=s.el?.querySelector(".met-cancel-btn");e&&(e.focus(),e.addEventListener("keydown",t=>{"Enter"===t.key&&(s.close(),i(e.value))})),t&&t.addEventListener("click",()=>{s.close(),i(e?.value||null)}),n&&n.addEventListener("click",()=>{s.close(),i(null)})},0)})},progress(e,t={}){const n=K([e,t],"info");n.duration=0,n.closeButton=!1,n.showProgress=!1;const o=this._emit({...n,html:te(t)});return{id:o.id,setProgress(e){const t=o.el?.querySelector(".met-progress-fill"),n=o.el?.querySelector(".met-progress-text");t&&(t.style.width=`${Math.min(100,Math.max(0,e))}%`),n&&(n.textContent=`${Math.round(e)}%`)},complete(e){this.setProgress(100),setTimeout(()=>{o.update({type:"success",message:e||_("success"),html:""}),setTimeout(()=>o.close(),1e3)},300)},error(e){o.update({type:"error",message:e||_("error"),html:""}),setTimeout(()=>o.close(),2e3)},dismiss(){o.close()}}},countdown(e,t=10,n={}){if("string"!=typeof e)return{cancel:()=>{},pause:()=>{},resume:()=>{}};let o=Math.max(1,parseInt(t)||10),i=null;const r=this._emit({...n,type:n.type||"warning",message:e.replace(/\{seconds\}/g,o),duration:0,closeButton:!0,showProgress:!1}),s=()=>{if(o--,o<=0){if(clearInterval(i),r.close(),"function"==typeof n.onComplete)try{n.onComplete()}catch(e){}}else r.update({message:e.replace(/\{seconds\}/g,o)})};return i=setInterval(s,1e3),{id:r.id,cancel(){clearInterval(i),r.close()},pause(){clearInterval(i)},resume(){clearInterval(i),i=setInterval(s,1e3)}}},action(e,t=[],n={}){const o=K([e,n],"info");o.duration=n.duration??0,o.closeButton=n.closeButton??!0;const i=this._emit({...o,html:(o.html||"")+ne(t)});return Array.isArray(t)&&setTimeout(()=>{t.forEach((e,t)=>{const n=i.el?.querySelector(`.met-action-btn-${t}`);n&&"function"==typeof e.onClick&&n.addEventListener("click",()=>{try{e.onClick(i)}catch(e){}!1!==e.close&&i.close()})})},0),{id:i.id,toast:i,dismiss:()=>i.close()}},queue(e,t={}){if(!Array.isArray(e))return{then:e=>Promise.resolve().then(e),cancel:()=>{}};let n=!1;const o=new Promise(o=>{let i=0;const r=t.delay||1e3,s=t.onClose,a=()=>{if(n||i>=e.length)return void o();const l=e[i];i++;const c="string"==typeof l?l:l?.message||"",d="object"==typeof l&&null!==l?l:{},h=d.onClose;this._emit({...t,...d,message:c,duration:d.duration||t.duration||3e3,onClose:e=>{if("function"==typeof h)try{h(e)}catch(e){}if("function"==typeof s)try{s(e)}catch(e){}setTimeout(a,r)}})};a()});return{then:(e,t)=>o.then(e,t),catch:e=>o.catch(e),cancel:()=>{n=!0}}},stack(e,t={}){Array.isArray(e)&&e.forEach((e,n)=>{setTimeout(()=>{const n="string"==typeof e?e:e?.message||"";this._emit({...t,..."object"==typeof e&&null!==e?e:{},message:n})},n*(t.stagger||100))})},dismiss(e){if(e){const t=this._toasts.get(e);return void(t&&t.close())}this._toasts.forEach(e=>e.close())},clear(e){this._toasts.forEach(t=>{e&&t.config.position!==e||t.close()})},destroy(){if(this.dismiss(),"undefined"!=typeof document){document.querySelectorAll(".met-container").forEach(e=>e.parentNode&&e.parentNode.removeChild(e));const e=document.getElementById("metona-toast-styles");e&&e.parentNode.removeChild(e)}this._toasts.clear(),G.clear()},getAll(){return new Map(this._toasts)},count(){return this._toasts.size},group(e){const t=this,n={_group:e};return["show","success","error","warning","info","loading","action"].forEach(o=>{n[o]=(...n)=>{const i=n[n.length-1],r="object"==typeof i&&null!==i&&!Array.isArray(i);return r&&1===n.length?t[o]({...i,group:e}):r?(n.pop(),t[o](...n,{...i,group:e})):t[o](...n,{group:e})}}),n.dismiss=()=>t.dismissGroup(e),n.count=()=>t._groupCount(e),n},dismissGroup(e){this._toasts.forEach(t=>{t.group===e&&t.close()})},_groupCount(e){let t=0;return this._toasts.forEach(n=>{n.group===e&&t++}),t}},ie=new Map;Object.entries({bounce:{enter:{transform:"translateY(-80px)",opacity:0},leave:{transform:"translateY(20px)",opacity:1},duration:650,easing:"ease"},slideUp:{enter:{transform:"translateY(60px)",opacity:0},leave:{transform:"translateY(0)",opacity:1},duration:400,easing:"cubic-bezier(0.25, 0.46, 0.45, 0.94)"},slideDown:{enter:{transform:"translateY(-60px)",opacity:0},leave:{transform:"translateY(0)",opacity:1},duration:400,easing:"cubic-bezier(0.25, 0.46, 0.45, 0.94)"},slideLeft:{enter:{transform:"translateX(-90px)",opacity:0},leave:{transform:"translateX(0)",opacity:1},duration:400,easing:"cubic-bezier(0.25, 0.46, 0.45, 0.94)"},slideRight:{enter:{transform:"translateX(90px)",opacity:0},leave:{transform:"translateX(0)",opacity:1},duration:400,easing:"cubic-bezier(0.25, 0.46, 0.45, 0.94)"}}).forEach(([e,t])=>{s[e]=t});const re=new class{constructor(){this.animations=new Map,this.activeAnimations=new Map,this.animationId=0,this._registerDefaults()}_registerDefaults(){Object.entries(s).forEach(([e,t])=>{this.register(e,t)})}register(e,t){const n={name:e,enter:t.enter||{},leave:t.leave||{},duration:t.duration||300,easing:t.easing||"cubic-bezier(0.4, 0, 0.2, 1)",delay:t.delay||0,iterations:t.iterations||1,direction:t.direction||"normal",fillMode:t.fillMode||"forwards"};this.animations.set(e,n),ie.set(e,n)}unregister(e){this.animations.delete(e),ie.delete(e)}get(e){return this.animations.get(e)||s[e]||null}apply(e,t,n={}){return new Promise((o,i)=>{const r=this.get(t);if(!r)return void o();const s={...r,...n},a=++this.animationId;Object.assign(e.style,s.enter),e.offsetHeight;const l=[{...s.enter},{...s.leave}],c={duration:s.duration,easing:s.easing,delay:s.delay,iterations:s.iterations,direction:s.direction,fill:s.fillMode},d=e.animate(l,c);this.activeAnimations.set(a,{element:e,animation:d,config:s}),d.onfinish=()=>{Object.assign(e.style,s.leave),this.activeAnimations.delete(a),o()},d.oncancel=()=>{this.activeAnimations.delete(a),i(new Error(`Animation "${t}" was cancelled`))}})}enter(e,t,n={}){return this.get(t)?this.apply(e,t,{...n,direction:"normal"}):Promise.resolve()}leave(e,t,n={}){return this.get(t)?this.apply(e,t,{...n,direction:"reverse"}):Promise.resolve()}cancelAll(){this.activeAnimations.forEach(({animation:e})=>{e.cancel()}),this.activeAnimations.clear()}cancel(e){this.activeAnimations.forEach(({element:t,animation:n},o)=>{t===e&&(n.cancel(),this.activeAnimations.delete(o))})}pauseAll(){this.activeAnimations.forEach(({animation:e})=>{e.pause()})}resumeAll(){this.activeAnimations.forEach(({animation:e})=>{e.play()})}pause(e){this.activeAnimations.forEach(({element:t,animation:n})=>{t===e&&n.pause()})}resume(e){this.activeAnimations.forEach(({element:t,animation:n})=>{t===e&&n.play()})}getActiveCount(){return this.activeAnimations.size}getActiveAnimations(){return new Map(this.activeAnimations)}hasActiveAnimation(e){for(const{element:t}of this.activeAnimations.values())if(t===e)return!0;return!1}getConfig(){return{animations:Array.from(this.animations.keys()),activeCount:this.getActiveCount()}}reset(){this.cancelAll(),this.animations.clear(),this._registerDefaults()}destroy(){this.cancelAll(),this.animations.clear(),this.activeAnimations.clear()}},se={apply:(e,t,n={})=>re.apply(e,t,n),enter:(e,t,n={})=>re.enter(e,t,n),leave:(e,t,n={})=>re.leave(e,t,n),cancelAll(){re.cancelAll()},cancel(e){re.cancel(e)},pauseAll(){re.pauseAll()},resumeAll(){re.resumeAll()},pause(e){re.pause(e)},resume(e){re.resume(e)},getActiveCount:()=>re.getActiveCount(),hasActiveAnimation:e=>re.hasActiveAnimation(e),register(e,t){re.register(e,t)},unregister(e){re.unregister(e)},get:e=>re.get(e),getAnimationNames:()=>Array.from(re.animations.keys()),getConfig:()=>re.getConfig(),reset(){re.reset()},destroy(){re.destroy()}};class ae{constructor(){this.plugins=new Map,this.initialized=!1}register(e,t){if(this.plugins.has(e))return this;if(!t||"object"!=typeof t||!t.name&&!t.version)return this;if(this.plugins.set(e,{name:e,...t,installed:!1,enabled:!0}),t.install)try{t.install(this),this.plugins.get(e).installed=!0}catch(e){}return this}unregister(e){const t=this.plugins.get(e);if(!t)return this;if(t.uninstall)try{t.uninstall(this)}catch(e){}return this.plugins.delete(e),this}get(e){return this.plugins.get(e)||null}has(e){return this.plugins.has(e)}getAll(){return Array.from(this.plugins.values())}getNames(){return Array.from(this.plugins.keys())}enable(e){const t=this.plugins.get(e);return t&&(t.enabled=!0),this}disable(e){const t=this.plugins.get(e);return t&&(t.enabled=!1),this}isEnabled(e){const t=this.plugins.get(e);return!!t&&t.enabled}destroy(){this.plugins.forEach((e,t)=>{if(e.destroy)try{e.destroy(this)}catch(e){}}),this.plugins.clear()}}const le={keyboard:{name:"keyboard",version:"1.0.0",description:"ESC 关闭所有 Toast",_handler:null,install(){"undefined"!=typeof document&&(this._handler=e=>{"Escape"===e.key&&document.querySelectorAll(".met-toast .met-close").forEach(e=>{try{e.click()}catch(e){}})},document.addEventListener("keydown",this._handler))},uninstall(){this._handler&&"undefined"!=typeof document&&(document.removeEventListener("keydown",this._handler),this._handler=null)}},persistence:{name:"persistence",version:"1.0.0",description:"自动持久化配置到 localStorage",storageKey:"metona-toast-config",install(){if("undefined"!=typeof localStorage)try{const e=localStorage.getItem(this.storageKey);return e?JSON.parse(e):null}catch(e){return null}return null},save(e){if("undefined"!=typeof localStorage)try{localStorage.setItem(this.storageKey,JSON.stringify(e))}catch(e){}},uninstall(){if("undefined"!=typeof localStorage)try{localStorage.removeItem(this.storageKey)}catch(e){}}},accessibility:{name:"accessibility",version:"1.0.0",description:"通过屏幕阅读器朗读 Toast 内容",announce(e){if("undefined"==typeof document)return;const t=document.createElement("div");t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";const n=_(e.type)||e.type;t.textContent=`${n}: ${e.title||""} ${e.message||""}`,document.body.appendChild(t),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t)},3e3)}}},ce={createManager:()=>new ae,register:(e,t)=>de.register(e,t),unregister:e=>de.unregister(e),get:e=>de.get(e),has:e=>de.has(e),getAll:()=>de.getAll(),getNames:()=>de.getNames(),enable:e=>de.enable(e),disable:e=>de.disable(e),isEnabled:e=>de.isEnabled(e),getPreset:e=>le[e]||null,getAllPresets:()=>({...le}),createPlugin:e=>({name:e.name||"custom",version:e.version||"1.0.0",description:e.description||"",hooks:e.hooks||{},install:e.install||null,uninstall:e.uninstall||null,...e}),validatePlugin(e){const t=[];return e&&"object"==typeof e||t.push("Plugin must be an object"),e.name||e.version||t.push("Plugin must have a name or version"),{valid:0===t.length,errors:t}}},de=new ae,he="2.0.0",ge={...oe,version:he,animations:se,themes:B,i18n:W,plugins:ce,presetPlugins:le,use(e,t={}){if("string"==typeof e){const n=le[e];if(!n)return this;if(this.plugins.register(e,{...n,...t}),"accessibility"===e&&Z.on("afterShow",e=>n.announce(e)),"persistence"===e){const e=n.install();e&&this.configure(e),Z.on("afterClose",()=>{n.save(this.getConfig())})}}else if(e&&"object"==typeof e){const n=e.name||"custom";this.plugins.register(n,{...e,...t})}return this},init(e={}){return e.config&&this.configure(e.config),e.theme&&this.themes.switchTheme(e.theme),e.locale&&this.i18n.switchLocale(e.locale),e.plugins&&Array.isArray(e.plugins)&&e.plugins.forEach(e=>{this.use(e)}),this},destroy(){if(this.dismiss(),this.plugins&&"function"==typeof this.plugins.destroy&&this.plugins.destroy(),this.themes&&("function"==typeof this.themes.clearThemeListeners&&this.themes.clearThemeListeners(),"function"==typeof this.themes.unwatchSystemTheme&&this.themes.unwatchSystemTheme()),this.i18n&&"function"==typeof this.i18n.clearLocaleListeners&&this.i18n.clearLocaleListeners(),this.animations&&"function"==typeof this.animations.cancelAll&&this.animations.cancelAll(),"undefined"!=typeof document){document.querySelectorAll(".met-container").forEach(e=>e.parentNode&&e.parentNode.removeChild(e));const e=document.getElementById("metona-toast-styles");e&&e.parentNode.removeChild(e)}this._toasts.clear()},getStatus(){return{version:he,toasts:this._toasts.size,theme:this.themes?.getCurrentTheme?.()||"auto",locale:this.i18n?.getCurrentLocale?.()||"zh-CN",plugins:this.plugins?.getNames?.()||[],animations:this.animations?.getActiveCount?.()||0}},getConfig(){return{...this._config}},updateConfig(e){return e&&"object"==typeof e&&(this._config={...this._config,...e}),this},resetConfig(){return this._config={...i},this},getToasts(){return Array.from(this._toasts.values())},hasToasts(){return this._toasts.size>0},getToast(e){return e&&this._toasts.get(e)||null},closeAll(){this._toasts.forEach(e=>e.close())},clearAll(){this._toasts.forEach(e=>e.close())},pauseAll(){this._toasts.forEach(e=>e._pause())},resumeAll(){this._toasts.forEach(e=>e._resume())},updateAll(e){e&&"object"==typeof e&&this._toasts.forEach(t=>t.update(e))},findToasts(e){return"function"!=typeof e?[]:Array.from(this._toasts.values()).filter(e)},findByType(e){return this.findToasts(t=>t.type===e)},findByPosition(e){return this.findToasts(t=>t.config.position===e)}};if("function"==typeof B.initTheme&&B.initTheme(),"function"==typeof W.initI18n&&W.initI18n(),"undefined"!=typeof window){window.MeToast=ge,window.Met=ge,ge._notify=t=>{"undefined"!=typeof Notification&&"denied"!==Notification.permission&&document.hidden&&("default"!==Notification.permission?e(t):Notification.requestPermission().then(n=>{"granted"===n&&e(t)}))};const e=e=>{try{new Notification(e.title||e.type,{body:e.message})}catch(e){}};Z.on("afterShow",e=>{e.config.notifyWhenHidden&&ge._notify(e)})}e.MeToast=ge,e.Met=ge,e.Toast=Z,e.VERSION=he,e.default=ge,e.meToast=ge,Object.defineProperty(e,"__esModule",{value:!0})});