UNPKG

tango-ui-cw

Version:

A lightweight ui library with ClayW

6 lines 86.5 kB
'use client'; "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),d=require("react"),Zt=require("react-dom"),t=require("prop-types"),Gt=require("tailwind-merge"),ot="tango:theme",st="tango:themeTokens",Fe="light",qt=["primary","input-accent","modal-ok-bg","drawer-ok-bg","datepicker-confirm-bg"],Pt=d.createContext(null),Ot=()=>typeof window<"u",rt=(e,o)=>{if(!Ot())return o;try{const r=window.localStorage.getItem(e);return r?JSON.parse(r):o}catch{return o}},at=(e,o)=>{if(Ot())try{window.localStorage.setItem(e,JSON.stringify(o))}catch{}};function Xt({children:e}){const[o,r]=d.useState(Fe),n=d.useRef(!1);d.useEffect(()=>{const u=rt(ot,Fe);u!==Fe&&r(u==="dark"?"dark":"light"),n.current=!0},[]);const[c,l]=d.useState(()=>rt(st,{})),a=d.useRef(new Set);d.useEffect(()=>{typeof document>"u"||(document.documentElement.dataset.theme=o)},[o]),d.useEffect(()=>{n.current&&at(ot,o)},[o]),d.useEffect(()=>{if(typeof document>"u")return;const u=document.documentElement,f=new Set(Object.keys(c));a.current.forEach(S=>{f.has(S)||u.style.removeProperty(`--${S}`)}),Object.entries(c).forEach(([S,C])=>{C==null||C===""?u.style.removeProperty(`--${S}`):u.style.setProperty(`--${S}`,String(C))}),a.current=f,at(st,c)},[c]);const i=u=>{l(f=>{const S=typeof u=="function"?u(f):u;return{...f,...S||{}}})},p=(u,f=qt)=>{i(S=>{const C={...S};return f.forEach(T=>{C[T]=u}),C})},h=()=>{l({})},x=()=>{r(u=>u==="dark"?"light":"dark")};return s.jsx(Pt.Provider,{value:{theme:o,setTheme:r,toggleTheme:x,themeTokens:c,setThemeTokens:i,setThemeColor:p,resetThemeTokens:h},children:e})}function Jt(){return d.useContext(Pt)}const Qt=new Set(["root","slots","tw","className","css","style"]),Pe={tw:"",css:{}},be=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Y=(e,o="px")=>typeof e=="number"?`${e}${o}`:e,me=e=>typeof e=="string"&&e.startsWith("$")?`var(--${e.slice(1)})`:e,eo=e=>e.includes("-")?e.replace(/-([a-z])/g,(o,r)=>r.toUpperCase()):e,to=e=>/(color|background|border|fill|stroke|shadow)$/i.test(e),oo={mt:(e,o)=>{e.marginTop=Y(o)},mr:(e,o)=>{e.marginRight=Y(o)},mb:(e,o)=>{e.marginBottom=Y(o)},ml:(e,o)=>{e.marginLeft=Y(o)},mx:(e,o)=>{e.marginLeft=Y(o),e.marginRight=Y(o)},my:(e,o)=>{e.marginTop=Y(o),e.marginBottom=Y(o)},m:(e,o)=>{e.margin=Y(o)},pt:(e,o)=>{e.paddingTop=Y(o)},pr:(e,o)=>{e.paddingRight=Y(o)},pb:(e,o)=>{e.paddingBottom=Y(o)},pl:(e,o)=>{e.paddingLeft=Y(o)},px:(e,o)=>{e.paddingLeft=Y(o),e.paddingRight=Y(o)},py:(e,o)=>{e.paddingTop=Y(o),e.paddingBottom=Y(o)},p:(e,o)=>{e.padding=Y(o)},g:(e,o)=>{e.gap=Y(o)},rg:(e,o)=>{e.rowGap=Y(o)},cg:(e,o)=>{e.columnGap=Y(o)},w:(e,o)=>{e.width=Y(o)},h:(e,o)=>{e.height=Y(o)},mw:(e,o)=>{e.minWidth=Y(o)},mh:(e,o)=>{e.minHeight=Y(o)},maxw:(e,o)=>{e.maxWidth=Y(o)},maxh:(e,o)=>{e.maxHeight=Y(o)},vw:(e,o)=>{e.width=typeof o=="number"?`${o}vw`:o},vh:(e,o)=>{e.height=typeof o=="number"?`${o}vh`:o},presentw:(e,o)=>{e.width=typeof o=="number"?`${o}%`:o},presenth:(e,o)=>{e.height=typeof o=="number"?`${o}%`:o},size:(e,o)=>{e.fontSize=Y(o)},fw:(e,o)=>{e.fontWeight=o},fwb:e=>{e.fontWeight="bold"},fwn:e=>{e.fontWeight="normal"},tac:e=>{e.textAlign="center"},tar:e=>{e.textAlign="right"},tal:e=>{e.textAlign="left"},lh:(e,o)=>{e.lineHeight=Y(o)},ls:(e,o)=>{e.letterSpacing=Y(o)},c:(e,o)=>{e.color=me(o)},bg:(e,o)=>{e.background=me(o)},bgc:(e,o)=>{e.backgroundColor=me(o)},b:(e,o)=>{e.border=o===1?"1px solid var(--border)":me(o)},br:(e,o)=>{e.borderRadius=Y(o)},bw:(e,o)=>{e.borderWidth=Y(o)},bs:(e,o)=>{e.borderStyle=o},bColor:(e,o)=>{e.borderColor=me(o)},boxshadow:(e,o)=>{e.boxShadow=me(o)},bgSize:(e,o)=>{e.backgroundSize=o},bgPosition:(e,o)=>{e.backgroundPosition=o},bgRepeat:(e,o)=>{e.backgroundRepeat=o},rel:e=>{e.position="relative"},ab:e=>{e.position="absolute"},fixed:e=>{e.position="fixed"},sticky:e=>{e.position="sticky"},center:e=>{e.position="absolute",e.inset=0,e.margin="auto"},inset:(e,o)=>{e.inset=Y(o)},top:(e,o)=>{e.top=Y(o)},right:(e,o)=>{e.right=Y(o)},bottom:(e,o)=>{e.bottom=Y(o)},left:(e,o)=>{e.left=Y(o)},z:(e,o)=>{e.zIndex=o},flex:e=>{e.display="flex"},iflex:e=>{e.display="inline-flex"},fd:(e,o)=>{e.flexDirection=o},fwrap:(e,o="wrap")=>{e.flexWrap=o},aic:e=>{e.alignItems="center"},ai:(e,o)=>{e.alignItems=o},jcc:e=>{e.justifyContent="center"},jc:(e,o)=>{e.justifyContent=o},ac:(e,o)=>{e.alignContent=o},as:(e,o)=>{e.alignSelf=o},f:(e,o)=>{e.flex=typeof o=="number"?o:`${o}`},fl:e=>{e.float="left"},fr:e=>{e.float="right"},ar:(e,o)=>{e.aspectRatio=o},tran:(e,o)=>{e.transition=typeof o=="number"?`${o}s`:o},op:(e,o)=>{e.opacity=o},oh:e=>{e.overflow="hidden"},ohauto:e=>{e.overflow="auto"},oxh:e=>{e.overflowX="hidden"},oxa:e=>{e.overflowX="auto"},oyh:e=>{e.overflowY="hidden"},oya:e=>{e.overflowY="auto"},cur:(e,o)=>{e.cursor=o},pe:(e,o)=>{e.pointerEvents=o},boxsizing:e=>{e.boxSizing="border-box"},none:e=>{e.display="none"},block:e=>{e.display="block"},inline:e=>{e.display="inline"},ib:e=>{e.display="inline-block"},hidden:e=>{e.visibility="hidden"},shown:e=>{e.visibility="visible"}},ve=(e={})=>be(e)?Object.entries(e).reduce((o,[r,n])=>{if(Qt.has(r))return o;const c=oo[r];if(c)return c(o,n),o;const l=eo(r),a=typeof n=="string"&&(n.startsWith("$")||to(l))?me(n):n;return o[l]=a,o},{}):{},$=(...e)=>{const o=e.filter(Boolean).join(" ").trim();return o?Gt.twMerge(o):""},Te=e=>{if(typeof e=="string")return{tw:e,css:{}};if(!be(e))return{...Pe};if(!("tw"in e||"className"in e||"css"in e||"style"in e))return{tw:"",css:ve(e)};const r=[e.className,e.tw].filter(Boolean).join(" "),n=be(e.css)?ve(e.css):{},c=be(e.style)?ve(e.style):{};return{tw:r,css:{...n,...c}}},so=(e,o)=>be(e)?"root"in e||"slots"in e||"tw"in e||"className"in e||"css"in e||"style"in e?!0:o.some(r=>r!=="root"&&r in e):!1,ro=e=>{const o={};return e.forEach(r=>{o[r]={...Pe}}),o.root||(o.root={...Pe}),o},H=(e,o=["root"])=>{const r=ro(o);if(typeof e=="string")return r.root.tw=e,r;if(!be(e))return r;if(!so(e,o))return r.root.css=ve(e),r;const n=Te({tw:[e.className,e.tw].filter(Boolean).join(" "),css:e.css,style:e.style}),c=Te(e.root);r.root={tw:$(n.tw,c.tw),css:{...n.css,...c.css}};const l=be(e.slots)?e.slots:{};return Object.keys(r).forEach(a=>{if(a==="root")return;const i=Te(e[a]),p=Te(l[a]);r[a]={tw:$(i.tw,p.tw),css:{...i.css,...p.css}}}),r},b=({baseClassName:e="",className:o="",baseStyle:r={},style:n={},sxSlot:c=Pe}={})=>({className:$(e,o,c.tw),style:{...r||{},...c.css||{},...n||{}}}),ao=["root","icon","content"],nt={success:"text-[var(--notice-success-text)]",fail:"text-[var(--notice-fail-text)]",caution:"text-[var(--notice-caution-text)]"},lt={default:{base:"fixed top-5 left-1/2 -translate-x-1/2",enter:"animate-[noticeSlideDown_0.3s_cubic-bezier(0.22,1,0.36,1)_forwards]"},md:{base:"fixed bottom-5 left-5",enter:"animate-[noticeSlideFromBottom_0.3s_ease-out_forwards]"}};function no(e,o){const{type:r="success",icon:n,message:c,variant:l="default",duration:a=3e3,onClose:i,sx:p={},style:h={},className:x="",...u}=e,[f,S]=d.useState(!1),C=nt[r]?r:"success",T=lt[l]?l:"default",F=H(p,ao),P=d.useCallback(()=>{S(!0);const O=setTimeout(()=>i==null?void 0:i(),300);return()=>clearTimeout(O)},[i]);d.useEffect(()=>{if(!i||a<=0)return;const O=setTimeout(P,a);return()=>clearTimeout(O)},[i,a,P]);const y=lt[T],v=T==="default"?"animate-[noticeSlideUpFade_0.3s_ease-in_forwards]":"animate-[noticeSlideToBottom_0.3s_ease-in_forwards]",k=b({baseClassName:$("inline-flex items-center gap-2 px-3 py-2 text-sm z-[999]","rounded-[var(--notice-radius)]","bg-[var(--notice-bg)] text-[var(--notice-foreground)]","shadow-[var(--notice-shadow)]",y.base,f?v:y.enter,T==="md"&&nt[C]),className:x,sxSlot:F.root,baseStyle:{borderRadius:"var(--notice-radius)"},style:h}),m=b({baseClassName:"flex-shrink-0 text-[var(--notice-foreground)]",sxSlot:F.icon}),N=b({baseClassName:"inline-block",sxSlot:F.content});return s.jsxs("div",{ref:o,role:"alert",className:k.className,style:k.style,...u,children:[T!=="md"&&n&&s.jsx("span",{className:m.className,style:m.style,children:n}),s.jsx("span",{className:N.className,style:N.style,children:c})]})}const Ne=d.forwardRef(no);Ne.displayName="Notice";Ne.propTypes={type:t.oneOf(["success","fail","caution"]),icon:t.node,message:t.node,variant:t.oneOf(["default","md"]),duration:t.number,onClose:t.func,sx:t.oneOfType([t.string,t.object]),style:t.object,className:t.string};const _t=d.createContext(null),lo=s.jsx("svg",{viewBox:"0 0 1024 1024",width:"1.2em",height:"1.2em",children:s.jsx("path",{d:"M874.119618 149.859922A510.816461 510.816461 0 0 0 511.997 0.00208a509.910462 509.910462 0 0 0-362.119618 149.857842c-199.817789 199.679789-199.817789 524.581447 0 724.260236a509.969462 509.969462 0 0 0 362.119618 149.857842A508.872463 508.872463 0 0 0 874.119618 874.120158c199.836789-199.679789 199.836789-524.581447 0-724.260236zM814.94268 378.210681L470.999043 744.132295a15.359984 15.359984 0 0 1-5.887994 4.095996c-1.751998 1.180999-2.913997 2.362998-5.276994 2.913997a34.499964 34.499964 0 0 1-13.469986 2.914997 45.547952 45.547952 0 0 1-12.897986-2.303998l-4.095996-2.363997a45.291952 45.291952 0 0 1-7.009992-4.095996l-196.902793-193.789796a34.126964 34.126964 0 0 1-10.555989-25.186973c0-9.37399 3.583996-18.74698 9.98399-25.186974a36.429962 36.429962 0 0 1 50.372947 0l169.98382 167.423824L763.389735 330.220732a37.059961 37.059961 0 0 1 50.371947-1.732998 33.647965 33.647965 0 0 1 11.165988 25.186973 35.544963 35.544963 0 0 1-9.98399 24.575974v-0.04z m0 0",fill:"var(--notice-success-text)"})}),co=s.jsx("svg",{viewBox:"0 0 1024 1024",width:"1.2em",height:"1.2em",children:s.jsx("path",{d:"M549.044706 512l166.189176-166.249412a26.383059 26.383059 0 0 0 0-36.98447 26.383059 26.383059 0 0 0-37.044706 0L512 475.015529l-166.249412-166.249411a26.383059 26.383059 0 0 0-36.98447 0 26.383059 26.383059 0 0 0 0 37.044706L475.015529 512l-166.249411 166.249412a26.383059 26.383059 0 0 0 0 36.98447 26.383059 26.383059 0 0 0 37.044706 0L512 548.984471l166.249412 166.249411a26.383059 26.383059 0 0 0 36.98447 0 26.383059 26.383059 0 0 0 0-37.044706L548.984471 512zM512 1024a512 512 0 1 1 0-1024 512 512 0 0 1 0 1024z",fill:"var(--notice-fail-text)"})}),io=s.jsxs("svg",{viewBox:"0 0 1024 1024",width:"1.2em",height:"1.2em",children:[s.jsx("path",{d:"M512 909.061224c-218.906122 0-397.061224-178.155102-397.061224-397.061224s178.155102-397.061224 397.061224-397.061224 397.061224 178.155102 397.061224 397.061224-178.155102 397.061224-397.061224 397.061224z",fill:"var(--notice-caution-text)"}),s.jsx("path",{d:"M512 690.677551m-31.346939 0a31.346939 31.346939 0 1 0 62.693878 0 31.346939 31.346939 0 1 0-62.693878 0Z",fill:"var(--notice-fail-text)"}),s.jsx("path",{d:"M512 584.097959c-11.493878 0-20.897959-9.404082-20.897959-20.897959v-261.22449c0-11.493878 9.404082-20.897959 20.897959-20.897959s20.897959 9.404082 20.897959 20.897959v261.22449c0 12.016327-9.404082 20.897959-20.897959 20.897959z",fill:"var(--notice-fail-text)"})]}),uo={success:lo,fail:co,caution:io};function po({children:e}){const[o,r]=d.useState([]),[n,c]=d.useState(!1);d.useEffect(()=>{c(!0)},[]);const l=d.useCallback(i=>{r(p=>p.filter(h=>h.id!==i))},[]),a=d.useCallback((i,p,h="default")=>{const x=Date.now()+Math.random();r(u=>[...u,{id:x,type:i,message:p,variant:h,icon:uo[i]}])},[]);return s.jsxs(_t.Provider,{value:{add:a,remove:l},children:[e,n&&Zt.createPortal(s.jsx("div",{id:"notification-container",className:"flex flex-col items-center gap-2",children:o.map(i=>s.jsx(Ne,{...i,onClose:()=>l(i.id)},i.id))}),document.body)]})}function mo(){const e=d.useContext(_t);if(!e)throw new Error("useNotice must be used inside <NoticeProvider />");return e}function bo(){const{add:e}=mo();return{success:o=>e("success",o),fail:o=>e("fail",o),caution:o=>e("caution",o),md:{success:o=>e("success",o,"md"),fail:o=>e("fail",o,"md"),caution:o=>e("caution",o,"md")}}}const At="tango:locale",xe="zh-CN",xo={zh:"zh-CN",ZH:"zh-CN","zh-CN":"zh-CN","zh-cn":"zh-CN",cn:"zh-CN",CN:"zh-CN",en:"en-US",EN:"en-US","en-US":"en-US","en-us":"en-US",us:"en-US",US:"en-US"},Mt={"zh-CN":{button:{default:"按钮",loading:"加载中",iconAlt:"图标",toggle:"切换",light:"浅色",dark:"暗色",blue:"蓝色",green:"绿色",token:"自定义词条",reset:"重置",locale:"语言",chinese:"中文",english:"英文",successDemo:"成功",outlineDemo:"描边",submit:"提交",confirm:"确认",cancel:"取消",search:"搜索",save:"保存",delete:"删除",back:"返回",next:"下一步",prev:"上一步",add:"新增"},banner:{cancel:"取消",action:"操作"},colorpicker:{hex:"HEX",rgb:"RGB",hsl:"HSL"},date:{weekdayPrefix:"星期",weekdayShortPrefix:"周"},datepicker:{placeholder:"YYYY-MM-DD",placeholderTime:"YYYY-MM-DD HH:mm",timeLabel:"时间",confirm:"确定",cancel:"关闭",prevMonth:"上一月",nextMonth:"下一月"},drawer:{title:"基础标题",okText:"确定",cancelText:"取消",closeAriaLabel:"关闭"},modal:{title:"基础标题",okText:"确定",cancelText:"取消",closeAriaLabel:"关闭"},search:{placeholder:"请输入内容",btnText:"搜索"},materialInput:{label:""},materialButton:{default:"按钮",loading:"加载中",iconAlt:"图标"},table:{empty:"暂无数据",prev:"上一页",next:"下一页",page:"页",total:"共 {total} 条",perPage:"条/页"}},"en-US":{button:{default:"Button",loading:"Loading",iconAlt:"icon",toggle:"Toggle",light:"Light",dark:"Dark",blue:"Blue",green:"Green",token:"Token",reset:"Reset",locale:"Locale",chinese:"Chinese",english:"English",successDemo:"Success",outlineDemo:"Outline",submit:"Submit",confirm:"Confirm",cancel:"Cancel",search:"Search",save:"Save",delete:"Delete",back:"Back",next:"Next",prev:"Previous",add:"Add"},banner:{cancel:"Cancel",action:"Action"},colorpicker:{hex:"HEX",rgb:"RGB",hsl:"HSL"},date:{weekdayPrefix:"",weekdayShortPrefix:""},datepicker:{placeholder:"YYYY-MM-DD",placeholderTime:"YYYY-MM-DD HH:mm",timeLabel:"Time",confirm:"Confirm",cancel:"Close",prevMonth:"Previous month",nextMonth:"Next month"},drawer:{title:"Drawer",okText:"OK",cancelText:"Cancel",closeAriaLabel:"Close"},modal:{title:"Modal",okText:"OK",cancelText:"Cancel",closeAriaLabel:"Close"},search:{placeholder:"Search...",btnText:"Search"},materialInput:{label:""},materialButton:{default:"Button",loading:"Loading",iconAlt:"icon"},table:{empty:"No data",prev:"Previous",next:"Next",page:"Page",total:"{total} items",perPage:"/ page"}}},Ke=()=>{},zt=d.createContext({locale:xe,setLocale:Ke,toggleLocale:Ke,messages:Mt,t:(e,o="")=>o}),ct=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Et=(e,o)=>{const r={...e};return Object.entries(o||{}).forEach(([n,c])=>{ct(c)&&ct(r[n])?r[n]=Et(r[n],c):r[n]=c}),r},fo=(e,o)=>o.split(".").reduce((r,n)=>{if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},e),Se=e=>typeof e!="string"||!e.trim()?xe:xo[e]||e,go=()=>{if(typeof window>"u")return xe;try{const e=window.localStorage.getItem(At);return Se(e||xe)}catch{return xe}};function ho({children:e,locale:o,defaultLocale:r=xe,onLocaleChange:n=Ke,messages:c={}}){const l=Se(r),a=o==null?null:Se(o),[i,p]=d.useState(()=>go()||l),h=a||i,x=C=>{const T=Se(C);a==null&&p(T),n(T)};d.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(At,h)}catch{}},[h]);const u=d.useMemo(()=>Et(Mt,c),[c]),f=()=>{x(h==="zh-CN"?"en-US":"zh-CN")},S=(C,T="")=>{const F=u[h]||u[xe]||{},P=fo(F,C);return P==null||P===""?T:String(P)};return s.jsx(zt.Provider,{value:{locale:h,setLocale:x,toggleLocale:f,messages:u,t:S},children:e})}function re(){return d.useContext(zt)}const yo="_materialBtn_y97j8_8",vo="_materialBtnSmall_y97j8_27",So="_materialBtnMedium_y97j8_33",No="_materialBtnLarge_y97j8_39",wo="_materialBtnHuge_y97j8_45",Co="_materialBtnDisabled_y97j8_52",To="_ripple_y97j8_60",he={materialBtn:yo,materialBtnSmall:vo,materialBtnMedium:So,materialBtnLarge:No,materialBtnHuge:wo,materialBtnDisabled:Co,ripple:To},it=["root","content","icon","loading"],ko={small:"small",medium:"medium",large:"large",huge:"huge"},jo={small:12,medium:14,large:16,huge:20},dt={default:{backgroundColor:"var(--primary)",color:"var(--primary-foreground)",borderColor:"var(--border)",borderWidth:"1px",borderStyle:"solid"},transparent:{backgroundColor:"var(--transparent)",color:"var(--primary-foreground)",borderColor:"var(--button-transparent-border)",borderWidth:"1px",borderStyle:"solid"},danger:{backgroundColor:"var(--destructive)",color:"var(--destructive-foreground)",borderColor:"transparent",borderWidth:"1px",borderStyle:"solid"},success:{backgroundColor:"var(--success)",color:"var(--success-foreground)",borderColor:"transparent",borderWidth:"1px",borderStyle:"solid"}},Lo={default:{backgroundColor:"var(--transparent)",color:"var(--button-outline-foreground)",borderColor:"var(--border)",borderWidth:"1px",borderStyle:"solid"},transparent:{backgroundColor:"var(--transparent)",color:"var(--button-outline-foreground)",borderColor:"var(--button-transparent-border)",borderWidth:"1px",borderStyle:"solid"},danger:{backgroundColor:"var(--transparent)",color:"var(--destructive)",borderColor:"var(--destructive)",borderWidth:"1px",borderStyle:"solid"},success:{backgroundColor:"var(--transparent)",color:"var(--success)",borderColor:"var(--success)",borderWidth:"1px",borderStyle:"solid"}},Po={backgroundColor:"var(--muted)",color:"var(--muted-foreground)",borderColor:"transparent",borderWidth:"1px",borderStyle:"solid",cursor:"not-allowed"},De={default:"按钮",loading:"加载中",iconAlt:"图标"},Oo=e=>e.charAt(0).toUpperCase()+e.slice(1),_o=e=>e===!0||e==="light"||e==="dark"?!0:Array.isArray(e)&&e.length>0?e[0]===!0||e[0]==="light"||e[0]==="dark":!1,Ao=e=>e==="light"?"light":e==="dark"||e===!0||Array.isArray(e)&&e.length>=2&&e[1]==="dark"?"dark":"light",ut=(e,o,r)=>Object.prototype.hasOwnProperty.call(r,e)?e:o;function Oe(e){const{type:o="default",size:r="medium",sx:n={},style:c={},className:l="",onClick:a=()=>{},children:i,disabled:p=!1,outline:h=!1,icon:x=null,iconPosition:u=null,loading:f=!1,i18nKey:S=null,localeText:C={},rippleColor:T,"aria-label":F,...P}=e,{t:y}=re(),v=d.useRef(null),k=ut(r,"medium",ko),m=ut(o,"default",dt),N=_o(f),O=Ao(f),A=p||N,B=jo[k],_=u==="right"?"right":x||N?"left":null,j=T??"var(--material-button-ripple)",w={default:y("materialButton.default",De.default),loading:y("materialButton.loading",De.loading),iconAlt:y("materialButton.iconAlt",De.iconAlt),...C},W=(S&&typeof w[S]=="string"?w[S]:null)||(S?y(`materialButton.${S}`,w.default):w.default),D=N?w.loading:W,z=i??D,E=F||(i==null?String(z||w.default):void 0),M=H(n,it),U=A?Po:h?Lo[m]:dt[m],K=he[`materialBtn${Oo(k)}`],Z=M.root.css||{},R=typeof n=="string"?n:"",J=new Set([...it,"root","slots","tw","className","css","style"]),le=typeof n=="object"?Object.fromEntries(Object.entries(n).filter(([ee])=>!J.has(ee))):{},de=[he.materialBtn,K,A&&he.materialBtnDisabled,M.root.tw,R,l].filter(Boolean).join(" "),ue={...U,...le,...Z,...c},pe=b({baseClassName:"inline-flex items-center relative z-[1]",sxSlot:M.content}),G=b({baseClassName:"inline-flex items-center justify-center shrink-0 transition-all duration-300 relative z-[1]",baseStyle:{width:`${B}px`,height:`${B}px`},sxSlot:M.icon}),X=b({baseClassName:"inline-flex items-center justify-center shrink-0 animate-spin relative z-[1]",baseStyle:{width:`${B}px`,height:`${B}px`,color:O==="light"?"var(--button-loading-light)":"var(--button-loading-dark)"},sxSlot:M.loading}),I=d.useCallback(ee=>{if(A)return;const oe=v.current;if(!oe)return;const g=document.createElement("span"),V=Math.max(oe.clientWidth,oe.clientHeight),Q=V/2;Object.assign(g.style,{width:`${V}px`,height:`${V}px`,left:`${ee.clientX-oe.getBoundingClientRect().left-Q}px`,top:`${ee.clientY-oe.getBoundingClientRect().top-Q}px`}),g.className=he.ripple,g.style.background=j;const ne=oe.querySelector(`.${he.ripple}`);ne&&ne.remove(),oe.appendChild(g)},[A,j]),q=()=>{if(!x)return null;if(typeof x=="string")return s.jsx("img",{src:x,alt:w.iconAlt,className:G.className,style:G.style,"aria-hidden":"true"});if(d.isValidElement(x))return d.cloneElement(x,{className:$(G.className,x.props.className),style:{...G.style,...x.props.style},"aria-hidden":!0});if(typeof x=="function"){const ee=x;return s.jsx(ee,{className:G.className,style:G.style,"aria-hidden":"true"})}return s.jsx("span",{className:G.className,style:G.style,"aria-hidden":"true",children:x})},ae=()=>s.jsx("svg",{viewBox:"0 0 1024 1024",role:"presentation",className:X.className,style:X.style,"aria-hidden":"true",children:s.jsx("path",{d:"M512 1024A512 512 0 0 1 0 512a32 32 0 0 1 64 0 448 448 0 0 0 896 0 32 32 0 0 1 64 0 512 512 0 0 1-512 512z",fill:"currentColor"})});return s.jsxs("button",{ref:v,className:de,style:ue,onClick:ee=>{I(ee),a==null||a(ee)},disabled:A,"aria-label":E,"data-variant":m,"data-size":k,"data-icon-position":_||void 0,...P,children:[_==="left"&&s.jsxs(s.Fragment,{children:[N&&ae(),!N&&x&&q()]}),s.jsx("span",{className:pe.className,style:pe.style,children:z}),_==="right"&&s.jsxs(s.Fragment,{children:[N&&ae(),!N&&x&&q()]})]})}Oe.propTypes={type:t.oneOf(["default","transparent","danger","success"]),size:t.oneOf(["small","medium","large","huge"]),sx:t.oneOfType([t.object,t.string]),style:t.object,onClick:t.func,className:t.string,children:t.node,disabled:t.bool,outline:t.bool,icon:t.oneOfType([t.elementType,t.node,t.string]),iconPosition:t.oneOf(["left","right"]),loading:t.oneOfType([t.bool,t.oneOf(["light","dark"]),t.array]),i18nKey:t.string,localeText:t.object,rippleColor:t.string};const Mo=["root","content","icon","loading"],Re={default:"按钮",loading:"加载中",iconAlt:"图标"},zo="inline-flex select-none items-center justify-center whitespace-nowrap rounded-[var(--radius)] border align-middle font-medium tracking-[0.5px] transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--input-accent)] focus-visible:ring-offset-2",Ve={small:{iconSize:12,className:"text-xs px-2 py-1 gap-1"},medium:{iconSize:14,className:"text-sm px-4 py-2 gap-1.5"},large:{iconSize:16,className:"text-base px-5 py-3 gap-2"},huge:{iconSize:20,className:"text-[25px] px-[45px] py-[18px] gap-3"}},pt={default:"bg-[var(--primary)] text-[var(--primary-foreground)] border-[var(--border)] hover:shadow-[0_0_0.4em_0_var(--button-shadow-default)]",transparent:"bg-[var(--transparent)] text-[var(--primary-foreground)] border-[var(--button-transparent-border)] hover:shadow-[0_0_0.4em_0_var(--button-shadow-default)]",danger:"bg-[var(--destructive)] text-[var(--destructive-foreground)] border-transparent hover:shadow-[0_0_0.4em_0_var(--destructive)]",success:"bg-[var(--success)] text-[var(--success-foreground)] border-transparent hover:shadow-[0_0_0.4em_0_var(--success)]"},Eo="bg-[var(--transparent)]",$o={default:"text-[var(--button-outline-foreground)] border-[var(--border)]",transparent:"text-[var(--button-outline-foreground)] border-[var(--button-transparent-border)]",danger:"text-[var(--destructive)] border-[var(--destructive)]",success:"text-[var(--success)] border-[var(--success)]"},Bo="shadow-[var(--button-enu-shadow)] hover:shadow-[var(--button-enu-hover-shadow)] active:translate-y-px active:shadow-[var(--button-enu-active-shadow)]",Io={default:"bg-[var(--button-enu-bg)] text-[var(--button-enu-fg)] border-transparent",transparent:"bg-[var(--transparent)] text-[var(--button-enu-fg)] border-[var(--button-transparent-border)]",danger:"bg-[var(--destructive)] text-[var(--destructive-foreground)] border-transparent",success:"bg-[var(--success)] text-[var(--success-foreground)] border-transparent"},Fo="bg-[var(--muted)] text-[var(--muted-foreground)] border-transparent cursor-not-allowed shadow-none hover:shadow-none",Do=e=>e===!0||e==="light"||e==="dark"?!0:Array.isArray(e)&&e.length>0?e[0]===!0||e[0]==="light"||e[0]==="dark":!1,Ro=e=>e==="light"?"light":e==="dark"||e===!0||Array.isArray(e)&&e.length>=2&&e[1]==="dark"?"dark":"light",mt=(e,o,r)=>Object.prototype.hasOwnProperty.call(r,e)?e:o;function se(e){const{type:o="default",size:r="medium",sx:n={},style:c={},className:l="",onClick:a=()=>{},children:i,disabled:p=!1,outline:h=!1,enu:x=!1,icon:u=null,iconPosition:f=null,loading:S=!1,i18nKey:C=null,localeText:T={},"aria-label":F,...P}=e,{t:y}=re(),v=mt(r,"medium",Ve),k=mt(o,"default",pt),m=Do(S),N=Ro(S),O=p||m,A=Ve[v].iconSize,B=f==="right"?"right":u||m?"left":null,_=H(n,Mo),j={default:y("button.default",Re.default),loading:y("button.loading",Re.loading),iconAlt:y("button.iconAlt",Re.iconAlt),...T},L=(C&&typeof j[C]=="string"?j[C]:null)||(C?y(`button.${C}`,j.default):j.default),W=m?j.loading:L,D=i??W,z=F||(i==null?String(D||j.default):void 0);let E=pt[k];h&&(E=$(E,Eo,$o[k])),x&&(E=$(E,Bo,Io[k]));const M=b({baseClassName:$(zo,Ve[v].className,E,O&&Fo,m&&"cursor-wait"),className:l,style:c,sxSlot:_.root}),U=b({baseClassName:"inline-flex items-center",sxSlot:_.content}),K=b({baseClassName:"inline-flex items-center justify-center shrink-0 transition-all duration-300",baseStyle:{width:`${A}px`,height:`${A}px`},sxSlot:_.icon}),Z=b({baseClassName:"inline-flex items-center justify-center shrink-0 animate-spin",baseStyle:{width:`${A}px`,height:`${A}px`,color:N==="light"?"var(--button-loading-light)":"var(--button-loading-dark)"},sxSlot:_.loading}),R=()=>{if(!u)return null;if(typeof u=="string")return s.jsx("img",{src:u,alt:j.iconAlt,className:K.className,style:K.style,"aria-hidden":"true"});if(d.isValidElement(u))return d.cloneElement(u,{className:$(K.className,u.props.className),style:{...K.style,...u.props.style},"aria-hidden":!0});if(typeof u=="function"){const le=u;return s.jsx(le,{className:K.className,style:K.style,"aria-hidden":"true"})}return s.jsx("span",{className:K.className,style:K.style,"aria-hidden":"true",children:u})},J=()=>s.jsx("svg",{viewBox:"0 0 1024 1024",role:"presentation",className:Z.className,style:Z.style,"aria-hidden":"true",children:s.jsx("path",{d:"M512 1024A512 512 0 0 1 0 512a32 32 0 0 1 64 0 448 448 0 0 0 896 0 32 32 0 0 1 64 0 512 512 0 0 1-512 512z",fill:"currentColor"})});return s.jsxs("button",{className:M.className,style:M.style,onClick:a,disabled:O,"aria-label":z,"data-variant":k,"data-size":v,"data-icon-position":B||void 0,...P,children:[B==="left"&&s.jsxs(s.Fragment,{children:[m&&J(),!m&&u&&R()]}),s.jsx("span",{className:U.className,style:U.style,children:D}),B==="right"&&s.jsxs(s.Fragment,{children:[m&&J(),!m&&u&&R()]})]})}se.propTypes={type:t.oneOf(["default","transparent","danger","success"]),size:t.oneOf(["small","medium","large","huge"]),sx:t.oneOfType([t.object,t.string]),style:t.object,onClick:t.func,className:t.string,children:t.node,disabled:t.bool,outline:t.bool,enu:t.bool,icon:t.oneOfType([t.elementType,t.node,t.string]),iconPosition:t.oneOf(["left","right"]),loading:t.oneOfType([t.bool,t.oneOf(["light","dark"]),t.array]),i18nKey:t.string,localeText:t.object};se.MaterialButton=Oe;const Vo=["root","input","label"],Yo={small:"small",medium:"medium",large:"large",huge:"huge"},Ko={small:{wrapper:"h-10 text-sm",label:"text-sm",labelFloat:"text-[10px]",pt:"pt-5"},medium:{wrapper:"h-12 text-base",label:"text-base",labelFloat:"text-xs",pt:"pt-6"},large:{wrapper:"h-14 text-lg",label:"text-lg",labelFloat:"text-sm",pt:"pt-7"},huge:{wrapper:"h-16 text-xl",label:"text-xl",labelFloat:"text-base",pt:"pt-8"}},Wo={label:""},Uo=(e,o,r)=>Object.prototype.hasOwnProperty.call(r,e)?e:o;function _e(e){const{size:o="medium",sx:r={},style:n={},className:c="",onChange:l,value:a,defaultValue:i,disabled:p=!1,label:h,localeText:x,type:u="text",...f}=e,{t:S}=re(),C=Uo(o,"medium",Yo),T=a!==void 0,[F,P]=d.useState(i??""),[y,v]=d.useState(!1),k=T?a:F,m=y||String(k).length>0,N=h??(x==null?void 0:x.label)??S("materialInput.label",Wo.label),O=H(r,Vo),A={tw:$(O.root.tw,O.input.tw),css:{...O.root.css,...O.input.css}},B=$("relative inline-flex",O.root.tw),_=Ko[C],j=$("w-[300px] bg-transparent text-[var(--foreground)] outline-none transition-all duration-200 ease-in-out","border-b border-b-[var(--border)]","hover:border-b-[var(--input-accent)]","focus:border-b-[var(--input-accent)]",p&&"text-[var(--muted-foreground)] border-b-[var(--muted)] cursor-not-allowed hover:border-b-[var(--muted)]",_.wrapper,_.pt),w=b({baseClassName:j,className:c,style:n,sxSlot:A}),L=$("absolute left-0 transition-all duration-200 ease-in-out pointer-events-none",m?`top-1 ${_.labelFloat} text-[var(--input-accent)]`:`top-1/2 -translate-y-1/2 ${_.label} text-[var(--muted-foreground)]`,y&&m&&"text-[var(--input-accent)]",p&&"text-[var(--muted-foreground)]",O.label.tw),W=b({baseClassName:L,sxSlot:{tw:"",css:O.label.css}}),D=d.useCallback(Z=>{const R=Z.target.value;T||P(R),l==null||l(R)},[T,l]),z=d.useCallback(Z=>{var R;v(!0),(R=f.onFocus)==null||R.call(f,Z)},[f.onFocus]),E=d.useCallback(Z=>{var R;v(!1),(R=f.onBlur)==null||R.call(f,Z)},[f.onBlur]),{onFocus:M,onBlur:U,...K}=f;return s.jsxs("div",{className:B,children:[s.jsx("input",{...K,type:u,className:w.className,style:w.style,value:k,disabled:p||void 0,onChange:D,onFocus:z,onBlur:E,"aria-label":N||void 0}),N&&s.jsx("label",{className:W.className,style:W.style,children:N})]})}_e.propTypes={size:t.oneOf(["small","medium","large","huge"]),sx:t.oneOfType([t.object,t.string]),style:t.object,className:t.string,onChange:t.func,value:t.string,defaultValue:t.string,disabled:t.bool,label:t.string,localeText:t.shape({label:t.string}),type:t.string};const Ho=["root","input"],Zo={small:"small",medium:"medium",large:"large",huge:"huge"},Go={small:"h-8 text-xs px-2.5",medium:"h-10 text-sm px-3",large:"h-12 text-base px-3.5",huge:"h-14 text-lg px-4"},qo=(e,o,r)=>Object.prototype.hasOwnProperty.call(r,e)?e:o;function Ae(e){const{type:o="default",size:r="medium",sx:n={},style:c={},className:l="",onClick:a,onChange:i,value:p,defaultValue:h,disabled:x=!1,placeholder:u="",maxlength:f=524288,status:S,...C}=e,T=qo(r,"medium",Zo),F=o==="textarea",P=o==="password",y=S==="error",v=H(n,Ho),k={tw:$(v.root.tw,v.input.tw),css:{...v.root.css,...v.input.css}},m=$("inline-flex",v.root.tw),N=$("w-[300px] rounded-[var(--radius)] border bg-[var(--input-bg)] text-[var(--foreground)] outline-none transition-all duration-200 ease-in-out","border-[var(--border)] shadow-[var(--input-shadow)]","hover:border-[var(--input-accent)]","focus:border-[var(--input-accent)] focus:shadow-[var(--input-focus-shadow)]",y&&"border-[var(--input-error-border)] bg-[var(--input-error-bg)] text-[var(--input-error-fg)] hover:border-[var(--input-error-border)] focus:shadow-[var(--input-error-focus-shadow)]",x&&"bg-[var(--muted)] text-[var(--muted-foreground)] border-[var(--muted)] cursor-not-allowed shadow-none hover:border-[var(--muted)] focus:shadow-none",Go[T]),O=b({baseClassName:N,className:l,style:c,sxSlot:k}),A=p!==void 0,B={className:O.className,style:O.style,onClick:a,onChange:i?_=>i(_.target.value):void 0,value:A?p:void 0,defaultValue:A?void 0:h??"",disabled:x||void 0,placeholder:u,maxLength:f,"aria-invalid":y||void 0,...C};return s.jsx("div",{className:m,children:P?s.jsx("form",{onSubmit:_=>_.preventDefault(),style:{display:"inline-flex"},autoComplete:"off",children:s.jsx("input",{...B,type:"password"})}):F?s.jsx("textarea",{...B,className:`${B.className} min-h-[80px] py-2 resize-y`}):s.jsx("input",{...B,type:"text"})})}Ae.propTypes={type:t.oneOf(["default","textarea","password"]),size:t.oneOf(["small","medium","large","huge"]),sx:t.oneOfType([t.object,t.string]),style:t.object,className:t.string,onClick:t.func,onChange:t.func,value:t.string,defaultValue:t.string,disabled:t.bool,placeholder:t.string,maxlength:t.number,status:t.oneOf(["default","error"])};Ae.MaterialInput=_e;const ge=["root"];function Xo(e,o){const{sx:r={},style:n={},className:c="",children:l,...a}=e,i=H(r,ge),p=b({baseClassName:"flex items-center px-4 bg-[var(--layout-header-bg)] text-[var(--layout-header-color)]",className:c,sxSlot:i.root,baseStyle:{height:"var(--layout-header-height)",borderBottom:"1px solid var(--layout-border)"},style:n});return s.jsx("header",{ref:o,className:p.className,style:p.style,...a,children:l})}const Me=d.forwardRef(Xo);Me.displayName="LayoutHeader";Me.propTypes={sx:t.oneOfType([t.string,t.object]),style:t.object,className:t.string,children:t.node};function Jo(e,o){const{sx:r={},style:n={},className:c="",children:l,...a}=e,i=H(r,ge),p=b({baseClassName:"flex items-center px-4 bg-[var(--layout-footer-bg)] text-[var(--layout-footer-color)]",className:c,sxSlot:i.root,baseStyle:{height:"var(--layout-footer-height)",borderTop:"1px solid var(--layout-border)"},style:n});return s.jsx("footer",{ref:o,className:p.className,style:p.style,...a,children:l})}const ze=d.forwardRef(Jo);ze.displayName="LayoutFooter";ze.propTypes={sx:t.oneOfType([t.string,t.object]),style:t.object,className:t.string,children:t.node};function Qo(e,o){const{sx:r={},style:n={},className:c="",width:l,children:a,...i}=e,p=H(r,ge),h=l??"var(--layout-sider-width)",x=b({baseClassName:"overflow-auto flex flex-col bg-[var(--layout-sider-bg)] text-[var(--layout-sider-color)]",className:c,sxSlot:p.root,baseStyle:{width:h,minWidth:h,maxWidth:"100%",borderRight:"1px solid var(--layout-border)"},style:n});return s.jsx("aside",{ref:o,className:x.className,style:x.style,...i,children:a})}const we=d.forwardRef(Qo);we.displayName="LayoutSider";we.propTypes={width:t.oneOfType([t.string,t.number]),sx:t.oneOfType([t.string,t.object]),style:t.object,className:t.string,children:t.node};function es(e,o){const{sx:r={},style:n={},className:c="",width:l,children:a,...i}=e,p=H(r,ge),h=l??"var(--layout-toc-width)",x=b({baseClassName:"overflow-auto flex flex-col bg-[var(--layout-toc-bg)] text-[var(--layout-toc-color)]",className:c,sxSlot:p.root,baseStyle:{width:h,minWidth:h,maxWidth:"100%",borderLeft:"1px solid var(--layout-border)"},style:n});return s.jsx("nav",{ref:o,className:x.className,style:x.style,...i,children:a})}const Ce=d.forwardRef(es);Ce.displayName="LayoutToc";Ce.propTypes={width:t.oneOfType([t.string,t.number]),sx:t.oneOfType([t.string,t.object]),style:t.object,className:t.string,children:t.node};function ts(e,o){const{sx:r={},style:n={},className:c="",children:l,...a}=e,i=H(r,ge),p=b({baseClassName:"flex-1 flex flex-col bg-[var(--layout-content-bg)] text-[var(--layout-content-color)]",className:c,sxSlot:i.root,baseStyle:{},style:n});return s.jsx("main",{ref:o,className:p.className,style:p.style,...a,children:l})}const Ee=d.forwardRef(ts);Ee.displayName="LayoutContent";Ee.propTypes={sx:t.oneOfType([t.string,t.object]),style:t.object,className:t.string,children:t.node};function os(e,o){const{sx:r={},style:n={},className:c="",hasSider:l,children:a,...i}=e,p=H(r,ge),h=l??d.Children.toArray(a).some(u=>{var f,S;return d.isValidElement(u)&&(u.type===we||u.type===Ce||((f=u.type)==null?void 0:f.displayName)==="LayoutSider"||((S=u.type)==null?void 0:S.displayName)==="LayoutToc")}),x=b({baseClassName:$("flex flex-1 flex-col min-h-0",h?"md:flex-row":""),className:c,sxSlot:p.root,style:n});return s.jsx("section",{ref:o,className:x.className,style:x.style,...i,children:a})}const te=d.forwardRef(os);te.displayName="Layout";te.Header=Me;te.Footer=ze;te.Sider=we;te.Content=Ee;te.Toc=Ce;te.propTypes={hasSider:t.bool,sx:t.oneOfType([t.string,t.object]),style:t.object,className:t.string,children:t.node};const $t=Me,Bt=ze,It=we,Ft=Ee,Dt=Ce,ss=["root","button","list","item"],Rt=Symbol("LIST_IGNORE"),bt=s.jsxs("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),s.jsx("path",{d:"M14 2v6h6"})]}),xt=s.jsx("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{d:"M18 6 6 18M6 6l12 12"})});function rs(e,o){const{sx:r={},style:n={},className:c="",accept:l="image/*",multiple:a=!1,onChange:i=()=>{},beforeUpload:p=()=>{},files:h=[],showUploadList:x=!0,maxCount:u=20,maxSize:f=100,btnText:S="选择文件",btnStyle:C,showSize:T=!0,disabled:F=!1,...P}=e,y=d.useId(),v=h||[],k=H(r,ss),m=d.useCallback(async(j,w)=>{if(!p)return!0;try{const L=await p(j,w);return L===void 0?!0:L}catch{return!1}},[p]),N=d.useCallback(async j=>{const L=Array.from(j.target.files||[]).filter(z=>z.size/1024/1024>f?(console.warn(`[Tango Upload] ${z.name} 超过 ${f}MB,已被过滤`),!1):!0),W=a?L.slice(0,u):L.slice(0,1),D=[];for(const z of W){const E=await m(z,W);if(E===!1){console.warn(`[Tango Upload] ${z.name} 被 beforeUpload 拦截`);continue}if(E===Rt){console.warn(`[Tango Upload] ${z.name} 被 LIST_IGNORE 忽略`);continue}if(E instanceof Blob){const M=E instanceof File?E:new File([E],z.name,{type:z.type});D.push(M)}else D.push(z)}j.target.value="",i(D)},[a,u,f,m,i]),O=d.useCallback((j,w)=>{const L=v.filter((W,D)=>D!==w);i(L)},[v,i]),A=b({baseClassName:"inline-flex flex-col gap-3",className:c,sxSlot:k.root,style:n}),B=b({baseClassName:$("list-none p-0 m-0 max-h-[150px] max-w-[400px] overflow-y-auto","border border-[var(--upload-border)] rounded-[var(--upload-radius)]","bg-[var(--upload-list-bg)]",v.length===0&&"border-transparent"),baseStyle:{borderRadius:"var(--upload-radius)"},sxSlot:k.list}),_=b({baseClassName:$("flex items-center gap-2 px-3 py-1.5 text-sm","text-[var(--upload-item-text)] hover:bg-[var(--upload-item-hover-bg)]","transition-colors"),sxSlot:k.item});return s.jsxs("div",{ref:o,className:A.className,style:A.style,...P,children:[s.jsx("input",{id:y,type:"file",accept:l,multiple:a,className:"hidden",onChange:N,disabled:F,"aria-hidden":"true",tabIndex:-1}),s.jsx(se,{disabled:F,style:C,sx:k.button,onClick:()=>{var j;return(j=document.getElementById(y))==null?void 0:j.click()},children:S}),x&&v.length>0&&s.jsx("ul",{className:B.className,style:B.style,children:a?v.map((j,w)=>s.jsxs("li",{className:_.className,style:_.style,children:[s.jsx("span",{className:"flex-shrink-0 text-[var(--upload-icon-color)]",children:bt}),s.jsxs("span",{className:"flex-1 truncate",children:[j.name,T&&s.jsxs("span",{className:"ml-1 text-xs text-[var(--muted-foreground)]",children:["(",(j.size/1024).toFixed(2)," KB)"]})]}),s.jsx("button",{type:"button",className:"flex-shrink-0 p-0.5 rounded hover:bg-[var(--upload-del-hover-bg)] text-[var(--upload-del-color)] transition-colors",onClick:()=>O(j,w),"aria-label":`删除 ${j.name}`,children:xt})]},w)):s.jsxs("li",{className:_.className,style:_.style,children:[s.jsx("span",{className:"flex-shrink-0 text-[var(--upload-icon-color)]",children:bt}),s.jsxs("span",{className:"flex-1 truncate",children:[v[0].name,T&&s.jsxs("span",{className:"ml-1 text-xs text-[var(--muted-foreground)]",children:["(",(v[0].size/1024).toFixed(2)," KB)"]})]}),s.jsx("button",{type:"button",className:"flex-shrink-0 p-0.5 rounded hover:bg-[var(--upload-del-hover-bg)] text-[var(--upload-del-color)] transition-colors",onClick:()=>O(v[0],0),"aria-label":`删除 ${v[0].name}`,children:xt})]})})]})}const $e=d.forwardRef(rs);$e.displayName="Upload";$e.LIST_IGNORE=Rt;$e.propTypes={sx:t.oneOfType([t.string,t.object]),style:t.object,className:t.string,accept:t.string,multiple:t.bool,onChange:t.func,beforeUpload:t.func,files:t.array,showUploadList:t.bool,maxCount:t.number,maxSize:t.number,btnText:t.string,btnStyle:t.object,showSize:t.bool,disabled:t.bool};const as=["root","icon","content","actions","closeIcon"],ft={cancel:"取消",action:"操作"},gt={small:{rootClass:"px-[15px] py-[8px] h-[45px] rounded-[6px] gap-[8px] border",iconSize:20,contentClass:"text-[14px]",closeIconSize:18,buttonBorderRadius:"0.8rem",buttonGap:"8px",buttonFontSize:"13px"},normal:{rootClass:"px-[20px] py-[10px] h-[52px] rounded-[8px] gap-[10px] border",iconSize:22,contentClass:"text-[15px]",closeIconSize:20,buttonBorderRadius:"1rem",buttonGap:"10px",buttonFontSize:"14px"},large:{rootClass:"px-[25px] py-[12px] h-[60px] rounded-[10px] gap-[12px] border-[1.5px]",iconSize:26,contentClass:"text-[16px]",closeIconSize:22,buttonBorderRadius:"1.2rem",buttonGap:"12px",buttonFontSize:"15px"}},ht={info:{bgVar:"--banner-info-bg",borderVar:"--banner-info-border",iconVar:"--banner-info-icon",textVar:"--banner-info-text"},success:{bgVar:"--banner-success-bg",borderVar:"--banner-success-border",iconVar:"--banner-success-icon",textVar:"--banner-success-text"},warning:{bgVar:"--banner-warning-bg",borderVar:"--banner-warning-border",iconVar:"--banner-warning-icon",textVar:"--banner-warning-text"},error:{bgVar:"--banner-error-bg",borderVar:"--banner-error-border",iconVar:"--banner-error-icon",textVar:"--banner-error-text"}},yt=(e,o,r)=>Object.prototype.hasOwnProperty.call(r,e)?e:o;function We(e){const{children:o,onCancel:r=()=>{},onAction:n=()=>{},size:c="normal",cancelText:l,actionText:a,level:i="info",transparent:p=!1,bannerBgColor:h,bannerBorderColor:x,bannerIconColor:u,sx:f={},style:S={},className:C="",i18nKey:T,localeText:F={},...P}=e,{t:y}=re(),v=yt(c,"normal",gt),k=yt(i,"info",ht),m=gt[v],N=ht[k],O=H(f,as),A={cancel:y("banner.cancel",ft.cancel),action:y("banner.action",ft.action),...F},B=l??(T==="cancel"?y("banner.cancel",A.cancel):A.cancel),_=a??(T==="action"?y("banner.action",A.action):A.action),j=o??B,w=h||(p===!0?"transparent":`var(${N.bgVar})`),L=x||`var(${N.borderVar})`,W=u||`var(${N.iconVar})`,D=`var(${N.textVar})`,z=b({baseClassName:$("flex w-full items-center justify-start transition-colors duration-200",m.rootClass),className:C,style:{backgroundColor:w,borderColor:L,color:p===!0?"var(--muted-foreground)":D,...S},sxSlot:O.root}),E=b({baseClassName:"shrink-0",baseStyle:{width:`${m.iconSize}px`,height:`${m.iconSize}px`,color:W},sxSlot:O.icon}),M=b({baseClassName:$("flex-grow text-left",m.contentClass),sxSlot:O.content}),U=b({baseClassName:"flex items-center justify-end flex-1",baseStyle:{gap:m.buttonGap},sxSlot:O.actions}),K=b({baseClassName:"shrink-0 cursor-pointer",baseStyle:{width:`${m.closeIconSize}px`,height:`${m.closeIconSize}px`,color:"var(--banner-close-icon)"},sxSlot:O.closeIcon}),Z=s.jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[s.jsx("path",{d:"M512.50142 958.397886c-119.320573 0-231.499491-46.465265-315.871087-130.837884C112.258737 743.188406 65.792449 631.010511 65.792449 511.688915c0-119.319549 46.466288-231.499491 130.837884-315.871087C281.002952 111.445208 393.180847 64.979944 512.50142 64.979944s231.499491 46.465265 315.871087 130.837884c84.372619 84.372619 130.837884 196.551538 130.837884 315.871087 0 119.321596-46.465265 231.499491-130.837884 315.871087C744.000911 911.932622 631.821993 958.397886 512.50142 958.397886zM512.50142 105.962334c-223.718271 0-405.726581 182.00831-405.726581 405.726581s182.00831 405.726581 405.726581 405.726581c223.718271 0 405.727605-182.00831 405.727605-405.726581S736.220714 105.962334 512.50142 105.962334z"}),s.jsx("path",{d:"M510.150886 775.953647c-18.107403 0-32.745798-14.678304-32.745798-32.785707L477.405087 452.191846c0-18.108426 14.638395-32.785707 32.745798-32.785707 18.107403 0 32.745798 14.678304 32.745798 32.785707l0 290.976094C542.896684 761.275343 528.258289 775.953647 510.150886 775.953647z"}),s.jsx("path",{d:"M511.357364 296.458969m-45.080731 0a44.054 44.054 0 1 0 90.161463 0 44.054 44.054 0 1 0-90.161463 0Z"})]}),R=s.jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[s.jsx("path",{d:"M869.472578 920.128281 154.906046 920.128281c-31.943526 0-60.545958-16.517185-76.514651-44.181245-15.968693-27.666106-15.96153-60.696384 0.016373-88.355327l357.283266-618.47194c15.971763-27.647687 44.568055-44.152593 76.496232-44.152593 31.930223-0.001023 60.527538 16.504906 76.499301 44.151569l357.283266 618.472963c15.977903 27.659967 15.984043 60.689221 0.017396 88.355327C930.018535 903.611096 901.416104 920.128281 869.472578 920.128281zM512.187265 169.139212c-15.962553 0-30.261211 8.251941-38.247092 22.075785l0 0L116.65793 809.686936c-7.989975 13.829983-7.993045 30.345122-0.008186 44.179199 7.983835 13.83203 22.285562 22.090111 38.257326 22.090111l714.566532 0c15.971763 0 30.273491-8.258081 38.256302-22.090111 7.984858-13.83203 7.980765-30.349215-0.008186-44.179199L550.437427 191.213973C542.452569 177.391153 528.152888 169.138188 512.187265 169.139212z"}),s.jsx("path",{d:"M513.732457 621.119233c-18.296715 0-33.257451-14.832823-33.257451-33.129538L480.475006 331.789639c0-18.296715 14.960737-33.129538 33.257451-33.129538 18.296715 0 33.257451 14.832823 33.257451 33.129538l0 256.200056C546.989909 606.28641 532.029172 621.119233 513.732457 621.119233z"}),s.jsx("path",{d:"M513.686409 737.619574m-49.991578 0a48.853 48.853 0 1 0 99.983155 0 48.853 48.853 0 1 0-99.983155 0Z"})]}),J=s.jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:s.jsx("path",{d:"M85.333333 512C85.333333 276.352 276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667S85.333333 747.648 85.333333 512z m683.093334-256.426667a358.954667 358.954667 0 0 0-122.922667-80.768A359.466667 359.466667 0 0 0 512 149.333333c-46.08 0-90.624 8.490667-133.504 25.472A358.954667 358.954667 0 0 0 255.573333 255.573333c-35.413333 35.413333-62.336 76.373333-80.768 122.922667A359.466667 359.466667 0 0 0 149.333333 512c0 46.08 8.490667 90.624 25.472 133.504A358.954667 358.954667 0 0 0 255.573333 768.426667c35.413333 35.413333 76.373333 62.336 122.922667 80.768A359.466667 359.466667 0 0 0 512 874.666667c46.08 0 90.624-8.490667 133.504-25.472a358.954667 358.954667 0 0 0 122.922667-80.768c35.413333-35.413333 62.336-76.373333 80.768-122.922667A359.466667 359.466667 0 0 0 874.666667 512c0-46.08-8.490667-90.624-25.472-133.504A358.912 358.912 0 0 0 768.426667 255.573333zM338.517333 640.213333L466.773333 512 338.517333 383.786667l45.226667-45.226667L512 466.688l128.213333-128.213333 45.226667 45.226666L557.312 512l128.213333 128.213333-45.226666 45.226667L512 557.312l-128.213333 128.213333-45.226667-45.226666z"})}),le=s.jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[s.jsx("path",{d:"M512.3 961.3c-247.1 0-448.1-201-448.1-448.1s201-448.1 448.1-448.1 448.1 201 448.1 448.1-201 448.1-448.1 448.1z m0-849.7c-221.4 0-401.6 180.2-401.6 401.6s180.2 401.6 401.6 401.6 401.6-180.2 401.6-401.6-180.2-401.6-401.6-401.6z"}),s.jsx("path",{d:"M441.2 676c-16.4 0-32.7-5.8-45.5-17.4l-151.3-138c-9.5-8.6-10.2-23.3-1.5-32.8 8.6-9.5 23.3-10.2 32.8-1.5L427 624.2c7.6 6.9 20.8 6.9 28.4 0l293.5-267.5c9.5-8.6 24.2-8 32.8 1.5 8.6 9.5 8 24.2-1.5 32.8L486.7 658.5c-12.8 11.7-29.1 17.5-45.5 17.5z"})]}),de=s.jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:s.jsx("path",{d:"M558.8 509.2l302.8-302.8c3.1-3.1 3.1-8.1 0-11.2l-30.8-30.8c-3.1-3.1-8.1-3.1-11.2 0L516.8 467.2c-1.5 1.5-4.1 1.5-5.6 0L208.3 164.3c-3.1-3.1-8.1-3.1-11.2 0l-30.8 30.8c-3.1 3.1-3.1 8.1 0 11.2l302.8 302.8c1.5 1.5 1.5 4.1 0 5.6l-302.8 303c-3.1 3.1-3.1 8.1 0 11.2l30.8 30.8c3.1 3.1 8.1 3.1 11.2 0l302.8-302.8c1.5-1.5 4.1-1.5 5.6 0l302.8 302.8c3.1 3.1 8.1 3.1 11.2 0l30.8-30.8c3.1-3.1 3.1-8.1 0-11.2L558.8 514.8c-1.5-1.5-1.5-4.1 0-5.6z"})}),ue={success:le,warning:R,error:J,info:Z};return s.jsxs("div",{className:z.className,style:z.style,"data-level":k,"data-size":v,...P,children:[s.jsx("div",{className:E.className,style:E.style,children:ue[k]}),s.jsx("div",{className:M.className,style:M.style,children:j}),s.jsxs("div",{className:U.className,style:U.style,children:[s.jsx(se,{type:"transparent",sx:{c:"var(--banner-btn-text)",br:m.buttonBorderRadius,bColor:"transparent",s:m.buttonFontSize},onClick:r,size:v==="normal"?"medium":v,children:B}),s.jsx(se,{type:"transparent",sx:{c:"var(--banner-btn-text)",br:m.buttonBorderRadius,b:1,bColor:"var(--banner-btn-border)",s:m.buttonFontSize},onClick:n,size:v==="normal"?"medium":v,children:_}),s.jsx("div",{className:K.className,style:K.style,onClick:r,children:de})]})]})}We.propTypes={children:t.node,onCancel:t.func,onAction:t.func,size:t.oneOf(["small","normal","large"]),cancelText:t.string,actionText:t.string,level:t.oneOf(["info","success","warning","error"]),transparent:t.bool,bannerBgColor:t.string,bannerBorderColor:t.string,bannerIconColor:t.string,sx:t.oneOfType([t.object,t.string]),style:t.object,className:t.string,i18nKey:t.string,localeText:t.object};const ns=["root","input","text"],Ye={hex:"HEX",rgb:"RGB",hsl:"HSL"},vt={small:{inputSize:20,fontSize:"11px",gap:"6px"},medium:{inputSize:28,fontSize:"12px",gap:"10px"},large:{inputSize:36,fontSize:"14px",gap:"14px"}},ls={hex:"hex",rgb:"rgb",hsl:"hsl"},St=(e,o,r)=>Object.prototype.hasOwnProperty.call(r,e)?e:o,cs=e=>{const o=parseInt(e.slice(1,3),16),r=parseInt(e.slice(3,5),16),n=parseInt(e.slice(5,7),16);return`rgb(${o}, ${r}, ${n})`},is=e=>{let o=parseInt(e.slice(1,3),16)/255,r=parseInt(e.slice(3,5),16)/255,n=parseInt(e.slice(5,7),16)/255;const c=Math.max(o,r,n),l=Math.min(o,r,n);let a=0,i=0,p=(c+l)/2;if(c!==l){const h=c-l;i=p>.5?h/(2-c-l):h/(c+l),c===o?a=(r-n)/h+(r<n?6:0):c===r?a=(n-o)/h+2:a=(o-r)/h+4,a/=6}return`hsl(${Math.round(a*360)}, ${Math.round(i*100)}%, ${Math.round(p*100)}%)`},ds=(e,o)=>{switch(o){case"rgb":return cs(e);case"hsl":return is(e);default:return e.toUpperCase()}};function Ue(e){const{value:o,defaultValue:r="#000000",onChange:n=()=>{},disabled:c=!1,showText:l=!1,format:a="hex",size:i="medium",sx:p={},style:h={},className:x="",i18nKey:u,localeText:f={},...S}=e,{t:C}=re(),T=St(i,"medium",vt),F=St(a,"hex",ls),P=vt[T],[y,v]=d.useState(r),k=o??y,m=H(p,ns),N={hex:C("colorpicker.hex",Ye.hex),rgb:C("colorpicker.rgb",Ye.rgb),hsl:C("colorpicker.hsl",Ye.hsl),...f},O=L=>{const W=L.target.value;o===void 0&&v(W),n(W)},A=[];if(l){const L=u||(typeof l=="string"?l:null)||F;A.push({label:N[L],value:ds(k,L)})}const B=b({baseClassName:$("inline-flex items-center",c&&"cursor-not-allowed opacity-60"),className:x,baseStyle:{gap:P.gap},style:h,sxSlot:m.root}),_=b({baseClassName:$("shrink-0 cursor-pointer border-2 border-[var(--border)] rounded-full bg-transparent overflow-hidden transition-colors duration-200",c&&"cursor-not-allowed"),baseStyle:{width:`${P.inputSize}px`,height:`${P.inputSize}px`,padding:0},sxSlot:m.input}),j=b({baseClassName:"flex flex-col text-[var(--muted-foreground)]",baseStyle:{fontSize:P.fontSize},sxSlot:m.text});return s.jsxs(s.Fragment,{children:[s.jsx("style",{children:` .tango-cp-input::-webkit-color-swatch-wrapper { padding: 0; } .tango-cp-input::-webkit-color-swatch { border: 0; border-radius: 9999px; } .tango-cp-input::-moz-color-swatch { border: 0; border-radius: 9999px; } `}),s.jsxs("div",{className:B.className,style:B.style,...S,children:[s.jsx("input