mantur-components 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`react`),require(`@arco-design/web-react`),require(`@arco-design/web-react/icon`),require(`react-i18next`),require(`react/jsx-runtime`),require(`next-themes`)):typeof define==`function`&&define.amd?define([`exports`,`react`,`@arco-design/web-react`,`@arco-design/web-react/icon`,`react-i18next`,`react/jsx-runtime`,`next-themes`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ManturComponents={},e.React,e.ArcoDesign,e.ArcoDesignIcon,e.ReactI18next,e.jsxRuntime,e.nextThemes))})(this,function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=Object.create,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty,p=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=u(t),a=0,o=i.length,s;a<o;a++)s=i[a],!f.call(e,s)&&s!==n&&c(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=l(t,s))||r.enumerable});return e},h=(e,t,n)=>(n=e==null?{}:s(d(e)),m(t||!e||!e.__esModule?c(n,`default`,{value:e,enumerable:!0}):n,e)),g=`/api`,_=`/users/me/points`,v=`mantur-points-refresh`,y=`mantur-tenant-context-change`;function b(){return typeof window<`u`&&window.__MANTUR_COMPONENTS_API_BASE__?window.__MANTUR_COMPONENTS_API_BASE__:g}function x(){return typeof window<`u`&&window.__MANTUR_COMPONENTS_POINTS_ENDPOINT__?window.__MANTUR_COMPONENTS_POINTS_ENDPOINT__:_}function S(e){if(typeof document>`u`)return;let t=`${encodeURIComponent(e)}=`;return document.cookie.split(`; `).find(e=>e.startsWith(t))?.slice(t.length)}function C(e){if(typeof document>`u`)return;let t=encodeURIComponent(e),n=window.location.hostname,r=[void 0,n],i=n.split(`.`);i.length>=2&&r.push(`.${i.slice(-2).join(`.`)}`),r.forEach(e=>{document.cookie=`${t}=; path=/; max-age=0${e?`; domain=${e}`:``}`})}function w(e){let t=JSON.parse(e||`null`);if(!t)throw Error(`Request failed`);if(t.code!==0)throw Error(t.message||`Request failed`);return t}async function T(e,t={}){let n=S(`front-token`),r=S(`Accept-Language`),i=t.headers||{};return n&&(i.Authorization=decodeURIComponent(n)),r&&(i[`Accept-Language`]=decodeURIComponent(r)),new Promise((n,r)=>{let a=new XMLHttpRequest;a.open(t.method||`GET`,`${b()}${e}`,!0),a.timeout=t.timeout||1e4,Object.entries(i).forEach(([e,t])=>{a.setRequestHeader(e,t)}),a.onload=()=>{try{let e=w(a.responseText);if(a.status<200||a.status>=300){r(Error(e.message||a.statusText));return}n(e)}catch(e){r(e)}},a.onerror=()=>r(Error(`Network request failed`)),a.ontimeout=()=>r(Error(`Network request timed out`)),a.send(t.body??null)})}async function E(){try{await T(`/auth/front-logout`,{method:`DELETE`})}catch(e){console.warn(`Logout request failed, continuing local logout.`,e)}finally{C(`front-token`),C(`refreshToken`),typeof window<`u`&&window.location.reload()}}async function D(e){let t;if(e.avatarFile){let n=new FormData;n.append(`file`,e.avatarFile),t=(await T(`/users/me/avatar`,{method:`POST`,body:n})).data}return(await T(`/users/me`,{method:`PUT`,headers:{"Content-Type":`application/json;charset=utf-8`},body:JSON.stringify({nickname:e.nickname})})).data||t}function O(e){let t=(...t)=>{let n=t.map(t=>e?.[t]).find(e=>e!==void 0);return typeof n==`number`?n:Number(n||0)};return{total:t(`total`,`totalPoints`,`balance`,`points`),recharge:t(`recharge`,`rechargePoints`,`paidPoints`),gifted:t(`gifted`,`giftedPoints`,`bonusPoints`)}}async function k(){return O((await T(x())).data)}async function A(){let e=await k();return typeof window<`u`&&window.dispatchEvent(new CustomEvent(v,{detail:e})),e}function j(e,t){return t?.tenantId?e.find(e=>e.tenantId===t.tenantId)||{tenantId:t.tenantId,tenantName:t.tenantName||t.tenantId,roles:t.roles?.map(e=>({roleCode:e,roleName:e}))}:e.find(e=>e.isOwner)||e[0]}function M(e){typeof window<`u`&&(window.__MANTUR_COMPONENTS_TENANT_CONTEXT__=e,window.dispatchEvent(new CustomEvent(y,{detail:e})))}async function N(){return(await T(`/users/me/tenants`)).data||[]}async function P(){return(await T(`/auth/current-tenant`)).data}async function F(e){return(await T(`/auth/current-tenant/${e}`,{method:`PUT`})).data}async function ee(e=`refresh`){let[t,n]=await Promise.all([N(),P()]),r={tenants:t,currentTenant:j(t,n),auth:n,reason:e};return M(r),r}async function te(e){let t=await F(e),n=await N(),r={tenants:n,currentTenant:j(n,t),auth:t,reason:`switch`};return M(r),r}var I={title:`Mantur`,switchTeam:`Switch Team`,personalSettings:`Personal Settings`,logout:`Logout`,loading:`Loading...`,owner:`Owner`,member:`Member`,createTeam:`Create Team`,createTeamComingSoon:`Create team is coming soon`,switchedToTeam:`Switched team`,error:`Request failed`,profileTitle:`Profile`,profileNickname:`Nickname`,profileNicknamePlaceholder:`Please enter nickname`,profileAvatar:`Avatar`,profileUploadAvatar:`Upload Avatar`,profileAvatarHint:`JPG/PNG/WebP, max 2MB, max 2048px.`,profileAvatarTooLarge:`Avatar must be less than 2MB`,profileAvatarDimensionExceeded:`Avatar dimensions must be within 2048px`,profileAvatarInvalidImage:`Invalid image`,profileUpdateSuccess:`Profile updated`,profileSave:`Save`,profileCancel:`Cancel`,myPoints:`My Points`,totalBalance:`Total Balance`,rechargePoints:`Recharge Points`,giftedPoints:`Gifted Points`,recharge:`Recharge`,rechargeTitle:`Recharge Points`,pointsDetail:`Points Detail`,close:`Close`,currentBalance:`Current Balance`,pointsUnit:`points`,rechargeHint:`Recharge points are valid for 2 years after arrival.`,payNow:`Pay Now`,rechargeSuccess:`Recharge successful`,all:`All`,income:`Income`,expense:`Expense`,source:`Source`,sourceAll:`All Sources`,sourceRecharge:`Recharge`,sourceGifted:`Gifted`,dateRange:`Date Range`,startDate:`Start Date`,endDate:`End Date`,dateTo:`to`,query:`Query`,refreshed:`Refreshed`,pointsDeductionTip:`Points expiring soon are deducted first.`,pointsNoteTitle:`Note`,pointsAccountNote:`Points are attached to your personal account. You recharge, consume, and manage them yourself. Others cannot recharge or use them for you. Recharge points are valid for 2 years; gifted points follow the validity set by operations.`},L={languageZh:`中文`,languageEn:`English`},R={title:`漫途`,switchTeam:`切换团队`,personalSettings:`个人设置`,logout:`退出登录`,loading:`加载中...`,owner:`管理员`,member:`成员`,createTeam:`创建团队`,createTeamComingSoon:`创建团队功能即将上线`,switchedToTeam:`已切换团队`,error:`请求失败`,profileTitle:`个人资料`,profileNickname:`昵称`,profileNicknamePlaceholder:`请输入昵称`,profileAvatar:`头像`,profileUploadAvatar:`上传头像`,profileAvatarHint:`支持 JPG/PNG/WebP,最大 2MB,尺寸不超过 2048px。`,profileAvatarTooLarge:`头像不能超过 2MB`,profileAvatarDimensionExceeded:`头像尺寸不能超过 2048px`,profileAvatarInvalidImage:`图片无效`,profileUpdateSuccess:`个人资料已更新`,profileSave:`保存`,profileCancel:`取消`,myPoints:`我的积分`,totalBalance:`总余额`,rechargePoints:`充值积分`,giftedPoints:`赠送积分`,recharge:`去充值`,rechargeTitle:`充值积分`,pointsDetail:`积分明细`,close:`关闭`,currentBalance:`当前余额`,pointsUnit:`积分`,rechargeHint:`充值积分有效期 2 年(自到账日起算),支付后不可退换。`,payNow:`立即支付`,rechargeSuccess:`充值成功`,all:`全部`,income:`获得`,expense:`消耗`,source:`来源`,sourceAll:`全部来源`,sourceRecharge:`充值`,sourceGifted:`赠送`,dateRange:`日期查询`,startDate:`开始日期`,endDate:`结束日期`,dateTo:`至`,query:`查询`,refreshed:`已刷新`,pointsDeductionTip:`优先扣减即将到期的积分`,pointsNoteTitle:`说明`,pointsAccountNote:`积分账户挂在你的个人账号上,自己充值、自己消耗、自己负责;他人不能代充、不能代用。充值积分有效期固定 2 年;赠送积分有效期由后台运营发放时设置。`},z={languageZh:`中文`,languageEn:`English`},B=`i18nextLng`,V=`manturLanguageSource`,H=`mantur-language-change`,U={"zh-CN":{...R,...z},"en-US":{...I,...L}};function W(e){return e?.toLowerCase().startsWith(`en`)?`en-US`:`zh-CN`}function G(){return typeof window>`u`?`zh-CN`:W(window.localStorage.getItem(`i18nextLng`)||document.documentElement.lang||navigator.language)}function K(e){return U[W(e)]}var q=B,J=V;function ne(e,t){document.cookie=`${encodeURIComponent(e)}=${encodeURIComponent(t)}; path=/`}function re(){let{i18n:e}=(0,i.useTranslation)(),[o,s]=(0,t.useState)(()=>G()),c=K(o);return(0,t.useEffect)(()=>{s(W(e.language))},[e.language]),(0,a.jsx)(n.Dropdown,{droplist:(0,a.jsxs)(n.Menu,{selectedKeys:[o],onClickMenuItem:t=>{let n=W(t);localStorage.setItem(q,t),localStorage.setItem(J,`manual`),s(n),e.changeLanguage(t),ne(`Accept-Language`,t),window.dispatchEvent(new CustomEvent(H,{detail:n})),window.location.reload()},children:[(0,a.jsx)(n.Menu.Item,{children:c.languageZh},`zh-CN`),(0,a.jsx)(n.Menu.Item,{children:c.languageEn},`en-US`)]}),trigger:`click`,position:`br`,children:(0,a.jsx)(n.Button,{shape:`circle`,icon:(0,a.jsx)(r.IconLanguage,{})})})}function ie(){let{resolvedTheme:e,setTheme:t}=(0,o.useTheme)();return(0,a.jsx)(n.Button,{shape:`circle`,icon:e===`light`?(0,a.jsx)(r.IconMoonFill,{}):(0,a.jsx)(r.IconSunFill,{}),onClick:()=>{t(e===`light`?`dark`:`light`)}})}var Y=[{id:`points-500`,points:500,price:5},{id:`points-1000`,points:1e3,price:10},{id:`points-5500`,points:5500,price:50,recommended:!0},{id:`points-24000`,points:24e3,price:200}],ae=[{id:`recharge-1`,type:`income`,source:`recharge`,name:`积分充值`,meta:`2026-05-10 14:00:00 · 订单号 R20260510140000 · 套餐 $50`,date:`2026-05-10`,amount:5500,badgeKind:`recharge`,badgeText:`充值`},{id:`gift-1`,type:`income`,source:`gift`,name:`系统赠送 · 新人礼包`,meta:`2026-05-08 09:00:00 · 有效期 30 天`,date:`2026-05-08`,amount:1e3,badgeKind:`gift`,badgeText:`赠送`},{id:`expense-1`,type:`expense`,name:`视频生成 — Sora 40秒 4K`,meta:`2026-05-10 16:45:22 · 制作中心`,date:`2026-05-10`,amount:-400,badgeKind:`deducted`,badgeText:`已扣除`},{id:`expense-2`,type:`expense`,name:`视频生成 — Sora 25秒 1080p`,meta:`2026-05-11 09:15:42 · 制作中心`,date:`2026-05-11`,amount:-250,badgeKind:`deducted`,badgeText:`已扣除`},{id:`expire-1`,type:`expense`,name:`积分过期`,meta:`2026-05-01 00:00:00 · 2026-04 批次到期未使用`,date:`2026-05-01`,amount:-100,badgeKind:`expired`,badgeText:`自然过期`},{id:`expense-3`,type:`expense`,name:`AI 对话 — GPT-4o 5轮`,meta:`2026-05-07 10:08:55 · 剧本中心`,date:`2026-05-07`,amount:-10,badgeKind:`deducted`,badgeText:`已扣除`},{id:`expense-4`,type:`expense`,name:`图片生成 — DALL-E 5张`,meta:`2026-05-04 14:20:11 · 制作中心`,date:`2026-05-04`,amount:-75,badgeKind:`deducted`,badgeText:`已扣除`}],{RangePicker:oe}=n.DatePicker,se=21,ce=7;function le(e){return e===`recharge`?`arcoblue`:e===`gift`?`cyan`:e===`expired`?`gray`:`orange`}function ue({visible:e,points:i,text:o,onCancel:s,onRecharge:c}){let[l,u]=(0,t.useState)(`all`),[d,f]=(0,t.useState)(`all`),[p,m]=(0,t.useState)([`2026-04-15`,`2026-05-15`]),[h,g]=(0,t.useState)(1),_=e=>new Intl.NumberFormat().format(e),v=(0,t.useMemo)(()=>{let[e,t]=p;return ae.filter(n=>{let r=l===`all`||n.type===l,i=d===`all`||n.source===d,a=!e||n.date>=e,o=!t||n.date<=t;return r&&i&&a&&o})},[p,d,l]),y=[{title:o.pointsDetail,dataIndex:`name`,render:(e,t)=>(0,a.jsxs)(`div`,{className:`min-w-0`,children:[(0,a.jsx)(n.Typography.Text,{className:`font-medium!`,children:t.name}),(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`mt-1 block! text-xs!`,children:t.meta})]})},{title:o.pointsUnit,dataIndex:`amount`,width:120,align:`right`,render:(e,t)=>(0,a.jsxs)(n.Typography.Text,{className:`font-semibold! ${t.amount>0?`text-arco-success-6!`:`text-arco-danger-6!`}`,children:[t.amount>0?`+`:``,_(t.amount)]})},{title:o.source,dataIndex:`badgeText`,width:110,align:`right`,render:(e,t)=>(0,a.jsx)(n.Tag,{color:le(t.badgeKind),children:t.badgeText})}];return(0,a.jsx)(n.Modal,{title:o.pointsDetail,visible:e,footer:(0,a.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,a.jsx)(n.Button,{onClick:s,children:o.close}),(0,a.jsx)(n.Button,{type:`primary`,icon:(0,a.jsx)(r.IconPlus,{}),onClick:()=>{s(),c()},children:o.recharge})]}),onCancel:s,style:{width:780,maxWidth:`calc(100vw - 48px)`},children:(0,a.jsxs)(`div`,{className:`max-h-[70vh] overflow-y-auto`,children:[(0,a.jsxs)(n.Card,{bordered:!1,className:`from-arco-primary-light-1/40 to-cyan-400/5 rounded-none! bg-linear-to-br!`,children:[(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`text-xs!`,children:o.totalBalance}),(0,a.jsxs)(`div`,{className:`mt-1.5 mb-3.5 `,children:[(0,a.jsx)(n.Typography.Text,{className:`text-3xl! font-bold!`,children:_(i.total)}),(0,a.jsxs)(n.Typography.Text,{type:`secondary`,className:`ml-2 text-sm! `,children:[`🪙 `,o.pointsUnit]})]}),(0,a.jsxs)(n.Grid.Row,{gutter:12,children:[(0,a.jsx)(n.Grid.Col,{span:12,children:(0,a.jsxs)(n.Card,{size:`small`,children:[(0,a.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`text-xs!`,children:o.rechargePoints}),(0,a.jsx)(n.Tag,{color:`arcoblue`,children:o.sourceRecharge})]}),(0,a.jsx)(n.Typography.Text,{className:`text-lg! font-semibold!`,children:_(i.recharge)})]})}),(0,a.jsx)(n.Grid.Col,{span:12,children:(0,a.jsxs)(n.Card,{size:`small`,children:[(0,a.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`text-xs!`,children:o.giftedPoints}),(0,a.jsx)(n.Tag,{color:`success`,children:o.sourceGifted})]}),(0,a.jsx)(n.Typography.Text,{className:`text-lg! font-semibold!`,children:_(i.gifted)})]})})]}),(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`mt-2.5 block! text-xs!`,children:o.pointsDeductionTip})]}),(0,a.jsxs)(`div`,{className:`px-6 py-4`,children:[(0,a.jsxs)(n.Tabs,{activeTab:l,onChange:e=>u(e),children:[(0,a.jsx)(n.Tabs.TabPane,{title:o.all},`all`),(0,a.jsx)(n.Tabs.TabPane,{title:o.income},`income`),(0,a.jsx)(n.Tabs.TabPane,{title:o.expense},`expense`)]}),(0,a.jsxs)(`div`,{className:`mt-2 mb-3.5 flex flex-wrap items-center gap-2.5`,children:[(0,a.jsxs)(n.Select,{value:d,style:{width:140},onChange:e=>f(e),children:[(0,a.jsx)(n.Select.Option,{value:`all`,children:o.sourceAll}),(0,a.jsx)(n.Select.Option,{value:`recharge`,children:o.sourceRecharge}),(0,a.jsx)(n.Select.Option,{value:`gift`,children:o.sourceGifted})]}),(0,a.jsx)(oe,{value:p,onChange:e=>m(e),style:{width:260}}),(0,a.jsx)(n.Button,{onClick:()=>n.Message.success(o.refreshed),children:o.query})]}),(0,a.jsx)(n.Table,{rowKey:`id`,columns:y,data:v,pagination:!1,border:!1}),(0,a.jsx)(n.Pagination,{className:`mt-3 flex justify-center!`,current:h,pageSize:ce,total:se,onChange:g})]}),(0,a.jsx)(n.Card,{bordered:!1,className:`bg-arco-primary-light-1/30 rounded-none!`,children:(0,a.jsxs)(n.Typography.Text,{type:`secondary`,className:`text-xs! leading-6!`,children:[(0,a.jsxs)(`strong`,{children:[o.pointsNoteTitle,`:`]}),o.pointsAccountNote]})})]})})}var de=I;function fe(e){return{...de,...e}}var X=2048,pe=2*1024*1024;function me(e){return new Promise((t,n)=>{let r=URL.createObjectURL(e),i=new Image;i.onload=()=>{URL.revokeObjectURL(r),t({width:i.naturalWidth,height:i.naturalHeight})},i.onerror=()=>{URL.revokeObjectURL(r),n(Error(`invalid image`))},i.src=r})}function he({visible:e,user:i,labels:o,onCancel:s,onSubmit:c}){let l=fe(o),[u]=n.Form.useForm(),[d,f]=(0,t.useState)(!1),[p,m]=(0,t.useState)(null),[h,g]=(0,t.useState)(null),_=(0,t.useRef)(null);(0,t.useEffect)(()=>()=>{_.current&&=(URL.revokeObjectURL(_.current),null)},[]),(0,t.useEffect)(()=>{e&&(u.setFieldsValue({nickname:i?.nickname||i?.username||``}),m(null),g(e=>(e&&URL.revokeObjectURL(e),_.current=null,null)))},[e,i,u]);let v=(e,t)=>{console.error(t),n.Message.error(e)},y=e=>{n.Message.success(e)};return(0,a.jsx)(n.Modal,{title:l.profileTitle,visible:e,onOk:async()=>{try{let e=await u.validate();f(!0),await c({nickname:e.nickname,avatarFile:p}),y(l.profileUpdateSuccess),s()}catch(e){e instanceof Error&&v(e.message||l.error,e)}finally{f(!1)}},onCancel:s,confirmLoading:d,okText:l.profileSave,cancelText:l.profileCancel,children:(0,a.jsxs)(n.Form,{form:u,layout:`vertical`,children:[(0,a.jsx)(n.Form.Item,{label:l.profileNickname,field:`nickname`,rules:[{required:!0,message:l.profileNicknamePlaceholder}],children:(0,a.jsx)(n.Input,{placeholder:l.profileNicknamePlaceholder,allowClear:!0})}),(0,a.jsx)(n.Form.Item,{label:l.profileAvatar,children:(0,a.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(n.Avatar,{size:64,className:`shrink-0 bg-arco-primary-light-1!`,children:h||i?.avatar?(0,a.jsx)(`img`,{src:h||i?.avatar,alt:``,className:`block h-full w-full object-cover`}):i?.nickname?.[0]||i?.username?.[0]||`U`}),(0,a.jsx)(n.Upload,{accept:`image/*`,showUploadList:!1,beforeUpload:async e=>{if(e.size>pe)return v(l.profileAvatarTooLarge),!1;try{let{width:t,height:n}=await me(e);if(t>X||n>X)return v(l.profileAvatarDimensionExceeded),!1}catch(e){return v(l.profileAvatarInvalidImage,e),!1}return g(t=>{t&&URL.revokeObjectURL(t);let n=URL.createObjectURL(e);return _.current=n,n}),m(e),!1},children:(0,a.jsx)(n.Button,{type:`outline`,size:`small`,icon:(0,a.jsx)(r.IconUpload,{}),children:l.profileUploadAvatar})})]}),(0,a.jsx)(`span`,{className:`text-xs text-arco-text-3`,children:l.profileAvatarHint})]})})]})})}function ge(e){return e?.nickname?.[0]||e?.username?.[0]||`U`}function Z({user:e,size:t,className:r=``}){return(0,a.jsx)(n.Avatar,{size:t,className:`bg-arco-primary/20! text-arco-primary-6 border-2 font-bold ${r}`,children:e?.avatar?(0,a.jsx)(`img`,{src:e.avatar,alt:`avatar`,className:`h-full w-full object-cover`}):ge(e)})}function _e({visible:e,user:i,points:o,text:s,onCancel:c,onPay:l}){let[u,d]=(0,t.useState)(Y[2].id),f=e=>new Intl.NumberFormat().format(e),p=Y.find(e=>e.id===u)||Y[0];return(0,a.jsx)(n.Modal,{title:s.rechargeTitle,visible:e,footer:(0,a.jsxs)(`div`,{className:`mx-auto flex max-w-7xl items-center justify-between gap-5`,children:[(0,a.jsx)(`span`,{className:`text-arco-text-2 text-sm leading-6`,children:s.rechargeHint}),(0,a.jsxs)(n.Button,{type:`primary`,size:`large`,className:`min-w-48! font-bold!`,onClick:()=>l(p),children:[s.payNow,` · $`,p.price]})]}),onCancel:c,alignCenter:!1,wrapClassName:`overflow-hidden!`,style:{width:`100vw`,maxWidth:`100vw`,top:0,paddingBottom:0},className:`top-0! m-0! flex! h-screen! w-screen! max-w-none! flex-col! [&_.arco-modal-body]:min-h-0! [&_.arco-modal-body]:flex-1! [&_.arco-modal-body]:overflow-hidden! [&_.arco-modal-body]:p-0! [&_.arco-modal-close-icon]:top-1.5! [&_.arco-modal-close-icon]:right-4! [&_.arco-modal-close-icon]:inline-flex! [&_.arco-modal-close-icon]:h-9! [&_.arco-modal-close-icon]:w-9! [&_.arco-modal-close-icon]:items-center! [&_.arco-modal-close-icon]:justify-center! [&_.arco-modal-close-icon]:rounded-lg! [&_.arco-modal-close-icon]:text-lg! [&_.arco-modal-close-icon]:leading-9! [&_.arco-modal-close-icon]:transition-colors [&_.arco-modal-close-icon:hover]:bg-arco-fill-2 [&_.arco-modal-close-icon:hover]:text-arco-primary-6 [&_.arco-modal-close-icon_svg]:h-[18px]! [&_.arco-modal-close-icon_svg]:w-[18px]! [&_.arco-modal-content]:flex! [&_.arco-modal-content]:h-auto! [&_.arco-modal-content]:min-h-0! [&_.arco-modal-content]:flex-1! [&_.arco-modal-content]:flex-col! [&_.arco-modal-content]:overflow-hidden! [&_.arco-modal-content]:rounded-none! [&_.arco-modal-footer]:shrink-0! [&_.arco-modal-header]:shrink-0!`,children:(0,a.jsxs)(`div`,{className:`mx-auto flex h-full w-full max-w-7xl flex-col items-center `,children:[(0,a.jsxs)(`div`,{className:`w-full border-arco-border-1 bg-arco-fill-1 text-arco-text-2 flex items-center gap-2.5 rounded-lg border px-3.5 py-3 text-sm`,children:[(0,a.jsx)(Z,{user:i,size:32,className:`shrink-0`}),(0,a.jsxs)(`span`,{children:[i?.nickname||i?.username,` · `,s.currentBalance,` `,(0,a.jsx)(`strong`,{className:`text-arco-text-1`,children:f(o.total)}),` `,s.pointsUnit]})]}),(0,a.jsx)(`div`,{className:`mt-6 w-full`,children:(0,a.jsx)(n.Grid.Row,{gutter:[16,16],children:Y.map(e=>(0,a.jsx)(n.Grid.Col,{xs:24,sm:12,lg:6,children:(0,a.jsxs)(n.Card,{hoverable:!0,role:`button`,tabIndex:0,onClick:()=>d(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&d(e.id)},bodyStyle:{minHeight:192,display:`flex`,flexDirection:`column`,justifyContent:`space-between`},className:`border-arco-border-2! bg-arco-bg-2! relative cursor-pointer overflow-hidden rounded-lg! shadow-sm! transition-all duration-200 before:absolute before:inset-x-0 before:top-0 before:h-1 before:bg-linear-to-r before:from-arco-primary before:to-transparent hover:shadow-md! ${u===e.id?`border-arco-primary-6! bg-arco-primary-light-1/40! ring-arco-primary-6/20 ring-2! shadow-[0_18px_38px_rgb(var(--primary-6)/22%)]!`:`hover:border-arco-primary-6!`}`,children:[u===e.id?(0,a.jsx)(r.IconCheckCircleFill,{className:`text-arco-primary-6! absolute bottom-4 left-4 text-xl`}):null,`recommended`in e&&e.recommended?(0,a.jsx)(n.Tag,{color:`arcoblue`,className:`absolute top-4 right-4 text-xs! font-bold!`,children:`HOT`}):null,(0,a.jsxs)(`div`,{className:`min-w-0 pr-16`,children:[(0,a.jsxs)(n.Typography.Text,{className:`flex items-center text-3xl! leading-tight! font-bold!`,children:[f(e.points),(0,a.jsx)(`span`,{className:`ml-1 text-2xl`,children:`🪙`})]}),(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`mt-1 block! text-sm!`,children:s.pointsUnit})]}),(0,a.jsx)(`div`,{className:`mt-7 flex w-full justify-end`,children:(0,a.jsxs)(n.Typography.Text,{className:`text-arco-primary-6! text-right text-2xl! leading-tight! font-bold!`,children:[`$`,e.price]})})]})},e.id))})})]})})}function ve({user:e,points:t,text:i,onEditProfile:o,onRecharge:s,onPointsDetail:c,onLogout:l}){let u=e=>new Intl.NumberFormat().format(e);return(0,a.jsxs)(`div`,{className:`w-80 overflow-hidden rounded-xl border border-arco-border-2 bg-arco-bg-popup shadow-[0_10px_28px_rgb(0_0_0/12%)]`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3 px-6 pt-5 pb-4`,children:[(0,a.jsx)(Z,{user:e,size:48,className:`shrink-0`}),(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,a.jsx)(`span`,{className:`text-arco-text-1 truncate text-base leading-6 font-bold`,children:e?.nickname||e?.username}),(0,a.jsx)(n.Button,{type:`text`,size:`mini`,icon:(0,a.jsx)(r.IconEdit,{}),className:`text-arco-text-3 h-6! min-w-6! px-0!`,onClick:o})]}),e?.email?(0,a.jsx)(`span`,{className:`text-arco-text-3 truncate text-xs leading-5`,children:e.email}):null]})]}),(0,a.jsx)(n.Divider,{className:`m-0!`}),(0,a.jsxs)(`ul`,{className:`flex flex-col gap-3.5 px-6 py-4`,children:[(0,a.jsxs)(`li`,{className:`text-arco-text-2 flex items-center justify-between gap-4 text-sm`,children:[(0,a.jsx)(`span`,{children:i.myPoints}),(0,a.jsx)(`strong`,{className:`text-arco-primary-6 text-base font-bold`,children:u(t.total)})]}),(0,a.jsxs)(`li`,{className:`text-arco-text-2 flex items-center justify-between gap-4 text-sm`,children:[(0,a.jsx)(`span`,{children:i.rechargePoints}),(0,a.jsx)(`strong`,{className:`text-arco-text-1 text-base font-bold`,children:u(t.recharge)})]}),(0,a.jsxs)(`li`,{className:`text-arco-text-2 flex items-center justify-between gap-4 text-sm`,children:[(0,a.jsx)(`span`,{children:i.giftedPoints}),(0,a.jsx)(`strong`,{className:`text-arco-text-1 text-base font-bold`,children:u(t.gifted)})]})]}),(0,a.jsx)(n.Divider,{className:`m-0!`}),(0,a.jsxs)(`div`,{className:`flex flex-col gap-2 px-6 py-4`,children:[(0,a.jsx)(n.Button,{type:`primary`,long:!0,icon:(0,a.jsx)(r.IconPlus,{}),className:`h-10! rounded-md! font-semibold!`,onClick:s,children:i.recharge}),(0,a.jsx)(n.Button,{long:!0,icon:(0,a.jsx)(r.IconFile,{}),className:`border-arco-border-2! bg-arco-fill-1! text-arco-text-1! h-10! rounded-md! font-semibold!`,onClick:c,children:i.pointsDetail})]}),(0,a.jsx)(n.Divider,{className:`m-0!`}),(0,a.jsx)(`div`,{className:`px-6 py-4`,children:(0,a.jsx)(n.Button,{icon:(0,a.jsx)(r.IconPoweroff,{}),type:`text`,status:`danger`,long:!0,className:`flex! items-center justify-start gap-2 text-sm text-arco-text-2`,onClick:()=>void l?.(),children:i.logout})})]})}var ye=`https://mantur.ai/images/logo.png`,Q=[`from-arco-primary-light-1 to-arco-primary-light-2 text-arco-primary-6`,`from-arco-success-light-1 to-arco-success-light-2 text-arco-success-6`,`from-arco-warning-light-1 to-arco-warning-light-2 text-arco-warning-6`,`from-arco-danger-light-1 to-arco-danger-light-2 text-arco-danger-6`];function $(e,t=!1){return`flex h-8 min-h-8 w-8 min-w-8 flex-none items-center justify-center rounded-lg bg-linear-to-br font-bold leading-none ${Q[e%Q.length]} ${t?`shadow-[inset_0_1px_3px_rgb(0_0_0/8%)]`:``}`}function be(e){return e?.tenantName?.[0]?.toUpperCase()||`T`}function xe(e,t,n){let r=e?.roles?.map(e=>e.roleName).filter(Boolean);return r?.length?r.join(`, `):e?.isOwner?t:n}function Se({user:e,disabled:i=!1,brandSlot:o,children:s,onTenantContextChange:c}){let[l,u]=(0,t.useState)(()=>G()),d=K(l),[f,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(!1),[y,b]=(0,t.useState)(e),[x,S]=(0,t.useState)([]),[C,w]=(0,t.useState)(),[T,O]=(0,t.useState)(!1),k=(0,t.useRef)(c),[j,M]=(0,t.useState)({total:0,recharge:0,gifted:0}),N=C?.tenantId||``,P=i,F={total:j.total??0,recharge:j.recharge??0,gifted:j.gifted??0},I=async e=>{let t=await D(e);return t&&b(t),t};(0,t.useEffect)(()=>{b(e)},[e]),(0,t.useEffect)(()=>{k.current=c},[c]);let L=(0,t.useCallback)(e=>{S(e.tenants),w(e.currentTenant),k.current?.(e)},[]);(0,t.useEffect)(()=>{O(!0),ee().then(L).catch(e=>{console.warn(`Failed to refresh Mantur tenant context.`,e),n.Message.error(d.error)}).finally(()=>O(!1))},[L,d.error]),(0,t.useEffect)(()=>{let e=e=>{e instanceof CustomEvent&&M(e.detail)};return window.addEventListener(v,e),A().catch(e=>{console.warn(`Failed to refresh Mantur user points.`,e)}),()=>{window.removeEventListener(v,e)}},[]),(0,t.useEffect)(()=>{let e=e=>{u(e instanceof CustomEvent?W(e.detail):G())};return window.addEventListener(H,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(H,e),window.removeEventListener(`storage`,e)}},[]);let R=e=>{n.Message.success(e)},z=(e,t)=>{console.error(t),n.Message.error(e)},B=(0,t.useCallback)(async e=>{if(!P&&e!==N)try{O(!0),L(await te(e)),R(d.switchedToTeam)}catch(e){z(d.error,e)}finally{O(!1)}},[L,N,P,d.error,d.switchedToTeam]),V=e=>{let t={total:F.total+e.points,recharge:F.recharge+e.points,gifted:F.gifted};M(t),window.dispatchEvent(new CustomEvent(v,{detail:t})),n.Message.success(d.rechargeSuccess),h(!1)},U=(0,t.useMemo)(()=>(0,a.jsxs)(n.Menu,{className:`w-56 rounded-xl bg-arco-bg-popup shadow-[0_10px_28px_rgb(0_0_0/12%)] [&_.arco-menu-inner]:px-2 [&_.arco-menu-inner]:py-1`,selectedKeys:N?[N]:[],onClickMenuItem:B,children:[(0,a.jsx)(`div`,{className:`px-3 py-2 text-xs font-semibold tracking-[0.04em] text-arco-text-4 uppercase`,children:d.switchTeam}),x.map((e,t)=>(0,a.jsx)(n.Menu.Item,{className:`mb-1 h-auto! min-h-10! overflow-visible! rounded-lg! px-2! py-1! leading-normal!`,children:(0,a.jsxs)(`div`,{className:`flex w-full items-center gap-3 leading-normal`,children:[(0,a.jsx)(`div`,{className:$(t),children:be(e)}),(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-col justify-center gap-0.75`,children:[(0,a.jsx)(`span`,{className:`text-sm leading-5 font-medium text-arco-text-1`,children:e.tenantName}),(0,a.jsx)(`span`,{className:`text-xs leading-4 text-arco-text-3`,children:xe(e,d.owner,d.member)})]})]})},e.tenantId))]}),[B,N,x,d]),q=(0,a.jsx)(ve,{user:y,points:F,text:d,onEditProfile:()=>p(!0),onRecharge:()=>h(!0),onPointsDetail:()=>_(!0),onLogout:E}),J=Math.max(0,x.findIndex(e=>e.tenantId===C?.tenantId));return(0,a.jsxs)(`div`,{className:`flex h-20 items-center justify-between bg-transparent pr-8 shadow-[0_2px_10px_rgb(0_0_0/2%)] backdrop-blur-md max-md:pr-4`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,a.jsxs)(`div`,{className:`flex w-65 items-center gap-3 px-8 max-md:w-auto max-md:px-4`,children:[(0,a.jsx)(`div`,{className:`relative flex w-12 items-center justify-center overflow-hidden `,children:(0,a.jsx)(`img`,{src:ye,alt:`logo`,className:`w-full object-contain`,onError:e=>{e.currentTarget.style.display=`none`}})}),o??(0,a.jsx)(`span`,{className:`text-lg font-bold tracking-normal text-arco-text-1`,children:d.title})]}),(0,a.jsx)(n.Dropdown,{droplist:U,trigger:`click`,position:`bl`,disabled:P,children:(0,a.jsxs)(`div`,{"aria-disabled":P,className:`flex items-center gap-3 rounded-full border border-arco-border-1 bg-arco-bg-1 px-2 py-1.5 transition-all ${P?`cursor-not-allowed opacity-60`:`cursor-pointer hover:bg-arco-fill-2 hover:shadow-[0_4px_12px_rgb(0_0_0/8%)]`}`,children:[(0,a.jsx)(`div`,{className:$(J,!0),children:be(C)}),(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,a.jsx)(`span`,{className:`text-xs leading-none font-bold text-arco-text-1`,children:T?d.loading:C?.tenantName||d.loading}),(0,a.jsx)(`span`,{className:`mt-1 text-[10px] leading-none text-arco-text-3`,children:xe(C,d.owner,d.member)})]}),(0,a.jsx)(r.IconDown,{className:`ml-1 text-arco-text-3`})]})})]}),(0,a.jsx)(`div`,{className:`flex-1`,children:s}),(0,a.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,a.jsx)(ie,{}),(0,a.jsx)(re,{})]}),(0,a.jsx)(n.Dropdown,{droplist:q,trigger:`click`,position:`br`,onVisibleChange:e=>{e&&A().catch(e=>{console.warn(`Failed to refresh Mantur user points.`,e)})},children:(0,a.jsxs)(`div`,{className:`hover:bg-arco-fill-2 flex cursor-pointer items-center gap-2.5 rounded-full border border-transparent p-1 pr-2 transition-all`,children:[(0,a.jsxs)(`div`,{className:`from-arco-primary to-transparent relative rounded-full bg-linear-to-br p-0.5 shadow-sm`,children:[(0,a.jsx)(Z,{user:y,size:36}),(0,a.jsx)(`div`,{className:`bg-arco-success border-arco-bg-white absolute right-0 bottom-0 h-3 w-3 rounded-full border-2 shadow-sm`})]}),(0,a.jsx)(`div`,{className:`hidden flex-col md:flex`,children:(0,a.jsx)(`span`,{className:`text-arco-text-1 text-sm font-medium`,children:y?.nickname||y?.username})}),(0,a.jsx)(r.IconDown,{className:`text-arco-text-3 ml-1`})]})})]}),(0,a.jsx)(he,{visible:f,user:y,labels:d,onCancel:()=>p(!1),onSubmit:I}),(0,a.jsx)(_e,{visible:m,user:y,points:F,text:d,onCancel:()=>h(!1),onPay:V}),(0,a.jsx)(ue,{visible:g,points:F,text:d,onCancel:()=>_(!1),onRecharge:()=>h(!0)})]})}var Ce=h(p(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){"use strict";var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}))(),1);function we(e,t=`datetime`,n){if(!e)return`-`;let r=(n?W(n):G()).startsWith(`en`),i=t===`date`?r?`MM/DD/YYYY`:`YYYY-MM-DD`:r?`MM/DD/YYYY HH:mm:ss`:`YYYY-MM-DD HH:mm:ss`;return(0,Ce.default)(e).format(i)}e.ManturHeader=Se,e.formatDateByLang=we});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`react`),require(`@arco-design/web-react`),require(`@arco-design/web-react/icon`),require(`react-i18next`),require(`react/jsx-runtime`),require(`next-themes`)):typeof define==`function`&&define.amd?define([`exports`,`react`,`@arco-design/web-react`,`@arco-design/web-react/icon`,`react-i18next`,`react/jsx-runtime`,`next-themes`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ManturComponents={},e.React,e.ArcoDesign,e.ArcoDesignIcon,e.ReactI18next,e.jsxRuntime,e.nextThemes))})(this,function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=Object.create,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty,p=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=u(t),a=0,o=i.length,s;a<o;a++)s=i[a],!f.call(e,s)&&s!==n&&c(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=l(t,s))||r.enumerable});return e},h=(e,t,n)=>(n=e==null?{}:s(d(e)),m(t||!e||!e.__esModule?c(n,`default`,{value:e,enumerable:!0}):n,e)),g=`/api`,_=`/users/me/points`,v=`mantur-points-refresh`,y=`mantur-tenant-context-change`;function b(){return typeof window<`u`&&window.__MANTUR_COMPONENTS_API_BASE__?window.__MANTUR_COMPONENTS_API_BASE__:g}function x(){return typeof window<`u`&&window.__MANTUR_COMPONENTS_POINTS_ENDPOINT__?window.__MANTUR_COMPONENTS_POINTS_ENDPOINT__:_}function S(e){if(typeof document>`u`)return;let t=`${encodeURIComponent(e)}=`;return document.cookie.split(`; `).find(e=>e.startsWith(t))?.slice(t.length)}function C(e){if(typeof document>`u`)return;let t=encodeURIComponent(e),n=window.location.hostname,r=[void 0,n],i=n.split(`.`);i.length>=2&&r.push(`.${i.slice(-2).join(`.`)}`),r.forEach(e=>{document.cookie=`${t}=; path=/; max-age=0${e?`; domain=${e}`:``}`})}function w(e){let t=JSON.parse(e||`null`);if(!t)throw Error(`Request failed`);if(t.code!==0)throw Error(t.message||`Request failed`);return t}async function T(e,t={}){let n=S(`front-token`),r=S(`Accept-Language`),i=t.headers||{};return n&&(i.Authorization=decodeURIComponent(n)),r&&(i[`Accept-Language`]=decodeURIComponent(r)),new Promise((n,r)=>{let a=new XMLHttpRequest;a.open(t.method||`GET`,`${b()}${e}`,!0),a.timeout=t.timeout||1e4,Object.entries(i).forEach(([e,t])=>{a.setRequestHeader(e,t)}),a.onload=()=>{try{let e=w(a.responseText);if(a.status<200||a.status>=300){r(Error(e.message||a.statusText));return}n(e)}catch(e){r(e)}},a.onerror=()=>r(Error(`Network request failed`)),a.ontimeout=()=>r(Error(`Network request timed out`)),a.send(t.body??null)})}async function E(){try{await T(`/auth/front-logout`,{method:`DELETE`})}catch(e){console.warn(`Logout request failed, continuing local logout.`,e)}finally{C(`front-token`),C(`refreshToken`),typeof window<`u`&&window.location.reload()}}async function D(e){let t;if(e.avatarFile){let n=new FormData;n.append(`file`,e.avatarFile),t=(await T(`/users/me/avatar`,{method:`POST`,body:n})).data}return(await T(`/users/me`,{method:`PUT`,headers:{"Content-Type":`application/json;charset=utf-8`},body:JSON.stringify({nickname:e.nickname})})).data||t}function O(e){let t=(...t)=>{let n=t.map(t=>e?.[t]).find(e=>e!==void 0);return typeof n==`number`?n:Number(n||0)};return{total:t(`total`,`totalPoints`,`balance`,`points`),recharge:t(`recharge`,`rechargePoints`,`paidPoints`),gifted:t(`gifted`,`giftedPoints`,`bonusPoints`)}}async function k(){return O((await T(x())).data)}async function ee(){let e=await k();return typeof window<`u`&&window.dispatchEvent(new CustomEvent(v,{detail:e})),e}function A(e,t){return t?.tenantId?e.find(e=>e.tenantId===t.tenantId)||{tenantId:t.tenantId,tenantName:t.tenantName||t.tenantId,roles:t.roles?.map(e=>({roleCode:e,roleName:e}))}:e.find(e=>e.isOwner)||e[0]}function j(e){typeof window<`u`&&(window.__MANTUR_COMPONENTS_TENANT_CONTEXT__=e,window.dispatchEvent(new CustomEvent(y,{detail:e})))}async function M(){return(await T(`/users/me/tenants`)).data||[]}async function N(){return(await T(`/auth/current-tenant`)).data}async function P(e){return(await T(`/auth/current-tenant/${e}`,{method:`PUT`})).data}async function te(e=`refresh`){let[t,n]=await Promise.all([M(),N()]),r={tenants:t,currentTenant:A(t,n),auth:n,reason:e};return j(r),r}async function ne(e){let t=await P(e),n=await M(),r={tenants:n,currentTenant:A(n,t),auth:t,reason:`switch`};return j(r),r}var F={title:`Mantur`,switchTeam:`Switch Team`,personalSettings:`Personal Settings`,logout:`Logout`,loading:`Loading...`,owner:`Owner`,member:`Member`,createTeam:`Create Team`,createTeamComingSoon:`Create team is coming soon`,switchedToTeam:`Switched team`,error:`Request failed`,profileTitle:`Profile`,profileNickname:`Nickname`,profileNicknamePlaceholder:`Please enter nickname`,profileAvatar:`Avatar`,profileUploadAvatar:`Upload Avatar`,profileAvatarHint:`JPG/PNG/WebP, max 2MB, max 2048px.`,profileAvatarTooLarge:`Avatar must be less than 2MB`,profileAvatarDimensionExceeded:`Avatar dimensions must be within 2048px`,profileAvatarInvalidImage:`Invalid image`,profileUpdateSuccess:`Profile updated`,profileSave:`Save`,profileCancel:`Cancel`,myPoints:`My Points`,totalBalance:`Total Balance`,rechargePoints:`Recharge Points`,giftedPoints:`Gifted Points`,recharge:`Recharge`,rechargeTitle:`Recharge Points`,pointsDetail:`Points Detail`,close:`Close`,currentBalance:`Current Balance`,pointsUnit:`points`,rechargeHint:`Recharge points are valid for 2 years after arrival.`,payNow:`Pay Now`,rechargeSuccess:`Recharge successful`,all:`All`,income:`Income`,expense:`Expense`,source:`Source`,sourceAll:`All Sources`,sourceRecharge:`Recharge`,sourceGifted:`Gifted`,dateRange:`Date Range`,startDate:`Start Date`,endDate:`End Date`,dateTo:`to`,query:`Query`,refreshed:`Refreshed`,pointsDeductionTip:`Points expiring soon are deducted first.`,pointsNoteTitle:`Note`,pointsAccountNote:`Points are attached to your personal account. You recharge, consume, and manage them yourself. Others cannot recharge or use them for you. Recharge points are valid for 2 years; gifted points follow the validity set by operations.`},I={languageZh:`中文`,languageEn:`English`},L={title:`漫途`,switchTeam:`切换团队`,personalSettings:`个人设置`,logout:`退出登录`,loading:`加载中...`,owner:`管理员`,member:`成员`,createTeam:`创建团队`,createTeamComingSoon:`创建团队功能即将上线`,switchedToTeam:`已切换团队`,error:`请求失败`,profileTitle:`个人资料`,profileNickname:`昵称`,profileNicknamePlaceholder:`请输入昵称`,profileAvatar:`头像`,profileUploadAvatar:`上传头像`,profileAvatarHint:`支持 JPG/PNG/WebP,最大 2MB,尺寸不超过 2048px。`,profileAvatarTooLarge:`头像不能超过 2MB`,profileAvatarDimensionExceeded:`头像尺寸不能超过 2048px`,profileAvatarInvalidImage:`图片无效`,profileUpdateSuccess:`个人资料已更新`,profileSave:`保存`,profileCancel:`取消`,myPoints:`我的积分`,totalBalance:`总余额`,rechargePoints:`充值积分`,giftedPoints:`赠送积分`,recharge:`去充值`,rechargeTitle:`充值积分`,pointsDetail:`积分明细`,close:`关闭`,currentBalance:`当前余额`,pointsUnit:`积分`,rechargeHint:`充值积分有效期 2 年(自到账日起算),支付后不可退换。`,payNow:`立即支付`,rechargeSuccess:`充值成功`,all:`全部`,income:`获得`,expense:`消耗`,source:`来源`,sourceAll:`全部来源`,sourceRecharge:`充值`,sourceGifted:`赠送`,dateRange:`日期查询`,startDate:`开始日期`,endDate:`结束日期`,dateTo:`至`,query:`查询`,refreshed:`已刷新`,pointsDeductionTip:`优先扣减即将到期的积分`,pointsNoteTitle:`说明`,pointsAccountNote:`积分账户挂在你的个人账号上,自己充值、自己消耗、自己负责;他人不能代充、不能代用。充值积分有效期固定 2 年;赠送积分有效期由后台运营发放时设置。`},R={languageZh:`中文`,languageEn:`English`},z=`i18nextLng`,B=`manturLanguageSource`,V=`mantur-language-change`,H={"zh-CN":{...L,...R},"en-US":{...F,...I}};function U(e){return e?.toLowerCase().startsWith(`en`)?`en-US`:`zh-CN`}function W(){return typeof window>`u`?`zh-CN`:U(window.localStorage.getItem(`i18nextLng`)||document.documentElement.lang||navigator.language)}function G(e){return H[U(e)]}var K=z,q=B;function re(e,t){document.cookie=`${encodeURIComponent(e)}=${encodeURIComponent(t)}; path=/`}function ie(){let{i18n:e}=(0,i.useTranslation)(),[o,s]=(0,t.useState)(()=>W()),c=G(o);return(0,t.useEffect)(()=>{s(U(e.language))},[e.language]),(0,a.jsx)(n.Dropdown,{droplist:(0,a.jsxs)(n.Menu,{selectedKeys:[o],onClickMenuItem:t=>{let n=U(t);localStorage.setItem(K,t),localStorage.setItem(q,`manual`),s(n),e.changeLanguage(t),re(`Accept-Language`,t),window.dispatchEvent(new CustomEvent(V,{detail:n})),window.location.reload()},children:[(0,a.jsx)(n.Menu.Item,{children:c.languageZh},`zh-CN`),(0,a.jsx)(n.Menu.Item,{children:c.languageEn},`en-US`)]}),trigger:`click`,position:`br`,children:(0,a.jsx)(n.Button,{shape:`circle`,icon:(0,a.jsx)(r.IconLanguage,{})})})}function ae(){let{resolvedTheme:e,setTheme:t}=(0,o.useTheme)();return(0,a.jsx)(n.Button,{shape:`circle`,icon:e===`light`?(0,a.jsx)(r.IconMoonFill,{}):(0,a.jsx)(r.IconSunFill,{}),onClick:()=>{t(e===`light`?`dark`:`light`)}})}var J=[{id:`points-500`,points:500,price:5},{id:`points-1000`,points:1e3,price:10},{id:`points-5500`,points:5500,price:50,recommended:!0},{id:`points-24000`,points:24e3,price:200}],oe=[{id:`recharge-1`,type:`income`,source:`recharge`,name:`积分充值`,meta:`2026-05-10 14:00:00 · 订单号 R20260510140000 · 套餐 $50`,date:`2026-05-10`,amount:5500,badgeKind:`recharge`,badgeText:`充值`},{id:`gift-1`,type:`income`,source:`gift`,name:`系统赠送 · 新人礼包`,meta:`2026-05-08 09:00:00 · 有效期 30 天`,date:`2026-05-08`,amount:1e3,badgeKind:`gift`,badgeText:`赠送`},{id:`expense-1`,type:`expense`,name:`视频生成 — Sora 40秒 4K`,meta:`2026-05-10 16:45:22 · 制作中心`,date:`2026-05-10`,amount:-400,badgeKind:`deducted`,badgeText:`已扣除`},{id:`expense-2`,type:`expense`,name:`视频生成 — Sora 25秒 1080p`,meta:`2026-05-11 09:15:42 · 制作中心`,date:`2026-05-11`,amount:-250,badgeKind:`deducted`,badgeText:`已扣除`},{id:`expire-1`,type:`expense`,name:`积分过期`,meta:`2026-05-01 00:00:00 · 2026-04 批次到期未使用`,date:`2026-05-01`,amount:-100,badgeKind:`expired`,badgeText:`自然过期`},{id:`expense-3`,type:`expense`,name:`AI 对话 — GPT-4o 5轮`,meta:`2026-05-07 10:08:55 · 剧本中心`,date:`2026-05-07`,amount:-10,badgeKind:`deducted`,badgeText:`已扣除`},{id:`expense-4`,type:`expense`,name:`图片生成 — DALL-E 5张`,meta:`2026-05-04 14:20:11 · 制作中心`,date:`2026-05-04`,amount:-75,badgeKind:`deducted`,badgeText:`已扣除`}],{RangePicker:se}=n.DatePicker,ce=21,le=7;function ue(e){return e===`recharge`?`arcoblue`:e===`gift`?`cyan`:e===`expired`?`gray`:`orange`}function de({visible:e,points:i,text:o,onCancel:s,onRecharge:c}){let[l,u]=(0,t.useState)(`all`),[d,f]=(0,t.useState)(`all`),[p,m]=(0,t.useState)([`2026-04-15`,`2026-05-15`]),[h,g]=(0,t.useState)(1),_=e=>new Intl.NumberFormat().format(e),v=(0,t.useMemo)(()=>{let[e,t]=p;return oe.filter(n=>{let r=l===`all`||n.type===l,i=d===`all`||n.source===d,a=!e||n.date>=e,o=!t||n.date<=t;return r&&i&&a&&o})},[p,d,l]),y=[{title:o.pointsDetail,dataIndex:`name`,render:(e,t)=>(0,a.jsxs)(`div`,{className:`min-w-0`,children:[(0,a.jsx)(n.Typography.Text,{className:`font-medium!`,children:t.name}),(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`mt-1 block! text-xs!`,children:t.meta})]})},{title:o.pointsUnit,dataIndex:`amount`,width:120,align:`right`,render:(e,t)=>(0,a.jsxs)(n.Typography.Text,{className:`font-semibold! ${t.amount>0?`text-arco-success-6!`:`text-arco-danger-6!`}`,children:[t.amount>0?`+`:``,_(t.amount)]})},{title:o.source,dataIndex:`badgeText`,width:110,align:`right`,render:(e,t)=>(0,a.jsx)(n.Tag,{color:ue(t.badgeKind),children:t.badgeText})}];return(0,a.jsx)(n.Modal,{title:o.pointsDetail,visible:e,footer:(0,a.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,a.jsx)(n.Button,{onClick:s,children:o.close}),(0,a.jsx)(n.Button,{type:`primary`,icon:(0,a.jsx)(r.IconPlus,{}),onClick:()=>{s(),c()},children:o.recharge})]}),onCancel:s,style:{width:780,maxWidth:`calc(100vw - 48px)`},children:(0,a.jsxs)(`div`,{className:`max-h-[70vh] overflow-y-auto`,children:[(0,a.jsxs)(n.Card,{bordered:!1,className:`from-arco-primary-light-1/40 to-cyan-400/5 rounded-none! bg-linear-to-br!`,children:[(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`text-xs!`,children:o.totalBalance}),(0,a.jsxs)(`div`,{className:`mt-1.5 mb-3.5 `,children:[(0,a.jsx)(n.Typography.Text,{className:`text-3xl! font-bold!`,children:_(i.total)}),(0,a.jsxs)(n.Typography.Text,{type:`secondary`,className:`ml-2 text-sm! `,children:[`🪙 `,o.pointsUnit]})]}),(0,a.jsxs)(n.Grid.Row,{gutter:12,children:[(0,a.jsx)(n.Grid.Col,{span:12,children:(0,a.jsxs)(n.Card,{size:`small`,children:[(0,a.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`text-xs!`,children:o.rechargePoints}),(0,a.jsx)(n.Tag,{color:`arcoblue`,children:o.sourceRecharge})]}),(0,a.jsx)(n.Typography.Text,{className:`text-lg! font-semibold!`,children:_(i.recharge)})]})}),(0,a.jsx)(n.Grid.Col,{span:12,children:(0,a.jsxs)(n.Card,{size:`small`,children:[(0,a.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`text-xs!`,children:o.giftedPoints}),(0,a.jsx)(n.Tag,{color:`success`,children:o.sourceGifted})]}),(0,a.jsx)(n.Typography.Text,{className:`text-lg! font-semibold!`,children:_(i.gifted)})]})})]}),(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`mt-2.5 block! text-xs!`,children:o.pointsDeductionTip})]}),(0,a.jsxs)(`div`,{className:`px-6 py-4`,children:[(0,a.jsxs)(n.Tabs,{activeTab:l,onChange:e=>u(e),children:[(0,a.jsx)(n.Tabs.TabPane,{title:o.all},`all`),(0,a.jsx)(n.Tabs.TabPane,{title:o.income},`income`),(0,a.jsx)(n.Tabs.TabPane,{title:o.expense},`expense`)]}),(0,a.jsxs)(`div`,{className:`mt-2 mb-3.5 flex flex-wrap items-center gap-2.5`,children:[(0,a.jsxs)(n.Select,{value:d,style:{width:140},onChange:e=>f(e),children:[(0,a.jsx)(n.Select.Option,{value:`all`,children:o.sourceAll}),(0,a.jsx)(n.Select.Option,{value:`recharge`,children:o.sourceRecharge}),(0,a.jsx)(n.Select.Option,{value:`gift`,children:o.sourceGifted})]}),(0,a.jsx)(se,{value:p,onChange:e=>m(e),style:{width:260}}),(0,a.jsx)(n.Button,{onClick:()=>n.Message.success(o.refreshed),children:o.query})]}),(0,a.jsx)(n.Table,{rowKey:`id`,columns:y,data:v,pagination:!1,border:!1}),(0,a.jsx)(n.Pagination,{className:`mt-3 flex justify-center!`,current:h,pageSize:le,total:ce,onChange:g})]}),(0,a.jsx)(n.Card,{bordered:!1,className:`bg-arco-primary-light-1/30 rounded-none!`,children:(0,a.jsxs)(n.Typography.Text,{type:`secondary`,className:`text-xs! leading-6!`,children:[(0,a.jsxs)(`strong`,{children:[o.pointsNoteTitle,`:`]}),o.pointsAccountNote]})})]})})}var fe=F;function pe(e){return{...fe,...e}}var Y=2048,me=2*1024*1024;function he(e){return new Promise((t,n)=>{let r=URL.createObjectURL(e),i=new Image;i.onload=()=>{URL.revokeObjectURL(r),t({width:i.naturalWidth,height:i.naturalHeight})},i.onerror=()=>{URL.revokeObjectURL(r),n(Error(`invalid image`))},i.src=r})}function ge({visible:e,user:i,labels:o,onCancel:s,onSubmit:c}){let l=pe(o),[u]=n.Form.useForm(),[d,f]=(0,t.useState)(!1),[p,m]=(0,t.useState)(null),[h,g]=(0,t.useState)(null),_=(0,t.useRef)(null);(0,t.useEffect)(()=>()=>{_.current&&=(URL.revokeObjectURL(_.current),null)},[]),(0,t.useEffect)(()=>{e&&(u.setFieldsValue({nickname:i?.nickname||i?.username||``}),m(null),g(e=>(e&&URL.revokeObjectURL(e),_.current=null,null)))},[e,i,u]);let v=(e,t)=>{console.error(t),n.Message.error(e)},y=e=>{n.Message.success(e)};return(0,a.jsx)(n.Modal,{title:l.profileTitle,visible:e,onOk:async()=>{try{let e=await u.validate();f(!0),await c({nickname:e.nickname,avatarFile:p}),y(l.profileUpdateSuccess),s()}catch(e){e instanceof Error&&v(e.message||l.error,e)}finally{f(!1)}},onCancel:s,confirmLoading:d,okText:l.profileSave,cancelText:l.profileCancel,children:(0,a.jsxs)(n.Form,{form:u,layout:`vertical`,children:[(0,a.jsx)(n.Form.Item,{label:l.profileNickname,field:`nickname`,rules:[{required:!0,message:l.profileNicknamePlaceholder}],children:(0,a.jsx)(n.Input,{placeholder:l.profileNicknamePlaceholder,allowClear:!0})}),(0,a.jsx)(n.Form.Item,{label:l.profileAvatar,children:(0,a.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(n.Avatar,{size:64,className:`shrink-0 bg-arco-primary-light-1!`,children:h||i?.avatar?(0,a.jsx)(`img`,{src:h||i?.avatar,alt:``,className:`block h-full w-full object-cover`}):i?.nickname?.[0]||i?.username?.[0]||`U`}),(0,a.jsx)(n.Upload,{accept:`image/*`,showUploadList:!1,beforeUpload:async e=>{if(e.size>me)return v(l.profileAvatarTooLarge),!1;try{let{width:t,height:n}=await he(e);if(t>Y||n>Y)return v(l.profileAvatarDimensionExceeded),!1}catch(e){return v(l.profileAvatarInvalidImage,e),!1}return g(t=>{t&&URL.revokeObjectURL(t);let n=URL.createObjectURL(e);return _.current=n,n}),m(e),!1},children:(0,a.jsx)(n.Button,{type:`outline`,size:`small`,icon:(0,a.jsx)(r.IconUpload,{}),children:l.profileUploadAvatar})})]}),(0,a.jsx)(`span`,{className:`text-xs text-arco-text-3`,children:l.profileAvatarHint})]})})]})})}function _e(e){return e?.nickname?.[0]||e?.username?.[0]||`U`}function X({user:e,size:t,className:r=``}){return(0,a.jsx)(n.Avatar,{size:t,className:`bg-arco-primary/20! text-arco-primary-6 border-2 font-bold ${r}`,children:e?.avatar?(0,a.jsx)(`img`,{src:e.avatar,alt:`avatar`,className:`h-full w-full object-cover`}):_e(e)})}function ve({visible:e,user:i,points:o,text:s,onCancel:c,onPay:l}){let[u,d]=(0,t.useState)(J[2].id),f=e=>new Intl.NumberFormat().format(e),p=J.find(e=>e.id===u)||J[0];return(0,a.jsx)(n.Modal,{title:s.rechargeTitle,visible:e,footer:(0,a.jsxs)(`div`,{className:`mx-auto flex max-w-7xl items-center justify-between gap-5`,children:[(0,a.jsx)(`span`,{className:`text-arco-text-2 text-sm leading-6`,children:s.rechargeHint}),(0,a.jsxs)(n.Button,{type:`primary`,size:`large`,className:`min-w-48! font-bold!`,onClick:()=>l(p),children:[s.payNow,` · $`,p.price]})]}),onCancel:c,alignCenter:!1,wrapClassName:`overflow-hidden!`,style:{width:`100vw`,maxWidth:`100vw`,top:0,paddingBottom:0},className:`top-0! m-0! flex! h-screen! w-screen! max-w-none! flex-col! [&_.arco-modal-body]:min-h-0! [&_.arco-modal-body]:flex-1! [&_.arco-modal-body]:overflow-hidden! [&_.arco-modal-body]:p-0! [&_.arco-modal-close-icon]:top-1.5! [&_.arco-modal-close-icon]:right-4! [&_.arco-modal-close-icon]:inline-flex! [&_.arco-modal-close-icon]:h-9! [&_.arco-modal-close-icon]:w-9! [&_.arco-modal-close-icon]:items-center! [&_.arco-modal-close-icon]:justify-center! [&_.arco-modal-close-icon]:rounded-lg! [&_.arco-modal-close-icon]:text-lg! [&_.arco-modal-close-icon]:leading-9! [&_.arco-modal-close-icon]:transition-colors [&_.arco-modal-close-icon:hover]:bg-arco-fill-2 [&_.arco-modal-close-icon:hover]:text-arco-primary-6 [&_.arco-modal-close-icon_svg]:h-[18px]! [&_.arco-modal-close-icon_svg]:w-[18px]! [&_.arco-modal-content]:flex! [&_.arco-modal-content]:h-auto! [&_.arco-modal-content]:min-h-0! [&_.arco-modal-content]:flex-1! [&_.arco-modal-content]:flex-col! [&_.arco-modal-content]:overflow-hidden! [&_.arco-modal-content]:rounded-none! [&_.arco-modal-footer]:shrink-0! [&_.arco-modal-header]:shrink-0!`,children:(0,a.jsxs)(`div`,{className:`mx-auto flex h-full w-full max-w-7xl flex-col items-center `,children:[(0,a.jsxs)(`div`,{className:`w-full border-arco-border-1 bg-arco-fill-1 text-arco-text-2 flex items-center gap-2.5 rounded-lg border px-3.5 py-3 text-sm`,children:[(0,a.jsx)(X,{user:i,size:32,className:`shrink-0`}),(0,a.jsxs)(`span`,{children:[i?.nickname||i?.username,` · `,s.currentBalance,` `,(0,a.jsx)(`strong`,{className:`text-arco-text-1`,children:f(o.total)}),` `,s.pointsUnit]})]}),(0,a.jsx)(`div`,{className:`mt-6 w-full`,children:(0,a.jsx)(n.Grid.Row,{gutter:[16,16],children:J.map(e=>(0,a.jsx)(n.Grid.Col,{xs:24,sm:12,lg:6,children:(0,a.jsxs)(n.Card,{hoverable:!0,role:`button`,tabIndex:0,onClick:()=>d(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&d(e.id)},bodyStyle:{minHeight:192,display:`flex`,flexDirection:`column`,justifyContent:`space-between`},className:`border-arco-border-2! bg-arco-bg-2! relative cursor-pointer overflow-hidden rounded-lg! shadow-sm! transition-all duration-200 before:absolute before:inset-x-0 before:top-0 before:h-1 before:bg-linear-to-r before:from-arco-primary before:to-transparent hover:shadow-md! ${u===e.id?`border-arco-primary-6! bg-arco-primary-light-1/40! ring-arco-primary-6/20 ring-2! shadow-[0_18px_38px_rgb(var(--primary-6)/22%)]!`:`hover:border-arco-primary-6!`}`,children:[u===e.id?(0,a.jsx)(r.IconCheckCircleFill,{className:`text-arco-primary-6! absolute bottom-4 left-4 text-xl`}):null,`recommended`in e&&e.recommended?(0,a.jsx)(n.Tag,{color:`arcoblue`,className:`absolute top-4 right-4 text-xs! font-bold!`,children:`HOT`}):null,(0,a.jsxs)(`div`,{className:`min-w-0 pr-16`,children:[(0,a.jsxs)(n.Typography.Text,{className:`flex items-center text-3xl! leading-tight! font-bold!`,children:[f(e.points),(0,a.jsx)(`span`,{className:`ml-1 text-2xl`,children:`🪙`})]}),(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`mt-1 block! text-sm!`,children:s.pointsUnit})]}),(0,a.jsx)(`div`,{className:`mt-7 flex w-full justify-end`,children:(0,a.jsxs)(n.Typography.Text,{className:`text-arco-primary-6! text-right text-2xl! leading-tight! font-bold!`,children:[`$`,e.price]})})]})},e.id))})})]})})}function ye({user:e,points:t,text:i,onEditProfile:o,onRecharge:s,onPointsDetail:c,onLogout:l}){let u=e=>new Intl.NumberFormat().format(e);return(0,a.jsxs)(`div`,{className:`w-80 overflow-hidden rounded-xl border border-arco-border-2 bg-arco-bg-popup shadow-[0_10px_28px_rgb(0_0_0/12%)]`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3 px-6 pt-5 pb-4`,children:[(0,a.jsx)(X,{user:e,size:48,className:`shrink-0`}),(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,a.jsx)(`span`,{className:`text-arco-text-1 truncate text-base leading-6 font-bold`,children:e?.nickname||e?.username}),(0,a.jsx)(n.Button,{type:`text`,size:`mini`,icon:(0,a.jsx)(r.IconEdit,{}),className:`text-arco-text-3 h-6! min-w-6! px-0!`,onClick:o})]}),e?.email?(0,a.jsx)(`span`,{className:`text-arco-text-3 truncate text-xs leading-5`,children:e.email}):null]})]}),(0,a.jsx)(n.Divider,{className:`m-0!`}),(0,a.jsxs)(`ul`,{className:`flex flex-col gap-3.5 px-6 py-4`,children:[(0,a.jsxs)(`li`,{className:`text-arco-text-2 flex items-center justify-between gap-4 text-sm`,children:[(0,a.jsx)(`span`,{children:i.myPoints}),(0,a.jsx)(`strong`,{className:`text-arco-primary-6 text-base font-bold`,children:u(t.total)})]}),(0,a.jsxs)(`li`,{className:`text-arco-text-2 flex items-center justify-between gap-4 text-sm`,children:[(0,a.jsx)(`span`,{children:i.rechargePoints}),(0,a.jsx)(`strong`,{className:`text-arco-text-1 text-base font-bold`,children:u(t.recharge)})]}),(0,a.jsxs)(`li`,{className:`text-arco-text-2 flex items-center justify-between gap-4 text-sm`,children:[(0,a.jsx)(`span`,{children:i.giftedPoints}),(0,a.jsx)(`strong`,{className:`text-arco-text-1 text-base font-bold`,children:u(t.gifted)})]})]}),(0,a.jsx)(n.Divider,{className:`m-0!`}),(0,a.jsxs)(`div`,{className:`flex flex-col gap-2 px-6 py-4`,children:[(0,a.jsx)(n.Button,{type:`primary`,long:!0,icon:(0,a.jsx)(r.IconPlus,{}),className:`h-10! rounded-md! font-semibold!`,onClick:s,children:i.recharge}),(0,a.jsx)(n.Button,{long:!0,icon:(0,a.jsx)(r.IconFile,{}),className:`border-arco-border-2! bg-arco-fill-1! text-arco-text-1! h-10! rounded-md! font-semibold!`,onClick:c,children:i.pointsDetail})]}),(0,a.jsx)(n.Divider,{className:`m-0!`}),(0,a.jsx)(`div`,{className:`px-6 py-4`,children:(0,a.jsx)(n.Button,{icon:(0,a.jsx)(r.IconPoweroff,{}),type:`text`,status:`danger`,long:!0,className:`flex! items-center justify-start gap-2 text-sm text-arco-text-2`,onClick:()=>void l?.(),children:i.logout})})]})}var be=`https://mantur.ai/images/logo.png`,Z=[`from-arco-primary-light-1 to-arco-primary-light-2 text-arco-primary-6`,`from-arco-success-light-1 to-arco-success-light-2 text-arco-success-6`,`from-arco-warning-light-1 to-arco-warning-light-2 text-arco-warning-6`,`from-arco-danger-light-1 to-arco-danger-light-2 text-arco-danger-6`];function Q(e,t=!1){return`flex h-8 min-h-8 w-8 min-w-8 flex-none items-center justify-center rounded-lg bg-linear-to-br font-bold leading-none ${Z[e%Z.length]} ${t?`shadow-[inset_0_1px_3px_rgb(0_0_0/8%)]`:``}`}function $(e){return e?.tenantName?.[0]?.toUpperCase()||`T`}function xe(e,t,n){let r=e?.roles?.map(e=>e.roleName).filter(Boolean);return r?.length?r.join(`, `):e?.isOwner?t:n}function Se({user:e,disabled:i=!1,brandSlot:o,children:s,onTenantContextChange:c}){let[l,u]=(0,t.useState)(()=>W()),d=G(l),[f,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(!1),[y,b]=(0,t.useState)(e),[x,S]=(0,t.useState)([]),[C,w]=(0,t.useState)(),[T,O]=(0,t.useState)(!1),k=(0,t.useRef)(c),[A,j]=(0,t.useState)({total:0,recharge:0,gifted:0}),M=C?.tenantId||``,N=i,P={total:A.total??0,recharge:A.recharge??0,gifted:A.gifted??0},F=async e=>{let t=await D(e);return t&&b(t),t};(0,t.useEffect)(()=>{b(e)},[e]),(0,t.useEffect)(()=>{k.current=c},[c]);let I=(0,t.useCallback)(e=>{S(e.tenants),w(e.currentTenant),k.current?.(e)},[]);(0,t.useEffect)(()=>{O(!0),te().then(I).catch(e=>{console.warn(`Failed to refresh Mantur tenant context.`,e),n.Message.error(d.error)}).finally(()=>O(!1))},[I,d.error]),(0,t.useEffect)(()=>{let e=e=>{e instanceof CustomEvent&&j(e.detail)};return window.addEventListener(v,e),ee().catch(e=>{console.warn(`Failed to refresh Mantur user points.`,e)}),()=>{window.removeEventListener(v,e)}},[]),(0,t.useEffect)(()=>{let e=e=>{u(e instanceof CustomEvent?U(e.detail):W())};return window.addEventListener(V,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(V,e),window.removeEventListener(`storage`,e)}},[]);let L=e=>{n.Message.success(e)},R=(e,t)=>{console.error(t),n.Message.error(e)},z=(0,t.useCallback)(async e=>{if(!N&&e!==M)try{O(!0),I(await ne(e)),L(d.switchedToTeam)}catch(e){R(d.error,e)}finally{O(!1)}},[I,M,N,d.error,d.switchedToTeam]),B=e=>{let t={total:P.total+e.points,recharge:P.recharge+e.points,gifted:P.gifted};j(t),window.dispatchEvent(new CustomEvent(v,{detail:t})),n.Message.success(d.rechargeSuccess),h(!1)},H=(0,t.useMemo)(()=>(0,a.jsxs)(n.Menu,{className:`w-56 rounded-xl bg-arco-bg-popup shadow-[0_10px_28px_rgb(0_0_0/12%)] [&_.arco-menu-inner]:px-2 [&_.arco-menu-inner]:py-1`,selectedKeys:M?[M]:[],onClickMenuItem:z,children:[(0,a.jsx)(`div`,{className:`px-3 py-2 text-xs font-semibold tracking-[0.04em] text-arco-text-4 uppercase`,children:d.switchTeam}),x.map((e,t)=>(0,a.jsx)(n.Menu.Item,{className:`mb-1 h-auto! min-h-10! overflow-visible! rounded-lg! px-2! py-1! leading-normal!`,children:(0,a.jsxs)(`div`,{className:`flex w-full items-center gap-3 leading-normal`,children:[(0,a.jsx)(`div`,{className:Q(t),children:$(e)}),(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-col justify-center gap-0.75`,children:[(0,a.jsx)(`span`,{className:`text-sm leading-5 font-medium text-arco-text-1`,children:e.tenantName}),(0,a.jsx)(`span`,{className:`text-xs leading-4 text-arco-text-3`,children:xe(e,d.owner,d.member)})]})]})},e.tenantId))]}),[z,M,x,d]),K=(0,a.jsx)(ye,{user:y,points:P,text:d,onEditProfile:()=>p(!0),onRecharge:()=>h(!0),onPointsDetail:()=>_(!0),onLogout:E}),q=Math.max(0,x.findIndex(e=>e.tenantId===C?.tenantId));return(0,a.jsxs)(`div`,{className:`flex h-20 items-center justify-between bg-transparent pr-8 shadow-[0_2px_10px_rgb(0_0_0/2%)] backdrop-blur-md max-md:pr-4`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,a.jsxs)(`div`,{className:`flex w-65 items-center gap-3 px-8 max-md:w-auto max-md:px-4`,children:[(0,a.jsx)(`div`,{className:`relative flex w-12 items-center justify-center overflow-hidden `,children:(0,a.jsx)(`img`,{src:be,alt:`logo`,className:`w-full object-contain`,onError:e=>{e.currentTarget.style.display=`none`}})}),o??(0,a.jsx)(`span`,{className:`text-lg font-bold tracking-normal text-arco-text-1`,children:d.title})]}),(0,a.jsx)(n.Dropdown,{droplist:H,trigger:`click`,position:`bl`,disabled:N,children:(0,a.jsxs)(`div`,{"aria-disabled":N,className:`flex items-center gap-3 rounded-full border border-arco-border-1 bg-arco-bg-1 px-2 py-1.5 transition-all ${N?`cursor-not-allowed opacity-60`:`cursor-pointer hover:bg-arco-fill-2 hover:shadow-[0_4px_12px_rgb(0_0_0/8%)]`}`,children:[(0,a.jsx)(`div`,{className:Q(q,!0),children:$(C)}),(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,a.jsx)(`span`,{className:`text-xs leading-none font-bold text-arco-text-1`,children:T?d.loading:C?.tenantName||d.loading}),(0,a.jsx)(`span`,{className:`mt-1 text-[10px] leading-none text-arco-text-3`,children:xe(C,d.owner,d.member)})]}),(0,a.jsx)(r.IconDown,{className:`ml-1 text-arco-text-3`})]})})]}),(0,a.jsx)(`div`,{className:`flex-1`,children:s}),(0,a.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,a.jsx)(ae,{}),(0,a.jsx)(ie,{})]}),(0,a.jsx)(n.Dropdown,{droplist:K,trigger:`click`,position:`br`,onVisibleChange:e=>{e&&ee().catch(e=>{console.warn(`Failed to refresh Mantur user points.`,e)})},children:(0,a.jsxs)(`div`,{className:`hover:bg-arco-fill-2 flex cursor-pointer items-center gap-2.5 rounded-full border border-transparent p-1 pr-2 transition-all`,children:[(0,a.jsxs)(`div`,{className:`from-arco-primary to-transparent relative rounded-full bg-linear-to-br p-0.5 shadow-sm`,children:[(0,a.jsx)(X,{user:y,size:36}),(0,a.jsx)(`div`,{className:`bg-arco-success border-arco-bg-white absolute right-0 bottom-0 h-3 w-3 rounded-full border-2 shadow-sm`})]}),(0,a.jsx)(`div`,{className:`hidden flex-col md:flex`,children:(0,a.jsx)(`span`,{className:`text-arco-text-1 text-sm font-medium`,children:y?.nickname||y?.username})}),(0,a.jsx)(r.IconDown,{className:`text-arco-text-3 ml-1`})]})})]}),(0,a.jsx)(ge,{visible:f,user:y,labels:d,onCancel:()=>p(!1),onSubmit:F}),(0,a.jsx)(ve,{visible:m,user:y,points:P,text:d,onCancel:()=>h(!1),onPay:B}),(0,a.jsx)(de,{visible:g,points:P,text:d,onCancel:()=>_(!1),onRecharge:()=>h(!0)})]})}var Ce=h(p(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){"use strict";var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}))(),1);function we(e,t=`datetime`,n){if(!e)return`-`;let r=(n?U(n):W()).startsWith(`en`),i=t===`date`?r?`MM/DD/YYYY`:`YYYY-MM-DD`:r?`MM/DD/YYYY HH:mm:ss`:`YYYY-MM-DD HH:mm:ss`;return(0,Ce.default)(e).format(i)}var Te=()=>{if(typeof window>`u`||!window.location?.href)throw Error(`redirectToManturMain requires currentUrl when window.location is unavailable.`);return window.location.href},Ee=(e,t)=>{let n=e.split(`.`);return n.length<=1?t:[t,...n.slice(1)].join(`.`)},De=e=>`${e.pathname}${e.search}${e.hash}`;function Oe(e,t,n={}){let r=new URL(n.currentUrl||Te()),i=new URL(r.toString()),a=e?.trim();if(!a)i.port=`80`;else{let e=De(r);i.hostname=Ee(r.hostname,a),i.searchParams.set(`appName`,t?.trim()||a),i.searchParams.set(`redirect`,e)}let o=i.toString();return n.navigate!==!1&&typeof window<`u`&&(window.location.href=o),o}e.ManturHeader=Se,e.formatDateByLang=we,e.redirectToManturMain=Oe});
@@ -0,0 +1,17 @@
1
+ export interface ManturMainRedirectOptions {
2
+ /**
3
+ * 主要用于测试或服务端预计算;不传时读取浏览器当前地址。
4
+ */
5
+ currentUrl?: string | URL;
6
+ /**
7
+ * 默认为 true。设置为 false 时只返回目标地址,不触发页面跳转。
8
+ */
9
+ navigate?: boolean;
10
+ }
11
+ /**
12
+ * 跳转到主应用入口。
13
+ *
14
+ * dev 环境通常没有 VITE_MAIN_PREFIX,直接跳到当前 host 的 80 端口;
15
+ * test/pro 环境使用 VITE_MAIN_PREFIX 替换当前 URL 的子域名,并携带当前应用名和回跳路由。
16
+ */
17
+ export declare function redirectToManturMain(mainPrefix: string | undefined, appName: string | undefined, options?: ManturMainRedirectOptions): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mantur-components",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Reusable Mantur React component library.",
5
5
  "type": "module",
6
6
  "main": "./dist/mantur-components.umd.cjs",