@spacecorexdev/core 0.2.3 → 0.2.4

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.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- var xe=Object.defineProperty;var ut=(e,t,r)=>t in e?xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ye=(e,t)=>{for(var r in t)xe(e,r,{get:t[r],enumerable:!0})};var c=(e,t,r)=>ut(e,typeof t!="symbol"?t+"":t,r);var mt="0.1.0";var _e={};ye(_e,{AuthorizationHandler:()=>M,HttpRequest:()=>o,ResponseCode:()=>be});import Ct,{AxiosError as Pt}from"axios";import{useEffect as sn,useState as on,useRef as an}from"react";import{notification as T}from"antd";import{CheckCircleOutlined as pt,CloseCircleOutlined as gt,InfoCircleOutlined as ft,WarningOutlined as yt}from"@ant-design/icons";import{Fragment as mn,jsx as ne,jsxs as pn}from"react/jsx-runtime";var Me={success:ne(pt,{style:{color:"#52c41a"}}),error:ne(gt,{style:{color:"#ff4d4f"}}),info:ne(ft,{style:{color:"#1677ff"}}),warning:ne(yt,{style:{color:"#faad14"}})};T.config({placement:"topRight",duration:3,zIndex:1e4});var x=class x{constructor(){c(this,"currentToast",null);c(this,"api",null);c(this,"isInitialized",!1);c(this,"pendingToast",null)}static getInstance(){return x.instance||(x.instance=new x),x.instance}init(t){if(this.api=t,this.isInitialized=!0,this.pendingToast){let r=this.pendingToast;this.pendingToast=null,this.show(r)}}show(t){let{key:r,type:n,message:i,descs:s,duration:a,placement:l,onClose:d}=t;if(!this.isInitialized||!this.api){this.pendingToast=t;return}this.currentToast?.timer&&clearTimeout(this.currentToast.timer),this.currentToast&&this.currentToast.key===r?(T.destroy(r),this.createNotification({key:r,type:n,message:i,descs:s,duration:a,placement:l,onClose:d})):(this.currentToast&&T.destroy(this.currentToast.key),this.createNotification({key:r,type:n,message:i,descs:s,duration:a,placement:l,onClose:d}))}createNotification(t){if(!this.api)return;let{key:r,type:n,message:i,descs:s,duration:a,placement:l,onClose:d}=t,u={success:this.api.success.bind(this.api),error:this.api.error.bind(this.api),info:this.api.info.bind(this.api),warning:this.api.warning.bind(this.api)}[n];u({key:r,message:i,description:s,duration:a,placement:l||"topRight",icon:Me[n],onClose:()=>{this.currentToast?.key===r&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),this.currentToast=null),d?.()}}),this.currentToast={key:r,type:n,message:i,descs:s,duration:a,placement:l,timer:null}}close(){this.currentToast&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),T.destroy(this.currentToast.key),this.currentToast=null)}destroy(){this.close(),T.destroy()}};c(x,"instance");var he=x,dn=he.getInstance();function re(e){return typeof e=="string"?{message:e,duration:3}:e}function W(e){return Me[e]}var se={success:e=>{if(!e)return;let t=re(e);T.success({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:W("success"),onClose:t.onClose})},error:e=>{if(!e)return;let t=re(e);T.error({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:W("error"),onClose:t.onClose})},info:e=>{if(!e)return;let t=re(e);T.info({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:W("info"),onClose:t.onClose})},warning:e=>{if(!e)return;let t=re(e);T.warning({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:W("warning"),onClose:t.onClose})},custom:(e,t)=>{let{message:r,descs:n,duration:i,placement:s,onClose:a}=t;T[e]({message:r,description:n,duration:i,placement:s,icon:W(e),onClose:a})}};import{Spin as ht}from"antd";import{LoadingOutlined as bt}from"@ant-design/icons";import{createRoot as _t}from"react-dom/client";import{jsx as H}from"react/jsx-runtime";var je=Symbol("loading");function Ue(){let e=window[je];return e||(e={count:0,timeoutId:0,inTimeout:!1},window[je]=e),e}var Le={tip:"",fullscreen:!0,delay:0,mask:!0,iconSize:40,wrapperClassName:"ui-loading-wrapper"},wt=e=>{let t={...Le,...e},{tip:r,fullscreen:n,mask:i,maskStyle:s,iconSize:a,iconStyle:l,containerStyle:d,wrapperClassName:u}=t,m=H(bt,{style:{fontSize:a,color:"#1677ff",...l},spin:!0}),P=n?{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9999,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:i?"rgba(0, 0, 0, 0.45)":"transparent",...s}:{},I={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...d};return H("div",{style:P,className:u,children:H("div",{style:I,children:H(ht,{indicator:m,children:r})})})},v=null,k=null,Be=(e={})=>(v&&k&&(k.unmount(),document.body.removeChild(v),v=null,k=null),v=document.createElement("div"),document.body.appendChild(v),k=_t(v),k.render(H(wt,{...e})),v),E={show:(e={})=>{let t=Ue();t.count++;let r={...Le,...e};if(r.delay&&r.delay>0){t.timeoutId!=0&&(window.clearTimeout(t.timeoutId),t.timeoutId=0),t.timeoutId=window.setTimeout(()=>{t.timeoutId=0,Be(r)},r.delay);return}else Be(r)},hide:()=>{let e=Ue();if(e.count<=0){console.warn("Loading count is less than 0");return}e.count--,e.timeoutId!=0&&(window.clearTimeout(e.timeoutId),e.timeoutId=0),e.count==0&&v&&k&&(k.unmount(),document.body.removeChild(v),v=null,k=null)},service:(e,t={})=>(E.show(t),e.then(r=>(E.hide(),r)).catch(r=>{throw E.hide(),r}))};import*as oe from"febs-browser";import*as q from"febs-browser";import Oe from"store2";var ie=class{constructor(t){c(this,"s");this.s=t}get length(){return this.s.size()}keys(){return this.s.keys()}set(t,r){return r?(r=JSON.stringify(r),r=q.crypt.base64_encode(r),this.s.set(t,r,!0),this):this.remove(t)}get(t,r=null){if(!this.s.has(t))return r;let n=this.s.get(t);if(n){n=q.crypt.base64_decode(n),n=q.string.bytesToUtf8(n||[]);try{return JSON.parse(n)}catch{return this.remove(t),null}}return n}remove(t){return this.s.remove(t),this}clear(){return this.s.clearAll(),this}},_={namespace:function(e){return new ie(Oe.namespace(e||"default"))},namespace_session:function(e){return new ie(Oe.session.namespace(e||"default"))}};var be=(d=>(d[d.SUCCESS=200]="SUCCESS",d[d.OPERATOR_ERROR=400]="OPERATOR_ERROR",d[d.UNAUTHORIZED=401]="UNAUTHORIZED",d[d.UNPERMISSION=402]="UNPERMISSION",d[d.NOT_FOUND=404]="NOT_FOUND",d[d.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",d[d.PARAM_ERROR=601]="PARAM_ERROR",d[d.REQUEST_LIMIT=602]="REQUEST_LIMIT",d))(be||{});function It(e){switch(e){case 404:return"\u8D44\u6E90\u4E0D\u5B58\u5728";case 400:return"\u7CFB\u7EDF\u64CD\u4F5C\u9519\u8BEF";case 601:return"\u53C2\u6570\u9519\u8BEF";case 602:return"\u8FBE\u5230\u8BBF\u95EE\u9650\u5236";case 503:return"\u670D\u52A1\u4E0D\u53EF\u7528";case 401:return"\u672A\u767B\u5F55";case 402:return"\u65E0\u6743\u9650";default:return"\u672A\u77E5\u9519\u8BEF"}}var L=Ct.create({baseURL:import.meta.env.VITE_API_BASE,timeout:Number(import.meta.env.VITE_API_TIMEOUT)||5e3,headers:{"Content-Type":"application/json;charset=UTF-8"},withCredentials:!0}),g=class g{static clearStoreToken(){this.setStoreToken(null,0)}static getStoreToken(){let t=_.namespace("bp.ss").get("ss");if(t){let r=_.namespace("bp.ss").get("exp");return{token:JSON.parse(t),exp:r?JSON.parse(r):0}}return null}static getValidStoreToken(){let t=g.getStoreToken();return t&&t.exp>Date.now()-g.TOKEN_EXP?t.token:null}static setStoreToken(t,r){t?(_.namespace("bp.ss").set("ss",JSON.stringify(t)),_.namespace("bp.ss").set("exp",JSON.stringify(r))):_.namespace("bp.ss").clear()}static requestHandleSid(t){let r=g.getStoreToken();r&&r.exp>Date.now()-g.TOKEN_EXP&&t.headers.set(g.HEADER_NAME,g.HEADER_PREFIX+r.token)}static responseHandleSid(t){let r=t.headers.get(g.HEADER_NAME);if(r&&r.startsWith(g.HEADER_PREFIX.trim())){r=r.replace(g.HEADER_PREFIX,"");let n=r;if(r=r.split(".")[1],r&&(r=oe.string.bytesToUtf8(oe.crypt.base64_decode(r)),r)){let i=JSON.parse(r);return i.exp<Date.now()-g.TOKEN_EXP?(g.clearStoreToken(),!1):(g.setStoreToken(n,i.exp),!0)}g.clearStoreToken(),typeof navigator<"u"&&navigator.onLine&&(window.location.href="/")}return!1}};c(g,"HEADER_NAME","Authorization"),c(g,"HEADER_PREFIX","SPBearer "),c(g,"TOKEN_EXP",20*1e3);var M=g;L.interceptors.request.use(e=>(E.show({delay:5e3}),M.requestHandleSid(e),e),e=>(E.hide(),console.log("Request Error =========="),Promise.reject(e)));L.interceptors.response.use(e=>(E.hide(),e.data.code!==200&&se.warning(e.data.message||It(e.data.code)),M.responseHandleSid(e),e.data),e=>(E.hide(),e instanceof Pt&&(e.code==="ERR_NETWORK"||e.code==="ECONNABORTED"?se.error("\u7F51\u7EDC\u9519\u8BEF"):e.code==="ERR_BAD_RESPONSE"&&se.error("\u670D\u52A1\u5668\u65E0\u54CD\u5E94")),console.log("Response Error =========="),Promise.reject(e)));var o={get(e,t,r){return L({method:"get",url:e,params:t,data:r})},post(e,t,r){return L({method:"post",url:e,params:t,data:r})},put(e,t,r){return L({method:"put",url:e,params:t,data:r})},delete(e,t,r){return L({method:"delete",url:e,params:t,data:r})}};var we={};ye(we,{admin:()=>Tt,gateway:()=>vt,message:()=>Rt,role:()=>St,user:()=>Dt});var Tt={registerAdmin:e=>o.post("/api/admin/registerAdmin",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode}).then(t=>t),registerUser:e=>o.post("/api/admin/registerUser",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id}).then(t=>t),updateInfoByAdmin:e=>o.post("/api/admin/updateByAdmin",null,{id:e.id,is_forbidden:e.is_forbidden,title:e.title,phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id,created_at:e.created_at,tick_avatar_self:e.tick_avatar_self,role_ids:e.role_ids,isAdmin:e.isAdmin,thirdPlatformInfo:e.thirdPlatformInfo,unreadMessageCount:e.unreadMessageCount}).then(t=>t),list:e=>o.get("/api/admin/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)},vt={register:e=>o.post("/api/register",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id}).then(t=>t),sendSms:e=>o.post("/api/sendSms",{phone:e.phone,imageCode:e.imageCode},null).then(t=>t),isLogin:()=>o.get("/api/isLogin",null,null).then(e=>e),login:e=>o.post("/api/login",null,{phone:e.phone,pwd:e.pwd,pwdSN:e.pwdSN,smsCode:e.smsCode}).then(t=>t),verifyPasswordHash:e=>o.post("/api/verifyPasswordHash",null,{passwordHash:e.passwordHash,passwordSalt:e.passwordSalt}).then(t=>t),logout:()=>o.get("/api/logout",null,null).then(e=>e),listPermissions:()=>o.get("/api/listPermissions",null,null).then(e=>e),listRolePermissions:e=>o.get("/api/listRolePermissions",{id:e.id},null).then(t=>t)},Rt={list:e=>o.get("/api/user/message/list",{pageNum:e.pageNum,pageSize:e.pageSize,unread_only:e.unread_only},null).then(t=>t),countUnread:()=>o.get("/api/user/message/unread/count",null,null).then(e=>e),markRead:e=>o.post("/api/user/message/read",null,{messageIds:e.messageIds}).then(t=>t),clearReaded:e=>o.delete("/api/user/message/clearReaded",null,{messageIds:e.messageIds}).then(t=>t)},St={listRoles:()=>o.get("/api/role/listRoles",null,null).then(e=>e),createRole:e=>o.post("/api/role/createRole",{name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id},null).then(t=>t),updateRole:e=>o.post("/api/role/updateRole",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id},null).then(t=>t),assignPermissionsToRole:e=>o.post("/api/role/assignPermissionsToRole",null,{role_id:e.role_id,permissions:e.permissions}).then(t=>t),assignRoleToUserPermission:()=>o.post("/api/role/assignRoleToUserPermission",null,null).then(e=>e),assignRoleToUser:e=>o.post("/api/role/assignRoleToUser",null,{user_id:e.user_id,role_ids:e.role_ids}).then(t=>t),listUserRoles:e=>o.get("/api/role/listUserRoles",{user_id:e.user_id},null).then(t=>t),listUserPermissions:e=>o.get("/api/role/listUserPermissions",{user_id:e.user_id},null).then(t=>t),listCompanies:()=>o.get("/api/role/listCompanies",null,null).then(e=>e),createCompany:e=>o.post("/api/role/createCompany",{name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id,is_spv_company:e.is_spv_company},null).then(t=>t),updateCompany:e=>o.post("/api/role/updateCompany",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id,is_spv_company:e.is_spv_company},null).then(t=>t),listDepartments:()=>o.get("/api/role/listDepartments",null,null).then(e=>e),createDepartment:e=>o.post("/api/role/createDepartment",{name:e.name,descs:e.descs,admin_id:e.admin_id,company_id:e.company_id,parent_id:e.parent_id},null).then(t=>t),updateDepartment:e=>o.post("/api/role/updateDepartment",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,company_id:e.company_id,parent_id:e.parent_id},null).then(t=>t),assignUserToDepartment:e=>o.post("/api/role/assignUserToDepartment",{user_id:e.user_id,department_id:e.department_id,position:e.position},null).then(t=>t),removeUserFromDepartment:e=>o.post("/api/role/removeUserFromDepartment",{user_id:e.user_id,department_id:e.department_id},null).then(t=>t),listCompanyDepartments:e=>o.get("/api/role/listCompanyDepartments",{company_id:e.company_id},null).then(t=>t),listUserDepartments:e=>o.get("/api/role/listUserDepartments",{user_id:e.user_id},null).then(t=>t),listDepartmentUsers:e=>o.get("/api/role/listDepartmentUsers",{department_id:e.department_id},null).then(t=>t)},Dt={getInfoByUsername:e=>o.get("/api/user/infoByUsername",{username:e.username},null).then(t=>t),getInfo:e=>o.get("/api/user/info",{id:e.id},null).then(t=>t),getAvatar:e=>o.get("/api/user/avatar",{id:e.id,tick:e.tick},null).then(t=>t),getAvatarList:e=>o.get("/api/user/avatar_list",{ids:e.ids},null).then(t=>t),updateAvatar:e=>o.post("/api/user/updateAvatar",null,{id:e.id,avatar:e.avatar,avatar_small:e.avatar_small,tick_self:e.tick_self}).then(t=>t),updateManager:e=>o.post("/api/user/updateManager",{id:e.id,managerid:e.managerid},null).then(t=>t),updateInfo:e=>o.post("/api/user/update",null,{id:e.id,is_forbidden:e.is_forbidden,title:e.title,phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id,created_at:e.created_at,tick_avatar_self:e.tick_avatar_self,role_ids:e.role_ids,isAdmin:e.isAdmin,thirdPlatformInfo:e.thirdPlatformInfo,unreadMessageCount:e.unreadMessageCount}).then(t=>t),updatePassword:e=>o.post("/api/user/updatePassword",null,{old_password:e.old_password,old_password_sn:e.old_password_sn,new_password:e.new_password}).then(t=>t),deleteUser:e=>o.post("/api/user/delete",{id:e.id},null).then(t=>t),list:e=>o.get("/api/user/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),listByIds:e=>o.get("/api/user/list_by_ids",{ids:e.ids},null).then(t=>t),search:e=>o.get("/api/user/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),forbid:e=>o.post("/api/user/forbid",{id:e.id,forbid:e.forbid},null).then(t=>t)};var Ce={};ye(Ce,{contract:()=>kt,file:()=>Et,fileversion:()=>Nt,project:()=>At,projectprogress:()=>xt});var kt={createContract:e=>o.post("/api/project/contract/create",null,{projectId:e.projectId,name:e.name,tag:e.tag,code:e.code,partyA:e.partyA,partyB:e.partyB,amount:e.amount,startDate:e.startDate,endDate:e.endDate,descs:e.descs}).then(t=>t),deleteContract:e=>o.delete("/api/project/contract/delete",{id:e.id},null).then(t=>t),updateContract:e=>o.post("/api/project/contract/update",null,{id:e.id,name:e.name,code:e.code,tag:e.tag,partyA:e.partyA,partyB:e.partyB,amount:e.amount,startDate:e.startDate,endDate:e.endDate,descs:e.descs,markdown:e.markdown}).then(t=>t),getContractDetail:e=>o.get("/api/project/contract/detail",{id:e.id},null).then(t=>t),getContractList:e=>o.get("/api/project/contract/list",{projectId:e.projectId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),submitApproval:e=>o.post("/api/project/contract/submit",{id:e.id,sealType:e.sealType},null).then(t=>t),cancelApproval:e=>o.post("/api/project/contract/cancelApproval",{id:e.id},null).then(t=>t),uploadVersion:e=>o.post("/api/project/contract/version/upload",null,{contractId:e.contractId,fileName:e.fileName,fileType:e.fileType,fileSize:e.fileSize,changeLog:e.changeLog}).then(t=>t),getVersionList:e=>o.get("/api/project/contract/version/list",{contractId:e.contractId},null).then(t=>t),deleteVersion:e=>o.delete("/api/project/contract/version/delete",{id:e.id},null).then(t=>t),renameVersion:e=>o.post("/api/project/contract/version/rename",null,{id:e.id,fileName:e.fileName}).then(t=>t),getVersionDetail:e=>o.get("/api/project/contract/version/detail",{id:e.id},null).then(t=>t),setVersionLayerOpinion:e=>o.post("/api/project/contract/version/layerOpinion",null,{contractId:e.contractId,version:e.version,opinion:e.opinion}).then(t=>t),getNewContractCode:e=>o.get("/api/project/contract/newCode",{contractCode:e.contractCode,sequenceLength:e.sequenceLength},null).then(t=>t),getContractHistoryParties:()=>o.get("/api/project/contract/historyParties",null,null).then(e=>e)},Et={getDetail:e=>o.get("/api/project/files/detail",{fileId:e.fileId},null).then(t=>t),listFiles:e=>o.get("/api/project/files/list",{projectId:e.projectId},null).then(t=>t),searchFiles:e=>o.get("/api/project/files/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),addFile:(e,t)=>o.post("/api/project/files/add",{projectId:e.projectId},{fileName:t.fileName,filePath:t.filePath,isSecure:t.isSecure,descs:t.descs,fileType:t.fileType,fileSize:t.fileSize,crc32:t.crc32,fileResourcePath:t.fileResourcePath}).then(r=>r),removeFile:e=>o.post("/api/project/files/remove",{fileId:e.fileId},null).then(t=>t),listTrashFiles:e=>o.get("/api/project/files/trash/list",{projectId:e.projectId},null).then(t=>t),restoreTrashFile:e=>o.post("/api/project/files/trash/restore",{fileId:e.fileId},null).then(t=>t),permanentDeleteTrashFile:e=>o.post("/api/project/files/trash/remove",{fileId:e.fileId},null).then(t=>t),emptyTrash:e=>o.post("/api/project/files/trash/empty",{projectId:e.projectId},null).then(t=>t),moveFile:(e,t)=>o.post("/api/project/files/move",{projectId:e.projectId},{oldFileName:t.oldFileName,oldFilePath:t.oldFilePath,newFileName:t.newFileName,newFilePath:t.newFilePath}).then(r=>r),updateFileDescs:e=>o.post("/api/project/files/updateDescs",null,{fileId:e.fileId,descs:e.descs}).then(t=>t),copyFileToProject:e=>o.post("/api/project/files/copyToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),moveFileToProject:e=>o.post("/api/project/files/moveToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),updateFileDelta:e=>o.post("/api/project/files/updateDelta",null,{fileId:e.fileId,deltaData:e.deltaData,deltaSize:e.deltaSize,newFileSize:e.newFileSize,crc32:e.crc32,recordVersion:e.recordVersion,rotateResourcePath:e.rotateResourcePath}).then(t=>t),updateFile:e=>o.post("/api/project/files/updateData",null,{fileId:e.fileId,fileSize:e.fileSize,crc32:e.crc32,fileName:e.fileName,fileResourcePath:e.fileResourcePath,recordVersion:e.recordVersion,rotateResourcePath:e.rotateResourcePath}).then(t=>t),generateTempAccessToken:e=>o.post("/api/project/files/generateTempAccessToken",{fileId:e.fileId,expireSeconds:e.expireSeconds},null).then(t=>t),folderDownload:(e,t)=>o.post("/api/project/files/folderDownload",{projectId:e.projectId},{folderPath:t.folderPath,folderName:t.folderName}).then(r=>r),folderDownloadStatus:e=>o.get("/api/project/files/folderDownloadStatus",{jobId:e.jobId},null).then(t=>t),listFilesByTempAccessToken:e=>o.get("/api/project/files/listByTempAccessToken",{tempToken:e.tempToken},null).then(t=>t)},Nt={listVersions:e=>o.get("/api/project/files/version/list",{fileId:e.fileId},null).then(t=>t),getVersionDetail:e=>o.get("/api/project/files/version/detail",{versionId:e.versionId},null).then(t=>t)},At={enableUserPrivateProject:()=>o.post("/api/project/enablePrivateProject",null,null).then(e=>e),createProject:e=>o.post("/api/project/create",null,{name:e.name,descs:e.descs,companyId:e.companyId,markdown:e.markdown,startTime:e.startTime,plannedEndTime:e.plannedEndTime,endTime:e.endTime,leaderId:e.leaderId,customerId:e.customerId,order:e.order,isUserPrivate:e.isUserPrivate}).then(t=>t),updateProject:e=>o.post("/api/project/update",null,{id:e.id,name:e.name,descs:e.descs,companyId:e.companyId,markdown:e.markdown,status:e.status,startTime:e.startTime,plannedEndTime:e.plannedEndTime,endTime:e.endTime,leaderId:e.leaderId,customerId:e.customerId,order:e.order,isUserPrivate:e.isUserPrivate,createTime:e.createTime,updateTime:e.updateTime,createBy:e.createBy,updateBy:e.updateBy}).then(t=>t),updateUserdataOrder:e=>o.post("/api/project/updateUserdataOrder",null,{projectIds:e.projectIds}).then(t=>t),getUserdataOrder:()=>o.get("/api/project/userdataOrder",null,null).then(e=>e),getProjectDetail:e=>o.get("/api/project/detail",{id:e.id},null).then(t=>t),getProjectName:e=>o.get("/api/project/name",{projectId:e.projectId},null).then(t=>t),listProjects:e=>o.get("/api/project/list",{pageNum:e.pageNum,pageSize:e.pageSize,status:e.status,companyId:e.companyId,customerId:e.customerId,userId:e.userId},null).then(t=>t),listProjectsByManager:e=>o.get("/api/project/listByManager",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),changeStatus:e=>o.put("/api/project/status",{id:e.id,status:e.status},null).then(t=>t),getProjectMembers:e=>o.get("/api/project/members",{projectId:e.projectId},null).then(t=>t),getMemberRole:e=>o.get("/api/project/member/role",{projectId:e.projectId,userId:e.userId},null).then(t=>t),assignMember:e=>o.post("/api/project/members/assign",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t),removeMember:e=>o.post("/api/project/members/remove",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t)},xt={createProgress:e=>o.post("/api/project/progress/create",null,{projectId:e.projectId,descs:e.descs,commentCount:e.commentCount,progressTime:e.progressTime}).then(t=>t),updateProgress:e=>o.put("/api/project/progress/update",null,{id:e.id,descs:e.descs,progressTime:e.progressTime}).then(t=>t),deleteProgress:e=>o.delete("/api/project/progress/delete",{id:e.id},null).then(t=>t),getProgressList:e=>o.get("/api/project/progress/list",{projectId:e.projectId},null).then(t=>t),addComment:e=>o.post("/api/project/progress/comment/add",null,{progressId:e.progressId,comment:e.comment}).then(t=>t),deleteComment:e=>o.delete("/api/project/progress/comment/delete",{id:e.id},null).then(t=>t),updateComment:e=>o.put("/api/project/progress/comment/update",{id:e.id},{}).then(t=>t),getCommentList:e=>o.get("/api/project/progress/comment/list",{progressId:e.progressId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)};var y={base:_e,user:we,project:Ce};import Mt from"dexie";var jt=1440*60*1e3,Pe=class extends Mt{constructor(){super("DepartmentInfoDB");c(this,"departmentCache");this.version(1).stores({departmentCache:"id, timestamp"})}},G=new Pe,ae=null,Ut=async()=>{try{let e=await G.departmentCache.get("DEPARTMENT_ALL");if(e){if(Date.now()-e.timestamp<jt)return e.data;await G.departmentCache.delete("DEPARTMENT_ALL")}return null}catch(e){return console.error("\u8BFB\u53D6\u90E8\u95E8\u7F13\u5B58\u5931\u8D25:",e),null}},Bt=async e=>{try{await G.departmentCache.put({id:"DEPARTMENT_ALL",data:e,timestamp:Date.now()})}catch(t){console.error("\u5199\u5165\u90E8\u95E8\u7F13\u5B58\u5931\u8D25:",t)}},Lt=async()=>{try{await G.departmentCache.clear()}catch(e){console.error("\u6E05\u9664\u90E8\u95E8\u7F13\u5B58\u5931\u8D25:",e)}},ze=(e,t)=>e.map(r=>({...r,company_id:r.company_id||t.id,company:t,children:r.children?ze(r.children,t):void 0})),Ot=async()=>{let e=await y.user.role.listCompanies();if(e.code!==200)return null;let t=(e.data||[]).map(n=>({id:n.id,name:n.name,descs:n.descs,parent_id:n.parent_id,admin_id:n.admin_id,is_spv_company:n.is_spv_company,created_at:n.created_at}));if(t.length===0)return[];let r=await Promise.all(t.map(async n=>{let i=await y.user.role.listCompanyDepartments({company_id:n.id});return i.code!==200?null:ze(i.data||[],n)}));return r.some(n=>n===null)?null:r.flatMap(n=>n||[])},Fe=async({forceRefresh:e=!1})=>{if(!e){let r=await Ut();if(r)return r}ae||(ae=Ot().then(async r=>(r&&await Bt(r),r)).finally(()=>{ae=null}));let t=await ae;return t||null},Ve=async({forceRefresh:e=!1})=>{let t=await Fe({forceRefresh:e});if(!t)return null;let r=n=>{let i=[];for(let s of n){let{children:a,...l}=s;i.push(l),s.children&&s.children.length>0&&(i=i.concat(r(s.children)))}return i};return r(t)},We=async({deptId:e,forceRefresh:t=!1})=>{let r=await Ve({forceRefresh:t});return r&&r.find(n=>n.id===e)||null},zt=async({deptId:e,forceRefresh:t=!1})=>(await We({deptId:e,forceRefresh:t}))?.name||"",Ft=async()=>{await Lt()},Vt=async()=>{try{let e=await G.departmentCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},Vn={getDepartmentList:Fe,getFlatDepartmentList:Ve,getDepartmentById:We,getDepartmentNameById:zt,clearDepartmentCache:Ft,getCacheStats:Vt};var Wt="flyfish-file-viewer-cache",Ht=async e=>{let t=indexedDB;if(typeof t.databases!="function")return!0;try{return(await t.databases()).some(n=>n.name===e)}catch{return!0}},qt=e=>new Promise(t=>{let r=indexedDB.open(e);r.onsuccess=()=>t(r.result),r.onerror=()=>t(null),r.onblocked=()=>t(null)}),Gt=async e=>{if(!(typeof indexedDB>"u"))try{if(!await Ht(e))return;let t=await qt(e);if(!t)return;let r=Array.from(t.objectStoreNames);r.length>0&&await new Promise((n,i)=>{let s=t.transaction(r,"readwrite");r.forEach(a=>{s.objectStore(a).clear()}),s.oncomplete=()=>n(),s.onerror=()=>i(s.error),s.onabort=()=>i(s.error)}),t.close()}catch(t){console.error(`\u6E05\u9664 IndexedDB \u7F13\u5B58\u5931\u8D25\uFF08${e}\uFF09:`,t)}},qn=async()=>{await Gt(Wt)};import nr from"dexie";import*as Ie from"febs-browser";import qe from"dexie";var U=1440*60*1e3,Te=class extends qe{constructor(){super("UserInfoDB");c(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},ve=class extends qe{constructor(){super("UserAvatarDB");c(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},R=new Te,S=new ve,Ge=async e=>{try{let t=await S.userCache.get(e);if(t){if(Date.now()-t.timestamp<U)return t.avatar;await S.userCache.delete(e)}return null}catch(t){return console.error("\u8BFB\u53D6\u7528\u6237\u5934\u50CF\u7F13\u5B58\u5931\u8D25:",t),null}},Re=async e=>{try{let t=await R.userCache.get(e);if(t){let r=Date.now(),n=await S.userCache.get(e);if(n?r-n.timestamp<U?t.data.avatar=n.avatar:(t.data.avatar=void 0,await S.userCache.delete(e)):t.data.avatar=void 0,r-t.timestamp<U)return t.data;await R.userCache.delete(e)}return null}catch(t){return console.error("\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",t),null}},Jt=async(e,t)=>{try{t&&await S.userCache.put({id:e,avatar:t,timestamp:Date.now()})}catch(r){console.error("\u5199\u5165\u7528\u6237\u5934\u50CF\u7F13\u5B58\u5931\u8D25:",r)}},$t=async(e,t)=>{try{t.avatar&&await S.userCache.put({id:e,avatar:t.avatar,timestamp:Date.now()});let r=t.avatar;t.avatar=void 0,await R.userCache.put({id:e,data:t,timestamp:Date.now()}),t.avatar=r}catch(r){console.error("\u5199\u5165\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}},Kt=async e=>{let t=new Map;try{let r=await R.userCache.bulkGet(e),n=Date.now();for(let s=0;s<e.length;s++){let a=r[s];a&&n-a.timestamp<U&&t.set(e[s],a.data)}let i=await S.userCache.bulkGet(e);for(let s=0;s<e.length;s++){let a=i[s];if(!a)continue;let l=t.get(a.id);l&&n-a.timestamp<U&&(l.avatar=a.avatar)}}catch(r){console.error("\u6279\u91CF\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}return t},He=async e=>{try{let t=e.map(n=>({id:n.id,data:n.data,timestamp:Date.now()})),r=e.map(n=>({id:n.id,avatar:n.data.avatar,timestamp:Date.now()}));r=r.filter(n=>n.avatar),await S.userCache.bulkPut(r),t.forEach(n=>{n.data.avatar=void 0}),await R.userCache.bulkPut(t)}catch(t){console.error("\u6279\u91CF\u5199\u5165\u7528\u6237\u7F13\u5B58\u5931\u8D25:",t)}},Xt=async()=>{let e=new Map;try{let t=Date.now(),r=await R.userCache.toArray();for(let n of r)if(t-n.timestamp<U){let i=await S.userCache.get(n.id);i&&t-i.timestamp<U&&(n.data.avatar=i.avatar),e.set(n.id,n.data)}else await R.userCache.delete(n.id)}catch(t){console.error("\u83B7\u53D6\u6240\u6709\u7F13\u5B58\u5931\u8D25:",t)}return e},Yt=async()=>{try{await R.userCache.clear(),await S.userCache.clear()}catch(e){console.error("\u6E05\u9664\u7528\u6237\u7F13\u5B58\u5931\u8D25:",e)}},Je=async({user_id:e,forceRefresh:t=!1,forceAvatar:r=!1})=>{let n={code:200,data:{user_id:e,isLogin:!0}},i=!1;if(!e)try{n=await y.user.gateway.isLogin()}catch{i=!0}if(i){let s;try{let l=_.namespace("bp.ss").get("user");l&&(s=JSON.parse(l)?.id)}catch{}let a=e??s;if(a){let l=await Re(a);if(l){let d=await j({user_id:a,forceRefresh:!1,serverTick:l.tick_avatar_self});return d&&(l.avatar=d),l}}try{let l=_.namespace("bp.ss").get("user");if(l)return JSON.parse(l)}catch{}return null}if(n?.code===200&&n.data?.isLogin){let s=n.data?.user_id,a=n.data?.isAdmin||!1,l=await Re(s);if(t||!l)try{let d=await y.user.user.getInfo({id:s});if(d?.code==200){e||_.namespace("bp.ss").set("user",JSON.stringify(d.data));let u={...d.data};s&&await $t(s,u);try{let m=await j({user_id:s,forceRefresh:r,serverTick:d.data?.tick_avatar_self});m&&(u.avatar=m)}catch{}return u}else return l||null}catch{if(l)return l;try{let u=_.namespace("bp.ss").get("user");if(u)return JSON.parse(u)}catch{}return null}try{let d=await j({user_id:s,forceRefresh:r,serverTick:l.tick_avatar_self});d&&(l.avatar=d)}catch{}return l}else return M.clearStoreToken(),null},j=async({user_id:e,forceRefresh:t=!1,serverTick:r=Number.MAX_SAFE_INTEGER})=>{if(!e)return;let n=await Ge(e);if(t||!n){let i=n?.avatar_tick||-1;if(i<r)try{let s=await y.user.user.getAvatar({id:e,tick:i});s?.code==200&&i!=s.data?.tick_self&&(n={avatar:Ie.string.isEmpty(s.data?.avatar)?void 0:s.data?.avatar,avatar_small:Ie.string.isEmpty(s.data?.avatar_small)?void 0:s.data?.avatar_small,avatar_tick:s.data?.tick_self||-1},await Jt(e,n))}catch{}}return n||void 0},Zt=async e=>(e=e||{forceRefresh:!1},await Je(e)),Qt=()=>{let e=_.namespace("bp.ss").get("user");return e?JSON.parse(e):null},er=async({userIds:e,keywords:t,forceRefresh:r=!1})=>{let n=new Map;if(!e){if(!r&&(!t||t.length===0)){let u=await Xt();if(u.size>=100){let m=new Map,P=0;for(let[I,V]of u){if(P>=100)break;let fe=await j({user_id:I,forceRefresh:!1,serverTick:V.tick_avatar_self});V.avatar=fe,m.set(I,V),P++}return m}return u}let a;if(t&&t.length>0){if(a=await y.user.user.search({pageNum:1,pageSize:100,keyword:t}),a?.code!==200)return n}else if(a=await y.user.user.list({pageNum:1,pageSize:100}),a?.code!==200)return n;let l=a.data?.list||[],d=[];for(let u of l){let m={...u};n.set(u.id,m),d.push({id:u.id,data:m})}d.length>0&&await He(d);for(let u=0;u<d.length;u++){let m=await j({user_id:d[u].id,serverTick:d[u].data.tick_avatar_self});d[u].data.avatar=m}return n}if(e.length==0)return n;let i=[...new Set(e)];r||(await Kt(i)).forEach((l,d)=>{n.set(d,l)});let s=i.filter(a=>!n.has(a));if(s.length===0)return n;try{let a=await y.user.user.listByIds({ids:JSON.stringify(s)});if(a?.code!=200)return n;let l=a.data?.list||[];if(l.length>0){let u=[];for(let m of l){let P={...m};u.push({id:m.id,data:P})}await He(u)}let d=[];if(l.length>0)for(let u of l){let m=await j({user_id:u.id,serverTick:u.tick_avatar_self||-1});d.push({id:u.id,avatar_small:m?.avatar_small||"",avatar_tick:u.tick_avatar_self||-1})}for(let u of l){let m=d.find(I=>I.id==u.id),P={...u,avatar:{avatar:"",avatar_small:m?.avatar_small||"",avatar_tick:m?.avatar_tick||-1}};n.set(u.id,P)}}catch(a){console.error("\u6279\u91CF\u83B7\u53D6\u7528\u6237\u4FE1\u606F\u5931\u8D25:",a)}return n},tr=async e=>{e?await R.userCache.delete(e):await Yt()},rr=async()=>{try{let e=await R.userCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},$e={getFromCache:Re,getAvatarFromCache:Ge,getUserInfo:Je,getUserAvatar:j,current:Zt,currentLocalUser:Qt,getUserInfos:er,clearUserCache:tr,getCacheStats:rr};var ss="approver:approvalinvoice:getInvoiceList",is="project:projectfile:downloadFolderPermission",os="crm:customer:createCustomer",as="crm:customer:updateCustomer",ls="crm:customer:deleteCustomer",cs="crm:customer:viewContact",ds="crm:customer:transferCustomer",us="crm:file:viewFile",ms="crm:file:manageFile",sr=600*1e3,Se=class extends nr{constructor(){super("PermissionInfoDB");c(this,"permissionCache");this.version(1).stores({permissionCache:"id, timestamp"})}},O=new Se,ir=async e=>{try{let t=await O.permissionCache.get(`PERMISSION_${e}`);if(t){if(Date.now()-t.timestamp<sr)return t.data;await O.permissionCache.delete(`PERMISSION_${e}`)}return null}catch(t){return console.error("\u8BFB\u53D6\u6743\u9650\u7F13\u5B58\u5931\u8D25:",t),null}},or=async(e,t)=>{try{await O.permissionCache.put({id:`PERMISSION_${e}`,data:t,timestamp:Date.now()})}catch(r){console.error("\u5199\u5165\u6743\u9650\u7F13\u5B58\u5931\u8D25:",r)}},ar=async e=>{try{e?await O.permissionCache.delete(`PERMISSION_${e}`):await O.permissionCache.clear()}catch(t){console.error("\u6E05\u9664\u6743\u9650\u7F13\u5B58\u5931\u8D25:",t)}},le=async({userId:e,forceRefresh:t=!1})=>{let r=e?{id:e}:await $e.getUserInfo({});if(!r)return null;let n=r.id;if(!t){let a=await ir(n);if(a)return a}let i=await y.user.role.listUserPermissions({user_id:n});if(i?.code!==200)return null;let s=i.data||[];return await or(n,s),s},lr=async({permission:e,userId:t,forceRefresh:r=!1})=>{let n=await le({userId:t,forceRefresh:r});return n?n.some(i=>i.permission===e):!1},cr=async({permissions:e,userId:t,forceRefresh:r=!1,allRequired:n=!0})=>{let i=await le({userId:t,forceRefresh:r});if(!i)return!1;let s=new Set(i.map(a=>a.permission));return n?e.every(a=>s.has(a)):e.some(a=>s.has(a))},dr=async({permission:e,userId:t,forceRefresh:r=!1})=>{let n=await le({userId:t,forceRefresh:r});return n&&n.find(s=>s.permission===e)?.descs||""},ur=async e=>{await ar(e)},mr=async()=>{try{let e=await O.permissionCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u6743\u9650\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},ps={getUserPermissions:le,hasPermission:lr,hasPermissions:cr,getPermissionDesc:dr,clearPermissionCache:ur,getCacheStats:mr};import pr from"dexie";var gr=3600*1e3,De=class extends pr{constructor(){super("RoleInfoDB");c(this,"roleCache");this.version(1).stores({roleCache:"id, timestamp"})}},J=new De,fr=async()=>{try{let e=await J.roleCache.get("ROLE_ALL");if(e){if(Date.now()-e.timestamp<gr)return e.data;await J.roleCache.delete("ROLE_ALL")}return null}catch(e){return console.error("\u8BFB\u53D6\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e),null}},yr=async e=>{try{await J.roleCache.put({id:"ROLE_ALL",data:e,timestamp:Date.now()})}catch(t){console.error("\u5199\u5165\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",t)}},hr=async()=>{try{await J.roleCache.clear()}catch(e){console.error("\u6E05\u9664\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e)}},Ee=async({forceRefresh:e=!1})=>{if(!e){let n=await fr();if(n)return n}let t=await y.user.role.listRoles();if(t?.code!==200)return null;let r=t.data||[];return await yr(r),r},Ke=async({roleId:e,forceRefresh:t=!1})=>{let r=await Ee({forceRefresh:t});return r&&r.find(n=>n.id===e)||null},br=async({roleId:e,forceRefresh:t=!1})=>(await Ke({roleId:e,forceRefresh:t}))?.name||"",ke=async({forceRefresh:e=!1}={})=>{let t=await Ee({forceRefresh:e}),r={};return(t||[]).forEach(n=>{r[n.id]=n.name}),r},_r=async({roleIds:e})=>{let t=await ke();return(e||[]).filter(n=>!!n&&!t[n]).length>0&&(t=await ke({forceRefresh:!0})),t},wr=async()=>{await hr()},Cr=async()=>{try{let e=await J.roleCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},_s={getRoleList:Ee,getRoleById:Ke,getRoleNameById:br,getRoleNameMap:ke,getRoleNameMapForIds:_r,clearRoleCache:wr,getCacheStats:Cr};import Pr from"dexie";var Ne=class extends Pr{constructor(){super("ViewToggleDB");c(this,"viewModeCache");this.version(1).stores({viewModeCache:"pageKey, timestamp"})}},$=new Ne,Ir=async e=>{try{let t=await $.viewModeCache.get(e);return t?t.viewMode:null}catch(t){return console.error("\u8BFB\u53D6\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",t),null}},Tr=async(e,t)=>{try{await $.viewModeCache.put({pageKey:e,viewMode:t,timestamp:Date.now()})}catch(r){console.error("\u5199\u5165\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",r)}},vr=async e=>{try{await $.viewModeCache.delete(e)}catch(t){console.error("\u6E05\u9664\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",t)}},Rr=async()=>{try{await $.viewModeCache.clear()}catch(e){console.error("\u6E05\u9664\u6240\u6709\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",e)}},Sr=async e=>await Ir(e),Dr=async(e,t)=>{await Tr(e,t)},kr=async e=>{await vr(e)},Er=async()=>{await Rr()},Nr=async()=>{try{return await $.viewModeCache.toArray()}catch(e){return console.error("\u83B7\u53D6\u6240\u6709\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",e),[]}},Ts={getViewMode:Sr,setViewMode:Dr,clearViewModeCache:kr,clearAllViewModeCache:Er,getAllCachedViewModes:Nr};var Xe={project:"\u9879\u76EE\u52A8\u6001",approval:"\u5BA1\u6279\u52A8\u6001",knowledge:"\u77E5\u8BC6\u5E93",todo:"\u5F85\u529E\u4EFB\u52A1",crm:"\u5BA2\u6237\u7BA1\u7406"},Ar={file_add:"\u6587\u4EF6\u65B0\u589E",file_update:"\u6587\u4EF6\u66F4\u65B0",file_delete:"\u6587\u4EF6\u5220\u9664",contract_add:"\u5408\u540C\u65B0\u589E",contract_delete:"\u5408\u540C\u5220\u9664",contract_update:"\u5408\u540C\u66F4\u65B0",detail:"\u8BE6\u60C5\u66F4\u65B0",member_add:"\u6210\u5458\u52A0\u5165",member_remove:"\u6210\u5458\u79FB\u9664",member_role_change:"\u89D2\u8272\u53D8\u66F4",file_download:"\u6587\u4EF6\u4E0B\u8F7D"},xr={submit:"\u5BA1\u6279\u63D0\u4EA4",approve:"\u5BA1\u6279\u901A\u8FC7",reject:"\u5BA1\u6279\u9A73\u56DE",cancel:"\u5BA1\u6279\u64A4\u9500",deal:"\u4EA7\u7269\u66F4\u65B0"},Mr={kb_new:"\u65B0\u589E\u77E5\u8BC6"},jr={task_assign:"\u4EFB\u52A1\u6307\u6D3E",task_remind:"\u5230\u671F\u63D0\u9192"},Ur={customer_transfer_in:"\u5BA2\u6237\u79FB\u4EA4\uFF08\u63A5\u6536\uFF09",customer_transfer_out:"\u5BA2\u6237\u79FB\u4EA4\uFF08\u79FB\u4EA4\u51FA\uFF09"},Br={file_add:"files",file_update:"files",file_delete:"files",contract_add:"contracts",contract_update:"contracts",contract_delete:"contracts",detail:"detail",member_add:"members",member_remove:"members",member_role_change:"members"},Ye=class e{static buildContent(t,r,n,i){return JSON.stringify({type:t,bizType:r,id:n||"",text:i||""})}static parseContent(t){if(!t)return null;try{let r=JSON.parse(t);if(r&&typeof r.type=="string"&&typeof r.bizType=="string"&&typeof r.id=="string"){let n={type:r.type,bizType:r.bizType,id:r.id,text:typeof r.text=="string"?r.text:""};return typeof r.url=="string"&&(n.url=r.url),typeof r.fileName=="string"&&(n.fileName=r.fileName),typeof r.jobId=="string"&&(n.jobId=r.jobId),typeof r.expireAt=="number"&&(n.expireAt=r.expireAt),n}return null}catch{return null}}static isMessageType(t){return Object.prototype.hasOwnProperty.call(Xe,t)}static getTypeLabel(t){return Xe[t]||"\u7CFB\u7EDF\u6D88\u606F"}static getBizTypeLabel(t,r){switch(t){case"project":return Ar[r]||"";case"approval":return xr[r]||"";case"knowledge":return Mr[r]||"";case"todo":return jr[r]||"";case"crm":return Ur[r]||"";default:return""}}static getDisplayText(t){return t?t.text||e.getBizTypeLabel(t.type,t.bizType):""}static getJumpRoute(t){if(!t||!t.id)return null;let r=encodeURIComponent(t.id);switch(t.type){case"project":{if(t.bizType==="file_download")return null;let n=Br[t.bizType];return`/project?id=${r}${n?`&tab=${n}`:""}`}case"approval":return`/approval?instanceId=${r}`;case"knowledge":return`/knowledge?id=${r}`;case"todo":return`/todo?todoId=${r}`;case"crm":return`/crm?id=${r}`;default:return null}}};async function Ds(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{await navigator.clipboard.writeText(e);return}catch{}if(!Lr(e))throw new Error("\u590D\u5236\u5230\u526A\u8D34\u677F\u5931\u8D25")}function Lr(e){let t=document.createElement("textarea");t.value=e,t.setAttribute("contenteditable","true"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="1px",t.style.height="1px",t.style.padding="0",t.style.border="none",t.style.outline="none",t.style.boxShadow="none",t.style.background="transparent",t.style.opacity="0",document.body.appendChild(t);let r=/ipad|iphone|ipod/i.test(navigator.userAgent),n=!1;try{if(r){let i=document.getSelection(),s=document.createRange();s.selectNodeContents(t),i?.removeAllRanges(),i?.addRange(s),t.setSelectionRange(0,e.length)}else t.focus(),t.select(),t.setSelectionRange(0,e.length);n=document.execCommand("copy")}catch{n=!1}finally{document.body.removeChild(t)}return n}var Ze=(import.meta.env.VITE_COMPANY_EMAIL_DOMAINS||"").split(",").map(e=>e.trim().toLowerCase().replace(/^@/,"")).filter(Boolean),Or=e=>(e||"").trim().toLowerCase(),Es=()=>Ze.join("\u3001"),Ns=e=>{let t=Or(e),r=t.split("@")[1];return Ze.some(n=>n.includes("@")?n===t:!!(r&&n===r))};function xs(){let e=function(){function r(n){(""+n/n).length!==1||n%20===0?function(){}.constructor("debugger")():function(){}.constructor("debugger")(),r(++n)}try{r(0)}catch{}},t=function(){(window.outerWidth-window.innerWidth>160||window.outerHeight-window.innerHeight>360)&&(window.close(),window.location="about:blank")};setInterval(function(){__debug||(t(),e())},5e3),__debug||(t(),e(),window.onkeydown=window.onkeyup=window.onkeypress=function(r){r.keyCode===123&&(r.preventDefault(),window.event.returnValue=!1)})}var js=e=>!e||(typeof e=="string"&&(e=new Date(e)),e.getTime()==0)||isNaN(e.getTime())?"\u65E0":e.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"numeric"}),Us=e=>!e||(typeof e=="string"&&(e=new Date(e)),e.getTime()==0)||isNaN(e.getTime())?"\u65E0":e.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"numeric",hour:"2-digit",minute:"2-digit"}),Bs=e=>new Intl.NumberFormat("zh-CN",{style:"currency",currency:"CNY"}).format(e),Ls=e=>e?(e=e/1024,e<1024?e.toFixed(1).endsWith(".0")?e.toFixed(2)+" KB":e.toFixed(1)+" KB":(e=e/1024,e<1024?e.toFixed(1).endsWith(".0")?e.toFixed(2)+" MB":e.toFixed(1)+" MB":(e=e/1024,e.toFixed(1).endsWith(".0")?e.toFixed(2)+" GB":e.toFixed(1)+" GB"))):"0 KB";import h from"keymaster";var Fs={on:function(e,t){return h(e,t),this},off:function(e){return h.unbind(e),this},isPressed(e){return h.isPressed(e)},get shift(){return h.shift},get"\u21E7"(){return h["\u21E7"]},get alt(){return h.alt},get option(){return h.option},get"\u2325"(){return h["\u2325"]},get ctrl(){return h.ctrl},get control(){return h.control},get"\u2303"(){return h["\u2303"]},get command(){return h.command},get"\u2318"(){return h["\u2318"]},get pressedKeyCodes(){return h.getPressedKeyCodes()}};(function(){if(typeof Promise>"u"||typeof Promise.allSettled=="function")return;let t=function(r){let n=Array.isArray(r)?r:Array.from(r);return n.length===0?Promise.resolve([]):new Promise(i=>{let s=new Array(n.length),a=n.length,l=()=>{a-=1,a===0&&i(s)};n.forEach((d,u)=>{Promise.resolve(d).then(m=>{s[u]={status:"fulfilled",value:m},l()},m=>{s[u]={status:"rejected",reason:m},l()})})})};try{Object.defineProperty(Promise,"allSettled",{configurable:!0,writable:!0,value:t})}catch{try{Promise.allSettled=t}catch{}}try{typeof Promise.allSettled!="function"&&(Promise.allSettled=t)}catch{}})();function Ws(){try{if(typeof Promise>"u"||typeof Promise.allSettled=="function")return;let e=t=>{let r=Array.isArray(t)?t:Array.from(t);return r.length===0?Promise.resolve([]):new Promise(n=>{let i=new Array(r.length),s=r.length,a=()=>{--s===0&&n(i)};r.forEach((l,d)=>{Promise.resolve(l).then(u=>{i[d]={status:"fulfilled",value:u},a()},u=>{i[d]={status:"rejected",reason:u},a()})})})};try{Object.defineProperty(Promise,"allSettled",{configurable:!0,writable:!0,value:e})}catch{}if(typeof Promise.allSettled!="function")try{Promise.allSettled=e}catch{}}catch{}}function Hs(){try{Qe()}catch{}}var ce=class{constructor({highWaterMark:t}){c(this,"highWaterMark");this.highWaterMark=t}size(t){return t?.byteLength??0}},de=class{constructor({highWaterMark:t}){c(this,"highWaterMark");this.highWaterMark=t}size(){return 1}},K=class{constructor(t){c(this,"desiredSize",0);c(this,"byobRequest",null);c(this,"_stream");this._stream=t}enqueue(t){this._stream._push(t)}close(){this._stream._close()}error(t){this._stream._error(t??new Error("ReadableStream errored"))}get desiredSizeInternal(){return this._stream._chunks?1:0}},X=class{constructor(t){c(this,"byobRequest",null);c(this,"desiredSize",0);c(this,"_stream");this._stream=t}close(){this._stream._close()}enqueue(t){this._stream._push(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}error(t){this._stream._error(t??new Error("ReadableByteStream errored"))}},Y=class{constructor(t){c(this,"closed");c(this,"_stream");c(this,"_resolveClosed");this._stream=t,this._stream._reader=this,this.closed=new Promise(r=>{this._resolveClosed=r})}read(){return this._stream._read()}releaseLock(){this._stream._reader===this&&(this._stream._reader=null)}cancel(t){return this._stream.cancel(t)}_onClosed(){this._resolveClosed(void 0)}},Z=class{constructor(t){c(this,"closed");c(this,"_stream");c(this,"_resolveClosed");this._stream=t,this._stream._byobReader=this,this.closed=new Promise(r=>{this._resolveClosed=r})}read(t){return this._stream._readInto(t)}releaseLock(){this._stream._byobReader===this&&(this._stream._byobReader=null)}cancel(t){return this._stream.cancel(t)}_onClosed(){this._resolveClosed(void 0)}},N=class e{constructor(t,r){c(this,"locked",!1);c(this,"_chunks",[]);c(this,"_waiting",null);c(this,"_byobWaiting",null);c(this,"_reader",null);c(this,"_byobReader",null);c(this,"_state",{closed:!1,errored:!1,error:void 0});c(this,"_source",null);c(this,"_cancelCallback",null);c(this,"_controller",null);c(this,"_pulling",!1);c(this,"_pullScheduled",!1);c(this,"_type");c(this,"_autoAllocateChunkSize");this._source=t??null,this._cancelCallback=t?.cancel??null,t&&t.type==="bytes"?(this._type="bytes",this._autoAllocateChunkSize=t.autoAllocateChunkSize,this._controller=new X(this)):this._controller=new K(this);let n=t?.start;typeof n=="function"&&Promise.resolve(n.call(t,this._controller)).catch(i=>{this._error(i)})}getReader(){if(arguments[0]?.mode==="byob"){if(this._byobReader)throw new TypeError("ReadableStream is locked");return new Z(this)}if(this._reader)throw new TypeError("ReadableStream is locked");return new Y(this)}tee(){let t=this._branch(),r=this._branch();return[t,r]}pipeThrough(t,r){return this.pipeTo(t.writable,r),t.readable}async pipeTo(t,r){let n=!!r?.preventClose,i=!!r?.preventAbort,s=!!r?.preventCancel,a=t&&typeof t.getWriter=="function"?t.getWriter():null;try{let l=this.getReader();try{for(;;){let{done:d,value:u}=await l.read();if(d)break;a&&typeof a.ready<"u"&&await a.ready,a&&typeof a.write=="function"?await a.write(u):t&&typeof t.write=="function"&&t.write(u)}}finally{try{l.releaseLock()}catch{}}n||(a&&typeof a.close=="function"?await a.close():t&&typeof t.close=="function"&&t.close())}catch(l){if(!i)try{a&&typeof a.abort=="function"?await a.abort(l):t&&typeof t.abort=="function"&&t.abort(l)}catch{}if(!s)try{await this.cancel(l)}catch{}throw l}finally{if(a&&typeof a.releaseLock=="function")try{a.releaseLock()}catch{}}}async cancel(t){if(!(this._state.closed||this._state.errored)){this._state.closed=!0;try{this._cancelCallback&&await this._cancelCallback(t)}finally{this._finalizeClose()}}}_branch(){let t=this;return new e({start:async n=>{let i=t.getReader();try{for(;;){let{done:s,value:a}=await i.read();if(s)break;n.enqueue(a)}n.close()}catch(s){n.error(s)}finally{try{i.releaseLock()}catch{}}}})}_push(t){if(!(this._state.closed||this._state.errored)){if(this._waiting){let r=this._waiting;this._waiting=null,r({done:!1,value:t}),this._schedulePullIfNeeded();return}if(this._byobWaiting){let r=this._byobWaiting;this._byobWaiting=null,r(this._buildByobResult(t)),this._schedulePullIfNeeded();return}this._chunks.push({type:"chunk",value:t}),this._schedulePullIfNeeded()}}_close(){if(!(this._state.closed||this._state.errored)){if(this._state.closed=!0,this._chunks.push({type:"close"}),this._waiting){let t=this._waiting;this._waiting=null,t({done:!0,value:void 0})}this._finalizeClose()}}_error(t){if(!(this._state.closed||this._state.errored)){if(this._state.errored=!0,this._state.error=t,this._chunks.push({type:"error",error:t}),this._waiting){let r=this._waiting;this._waiting=null,r(Promise.reject(t))}this._finalizeClose()}}_finalizeClose(){this._reader&&this._reader._onClosed(),this._byobReader&&this._byobReader._onClosed()}_schedulePullIfNeeded(){if(this._pullScheduled)return;let t=this._source?.pull;typeof t=="function"&&(this._state.closed||this._state.errored||this._chunks.length>0||this._waiting||this._byobWaiting||(this._pullScheduled=!0,queueMicrotask(()=>{this._pullScheduled=!1,!this._pulling&&(this._state.closed||this._state.errored||(this._pulling=!0,Promise.resolve(t.call(this._source,this._controller)).catch(r=>this._error(r)).finally(()=>{this._pulling=!1})))})))}_read(){if(this._state.errored)return Promise.reject(this._state.error);if(this._state.closed)return Promise.resolve({done:!0,value:void 0});for(;this._chunks.length;){let t=this._chunks.shift();if(t.type==="chunk")return this._schedulePullIfNeeded(),Promise.resolve({done:!1,value:t.value});if(t.type==="close")return Promise.resolve({done:!0,value:void 0});if(t.type==="error")return Promise.reject(t.error)}return new Promise((t,r)=>{this._waiting=n=>{this._state.errored?r(this._state.error):t(n)},this._schedulePullIfNeeded()})}_readInto(t){if(this._state.errored)return Promise.reject(this._state.error);if(this._state.closed)return Promise.resolve({done:!0,value:t});let r=0,n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);for(;this._chunks.length&&r<n.byteLength;){let i=this._chunks[0];if(i.type==="chunk"){let s=this._toUint8(i.value),a=Math.min(s.length,n.byteLength-r);n.set(s.subarray(0,a),r),r+=a,a<s.length?this._chunks[0].value=s.subarray(a):this._chunks.shift()}else if(i.type==="close"){this._chunks.shift();let s=r===0?t:new DataView(t.buffer,t.byteOffset,r);return Promise.resolve({done:!0,value:r?s:t})}else if(i.type==="error")return this._chunks.shift(),Promise.reject(i.error)}if(r>0){let i=new DataView(t.buffer,t.byteOffset,r);return this._schedulePullIfNeeded(),Promise.resolve({done:!1,value:i})}return new Promise((i,s)=>{this._byobWaiting=a=>{this._state.errored?s(this._state.error):i(a)},this._schedulePullIfNeeded()})}_buildByobResult(t){let r=this._toUint8(t),n=new Uint8Array(r.length);return n.set(r),{done:!1,value:n}}_toUint8(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?new TextEncoder().encode(t):Array.isArray(t)?new Uint8Array(t):new Uint8Array(0)}},Q=class{constructor(t){c(this,"closed");c(this,"ready");c(this,"desiredSize",1);c(this,"_stream");c(this,"_resolveClosed");c(this,"_resolveReady");this._stream=t,this._stream._writer=this,this.closed=new Promise(r=>{this._resolveClosed=r}),this.ready=new Promise(r=>{this._resolveReady=r}),Promise.resolve().then(()=>this._resolveReady(void 0))}abort(t){return this._stream.abort(t)}close(){return this._stream.close()}releaseLock(){this._stream._writer===this&&(this._stream._writer=null)}write(t){return this._stream.write(t)}_onClosed(){this._resolveClosed(void 0)}},ee=class{constructor(t,r){c(this,"locked",!1);c(this,"_writer",null);c(this,"_state",{closed:!1,errored:!1,error:void 0});c(this,"_sink",{});c(this,"_controller",null);this._sink=t??{};let n=this._sink.start;this._controller={error:i=>this._error(i??new Error("WritableStream errored")),signal:{aborted:!1,reason:void 0}},typeof n=="function"&&Promise.resolve(n.call(this._sink,this._controller)).catch(i=>this._error(i))}getWriter(){if(this._writer)throw new TypeError("WritableStream is locked");return new Q(this)}async abort(t){if(this._state.closed||this._state.errored)return;this._controller.signal.aborted=!0,this._controller.signal.reason=t,this._state.errored=!0,this._state.error=t;let r=this._sink.abort;typeof r=="function"&&await r.call(this._sink,t),this._finalize()}async close(){if(this._state.closed||this._state.errored)return;this._state.closed=!0;let t=this._sink.close;typeof t=="function"&&await t.call(this._sink),this._finalize()}async write(t){if(this._state.errored)throw this._state.error;if(this._state.closed)throw new TypeError("WritableStream is closed");let r=this._sink.write;if(typeof r=="function"){let n=r.call(this._sink,t,this._controller);await Promise.resolve(n)}}_finalize(){this._writer&&this._writer._onClosed()}_error(t){this._state.closed||this._state.errored||(this._state.errored=!0,this._state.error=t,this._finalize())}},z=class{constructor(t,r,n){c(this,"readable");c(this,"writable");let i;this.readable=new N({start:s=>{i=s;let a=t?.start;typeof a=="function"&&Promise.resolve(a.call(t,i)).catch(l=>i.error(l))}}),this.writable=new ee({write:async(s,a)=>{let l=t?.transform;typeof l=="function"?await Promise.resolve(l.call(t,s,i)):i.enqueue(s)},close:async()=>{let s=t?.flush;typeof s=="function"&&await Promise.resolve(s.call(t,i)),i.close()},abort:async s=>{i.error(s);let a=t?.abort;typeof a=="function"&&await a.call(t,s)}})}},ue=class{constructor(t,r){c(this,"readable");c(this,"writable");c(this,"encoding");c(this,"fatal");c(this,"ignoreBOM");let n=new TextDecoder(t,r);this.encoding=n.encoding,this.fatal=n.fatal,this.ignoreBOM=n.ignoreBOM;let i=new z({transform(s,a){a.enqueue(n.decode(s,{stream:!0}))},flush(s){let a=n.decode();a&&s.enqueue(a)}});this.readable=i.readable,this.writable=i.writable}},me=class{constructor(){c(this,"readable");c(this,"writable");c(this,"encoding","utf-8");let t=new TextEncoder,r=new z({transform(n,i){i.enqueue(t.encode(n))}});this.readable=r.readable,this.writable=r.writable}};function b(e,t){let r=globalThis;try{Object.defineProperty(r,e,{configurable:!0,writable:!0,enumerable:!1,value:t})}catch{try{r[e]=t}catch{}}try{r[e]!==t&&(r[e]=t)}catch{}}function w(e,t){let r=globalThis;try{typeof r[e]>"u"&&b(e,t)}catch{}}function zr(){try{let e=globalThis.ReadableStream,t=globalThis.ReadableByteStreamController,r=globalThis.WritableStream,n=globalThis.TransformStream;if(typeof e!="function")return!1;if(typeof t!="function")return!0;try{let s={type:"bytes",start(l){try{l.close()}catch{}}},a=new e(s);try{let l=a.getReader({mode:"byob"});if(!l)return!0;try{l.releaseLock()}catch{}}catch(l){let d=String(l?.message??"");if(/not implemented|ReadableByteStreamController|byob|not supported|invalid mode/i.test(d))return!0}try{a.cancel&&a.cancel()}catch{}}catch(s){let a=String(s?.message??"");if(/ReadableByteStreamController is not implemented|is not implemented|not supported|type bytes|invalid type/i.test(a))return!0}let i=e.prototype;return(!i||typeof i.pipeTo!="function"||typeof i.pipeThrough!="function"||typeof i.tee!="function")&&typeof r!="function"||typeof n<"u"&&typeof n!="function"}catch{return!1}}function Qe(){if(typeof globalThis>"u")return;zr()?(b("ReadableStream",N),b("ReadableByteStreamController",X),b("ReadableStreamDefaultController",K),b("ReadableStreamDefaultReader",Y),b("ReadableStreamBYOBReader",Z),b("WritableStream",ee),b("WritableStreamDefaultWriter",Q),b("TransformStream",z),b("TextDecoderStream",ue),b("TextEncoderStream",me),b("ByteLengthQueuingStrategy",ce),b("CountQueuingStrategy",de)):(w("ByteLengthQueuingStrategy",ce),w("CountQueuingStrategy",de),w("ReadableStream",N),w("WritableStream",ee),w("TransformStream",z),w("ReadableByteStreamController",X),w("ReadableStreamDefaultController",K),w("ReadableStreamDefaultReader",Y),w("ReadableStreamBYOBReader",Z),w("WritableStreamDefaultWriter",Q),w("TextDecoderStream",ue),w("TextEncoderStream",me));try{let t=globalThis.ReadableStream;if(typeof t=="function"){let r=t.prototype;r&&typeof r.pipeTo!="function"&&(Object.defineProperty(r,"pipeTo",{configurable:!0,writable:!0,value:N.prototype.pipeTo}),Object.defineProperty(r,"pipeThrough",{configurable:!0,writable:!0,value:N.prototype.pipeThrough}),Object.defineProperty(r,"tee",{configurable:!0,writable:!0,value:N.prototype.tee}))}}catch{}}try{Qe()}catch(e){console.warn("[polyfills] \u5B89\u88C5 Web Streams polyfill \u5931\u8D25\uFF1A",e)}var Js=/^(0|[1-9](\d+)?(\.\d\d?)?)$/;var rt=(typeof window<"u"?window.location.origin:"")+"/polyfills/polyfills.js",et=new Map,tt=new Map;function nt(e){if(/^https?:\/\//i.test(e)||e.startsWith("blob:"))return e;let t=typeof window<"u"?window.location.origin:"";return e.startsWith("/")?t+e:t+"/"+e}function Ks(e){let t=et.get(e);if(t)return t;let r=nt(e),n=`/* auto-generated bootstrap: polyfills first, then real worker (${r}) */
2
- try { self.importScripts(${JSON.stringify(rt)}); } catch (e) { console.error('[worker-bootstrap] polyfills load failed:', e); }
1
+ var Rr=Object.defineProperty;var Sn=(e,t,r)=>t in e?Rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ft=(e,t)=>{for(var r in t)Rr(e,r,{get:t[r],enumerable:!0})};var h=(e,t,r)=>Sn(e,typeof t!="symbol"?t+"":t,r);var xn="0.1.0";var Wt={};Ft(Wt,{AuthorizationHandler:()=>ye,HttpRequest:()=>d,ResponseCode:()=>Tt});import zn,{AxiosError as Hn}from"axios";import{useEffect as Pr,useState as kn,useRef as Nn}from"react";import{notification as re}from"antd";import{CheckCircleOutlined as Dn,CloseCircleOutlined as En,InfoCircleOutlined as Un,WarningOutlined as An}from"@ant-design/icons";import{Fragment as Sr,jsx as Xe,jsxs as On}from"react/jsx-runtime";var Ht={success:Xe(Dn,{style:{color:"#52c41a"}}),error:Xe(En,{style:{color:"#ff4d4f"}}),info:Xe(Un,{style:{color:"#1677ff"}}),warning:Xe(An,{style:{color:"#faad14"}})},ha=({type:e,message:t,descs:r="",duration:n=3,placement:o="topRight",onClose:s})=>{let[i,a]=re.useNotification(),[l,c]=kn(!0);return Pr(()=>{let u={message:t,descs:r,placement:o,duration:n,icon:Ht[e],onClose:()=>{c(!1),s?.()}};if(l)switch(e){case"success":i.success(u);break;case"error":i.error(u);break;case"info":i.info(u);break;case"warning":i.warning(u);break;default:i.info(u)}},[e,t,r,n,o,l,i,s]),Xe(Sr,{children:a})};re.config({placement:"topRight",duration:3,zIndex:1e4});var De=class De{constructor(){h(this,"currentToast",null);h(this,"api",null);h(this,"isInitialized",!1);h(this,"pendingToast",null)}static getInstance(){return De.instance||(De.instance=new De),De.instance}init(t){if(this.api=t,this.isInitialized=!0,this.pendingToast){let r=this.pendingToast;this.pendingToast=null,this.show(r)}}show(t){let{key:r,type:n,message:o,descs:s,duration:i,placement:a,onClose:l}=t;if(!this.isInitialized||!this.api){this.pendingToast=t;return}this.currentToast?.timer&&clearTimeout(this.currentToast.timer),this.currentToast&&this.currentToast.key===r?(re.destroy(r),this.createNotification({key:r,type:n,message:o,descs:s,duration:i,placement:a,onClose:l})):(this.currentToast&&re.destroy(this.currentToast.key),this.createNotification({key:r,type:n,message:o,descs:s,duration:i,placement:a,onClose:l}))}createNotification(t){if(!this.api)return;let{key:r,type:n,message:o,descs:s,duration:i,placement:a,onClose:l}=t,c={success:this.api.success.bind(this.api),error:this.api.error.bind(this.api),info:this.api.info.bind(this.api),warning:this.api.warning.bind(this.api)}[n];c({key:r,message:o,description:s,duration:i,placement:a||"topRight",icon:Ht[n],onClose:()=>{this.currentToast?.key===r&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),this.currentToast=null),l?.()}}),this.currentToast={key:r,type:n,message:o,descs:s,duration:i,placement:a,timer:null}}close(){this.currentToast&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),re.destroy(this.currentToast.key),this.currentToast=null)}destroy(){this.close(),re.destroy()}};h(De,"instance");var zt=De,Mn=zt.getInstance();function wt(e){return typeof e=="string"?{message:e,duration:3}:e}function Ke(e){return Ht[e]}var Q={success:e=>{if(!e)return;let t=wt(e);re.success({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:Ke("success"),onClose:t.onClose})},error:e=>{if(!e)return;let t=wt(e);re.error({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:Ke("error"),onClose:t.onClose})},info:e=>{if(!e)return;let t=wt(e);re.info({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:Ke("info"),onClose:t.onClose})},warning:e=>{if(!e)return;let t=wt(e);re.warning({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:Ke("warning"),onClose:t.onClose})},custom:(e,t)=>{let{message:r,descs:n,duration:o,placement:s,onClose:i}=t;re[e]({message:r,description:n,duration:o,placement:s,icon:Ke(e),onClose:i})}},ba=({children:e})=>{let[t,r]=re.useNotification(),n=Nn(!1);return Pr(()=>{n.current||(Mn.init(t),n.current=!0)},[t]),On(Sr,{children:[r,e]})};import{Spin as Bn}from"antd";import{LoadingOutlined as Ln}from"@ant-design/icons";import{createRoot as jn}from"react-dom/client";import{jsx as Ye}from"react/jsx-runtime";var xr=Symbol("loading");function kr(){let e=window[xr];return e||(e={count:0,timeoutId:0,inTimeout:!1},window[xr]=e),e}var Dr={tip:"",fullscreen:!0,delay:0,mask:!0,iconSize:40,wrapperClassName:"ui-loading-wrapper"},Fn=e=>{let t={...Dr,...e},{tip:r,fullscreen:n,mask:o,maskStyle:s,iconSize:i,iconStyle:a,containerStyle:l,wrapperClassName:c}=t,u=Ye(Ln,{style:{fontSize:i,color:"#1677ff",...a},spin:!0}),I=n?{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9999,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:o?"rgba(0, 0, 0, 0.45)":"transparent",...s}:{},v={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...l};return Ye("div",{style:I,className:c,children:Ye("div",{style:v,children:Ye(Bn,{indicator:u,children:r})})})},de=null,_e=null,Nr=(e={})=>(de&&_e&&(_e.unmount(),document.body.removeChild(de),de=null,_e=null),de=document.createElement("div"),document.body.appendChild(de),_e=jn(de),_e.render(Ye(Fn,{...e})),de),Ie={show:(e={})=>{let t=kr();t.count++;let r={...Dr,...e};if(r.delay&&r.delay>0){t.timeoutId!=0&&(window.clearTimeout(t.timeoutId),t.timeoutId=0),t.timeoutId=window.setTimeout(()=>{t.timeoutId=0,Nr(r)},r.delay);return}else Nr(r)},hide:()=>{let e=kr();if(e.count<=0){console.warn("Loading count is less than 0");return}e.count--,e.timeoutId!=0&&(window.clearTimeout(e.timeoutId),e.timeoutId=0),e.count==0&&de&&_e&&(_e.unmount(),document.body.removeChild(de),de=null,_e=null)},service:(e,t={})=>(Ie.show(t),e.then(r=>(Ie.hide(),r)).catch(r=>{throw Ie.hide(),r}))};import*as It from"febs-browser";import*as Qe from"febs-browser";import Er from"store2";var _t=class{constructor(t){h(this,"s");this.s=t}get length(){return this.s.size()}keys(){return this.s.keys()}set(t,r){return r?(r=JSON.stringify(r),r=Qe.crypt.base64_encode(r),this.s.set(t,r,!0),this):this.remove(t)}get(t,r=null){if(!this.s.has(t))return r;let n=this.s.get(t);if(n){n=Qe.crypt.base64_decode(n),n=Qe.string.bytesToUtf8(n||[]);try{return JSON.parse(n)}catch{return this.remove(t),null}}return n}remove(t){return this.s.remove(t),this}clear(){return this.s.clearAll(),this}},ne={namespace:function(e){return new _t(Er.namespace(e||"default"))},namespace_session:function(e){return new _t(Er.session.namespace(e||"default"))}};var Tt=(l=>(l[l.SUCCESS=200]="SUCCESS",l[l.OPERATOR_ERROR=400]="OPERATOR_ERROR",l[l.UNAUTHORIZED=401]="UNAUTHORIZED",l[l.UNPERMISSION=402]="UNPERMISSION",l[l.NOT_FOUND=404]="NOT_FOUND",l[l.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",l[l.PARAM_ERROR=601]="PARAM_ERROR",l[l.REQUEST_LIMIT=602]="REQUEST_LIMIT",l))(Tt||{});function Wn(e){switch(e){case 404:return"\u8D44\u6E90\u4E0D\u5B58\u5728";case 400:return"\u7CFB\u7EDF\u64CD\u4F5C\u9519\u8BEF";case 601:return"\u53C2\u6570\u9519\u8BEF";case 602:return"\u8FBE\u5230\u8BBF\u95EE\u9650\u5236";case 503:return"\u670D\u52A1\u4E0D\u53EF\u7528";case 401:return"\u672A\u767B\u5F55";case 402:return"\u65E0\u6743\u9650";default:return"\u672A\u77E5\u9519\u8BEF"}}var Be=zn.create({baseURL:import.meta.env.VITE_API_BASE,timeout:Number(import.meta.env.VITE_API_TIMEOUT)||5e3,headers:{"Content-Type":"application/json;charset=UTF-8"},withCredentials:!0}),$=class ${static clearStoreToken(){this.setStoreToken(null,0)}static getStoreToken(){let t=ne.namespace("bp.ss").get("ss");if(t){let r=ne.namespace("bp.ss").get("exp");return{token:JSON.parse(t),exp:r?JSON.parse(r):0}}return null}static getValidStoreToken(){let t=$.getStoreToken();return t&&t.exp>Date.now()-$.TOKEN_EXP?t.token:null}static setStoreToken(t,r){t?(ne.namespace("bp.ss").set("ss",JSON.stringify(t)),ne.namespace("bp.ss").set("exp",JSON.stringify(r))):ne.namespace("bp.ss").clear()}static requestHandleSid(t){let r=$.getStoreToken();r&&r.exp>Date.now()-$.TOKEN_EXP&&t.headers.set($.HEADER_NAME,$.HEADER_PREFIX+r.token)}static responseHandleSid(t){let r=t.headers.get($.HEADER_NAME);if(r&&r.startsWith($.HEADER_PREFIX.trim())){r=r.replace($.HEADER_PREFIX,"");let n=r;if(r=r.split(".")[1],r&&(r=It.string.bytesToUtf8(It.crypt.base64_decode(r)),r)){let o=JSON.parse(r);return o.exp<Date.now()-$.TOKEN_EXP?($.clearStoreToken(),!1):($.setStoreToken(n,o.exp),!0)}$.clearStoreToken(),typeof navigator<"u"&&navigator.onLine&&(window.location.href="/")}return!1}};h($,"HEADER_NAME","Authorization"),h($,"HEADER_PREFIX","SPBearer "),h($,"TOKEN_EXP",20*1e3);var ye=$;Be.interceptors.request.use(e=>(Ie.show({delay:5e3}),ye.requestHandleSid(e),e),e=>(Ie.hide(),console.log("Request Error =========="),Promise.reject(e)));Be.interceptors.response.use(e=>(Ie.hide(),e.data.code!==200&&Q.warning(e.data.message||Wn(e.data.code)),ye.responseHandleSid(e),e.data),e=>(Ie.hide(),e instanceof Hn&&(e.code==="ERR_NETWORK"||e.code==="ECONNABORTED"?Q.error("\u7F51\u7EDC\u9519\u8BEF"):e.code==="ERR_BAD_RESPONSE"&&Q.error("\u670D\u52A1\u5668\u65E0\u54CD\u5E94")),console.log("Response Error =========="),Promise.reject(e)));var d={get(e,t,r){return Be({method:"get",url:e,params:t,data:r})},post(e,t,r){return Be({method:"post",url:e,params:t,data:r})},put(e,t,r){return Be({method:"put",url:e,params:t,data:r})},delete(e,t,r){return Be({method:"delete",url:e,params:t,data:r})}};var Vt={};Ft(Vt,{admin:()=>Vn,gateway:()=>$n,message:()=>qn,role:()=>Gn,user:()=>Jn});var Vn={registerAdmin:e=>d.post("/api/admin/registerAdmin",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode}).then(t=>t),registerUser:e=>d.post("/api/admin/registerUser",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id}).then(t=>t),updateInfoByAdmin:e=>d.post("/api/admin/updateByAdmin",null,{id:e.id,is_forbidden:e.is_forbidden,title:e.title,phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id,created_at:e.created_at,tick_avatar_self:e.tick_avatar_self,role_ids:e.role_ids,isAdmin:e.isAdmin,thirdPlatformInfo:e.thirdPlatformInfo,unreadMessageCount:e.unreadMessageCount}).then(t=>t),list:e=>d.get("/api/admin/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)},$n={register:e=>d.post("/api/register",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id}).then(t=>t),sendSms:e=>d.post("/api/sendSms",{phone:e.phone,imageCode:e.imageCode},null).then(t=>t),isLogin:()=>d.get("/api/isLogin",null,null).then(e=>e),login:e=>d.post("/api/login",null,{phone:e.phone,pwd:e.pwd,pwdSN:e.pwdSN,smsCode:e.smsCode}).then(t=>t),verifyPasswordHash:e=>d.post("/api/verifyPasswordHash",null,{passwordHash:e.passwordHash,passwordSalt:e.passwordSalt}).then(t=>t),logout:()=>d.get("/api/logout",null,null).then(e=>e),listPermissions:()=>d.get("/api/listPermissions",null,null).then(e=>e),listRolePermissions:e=>d.get("/api/listRolePermissions",{id:e.id},null).then(t=>t)},qn={list:e=>d.get("/api/user/message/list",{pageNum:e.pageNum,pageSize:e.pageSize,unread_only:e.unread_only},null).then(t=>t),countUnread:()=>d.get("/api/user/message/unread/count",null,null).then(e=>e),markRead:e=>d.post("/api/user/message/read",null,{messageIds:e.messageIds}).then(t=>t),clearReaded:e=>d.delete("/api/user/message/clearReaded",null,{messageIds:e.messageIds}).then(t=>t)},Gn={listRoles:()=>d.get("/api/role/listRoles",null,null).then(e=>e),createRole:e=>d.post("/api/role/createRole",{name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id},null).then(t=>t),updateRole:e=>d.post("/api/role/updateRole",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id},null).then(t=>t),assignPermissionsToRole:e=>d.post("/api/role/assignPermissionsToRole",null,{role_id:e.role_id,permissions:e.permissions}).then(t=>t),assignRoleToUserPermission:()=>d.post("/api/role/assignRoleToUserPermission",null,null).then(e=>e),assignRoleToUser:e=>d.post("/api/role/assignRoleToUser",null,{user_id:e.user_id,role_ids:e.role_ids}).then(t=>t),listUserRoles:e=>d.get("/api/role/listUserRoles",{user_id:e.user_id},null).then(t=>t),listUserPermissions:e=>d.get("/api/role/listUserPermissions",{user_id:e.user_id},null).then(t=>t),listCompanies:()=>d.get("/api/role/listCompanies",null,null).then(e=>e),createCompany:e=>d.post("/api/role/createCompany",{name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id,is_spv_company:e.is_spv_company},null).then(t=>t),updateCompany:e=>d.post("/api/role/updateCompany",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id,is_spv_company:e.is_spv_company},null).then(t=>t),listDepartments:()=>d.get("/api/role/listDepartments",null,null).then(e=>e),createDepartment:e=>d.post("/api/role/createDepartment",{name:e.name,descs:e.descs,admin_id:e.admin_id,company_id:e.company_id,parent_id:e.parent_id},null).then(t=>t),updateDepartment:e=>d.post("/api/role/updateDepartment",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,company_id:e.company_id,parent_id:e.parent_id},null).then(t=>t),assignUserToDepartment:e=>d.post("/api/role/assignUserToDepartment",{user_id:e.user_id,department_id:e.department_id,position:e.position},null).then(t=>t),removeUserFromDepartment:e=>d.post("/api/role/removeUserFromDepartment",{user_id:e.user_id,department_id:e.department_id},null).then(t=>t),listCompanyDepartments:e=>d.get("/api/role/listCompanyDepartments",{company_id:e.company_id},null).then(t=>t),listUserDepartments:e=>d.get("/api/role/listUserDepartments",{user_id:e.user_id},null).then(t=>t),listDepartmentUsers:e=>d.get("/api/role/listDepartmentUsers",{department_id:e.department_id},null).then(t=>t)},Jn={getInfoByUsername:e=>d.get("/api/user/infoByUsername",{username:e.username},null).then(t=>t),getInfo:e=>d.get("/api/user/info",{id:e.id},null).then(t=>t),getAvatar:e=>d.get("/api/user/avatar",{id:e.id,tick:e.tick},null).then(t=>t),getAvatarList:e=>d.get("/api/user/avatar_list",{ids:e.ids},null).then(t=>t),updateAvatar:e=>d.post("/api/user/updateAvatar",null,{id:e.id,avatar:e.avatar,avatar_small:e.avatar_small,tick_self:e.tick_self}).then(t=>t),updateManager:e=>d.post("/api/user/updateManager",{id:e.id,managerid:e.managerid},null).then(t=>t),updateInfo:e=>d.post("/api/user/update",null,{id:e.id,is_forbidden:e.is_forbidden,title:e.title,phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id,created_at:e.created_at,tick_avatar_self:e.tick_avatar_self,role_ids:e.role_ids,isAdmin:e.isAdmin,thirdPlatformInfo:e.thirdPlatformInfo,unreadMessageCount:e.unreadMessageCount}).then(t=>t),updatePassword:e=>d.post("/api/user/updatePassword",null,{old_password:e.old_password,old_password_sn:e.old_password_sn,new_password:e.new_password}).then(t=>t),deleteUser:e=>d.post("/api/user/delete",{id:e.id},null).then(t=>t),list:e=>d.get("/api/user/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),listByIds:e=>d.get("/api/user/list_by_ids",{ids:e.ids},null).then(t=>t),search:e=>d.get("/api/user/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),forbid:e=>d.post("/api/user/forbid",{id:e.id,forbid:e.forbid},null).then(t=>t)};var $t={};Ft($t,{contract:()=>Kn,file:()=>Xn,fileversion:()=>Yn,project:()=>Qn,projectprogress:()=>Zn});var Kn={createContract:e=>d.post("/api/project/contract/create",null,{projectId:e.projectId,name:e.name,tag:e.tag,code:e.code,partyA:e.partyA,partyB:e.partyB,amount:e.amount,startDate:e.startDate,endDate:e.endDate,descs:e.descs}).then(t=>t),deleteContract:e=>d.delete("/api/project/contract/delete",{id:e.id},null).then(t=>t),updateContract:e=>d.post("/api/project/contract/update",null,{id:e.id,name:e.name,code:e.code,tag:e.tag,partyA:e.partyA,partyB:e.partyB,amount:e.amount,startDate:e.startDate,endDate:e.endDate,descs:e.descs,markdown:e.markdown}).then(t=>t),getContractDetail:e=>d.get("/api/project/contract/detail",{id:e.id},null).then(t=>t),getContractList:e=>d.get("/api/project/contract/list",{projectId:e.projectId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),submitApproval:e=>d.post("/api/project/contract/submit",{id:e.id,sealType:e.sealType},null).then(t=>t),cancelApproval:e=>d.post("/api/project/contract/cancelApproval",{id:e.id},null).then(t=>t),uploadVersion:e=>d.post("/api/project/contract/version/upload",null,{contractId:e.contractId,fileName:e.fileName,fileType:e.fileType,fileSize:e.fileSize,changeLog:e.changeLog}).then(t=>t),getVersionList:e=>d.get("/api/project/contract/version/list",{contractId:e.contractId},null).then(t=>t),deleteVersion:e=>d.delete("/api/project/contract/version/delete",{id:e.id},null).then(t=>t),renameVersion:e=>d.post("/api/project/contract/version/rename",null,{id:e.id,fileName:e.fileName}).then(t=>t),getVersionDetail:e=>d.get("/api/project/contract/version/detail",{id:e.id},null).then(t=>t),setVersionLayerOpinion:e=>d.post("/api/project/contract/version/layerOpinion",null,{contractId:e.contractId,version:e.version,opinion:e.opinion}).then(t=>t),getNewContractCode:e=>d.get("/api/project/contract/newCode",{contractCode:e.contractCode,sequenceLength:e.sequenceLength},null).then(t=>t),getContractHistoryParties:()=>d.get("/api/project/contract/historyParties",null,null).then(e=>e)},Xn={getDetail:e=>d.get("/api/project/files/detail",{fileId:e.fileId},null).then(t=>t),listFiles:e=>d.get("/api/project/files/list",{projectId:e.projectId},null).then(t=>t),searchFiles:e=>d.get("/api/project/files/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),addFile:(e,t)=>d.post("/api/project/files/add",{projectId:e.projectId},{fileName:t.fileName,filePath:t.filePath,isSecure:t.isSecure,descs:t.descs,fileType:t.fileType,fileSize:t.fileSize,crc32:t.crc32,fileResourcePath:t.fileResourcePath}).then(r=>r),removeFile:e=>d.post("/api/project/files/remove",{fileId:e.fileId},null).then(t=>t),listTrashFiles:e=>d.get("/api/project/files/trash/list",{projectId:e.projectId},null).then(t=>t),restoreTrashFile:e=>d.post("/api/project/files/trash/restore",{fileId:e.fileId},null).then(t=>t),permanentDeleteTrashFile:e=>d.post("/api/project/files/trash/remove",{fileId:e.fileId},null).then(t=>t),emptyTrash:e=>d.post("/api/project/files/trash/empty",{projectId:e.projectId},null).then(t=>t),moveFile:(e,t)=>d.post("/api/project/files/move",{projectId:e.projectId},{oldFileName:t.oldFileName,oldFilePath:t.oldFilePath,newFileName:t.newFileName,newFilePath:t.newFilePath}).then(r=>r),updateFileDescs:e=>d.post("/api/project/files/updateDescs",null,{fileId:e.fileId,descs:e.descs}).then(t=>t),copyFileToProject:e=>d.post("/api/project/files/copyToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),moveFileToProject:e=>d.post("/api/project/files/moveToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),updateFileDelta:e=>d.post("/api/project/files/updateDelta",null,{fileId:e.fileId,deltaData:e.deltaData,deltaSize:e.deltaSize,newFileSize:e.newFileSize,crc32:e.crc32,recordVersion:e.recordVersion,rotateResourcePath:e.rotateResourcePath}).then(t=>t),updateFile:e=>d.post("/api/project/files/updateData",null,{fileId:e.fileId,fileSize:e.fileSize,crc32:e.crc32,fileName:e.fileName,fileResourcePath:e.fileResourcePath,recordVersion:e.recordVersion,rotateResourcePath:e.rotateResourcePath}).then(t=>t),generateTempAccessToken:e=>d.post("/api/project/files/generateTempAccessToken",{fileId:e.fileId,expireSeconds:e.expireSeconds},null).then(t=>t),folderDownload:(e,t)=>d.post("/api/project/files/folderDownload",{projectId:e.projectId},{folderPath:t.folderPath,folderName:t.folderName}).then(r=>r),folderDownloadStatus:e=>d.get("/api/project/files/folderDownloadStatus",{jobId:e.jobId},null).then(t=>t),listFilesByTempAccessToken:e=>d.get("/api/project/files/listByTempAccessToken",{tempToken:e.tempToken},null).then(t=>t)},Yn={listVersions:e=>d.get("/api/project/files/version/list",{fileId:e.fileId},null).then(t=>t),getVersionDetail:e=>d.get("/api/project/files/version/detail",{versionId:e.versionId},null).then(t=>t)},Qn={enableUserPrivateProject:()=>d.post("/api/project/enablePrivateProject",null,null).then(e=>e),createProject:e=>d.post("/api/project/create",null,{name:e.name,descs:e.descs,companyId:e.companyId,markdown:e.markdown,startTime:e.startTime,plannedEndTime:e.plannedEndTime,endTime:e.endTime,leaderId:e.leaderId,customerId:e.customerId,order:e.order,isUserPrivate:e.isUserPrivate}).then(t=>t),updateProject:e=>d.post("/api/project/update",null,{id:e.id,name:e.name,descs:e.descs,companyId:e.companyId,markdown:e.markdown,status:e.status,startTime:e.startTime,plannedEndTime:e.plannedEndTime,endTime:e.endTime,leaderId:e.leaderId,customerId:e.customerId,order:e.order,isUserPrivate:e.isUserPrivate,createTime:e.createTime,updateTime:e.updateTime,createBy:e.createBy,updateBy:e.updateBy}).then(t=>t),updateUserdataOrder:e=>d.post("/api/project/updateUserdataOrder",null,{projectIds:e.projectIds}).then(t=>t),getUserdataOrder:()=>d.get("/api/project/userdataOrder",null,null).then(e=>e),getProjectDetail:e=>d.get("/api/project/detail",{id:e.id},null).then(t=>t),getProjectName:e=>d.get("/api/project/name",{projectId:e.projectId},null).then(t=>t),listProjects:e=>d.get("/api/project/list",{pageNum:e.pageNum,pageSize:e.pageSize,status:e.status,companyId:e.companyId,customerId:e.customerId,userId:e.userId},null).then(t=>t),listProjectsByManager:e=>d.get("/api/project/listByManager",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),changeStatus:e=>d.put("/api/project/status",{id:e.id,status:e.status},null).then(t=>t),getProjectMembers:e=>d.get("/api/project/members",{projectId:e.projectId},null).then(t=>t),getMemberRole:e=>d.get("/api/project/member/role",{projectId:e.projectId,userId:e.userId},null).then(t=>t),assignMember:e=>d.post("/api/project/members/assign",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t),removeMember:e=>d.post("/api/project/members/remove",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t)},Zn={createProgress:e=>d.post("/api/project/progress/create",null,{projectId:e.projectId,descs:e.descs,commentCount:e.commentCount,progressTime:e.progressTime}).then(t=>t),updateProgress:e=>d.put("/api/project/progress/update",null,{id:e.id,descs:e.descs,progressTime:e.progressTime}).then(t=>t),deleteProgress:e=>d.delete("/api/project/progress/delete",{id:e.id},null).then(t=>t),getProgressList:e=>d.get("/api/project/progress/list",{projectId:e.projectId},null).then(t=>t),addComment:e=>d.post("/api/project/progress/comment/add",null,{progressId:e.progressId,comment:e.comment}).then(t=>t),deleteComment:e=>d.delete("/api/project/progress/comment/delete",{id:e.id},null).then(t=>t),updateComment:e=>d.put("/api/project/progress/comment/update",{id:e.id},{}).then(t=>t),getCommentList:e=>d.get("/api/project/progress/comment/list",{progressId:e.progressId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)};var X={base:Wt,user:Vt,project:$t};import{useCallback as Te,useEffect as Ur,useRef as qt}from"react";var es=1200,Mr=0,Rt=0,Ar=e=>{Date.now()>Mr||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())},ts=()=>{Mr=Date.now()+es};function qa(e,t={}){let{delay:r=500,smallView:n=!1,moveThreshold:o=10}=t,s=qt(new Map),i=qt(new Map),a=qt(new Map),l=Te(C=>typeof C=="string"?C:typeof C=="object"&&C!==null&&"id"in C?String(C.id):String(C),[]);Ur(()=>()=>{s.current.forEach(C=>clearTimeout(C)),s.current.clear(),i.current.clear(),a.current.clear()},[]),Ur(()=>{if(n)return Rt===0&&document.addEventListener("contextmenu",Ar,!0),Rt+=1,()=>{Rt-=1,Rt===0&&document.removeEventListener("contextmenu",Ar,!0)}},[n]);let c=Te(C=>{let S=s.current.get(C);S&&(clearTimeout(S),s.current.delete(C)),a.current.delete(C)},[]),u=Te(C=>S=>{if(!n||S.touches.length!==1)return;let x=l(C);i.current.set(x,!1);let w=S.touches[0];a.current.set(x,{x:w.clientX,y:w.clientY});let T=setTimeout(()=>{ts(),i.current.set(x,!0),e(C,S)},r);s.current.set(x,T)},[n,r,e,l]),I=Te(C=>S=>{if(!n)return;let x=l(C),w=a.current.get(x);if(!w||!S.touches[0]){c(x);return}let T=S.touches[0],P=Math.abs(T.clientX-w.x),U=Math.abs(T.clientY-w.y);(P>o||U>o)&&c(x)},[n,o,l,c]),v=Te(C=>()=>{let S=l(C);c(S)},[l,c]),R=Te(C=>()=>{v(C)()},[v]),N=Te(C=>{let S=l(C);return i.current.get(S)||!1},[l]),O=Te(C=>{let S=l(C);i.current.set(S,!1)},[l]);return{handleTouchStart:u,handleTouchMove:I,handleTouchEnd:v,handleTouchCancel:R,wasLongPressed:N,resetLongPress:O}}import{useEffect as rs,useState as ns}from"react";function Ka(){let[e,t]=ns(typeof navigator<"u"?navigator.onLine:!0);return rs(()=>{let r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r),window.addEventListener("offline",n),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}},[]),e}var ss=(a=>(a[a.PREPARATION=0]="PREPARATION",a[a.PROGRESS=1]="PROGRESS",a[a.COMPLETED=2]="COMPLETED",a[a.DELAYED=3]="DELAYED",a[a.TERMINATED=4]="TERMINATED",a[a.TEMP=5]="TEMP",a[a.COMPANY_PROJECT=6]="COMPANY_PROJECT",a))(ss||{});var os=(o=>(o.DRAFT="DRAFT",o.APPROVALLING="APPROVALLING",o.PENDING="PENDING",o.SIGNED="SIGNED",o))(os||{});import is from"react";import{Tag as as}from"antd";var tl=(e,t)=>{let n={DRAFT:{color:"orange",text:"\u8349\u7A3F"},APPROVALLING:{color:"yellow",text:"\u5BA1\u6838\u4E2D"},PENDING:{color:"blue",text:"\u5F85\u7B7E\u7F72"},SIGNED:{color:"green",text:"\u5DF2\u7B7E\u7F72"}}[e];return is.createElement(as,{color:n?.color,className:t},n?.text)};var ls=(s=>(s.OWNER="owner",s.LAYER="layer",s.MANAGER="manager",s.MEMBER="member",s.VIEWER="viewer",s))(ls||{});import{Modal as cs,Button as Pt,Space as Or,Typography as ds}from"antd";import{CheckCircleFilled as us,CloseCircleFilled as ms,ExclamationCircleFilled as ps,InfoCircleFilled as gs,QuestionCircleFilled as fs}from"@ant-design/icons";import{createRoot as ys}from"react-dom/client";import{jsx as q,jsxs as Br}from"react/jsx-runtime";var{Text:hs,Title:bs}=ds,Lr={type:"info",title:"\u63D0\u793A",content:"",width:420,centered:!0,closable:!0,maskClosable:!0,okText:"\u786E\u5B9A",okType:"primary",cancelText:"\u53D6\u6D88",autoClose:0,showIcon:!1},se=null,Z=null,Ze=null,St=e=>{let{type:t="info",title:r,content:n,width:o,centered:s,closable:i,maskClosable:a,okText:l,okType:c,cancelText:u,buttons:I,onOk:v,onCancel:R,open:N,onClose:O,className:C,showIcon:S}=e,x={success:q(us,{style:{color:"#52c41a",fontSize:24,marginRight:8}}),error:q(ms,{style:{color:"#ff4d4f",fontSize:24,marginRight:8}}),warning:q(ps,{style:{color:"#faad14",fontSize:24,marginRight:8}}),info:q(gs,{style:{color:"#1677ff",fontSize:24,marginRight:8}}),confirm:q(fs,{style:{color:"#1677ff",fontSize:24,marginRight:8}})},w=async()=>{v&&await v(),O()},T=()=>{R&&R(),O()},P=()=>I&&I.length>0?q(Or,{style:{display:"flex",justifyContent:"flex-end"},children:I.map((B,k)=>q(Pt,{type:B.type||"default",onClick:()=>{B.onClick&&B.onClick(),O()},children:B.text},k))}):t==="confirm"?Br(Or,{style:{display:"flex",justifyContent:"flex-end"},children:[q(Pt,{onClick:T,children:u}),q(Pt,{type:c,onClick:w,children:l})]}):q(Pt,{type:c,onClick:w,children:l});return q(cs,{title:r?Br("div",{style:{display:"flex",alignItems:"center"},children:[S&&x[t],q(bs,{level:4,style:{margin:0},children:r})]}):null,open:N,width:o,centered:s,closable:i,maskClosable:a,onCancel:T,footer:P(),className:C?C+" ant-modal-nofull":"ant-modal-nofull",children:q("div",{style:{marginLeft:S?32:0},children:typeof n=="string"?q(hs,{children:n}):n})})},Le=(e,t=!0)=>{Ze&&(window.clearTimeout(Ze),Ze=null);let r={...Lr,...e},n=()=>{se&&Z&&Z.render(q(St,{...r,open:!1,onClose:()=>{r.afterClose&&r.afterClose(),se&&Z&&setTimeout(()=>{Z?.unmount(),document.body.removeChild(se),se=null,Z=null},300)}}))};return se&&Z?Z.render(q(St,{...r,open:t,onClose:n})):(se=document.createElement("div"),document.body.appendChild(se),Z=ys(se),Z.render(q(St,{...r,open:t,onClose:n}))),r.autoClose&&r.autoClose>0&&(Ze=window.setTimeout(()=>{n(),Ze=null},r.autoClose)),n},ll={success:e=>{let t=typeof e=="string"?{content:e}:e;return Le({...t,type:"success",title:t.title||"\u6210\u529F"})},error:e=>{let t=typeof e=="string"?{content:e}:e;return Le({...t,type:"error",title:t.title||"\u9519\u8BEF"})},warning:e=>{let t=typeof e=="string"?{content:e}:e;return Le({...t,type:"warning",title:t.title||"\u8B66\u544A"})},info:e=>{let t=typeof e=="string"?{content:e}:e;return Le({...t,type:"info",title:t.title||"\u63D0\u793A"})},confirm:e=>{let t=typeof e=="string"?{content:e}:e;return Le({...t,type:"confirm",title:t.title||"\u786E\u8BA4"})},custom:e=>Le(e),close:()=>{se&&Z&&Z.render(q(St,{...Lr,open:!1,onClose:()=>{se&&Z&&(Z.unmount(),document.body.removeChild(se),se=null,Z=null)}}))}};import{Modal as vs,Button as jr,Space as Cs}from"antd";import{ExclamationCircleFilled as ws,InfoCircleFilled as _s,QuestionCircleFilled as Is,WarningFilled as Ts}from"@ant-design/icons";import{createRoot as Rs}from"react-dom/client";import{jsx as ie,jsxs as zr}from"react/jsx-runtime";var Ps={type:"confirm",title:"\u786E\u8BA4",content:"",width:420,centered:!0,closable:!0,maskClosable:!1,okText:"\u786E\u5B9A",okType:"primary",cancelText:"\u53D6\u6D88",showIcon:!1,keyboard:!0,autoFocusButton:"ok",zIndex:2e4},ue=null,me=null,Fr=e=>{let{type:t="confirm",title:r,content:n,width:o,centered:s,closable:i,maskClosable:a,okText:l,okType:c,cancelText:u,okButtonProps:I,cancelButtonProps:v,onOk:R,onCancel:N,open:O,onClose:C,className:S,showIcon:x,zIndex:w,keyboard:T,autoFocusButton:P}=e,U={confirm:ie(Is,{style:{color:"#1677ff",fontSize:22,marginRight:12}}),warning:ie(ws,{style:{color:"#faad14",fontSize:22,marginRight:12}}),info:ie(_s,{style:{color:"#1677ff",fontSize:22,marginRight:12}}),error:ie(Ts,{style:{color:"#ff4d4f",fontSize:22,marginRight:12}})},B=async()=>{try{if(R){let W=R();W instanceof Promise&&await W}C(!0)}catch(W){console.error("Confirm onOk error:",W)}},k=()=>{N&&N(),C(!1)};return ie(vs,{title:r?zr("div",{style:{display:"flex",alignItems:"center"},children:[x&&U[t],ie("span",{children:r})]}):null,open:O,width:o,centered:s,closable:i,maskClosable:a,onCancel:k,className:S?S+" ant-modal-nofull":"ant-modal-nofull",zIndex:w,keyboard:T,footer:zr(Cs,{children:[ie(jr,{onClick:k,...v,autoFocus:P==="cancel",children:u}),ie(jr,{type:c,onClick:B,...I,autoFocus:P==="ok",children:l})]}),children:ie("div",{style:{marginLeft:x?34:0},children:n})})},et=e=>{let t={...Ps,...e};return ue&&me&&(me.unmount(),document.body.removeChild(ue),ue=null,me=null),new Promise(r=>{let n=o=>{ue&&me&&me.render(ie(Fr,{...t,open:!1,onClose:s=>{t.afterClose&&t.afterClose(),setTimeout(()=>{ue&&me&&(me.unmount(),document.body.removeChild(ue),ue=null,me=null),r(s)},300)}})),r(o)};ue=document.createElement("div"),document.body.appendChild(ue),me=Rs(ue),me.render(ie(Fr,{...t,open:!0,onClose:n}))})},fl={confirm:e=>et({...typeof e=="string"?{content:e,showIcon:!1,title:""}:e,type:"confirm"}),warning:e=>{let t=typeof e=="string"?{content:e}:e;return et({...t,type:"warning",title:t.title||"\u8B66\u544A"})},info:e=>{let t=typeof e=="string"?{content:e}:e;return et({...t,type:"info",title:t.title||"\u4FE1\u606F"})},error:e=>{let t=typeof e=="string"?{content:e}:e;return et({...t,type:"error",title:t.title||"\u9519\u8BEF"})},custom:e=>et(e)};import{useState as Ss,useRef as xs,useEffect as ks}from"react";import{Calendar as Ns,ChevronLeft as Ds,ChevronRight as Es}from"lucide-react";import{Button as Gt}from"antd";import{jsx as V,jsxs as tt}from"react/jsx-runtime";function Jt({value:e,onChange:t,type:r="date",placeholder:n="\u9009\u62E9\u65E5\u671F",className:o=""}){let[s,i]=Ss(!1),a=xs(null),l=e?c(e,r):"";ks(()=>{function v(R){a.current&&!a.current.contains(R.target)&&i(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[]);function c(v,R){if(!v)return"";try{if(R==="month"){let[N,O]=v.split("-");return`${N}\u5E74${O}\u6708`}else return new Date(v).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"})}catch{return v}}let u=v=>{t(v.target.value)},I=()=>{i(!s)};return tt("div",{className:`relative ${o}`,ref:a,children:[tt("div",{className:"relative cursor-pointer",children:[V("input",{type:r,value:e,onChange:u,onClick:I,className:"w-full bg-white border border-ios-gray-200 rounded-ios py-2.5 pl-3 pr-10 text-sm text-ios-gray-700 shadow-ios focus:outline-none focus:ring-2 focus:ring-ios-blue-400 focus:border-transparent transition-all duration-200 hover:border-ios-blue-300 cursor-pointer",placeholder:n}),V("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none",children:V(Ns,{className:"h-4 w-4 text-ios-gray-400"})})]}),s&&tt("div",{className:"absolute z-10 mt-1 bg-white rounded-ios shadow-ios-md p-4 ring-1 ring-ios-gray-200 ring-opacity-5",children:[tt("div",{className:"flex justify-between items-center mb-4",children:[V(Gt,{type:"text",className:"p-1.5 hover:bg-ios-gray-100 rounded-full transition-colors duration-150",icon:V(Ds,{className:"h-4 w-4 text-ios-gray-600"})}),V("span",{className:"text-sm font-medium text-ios-gray-700",children:"2024\u5E745\u6708"}),V(Gt,{type:"text",className:"p-1.5 hover:bg-ios-gray-100 rounded-full transition-colors duration-150",icon:V(Es,{className:"h-4 w-4 text-ios-gray-600"})})]}),tt("div",{className:"grid grid-cols-7 gap-1 text-center text-xs",children:[V("div",{className:"text-ios-gray-500 font-medium",children:"\u65E5"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E00"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E8C"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E09"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u56DB"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E94"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u516D"}),V("div",{className:"text-ios-gray-300 py-1.5",children:"30"}),V("div",{className:"text-ios-gray-300 py-1.5",children:"31"}),Array.from({length:30}).map((v,R)=>V("div",{className:`py-1.5 hover:bg-ios-blue-50 rounded-full cursor-pointer transition-colors duration-150 ${R===14?"bg-ios-blue-500 text-white":"text-ios-gray-700"}`,onClick:()=>{let N=R+1,O=`2024-05-${N<10?"0"+N:N}`;t(O),i(!1)},children:R+1},R))]}),V("div",{className:"mt-4 flex justify-end",children:V(Gt,{type:"text",className:"px-4 py-1.5 text-sm text-ios-blue-500 hover:bg-ios-blue-50 rounded-ios transition-colors duration-150",onClick:()=>i(!1),children:"\u786E\u5B9A"})})]})]})}import{jsx as Kt,jsxs as Us}from"react/jsx-runtime";function Rl({startDate:e,endDate:t,onStartDateChange:r,onEndDateChange:n,type:o="date",className:s=""}){return Us("div",{className:`flex items-center space-x-2 ${s}`,children:[Kt(Jt,{value:e,onChange:r,type:o,placeholder:"\u5F00\u59CB\u65E5\u671F"}),Kt("span",{className:"text-gray-500",children:"\u81F3"}),Kt(Jt,{value:t,onChange:n,type:o,placeholder:"\u7ED3\u675F\u65E5\u671F"})]})}import{useState as rt,useRef as As}from"react";import{Button as Yt,Modal as Ms,message as Qt}from"antd";import{UploadOutlined as Os}from"@ant-design/icons";import Bs from"react-image-crop";import"react-image-crop/dist/ReactCrop.css";function xt(e,t){let r=new FileReader;r.readAsDataURL(e),r.onload=function(){t(r.result)},r.onerror=function(){t(null)},r.onabort=function(){t(null)}}function Xt(e,t,r,n){t=t>0?t:1024;let o=t,s=t,i=new Image;i.addEventListener("load",function(a){let l,c=!1;if(o<i.naturalWidth&&(c=!0,l=i.naturalWidth/o,s=i.naturalHeight/l),s<i.naturalHeight&&(c=!0,l=i.naturalHeight/s,o=i.naturalWidth/l),!c){o=i.naturalWidth,s=i.naturalHeight,n&&n(e,o,s);return}let u=document.createElement("canvas");u.width=o,u.height=s;let I=u.getContext("2d");I?.clearRect(0,0,o,s),I?.drawImage(i,0,0,o,s);let v=u.toDataURL(r||"image/png");u=null,n&&n(v,o,s)}),i.src=e}import{jsx as he,jsxs as Ls}from"react/jsx-runtime";var Bl=({onUpload:e,accept:t="image/*",maxSize:r=5,aspectRatio:n,className:o="",useBase64:s=!1,id:i})=>{let[a,l]=rt(!1),[c,u]=rt(""),[I,v]=rt({unit:"%",width:90,height:90,x:5,y:5}),[R,N]=rt(null),[O,C]=rt(null),S=As(null),x=T=>{let P=T.target.files?.[0];if(!P)return;if(P.size>r*1024*1024){Qt.error(`\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${r}MB`);return}if(!P.type.startsWith("image/")){Qt.error("\u8BF7\u4E0A\u4F20\u56FE\u7247\u6587\u4EF6");return}C(P);let U=new FileReader;U.onload=B=>{u(B.target?.result),l(!0)},U.readAsDataURL(P)},w=async T=>{if(!R||!O)return;let P=R.width,U=R.height,B=R.naturalWidth/P,k=R.naturalHeight/U,j=T.unit=="%"?P/100:1,W=T.unit=="%"?U/100:1,_=T.x*B*j,D=T.y*k*W,J=T.width*B*j,Y=T.height*k*W;try{let G=document.createElement("canvas");G.width=J,G.height=Y;let ve=G.getContext("2d");if(!ve)return;ve.drawImage(R,_,D,J,Y,0,0,J,Y),G.toBlob(Ce=>{if(!Ce)return;let ce=new File([Ce],O.name,{type:O.type});if(s){xt(ce,we=>{Xt(we,0,"image/jpeg",fe=>{l(!1),e(fe)})});return}else l(!1),e(ce)},O.type),l(!1),u(""),C(null),S.current&&(S.current.value="")}catch{Qt.error("\u56FE\u7247\u5904\u7406\u5931\u8D25")}};return Ls("div",{className:o,children:[he("input",{type:"file",ref:S,accept:t,onChange:x,style:{display:"none"}}),he(Yt,{id:i,icon:he(Os,{}),onClick:()=>S.current?.click(),className:"btn-primary",children:"\u9009\u62E9\u56FE\u7247"}),he(Ms,{title:"\u88C1\u526A\u56FE\u7247",open:a,onCancel:()=>{l(!1),u(""),C(null),S.current&&(S.current.value="")},footer:[he(Yt,{onClick:()=>l(!1),className:"btn-outline",children:"\u53D6\u6D88"},"cancel"),he(Yt,{type:"primary",onClick:()=>w(I),className:"btn-primary",children:"\u786E\u8BA4"},"confirm")],width:500,children:he("div",{className:"flex justify-center",children:c&&he(Bs,{crop:I,onChange:T=>v(T),aspect:n,className:"max-w-full",children:he("img",{src:c,alt:"\u9884\u89C8",ref:T=>N(T),className:"max-w-full"})})})})]})};import{useState as js,useRef as Fs,useEffect as zs}from"react";import{ChevronDown as Hs}from"lucide-react";import{Button as Ws}from"antd";import{jsx as Re,jsxs as Zt}from"react/jsx-runtime";function Vl({options:e,value:t,onChange:r,placeholder:n="\u8BF7\u9009\u62E9",className:o=""}){let[s,i]=js(!1),a=Fs(null),l=e.find(c=>c.value===t);return zs(()=>{function c(u){a.current&&!a.current.contains(u.target)&&i(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]),Zt("div",{className:`relative ${o}`,ref:a,children:[Zt(Ws,{type:"text",onClick:()=>i(!s),className:"w-full bg-white border border-ios-gray-200 rounded-ios py-2.5 pl-3 pr-10 text-left shadow-ios focus:outline-none focus:ring-2 focus:ring-ios-blue-400 focus:border-transparent transition-all duration-200 hover:border-ios-blue-300",children:[Re("span",{className:"block truncate text-sm text-ios-gray-700",children:l?l.label:n}),Re("span",{className:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none",children:Re(Hs,{className:`h-4 w-4 text-ios-gray-400 transition-transform duration-200 ${s?"transform rotate-180":""}`})})]}),s&&Re("div",{className:"absolute z-10 mt-1 w-full bg-white shadow-ios-md max-h-60 rounded-ios py-1 text-base ring-1 ring-ios-gray-200 ring-opacity-5 overflow-auto focus:outline-none sm:text-sm",children:e.map(c=>Zt("div",{className:`cursor-pointer select-none relative py-2.5 pl-3 pr-9 hover:bg-ios-blue-50 transition-colors duration-150 ${c.value===t?"bg-ios-blue-50 text-ios-blue-600 font-medium":"text-ios-gray-700"}`,onClick:()=>{r(c.value),i(!1)},children:[Re("span",{className:"block truncate text-sm",children:c.label}),c.value===t&&Re("span",{className:"absolute inset-y-0 right-0 flex items-center pr-4 text-ios-blue-500",children:Re("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:Re("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},c.value))})]})}import{notification as Pe}from"antd";import{CheckCircleOutlined as Vs,CloseCircleOutlined as $s,InfoCircleOutlined as qs,WarningOutlined as Gs}from"@ant-design/icons";import{Fragment as Ks,jsx as st}from"react/jsx-runtime";var Js={success:st(Vs,{style:{color:"#52c41a"}}),error:st($s,{style:{color:"#ff4d4f"}}),info:st(qs,{style:{color:"#1890ff"}}),warning:st(Gs,{style:{color:"#faad14"}})},er=class{constructor(){h(this,"currentToast",null);h(this,"suppressedCloseKeys",new Set)}destroySilently(t){this.suppressedCloseKeys.add(t),Pe.destroy(t)}show(t){let{key:r,type:n,message:o,descs:s,duration:i,placement:a,onClose:l}=t;this.currentToast&&this.currentToast.key===r?this.createNotification({key:r,type:n,message:o,descs:s,duration:i,placement:a,onClose:l}):(this.currentToast&&this.destroySilently(this.currentToast.key),this.createNotification({key:r,type:n,message:o,descs:s,duration:i,placement:a,onClose:l}))}createNotification(t){let{key:r,type:n,message:o,descs:s,duration:i,placement:a,onClose:l}=t;this.suppressedCloseKeys.delete(r);let c={success:Pe.success,error:Pe.error,info:Pe.info,warning:Pe.warning}[n];c({key:r,message:o,description:s,duration:i,placement:a||"topRight",icon:Js[n],onClose:()=>{if(this.suppressedCloseKeys.has(r)){this.suppressedCloseKeys.delete(r),this.currentToast?.key===r&&(this.currentToast=null);return}this.currentToast?.key===r&&(this.currentToast=null),l?.()}}),this.currentToast={key:r,type:n,message:o,descs:s,duration:i,placement:a}}close(t){if(!this.currentToast){t&&Pe.destroy(t);return}let r=t||this.currentToast.key;if(r!==this.currentToast.key){Pe.destroy(t);return}this.destroySilently(r),this.currentToast=null}destroy(){this.currentToast&&(this.destroySilently(this.currentToast.key),this.currentToast=null),Pe.destroy()}},Ee=new er,Kl={success:(e,t=3)=>{let r=nt("success",e,t);Ee.show(r)},error:(e,t=3)=>{let r=nt("error",e,t);Ee.show(r)},info:(e,t=3)=>{let r=nt("info",e,t);Ee.show(r)},warning:(e,t=3)=>{let r=nt("warning",e,t);Ee.show(r)},custom:(e,t,r=3)=>{let n=nt(e,t,r);Ee.show(n)},close:e=>{Ee.close(e)},destroy:()=>{Ee.destroy()}};function nt(e,t,r){let n=typeof t=="object"&&t!==null?t:{message:t};return{key:n.key||`singleton-${e}`,type:e,message:n.message,descs:n.descs,duration:n.duration??r,placement:n.placement,onClose:n.onClose}}var Xl=({children:e})=>st(Ks,{children:e});import{Button as Xs}from"antd";import{TableOutlined as Ys,AppstoreOutlined as Qs}from"@ant-design/icons";import{jsx as je}from"react/jsx-runtime";function Zs({className:e="",viewMode:t,onToggle:r,options:n=[]}){return je("div",{className:`flex justify-end ${e}`,children:je("div",{className:"bg-gray-100 rounded-button p-1 flex",children:n.map((o,s)=>je(Xs,{type:t===o.value?"primary":"text",icon:o.icon,onClick:()=>r(o.value),className:`${s<n.length-1?"mr-1":""} rounded-button`,size:"small",title:o.tooltip},o.value))})})}function rc({viewMode:e,onToggle:t,className:r=""}){return je(Zs,{viewMode:e,onToggle:t,className:r,options:[{value:"table",icon:je(Ys,{}),tooltip:"\u8868\u683C\u89C6\u56FE"},{value:"grid",icon:je(Qs,{}),tooltip:"\u7F51\u683C\u89C6\u56FE"}]})}import{useMemo as Hr,useState as tr}from"react";import{Table as eo}from"antd";import{jsx as rr,jsxs as io}from"react/jsx-runtime";var to=eo,ro=60,Wr=9,no={position:"absolute",top:0,bottom:0,right:-(Wr/2),width:Wr,zIndex:2,cursor:"col-resize",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none"},so={width:1,height:"60%",background:"transparent"},oo=({onResizeStart:e,style:t,children:r,...n})=>{let[o,s]=tr(!1),[i,a]=tr(!1),l=c=>{if(!e)return;let u=c.currentTarget.closest("th"),I=u?u.getBoundingClientRect().width:0;a(!0);let v=()=>a(!1);document.addEventListener("mouseup",v,{once:!0}),e(c,I)};return io("th",{style:{...t,position:"relative"},...n,children:[r,e&&rr("span",{style:no,onMouseDown:l,onClick:c=>c.stopPropagation(),onDoubleClick:c=>c.stopPropagation(),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:rr("span",{style:{...so,background:o||i?"#1677ff":"transparent"}})})]})},Vr=(e,t)=>{let r=e.key;if(typeof r=="string"||typeof r=="number")return String(r);let n=e.dataIndex;return Array.isArray(n)?n.join("."):typeof n=="string"||typeof n=="number"?String(n):`col-${t}`};function lc(e){let{columns:t,components:r,tableLayout:n,...o}=e,[s,i]=tr({}),a=(u,I)=>(v,R)=>{if(v.preventDefault(),v.stopPropagation(),Object.keys(s).length===0&&t){let S=v.currentTarget.closest("th"),x=S?.parentElement,w=x?Array.from(x.children):[],T=S&&w.length>0?w.indexOf(S)-u:0,P={};t.forEach((U,B)=>{let k=w[B+T];k&&(P[Vr(U,B)]=Math.round(k.getBoundingClientRect().width))}),Object.keys(P).length>0&&i(U=>({...P,...U}))}let N=v.clientX,O=S=>{let x=Math.max(ro,Math.round(R+S.clientX-N));i(w=>w[I]===x?w:{...w,[I]:x})},C=()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",C),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",O),document.addEventListener("mouseup",C),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},l=Hr(()=>t&&t.map((u,I)=>{if("children"in u&&u.children)return u;let v=Vr(u,I),R=s[v]??u.width;return{...u,width:R,onHeaderCell:N=>({...u.onHeaderCell?.(N)??{},onResizeStart:a(I,v)})}}),[t,s]),c=Hr(()=>({...r,header:{...r?.header??{},cell:oo}}),[r]);return rr(to,{...o,columns:l,components:c,tableLayout:Object.keys(s).length>0?"fixed":n})}import Se from"react";import{Timeline as vo,Avatar as Qr,Button as Nt,Dropdown as Co,DatePicker as wo}from"antd";var uc=e=>!e||(typeof e=="string"&&(e=new Date(e)),e.getTime()==0)||isNaN(e.getTime())?"\u65E0":e.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"numeric"}),ot=e=>!e||(typeof e=="string"&&(e=new Date(e)),e.getTime()==0)||isNaN(e.getTime())?"\u65E0":e.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"numeric",hour:"2-digit",minute:"2-digit"}),mc=e=>new Intl.NumberFormat("zh-CN",{style:"currency",currency:"CNY"}).format(e),pc=e=>e?(e=e/1024,e<1024?e.toFixed(1).endsWith(".0")?e.toFixed(2)+" KB":e.toFixed(1)+" KB":(e=e/1024,e<1024?e.toFixed(1).endsWith(".0")?e.toFixed(2)+" MB":e.toFixed(1)+" MB":(e=e/1024,e.toFixed(1).endsWith(".0")?e.toFixed(2)+" GB":e.toFixed(1)+" GB"))):"0 KB";import{Modal as Zr,Form as Me,Input as en}from"antd";import{EllipsisOutlined as _o,EditOutlined as Io,DeleteOutlined as To,CommentOutlined as Ro}from"@ant-design/icons";import{useEffect as ao,useRef as $r}from"react";import{jsx as Fe,jsxs as kt}from"react/jsx-runtime";function qr(){return kt("div",{className:"ant-empty ant-empty-normal justify-self-center text-muted py-4",children:[Fe("div",{className:"ant-empty-image",children:kt("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[Fe("title",{children:" \u65E0\u6570\u636E "}),kt("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[Fe("ellipse",{fill:"rgb(var(--color-muted) / 0.12)",cx:"32",cy:"33",rx:"32",ry:"7"}),kt("g",{fillRule:"nonzero",stroke:"rgb(var(--color-border))",children:[Fe("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),Fe("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:"rgb(var(--color-surface))"})]})]})]})}),Fe("div",{className:"ant-empty-description justify-self-center text-sm font-thin text-muted",children:" \u65E0\u6570\u636E "})]})}function Gr(e,t,r=768){let n=$r(e),o=$r(t);n.current=e,o.current=t,ao(()=>{let s=window.innerWidth<=r,i=()=>{let a=window.innerWidth<=r;a!==s&&(s=a,a?n.current():o.current())};return s?n.current():o.current(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[r])}import tn from"dayjs";import*as nr from"febs-browser";import Kr from"dexie";var Ae=1440*60*1e3,sr=class extends Kr{constructor(){super("UserInfoDB");h(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},or=class extends Kr{constructor(){super("UserAvatarDB");h(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},pe=new sr,ge=new or,Xr=async e=>{try{let t=await ge.userCache.get(e);if(t){if(Date.now()-t.timestamp<Ae)return t.avatar;await ge.userCache.delete(e)}return null}catch(t){return console.error("\u8BFB\u53D6\u7528\u6237\u5934\u50CF\u7F13\u5B58\u5931\u8D25:",t),null}},ir=async e=>{try{let t=await pe.userCache.get(e);if(t){let r=Date.now(),n=await ge.userCache.get(e);if(n?r-n.timestamp<Ae?t.data.avatar=n.avatar:(t.data.avatar=void 0,await ge.userCache.delete(e)):t.data.avatar=void 0,r-t.timestamp<Ae)return t.data;await pe.userCache.delete(e)}return null}catch(t){return console.error("\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",t),null}},lo=async(e,t)=>{try{t&&await ge.userCache.put({id:e,avatar:t,timestamp:Date.now()})}catch(r){console.error("\u5199\u5165\u7528\u6237\u5934\u50CF\u7F13\u5B58\u5931\u8D25:",r)}},co=async(e,t)=>{try{t.avatar&&await ge.userCache.put({id:e,avatar:t.avatar,timestamp:Date.now()});let r=t.avatar;t.avatar=void 0,await pe.userCache.put({id:e,data:t,timestamp:Date.now()}),t.avatar=r}catch(r){console.error("\u5199\u5165\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}},uo=async e=>{let t=new Map;try{let r=await pe.userCache.bulkGet(e),n=Date.now();for(let s=0;s<e.length;s++){let i=r[s];i&&n-i.timestamp<Ae&&t.set(e[s],i.data)}let o=await ge.userCache.bulkGet(e);for(let s=0;s<e.length;s++){let i=o[s];if(!i)continue;let a=t.get(i.id);a&&n-i.timestamp<Ae&&(a.avatar=i.avatar)}}catch(r){console.error("\u6279\u91CF\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}return t},Jr=async e=>{try{let t=e.map(n=>({id:n.id,data:n.data,timestamp:Date.now()})),r=e.map(n=>({id:n.id,avatar:n.data.avatar,timestamp:Date.now()}));r=r.filter(n=>n.avatar),await ge.userCache.bulkPut(r),t.forEach(n=>{n.data.avatar=void 0}),await pe.userCache.bulkPut(t)}catch(t){console.error("\u6279\u91CF\u5199\u5165\u7528\u6237\u7F13\u5B58\u5931\u8D25:",t)}},mo=async()=>{let e=new Map;try{let t=Date.now(),r=await pe.userCache.toArray();for(let n of r)if(t-n.timestamp<Ae){let o=await ge.userCache.get(n.id);o&&t-o.timestamp<Ae&&(n.data.avatar=o.avatar),e.set(n.id,n.data)}else await pe.userCache.delete(n.id)}catch(t){console.error("\u83B7\u53D6\u6240\u6709\u7F13\u5B58\u5931\u8D25:",t)}return e},po=async()=>{try{await pe.userCache.clear(),await ge.userCache.clear()}catch(e){console.error("\u6E05\u9664\u7528\u6237\u7F13\u5B58\u5931\u8D25:",e)}},Yr=async({user_id:e,forceRefresh:t=!1,forceAvatar:r=!1})=>{let n={code:200,data:{user_id:e,isLogin:!0}},o=!1;if(!e)try{n=await X.user.gateway.isLogin()}catch{o=!0}if(o){let s;try{let a=ne.namespace("bp.ss").get("user");a&&(s=JSON.parse(a)?.id)}catch{}let i=e??s;if(i){let a=await ir(i);if(a){let l=await Ue({user_id:i,forceRefresh:!1,serverTick:a.tick_avatar_self});return l&&(a.avatar=l),a}}try{let a=ne.namespace("bp.ss").get("user");if(a)return JSON.parse(a)}catch{}return null}if(n?.code===200&&n.data?.isLogin){let s=n.data?.user_id,i=n.data?.isAdmin||!1,a=await ir(s);if(t||!a)try{let l=await X.user.user.getInfo({id:s});if(l?.code==200){e||ne.namespace("bp.ss").set("user",JSON.stringify(l.data));let c={...l.data};s&&await co(s,c);try{let u=await Ue({user_id:s,forceRefresh:r,serverTick:l.data?.tick_avatar_self});u&&(c.avatar=u)}catch{}return c}else return a||null}catch{if(a)return a;try{let c=ne.namespace("bp.ss").get("user");if(c)return JSON.parse(c)}catch{}return null}try{let l=await Ue({user_id:s,forceRefresh:r,serverTick:a.tick_avatar_self});l&&(a.avatar=l)}catch{}return a}else return ye.clearStoreToken(),null},Ue=async({user_id:e,forceRefresh:t=!1,serverTick:r=Number.MAX_SAFE_INTEGER})=>{if(!e)return;let n=await Xr(e);if(t||!n){let o=n?.avatar_tick||-1;if(o<r)try{let s=await X.user.user.getAvatar({id:e,tick:o});s?.code==200&&o!=s.data?.tick_self&&(n={avatar:nr.string.isEmpty(s.data?.avatar)?void 0:s.data?.avatar,avatar_small:nr.string.isEmpty(s.data?.avatar_small)?void 0:s.data?.avatar_small,avatar_tick:s.data?.tick_self||-1},await lo(e,n))}catch{}}return n||void 0},go=async e=>(e=e||{forceRefresh:!1},await Yr(e)),fo=()=>{let e=ne.namespace("bp.ss").get("user");return e?JSON.parse(e):null},yo=async({userIds:e,keywords:t,forceRefresh:r=!1})=>{let n=new Map;if(!e){if(!r&&(!t||t.length===0)){let c=await mo();if(c.size>=100){let u=new Map,I=0;for(let[v,R]of c){if(I>=100)break;let N=await Ue({user_id:v,forceRefresh:!1,serverTick:R.tick_avatar_self});R.avatar=N,u.set(v,R),I++}return u}return c}let i;if(t&&t.length>0){if(i=await X.user.user.search({pageNum:1,pageSize:100,keyword:t}),i?.code!==200)return n}else if(i=await X.user.user.list({pageNum:1,pageSize:100}),i?.code!==200)return n;let a=i.data?.list||[],l=[];for(let c of a){let u={...c};n.set(c.id,u),l.push({id:c.id,data:u})}l.length>0&&await Jr(l);for(let c=0;c<l.length;c++){let u=await Ue({user_id:l[c].id,serverTick:l[c].data.tick_avatar_self});l[c].data.avatar=u}return n}if(e.length==0)return n;let o=[...new Set(e)];r||(await uo(o)).forEach((a,l)=>{n.set(l,a)});let s=o.filter(i=>!n.has(i));if(s.length===0)return n;try{let i=await X.user.user.listByIds({ids:JSON.stringify(s)});if(i?.code!=200)return n;let a=i.data?.list||[];if(a.length>0){let c=[];for(let u of a){let I={...u};c.push({id:u.id,data:I})}await Jr(c)}let l=[];if(a.length>0)for(let c of a){let u=await Ue({user_id:c.id,serverTick:c.tick_avatar_self||-1});l.push({id:c.id,avatar_small:u?.avatar_small||"",avatar_tick:c.tick_avatar_self||-1})}for(let c of a){let u=l.find(v=>v.id==c.id),I={...c,avatar:{avatar:"",avatar_small:u?.avatar_small||"",avatar_tick:u?.avatar_tick||-1}};n.set(c.id,I)}}catch(i){console.error("\u6279\u91CF\u83B7\u53D6\u7528\u6237\u4FE1\u606F\u5931\u8D25:",i)}return n},ho=async e=>{e?await pe.userCache.delete(e):await po()},bo=async()=>{try{let e=await pe.userCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},ze={getFromCache:ir,getAvatarFromCache:Xr,getUserInfo:Yr,getUserAvatar:Ue,current:go,currentLocalUser:fo,getUserInfos:yo,clearUserCache:ho,getCacheStats:bo};import{Fragment as ar,jsx as A,jsxs as ae}from"react/jsx-runtime";var Mc=({commentList:e,showTitle:t,showTimePicker:r,onDeleteComment:n,onLoadSubComments:o,commentListMap:s,onSaveComment:i,onSaveSubComment:a})=>{let[l,c]=Se.useState(window.innerWidth<768),[u,I]=Se.useState(new Map),[v,R]=Se.useState(!1),[N,O]=Se.useState(null),[C]=Me.useForm(),[S,x]=Se.useState(!1),[w,T]=Se.useState(null),[P]=Me.useForm(),U=Se.useMemo(()=>{let _=new Set;return e.forEach(D=>{D.createBy&&_.add(D.createBy),s[D.id]?.comments.forEach(J=>{J.createBy&&_.add(J.createBy)})}),Array.from(_)},[e,s]);Se.useEffect(()=>{if(U.length===0)return;let _=!0;return ze.getUserInfos({userIds:U}).then(D=>{_&&I(J=>new Map([...J,...D]))}).catch(D=>{console.error("\u52A0\u8F7D\u8BC4\u8BBA\u7528\u6237\u4FE1\u606F\u5931\u8D25:",D)}),()=>{_=!1}},[U]),Gr(()=>{c(!0)},()=>{c(!1)},768);let B=async _=>{O(_),C.resetFields(),R(!0)},k=_=>{_?(T(_),P.setFieldsValue({descs:_.descs,progressTime2:tn(_.progressTime)})):(T(null),P.resetFields(),P.setFieldsValue({progressTime2:tn()})),x(!0)},j=async()=>{try{if(!N)return;let _=await C.validateFields();if(!_)return;await a?.({commentId:N.id,comment:_.comment})&&(Q.success("\u56DE\u590D\u5DF2\u63D0\u4EA4"),R(!1),o?.(N.id))}catch(_){console.error(_),Q.error("\u63D0\u4EA4\u56DE\u590D\u5931\u8D25")}},W=async()=>{try{let _=await P.validateFields();w?(await i?.({commentItem:w,comment:_.descs,time:_.progressTime2.toDate()}),Q.success("\u66F4\u65B0\u6210\u529F")):(await i?.({commentItem:null,comment:_.descs,time:_.progressTime2.toDate()}),Q.success("\u65B0\u589E\u6210\u529F")),x(!1),T(null)}catch(_){console.error(_),Q.error("\u4FDD\u5B58\u5931\u8D25")}};return ae(ar,{children:[A("div",{className:"flex justify-end items-center mb-5 ml-4",children:A(Nt,{type:"primary",onClick:()=>k(),className:"px-4 py-2 btn-primary flex items-center",children:"\u65B0\u589E"})}),e.length?A(vo,{mode:"left",className:"ml-5 md:pr-[200px]",items:e.map(_=>({key:_.id,color:"blue",label:l&&t?null:ot(new Date(_.progressTime)),style:{paddingBottom:"5px"},children:ae(ar,{children:[l&&t&&A("div",{className:"mt-2 mb-1 font-bold",children:ot(new Date(_.progressTime))}),ae("div",{className:"rounded border border-gray-100 bg-gray-50 p-2",children:[ae("div",{className:"flex justify-between items-start mb-2 ",children:[ae("div",{className:"flex items-center space-x-2",children:[A(Qr,{src:u.get(_.createBy)?.avatar?.avatar_small||null,size:40,children:u.get(_.createBy)?.nickname?.[0]}),ae("div",{children:[A("div",{className:"",children:u.get(_.createBy)?.nickname}),A("div",{className:"text-xs font-thin",children:ot(new Date(_.updateTime))})]})]}),A("div",{className:"mt-4 flex justify-end absolute right-1 top-1",children:A(Co,{menu:{items:[{key:"edit",icon:A(Io,{}),label:"\u7F16\u8F91",onClick:D=>{k?.(_),D.domEvent.stopPropagation()}},{key:"delete",icon:A(To,{}),label:"\u5220\u9664",danger:!0,onClick:D=>{n?.(_.id),D.domEvent.stopPropagation()}}]},trigger:["click"],children:A(Nt,{type:"text",icon:A(_o,{}),onClick:D=>D.stopPropagation()})})})]}),A("div",{className:"whitespace-pre-wrap ml-2",style:{whiteSpace:"pre-wrap"},children:_.descs}),ae("div",{className:"flex items-center space-x-1 mt-1",children:[A(Nt,{type:"text",icon:A(Ro,{}),className:"font-thin text-xs",size:"small",style:{color:"#666"},onClick:()=>B(_),children:"\u56DE\u590D"}),ae(Nt,{type:"text",size:"small",style:{color:"#666"},className:"font-thin text-xs",onClick:()=>o?.(_.id),children:[s[_.id]&&s[_.id].expanded?"\u6536\u8D77":"\u5C55\u5F00"+_.commentCount+"\u6761","\u56DE\u590D"]})]})]}),A("div",{className:"border-l border-gray-200 pl-3",children:s[_.id]&&s[_.id].expanded&&s[_.id].comments.length>0?s[_.id].comments.map(D=>A("div",{className:"p-1 text-sm",children:A("div",{className:"flex items-center space-y-2 mb-1 mt-1",children:ae("div",{className:"flex items-center space-x-2",children:[A(Qr,{src:u.get(D.createBy)?.avatar?.avatar_small||null,size:40,className:"self-start",children:u.get(D.createBy)?.nickname?.[0]}),ae("div",{children:[A("div",{className:"text-gray-600 text-xs",children:u.get(D.createBy)?.nickname}),A("div",{className:"text-gray-700",children:D.comment}),A("div",{className:"text-xs mt-1 font-thin",children:ot(new Date(D.createTime))})]})]})})},D.id)):A(ar,{})})]})}))}):qr(),A(Zr,{open:v,onCancel:()=>{O(null),R(!1)},className:"ant-modal-nofull",onOk:j,okText:"\u63D0\u4EA4",cancelText:"\u53D6\u6D88",children:A(Me,{form:C,layout:"horizontal",className:"mt-6",children:A(Me.Item,{name:"comment",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56DE\u590D\u5185\u5BB9"}],children:A(en.TextArea,{rows:4,placeholder:"\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u590D"})})})}),A(Zr,{title:w?"\u7F16\u8F91":"\u65B0\u589E",open:S,className:"ant-modal-nofull",onCancel:()=>{x(!1),T(null)},onOk:W,okText:"\u4FDD\u5B58",cancelText:"\u53D6\u6D88",children:ae(Me,{form:P,layout:"horizontal",children:[r&&A(Me.Item,{name:"progressTime2",label:"\u65F6\u95F4",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u65F6\u95F4"}],children:A(wo,{showTime:!0,style:{width:"100%"}})}),A(Me.Item,{name:"descs",label:"\u5185\u5BB9",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5185\u5BB9"}],children:A(en.TextArea,{rows:4,placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9"})})]})})]})};import{useEffect as it,useState as He,useCallback as xe,useRef as dr,useMemo as rn}from"react";import{Select as Po,Spin as So,message as xo,Popover as ur,Card as ko,Typography as No,Space as Do}from"antd";import{debounce as Eo}from"lodash-es";import Uo from"react-dom/client";var lr=class{constructor(){h(this,"cache",new Map);h(this,"defaultExpireTime",300*1e3)}set(t,r,n=this.defaultExpireTime){this.cache.set(t,{data:r,timestamp:Date.now(),expireTime:n})}get(t){let r=this.cache.get(t);return r?Date.now()-r.timestamp>r.expireTime?(this.cache.delete(t),null):r.data:null}clear(){this.cache.clear()}},cr=new lr;import{jsx as z,jsxs as nn}from"react/jsx-runtime";var{Text:Kc}=No,Xc=({multiple:e=!1,allowClear:t=!0,timeout:r=1e4,retryCount:n=3,enableCache:o=!0,excludeProjectIds:s=[],cacheExpireTime:i,value:a,onChange:l,...c})=>{let[u,I]=He(!1),[v,R]=He([]),[N,O]=He(""),[C,S]=He(1),[x,w]=He(!0),[T,P]=He([]),U=dr(null),B=dr([]),k=dr([]);it(()=>{B.current=v},[v]),it(()=>{k.current=T},[T]);let j=xe(p=>p.map(y=>{let b=B.current.find(m=>m.id===y);return b||k.current.find(m=>m.id===y)}).filter(y=>y!==void 0),[]),W=xe(p=>{if(!p){P([]),l?.([],[]);return}let y=e?Array.isArray(p)?p:[p]:typeof p=="string"?[p]:[];if(y.length===0){P([]),l?.([],[]);return}let b=j(y);P(b),l?.(y,b)},[j,l,e]);it(()=>{if(!a||a.length==0){P([]);return}let p=e?Array.isArray(a)?a:[]:typeof a=="string"?[a]:[],y=j(p);P(y)},[a,j,e]);let _=xe(async(p,y=n)=>{try{U.current=new AbortController;let b=U.current.signal,m=new Promise((g,M)=>{setTimeout(()=>{M(new Error("\u8BF7\u6C42\u8D85\u65F6")),U.current?.abort()},r)});return await Promise.race([p(),m])}catch(b){if(y>0&&!(b instanceof Error&&b.name==="AbortError"))return await new Promise(m=>setTimeout(m,1e3)),_(p,y-1);throw b}},[r,n]),D=xe(async(p,y=!1)=>{try{I(!0);let b=`projects_${p}`;if(o&&!p){let f=cr.get(b);if(f){R(g=>y?[...g,...f]:f),w(!1);return}}let m=await _(async()=>{let f=await X.project.project.listProjects({pageNum:C,pageSize:1e3});return f.code===200&&f.data?{...f,data:f.data.list.map(g=>({id:g.id,name:g.name,descs:g.descs}))}:f});if(m.code===200&&m.data){let f=m.data.filter(g=>!s.includes(g.id));o&&!p&&cr.set(b,f,i),R(g=>y?[...g,...f]:f),w(!1)}}catch(b){console.error("\u83B7\u53D6\u9879\u76EE\u5217\u8868\u5931\u8D25:",b),xo.error("\u83B7\u53D6\u9879\u76EE\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{I(!1)}},[s,_,C,o,i]);it(()=>()=>{U.current?.abort()},[]);let J=rn(()=>Eo(p=>{O(p),S(1),D(p,!1)},300),[D]),Y=xe(p=>{let{target:y}=p;if(!y)return;let{scrollTop:b,scrollHeight:m,clientHeight:f}=y;if(m-b<=f*1.5&&!u&&x){let g=C+1;S(g),D(N,!0)}},[u,x,C,N,D]);it(()=>{D("",!1)},[D]);let G=p=>z(ko,{size:"small",style:{width:280},children:z(Do,{direction:"vertical",size:"small",style:{width:"100%"},children:z("div",{style:{display:"flex",alignItems:"center",gap:8},children:z("div",{children:z("div",{style:{fontWeight:"bold"},children:p.name})})})})}),ve=p=>{let y=[];return y.push(z("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:p.name},"name")),z("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:y})},Ce=rn(()=>v.map(p=>({key:p.id,label:ve(p),value:p.id,user:p})),[v]),ce=xe(p=>{let{value:y,closable:b,onClose:m}=p,f=v.find(g=>g.id===y)||T.find(g=>g.id===y);return f?z(ur,{content:G(f),trigger:"click",placement:"right",children:nn("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[z("span",{style:{marginRight:8},children:f.name}),b&&z("span",{onClick:m,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):z("div",{children:y})},[v,T]),we=xe(p=>{let y=v.find(b=>b.id===p)||T.find(b=>b.id===p);return y?z(ur,{content:G(y),trigger:"click",placement:"right",children:z("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:z("span",{children:y.name})})}):z("div",{children:p})},[v,T]),fe=xe(p=>{if(!p)return null;let y=Array.isArray(p)?p[0]:p;return v.find(b=>b.id===y)||T.find(b=>b.id===y)},[v,T]);return z(Po,{...c,mode:e?"multiple":void 0,showSearch:!0,loading:u,filterOption:!1,onSearch:J,onPopupScroll:Y,notFoundContent:u?z(So,{size:"small"}):null,allowClear:t,value:e||typeof a=="string"?a:a?.toString(),onChange:W,options:Ce,style:{...c.style,minHeight:"32px"},tagRender:e?ce:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:p=>{let y=fe(a);return y?nn("div",{children:[z("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:we(y.id)}),p]}):p},suffixIcon:e?void 0:a?z("div",{onClick:p=>{p.stopPropagation();let y=fe(a);if(y){let b=document.createElement("div");document.body.appendChild(b);let m=Uo.createRoot(b);m.render(z(ur,{content:G(y),trigger:"click",placement:"right",open:!0,onOpenChange:f=>{f||(m.unmount(),document.body.removeChild(b))},children:z("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:z("span",{className:"ant-select-arrow"})}):z("span",{className:"ant-select-arrow"})})};import{useEffect as lt,useState as We,useCallback as ke,useRef as yr,useMemo as an}from"react";import{Select as Vo,Spin as $o,message as qo,Popover as hr,Card as Go,Typography as Jo,Space as Ko}from"antd";import{debounce as Xo}from"lodash-es";import Yo from"react-dom/client";import Ao from"dexie";var Mo=3600*1e3,mr=class extends Ao{constructor(){super("RoleInfoDB");h(this,"roleCache");this.version(1).stores({roleCache:"id, timestamp"})}},at=new mr,Oo=async()=>{try{let e=await at.roleCache.get("ROLE_ALL");if(e){if(Date.now()-e.timestamp<Mo)return e.data;await at.roleCache.delete("ROLE_ALL")}return null}catch(e){return console.error("\u8BFB\u53D6\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e),null}},Bo=async e=>{try{await at.roleCache.put({id:"ROLE_ALL",data:e,timestamp:Date.now()})}catch(t){console.error("\u5199\u5165\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",t)}},Lo=async()=>{try{await at.roleCache.clear()}catch(e){console.error("\u6E05\u9664\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e)}},gr=async({forceRefresh:e=!1})=>{if(!e){let n=await Oo();if(n)return n}let t=await X.user.role.listRoles();if(t?.code!==200)return null;let r=t.data||[];return await Bo(r),r},sn=async({roleId:e,forceRefresh:t=!1})=>{let r=await gr({forceRefresh:t});return r&&r.find(n=>n.id===e)||null},jo=async({roleId:e,forceRefresh:t=!1})=>(await sn({roleId:e,forceRefresh:t}))?.name||"",pr=async({forceRefresh:e=!1}={})=>{let t=await gr({forceRefresh:e}),r={};return(t||[]).forEach(n=>{r[n.id]=n.name}),r},Fo=async({roleIds:e})=>{let t=await pr();return(e||[]).filter(n=>!!n&&!t[n]).length>0&&(t=await pr({forceRefresh:!0})),t},zo=async()=>{await Lo()},Ho=async()=>{try{let e=await at.roleCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},on={getRoleList:gr,getRoleById:sn,getRoleNameById:jo,getRoleNameMap:pr,getRoleNameMapForIds:Fo,clearRoleCache:zo,getCacheStats:Ho};var fr=class{constructor(){h(this,"cache",new Map);h(this,"defaultExpireTime",300*1e3)}set(t,r,n=this.defaultExpireTime){this.cache.set(t,{data:r,timestamp:Date.now(),expireTime:n})}get(t){let r=this.cache.get(t);return r?Date.now()-r.timestamp>r.expireTime?(this.cache.delete(t),null):r.data:null}clear(){this.cache.clear()}},Dt=new fr;function Wo(){Dt.clear()}import{jsx as H,jsxs as ln}from"react/jsx-runtime";var{Text:fd}=Jo,yd=({multiple:e=!1,allowClear:t=!0,timeout:r=1e4,retryCount:n=3,enableCache:o=!0,excludeRoleIds:s=[],cacheExpireTime:i,value:a,onChange:l,...c})=>{let[u,I]=We(!1),[v,R]=We([]),[N,O]=We(""),[C,S]=We(1),[x,w]=We(!0),[T,P]=We([]),U=yr(null),B=yr([]),k=yr([]);lt(()=>{B.current=v},[v]),lt(()=>{k.current=T},[T]);let j=ke(p=>p.map(y=>{let b=B.current.find(m=>m.id===y);return b||k.current.find(m=>m.id===y)}).filter(y=>y!==void 0),[]),W=ke(p=>{if(!p){P([]),l?.([],[]);return}let y=e?Array.isArray(p)?p:[p]:typeof p=="string"?[p]:p;if(y.length===0){P([]),l?.([],[]);return}let b=j(y);P(b),l?.(y,b)},[j,l,e]);lt(()=>{if(!a||a.length==0){P([]);return}let p=e?Array.isArray(a)?a:[]:typeof a=="string"?[a]:[],y=j(p);if(T.length==y.length){let b=0;for(b=0;b<y.length&&!T.find(m=>m.id==y[b].id?m:null);b++);if(b<y.length)return}P(y)},[a,j,e]);let _=ke(async(p,y=n)=>{try{U.current=new AbortController;let b=U.current.signal,m=new Promise((g,M)=>{setTimeout(()=>{M(new Error("\u8BF7\u6C42\u8D85\u65F6")),U.current?.abort()},r)});return await Promise.race([p(),m])}catch(b){if(y>0&&!(b instanceof Error&&b.name==="AbortError"))return await new Promise(m=>setTimeout(m,1e3)),_(p,y-1);throw b}},[r,n]),D=ke(async(p,y=!1)=>{try{I(!0);let b=`roles_${p}`;if(o&&!p){let g=Dt.get(b);if(g){R(M=>y?[...M,...g]:g),w(!1);return}}let f=(await _(async()=>await on.getRoleList({forceRefresh:!0})||[])).filter(g=>!s.includes(g.id));o&&!p&&Dt.set(b,f,i),R(g=>y?[...g,...f]:f),w(!1)}catch(b){console.error("\u83B7\u53D6\u89D2\u8272\u5217\u8868\u5931\u8D25:",b),qo.error("\u83B7\u53D6\u89D2\u8272\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{I(!1)}},[s,_,o,i]);lt(()=>()=>{U.current?.abort()},[]);let J=an(()=>Xo(p=>{O(p),S(1),D(p,!1)},300),[D]),Y=ke(p=>{let{target:y}=p;if(!y)return;let{scrollTop:b,scrollHeight:m,clientHeight:f}=y;if(m-b<=f*1.5&&!u&&x){let g=C+1;S(g),D(N,!0)}},[u,x,C,N,D]);lt(()=>{D("",!1)},[D]);let G=p=>H(Go,{size:"small",style:{width:280},children:H(Ko,{direction:"vertical",size:"small",style:{width:"100%"},children:H("div",{style:{display:"flex",alignItems:"center",gap:8},children:H("div",{children:H("div",{style:{fontWeight:"bold"},children:p.name})})})})}),ve=p=>{let y=[];return y.push(H("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:p.name},"name")),H("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:y})},Ce=an(()=>v.map(p=>({label:ve(p),value:p.id,user:p})),[v]),ce=ke(p=>{let{value:y,closable:b,onClose:m}=p,f=v.find(g=>g.id===y)||T.find(g=>g.id===y);return f?H(hr,{content:G(f),trigger:"click",placement:"right",children:ln("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[H("span",{style:{marginRight:8},children:f.name}),b&&H("span",{onClick:m,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):H("div",{children:y})},[v,T]),we=ke(p=>{let y=v.find(b=>b.id===p)||T.find(b=>b.id===p);return y?H(hr,{content:G(y),trigger:"click",placement:"right",children:H("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:H("span",{children:y.name})})}):H("div",{children:p})},[v,T]),fe=ke(p=>{if(!p)return null;let y=Array.isArray(p)?p[0]:p;return v.find(b=>b.id===y)||T.find(b=>b.id===y)},[v,T]);return H(Vo,{...c,mode:e?"multiple":void 0,showSearch:!0,loading:u,filterOption:!1,onSearch:J,onPopupScroll:Y,notFoundContent:u?H($o,{size:"small"}):null,allowClear:t,value:e||typeof a=="string"?a:a?.toString(),onChange:W,options:Ce,style:{...c.style,minHeight:"32px"},tagRender:e?ce:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:p=>{let y=fe(a);return y?ln("div",{children:[H("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:we(y.id)}),p]}):p},suffixIcon:e?void 0:a?H("div",{onClick:p=>{p.stopPropagation();let y=fe(a);if(y){let b=document.createElement("div");document.body.appendChild(b);let m=Yo.createRoot(b);m.render(H(hr,{content:G(y),trigger:"click",placement:"right",open:!0,onOpenChange:f=>{f||(m.unmount(),document.body.removeChild(b))},children:H("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:H("span",{className:"ant-select-arrow"})}):H("span",{className:"ant-select-arrow"})})};import{useEffect as Ve,useState as $e,useCallback as Oe,useRef as br,useMemo as vr}from"react";import{Select as Qo,Avatar as Et,Spin as Zo,message as ei,Popover as Cr,Card as ti,Typography as ri,Space as ni}from"antd";import{debounce as si}from"lodash-es";import oi from"react-dom/client";import{jsx as L,jsxs as be}from"react/jsx-runtime";var{Text:ct}=ri,Sd=({multiple:e=!1,userType:t="all",excludeUserIds:r=[],showAvatar:n=!0,showUsername:o=!0,showNickname:s=!0,showPhone:i=!0,searchFields:a=["username","nickname","phone"],pageSize:l=10,allowClear:c=!0,value:u,initialUsers:I,onChange:v,...R})=>{let[N,O]=$e(!1),[C,S]=$e([]),[x,w]=$e(""),[T,P]=$e(1),[U,B]=$e(!0),[k,j]=$e([]),W=br([]),_=br([]),D=br([]),J=Oe(m=>W.current.find(f=>f.id===m)||_.current.find(f=>f.id===m)||(D.current||[]).find(f=>f.id===m),[]);Ve(()=>{D.current=I||[]},[I]);let Y=Oe(async m=>{try{O(!0);let f=await ze.getUserInfos({keywords:m||"",forceRefresh:!1}),g=Array.from(f.values());g=g.filter(E=>E.username!=="admin"),t==="admin"?g=g.filter(E=>E.isAdmin):t==="user"&&(g=g.filter(E=>!E.isAdmin)),m&&(g=g.filter(E=>a.some(K=>{let Tr=E[K];return Tr&&Tr.toLowerCase().includes(m.toLowerCase())}))),r.length>0&&(g=g.filter(E=>!r.includes(E.id))),g.sort((E,K)=>(E.username||"").localeCompare(K.username||""));let M=g;S(E=>[...E,...M]),B(!1)}catch(f){console.error("\u83B7\u53D6\u4EBA\u5458\u5217\u8868\u5931\u8D25:",f),ei.error("\u83B7\u53D6\u4EBA\u5458\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{O(!1)}},[t,r,a]);Ve(()=>{Y(null)},[Y]),Ve(()=>{W.current=C},[C]),Ve(()=>{_.current=k},[k]);let G=Oe(m=>{if(!m||m.length==0){j([]),v?.([],[]);return}let f=Array.isArray(m)?m:[m],g=[];for(let M=0;M<f.length;M++){let E=f[M],K=J(E);K?g.push(K):g.push({id:E,username:E,nickname:"",phone:"",avatar:{avatar_small:""}})}if(k.length==g.length){let M=0;for(M=0;M<g.length&&!k.find(E=>E.id==g[M].id?E:null);M++);if(M<g.length)return}j(g.slice()),v?.(f,g)},[v,k]);Ve(()=>{if(!u||u.length==0){if(!k||k.length==0)return;j([]);return}u.sort();let m=[];k&&(m=k.map(f=>f.id),m.sort()),u.join(",")!=m.join(",")&&G(u)},[u,e,G,k]),Ve(()=>{if(!u||u.length==0)return;let f=u.map(g=>{let M=J(g);return M||{id:g,username:g,nickname:"",phone:"",type:null}}).filter(g=>g!==void 0);j(g=>g.length!==f.length||g.some((M,E)=>M.id!==f[E]?.id||M.username!==f[E]?.username)?f:g)},[C,u,I,J]);let ve=vr(()=>si(m=>{w(m),P(1),Y(m)},300),[Y]),Ce=Oe(m=>{let{target:f}=m;if(!f)return;let{scrollTop:g,scrollHeight:M,clientHeight:E}=f;if(M-g<=E*1.5&&!N&&U){let K=T+1;P(K),Y(x)}},[N,U,T,x,Y]),ce=m=>L(ti,{size:"small",style:{width:280},children:be(ni,{direction:"vertical",size:"small",style:{width:"100%"},children:[be("div",{style:{display:"flex",alignItems:"center",gap:8},children:[L(Et,{src:m?.avatar?.avatar_small,size:40,children:m.nickname?.[0]||m.username?.[0]}),be("div",{children:[L("div",{style:{fontWeight:"bold"},children:m.nickname||m.username}),m.title&&L(ct,{type:"secondary",style:{fontSize:12},children:m.title})]})]}),m.phone&&be("div",{children:[L(ct,{type:"secondary",style:{fontSize:12},children:"\u624B\u673A\u53F7\uFF1A"}),L(ct,{style:{fontSize:12},children:m.phone})]}),m.departmentInfo?.department_names&&be("div",{children:[L(ct,{type:"secondary",style:{fontSize:12},children:"\u6240\u5C5E\u90E8\u95E8\uFF1A"}),L(ct,{style:{fontSize:12},children:m.departmentInfo?.department_names.join("\u3001")})]})]})}),we=vr(()=>m=>{let f=[];return n&&f.push(L(Et,{src:m?.avatar?.avatar_small,size:20,style:{marginRight:8,verticalAlign:"middle",flexShrink:0},children:m.nickname?.[0]||m.username?.[0]},"avatar")),s&&m.nickname&&f.push(L("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:m.nickname},"nickname")),o&&f.push(be("span",{style:{marginLeft:8,color:"rgb(var(--color-gray-400))",verticalAlign:"middle",lineHeight:"20px"},children:["(",m.username,")"]},"username")),i&&m.phone&&f.push(L("span",{style:{marginLeft:8,color:"rgb(var(--color-gray-400))",verticalAlign:"middle",lineHeight:"20px"},children:m.phone},"phone")),L("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:f})},[n,o,s,i]),fe=vr(()=>[...C,...k].filter((g,M,E)=>E.findIndex(K=>K.id===g.id)===M).map(g=>({label:we(g),value:g.id,user:g})),[C,k,we]),p=Oe(m=>{let{value:f,closable:g,onClose:M}=m,E=C.find(K=>K.id===f)||k.find(K=>K.id===f)||(I||[]).find(K=>K.id===f);return E?L(Cr,{content:ce(E),trigger:"click",placement:"right",children:be("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[L(Et,{src:E?.avatar?.avatar_small,size:20,style:{marginRight:8},children:E.nickname?.[0]||E.username?.[0]}),L("span",{style:{marginRight:8},children:E.nickname||E.username}),g&&L("span",{onClick:M,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):L("div",{children:f})},[C,k,I]),y=Oe(m=>{let f=C.find(g=>g.id===m)||k.find(g=>g.id===m)||(I||[]).find(g=>g.id===m);return f?L(Cr,{content:ce(f),trigger:"click",placement:"right",children:be("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:[L(Et,{src:f?.avatar?.avatar_small,size:20,style:{marginRight:8},children:f.nickname?.[0]||f.username?.[0]}),L("span",{children:f.nickname||f.username})]})}):L("div",{children:m})},[C,k,I]),b=Oe(m=>{if(!m||m.length==0)return null;let f=m[0];return C.find(g=>g.id===f)||k.find(g=>g.id===f)||(I||[]).find(g=>g.id===f)},[C,k,I]);return L(Qo,{...R,mode:e?"multiple":void 0,showSearch:!0,loading:N,filterOption:!1,onSearch:ve,onPopupScroll:Ce,notFoundContent:N?L(Zo,{size:"small"}):null,allowClear:c,value:u,onChange:G,options:fe,style:{...R.style,minHeight:"32px"},tagRender:e?p:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:m=>{let f=b(u);return f?be("div",{children:[L("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:y(f.id)}),m]}):m},suffixIcon:e?void 0:u?L("div",{onClick:m=>{m.stopPropagation();let f=b(u);if(f){let g=document.createElement("div");document.body.appendChild(g);let M=oi.createRoot(g);M.render(L(Cr,{content:ce(f),trigger:"click",placement:"right",open:!0,onOpenChange:E=>{E||(M.unmount(),document.body.removeChild(g))},children:L("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:L("span",{className:"ant-select-arrow"})}):L("span",{className:"ant-select-arrow"})})};import{useEffect as ii,useRef as ai,useState as un}from"react";import{Upload as dn,Button as ut,Modal as li,Image as ci,Space as di,message as ui,Progress as mi}from"antd";import{UploadOutlined as pi,DownloadOutlined as mn,EyeOutlined as gi,FilePdfFilled as fi,FileExcelFilled as yi,FileWordFilled as hi,FileTextFilled as bi,FileUnknownFilled as vi}from"@ant-design/icons";import*as qe from"febs-browser";function cn(e,t,r){r.method=r.method||"POST",r.headers=r.headers||{},r.timeout=r.timeout||5e3,r.withCredentials=r.withCredentials||!0,r.crossDomain=r.crossDomain||!0,r.sliceOffset=r.sliceOffset||0,r.sliceLength=r.sliceLength||-1;let n={success:r.success,method:r.method||"POST",url:r.url,mode:r.crossDomain!=!0?"same-origin":"cors",timeout:r.timeout||5e3};r=qe.utils.mergeMap(n,r||{});let o=qe.$(e);if(o.attr("enctype")&&o.attr("enctype").toLowerCase()==="multipart/form-data"){let i=new FormData,a=File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice,l=t.name,c=l.lastIndexOf("/");c>=0&&(l=l.substr(c+1)),c=l.lastIndexOf("\\"),c>=0&&(l=l.substr(c+1));let u=r.sliceLength||-1;u==-1&&(u=t.size-(r.sliceOffset||0));let I=a.call(t,r.sliceOffset,(r.sliceOffset||0)+u);i.append("file",I,l),r.data=i}else throw new Error("only support multipart/form-data");let s;return r.headers?s=r.headers:s={},s["Content-Type"]=!1,qe.net.ajax({url:r.url,type:r.method,headers:s,processData:!1,data:r.data,timeout:r.timeout,withCredentials:r.withCredentials,success:function(i){r.success&&r.success(i)},error:function(i,a,l){r.error&&r.error(l)},complete:r.complete,progress:r.progress})}var Ut=class Ut{static uploadSingle(t,r,n,o,s){new FormData().append("file",t);let a=document.createElement("form");a.setAttribute("enctype","multipart/form-data");let l={headers:{}};return l.headers.set=(c,u)=>{l.headers[c]=u},ye.requestHandleSid(l),delete l.headers.set,cn(a,t,{url:Ut.UPLOAD_SINGLE_URL+"?size="+t.size+"&crc32="+r,success:(c=>{c=JSON.parse(c),c.code===200?Q.success("\u6587\u4EF6\u4E0A\u4F20\u6210\u529F"):Q.error(c.message||"\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"),s&&s(c)}),error:(c=>{console.error("File upload error:",c),Q.error("\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"),o&&o(c)}),progress:n||(c=>{console.log(`\u4E0A\u4F20\u8FDB\u5EA6: ${c}%`)}),complete:c=>{},data:"",method:"POST",headers:l.headers,timeout:Number(import.meta.env.VITE_API_UPLOAD_TIMEOUT)||5e3,withCredentials:!0,crossDomain:!0,sliceOffset:0,sliceLength:-1})}static copyFromServer(t){return d.post(import.meta.env.VITE_API_BASE+"/api/fs/copy",{sourcePath:t},null)}};h(Ut,"UPLOAD_SINGLE_URL",import.meta.env.VITE_API_BASE+"/api/fs/upload");var dt=Ut;import*as pn from"febs-browser";import{jsx as F,jsxs as mt}from"react/jsx-runtime";var Hd=({fileList:e,onChange:t,onFinish:r,cancel:n,btnText:o="\u4E0A\u4F20\u6587\u4EF6",maxCount:s=5,disabled:i=!1,multiple:a=!0,accept:l=void 0})=>{let[c,u]=un(void 0),I=ai(e);ii(()=>{I.current=e},[e]);let v=({fileList:x})=>{t?.(x)},R=x=>{t?.(I.current.filter(w=>w.uid!==x.uid))},N=x=>{let w=x.size/1024/1024<100;return w||ui.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7100MB"),w||dn.LIST_IGNORE},O=async x=>{let{file:w,onSuccess:T,onError:P,onProgress:U}=x;try{w.status="uploading",w.percent=0,U({percent:0}),u(0),pn.crypt.crc32_file(w,B=>{if(B==0){w.status="error",P("calc crc32 error");return}let k=dt.uploadSingle(w,B,j=>{let W=Math.floor(j*100);U({percent:W}),w.percent=W,u(W)},j=>{u(void 0),P(j)},j=>{w.status="done",w.percent=100,u(void 0),T("ok"),r&&r([w],j).then(()=>{}).catch(()=>{})});w.cancel=()=>{k.abort(),w.status="error",w.percent=0,u(void 0),P(new Error("\u4E0A\u4F20\u5DF2\u53D6\u6D88")),R(w)}})}catch(B){w.status="error",u(void 0),P(B)}},C=c!==void 0&&c<100;return F(dn,{fileList:e,onChange:v,beforeUpload:N,customRequest:O,multiple:a,maxCount:s,disabled:i,itemRender:(x,w,T,P)=>C?mt("div",{className:"flex items-center justify-between w-full mt-2 rounded border border-blue-100 bg-blue-50 px-3 py-2",children:[F("span",{className:"mr-3 min-w-0 max-w-[120px] flex-1 truncate text-sm text-gray-700",children:w.name}),F(mi,{className:"w-[60px]",percent:Math.round(w.percent||0),size:"small",status:"active",showInfo:!0}),F(ut,{className:"ml-3",size:"small",onClick:()=>{n?n(w):w.cancel?.(),R(w)},danger:!0,children:"\u53D6\u6D88"})]}):null,accept:l,showUploadList:!0,children:!C&&F(ut,{icon:F(pi,{}),disabled:i||C,title:a?`\u4E0A\u4F20\u6587\u4EF6\uFF08\u6700\u591A\u652F\u6301${s}\u4E2A\u6587\u4EF6\uFF0C\u5355\u4E2A\u6587\u4EF6\u4E0D\u8D85\u8FC7100MB\uFF09`:"\u4E0A\u4F20\u6587\u4EF6\uFF08\u5355\u4E2A\u6587\u4EF6\u4E0D\u8D85\u8FC7100MB\uFF09",children:C?mt("span",{className:"inline-block w-[85px]",children:["\u4E0A\u4F20\u4E2D ",c,"%"]}):o})})},Wd=({files:e=[],onPreview:t,onDownload:r})=>e.length===0?null:F("div",{className:"p-4 bg-gray-50 rounded",children:e.map((n,o)=>mt("div",{className:"flex items-center mb-2",children:[gn(n),F("span",{className:"mr-2",children:n.name}),mt(di,{children:[t&&F(ut,{type:"link",size:"small",icon:F(gi,{}),onClick:()=>t(n),children:"\u67E5\u770B"}),r&&F(ut,{type:"link",size:"small",icon:F(mn,{}),onClick:()=>r(n),children:"\u4E0B\u8F7D"})]})]},n.uid||o))}),gn=e=>{let t=e.type||"";return t.includes("pdf")?F(fi,{className:"mr-2 text-red-500"}):t.includes("excel")||t.includes("spreadsheet")||e.name.endsWith(".xlsx")||e.name.endsWith(".xls")?F(yi,{className:"mr-2 text-green-500"}):t.includes("word")||t.includes("document")||e.name.endsWith(".docx")||e.name.endsWith(".doc")?F(hi,{className:"mr-2 text-blue-500"}):t.includes("image")?F(bi,{className:"mr-2 text-purple-500"}):F(vi,{className:"mr-2 text-gray-500"})},Vd=({visible:e,file:t,onClose:r,onDownload:n})=>{if(!t)return null;let[o,s]=un(""),i=t.name||"",a=t.type?.startsWith("image/");return a&&xt(t,l=>{s(l||"")}),F(li,{open:e,title:i,footer:null,onCancel:r,width:800,children:a?F(ci,{alt:i,style:{width:"100%"},src:o}):mt("div",{className:"text-center p-8",children:[F("div",{className:"text-6xl mb-4",children:gn(t)}),F("p",{className:"mb-4",children:i}),F("p",{className:"text-gray-500 mb-4",children:"\u8BE5\u6587\u4EF6\u7C7B\u578B\u65E0\u6CD5\u76F4\u63A5\u9884\u89C8"}),n&&F(ut,{type:"primary",icon:F(mn,{}),onClick:()=>n(t),children:"\u4E0B\u8F7D\u6587\u4EF6\u67E5\u770B"})]})})};import Ci from"dexie";var wi=1440*60*1e3,wr=class extends Ci{constructor(){super("DepartmentInfoDB");h(this,"departmentCache");this.version(1).stores({departmentCache:"id, timestamp"})}},pt=new wr,At=null,_i=async()=>{try{let e=await pt.departmentCache.get("DEPARTMENT_ALL");if(e){if(Date.now()-e.timestamp<wi)return e.data;await pt.departmentCache.delete("DEPARTMENT_ALL")}return null}catch(e){return console.error("\u8BFB\u53D6\u90E8\u95E8\u7F13\u5B58\u5931\u8D25:",e),null}},Ii=async e=>{try{await pt.departmentCache.put({id:"DEPARTMENT_ALL",data:e,timestamp:Date.now()})}catch(t){console.error("\u5199\u5165\u90E8\u95E8\u7F13\u5B58\u5931\u8D25:",t)}},Ti=async()=>{try{await pt.departmentCache.clear()}catch(e){console.error("\u6E05\u9664\u90E8\u95E8\u7F13\u5B58\u5931\u8D25:",e)}},fn=(e,t)=>e.map(r=>({...r,company_id:r.company_id||t.id,company:t,children:r.children?fn(r.children,t):void 0})),Ri=async()=>{let e=await X.user.role.listCompanies();if(e.code!==200)return null;let t=(e.data||[]).map(n=>({id:n.id,name:n.name,descs:n.descs,parent_id:n.parent_id,admin_id:n.admin_id,is_spv_company:n.is_spv_company,created_at:n.created_at}));if(t.length===0)return[];let r=await Promise.all(t.map(async n=>{let o=await X.user.role.listCompanyDepartments({company_id:n.id});return o.code!==200?null:fn(o.data||[],n)}));return r.some(n=>n===null)?null:r.flatMap(n=>n||[])},yn=async({forceRefresh:e=!1})=>{if(!e){let r=await _i();if(r)return r}At||(At=Ri().then(async r=>(r&&await Ii(r),r)).finally(()=>{At=null}));let t=await At;return t||null},hn=async({forceRefresh:e=!1})=>{let t=await yn({forceRefresh:e});if(!t)return null;let r=n=>{let o=[];for(let s of n){let{children:i,...a}=s;o.push(a),s.children&&s.children.length>0&&(o=o.concat(r(s.children)))}return o};return r(t)},bn=async({deptId:e,forceRefresh:t=!1})=>{let r=await hn({forceRefresh:t});return r&&r.find(n=>n.id===e)||null},Pi=async({deptId:e,forceRefresh:t=!1})=>(await bn({deptId:e,forceRefresh:t}))?.name||"",Si=async()=>{await Ti()},xi=async()=>{try{let e=await pt.departmentCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},yu={getDepartmentList:yn,getFlatDepartmentList:hn,getDepartmentById:bn,getDepartmentNameById:Pi,clearDepartmentCache:Si,getCacheStats:xi};var ki="flyfish-file-viewer-cache",Ni=async e=>{let t=indexedDB;if(typeof t.databases!="function")return!0;try{return(await t.databases()).some(n=>n.name===e)}catch{return!0}},Di=e=>new Promise(t=>{let r=indexedDB.open(e);r.onsuccess=()=>t(r.result),r.onerror=()=>t(null),r.onblocked=()=>t(null)}),Ei=async e=>{if(!(typeof indexedDB>"u"))try{if(!await Ni(e))return;let t=await Di(e);if(!t)return;let r=Array.from(t.objectStoreNames);r.length>0&&await new Promise((n,o)=>{let s=t.transaction(r,"readwrite");r.forEach(i=>{s.objectStore(i).clear()}),s.oncomplete=()=>n(),s.onerror=()=>o(s.error),s.onabort=()=>o(s.error)}),t.close()}catch(t){console.error(`\u6E05\u9664 IndexedDB \u7F13\u5B58\u5931\u8D25\uFF08${e}\uFF09:`,t)}},vu=async()=>{await Ei(ki)};import Ui from"dexie";var Ru="approver:approvalinvoice:getInvoiceList",Pu="project:projectfile:downloadFolderPermission",Su="crm:customer:createCustomer",xu="crm:customer:updateCustomer",ku="crm:customer:deleteCustomer",Nu="crm:customer:viewContact",Du="crm:customer:transferCustomer",Eu="crm:file:viewFile",Uu="crm:file:manageFile",Ai=600*1e3,_r=class extends Ui{constructor(){super("PermissionInfoDB");h(this,"permissionCache");this.version(1).stores({permissionCache:"id, timestamp"})}},Ge=new _r,Mi=async e=>{try{let t=await Ge.permissionCache.get(`PERMISSION_${e}`);if(t){if(Date.now()-t.timestamp<Ai)return t.data;await Ge.permissionCache.delete(`PERMISSION_${e}`)}return null}catch(t){return console.error("\u8BFB\u53D6\u6743\u9650\u7F13\u5B58\u5931\u8D25:",t),null}},Oi=async(e,t)=>{try{await Ge.permissionCache.put({id:`PERMISSION_${e}`,data:t,timestamp:Date.now()})}catch(r){console.error("\u5199\u5165\u6743\u9650\u7F13\u5B58\u5931\u8D25:",r)}},Bi=async e=>{try{e?await Ge.permissionCache.delete(`PERMISSION_${e}`):await Ge.permissionCache.clear()}catch(t){console.error("\u6E05\u9664\u6743\u9650\u7F13\u5B58\u5931\u8D25:",t)}},Mt=async({userId:e,forceRefresh:t=!1})=>{let r=e?{id:e}:await ze.getUserInfo({});if(!r)return null;let n=r.id;if(!t){let i=await Mi(n);if(i)return i}let o=await X.user.role.listUserPermissions({user_id:n});if(o?.code!==200)return null;let s=o.data||[];return await Oi(n,s),s},Li=async({permission:e,userId:t,forceRefresh:r=!1})=>{let n=await Mt({userId:t,forceRefresh:r});return n?n.some(o=>o.permission===e):!1},ji=async({permissions:e,userId:t,forceRefresh:r=!1,allRequired:n=!0})=>{let o=await Mt({userId:t,forceRefresh:r});if(!o)return!1;let s=new Set(o.map(i=>i.permission));return n?e.every(i=>s.has(i)):e.some(i=>s.has(i))},Fi=async({permission:e,userId:t,forceRefresh:r=!1})=>{let n=await Mt({userId:t,forceRefresh:r});return n&&n.find(s=>s.permission===e)?.descs||""},zi=async e=>{await Bi(e)},Hi=async()=>{try{let e=await Ge.permissionCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u6743\u9650\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},Au={getUserPermissions:Mt,hasPermission:Li,hasPermissions:ji,getPermissionDesc:Fi,clearPermissionCache:zi,getCacheStats:Hi};import Wi from"dexie";var Ir=class extends Wi{constructor(){super("ViewToggleDB");h(this,"viewModeCache");this.version(1).stores({viewModeCache:"pageKey, timestamp"})}},gt=new Ir,Vi=async e=>{try{let t=await gt.viewModeCache.get(e);return t?t.viewMode:null}catch(t){return console.error("\u8BFB\u53D6\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",t),null}},$i=async(e,t)=>{try{await gt.viewModeCache.put({pageKey:e,viewMode:t,timestamp:Date.now()})}catch(r){console.error("\u5199\u5165\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",r)}},qi=async e=>{try{await gt.viewModeCache.delete(e)}catch(t){console.error("\u6E05\u9664\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",t)}},Gi=async()=>{try{await gt.viewModeCache.clear()}catch(e){console.error("\u6E05\u9664\u6240\u6709\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",e)}},Ji=async e=>await Vi(e),Ki=async(e,t)=>{await $i(e,t)},Xi=async e=>{await qi(e)},Yi=async()=>{await Gi()},Qi=async()=>{try{return await gt.viewModeCache.toArray()}catch(e){return console.error("\u83B7\u53D6\u6240\u6709\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",e),[]}},ju={getViewMode:Ji,setViewMode:Ki,clearViewModeCache:Xi,clearAllViewModeCache:Yi,getAllCachedViewModes:Qi};var vn={project:"\u9879\u76EE\u52A8\u6001",approval:"\u5BA1\u6279\u52A8\u6001",knowledge:"\u77E5\u8BC6\u5E93",todo:"\u5F85\u529E\u4EFB\u52A1",crm:"\u5BA2\u6237\u7BA1\u7406"},Zi={file_add:"\u6587\u4EF6\u65B0\u589E",file_update:"\u6587\u4EF6\u66F4\u65B0",file_delete:"\u6587\u4EF6\u5220\u9664",contract_add:"\u5408\u540C\u65B0\u589E",contract_delete:"\u5408\u540C\u5220\u9664",contract_update:"\u5408\u540C\u66F4\u65B0",detail:"\u8BE6\u60C5\u66F4\u65B0",member_add:"\u6210\u5458\u52A0\u5165",member_remove:"\u6210\u5458\u79FB\u9664",member_role_change:"\u89D2\u8272\u53D8\u66F4",file_download:"\u6587\u4EF6\u4E0B\u8F7D"},ea={submit:"\u5BA1\u6279\u63D0\u4EA4",approve:"\u5BA1\u6279\u901A\u8FC7",reject:"\u5BA1\u6279\u9A73\u56DE",cancel:"\u5BA1\u6279\u64A4\u9500",deal:"\u4EA7\u7269\u66F4\u65B0"},ta={kb_new:"\u65B0\u589E\u77E5\u8BC6"},ra={task_assign:"\u4EFB\u52A1\u6307\u6D3E",task_remind:"\u5230\u671F\u63D0\u9192"},na={customer_transfer_in:"\u5BA2\u6237\u79FB\u4EA4\uFF08\u63A5\u6536\uFF09",customer_transfer_out:"\u5BA2\u6237\u79FB\u4EA4\uFF08\u79FB\u4EA4\u51FA\uFF09"},sa={file_add:"files",file_update:"files",file_delete:"files",contract_add:"contracts",contract_update:"contracts",contract_delete:"contracts",detail:"detail",member_add:"members",member_remove:"members",member_role_change:"members"},Cn=class e{static buildContent(t,r,n,o){return JSON.stringify({type:t,bizType:r,id:n||"",text:o||""})}static parseContent(t){if(!t)return null;try{let r=JSON.parse(t);if(r&&typeof r.type=="string"&&typeof r.bizType=="string"&&typeof r.id=="string"){let n={type:r.type,bizType:r.bizType,id:r.id,text:typeof r.text=="string"?r.text:""};return typeof r.url=="string"&&(n.url=r.url),typeof r.fileName=="string"&&(n.fileName=r.fileName),typeof r.jobId=="string"&&(n.jobId=r.jobId),typeof r.expireAt=="number"&&(n.expireAt=r.expireAt),n}return null}catch{return null}}static isMessageType(t){return Object.prototype.hasOwnProperty.call(vn,t)}static getTypeLabel(t){return vn[t]||"\u7CFB\u7EDF\u6D88\u606F"}static getBizTypeLabel(t,r){switch(t){case"project":return Zi[r]||"";case"approval":return ea[r]||"";case"knowledge":return ta[r]||"";case"todo":return ra[r]||"";case"crm":return na[r]||"";default:return""}}static getDisplayText(t){return t?t.text||e.getBizTypeLabel(t.type,t.bizType):""}static getJumpRoute(t){if(!t||!t.id)return null;let r=encodeURIComponent(t.id);switch(t.type){case"project":{if(t.bizType==="file_download")return null;let n=sa[t.bizType];return`/project?id=${r}${n?`&tab=${n}`:""}`}case"approval":return`/approval?instanceId=${r}`;case"knowledge":return`/knowledge?id=${r}`;case"todo":return`/todo?todoId=${r}`;case"crm":return`/crm?id=${r}`;default:return null}}};async function Wu(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{await navigator.clipboard.writeText(e);return}catch{}if(!oa(e))throw new Error("\u590D\u5236\u5230\u526A\u8D34\u677F\u5931\u8D25")}function oa(e){let t=document.createElement("textarea");t.value=e,t.setAttribute("contenteditable","true"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="1px",t.style.height="1px",t.style.padding="0",t.style.border="none",t.style.outline="none",t.style.boxShadow="none",t.style.background="transparent",t.style.opacity="0",document.body.appendChild(t);let r=/ipad|iphone|ipod/i.test(navigator.userAgent),n=!1;try{if(r){let o=document.getSelection(),s=document.createRange();s.selectNodeContents(t),o?.removeAllRanges(),o?.addRange(s),t.setSelectionRange(0,e.length)}else t.focus(),t.select(),t.setSelectionRange(0,e.length);n=document.execCommand("copy")}catch{n=!1}finally{document.body.removeChild(t)}return n}var wn=(import.meta.env.VITE_COMPANY_EMAIL_DOMAINS||"").split(",").map(e=>e.trim().toLowerCase().replace(/^@/,"")).filter(Boolean),ia=e=>(e||"").trim().toLowerCase(),$u=()=>wn.join("\u3001"),qu=e=>{let t=ia(e),r=t.split("@")[1];return wn.some(n=>n.includes("@")?n===t:!!(r&&n===r))};function Ju(){let e=function(){function r(n){(""+n/n).length!==1||n%20===0?function(){}.constructor("debugger")():function(){}.constructor("debugger")(),r(++n)}try{r(0)}catch{}},t=function(){(window.outerWidth-window.innerWidth>160||window.outerHeight-window.innerHeight>360)&&(window.close(),window.location="about:blank")};setInterval(function(){__debug||(t(),e())},5e3),__debug||(t(),e(),window.onkeydown=window.onkeyup=window.onkeypress=function(r){r.keyCode===123&&(r.preventDefault(),window.event.returnValue=!1)})}import ee from"keymaster";var Yu={on:function(e,t){return ee(e,t),this},off:function(e){return ee.unbind(e),this},isPressed(e){return ee.isPressed(e)},get shift(){return ee.shift},get"\u21E7"(){return ee["\u21E7"]},get alt(){return ee.alt},get option(){return ee.option},get"\u2325"(){return ee["\u2325"]},get ctrl(){return ee.ctrl},get control(){return ee.control},get"\u2303"(){return ee["\u2303"]},get command(){return ee.command},get"\u2318"(){return ee["\u2318"]},get pressedKeyCodes(){return ee.getPressedKeyCodes()}};(function(){if(typeof Promise>"u"||typeof Promise.allSettled=="function")return;let t=function(r){let n=Array.isArray(r)?r:Array.from(r);return n.length===0?Promise.resolve([]):new Promise(o=>{let s=new Array(n.length),i=n.length,a=()=>{i-=1,i===0&&o(s)};n.forEach((l,c)=>{Promise.resolve(l).then(u=>{s[c]={status:"fulfilled",value:u},a()},u=>{s[c]={status:"rejected",reason:u},a()})})})};try{Object.defineProperty(Promise,"allSettled",{configurable:!0,writable:!0,value:t})}catch{try{Promise.allSettled=t}catch{}}try{typeof Promise.allSettled!="function"&&(Promise.allSettled=t)}catch{}})();function Zu(){try{if(typeof Promise>"u"||typeof Promise.allSettled=="function")return;let e=t=>{let r=Array.isArray(t)?t:Array.from(t);return r.length===0?Promise.resolve([]):new Promise(n=>{let o=new Array(r.length),s=r.length,i=()=>{--s===0&&n(o)};r.forEach((a,l)=>{Promise.resolve(a).then(c=>{o[l]={status:"fulfilled",value:c},i()},c=>{o[l]={status:"rejected",reason:c},i()})})})};try{Object.defineProperty(Promise,"allSettled",{configurable:!0,writable:!0,value:e})}catch{}if(typeof Promise.allSettled!="function")try{Promise.allSettled=e}catch{}}catch{}}function em(){try{_n()}catch{}}var Ot=class{constructor({highWaterMark:t}){h(this,"highWaterMark");this.highWaterMark=t}size(t){return t?.byteLength??0}},Bt=class{constructor({highWaterMark:t}){h(this,"highWaterMark");this.highWaterMark=t}size(){return 1}},ft=class{constructor(t){h(this,"desiredSize",0);h(this,"byobRequest",null);h(this,"_stream");this._stream=t}enqueue(t){this._stream._push(t)}close(){this._stream._close()}error(t){this._stream._error(t??new Error("ReadableStream errored"))}get desiredSizeInternal(){return this._stream._chunks?1:0}},yt=class{constructor(t){h(this,"byobRequest",null);h(this,"desiredSize",0);h(this,"_stream");this._stream=t}close(){this._stream._close()}enqueue(t){this._stream._push(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}error(t){this._stream._error(t??new Error("ReadableByteStream errored"))}},ht=class{constructor(t){h(this,"closed");h(this,"_stream");h(this,"_resolveClosed");this._stream=t,this._stream._reader=this,this.closed=new Promise(r=>{this._resolveClosed=r})}read(){return this._stream._read()}releaseLock(){this._stream._reader===this&&(this._stream._reader=null)}cancel(t){return this._stream.cancel(t)}_onClosed(){this._resolveClosed(void 0)}},bt=class{constructor(t){h(this,"closed");h(this,"_stream");h(this,"_resolveClosed");this._stream=t,this._stream._byobReader=this,this.closed=new Promise(r=>{this._resolveClosed=r})}read(t){return this._stream._readInto(t)}releaseLock(){this._stream._byobReader===this&&(this._stream._byobReader=null)}cancel(t){return this._stream.cancel(t)}_onClosed(){this._resolveClosed(void 0)}},Ne=class e{constructor(t,r){h(this,"locked",!1);h(this,"_chunks",[]);h(this,"_waiting",null);h(this,"_byobWaiting",null);h(this,"_reader",null);h(this,"_byobReader",null);h(this,"_state",{closed:!1,errored:!1,error:void 0});h(this,"_source",null);h(this,"_cancelCallback",null);h(this,"_controller",null);h(this,"_pulling",!1);h(this,"_pullScheduled",!1);h(this,"_type");h(this,"_autoAllocateChunkSize");this._source=t??null,this._cancelCallback=t?.cancel??null,t&&t.type==="bytes"?(this._type="bytes",this._autoAllocateChunkSize=t.autoAllocateChunkSize,this._controller=new yt(this)):this._controller=new ft(this);let n=t?.start;typeof n=="function"&&Promise.resolve(n.call(t,this._controller)).catch(o=>{this._error(o)})}getReader(){if(arguments[0]?.mode==="byob"){if(this._byobReader)throw new TypeError("ReadableStream is locked");return new bt(this)}if(this._reader)throw new TypeError("ReadableStream is locked");return new ht(this)}tee(){let t=this._branch(),r=this._branch();return[t,r]}pipeThrough(t,r){return this.pipeTo(t.writable,r),t.readable}async pipeTo(t,r){let n=!!r?.preventClose,o=!!r?.preventAbort,s=!!r?.preventCancel,i=t&&typeof t.getWriter=="function"?t.getWriter():null;try{let a=this.getReader();try{for(;;){let{done:l,value:c}=await a.read();if(l)break;i&&typeof i.ready<"u"&&await i.ready,i&&typeof i.write=="function"?await i.write(c):t&&typeof t.write=="function"&&t.write(c)}}finally{try{a.releaseLock()}catch{}}n||(i&&typeof i.close=="function"?await i.close():t&&typeof t.close=="function"&&t.close())}catch(a){if(!o)try{i&&typeof i.abort=="function"?await i.abort(a):t&&typeof t.abort=="function"&&t.abort(a)}catch{}if(!s)try{await this.cancel(a)}catch{}throw a}finally{if(i&&typeof i.releaseLock=="function")try{i.releaseLock()}catch{}}}async cancel(t){if(!(this._state.closed||this._state.errored)){this._state.closed=!0;try{this._cancelCallback&&await this._cancelCallback(t)}finally{this._finalizeClose()}}}_branch(){let t=this;return new e({start:async n=>{let o=t.getReader();try{for(;;){let{done:s,value:i}=await o.read();if(s)break;n.enqueue(i)}n.close()}catch(s){n.error(s)}finally{try{o.releaseLock()}catch{}}}})}_push(t){if(!(this._state.closed||this._state.errored)){if(this._waiting){let r=this._waiting;this._waiting=null,r({done:!1,value:t}),this._schedulePullIfNeeded();return}if(this._byobWaiting){let r=this._byobWaiting;this._byobWaiting=null,r(this._buildByobResult(t)),this._schedulePullIfNeeded();return}this._chunks.push({type:"chunk",value:t}),this._schedulePullIfNeeded()}}_close(){if(!(this._state.closed||this._state.errored)){if(this._state.closed=!0,this._chunks.push({type:"close"}),this._waiting){let t=this._waiting;this._waiting=null,t({done:!0,value:void 0})}this._finalizeClose()}}_error(t){if(!(this._state.closed||this._state.errored)){if(this._state.errored=!0,this._state.error=t,this._chunks.push({type:"error",error:t}),this._waiting){let r=this._waiting;this._waiting=null,r(Promise.reject(t))}this._finalizeClose()}}_finalizeClose(){this._reader&&this._reader._onClosed(),this._byobReader&&this._byobReader._onClosed()}_schedulePullIfNeeded(){if(this._pullScheduled)return;let t=this._source?.pull;typeof t=="function"&&(this._state.closed||this._state.errored||this._chunks.length>0||this._waiting||this._byobWaiting||(this._pullScheduled=!0,queueMicrotask(()=>{this._pullScheduled=!1,!this._pulling&&(this._state.closed||this._state.errored||(this._pulling=!0,Promise.resolve(t.call(this._source,this._controller)).catch(r=>this._error(r)).finally(()=>{this._pulling=!1})))})))}_read(){if(this._state.errored)return Promise.reject(this._state.error);if(this._state.closed)return Promise.resolve({done:!0,value:void 0});for(;this._chunks.length;){let t=this._chunks.shift();if(t.type==="chunk")return this._schedulePullIfNeeded(),Promise.resolve({done:!1,value:t.value});if(t.type==="close")return Promise.resolve({done:!0,value:void 0});if(t.type==="error")return Promise.reject(t.error)}return new Promise((t,r)=>{this._waiting=n=>{this._state.errored?r(this._state.error):t(n)},this._schedulePullIfNeeded()})}_readInto(t){if(this._state.errored)return Promise.reject(this._state.error);if(this._state.closed)return Promise.resolve({done:!0,value:t});let r=0,n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);for(;this._chunks.length&&r<n.byteLength;){let o=this._chunks[0];if(o.type==="chunk"){let s=this._toUint8(o.value),i=Math.min(s.length,n.byteLength-r);n.set(s.subarray(0,i),r),r+=i,i<s.length?this._chunks[0].value=s.subarray(i):this._chunks.shift()}else if(o.type==="close"){this._chunks.shift();let s=r===0?t:new DataView(t.buffer,t.byteOffset,r);return Promise.resolve({done:!0,value:r?s:t})}else if(o.type==="error")return this._chunks.shift(),Promise.reject(o.error)}if(r>0){let o=new DataView(t.buffer,t.byteOffset,r);return this._schedulePullIfNeeded(),Promise.resolve({done:!1,value:o})}return new Promise((o,s)=>{this._byobWaiting=i=>{this._state.errored?s(this._state.error):o(i)},this._schedulePullIfNeeded()})}_buildByobResult(t){let r=this._toUint8(t),n=new Uint8Array(r.length);return n.set(r),{done:!1,value:n}}_toUint8(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?new TextEncoder().encode(t):Array.isArray(t)?new Uint8Array(t):new Uint8Array(0)}},vt=class{constructor(t){h(this,"closed");h(this,"ready");h(this,"desiredSize",1);h(this,"_stream");h(this,"_resolveClosed");h(this,"_resolveReady");this._stream=t,this._stream._writer=this,this.closed=new Promise(r=>{this._resolveClosed=r}),this.ready=new Promise(r=>{this._resolveReady=r}),Promise.resolve().then(()=>this._resolveReady(void 0))}abort(t){return this._stream.abort(t)}close(){return this._stream.close()}releaseLock(){this._stream._writer===this&&(this._stream._writer=null)}write(t){return this._stream.write(t)}_onClosed(){this._resolveClosed(void 0)}},Ct=class{constructor(t,r){h(this,"locked",!1);h(this,"_writer",null);h(this,"_state",{closed:!1,errored:!1,error:void 0});h(this,"_sink",{});h(this,"_controller",null);this._sink=t??{};let n=this._sink.start;this._controller={error:o=>this._error(o??new Error("WritableStream errored")),signal:{aborted:!1,reason:void 0}},typeof n=="function"&&Promise.resolve(n.call(this._sink,this._controller)).catch(o=>this._error(o))}getWriter(){if(this._writer)throw new TypeError("WritableStream is locked");return new vt(this)}async abort(t){if(this._state.closed||this._state.errored)return;this._controller.signal.aborted=!0,this._controller.signal.reason=t,this._state.errored=!0,this._state.error=t;let r=this._sink.abort;typeof r=="function"&&await r.call(this._sink,t),this._finalize()}async close(){if(this._state.closed||this._state.errored)return;this._state.closed=!0;let t=this._sink.close;typeof t=="function"&&await t.call(this._sink),this._finalize()}async write(t){if(this._state.errored)throw this._state.error;if(this._state.closed)throw new TypeError("WritableStream is closed");let r=this._sink.write;if(typeof r=="function"){let n=r.call(this._sink,t,this._controller);await Promise.resolve(n)}}_finalize(){this._writer&&this._writer._onClosed()}_error(t){this._state.closed||this._state.errored||(this._state.errored=!0,this._state.error=t,this._finalize())}},Je=class{constructor(t,r,n){h(this,"readable");h(this,"writable");let o;this.readable=new Ne({start:s=>{o=s;let i=t?.start;typeof i=="function"&&Promise.resolve(i.call(t,o)).catch(a=>o.error(a))}}),this.writable=new Ct({write:async(s,i)=>{let a=t?.transform;typeof a=="function"?await Promise.resolve(a.call(t,s,o)):o.enqueue(s)},close:async()=>{let s=t?.flush;typeof s=="function"&&await Promise.resolve(s.call(t,o)),o.close()},abort:async s=>{o.error(s);let i=t?.abort;typeof i=="function"&&await i.call(t,s)}})}},Lt=class{constructor(t,r){h(this,"readable");h(this,"writable");h(this,"encoding");h(this,"fatal");h(this,"ignoreBOM");let n=new TextDecoder(t,r);this.encoding=n.encoding,this.fatal=n.fatal,this.ignoreBOM=n.ignoreBOM;let o=new Je({transform(s,i){i.enqueue(n.decode(s,{stream:!0}))},flush(s){let i=n.decode();i&&s.enqueue(i)}});this.readable=o.readable,this.writable=o.writable}},jt=class{constructor(){h(this,"readable");h(this,"writable");h(this,"encoding","utf-8");let t=new TextEncoder,r=new Je({transform(n,o){o.enqueue(t.encode(n))}});this.readable=r.readable,this.writable=r.writable}};function te(e,t){let r=globalThis;try{Object.defineProperty(r,e,{configurable:!0,writable:!0,enumerable:!1,value:t})}catch{try{r[e]=t}catch{}}try{r[e]!==t&&(r[e]=t)}catch{}}function oe(e,t){let r=globalThis;try{typeof r[e]>"u"&&te(e,t)}catch{}}function aa(){try{let e=globalThis.ReadableStream,t=globalThis.ReadableByteStreamController,r=globalThis.WritableStream,n=globalThis.TransformStream;if(typeof e!="function")return!1;if(typeof t!="function")return!0;try{let s={type:"bytes",start(a){try{a.close()}catch{}}},i=new e(s);try{let a=i.getReader({mode:"byob"});if(!a)return!0;try{a.releaseLock()}catch{}}catch(a){let l=String(a?.message??"");if(/not implemented|ReadableByteStreamController|byob|not supported|invalid mode/i.test(l))return!0}try{i.cancel&&i.cancel()}catch{}}catch(s){let i=String(s?.message??"");if(/ReadableByteStreamController is not implemented|is not implemented|not supported|type bytes|invalid type/i.test(i))return!0}let o=e.prototype;return(!o||typeof o.pipeTo!="function"||typeof o.pipeThrough!="function"||typeof o.tee!="function")&&typeof r!="function"||typeof n<"u"&&typeof n!="function"}catch{return!1}}function _n(){if(typeof globalThis>"u")return;aa()?(te("ReadableStream",Ne),te("ReadableByteStreamController",yt),te("ReadableStreamDefaultController",ft),te("ReadableStreamDefaultReader",ht),te("ReadableStreamBYOBReader",bt),te("WritableStream",Ct),te("WritableStreamDefaultWriter",vt),te("TransformStream",Je),te("TextDecoderStream",Lt),te("TextEncoderStream",jt),te("ByteLengthQueuingStrategy",Ot),te("CountQueuingStrategy",Bt)):(oe("ByteLengthQueuingStrategy",Ot),oe("CountQueuingStrategy",Bt),oe("ReadableStream",Ne),oe("WritableStream",Ct),oe("TransformStream",Je),oe("ReadableByteStreamController",yt),oe("ReadableStreamDefaultController",ft),oe("ReadableStreamDefaultReader",ht),oe("ReadableStreamBYOBReader",bt),oe("WritableStreamDefaultWriter",vt),oe("TextDecoderStream",Lt),oe("TextEncoderStream",jt));try{let t=globalThis.ReadableStream;if(typeof t=="function"){let r=t.prototype;r&&typeof r.pipeTo!="function"&&(Object.defineProperty(r,"pipeTo",{configurable:!0,writable:!0,value:Ne.prototype.pipeTo}),Object.defineProperty(r,"pipeThrough",{configurable:!0,writable:!0,value:Ne.prototype.pipeThrough}),Object.defineProperty(r,"tee",{configurable:!0,writable:!0,value:Ne.prototype.tee}))}}catch{}}try{_n()}catch(e){console.warn("[polyfills] \u5B89\u88C5 Web Streams polyfill \u5931\u8D25\uFF1A",e)}var nm=/^(0|[1-9](\d+)?(\.\d\d?)?)$/;var Rn=(typeof window<"u"?window.location.origin:"")+"/polyfills/polyfills.js",In=new Map,Tn=new Map;function Pn(e){if(/^https?:\/\//i.test(e)||e.startsWith("blob:"))return e;let t=typeof window<"u"?window.location.origin:"";return e.startsWith("/")?t+e:t+"/"+e}function om(e){let t=In.get(e);if(t)return t;let r=Pn(e),n=`/* auto-generated bootstrap: polyfills first, then real worker (${r}) */
2
+ try { self.importScripts(${JSON.stringify(Rn)}); } catch (e) { console.error('[worker-bootstrap] polyfills load failed:', e); }
3
3
  self.importScripts(${JSON.stringify(r)});
4
- `,i=new Blob([n],{type:"text/javascript"}),s=URL.createObjectURL(i);return et.set(e,s),s}function Xs(e){let t=tt.get(e);if(t)return t;let r=nt(e),n=`/* auto-generated module bootstrap: polyfills first, then real worker (${r}) */
5
- import ${JSON.stringify(rt)};
4
+ `,o=new Blob([n],{type:"text/javascript"}),s=URL.createObjectURL(o);return In.set(e,s),s}function im(e){let t=Tn.get(e);if(t)return t;let r=Pn(e),n=`/* auto-generated module bootstrap: polyfills first, then real worker (${r}) */
5
+ import ${JSON.stringify(Rn)};
6
6
  import ${JSON.stringify(r)};
7
- `,i=new Blob([n],{type:"text/javascript"}),s=URL.createObjectURL(i);return tt.set(e,s),s}import{useEffect as Fr,useRef as st}from"react";import{jsx as F,jsxs as pe}from"react/jsx-runtime";function Qs(){return pe("div",{className:"ant-empty ant-empty-normal justify-self-center text-muted py-4",children:[F("div",{className:"ant-empty-image",children:pe("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[F("title",{children:" \u65E0\u6570\u636E "}),pe("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[F("ellipse",{fill:"rgb(var(--color-muted) / 0.12)",cx:"32",cy:"33",rx:"32",ry:"7"}),pe("g",{fillRule:"nonzero",stroke:"rgb(var(--color-border))",children:[F("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),F("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:"rgb(var(--color-surface))"})]})]})]})}),F("div",{className:"ant-empty-description justify-self-center text-sm font-thin text-muted",children:" \u65E0\u6570\u636E "})]})}function ei(e,t,r=768){let n=st(e),i=st(t);n.current=e,i.current=t,Fr(()=>{let s=window.innerWidth<=r,a=()=>{let l=window.innerWidth<=r;l!==s&&(s=l,l?n.current():i.current())};return s?n.current():i.current(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[r])}var C=e=>{let t=(e||"").trim();return["undefined","null"].includes(t.toLowerCase())?"":t},Vr=e=>{try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}},Wr=e=>{if(!e.toLowerCase().startsWith("mailto:"))return null;let t=e.slice(7),r=t.indexOf("?"),n=r>=0?t.slice(0,r):t,i=r>=0?t.slice(r+1):"",s=new URLSearchParams(i);return{to:[Vr(n),s.get("to")].map(C).filter(Boolean).join(", "),cc:C(s.get("cc")),bcc:C(s.get("bcc")),subject:C(s.get("subject")),bodyText:C(s.get("body"))}},Hr=e=>{let t=new URLSearchParams;return t.set("compose","1"),t.set("composeToken",e.token||String(Date.now())),e.to&&t.set("to",e.to),e.cc&&t.set("cc",e.cc),e.bcc&&t.set("bcc",e.bcc),e.subject&&t.set("subject",e.subject),e.bodyText&&t.set("body",e.bodyText),`/email?${t.toString()}`},ni=e=>{let t=Wr(e);return t?Hr(t):null},si=e=>{let t=e.get("compose")==="1",r={to:C(e.get("to")),cc:C(e.get("cc")),bcc:C(e.get("bcc")),subject:C(e.get("subject")),bodyText:C(e.get("body")),token:C(e.get("composeToken"))},n=!!(r.to||r.cc||r.bcc||r.subject||r.bodyText);return t||n?r:null};import{useCallback as A,useEffect as it,useRef as Ae}from"react";var qr=1200,at=0,ge=0,ot=e=>{Date.now()>at||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())},Gr=()=>{at=Date.now()+qr};function ai(e,t={}){let{delay:r=500,smallView:n=!1,moveThreshold:i=10}=t,s=Ae(new Map),a=Ae(new Map),l=Ae(new Map),d=A(p=>typeof p=="string"?p:typeof p=="object"&&p!==null&&"id"in p?String(p.id):String(p),[]);it(()=>()=>{s.current.forEach(p=>clearTimeout(p)),s.current.clear(),a.current.clear(),l.current.clear()},[]),it(()=>{if(n)return ge===0&&document.addEventListener("contextmenu",ot,!0),ge+=1,()=>{ge-=1,ge===0&&document.removeEventListener("contextmenu",ot,!0)}},[n]);let u=A(p=>{let f=s.current.get(p);f&&(clearTimeout(f),s.current.delete(p)),l.current.delete(p)},[]),m=A(p=>f=>{if(!n||f.touches.length!==1)return;let D=d(p);a.current.set(D,!1);let B=f.touches[0];l.current.set(D,{x:B.clientX,y:B.clientY});let te=setTimeout(()=>{Gr(),a.current.set(D,!0),e(p,f)},r);s.current.set(D,te)},[n,r,e,d]),P=A(p=>f=>{if(!n)return;let D=d(p),B=l.current.get(D);if(!B||!f.touches[0]){u(D);return}let te=f.touches[0],ct=Math.abs(te.clientX-B.x),dt=Math.abs(te.clientY-B.y);(ct>i||dt>i)&&u(D)},[n,i,d,u]),I=A(p=>()=>{let f=d(p);u(f)},[d,u]),V=A(p=>()=>{I(p)()},[I]),fe=A(p=>{let f=d(p);return a.current.get(f)||!1},[d]),lt=A(p=>{let f=d(p);a.current.set(f,!1)},[d]);return{handleTouchStart:m,handleTouchMove:P,handleTouchEnd:I,handleTouchCancel:V,wasLongPressed:fe,resetLongPress:lt}}import{useEffect as Jr,useState as $r}from"react";function di(){let[e,t]=$r(typeof navigator<"u"?navigator.onLine:!0);return Jr(()=>{let r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r),window.addEventListener("offline",n),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}},[]),e}var Kr=(l=>(l[l.PREPARATION=0]="PREPARATION",l[l.PROGRESS=1]="PROGRESS",l[l.COMPLETED=2]="COMPLETED",l[l.DELAYED=3]="DELAYED",l[l.TERMINATED=4]="TERMINATED",l[l.TEMP=5]="TEMP",l[l.COMPANY_PROJECT=6]="COMPANY_PROJECT",l))(Kr||{});var Xr=(i=>(i.DRAFT="DRAFT",i.APPROVALLING="APPROVALLING",i.PENDING="PENDING",i.SIGNED="SIGNED",i))(Xr||{});import Yr from"react";import{Tag as Zr}from"antd";var yi=(e,t)=>{let n={DRAFT:{color:"orange",text:"\u8349\u7A3F"},APPROVALLING:{color:"yellow",text:"\u5BA1\u6838\u4E2D"},PENDING:{color:"blue",text:"\u5F85\u7B7E\u7F72"},SIGNED:{color:"green",text:"\u5DF2\u7B7E\u7F72"}}[e];return Yr.createElement(Zr,{color:n?.color,className:t},n?.text)};var Qr=(s=>(s.OWNER="owner",s.LAYER="layer",s.MANAGER="manager",s.MEMBER="member",s.VIEWER="viewer",s))(Qr||{});export{y as API,xr as APPROVAL_BIZ_LABELS,M as AuthorizationHandler,mt as CORE_VERSION,Ur as CRM_BIZ_LABELS,Vn as CacheDepartmentInfo,ps as CachePermissionInfo,_s as CacheRoleInfo,$e as CacheUserInfo,Ts as CacheViewToggleInfo,Xr as ContractStatus,o as HttpRequest,Mr as KNOWLEDGE_BIZ_LABELS,Xe as MESSAGE_TYPE_LABELS,Ye as MessageContentUtils,os as PERMISSION_CRM_CREATE,ls as PERMISSION_CRM_DELETE,ms as PERMISSION_CRM_MANAGE_FILE,ds as PERMISSION_CRM_TRANSFER,as as PERMISSION_CRM_UPDATE,cs as PERMISSION_CRM_VIEW_CONTACT,us as PERMISSION_CRM_VIEW_FILE,is as PERMISSION_FOLDER_DOWNLOAD,ss as PERMISSION_INVOICE_LIST,Ar as PROJECT_BIZ_LABELS,Qr as ProjectRole,Kr as ProjectStatus,be as ResponseCode,jr as TODO_BIZ_LABELS,Tt as admin,Hr as buildEmailComposePath,ni as buildEmailComposePathFromMailto,Er as clearAllViewModeCache,qn as clearFileViewerCache,Gt as clearIndexedDBStores,kr as clearViewModeCache,kt as contract,Ds as copyToClipboard,Ws as ensurePromiseAllSettled,Hs as ensureWebStreamsPolyfill,Et as file,Nt as fileversion,xs as forbidDebugger,Bs as formatCurrency,js as formatDate,Us as formatDatetime,Ls as formatDisksize,vt as gateway,Es as getCompanyEmailRuleText,yi as getContractStatusTag,Sr as getViewMode,Qs as htmlNoData,Qe as installWebStreamsPolyfill,Ns as isCompanyEmail,Fs as keyboard,Rt as message,Wr as parseMailtoHref,At as project,xt as projectprogress,si as readEmailComposeSearchParams,Js as regexCurrency,St as role,Dr as setViewMode,_ as storage,ei as useEffectResize,ai as useLongPress,di as useOnlineStatus,Dt as user,Xs as withPolyfillModuleWorkerBootstrap,Ks as withPolyfillWorkerBootstrap};
7
+ `,o=new Blob([n],{type:"text/javascript"}),s=URL.createObjectURL(o);return Tn.set(e,s),s}var le=e=>{let t=(e||"").trim();return["undefined","null"].includes(t.toLowerCase())?"":t},la=e=>{try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}},ca=e=>{if(!e.toLowerCase().startsWith("mailto:"))return null;let t=e.slice(7),r=t.indexOf("?"),n=r>=0?t.slice(0,r):t,o=r>=0?t.slice(r+1):"",s=new URLSearchParams(o);return{to:[la(n),s.get("to")].map(le).filter(Boolean).join(", "),cc:le(s.get("cc")),bcc:le(s.get("bcc")),subject:le(s.get("subject")),bodyText:le(s.get("body"))}},da=e=>{let t=new URLSearchParams;return t.set("compose","1"),t.set("composeToken",e.token||String(Date.now())),e.to&&t.set("to",e.to),e.cc&&t.set("cc",e.cc),e.bcc&&t.set("bcc",e.bcc),e.subject&&t.set("subject",e.subject),e.bodyText&&t.set("body",e.bodyText),`/email?${t.toString()}`},lm=e=>{let t=ca(e);return t?da(t):null},cm=e=>{let t=e.get("compose")==="1",r={to:le(e.get("to")),cc:le(e.get("cc")),bcc:le(e.get("bcc")),subject:le(e.get("subject")),bodyText:le(e.get("body")),token:le(e.get("composeToken"))},n=!!(r.to||r.cc||r.bcc||r.subject||r.bodyText);return t||n?r:null};export{X as API,ea as APPROVAL_BIZ_LABELS,ye as AuthorizationHandler,xn as CORE_VERSION,na as CRM_BIZ_LABELS,yu as CacheDepartmentInfo,Au as CachePermissionInfo,on as CacheRoleInfo,ze as CacheUserInfo,ju as CacheViewToggleInfo,Mc as CommentTimeline,os as ContractStatus,dt as FileUploadHandler,d as HttpRequest,ta as KNOWLEDGE_BIZ_LABELS,vn as MESSAGE_TYPE_LABELS,Cn as MessageContentUtils,Su as PERMISSION_CRM_CREATE,ku as PERMISSION_CRM_DELETE,Uu as PERMISSION_CRM_MANAGE_FILE,Du as PERMISSION_CRM_TRANSFER,xu as PERMISSION_CRM_UPDATE,Nu as PERMISSION_CRM_VIEW_CONTACT,Eu as PERMISSION_CRM_VIEW_FILE,Pu as PERMISSION_FOLDER_DOWNLOAD,Ru as PERMISSION_INVOICE_LIST,Zi as PROJECT_BIZ_LABELS,ls as ProjectRole,Xc as ProjectSelector,ss as ProjectStatus,Tt as ResponseCode,yd as RoleSelector,ba as SingletonToastProvider,ra as TODO_BIZ_LABELS,Jt as UIDatePicker,Rl as UIDateRangePicker,Wd as UIFileList,Hd as UIFileUpload,Vd as UIFileUploadPreviewModal,Bl as UIImageUpload,Fn as UILoading,lc as UIResizableTable,Vl as UISelect,rc as UITableGridViewToggle,ha as UIToast,Kl as UIToastSingle,Xl as UIToastSingleProvider,Zs as UIViewToggle,Sd as UserSelector,Vn as admin,da as buildEmailComposePath,lm as buildEmailComposePathFromMailto,Yi as clearAllViewModeCache,vu as clearFileViewerCache,Ei as clearIndexedDBStores,Wo as clearRoleCache,Xi as clearViewModeCache,Xt as compressImage,Kn as contract,Wu as copyToClipboard,Zu as ensurePromiseAllSettled,em as ensureWebStreamsPolyfill,Xn as file,Yn as fileversion,Ju as forbidDebugger,mc as formatCurrency,uc as formatDate,ot as formatDatetime,pc as formatDisksize,$n as gateway,$u as getCompanyEmailRuleText,tl as getContractStatusTag,Ji as getViewMode,qr as htmlNoData,_n as installWebStreamsPolyfill,qu as isCompanyEmail,Yu as keyboard,qn as message,ca as parseMailtoHref,Qn as project,Zn as projectprogress,cm as readEmailComposeSearchParams,nm as regexCurrency,Gn as role,Ki as setViewMode,ne as storage,ll as uiAlert,fl as uiConfirm,Ie as uiLoading,Q as uiToast,Gr as useEffectResize,qa as useLongPress,Ka as useOnlineStatus,Jn as user,im as withPolyfillModuleWorkerBootstrap,om as withPolyfillWorkerBootstrap};
package/dist/ui/index.js CHANGED
@@ -1 +1 @@
1
- var Yt=Object.defineProperty;var Fr=(e,t,r)=>t in e?Yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ht=(e,t)=>{for(var r in t)Yt(e,r,{get:t[r],enumerable:!0})};var F=(e,t,r)=>Fr(e,typeof t!="symbol"?t+"":t,r);import{Modal as Br,Button as st,Space as Zt,Typography as Lr}from"antd";import{CheckCircleFilled as zr,CloseCircleFilled as Hr,ExclamationCircleFilled as Wr,InfoCircleFilled as Vr,QuestionCircleFilled as qr}from"@ant-design/icons";import{createRoot as $r}from"react-dom/client";import{jsx as q,jsxs as er}from"react/jsx-runtime";var{Text:Xr,Title:Gr}=Lr,tr={type:"info",title:"\u63D0\u793A",content:"",width:420,centered:!0,closable:!0,maskClosable:!0,okText:"\u786E\u5B9A",okType:"primary",cancelText:"\u53D6\u6D88",autoClose:0,showIcon:!1},Z=null,Q=null,Le=null,ot=e=>{let{type:t="info",title:r,content:n,width:d,centered:s,closable:a,maskClosable:o,okText:i,okType:c,cancelText:m,buttons:C,onOk:b,onCancel:w,open:_,onClose:j,className:P,showIcon:A}=e,N={success:q(zr,{style:{color:"#52c41a",fontSize:24,marginRight:8}}),error:q(Hr,{style:{color:"#ff4d4f",fontSize:24,marginRight:8}}),warning:q(Wr,{style:{color:"#faad14",fontSize:24,marginRight:8}}),info:q(Vr,{style:{color:"#1677ff",fontSize:24,marginRight:8}}),confirm:q(qr,{style:{color:"#1677ff",fontSize:24,marginRight:8}})},I=async()=>{b&&await b(),j()},R=()=>{w&&w(),j()},T=()=>C&&C.length>0?q(Zt,{style:{display:"flex",justifyContent:"flex-end"},children:C.map((O,x)=>q(st,{type:O.type||"default",onClick:()=>{O.onClick&&O.onClick(),j()},children:O.text},x))}):t==="confirm"?er(Zt,{style:{display:"flex",justifyContent:"flex-end"},children:[q(st,{onClick:R,children:m}),q(st,{type:c,onClick:I,children:i})]}):q(st,{type:c,onClick:I,children:i});return q(Br,{title:r?er("div",{style:{display:"flex",alignItems:"center"},children:[A&&N[t],q(Gr,{level:4,style:{margin:0},children:r})]}):null,open:_,width:d,centered:s,closable:a,maskClosable:o,onCancel:R,footer:T(),className:P?P+" ant-modal-nofull":"ant-modal-nofull",children:q("div",{style:{marginLeft:A?32:0},children:typeof n=="string"?q(Xr,{children:n}):n})})},Ue=(e,t=!0)=>{Le&&(window.clearTimeout(Le),Le=null);let r={...tr,...e},n=()=>{Z&&Q&&Q.render(q(ot,{...r,open:!1,onClose:()=>{r.afterClose&&r.afterClose(),Z&&Q&&setTimeout(()=>{Q?.unmount(),document.body.removeChild(Z),Z=null,Q=null},300)}}))};return Z&&Q?Q.render(q(ot,{...r,open:t,onClose:n})):(Z=document.createElement("div"),document.body.appendChild(Z),Q=$r(Z),Q.render(q(ot,{...r,open:t,onClose:n}))),r.autoClose&&r.autoClose>0&&(Le=window.setTimeout(()=>{n(),Le=null},r.autoClose)),n},So={success:e=>{let t=typeof e=="string"?{content:e}:e;return Ue({...t,type:"success",title:t.title||"\u6210\u529F"})},error:e=>{let t=typeof e=="string"?{content:e}:e;return Ue({...t,type:"error",title:t.title||"\u9519\u8BEF"})},warning:e=>{let t=typeof e=="string"?{content:e}:e;return Ue({...t,type:"warning",title:t.title||"\u8B66\u544A"})},info:e=>{let t=typeof e=="string"?{content:e}:e;return Ue({...t,type:"info",title:t.title||"\u63D0\u793A"})},confirm:e=>{let t=typeof e=="string"?{content:e}:e;return Ue({...t,type:"confirm",title:t.title||"\u786E\u8BA4"})},custom:e=>Ue(e),close:()=>{Z&&Q&&Q.render(q(ot,{...tr,open:!1,onClose:()=>{Z&&Q&&(Q.unmount(),document.body.removeChild(Z),Z=null,Q=null)}}))}};import{Modal as Jr,Button as rr,Space as Kr}from"antd";import{ExclamationCircleFilled as Qr,InfoCircleFilled as Yr,QuestionCircleFilled as Zr,WarningFilled as en}from"@ant-design/icons";import{createRoot as tn}from"react-dom/client";import{jsx as re,jsxs as sr}from"react/jsx-runtime";var rn={type:"confirm",title:"\u786E\u8BA4",content:"",width:420,centered:!0,closable:!0,maskClosable:!1,okText:"\u786E\u5B9A",okType:"primary",cancelText:"\u53D6\u6D88",showIcon:!1,keyboard:!0,autoFocusButton:"ok",zIndex:2e4},ie=null,ae=null,nr=e=>{let{type:t="confirm",title:r,content:n,width:d,centered:s,closable:a,maskClosable:o,okText:i,okType:c,cancelText:m,okButtonProps:C,cancelButtonProps:b,onOk:w,onCancel:_,open:j,onClose:P,className:A,showIcon:N,zIndex:I,keyboard:R,autoFocusButton:T}=e,D={confirm:re(Zr,{style:{color:"#1677ff",fontSize:22,marginRight:12}}),warning:re(Qr,{style:{color:"#faad14",fontSize:22,marginRight:12}}),info:re(Yr,{style:{color:"#1677ff",fontSize:22,marginRight:12}}),error:re(en,{style:{color:"#ff4d4f",fontSize:22,marginRight:12}})},O=async()=>{try{if(w){let W=w();W instanceof Promise&&await W}P(!0)}catch(W){console.error("Confirm onOk error:",W)}},x=()=>{_&&_(),P(!1)};return re(Jr,{title:r?sr("div",{style:{display:"flex",alignItems:"center"},children:[N&&D[t],re("span",{children:r})]}):null,open:j,width:d,centered:s,closable:a,maskClosable:o,onCancel:x,className:A?A+" ant-modal-nofull":"ant-modal-nofull",zIndex:I,keyboard:R,footer:sr(Kr,{children:[re(rr,{onClick:x,...b,autoFocus:T==="cancel",children:m}),re(rr,{type:c,onClick:O,...C,autoFocus:T==="ok",children:i})]}),children:re("div",{style:{marginLeft:N?34:0},children:n})})},ze=e=>{let t={...rn,...e};return ie&&ae&&(ae.unmount(),document.body.removeChild(ie),ie=null,ae=null),new Promise(r=>{let n=d=>{ie&&ae&&ae.render(re(nr,{...t,open:!1,onClose:s=>{t.afterClose&&t.afterClose(),setTimeout(()=>{ie&&ae&&(ae.unmount(),document.body.removeChild(ie),ie=null,ae=null),r(s)},300)}})),r(d)};ie=document.createElement("div"),document.body.appendChild(ie),ae=tn(ie),ae.render(re(nr,{...t,open:!0,onClose:n}))})},jo={confirm:e=>ze({...typeof e=="string"?{content:e,showIcon:!1,title:""}:e,type:"confirm"}),warning:e=>{let t=typeof e=="string"?{content:e}:e;return ze({...t,type:"warning",title:t.title||"\u8B66\u544A"})},info:e=>{let t=typeof e=="string"?{content:e}:e;return ze({...t,type:"info",title:t.title||"\u4FE1\u606F"})},error:e=>{let t=typeof e=="string"?{content:e}:e;return ze({...t,type:"error",title:t.title||"\u9519\u8BEF"})},custom:e=>ze(e)};import{useState as nn,useRef as sn,useEffect as on}from"react";import{Calendar as an,ChevronLeft as ln,ChevronRight as cn}from"lucide-react";import{Button as bt}from"antd";import{jsx as V,jsxs as He}from"react/jsx-runtime";function vt({value:e,onChange:t,type:r="date",placeholder:n="\u9009\u62E9\u65E5\u671F",className:d=""}){let[s,a]=nn(!1),o=sn(null),i=e?c(e,r):"";on(()=>{function b(w){o.current&&!o.current.contains(w.target)&&a(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]);function c(b,w){if(!b)return"";try{if(w==="month"){let[_,j]=b.split("-");return`${_}\u5E74${j}\u6708`}else return new Date(b).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"})}catch{return b}}let m=b=>{t(b.target.value)},C=()=>{a(!s)};return He("div",{className:`relative ${d}`,ref:o,children:[He("div",{className:"relative cursor-pointer",children:[V("input",{type:r,value:e,onChange:m,onClick:C,className:"w-full bg-white border border-ios-gray-200 rounded-ios py-2.5 pl-3 pr-10 text-sm text-ios-gray-700 shadow-ios focus:outline-none focus:ring-2 focus:ring-ios-blue-400 focus:border-transparent transition-all duration-200 hover:border-ios-blue-300 cursor-pointer",placeholder:n}),V("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none",children:V(an,{className:"h-4 w-4 text-ios-gray-400"})})]}),s&&He("div",{className:"absolute z-10 mt-1 bg-white rounded-ios shadow-ios-md p-4 ring-1 ring-ios-gray-200 ring-opacity-5",children:[He("div",{className:"flex justify-between items-center mb-4",children:[V(bt,{type:"text",className:"p-1.5 hover:bg-ios-gray-100 rounded-full transition-colors duration-150",icon:V(ln,{className:"h-4 w-4 text-ios-gray-600"})}),V("span",{className:"text-sm font-medium text-ios-gray-700",children:"2024\u5E745\u6708"}),V(bt,{type:"text",className:"p-1.5 hover:bg-ios-gray-100 rounded-full transition-colors duration-150",icon:V(cn,{className:"h-4 w-4 text-ios-gray-600"})})]}),He("div",{className:"grid grid-cols-7 gap-1 text-center text-xs",children:[V("div",{className:"text-ios-gray-500 font-medium",children:"\u65E5"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E00"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E8C"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E09"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u56DB"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E94"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u516D"}),V("div",{className:"text-ios-gray-300 py-1.5",children:"30"}),V("div",{className:"text-ios-gray-300 py-1.5",children:"31"}),Array.from({length:30}).map((b,w)=>V("div",{className:`py-1.5 hover:bg-ios-blue-50 rounded-full cursor-pointer transition-colors duration-150 ${w===14?"bg-ios-blue-500 text-white":"text-ios-gray-700"}`,onClick:()=>{let _=w+1,j=`2024-05-${_<10?"0"+_:_}`;t(j),a(!1)},children:w+1},w))]}),V("div",{className:"mt-4 flex justify-end",children:V(bt,{type:"text",className:"px-4 py-1.5 text-sm text-ios-blue-500 hover:bg-ios-blue-50 rounded-ios transition-colors duration-150",onClick:()=>a(!1),children:"\u786E\u5B9A"})})]})]})}import{jsx as Ct,jsxs as dn}from"react/jsx-runtime";function Vo({startDate:e,endDate:t,onStartDateChange:r,onEndDateChange:n,type:d="date",className:s=""}){return dn("div",{className:`flex items-center space-x-2 ${s}`,children:[Ct(vt,{value:e,onChange:r,type:d,placeholder:"\u5F00\u59CB\u65E5\u671F"}),Ct("span",{className:"text-gray-500",children:"\u81F3"}),Ct(vt,{value:t,onChange:n,type:d,placeholder:"\u7ED3\u675F\u65E5\u671F"})]})}import{useState as We,useRef as mn}from"react";import{Button as Rt,Modal as un,message as wt}from"antd";import{UploadOutlined as gn}from"@ant-design/icons";import pn from"react-image-crop";import"react-image-crop/dist/ReactCrop.css";function it(e,t){let r=new FileReader;r.readAsDataURL(e),r.onload=function(){t(r.result)},r.onerror=function(){t(null)},r.onabort=function(){t(null)}}function It(e,t,r,n){t=t>0?t:1024;let d=t,s=t,a=new Image;a.addEventListener("load",function(o){let i,c=!1;if(d<a.naturalWidth&&(c=!0,i=a.naturalWidth/d,s=a.naturalHeight/i),s<a.naturalHeight&&(c=!0,i=a.naturalHeight/s,d=a.naturalWidth/i),!c){d=a.naturalWidth,s=a.naturalHeight,n&&n(e,d,s);return}let m=document.createElement("canvas");m.width=d,m.height=s;let C=m.getContext("2d");C?.clearRect(0,0,d,s),C?.drawImage(a,0,0,d,s);let b=m.toDataURL(r||"image/png");m=null,n&&n(b,d,s)}),a.src=e}import{jsx as ue,jsxs as fn}from"react/jsx-runtime";var ri=({onUpload:e,accept:t="image/*",maxSize:r=5,aspectRatio:n,className:d="",useBase64:s=!1,id:a})=>{let[o,i]=We(!1),[c,m]=We(""),[C,b]=We({unit:"%",width:90,height:90,x:5,y:5}),[w,_]=We(null),[j,P]=We(null),A=mn(null),N=R=>{let T=R.target.files?.[0];if(!T)return;if(T.size>r*1024*1024){wt.error(`\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${r}MB`);return}if(!T.type.startsWith("image/")){wt.error("\u8BF7\u4E0A\u4F20\u56FE\u7247\u6587\u4EF6");return}P(T);let D=new FileReader;D.onload=O=>{m(O.target?.result),i(!0)},D.readAsDataURL(T)},I=async R=>{if(!w||!j)return;let T=w.width,D=w.height,O=w.naturalWidth/T,x=w.naturalHeight/D,B=R.unit=="%"?T/100:1,W=R.unit=="%"?D/100:1,v=R.x*O*B,S=R.y*x*W,G=R.width*O*B,K=R.height*x*W;try{let X=document.createElement("canvas");X.width=G,X.height=K;let fe=X.getContext("2d");if(!fe)return;fe.drawImage(w,v,S,G,K,0,0,G,K),X.toBlob(ye=>{if(!ye)return;let oe=new File([ye],j.name,{type:j.type});if(s){it(oe,he=>{It(he,0,"image/jpeg",me=>{i(!1),e(me)})});return}else i(!1),e(oe)},j.type),i(!1),m(""),P(null),A.current&&(A.current.value="")}catch{wt.error("\u56FE\u7247\u5904\u7406\u5931\u8D25")}};return fn("div",{className:d,children:[ue("input",{type:"file",ref:A,accept:t,onChange:N,style:{display:"none"}}),ue(Rt,{id:a,icon:ue(gn,{}),onClick:()=>A.current?.click(),className:"btn-primary",children:"\u9009\u62E9\u56FE\u7247"}),ue(un,{title:"\u88C1\u526A\u56FE\u7247",open:o,onCancel:()=>{i(!1),m(""),P(null),A.current&&(A.current.value="")},footer:[ue(Rt,{onClick:()=>i(!1),className:"btn-outline",children:"\u53D6\u6D88"},"cancel"),ue(Rt,{type:"primary",onClick:()=>I(C),className:"btn-primary",children:"\u786E\u8BA4"},"confirm")],width:500,children:ue("div",{className:"flex justify-center",children:c&&ue(pn,{crop:C,onChange:R=>b(R),aspect:n,className:"max-w-full",children:ue("img",{src:c,alt:"\u9884\u89C8",ref:R=>_(R),className:"max-w-full"})})})})]})};import{Spin as yn}from"antd";import{LoadingOutlined as hn}from"@ant-design/icons";import{createRoot as bn}from"react-dom/client";import{jsx as Ve}from"react/jsx-runtime";var or=Symbol("loading");function ir(){let e=window[or];return e||(e={count:0,timeoutId:0,inTimeout:!1},window[or]=e),e}var lr={tip:"",fullscreen:!0,delay:0,mask:!0,iconSize:40,wrapperClassName:"ui-loading-wrapper"},vn=e=>{let t={...lr,...e},{tip:r,fullscreen:n,mask:d,maskStyle:s,iconSize:a,iconStyle:o,containerStyle:i,wrapperClassName:c}=t,m=Ve(hn,{style:{fontSize:a,color:"#1677ff",...o},spin:!0}),C=n?{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9999,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:d?"rgba(0, 0, 0, 0.45)":"transparent",...s}:{},b={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...i};return Ve("div",{style:C,className:c,children:Ve("div",{style:b,children:Ve(yn,{indicator:m,children:r})})})},le=null,be=null,ar=(e={})=>(le&&be&&(be.unmount(),document.body.removeChild(le),le=null,be=null),le=document.createElement("div"),document.body.appendChild(le),be=bn(le),be.render(Ve(vn,{...e})),le),ve={show:(e={})=>{let t=ir();t.count++;let r={...lr,...e};if(r.delay&&r.delay>0){t.timeoutId!=0&&(window.clearTimeout(t.timeoutId),t.timeoutId=0),t.timeoutId=window.setTimeout(()=>{t.timeoutId=0,ar(r)},r.delay);return}else ar(r)},hide:()=>{let e=ir();if(e.count<=0){console.warn("Loading count is less than 0");return}e.count--,e.timeoutId!=0&&(window.clearTimeout(e.timeoutId),e.timeoutId=0),e.count==0&&le&&be&&(be.unmount(),document.body.removeChild(le),le=null,be=null)},service:(e,t={})=>(ve.show(t),e.then(r=>(ve.hide(),r)).catch(r=>{throw ve.hide(),r}))};import{useState as Cn,useRef as In,useEffect as Rn}from"react";import{ChevronDown as wn}from"lucide-react";import{Button as Tn}from"antd";import{jsx as Ce,jsxs as Tt}from"react/jsx-runtime";function fi({options:e,value:t,onChange:r,placeholder:n="\u8BF7\u9009\u62E9",className:d=""}){let[s,a]=Cn(!1),o=In(null),i=e.find(c=>c.value===t);return Rn(()=>{function c(m){o.current&&!o.current.contains(m.target)&&a(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]),Tt("div",{className:`relative ${d}`,ref:o,children:[Tt(Tn,{type:"text",onClick:()=>a(!s),className:"w-full bg-white border border-ios-gray-200 rounded-ios py-2.5 pl-3 pr-10 text-left shadow-ios focus:outline-none focus:ring-2 focus:ring-ios-blue-400 focus:border-transparent transition-all duration-200 hover:border-ios-blue-300",children:[Ce("span",{className:"block truncate text-sm text-ios-gray-700",children:i?i.label:n}),Ce("span",{className:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none",children:Ce(wn,{className:`h-4 w-4 text-ios-gray-400 transition-transform duration-200 ${s?"transform rotate-180":""}`})})]}),s&&Ce("div",{className:"absolute z-10 mt-1 w-full bg-white shadow-ios-md max-h-60 rounded-ios py-1 text-base ring-1 ring-ios-gray-200 ring-opacity-5 overflow-auto focus:outline-none sm:text-sm",children:e.map(c=>Tt("div",{className:`cursor-pointer select-none relative py-2.5 pl-3 pr-9 hover:bg-ios-blue-50 transition-colors duration-150 ${c.value===t?"bg-ios-blue-50 text-ios-blue-600 font-medium":"text-ios-gray-700"}`,onClick:()=>{r(c.value),a(!1)},children:[Ce("span",{className:"block truncate text-sm",children:c.label}),c.value===t&&Ce("span",{className:"absolute inset-y-0 right-0 flex items-center pr-4 text-ios-blue-500",children:Ce("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:Ce("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},c.value))})]})}import{useEffect as cr,useState as Pn,useRef as xn}from"react";import{notification as ee}from"antd";import{CheckCircleOutlined as Sn,CloseCircleOutlined as _n,InfoCircleOutlined as kn,WarningOutlined as Nn}from"@ant-design/icons";import{Fragment as dr,jsx as $e,jsxs as Dn}from"react/jsx-runtime";var xt={success:$e(Sn,{style:{color:"#52c41a"}}),error:$e(_n,{style:{color:"#ff4d4f"}}),info:$e(kn,{style:{color:"#1677ff"}}),warning:$e(Nn,{style:{color:"#faad14"}})},Ri=({type:e,message:t,descs:r="",duration:n=3,placement:d="topRight",onClose:s})=>{let[a,o]=ee.useNotification(),[i,c]=Pn(!0);return cr(()=>{let m={message:t,descs:r,placement:d,duration:n,icon:xt[e],onClose:()=>{c(!1),s?.()}};if(i)switch(e){case"success":a.success(m);break;case"error":a.error(m);break;case"info":a.info(m);break;case"warning":a.warning(m);break;default:a.info(m)}},[e,t,r,n,d,i,a,s]),$e(dr,{children:o})};ee.config({placement:"topRight",duration:3,zIndex:1e4});var Pe=class Pe{constructor(){F(this,"currentToast",null);F(this,"api",null);F(this,"isInitialized",!1);F(this,"pendingToast",null)}static getInstance(){return Pe.instance||(Pe.instance=new Pe),Pe.instance}init(t){if(this.api=t,this.isInitialized=!0,this.pendingToast){let r=this.pendingToast;this.pendingToast=null,this.show(r)}}show(t){let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t;if(!this.isInitialized||!this.api){this.pendingToast=t;return}this.currentToast?.timer&&clearTimeout(this.currentToast.timer),this.currentToast&&this.currentToast.key===r?(ee.destroy(r),this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i})):(this.currentToast&&ee.destroy(this.currentToast.key),this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}))}createNotification(t){if(!this.api)return;let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t,c={success:this.api.success.bind(this.api),error:this.api.error.bind(this.api),info:this.api.info.bind(this.api),warning:this.api.warning.bind(this.api)}[n];c({key:r,message:d,description:s,duration:a,placement:o||"topRight",icon:xt[n],onClose:()=>{this.currentToast?.key===r&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),this.currentToast=null),i?.()}}),this.currentToast={key:r,type:n,message:d,descs:s,duration:a,placement:o,timer:null}}close(){this.currentToast&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),ee.destroy(this.currentToast.key),this.currentToast=null)}destroy(){this.close(),ee.destroy()}};F(Pe,"instance");var Pt=Pe,Un=Pt.getInstance();function at(e){return typeof e=="string"?{message:e,duration:3}:e}function qe(e){return xt[e]}var Y={success:e=>{if(!e)return;let t=at(e);ee.success({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("success"),onClose:t.onClose})},error:e=>{if(!e)return;let t=at(e);ee.error({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("error"),onClose:t.onClose})},info:e=>{if(!e)return;let t=at(e);ee.info({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("info"),onClose:t.onClose})},warning:e=>{if(!e)return;let t=at(e);ee.warning({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("warning"),onClose:t.onClose})},custom:(e,t)=>{let{message:r,descs:n,duration:d,placement:s,onClose:a}=t;ee[e]({message:r,description:n,duration:d,placement:s,icon:qe(e),onClose:a})}},wi=({children:e})=>{let[t,r]=ee.useNotification(),n=xn(!1);return cr(()=>{n.current||(Un.init(t),n.current=!0)},[t]),Dn(dr,{children:[r,e]})};import{notification as Ie}from"antd";import{CheckCircleOutlined as En,CloseCircleOutlined as jn,InfoCircleOutlined as An,WarningOutlined as On}from"@ant-design/icons";import{Fragment as Fn,jsx as Ge}from"react/jsx-runtime";var Mn={success:Ge(En,{style:{color:"#52c41a"}}),error:Ge(jn,{style:{color:"#ff4d4f"}}),info:Ge(An,{style:{color:"#1890ff"}}),warning:Ge(On,{style:{color:"#faad14"}})},St=class{constructor(){F(this,"currentToast",null);F(this,"suppressedCloseKeys",new Set)}destroySilently(t){this.suppressedCloseKeys.add(t),Ie.destroy(t)}show(t){let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t;this.currentToast&&this.currentToast.key===r?this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}):(this.currentToast&&this.destroySilently(this.currentToast.key),this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}))}createNotification(t){let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t;this.suppressedCloseKeys.delete(r);let c={success:Ie.success,error:Ie.error,info:Ie.info,warning:Ie.warning}[n];c({key:r,message:d,description:s,duration:a,placement:o||"topRight",icon:Mn[n],onClose:()=>{if(this.suppressedCloseKeys.has(r)){this.suppressedCloseKeys.delete(r),this.currentToast?.key===r&&(this.currentToast=null);return}this.currentToast?.key===r&&(this.currentToast=null),i?.()}}),this.currentToast={key:r,type:n,message:d,descs:s,duration:a,placement:o}}close(t){if(!this.currentToast){t&&Ie.destroy(t);return}let r=t||this.currentToast.key;if(r!==this.currentToast.key){Ie.destroy(t);return}this.destroySilently(r),this.currentToast=null}destroy(){this.currentToast&&(this.destroySilently(this.currentToast.key),this.currentToast=null),Ie.destroy()}},xe=new St,ki={success:(e,t=3)=>{let r=Xe("success",e,t);xe.show(r)},error:(e,t=3)=>{let r=Xe("error",e,t);xe.show(r)},info:(e,t=3)=>{let r=Xe("info",e,t);xe.show(r)},warning:(e,t=3)=>{let r=Xe("warning",e,t);xe.show(r)},custom:(e,t,r=3)=>{let n=Xe(e,t,r);xe.show(n)},close:e=>{xe.close(e)},destroy:()=>{xe.destroy()}};function Xe(e,t,r){let n=typeof t=="object"&&t!==null?t:{message:t};return{key:n.key||`singleton-${e}`,type:e,message:n.message,descs:n.descs,duration:n.duration??r,placement:n.placement,onClose:n.onClose}}var Ni=({children:e})=>Ge(Fn,{children:e});import{Button as Bn}from"antd";import{TableOutlined as Ln,AppstoreOutlined as zn}from"@ant-design/icons";import{jsx as De}from"react/jsx-runtime";function Hn({className:e="",viewMode:t,onToggle:r,options:n=[]}){return De("div",{className:`flex justify-end ${e}`,children:De("div",{className:"bg-gray-100 rounded-button p-1 flex",children:n.map((d,s)=>De(Bn,{type:t===d.value?"primary":"text",icon:d.icon,onClick:()=>r(d.value),className:`${s<n.length-1?"mr-1":""} rounded-button`,size:"small",title:d.tooltip},d.value))})})}function Oi({viewMode:e,onToggle:t,className:r=""}){return De(Hn,{viewMode:e,onToggle:t,className:r,options:[{value:"table",icon:De(Ln,{}),tooltip:"\u8868\u683C\u89C6\u56FE"},{value:"grid",icon:De(zn,{}),tooltip:"\u7F51\u683C\u89C6\u56FE"}]})}import{useMemo as mr,useState as _t}from"react";import{Table as Wn}from"antd";import{jsx as kt,jsxs as Jn}from"react/jsx-runtime";var Vn=Wn,qn=60,ur=9,$n={position:"absolute",top:0,bottom:0,right:-(ur/2),width:ur,zIndex:2,cursor:"col-resize",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none"},Xn={width:1,height:"60%",background:"transparent"},Gn=({onResizeStart:e,style:t,children:r,...n})=>{let[d,s]=_t(!1),[a,o]=_t(!1),i=c=>{if(!e)return;let m=c.currentTarget.closest("th"),C=m?m.getBoundingClientRect().width:0;o(!0);let b=()=>o(!1);document.addEventListener("mouseup",b,{once:!0}),e(c,C)};return Jn("th",{style:{...t,position:"relative"},...n,children:[r,e&&kt("span",{style:$n,onMouseDown:i,onClick:c=>c.stopPropagation(),onDoubleClick:c=>c.stopPropagation(),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:kt("span",{style:{...Xn,background:d||a?"#1677ff":"transparent"}})})]})},gr=(e,t)=>{let r=e.key;if(typeof r=="string"||typeof r=="number")return String(r);let n=e.dataIndex;return Array.isArray(n)?n.join("."):typeof n=="string"||typeof n=="number"?String(n):`col-${t}`};function Hi(e){let{columns:t,components:r,tableLayout:n,...d}=e,[s,a]=_t({}),o=(m,C)=>(b,w)=>{if(b.preventDefault(),b.stopPropagation(),Object.keys(s).length===0&&t){let A=b.currentTarget.closest("th"),N=A?.parentElement,I=N?Array.from(N.children):[],R=A&&I.length>0?I.indexOf(A)-m:0,T={};t.forEach((D,O)=>{let x=I[O+R];x&&(T[gr(D,O)]=Math.round(x.getBoundingClientRect().width))}),Object.keys(T).length>0&&a(D=>({...T,...D}))}let _=b.clientX,j=A=>{let N=Math.max(qn,Math.round(w+A.clientX-_));a(I=>I[C]===N?I:{...I,[C]:N})},P=()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",P),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",j),document.addEventListener("mouseup",P),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},i=mr(()=>t&&t.map((m,C)=>{if("children"in m&&m.children)return m;let b=gr(m,C),w=s[b]??m.width;return{...m,width:w,onHeaderCell:_=>({...m.onHeaderCell?.(_)??{},onResizeStart:o(C,b)})}}),[t,s]),c=mr(()=>({...r,header:{...r?.header??{},cell:Gn}}),[r]);return kt(Vn,{...d,columns:i,components:c,tableLayout:Object.keys(s).length>0?"fixed":n})}import Re from"react";import{Timeline as Cs,Avatar as Rr,Button as gt,Dropdown as Is,DatePicker as Rs}from"antd";var Je=e=>!e||(typeof e=="string"&&(e=new Date(e)),e.getTime()==0)||isNaN(e.getTime())?"\u65E0":e.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"numeric",hour:"2-digit",minute:"2-digit"});import{Modal as wr,Form as ke,Input as Tr}from"antd";import{EllipsisOutlined as ws,EditOutlined as Ts,DeleteOutlined as Ps,CommentOutlined as xs}from"@ant-design/icons";import{useEffect as Kn,useRef as pr}from"react";import{jsx as Ee,jsxs as lt}from"react/jsx-runtime";function fr(){return lt("div",{className:"ant-empty ant-empty-normal justify-self-center text-muted py-4",children:[Ee("div",{className:"ant-empty-image",children:lt("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[Ee("title",{children:" \u65E0\u6570\u636E "}),lt("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[Ee("ellipse",{fill:"rgb(var(--color-muted) / 0.12)",cx:"32",cy:"33",rx:"32",ry:"7"}),lt("g",{fillRule:"nonzero",stroke:"rgb(var(--color-border))",children:[Ee("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),Ee("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:"rgb(var(--color-surface))"})]})]})]})}),Ee("div",{className:"ant-empty-description justify-self-center text-sm font-thin text-muted",children:" \u65E0\u6570\u636E "})]})}function yr(e,t,r=768){let n=pr(e),d=pr(t);n.current=e,d.current=t,Kn(()=>{let s=window.innerWidth<=r,a=()=>{let o=window.innerWidth<=r;o!==s&&(s=o,o?n.current():d.current())};return s?n.current():d.current(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[r])}import Pr from"dayjs";import*as Et from"febs-browser";import vr from"dexie";var Nt={};ht(Nt,{AuthorizationHandler:()=>ge,HttpRequest:()=>l,ResponseCode:()=>mt});import Qn,{AxiosError as Yn}from"axios";import*as dt from"febs-browser";import*as Ke from"febs-browser";import hr from"store2";var ct=class{constructor(t){F(this,"s");this.s=t}get length(){return this.s.size()}keys(){return this.s.keys()}set(t,r){return r?(r=JSON.stringify(r),r=Ke.crypt.base64_encode(r),this.s.set(t,r,!0),this):this.remove(t)}get(t,r=null){if(!this.s.has(t))return r;let n=this.s.get(t);if(n){n=Ke.crypt.base64_decode(n),n=Ke.string.bytesToUtf8(n||[]);try{return JSON.parse(n)}catch{return this.remove(t),null}}return n}remove(t){return this.s.remove(t),this}clear(){return this.s.clearAll(),this}},te={namespace:function(e){return new ct(hr.namespace(e||"default"))},namespace_session:function(e){return new ct(hr.session.namespace(e||"default"))}};var mt=(i=>(i[i.SUCCESS=200]="SUCCESS",i[i.OPERATOR_ERROR=400]="OPERATOR_ERROR",i[i.UNAUTHORIZED=401]="UNAUTHORIZED",i[i.UNPERMISSION=402]="UNPERMISSION",i[i.NOT_FOUND=404]="NOT_FOUND",i[i.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",i[i.PARAM_ERROR=601]="PARAM_ERROR",i[i.REQUEST_LIMIT=602]="REQUEST_LIMIT",i))(mt||{});function Zn(e){switch(e){case 404:return"\u8D44\u6E90\u4E0D\u5B58\u5728";case 400:return"\u7CFB\u7EDF\u64CD\u4F5C\u9519\u8BEF";case 601:return"\u53C2\u6570\u9519\u8BEF";case 602:return"\u8FBE\u5230\u8BBF\u95EE\u9650\u5236";case 503:return"\u670D\u52A1\u4E0D\u53EF\u7528";case 401:return"\u672A\u767B\u5F55";case 402:return"\u65E0\u6743\u9650";default:return"\u672A\u77E5\u9519\u8BEF"}}var je=Qn.create({baseURL:import.meta.env.VITE_API_BASE,timeout:Number(import.meta.env.VITE_API_TIMEOUT)||5e3,headers:{"Content-Type":"application/json;charset=UTF-8"},withCredentials:!0}),$=class ${static clearStoreToken(){this.setStoreToken(null,0)}static getStoreToken(){let t=te.namespace("bp.ss").get("ss");if(t){let r=te.namespace("bp.ss").get("exp");return{token:JSON.parse(t),exp:r?JSON.parse(r):0}}return null}static getValidStoreToken(){let t=$.getStoreToken();return t&&t.exp>Date.now()-$.TOKEN_EXP?t.token:null}static setStoreToken(t,r){t?(te.namespace("bp.ss").set("ss",JSON.stringify(t)),te.namespace("bp.ss").set("exp",JSON.stringify(r))):te.namespace("bp.ss").clear()}static requestHandleSid(t){let r=$.getStoreToken();r&&r.exp>Date.now()-$.TOKEN_EXP&&t.headers.set($.HEADER_NAME,$.HEADER_PREFIX+r.token)}static responseHandleSid(t){let r=t.headers.get($.HEADER_NAME);if(r&&r.startsWith($.HEADER_PREFIX.trim())){r=r.replace($.HEADER_PREFIX,"");let n=r;if(r=r.split(".")[1],r&&(r=dt.string.bytesToUtf8(dt.crypt.base64_decode(r)),r)){let d=JSON.parse(r);return d.exp<Date.now()-$.TOKEN_EXP?($.clearStoreToken(),!1):($.setStoreToken(n,d.exp),!0)}$.clearStoreToken(),typeof navigator<"u"&&navigator.onLine&&(window.location.href="/")}return!1}};F($,"HEADER_NAME","Authorization"),F($,"HEADER_PREFIX","SPBearer "),F($,"TOKEN_EXP",20*1e3);var ge=$;je.interceptors.request.use(e=>(ve.show({delay:5e3}),ge.requestHandleSid(e),e),e=>(ve.hide(),console.log("Request Error =========="),Promise.reject(e)));je.interceptors.response.use(e=>(ve.hide(),e.data.code!==200&&Y.warning(e.data.message||Zn(e.data.code)),ge.responseHandleSid(e),e.data),e=>(ve.hide(),e instanceof Yn&&(e.code==="ERR_NETWORK"||e.code==="ECONNABORTED"?Y.error("\u7F51\u7EDC\u9519\u8BEF"):e.code==="ERR_BAD_RESPONSE"&&Y.error("\u670D\u52A1\u5668\u65E0\u54CD\u5E94")),console.log("Response Error =========="),Promise.reject(e)));var l={get(e,t,r){return je({method:"get",url:e,params:t,data:r})},post(e,t,r){return je({method:"post",url:e,params:t,data:r})},put(e,t,r){return je({method:"put",url:e,params:t,data:r})},delete(e,t,r){return je({method:"delete",url:e,params:t,data:r})}};var Ut={};ht(Ut,{admin:()=>es,gateway:()=>ts,message:()=>rs,role:()=>ns,user:()=>ss});var es={registerAdmin:e=>l.post("/api/admin/registerAdmin",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode}).then(t=>t),registerUser:e=>l.post("/api/admin/registerUser",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id}).then(t=>t),updateInfoByAdmin:e=>l.post("/api/admin/updateByAdmin",null,{id:e.id,is_forbidden:e.is_forbidden,title:e.title,phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id,created_at:e.created_at,tick_avatar_self:e.tick_avatar_self,role_ids:e.role_ids,isAdmin:e.isAdmin,thirdPlatformInfo:e.thirdPlatformInfo,unreadMessageCount:e.unreadMessageCount}).then(t=>t),list:e=>l.get("/api/admin/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)},ts={register:e=>l.post("/api/register",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id}).then(t=>t),sendSms:e=>l.post("/api/sendSms",{phone:e.phone,imageCode:e.imageCode},null).then(t=>t),isLogin:()=>l.get("/api/isLogin",null,null).then(e=>e),login:e=>l.post("/api/login",null,{phone:e.phone,pwd:e.pwd,pwdSN:e.pwdSN,smsCode:e.smsCode}).then(t=>t),verifyPasswordHash:e=>l.post("/api/verifyPasswordHash",null,{passwordHash:e.passwordHash,passwordSalt:e.passwordSalt}).then(t=>t),logout:()=>l.get("/api/logout",null,null).then(e=>e),listPermissions:()=>l.get("/api/listPermissions",null,null).then(e=>e),listRolePermissions:e=>l.get("/api/listRolePermissions",{id:e.id},null).then(t=>t)},rs={list:e=>l.get("/api/user/message/list",{pageNum:e.pageNum,pageSize:e.pageSize,unread_only:e.unread_only},null).then(t=>t),countUnread:()=>l.get("/api/user/message/unread/count",null,null).then(e=>e),markRead:e=>l.post("/api/user/message/read",null,{messageIds:e.messageIds}).then(t=>t),clearReaded:e=>l.delete("/api/user/message/clearReaded",null,{messageIds:e.messageIds}).then(t=>t)},ns={listRoles:()=>l.get("/api/role/listRoles",null,null).then(e=>e),createRole:e=>l.post("/api/role/createRole",{name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id},null).then(t=>t),updateRole:e=>l.post("/api/role/updateRole",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id},null).then(t=>t),assignPermissionsToRole:e=>l.post("/api/role/assignPermissionsToRole",null,{role_id:e.role_id,permissions:e.permissions}).then(t=>t),assignRoleToUserPermission:()=>l.post("/api/role/assignRoleToUserPermission",null,null).then(e=>e),assignRoleToUser:e=>l.post("/api/role/assignRoleToUser",null,{user_id:e.user_id,role_ids:e.role_ids}).then(t=>t),listUserRoles:e=>l.get("/api/role/listUserRoles",{user_id:e.user_id},null).then(t=>t),listUserPermissions:e=>l.get("/api/role/listUserPermissions",{user_id:e.user_id},null).then(t=>t),listCompanies:()=>l.get("/api/role/listCompanies",null,null).then(e=>e),createCompany:e=>l.post("/api/role/createCompany",{name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id,is_spv_company:e.is_spv_company},null).then(t=>t),updateCompany:e=>l.post("/api/role/updateCompany",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id,is_spv_company:e.is_spv_company},null).then(t=>t),listDepartments:()=>l.get("/api/role/listDepartments",null,null).then(e=>e),createDepartment:e=>l.post("/api/role/createDepartment",{name:e.name,descs:e.descs,admin_id:e.admin_id,company_id:e.company_id,parent_id:e.parent_id},null).then(t=>t),updateDepartment:e=>l.post("/api/role/updateDepartment",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,company_id:e.company_id,parent_id:e.parent_id},null).then(t=>t),assignUserToDepartment:e=>l.post("/api/role/assignUserToDepartment",{user_id:e.user_id,department_id:e.department_id,position:e.position},null).then(t=>t),removeUserFromDepartment:e=>l.post("/api/role/removeUserFromDepartment",{user_id:e.user_id,department_id:e.department_id},null).then(t=>t),listCompanyDepartments:e=>l.get("/api/role/listCompanyDepartments",{company_id:e.company_id},null).then(t=>t),listUserDepartments:e=>l.get("/api/role/listUserDepartments",{user_id:e.user_id},null).then(t=>t),listDepartmentUsers:e=>l.get("/api/role/listDepartmentUsers",{department_id:e.department_id},null).then(t=>t)},ss={getInfoByUsername:e=>l.get("/api/user/infoByUsername",{username:e.username},null).then(t=>t),getInfo:e=>l.get("/api/user/info",{id:e.id},null).then(t=>t),getAvatar:e=>l.get("/api/user/avatar",{id:e.id,tick:e.tick},null).then(t=>t),getAvatarList:e=>l.get("/api/user/avatar_list",{ids:e.ids},null).then(t=>t),updateAvatar:e=>l.post("/api/user/updateAvatar",null,{id:e.id,avatar:e.avatar,avatar_small:e.avatar_small,tick_self:e.tick_self}).then(t=>t),updateManager:e=>l.post("/api/user/updateManager",{id:e.id,managerid:e.managerid},null).then(t=>t),updateInfo:e=>l.post("/api/user/update",null,{id:e.id,is_forbidden:e.is_forbidden,title:e.title,phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id,created_at:e.created_at,tick_avatar_self:e.tick_avatar_self,role_ids:e.role_ids,isAdmin:e.isAdmin,thirdPlatformInfo:e.thirdPlatformInfo,unreadMessageCount:e.unreadMessageCount}).then(t=>t),updatePassword:e=>l.post("/api/user/updatePassword",null,{old_password:e.old_password,old_password_sn:e.old_password_sn,new_password:e.new_password}).then(t=>t),deleteUser:e=>l.post("/api/user/delete",{id:e.id},null).then(t=>t),list:e=>l.get("/api/user/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),listByIds:e=>l.get("/api/user/list_by_ids",{ids:e.ids},null).then(t=>t),search:e=>l.get("/api/user/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),forbid:e=>l.post("/api/user/forbid",{id:e.id,forbid:e.forbid},null).then(t=>t)};var Dt={};ht(Dt,{contract:()=>os,file:()=>is,fileversion:()=>as,project:()=>ls,projectprogress:()=>cs});var os={createContract:e=>l.post("/api/project/contract/create",null,{projectId:e.projectId,name:e.name,tag:e.tag,code:e.code,partyA:e.partyA,partyB:e.partyB,amount:e.amount,startDate:e.startDate,endDate:e.endDate,descs:e.descs}).then(t=>t),deleteContract:e=>l.delete("/api/project/contract/delete",{id:e.id},null).then(t=>t),updateContract:e=>l.post("/api/project/contract/update",null,{id:e.id,name:e.name,code:e.code,tag:e.tag,partyA:e.partyA,partyB:e.partyB,amount:e.amount,startDate:e.startDate,endDate:e.endDate,descs:e.descs,markdown:e.markdown}).then(t=>t),getContractDetail:e=>l.get("/api/project/contract/detail",{id:e.id},null).then(t=>t),getContractList:e=>l.get("/api/project/contract/list",{projectId:e.projectId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),submitApproval:e=>l.post("/api/project/contract/submit",{id:e.id,sealType:e.sealType},null).then(t=>t),cancelApproval:e=>l.post("/api/project/contract/cancelApproval",{id:e.id},null).then(t=>t),uploadVersion:e=>l.post("/api/project/contract/version/upload",null,{contractId:e.contractId,fileName:e.fileName,fileType:e.fileType,fileSize:e.fileSize,changeLog:e.changeLog}).then(t=>t),getVersionList:e=>l.get("/api/project/contract/version/list",{contractId:e.contractId},null).then(t=>t),deleteVersion:e=>l.delete("/api/project/contract/version/delete",{id:e.id},null).then(t=>t),renameVersion:e=>l.post("/api/project/contract/version/rename",null,{id:e.id,fileName:e.fileName}).then(t=>t),getVersionDetail:e=>l.get("/api/project/contract/version/detail",{id:e.id},null).then(t=>t),setVersionLayerOpinion:e=>l.post("/api/project/contract/version/layerOpinion",null,{contractId:e.contractId,version:e.version,opinion:e.opinion}).then(t=>t),getNewContractCode:e=>l.get("/api/project/contract/newCode",{contractCode:e.contractCode,sequenceLength:e.sequenceLength},null).then(t=>t),getContractHistoryParties:()=>l.get("/api/project/contract/historyParties",null,null).then(e=>e)},is={getDetail:e=>l.get("/api/project/files/detail",{fileId:e.fileId},null).then(t=>t),listFiles:e=>l.get("/api/project/files/list",{projectId:e.projectId},null).then(t=>t),searchFiles:e=>l.get("/api/project/files/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),addFile:(e,t)=>l.post("/api/project/files/add",{projectId:e.projectId},{fileName:t.fileName,filePath:t.filePath,isSecure:t.isSecure,descs:t.descs,fileType:t.fileType,fileSize:t.fileSize,crc32:t.crc32,fileResourcePath:t.fileResourcePath}).then(r=>r),removeFile:e=>l.post("/api/project/files/remove",{fileId:e.fileId},null).then(t=>t),listTrashFiles:e=>l.get("/api/project/files/trash/list",{projectId:e.projectId},null).then(t=>t),restoreTrashFile:e=>l.post("/api/project/files/trash/restore",{fileId:e.fileId},null).then(t=>t),permanentDeleteTrashFile:e=>l.post("/api/project/files/trash/remove",{fileId:e.fileId},null).then(t=>t),emptyTrash:e=>l.post("/api/project/files/trash/empty",{projectId:e.projectId},null).then(t=>t),moveFile:(e,t)=>l.post("/api/project/files/move",{projectId:e.projectId},{oldFileName:t.oldFileName,oldFilePath:t.oldFilePath,newFileName:t.newFileName,newFilePath:t.newFilePath}).then(r=>r),updateFileDescs:e=>l.post("/api/project/files/updateDescs",null,{fileId:e.fileId,descs:e.descs}).then(t=>t),copyFileToProject:e=>l.post("/api/project/files/copyToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),moveFileToProject:e=>l.post("/api/project/files/moveToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),updateFileDelta:e=>l.post("/api/project/files/updateDelta",null,{fileId:e.fileId,deltaData:e.deltaData,deltaSize:e.deltaSize,newFileSize:e.newFileSize,crc32:e.crc32,recordVersion:e.recordVersion,rotateResourcePath:e.rotateResourcePath}).then(t=>t),updateFile:e=>l.post("/api/project/files/updateData",null,{fileId:e.fileId,fileSize:e.fileSize,crc32:e.crc32,fileName:e.fileName,fileResourcePath:e.fileResourcePath,recordVersion:e.recordVersion,rotateResourcePath:e.rotateResourcePath}).then(t=>t),generateTempAccessToken:e=>l.post("/api/project/files/generateTempAccessToken",{fileId:e.fileId,expireSeconds:e.expireSeconds},null).then(t=>t),folderDownload:(e,t)=>l.post("/api/project/files/folderDownload",{projectId:e.projectId},{folderPath:t.folderPath,folderName:t.folderName}).then(r=>r),folderDownloadStatus:e=>l.get("/api/project/files/folderDownloadStatus",{jobId:e.jobId},null).then(t=>t),listFilesByTempAccessToken:e=>l.get("/api/project/files/listByTempAccessToken",{tempToken:e.tempToken},null).then(t=>t)},as={listVersions:e=>l.get("/api/project/files/version/list",{fileId:e.fileId},null).then(t=>t),getVersionDetail:e=>l.get("/api/project/files/version/detail",{versionId:e.versionId},null).then(t=>t)},ls={enableUserPrivateProject:()=>l.post("/api/project/enablePrivateProject",null,null).then(e=>e),createProject:e=>l.post("/api/project/create",null,{name:e.name,descs:e.descs,companyId:e.companyId,markdown:e.markdown,startTime:e.startTime,plannedEndTime:e.plannedEndTime,endTime:e.endTime,leaderId:e.leaderId,customerId:e.customerId,order:e.order,isUserPrivate:e.isUserPrivate}).then(t=>t),updateProject:e=>l.post("/api/project/update",null,{id:e.id,name:e.name,descs:e.descs,companyId:e.companyId,markdown:e.markdown,status:e.status,startTime:e.startTime,plannedEndTime:e.plannedEndTime,endTime:e.endTime,leaderId:e.leaderId,customerId:e.customerId,order:e.order,isUserPrivate:e.isUserPrivate,createTime:e.createTime,updateTime:e.updateTime,createBy:e.createBy,updateBy:e.updateBy}).then(t=>t),updateUserdataOrder:e=>l.post("/api/project/updateUserdataOrder",null,{projectIds:e.projectIds}).then(t=>t),getUserdataOrder:()=>l.get("/api/project/userdataOrder",null,null).then(e=>e),getProjectDetail:e=>l.get("/api/project/detail",{id:e.id},null).then(t=>t),getProjectName:e=>l.get("/api/project/name",{projectId:e.projectId},null).then(t=>t),listProjects:e=>l.get("/api/project/list",{pageNum:e.pageNum,pageSize:e.pageSize,status:e.status,companyId:e.companyId,customerId:e.customerId,userId:e.userId},null).then(t=>t),listProjectsByManager:e=>l.get("/api/project/listByManager",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),changeStatus:e=>l.put("/api/project/status",{id:e.id,status:e.status},null).then(t=>t),getProjectMembers:e=>l.get("/api/project/members",{projectId:e.projectId},null).then(t=>t),getMemberRole:e=>l.get("/api/project/member/role",{projectId:e.projectId,userId:e.userId},null).then(t=>t),assignMember:e=>l.post("/api/project/members/assign",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t),removeMember:e=>l.post("/api/project/members/remove",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t)},cs={createProgress:e=>l.post("/api/project/progress/create",null,{projectId:e.projectId,descs:e.descs,commentCount:e.commentCount,progressTime:e.progressTime}).then(t=>t),updateProgress:e=>l.put("/api/project/progress/update",null,{id:e.id,descs:e.descs,progressTime:e.progressTime}).then(t=>t),deleteProgress:e=>l.delete("/api/project/progress/delete",{id:e.id},null).then(t=>t),getProgressList:e=>l.get("/api/project/progress/list",{projectId:e.projectId},null).then(t=>t),addComment:e=>l.post("/api/project/progress/comment/add",null,{progressId:e.progressId,comment:e.comment}).then(t=>t),deleteComment:e=>l.delete("/api/project/progress/comment/delete",{id:e.id},null).then(t=>t),updateComment:e=>l.put("/api/project/progress/comment/update",{id:e.id},{}).then(t=>t),getCommentList:e=>l.get("/api/project/progress/comment/list",{progressId:e.progressId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)};var ne={base:Nt,user:Ut,project:Dt};var _e=1440*60*1e3,jt=class extends vr{constructor(){super("UserInfoDB");F(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},At=class extends vr{constructor(){super("UserAvatarDB");F(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},ce=new jt,de=new At,Cr=async e=>{try{let t=await de.userCache.get(e);if(t){if(Date.now()-t.timestamp<_e)return t.avatar;await de.userCache.delete(e)}return null}catch(t){return console.error("\u8BFB\u53D6\u7528\u6237\u5934\u50CF\u7F13\u5B58\u5931\u8D25:",t),null}},Ot=async e=>{try{let t=await ce.userCache.get(e);if(t){let r=Date.now(),n=await de.userCache.get(e);if(n?r-n.timestamp<_e?t.data.avatar=n.avatar:(t.data.avatar=void 0,await de.userCache.delete(e)):t.data.avatar=void 0,r-t.timestamp<_e)return t.data;await ce.userCache.delete(e)}return null}catch(t){return console.error("\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",t),null}},ds=async(e,t)=>{try{t&&await de.userCache.put({id:e,avatar:t,timestamp:Date.now()})}catch(r){console.error("\u5199\u5165\u7528\u6237\u5934\u50CF\u7F13\u5B58\u5931\u8D25:",r)}},ms=async(e,t)=>{try{t.avatar&&await de.userCache.put({id:e,avatar:t.avatar,timestamp:Date.now()});let r=t.avatar;t.avatar=void 0,await ce.userCache.put({id:e,data:t,timestamp:Date.now()}),t.avatar=r}catch(r){console.error("\u5199\u5165\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}},us=async e=>{let t=new Map;try{let r=await ce.userCache.bulkGet(e),n=Date.now();for(let s=0;s<e.length;s++){let a=r[s];a&&n-a.timestamp<_e&&t.set(e[s],a.data)}let d=await de.userCache.bulkGet(e);for(let s=0;s<e.length;s++){let a=d[s];if(!a)continue;let o=t.get(a.id);o&&n-a.timestamp<_e&&(o.avatar=a.avatar)}}catch(r){console.error("\u6279\u91CF\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}return t},br=async e=>{try{let t=e.map(n=>({id:n.id,data:n.data,timestamp:Date.now()})),r=e.map(n=>({id:n.id,avatar:n.data.avatar,timestamp:Date.now()}));r=r.filter(n=>n.avatar),await de.userCache.bulkPut(r),t.forEach(n=>{n.data.avatar=void 0}),await ce.userCache.bulkPut(t)}catch(t){console.error("\u6279\u91CF\u5199\u5165\u7528\u6237\u7F13\u5B58\u5931\u8D25:",t)}},gs=async()=>{let e=new Map;try{let t=Date.now(),r=await ce.userCache.toArray();for(let n of r)if(t-n.timestamp<_e){let d=await de.userCache.get(n.id);d&&t-d.timestamp<_e&&(n.data.avatar=d.avatar),e.set(n.id,n.data)}else await ce.userCache.delete(n.id)}catch(t){console.error("\u83B7\u53D6\u6240\u6709\u7F13\u5B58\u5931\u8D25:",t)}return e},ps=async()=>{try{await ce.userCache.clear(),await de.userCache.clear()}catch(e){console.error("\u6E05\u9664\u7528\u6237\u7F13\u5B58\u5931\u8D25:",e)}},Ir=async({user_id:e,forceRefresh:t=!1,forceAvatar:r=!1})=>{let n={code:200,data:{user_id:e,isLogin:!0}},d=!1;if(!e)try{n=await ne.user.gateway.isLogin()}catch{d=!0}if(d){let s;try{let o=te.namespace("bp.ss").get("user");o&&(s=JSON.parse(o)?.id)}catch{}let a=e??s;if(a){let o=await Ot(a);if(o){let i=await Se({user_id:a,forceRefresh:!1,serverTick:o.tick_avatar_self});return i&&(o.avatar=i),o}}try{let o=te.namespace("bp.ss").get("user");if(o)return JSON.parse(o)}catch{}return null}if(n?.code===200&&n.data?.isLogin){let s=n.data?.user_id,a=n.data?.isAdmin||!1,o=await Ot(s);if(t||!o)try{let i=await ne.user.user.getInfo({id:s});if(i?.code==200){e||te.namespace("bp.ss").set("user",JSON.stringify(i.data));let c={...i.data};s&&await ms(s,c);try{let m=await Se({user_id:s,forceRefresh:r,serverTick:i.data?.tick_avatar_self});m&&(c.avatar=m)}catch{}return c}else return o||null}catch{if(o)return o;try{let c=te.namespace("bp.ss").get("user");if(c)return JSON.parse(c)}catch{}return null}try{let i=await Se({user_id:s,forceRefresh:r,serverTick:o.tick_avatar_self});i&&(o.avatar=i)}catch{}return o}else return ge.clearStoreToken(),null},Se=async({user_id:e,forceRefresh:t=!1,serverTick:r=Number.MAX_SAFE_INTEGER})=>{if(!e)return;let n=await Cr(e);if(t||!n){let d=n?.avatar_tick||-1;if(d<r)try{let s=await ne.user.user.getAvatar({id:e,tick:d});s?.code==200&&d!=s.data?.tick_self&&(n={avatar:Et.string.isEmpty(s.data?.avatar)?void 0:s.data?.avatar,avatar_small:Et.string.isEmpty(s.data?.avatar_small)?void 0:s.data?.avatar_small,avatar_tick:s.data?.tick_self||-1},await ds(e,n))}catch{}}return n||void 0},fs=async e=>(e=e||{forceRefresh:!1},await Ir(e)),ys=()=>{let e=te.namespace("bp.ss").get("user");return e?JSON.parse(e):null},hs=async({userIds:e,keywords:t,forceRefresh:r=!1})=>{let n=new Map;if(!e){if(!r&&(!t||t.length===0)){let c=await gs();if(c.size>=100){let m=new Map,C=0;for(let[b,w]of c){if(C>=100)break;let _=await Se({user_id:b,forceRefresh:!1,serverTick:w.tick_avatar_self});w.avatar=_,m.set(b,w),C++}return m}return c}let a;if(t&&t.length>0){if(a=await ne.user.user.search({pageNum:1,pageSize:100,keyword:t}),a?.code!==200)return n}else if(a=await ne.user.user.list({pageNum:1,pageSize:100}),a?.code!==200)return n;let o=a.data?.list||[],i=[];for(let c of o){let m={...c};n.set(c.id,m),i.push({id:c.id,data:m})}i.length>0&&await br(i);for(let c=0;c<i.length;c++){let m=await Se({user_id:i[c].id,serverTick:i[c].data.tick_avatar_self});i[c].data.avatar=m}return n}if(e.length==0)return n;let d=[...new Set(e)];r||(await us(d)).forEach((o,i)=>{n.set(i,o)});let s=d.filter(a=>!n.has(a));if(s.length===0)return n;try{let a=await ne.user.user.listByIds({ids:JSON.stringify(s)});if(a?.code!=200)return n;let o=a.data?.list||[];if(o.length>0){let c=[];for(let m of o){let C={...m};c.push({id:m.id,data:C})}await br(c)}let i=[];if(o.length>0)for(let c of o){let m=await Se({user_id:c.id,serverTick:c.tick_avatar_self||-1});i.push({id:c.id,avatar_small:m?.avatar_small||"",avatar_tick:c.tick_avatar_self||-1})}for(let c of o){let m=i.find(b=>b.id==c.id),C={...c,avatar:{avatar:"",avatar_small:m?.avatar_small||"",avatar_tick:m?.avatar_tick||-1}};n.set(c.id,C)}}catch(a){console.error("\u6279\u91CF\u83B7\u53D6\u7528\u6237\u4FE1\u606F\u5931\u8D25:",a)}return n},bs=async e=>{e?await ce.userCache.delete(e):await ps()},vs=async()=>{try{let e=await ce.userCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},ut={getFromCache:Ot,getAvatarFromCache:Cr,getUserInfo:Ir,getUserAvatar:Se,current:fs,currentLocalUser:ys,getUserInfos:hs,clearUserCache:bs,getCacheStats:vs};import{Fragment as Mt,jsx as U,jsxs as se}from"react/jsx-runtime";var ka=({commentList:e,showTitle:t,showTimePicker:r,onDeleteComment:n,onLoadSubComments:d,commentListMap:s,onSaveComment:a,onSaveSubComment:o})=>{let[i,c]=Re.useState(window.innerWidth<768),[m,C]=Re.useState(new Map),[b,w]=Re.useState(!1),[_,j]=Re.useState(null),[P]=ke.useForm(),[A,N]=Re.useState(!1),[I,R]=Re.useState(null),[T]=ke.useForm(),D=Re.useMemo(()=>{let v=new Set;return e.forEach(S=>{S.createBy&&v.add(S.createBy),s[S.id]?.comments.forEach(G=>{G.createBy&&v.add(G.createBy)})}),Array.from(v)},[e,s]);Re.useEffect(()=>{if(D.length===0)return;let v=!0;return ut.getUserInfos({userIds:D}).then(S=>{v&&C(G=>new Map([...G,...S]))}).catch(S=>{console.error("\u52A0\u8F7D\u8BC4\u8BBA\u7528\u6237\u4FE1\u606F\u5931\u8D25:",S)}),()=>{v=!1}},[D]),yr(()=>{c(!0)},()=>{c(!1)},768);let O=async v=>{j(v),P.resetFields(),w(!0)},x=v=>{v?(R(v),T.setFieldsValue({descs:v.descs,progressTime2:Pr(v.progressTime)})):(R(null),T.resetFields(),T.setFieldsValue({progressTime2:Pr()})),N(!0)},B=async()=>{try{if(!_)return;let v=await P.validateFields();if(!v)return;await o?.({commentId:_.id,comment:v.comment})&&(Y.success("\u56DE\u590D\u5DF2\u63D0\u4EA4"),w(!1),d?.(_.id))}catch(v){console.error(v),Y.error("\u63D0\u4EA4\u56DE\u590D\u5931\u8D25")}},W=async()=>{try{let v=await T.validateFields();I?(await a?.({commentItem:I,comment:v.descs,time:v.progressTime2.toDate()}),Y.success("\u66F4\u65B0\u6210\u529F")):(await a?.({commentItem:null,comment:v.descs,time:v.progressTime2.toDate()}),Y.success("\u65B0\u589E\u6210\u529F")),N(!1),R(null)}catch(v){console.error(v),Y.error("\u4FDD\u5B58\u5931\u8D25")}};return se(Mt,{children:[U("div",{className:"flex justify-end items-center mb-5 ml-4",children:U(gt,{type:"primary",onClick:()=>x(),className:"px-4 py-2 btn-primary flex items-center",children:"\u65B0\u589E"})}),e.length?U(Cs,{mode:"left",className:"ml-5 md:pr-[200px]",items:e.map(v=>({key:v.id,color:"blue",label:i&&t?null:Je(new Date(v.progressTime)),style:{paddingBottom:"5px"},children:se(Mt,{children:[i&&t&&U("div",{className:"mt-2 mb-1 font-bold",children:Je(new Date(v.progressTime))}),se("div",{className:"rounded border border-gray-100 bg-gray-50 p-2",children:[se("div",{className:"flex justify-between items-start mb-2 ",children:[se("div",{className:"flex items-center space-x-2",children:[U(Rr,{src:m.get(v.createBy)?.avatar?.avatar_small||null,size:40,children:m.get(v.createBy)?.nickname?.[0]}),se("div",{children:[U("div",{className:"",children:m.get(v.createBy)?.nickname}),U("div",{className:"text-xs font-thin",children:Je(new Date(v.updateTime))})]})]}),U("div",{className:"mt-4 flex justify-end absolute right-1 top-1",children:U(Is,{menu:{items:[{key:"edit",icon:U(Ts,{}),label:"\u7F16\u8F91",onClick:S=>{x?.(v),S.domEvent.stopPropagation()}},{key:"delete",icon:U(Ps,{}),label:"\u5220\u9664",danger:!0,onClick:S=>{n?.(v.id),S.domEvent.stopPropagation()}}]},trigger:["click"],children:U(gt,{type:"text",icon:U(ws,{}),onClick:S=>S.stopPropagation()})})})]}),U("div",{className:"whitespace-pre-wrap ml-2",style:{whiteSpace:"pre-wrap"},children:v.descs}),se("div",{className:"flex items-center space-x-1 mt-1",children:[U(gt,{type:"text",icon:U(xs,{}),className:"font-thin text-xs",size:"small",style:{color:"#666"},onClick:()=>O(v),children:"\u56DE\u590D"}),se(gt,{type:"text",size:"small",style:{color:"#666"},className:"font-thin text-xs",onClick:()=>d?.(v.id),children:[s[v.id]&&s[v.id].expanded?"\u6536\u8D77":"\u5C55\u5F00"+v.commentCount+"\u6761","\u56DE\u590D"]})]})]}),U("div",{className:"border-l border-gray-200 pl-3",children:s[v.id]&&s[v.id].expanded&&s[v.id].comments.length>0?s[v.id].comments.map(S=>U("div",{className:"p-1 text-sm",children:U("div",{className:"flex items-center space-y-2 mb-1 mt-1",children:se("div",{className:"flex items-center space-x-2",children:[U(Rr,{src:m.get(S.createBy)?.avatar?.avatar_small||null,size:40,className:"self-start",children:m.get(S.createBy)?.nickname?.[0]}),se("div",{children:[U("div",{className:"text-gray-600 text-xs",children:m.get(S.createBy)?.nickname}),U("div",{className:"text-gray-700",children:S.comment}),U("div",{className:"text-xs mt-1 font-thin",children:Je(new Date(S.createTime))})]})]})})},S.id)):U(Mt,{})})]})}))}):fr(),U(wr,{open:b,onCancel:()=>{j(null),w(!1)},className:"ant-modal-nofull",onOk:B,okText:"\u63D0\u4EA4",cancelText:"\u53D6\u6D88",children:U(ke,{form:P,layout:"horizontal",className:"mt-6",children:U(ke.Item,{name:"comment",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56DE\u590D\u5185\u5BB9"}],children:U(Tr.TextArea,{rows:4,placeholder:"\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u590D"})})})}),U(wr,{title:I?"\u7F16\u8F91":"\u65B0\u589E",open:A,className:"ant-modal-nofull",onCancel:()=>{N(!1),R(null)},onOk:W,okText:"\u4FDD\u5B58",cancelText:"\u53D6\u6D88",children:se(ke,{form:T,layout:"horizontal",children:[r&&U(ke.Item,{name:"progressTime2",label:"\u65F6\u95F4",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u65F6\u95F4"}],children:U(Rs,{showTime:!0,style:{width:"100%"}})}),U(ke.Item,{name:"descs",label:"\u5185\u5BB9",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5185\u5BB9"}],children:U(Tr.TextArea,{rows:4,placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9"})})]})})]})};import{useEffect as Qe,useState as Ae,useCallback as we,useRef as Lt,useMemo as xr}from"react";import{Select as Ss,Spin as _s,message as ks,Popover as zt,Card as Ns,Typography as Us,Space as Ds}from"antd";import{debounce as Es}from"lodash-es";import js from"react-dom/client";var Ft=class{constructor(){F(this,"cache",new Map);F(this,"defaultExpireTime",300*1e3)}set(t,r,n=this.defaultExpireTime){this.cache.set(t,{data:r,timestamp:Date.now(),expireTime:n})}get(t){let r=this.cache.get(t);return r?Date.now()-r.timestamp>r.expireTime?(this.cache.delete(t),null):r.data:null}clear(){this.cache.clear()}},Bt=new Ft;import{jsx as z,jsxs as Sr}from"react/jsx-runtime";var{Text:Wa}=Us,Va=({multiple:e=!1,allowClear:t=!0,timeout:r=1e4,retryCount:n=3,enableCache:d=!0,excludeProjectIds:s=[],cacheExpireTime:a,value:o,onChange:i,...c})=>{let[m,C]=Ae(!1),[b,w]=Ae([]),[_,j]=Ae(""),[P,A]=Ae(1),[N,I]=Ae(!0),[R,T]=Ae([]),D=Lt(null),O=Lt([]),x=Lt([]);Qe(()=>{O.current=b},[b]),Qe(()=>{x.current=R},[R]);let B=we(g=>g.map(y=>{let h=O.current.find(u=>u.id===y);return h||x.current.find(u=>u.id===y)}).filter(y=>y!==void 0),[]),W=we(g=>{if(!g){T([]),i?.([],[]);return}let y=e?Array.isArray(g)?g:[g]:typeof g=="string"?[g]:[];if(y.length===0){T([]),i?.([],[]);return}let h=B(y);T(h),i?.(y,h)},[B,i,e]);Qe(()=>{if(!o||o.length==0){T([]);return}let g=e?Array.isArray(o)?o:[]:typeof o=="string"?[o]:[],y=B(g);T(y)},[o,B,e]);let v=we(async(g,y=n)=>{try{D.current=new AbortController;let h=D.current.signal,u=new Promise((p,E)=>{setTimeout(()=>{E(new Error("\u8BF7\u6C42\u8D85\u65F6")),D.current?.abort()},r)});return await Promise.race([g(),u])}catch(h){if(y>0&&!(h instanceof Error&&h.name==="AbortError"))return await new Promise(u=>setTimeout(u,1e3)),v(g,y-1);throw h}},[r,n]),S=we(async(g,y=!1)=>{try{C(!0);let h=`projects_${g}`;if(d&&!g){let f=Bt.get(h);if(f){w(p=>y?[...p,...f]:f),I(!1);return}}let u=await v(async()=>{let f=await ne.project.project.listProjects({pageNum:P,pageSize:1e3});return f.code===200&&f.data?{...f,data:f.data.list.map(p=>({id:p.id,name:p.name,descs:p.descs}))}:f});if(u.code===200&&u.data){let f=u.data.filter(p=>!s.includes(p.id));d&&!g&&Bt.set(h,f,a),w(p=>y?[...p,...f]:f),I(!1)}}catch(h){console.error("\u83B7\u53D6\u9879\u76EE\u5217\u8868\u5931\u8D25:",h),ks.error("\u83B7\u53D6\u9879\u76EE\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{C(!1)}},[s,v,P,d,a]);Qe(()=>()=>{D.current?.abort()},[]);let G=xr(()=>Es(g=>{j(g),A(1),S(g,!1)},300),[S]),K=we(g=>{let{target:y}=g;if(!y)return;let{scrollTop:h,scrollHeight:u,clientHeight:f}=y;if(u-h<=f*1.5&&!m&&N){let p=P+1;A(p),S(_,!0)}},[m,N,P,_,S]);Qe(()=>{S("",!1)},[S]);let X=g=>z(Ns,{size:"small",style:{width:280},children:z(Ds,{direction:"vertical",size:"small",style:{width:"100%"},children:z("div",{style:{display:"flex",alignItems:"center",gap:8},children:z("div",{children:z("div",{style:{fontWeight:"bold"},children:g.name})})})})}),fe=g=>{let y=[];return y.push(z("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:g.name},"name")),z("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:y})},ye=xr(()=>b.map(g=>({key:g.id,label:fe(g),value:g.id,user:g})),[b]),oe=we(g=>{let{value:y,closable:h,onClose:u}=g,f=b.find(p=>p.id===y)||R.find(p=>p.id===y);return f?z(zt,{content:X(f),trigger:"click",placement:"right",children:Sr("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[z("span",{style:{marginRight:8},children:f.name}),h&&z("span",{onClick:u,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):z("div",{children:y})},[b,R]),he=we(g=>{let y=b.find(h=>h.id===g)||R.find(h=>h.id===g);return y?z(zt,{content:X(y),trigger:"click",placement:"right",children:z("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:z("span",{children:y.name})})}):z("div",{children:g})},[b,R]),me=we(g=>{if(!g)return null;let y=Array.isArray(g)?g[0]:g;return b.find(h=>h.id===y)||R.find(h=>h.id===y)},[b,R]);return z(Ss,{...c,mode:e?"multiple":void 0,showSearch:!0,loading:m,filterOption:!1,onSearch:G,onPopupScroll:K,notFoundContent:m?z(_s,{size:"small"}):null,allowClear:t,value:e||typeof o=="string"?o:o?.toString(),onChange:W,options:ye,style:{...c.style,minHeight:"32px"},tagRender:e?oe:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:g=>{let y=me(o);return y?Sr("div",{children:[z("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:he(y.id)}),g]}):g},suffixIcon:e?void 0:o?z("div",{onClick:g=>{g.stopPropagation();let y=me(o);if(y){let h=document.createElement("div");document.body.appendChild(h);let u=js.createRoot(h);u.render(z(zt,{content:X(y),trigger:"click",placement:"right",open:!0,onOpenChange:f=>{f||(u.unmount(),document.body.removeChild(h))},children:z("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:z("span",{className:"ant-select-arrow"})}):z("span",{className:"ant-select-arrow"})})};import{useEffect as Ze,useState as Oe,useCallback as Te,useRef as $t,useMemo as Nr}from"react";import{Select as qs,Spin as $s,message as Xs,Popover as Xt,Card as Gs,Typography as Js,Space as Ks}from"antd";import{debounce as Qs}from"lodash-es";import Ys from"react-dom/client";import As from"dexie";var Os=3600*1e3,Ht=class extends As{constructor(){super("RoleInfoDB");F(this,"roleCache");this.version(1).stores({roleCache:"id, timestamp"})}},Ye=new Ht,Ms=async()=>{try{let e=await Ye.roleCache.get("ROLE_ALL");if(e){if(Date.now()-e.timestamp<Os)return e.data;await Ye.roleCache.delete("ROLE_ALL")}return null}catch(e){return console.error("\u8BFB\u53D6\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e),null}},Fs=async e=>{try{await Ye.roleCache.put({id:"ROLE_ALL",data:e,timestamp:Date.now()})}catch(t){console.error("\u5199\u5165\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",t)}},Bs=async()=>{try{await Ye.roleCache.clear()}catch(e){console.error("\u6E05\u9664\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e)}},Vt=async({forceRefresh:e=!1})=>{if(!e){let n=await Ms();if(n)return n}let t=await ne.user.role.listRoles();if(t?.code!==200)return null;let r=t.data||[];return await Fs(r),r},_r=async({roleId:e,forceRefresh:t=!1})=>{let r=await Vt({forceRefresh:t});return r&&r.find(n=>n.id===e)||null},Ls=async({roleId:e,forceRefresh:t=!1})=>(await _r({roleId:e,forceRefresh:t}))?.name||"",Wt=async({forceRefresh:e=!1}={})=>{let t=await Vt({forceRefresh:e}),r={};return(t||[]).forEach(n=>{r[n.id]=n.name}),r},zs=async({roleIds:e})=>{let t=await Wt();return(e||[]).filter(n=>!!n&&!t[n]).length>0&&(t=await Wt({forceRefresh:!0})),t},Hs=async()=>{await Bs()},Ws=async()=>{try{let e=await Ye.roleCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},kr={getRoleList:Vt,getRoleById:_r,getRoleNameById:Ls,getRoleNameMap:Wt,getRoleNameMapForIds:zs,clearRoleCache:Hs,getCacheStats:Ws};var qt=class{constructor(){F(this,"cache",new Map);F(this,"defaultExpireTime",300*1e3)}set(t,r,n=this.defaultExpireTime){this.cache.set(t,{data:r,timestamp:Date.now(),expireTime:n})}get(t){let r=this.cache.get(t);return r?Date.now()-r.timestamp>r.expireTime?(this.cache.delete(t),null):r.data:null}clear(){this.cache.clear()}},pt=new qt;function Vs(){pt.clear()}import{jsx as H,jsxs as Ur}from"react/jsx-runtime";var{Text:cl}=Js,dl=({multiple:e=!1,allowClear:t=!0,timeout:r=1e4,retryCount:n=3,enableCache:d=!0,excludeRoleIds:s=[],cacheExpireTime:a,value:o,onChange:i,...c})=>{let[m,C]=Oe(!1),[b,w]=Oe([]),[_,j]=Oe(""),[P,A]=Oe(1),[N,I]=Oe(!0),[R,T]=Oe([]),D=$t(null),O=$t([]),x=$t([]);Ze(()=>{O.current=b},[b]),Ze(()=>{x.current=R},[R]);let B=Te(g=>g.map(y=>{let h=O.current.find(u=>u.id===y);return h||x.current.find(u=>u.id===y)}).filter(y=>y!==void 0),[]),W=Te(g=>{if(!g){T([]),i?.([],[]);return}let y=e?Array.isArray(g)?g:[g]:typeof g=="string"?[g]:g;if(y.length===0){T([]),i?.([],[]);return}let h=B(y);T(h),i?.(y,h)},[B,i,e]);Ze(()=>{if(!o||o.length==0){T([]);return}let g=e?Array.isArray(o)?o:[]:typeof o=="string"?[o]:[],y=B(g);if(R.length==y.length){let h=0;for(h=0;h<y.length&&!R.find(u=>u.id==y[h].id?u:null);h++);if(h<y.length)return}T(y)},[o,B,e]);let v=Te(async(g,y=n)=>{try{D.current=new AbortController;let h=D.current.signal,u=new Promise((p,E)=>{setTimeout(()=>{E(new Error("\u8BF7\u6C42\u8D85\u65F6")),D.current?.abort()},r)});return await Promise.race([g(),u])}catch(h){if(y>0&&!(h instanceof Error&&h.name==="AbortError"))return await new Promise(u=>setTimeout(u,1e3)),v(g,y-1);throw h}},[r,n]),S=Te(async(g,y=!1)=>{try{C(!0);let h=`roles_${g}`;if(d&&!g){let p=pt.get(h);if(p){w(E=>y?[...E,...p]:p),I(!1);return}}let f=(await v(async()=>await kr.getRoleList({forceRefresh:!0})||[])).filter(p=>!s.includes(p.id));d&&!g&&pt.set(h,f,a),w(p=>y?[...p,...f]:f),I(!1)}catch(h){console.error("\u83B7\u53D6\u89D2\u8272\u5217\u8868\u5931\u8D25:",h),Xs.error("\u83B7\u53D6\u89D2\u8272\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{C(!1)}},[s,v,d,a]);Ze(()=>()=>{D.current?.abort()},[]);let G=Nr(()=>Qs(g=>{j(g),A(1),S(g,!1)},300),[S]),K=Te(g=>{let{target:y}=g;if(!y)return;let{scrollTop:h,scrollHeight:u,clientHeight:f}=y;if(u-h<=f*1.5&&!m&&N){let p=P+1;A(p),S(_,!0)}},[m,N,P,_,S]);Ze(()=>{S("",!1)},[S]);let X=g=>H(Gs,{size:"small",style:{width:280},children:H(Ks,{direction:"vertical",size:"small",style:{width:"100%"},children:H("div",{style:{display:"flex",alignItems:"center",gap:8},children:H("div",{children:H("div",{style:{fontWeight:"bold"},children:g.name})})})})}),fe=g=>{let y=[];return y.push(H("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:g.name},"name")),H("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:y})},ye=Nr(()=>b.map(g=>({label:fe(g),value:g.id,user:g})),[b]),oe=Te(g=>{let{value:y,closable:h,onClose:u}=g,f=b.find(p=>p.id===y)||R.find(p=>p.id===y);return f?H(Xt,{content:X(f),trigger:"click",placement:"right",children:Ur("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[H("span",{style:{marginRight:8},children:f.name}),h&&H("span",{onClick:u,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):H("div",{children:y})},[b,R]),he=Te(g=>{let y=b.find(h=>h.id===g)||R.find(h=>h.id===g);return y?H(Xt,{content:X(y),trigger:"click",placement:"right",children:H("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:H("span",{children:y.name})})}):H("div",{children:g})},[b,R]),me=Te(g=>{if(!g)return null;let y=Array.isArray(g)?g[0]:g;return b.find(h=>h.id===y)||R.find(h=>h.id===y)},[b,R]);return H(qs,{...c,mode:e?"multiple":void 0,showSearch:!0,loading:m,filterOption:!1,onSearch:G,onPopupScroll:K,notFoundContent:m?H($s,{size:"small"}):null,allowClear:t,value:e||typeof o=="string"?o:o?.toString(),onChange:W,options:ye,style:{...c.style,minHeight:"32px"},tagRender:e?oe:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:g=>{let y=me(o);return y?Ur("div",{children:[H("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:he(y.id)}),g]}):g},suffixIcon:e?void 0:o?H("div",{onClick:g=>{g.stopPropagation();let y=me(o);if(y){let h=document.createElement("div");document.body.appendChild(h);let u=Ys.createRoot(h);u.render(H(Xt,{content:X(y),trigger:"click",placement:"right",open:!0,onOpenChange:f=>{f||(u.unmount(),document.body.removeChild(h))},children:H("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:H("span",{className:"ant-select-arrow"})}):H("span",{className:"ant-select-arrow"})})};import{useEffect as Me,useState as Fe,useCallback as Ne,useRef as Gt,useMemo as Jt}from"react";import{Select as Zs,Avatar as ft,Spin as eo,message as to,Popover as Kt,Card as ro,Typography as no,Space as so}from"antd";import{debounce as oo}from"lodash-es";import io from"react-dom/client";import{jsx as M,jsxs as pe}from"react/jsx-runtime";var{Text:et}=no,Il=({multiple:e=!1,userType:t="all",excludeUserIds:r=[],showAvatar:n=!0,showUsername:d=!0,showNickname:s=!0,showPhone:a=!0,searchFields:o=["username","nickname","phone"],pageSize:i=10,allowClear:c=!0,value:m,initialUsers:C,onChange:b,...w})=>{let[_,j]=Fe(!1),[P,A]=Fe([]),[N,I]=Fe(""),[R,T]=Fe(1),[D,O]=Fe(!0),[x,B]=Fe([]),W=Gt([]),v=Gt([]),S=Gt([]),G=Ne(u=>W.current.find(f=>f.id===u)||v.current.find(f=>f.id===u)||(S.current||[]).find(f=>f.id===u),[]);Me(()=>{S.current=C||[]},[C]);let K=Ne(async u=>{try{j(!0);let f=await ut.getUserInfos({keywords:u||"",forceRefresh:!1}),p=Array.from(f.values());p=p.filter(k=>k.username!=="admin"),t==="admin"?p=p.filter(k=>k.isAdmin):t==="user"&&(p=p.filter(k=>!k.isAdmin)),u&&(p=p.filter(k=>o.some(J=>{let Qt=k[J];return Qt&&Qt.toLowerCase().includes(u.toLowerCase())}))),r.length>0&&(p=p.filter(k=>!r.includes(k.id))),p.sort((k,J)=>(k.username||"").localeCompare(J.username||""));let E=p;A(k=>[...k,...E]),O(!1)}catch(f){console.error("\u83B7\u53D6\u4EBA\u5458\u5217\u8868\u5931\u8D25:",f),to.error("\u83B7\u53D6\u4EBA\u5458\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{j(!1)}},[t,r,o]);Me(()=>{K(null)},[K]),Me(()=>{W.current=P},[P]),Me(()=>{v.current=x},[x]);let X=Ne(u=>{if(!u||u.length==0){B([]),b?.([],[]);return}let f=Array.isArray(u)?u:[u],p=[];for(let E=0;E<f.length;E++){let k=f[E],J=G(k);J?p.push(J):p.push({id:k,username:k,nickname:"",phone:"",avatar:{avatar_small:""}})}if(x.length==p.length){let E=0;for(E=0;E<p.length&&!x.find(k=>k.id==p[E].id?k:null);E++);if(E<p.length)return}B(p.slice()),b?.(f,p)},[b,x]);Me(()=>{if(!m||m.length==0){if(!x||x.length==0)return;B([]);return}m.sort();let u=[];x&&(u=x.map(f=>f.id),u.sort()),m.join(",")!=u.join(",")&&X(m)},[m,e,X,x]),Me(()=>{if(!m||m.length==0)return;let f=m.map(p=>{let E=G(p);return E||{id:p,username:p,nickname:"",phone:"",type:null}}).filter(p=>p!==void 0);B(p=>p.length!==f.length||p.some((E,k)=>E.id!==f[k]?.id||E.username!==f[k]?.username)?f:p)},[P,m,C,G]);let fe=Jt(()=>oo(u=>{I(u),T(1),K(u)},300),[K]),ye=Ne(u=>{let{target:f}=u;if(!f)return;let{scrollTop:p,scrollHeight:E,clientHeight:k}=f;if(E-p<=k*1.5&&!_&&D){let J=R+1;T(J),K(N)}},[_,D,R,N,K]),oe=u=>M(ro,{size:"small",style:{width:280},children:pe(so,{direction:"vertical",size:"small",style:{width:"100%"},children:[pe("div",{style:{display:"flex",alignItems:"center",gap:8},children:[M(ft,{src:u?.avatar?.avatar_small,size:40,children:u.nickname?.[0]||u.username?.[0]}),pe("div",{children:[M("div",{style:{fontWeight:"bold"},children:u.nickname||u.username}),u.title&&M(et,{type:"secondary",style:{fontSize:12},children:u.title})]})]}),u.phone&&pe("div",{children:[M(et,{type:"secondary",style:{fontSize:12},children:"\u624B\u673A\u53F7\uFF1A"}),M(et,{style:{fontSize:12},children:u.phone})]}),u.departmentInfo?.department_names&&pe("div",{children:[M(et,{type:"secondary",style:{fontSize:12},children:"\u6240\u5C5E\u90E8\u95E8\uFF1A"}),M(et,{style:{fontSize:12},children:u.departmentInfo?.department_names.join("\u3001")})]})]})}),he=Jt(()=>u=>{let f=[];return n&&f.push(M(ft,{src:u?.avatar?.avatar_small,size:20,style:{marginRight:8,verticalAlign:"middle",flexShrink:0},children:u.nickname?.[0]||u.username?.[0]},"avatar")),s&&u.nickname&&f.push(M("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:u.nickname},"nickname")),d&&f.push(pe("span",{style:{marginLeft:8,color:"rgb(var(--color-gray-400))",verticalAlign:"middle",lineHeight:"20px"},children:["(",u.username,")"]},"username")),a&&u.phone&&f.push(M("span",{style:{marginLeft:8,color:"rgb(var(--color-gray-400))",verticalAlign:"middle",lineHeight:"20px"},children:u.phone},"phone")),M("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:f})},[n,d,s,a]),me=Jt(()=>[...P,...x].filter((p,E,k)=>k.findIndex(J=>J.id===p.id)===E).map(p=>({label:he(p),value:p.id,user:p})),[P,x,he]),g=Ne(u=>{let{value:f,closable:p,onClose:E}=u,k=P.find(J=>J.id===f)||x.find(J=>J.id===f)||(C||[]).find(J=>J.id===f);return k?M(Kt,{content:oe(k),trigger:"click",placement:"right",children:pe("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[M(ft,{src:k?.avatar?.avatar_small,size:20,style:{marginRight:8},children:k.nickname?.[0]||k.username?.[0]}),M("span",{style:{marginRight:8},children:k.nickname||k.username}),p&&M("span",{onClick:E,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):M("div",{children:f})},[P,x,C]),y=Ne(u=>{let f=P.find(p=>p.id===u)||x.find(p=>p.id===u)||(C||[]).find(p=>p.id===u);return f?M(Kt,{content:oe(f),trigger:"click",placement:"right",children:pe("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:[M(ft,{src:f?.avatar?.avatar_small,size:20,style:{marginRight:8},children:f.nickname?.[0]||f.username?.[0]}),M("span",{children:f.nickname||f.username})]})}):M("div",{children:u})},[P,x,C]),h=Ne(u=>{if(!u||u.length==0)return null;let f=u[0];return P.find(p=>p.id===f)||x.find(p=>p.id===f)||(C||[]).find(p=>p.id===f)},[P,x,C]);return M(Zs,{...w,mode:e?"multiple":void 0,showSearch:!0,loading:_,filterOption:!1,onSearch:fe,onPopupScroll:ye,notFoundContent:_?M(eo,{size:"small"}):null,allowClear:c,value:m,onChange:X,options:me,style:{...w.style,minHeight:"32px"},tagRender:e?g:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:u=>{let f=h(m);return f?pe("div",{children:[M("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:y(f.id)}),u]}):u},suffixIcon:e?void 0:m?M("div",{onClick:u=>{u.stopPropagation();let f=h(m);if(f){let p=document.createElement("div");document.body.appendChild(p);let E=io.createRoot(p);E.render(M(Kt,{content:oe(f),trigger:"click",placement:"right",open:!0,onOpenChange:k=>{k||(E.unmount(),document.body.removeChild(p))},children:M("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:M("span",{className:"ant-select-arrow"})}):M("span",{className:"ant-select-arrow"})})};import{useEffect as ao,useRef as lo,useState as jr}from"react";import{Upload as Er,Button as rt,Modal as co,Image as mo,Space as uo,message as go,Progress as po}from"antd";import{UploadOutlined as fo,DownloadOutlined as Ar,EyeOutlined as yo,FilePdfFilled as ho,FileExcelFilled as bo,FileWordFilled as vo,FileTextFilled as Co,FileUnknownFilled as Io}from"@ant-design/icons";import*as Be from"febs-browser";function Dr(e,t,r){r.method=r.method||"POST",r.headers=r.headers||{},r.timeout=r.timeout||5e3,r.withCredentials=r.withCredentials||!0,r.crossDomain=r.crossDomain||!0,r.sliceOffset=r.sliceOffset||0,r.sliceLength=r.sliceLength||-1;let n={success:r.success,method:r.method||"POST",url:r.url,mode:r.crossDomain!=!0?"same-origin":"cors",timeout:r.timeout||5e3};r=Be.utils.mergeMap(n,r||{});let d=Be.$(e);if(d.attr("enctype")&&d.attr("enctype").toLowerCase()==="multipart/form-data"){let a=new FormData,o=File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice,i=t.name,c=i.lastIndexOf("/");c>=0&&(i=i.substr(c+1)),c=i.lastIndexOf("\\"),c>=0&&(i=i.substr(c+1));let m=r.sliceLength||-1;m==-1&&(m=t.size-(r.sliceOffset||0));let C=o.call(t,r.sliceOffset,(r.sliceOffset||0)+m);a.append("file",C,i),r.data=a}else throw new Error("only support multipart/form-data");let s;return r.headers?s=r.headers:s={},s["Content-Type"]=!1,Be.net.ajax({url:r.url,type:r.method,headers:s,processData:!1,data:r.data,timeout:r.timeout,withCredentials:r.withCredentials,success:function(a){r.success&&r.success(a)},error:function(a,o,i){r.error&&r.error(i)},complete:r.complete,progress:r.progress})}var yt=class yt{static uploadSingle(t,r,n,d,s){new FormData().append("file",t);let o=document.createElement("form");o.setAttribute("enctype","multipart/form-data");let i={headers:{}};return i.headers.set=(c,m)=>{i.headers[c]=m},ge.requestHandleSid(i),delete i.headers.set,Dr(o,t,{url:yt.UPLOAD_SINGLE_URL+"?size="+t.size+"&crc32="+r,success:(c=>{c=JSON.parse(c),c.code===200?Y.success("\u6587\u4EF6\u4E0A\u4F20\u6210\u529F"):Y.error(c.message||"\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"),s&&s(c)}),error:(c=>{console.error("File upload error:",c),Y.error("\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"),d&&d(c)}),progress:n||(c=>{console.log(`\u4E0A\u4F20\u8FDB\u5EA6: ${c}%`)}),complete:c=>{},data:"",method:"POST",headers:i.headers,timeout:Number(import.meta.env.VITE_API_UPLOAD_TIMEOUT)||5e3,withCredentials:!0,crossDomain:!0,sliceOffset:0,sliceLength:-1})}static copyFromServer(t){return l.post(import.meta.env.VITE_API_BASE+"/api/fs/copy",{sourcePath:t},null)}};F(yt,"UPLOAD_SINGLE_URL",import.meta.env.VITE_API_BASE+"/api/fs/upload");var tt=yt;import*as Or from"febs-browser";import{jsx as L,jsxs as nt}from"react/jsx-runtime";var Ol=({fileList:e,onChange:t,onFinish:r,cancel:n,btnText:d="\u4E0A\u4F20\u6587\u4EF6",maxCount:s=5,disabled:a=!1,multiple:o=!0,accept:i=void 0})=>{let[c,m]=jr(void 0),C=lo(e);ao(()=>{C.current=e},[e]);let b=({fileList:N})=>{t?.(N)},w=N=>{t?.(C.current.filter(I=>I.uid!==N.uid))},_=N=>{let I=N.size/1024/1024<100;return I||go.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7100MB"),I||Er.LIST_IGNORE},j=async N=>{let{file:I,onSuccess:R,onError:T,onProgress:D}=N;try{I.status="uploading",I.percent=0,D({percent:0}),m(0),Or.crypt.crc32_file(I,O=>{if(O==0){I.status="error",T("calc crc32 error");return}let x=tt.uploadSingle(I,O,B=>{let W=Math.floor(B*100);D({percent:W}),I.percent=W,m(W)},B=>{m(void 0),T(B)},B=>{I.status="done",I.percent=100,m(void 0),R("ok"),r&&r([I],B).then(()=>{}).catch(()=>{})});I.cancel=()=>{x.abort(),I.status="error",I.percent=0,m(void 0),T(new Error("\u4E0A\u4F20\u5DF2\u53D6\u6D88")),w(I)}})}catch(O){I.status="error",m(void 0),T(O)}},P=c!==void 0&&c<100;return L(Er,{fileList:e,onChange:b,beforeUpload:_,customRequest:j,multiple:o,maxCount:s,disabled:a,itemRender:(N,I,R,T)=>P?nt("div",{className:"flex items-center justify-between w-full mt-2 rounded border border-blue-100 bg-blue-50 px-3 py-2",children:[L("span",{className:"mr-3 min-w-0 max-w-[120px] flex-1 truncate text-sm text-gray-700",children:I.name}),L(po,{className:"w-[60px]",percent:Math.round(I.percent||0),size:"small",status:"active",showInfo:!0}),L(rt,{className:"ml-3",size:"small",onClick:()=>{n?n(I):I.cancel?.(),w(I)},danger:!0,children:"\u53D6\u6D88"})]}):null,accept:i,showUploadList:!0,children:!P&&L(rt,{icon:L(fo,{}),disabled:a||P,title:o?`\u4E0A\u4F20\u6587\u4EF6\uFF08\u6700\u591A\u652F\u6301${s}\u4E2A\u6587\u4EF6\uFF0C\u5355\u4E2A\u6587\u4EF6\u4E0D\u8D85\u8FC7100MB\uFF09`:"\u4E0A\u4F20\u6587\u4EF6\uFF08\u5355\u4E2A\u6587\u4EF6\u4E0D\u8D85\u8FC7100MB\uFF09",children:P?nt("span",{className:"inline-block w-[85px]",children:["\u4E0A\u4F20\u4E2D ",c,"%"]}):d})})},Ml=({files:e=[],onPreview:t,onDownload:r})=>e.length===0?null:L("div",{className:"p-4 bg-gray-50 rounded",children:e.map((n,d)=>nt("div",{className:"flex items-center mb-2",children:[Mr(n),L("span",{className:"mr-2",children:n.name}),nt(uo,{children:[t&&L(rt,{type:"link",size:"small",icon:L(yo,{}),onClick:()=>t(n),children:"\u67E5\u770B"}),r&&L(rt,{type:"link",size:"small",icon:L(Ar,{}),onClick:()=>r(n),children:"\u4E0B\u8F7D"})]})]},n.uid||d))}),Mr=e=>{let t=e.type||"";return t.includes("pdf")?L(ho,{className:"mr-2 text-red-500"}):t.includes("excel")||t.includes("spreadsheet")||e.name.endsWith(".xlsx")||e.name.endsWith(".xls")?L(bo,{className:"mr-2 text-green-500"}):t.includes("word")||t.includes("document")||e.name.endsWith(".docx")||e.name.endsWith(".doc")?L(vo,{className:"mr-2 text-blue-500"}):t.includes("image")?L(Co,{className:"mr-2 text-purple-500"}):L(Io,{className:"mr-2 text-gray-500"})},Fl=({visible:e,file:t,onClose:r,onDownload:n})=>{if(!t)return null;let[d,s]=jr(""),a=t.name||"",o=t.type?.startsWith("image/");return o&&it(t,i=>{s(i||"")}),L(co,{open:e,title:a,footer:null,onCancel:r,width:800,children:o?L(mo,{alt:a,style:{width:"100%"},src:d}):nt("div",{className:"text-center p-8",children:[L("div",{className:"text-6xl mb-4",children:Mr(t)}),L("p",{className:"mb-4",children:a}),L("p",{className:"text-gray-500 mb-4",children:"\u8BE5\u6587\u4EF6\u7C7B\u578B\u65E0\u6CD5\u76F4\u63A5\u9884\u89C8"}),n&&L(rt,{type:"primary",icon:L(Ar,{}),onClick:()=>n(t),children:"\u4E0B\u8F7D\u6587\u4EF6\u67E5\u770B"})]})})};export{ka as CommentTimeline,tt as FileUploadHandler,Va as ProjectSelector,Hi as ResizableTable,dl as RoleSelector,wi as SingletonToastProvider,vt as UIDatePicker,Vo as UIDateRangePicker,Ml as UIFileList,Ol as UIFileUpload,Fl as UIFileUploadPreviewModal,ri as UIImageUpload,vn as UILoading,fi as UISelect,Oi as UITableGridViewToggle,Ri as UIToast,ki as UIToastSingle,Ni as UIToastSingleProvider,Hn as UIViewToggle,Il as UserSelector,Vs as clearRoleCache,It as compressImage,So as uiAlert,jo as uiConfirm,ve as uiLoading,Y as uiToast};
1
+ var Yt=Object.defineProperty;var Fr=(e,t,r)=>t in e?Yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ht=(e,t)=>{for(var r in t)Yt(e,r,{get:t[r],enumerable:!0})};var F=(e,t,r)=>Fr(e,typeof t!="symbol"?t+"":t,r);import{Modal as Br,Button as st,Space as Zt,Typography as Lr}from"antd";import{CheckCircleFilled as zr,CloseCircleFilled as Hr,ExclamationCircleFilled as Wr,InfoCircleFilled as Vr,QuestionCircleFilled as qr}from"@ant-design/icons";import{createRoot as $r}from"react-dom/client";import{jsx as q,jsxs as er}from"react/jsx-runtime";var{Text:Xr,Title:Gr}=Lr,tr={type:"info",title:"\u63D0\u793A",content:"",width:420,centered:!0,closable:!0,maskClosable:!0,okText:"\u786E\u5B9A",okType:"primary",cancelText:"\u53D6\u6D88",autoClose:0,showIcon:!1},Z=null,Q=null,Le=null,ot=e=>{let{type:t="info",title:r,content:n,width:d,centered:s,closable:a,maskClosable:o,okText:i,okType:c,cancelText:m,buttons:C,onOk:b,onCancel:w,open:_,onClose:j,className:P,showIcon:A}=e,N={success:q(zr,{style:{color:"#52c41a",fontSize:24,marginRight:8}}),error:q(Hr,{style:{color:"#ff4d4f",fontSize:24,marginRight:8}}),warning:q(Wr,{style:{color:"#faad14",fontSize:24,marginRight:8}}),info:q(Vr,{style:{color:"#1677ff",fontSize:24,marginRight:8}}),confirm:q(qr,{style:{color:"#1677ff",fontSize:24,marginRight:8}})},I=async()=>{b&&await b(),j()},R=()=>{w&&w(),j()},T=()=>C&&C.length>0?q(Zt,{style:{display:"flex",justifyContent:"flex-end"},children:C.map((O,x)=>q(st,{type:O.type||"default",onClick:()=>{O.onClick&&O.onClick(),j()},children:O.text},x))}):t==="confirm"?er(Zt,{style:{display:"flex",justifyContent:"flex-end"},children:[q(st,{onClick:R,children:m}),q(st,{type:c,onClick:I,children:i})]}):q(st,{type:c,onClick:I,children:i});return q(Br,{title:r?er("div",{style:{display:"flex",alignItems:"center"},children:[A&&N[t],q(Gr,{level:4,style:{margin:0},children:r})]}):null,open:_,width:d,centered:s,closable:a,maskClosable:o,onCancel:R,footer:T(),className:P?P+" ant-modal-nofull":"ant-modal-nofull",children:q("div",{style:{marginLeft:A?32:0},children:typeof n=="string"?q(Xr,{children:n}):n})})},Ue=(e,t=!0)=>{Le&&(window.clearTimeout(Le),Le=null);let r={...tr,...e},n=()=>{Z&&Q&&Q.render(q(ot,{...r,open:!1,onClose:()=>{r.afterClose&&r.afterClose(),Z&&Q&&setTimeout(()=>{Q?.unmount(),document.body.removeChild(Z),Z=null,Q=null},300)}}))};return Z&&Q?Q.render(q(ot,{...r,open:t,onClose:n})):(Z=document.createElement("div"),document.body.appendChild(Z),Q=$r(Z),Q.render(q(ot,{...r,open:t,onClose:n}))),r.autoClose&&r.autoClose>0&&(Le=window.setTimeout(()=>{n(),Le=null},r.autoClose)),n},So={success:e=>{let t=typeof e=="string"?{content:e}:e;return Ue({...t,type:"success",title:t.title||"\u6210\u529F"})},error:e=>{let t=typeof e=="string"?{content:e}:e;return Ue({...t,type:"error",title:t.title||"\u9519\u8BEF"})},warning:e=>{let t=typeof e=="string"?{content:e}:e;return Ue({...t,type:"warning",title:t.title||"\u8B66\u544A"})},info:e=>{let t=typeof e=="string"?{content:e}:e;return Ue({...t,type:"info",title:t.title||"\u63D0\u793A"})},confirm:e=>{let t=typeof e=="string"?{content:e}:e;return Ue({...t,type:"confirm",title:t.title||"\u786E\u8BA4"})},custom:e=>Ue(e),close:()=>{Z&&Q&&Q.render(q(ot,{...tr,open:!1,onClose:()=>{Z&&Q&&(Q.unmount(),document.body.removeChild(Z),Z=null,Q=null)}}))}};import{Modal as Jr,Button as rr,Space as Kr}from"antd";import{ExclamationCircleFilled as Qr,InfoCircleFilled as Yr,QuestionCircleFilled as Zr,WarningFilled as en}from"@ant-design/icons";import{createRoot as tn}from"react-dom/client";import{jsx as re,jsxs as sr}from"react/jsx-runtime";var rn={type:"confirm",title:"\u786E\u8BA4",content:"",width:420,centered:!0,closable:!0,maskClosable:!1,okText:"\u786E\u5B9A",okType:"primary",cancelText:"\u53D6\u6D88",showIcon:!1,keyboard:!0,autoFocusButton:"ok",zIndex:2e4},ie=null,ae=null,nr=e=>{let{type:t="confirm",title:r,content:n,width:d,centered:s,closable:a,maskClosable:o,okText:i,okType:c,cancelText:m,okButtonProps:C,cancelButtonProps:b,onOk:w,onCancel:_,open:j,onClose:P,className:A,showIcon:N,zIndex:I,keyboard:R,autoFocusButton:T}=e,D={confirm:re(Zr,{style:{color:"#1677ff",fontSize:22,marginRight:12}}),warning:re(Qr,{style:{color:"#faad14",fontSize:22,marginRight:12}}),info:re(Yr,{style:{color:"#1677ff",fontSize:22,marginRight:12}}),error:re(en,{style:{color:"#ff4d4f",fontSize:22,marginRight:12}})},O=async()=>{try{if(w){let W=w();W instanceof Promise&&await W}P(!0)}catch(W){console.error("Confirm onOk error:",W)}},x=()=>{_&&_(),P(!1)};return re(Jr,{title:r?sr("div",{style:{display:"flex",alignItems:"center"},children:[N&&D[t],re("span",{children:r})]}):null,open:j,width:d,centered:s,closable:a,maskClosable:o,onCancel:x,className:A?A+" ant-modal-nofull":"ant-modal-nofull",zIndex:I,keyboard:R,footer:sr(Kr,{children:[re(rr,{onClick:x,...b,autoFocus:T==="cancel",children:m}),re(rr,{type:c,onClick:O,...C,autoFocus:T==="ok",children:i})]}),children:re("div",{style:{marginLeft:N?34:0},children:n})})},ze=e=>{let t={...rn,...e};return ie&&ae&&(ae.unmount(),document.body.removeChild(ie),ie=null,ae=null),new Promise(r=>{let n=d=>{ie&&ae&&ae.render(re(nr,{...t,open:!1,onClose:s=>{t.afterClose&&t.afterClose(),setTimeout(()=>{ie&&ae&&(ae.unmount(),document.body.removeChild(ie),ie=null,ae=null),r(s)},300)}})),r(d)};ie=document.createElement("div"),document.body.appendChild(ie),ae=tn(ie),ae.render(re(nr,{...t,open:!0,onClose:n}))})},jo={confirm:e=>ze({...typeof e=="string"?{content:e,showIcon:!1,title:""}:e,type:"confirm"}),warning:e=>{let t=typeof e=="string"?{content:e}:e;return ze({...t,type:"warning",title:t.title||"\u8B66\u544A"})},info:e=>{let t=typeof e=="string"?{content:e}:e;return ze({...t,type:"info",title:t.title||"\u4FE1\u606F"})},error:e=>{let t=typeof e=="string"?{content:e}:e;return ze({...t,type:"error",title:t.title||"\u9519\u8BEF"})},custom:e=>ze(e)};import{useState as nn,useRef as sn,useEffect as on}from"react";import{Calendar as an,ChevronLeft as ln,ChevronRight as cn}from"lucide-react";import{Button as bt}from"antd";import{jsx as V,jsxs as He}from"react/jsx-runtime";function vt({value:e,onChange:t,type:r="date",placeholder:n="\u9009\u62E9\u65E5\u671F",className:d=""}){let[s,a]=nn(!1),o=sn(null),i=e?c(e,r):"";on(()=>{function b(w){o.current&&!o.current.contains(w.target)&&a(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]);function c(b,w){if(!b)return"";try{if(w==="month"){let[_,j]=b.split("-");return`${_}\u5E74${j}\u6708`}else return new Date(b).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"})}catch{return b}}let m=b=>{t(b.target.value)},C=()=>{a(!s)};return He("div",{className:`relative ${d}`,ref:o,children:[He("div",{className:"relative cursor-pointer",children:[V("input",{type:r,value:e,onChange:m,onClick:C,className:"w-full bg-white border border-ios-gray-200 rounded-ios py-2.5 pl-3 pr-10 text-sm text-ios-gray-700 shadow-ios focus:outline-none focus:ring-2 focus:ring-ios-blue-400 focus:border-transparent transition-all duration-200 hover:border-ios-blue-300 cursor-pointer",placeholder:n}),V("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none",children:V(an,{className:"h-4 w-4 text-ios-gray-400"})})]}),s&&He("div",{className:"absolute z-10 mt-1 bg-white rounded-ios shadow-ios-md p-4 ring-1 ring-ios-gray-200 ring-opacity-5",children:[He("div",{className:"flex justify-between items-center mb-4",children:[V(bt,{type:"text",className:"p-1.5 hover:bg-ios-gray-100 rounded-full transition-colors duration-150",icon:V(ln,{className:"h-4 w-4 text-ios-gray-600"})}),V("span",{className:"text-sm font-medium text-ios-gray-700",children:"2024\u5E745\u6708"}),V(bt,{type:"text",className:"p-1.5 hover:bg-ios-gray-100 rounded-full transition-colors duration-150",icon:V(cn,{className:"h-4 w-4 text-ios-gray-600"})})]}),He("div",{className:"grid grid-cols-7 gap-1 text-center text-xs",children:[V("div",{className:"text-ios-gray-500 font-medium",children:"\u65E5"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E00"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E8C"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E09"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u56DB"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E94"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u516D"}),V("div",{className:"text-ios-gray-300 py-1.5",children:"30"}),V("div",{className:"text-ios-gray-300 py-1.5",children:"31"}),Array.from({length:30}).map((b,w)=>V("div",{className:`py-1.5 hover:bg-ios-blue-50 rounded-full cursor-pointer transition-colors duration-150 ${w===14?"bg-ios-blue-500 text-white":"text-ios-gray-700"}`,onClick:()=>{let _=w+1,j=`2024-05-${_<10?"0"+_:_}`;t(j),a(!1)},children:w+1},w))]}),V("div",{className:"mt-4 flex justify-end",children:V(bt,{type:"text",className:"px-4 py-1.5 text-sm text-ios-blue-500 hover:bg-ios-blue-50 rounded-ios transition-colors duration-150",onClick:()=>a(!1),children:"\u786E\u5B9A"})})]})]})}import{jsx as Ct,jsxs as dn}from"react/jsx-runtime";function Vo({startDate:e,endDate:t,onStartDateChange:r,onEndDateChange:n,type:d="date",className:s=""}){return dn("div",{className:`flex items-center space-x-2 ${s}`,children:[Ct(vt,{value:e,onChange:r,type:d,placeholder:"\u5F00\u59CB\u65E5\u671F"}),Ct("span",{className:"text-gray-500",children:"\u81F3"}),Ct(vt,{value:t,onChange:n,type:d,placeholder:"\u7ED3\u675F\u65E5\u671F"})]})}import{useState as We,useRef as mn}from"react";import{Button as Rt,Modal as un,message as wt}from"antd";import{UploadOutlined as gn}from"@ant-design/icons";import pn from"react-image-crop";import"react-image-crop/dist/ReactCrop.css";function it(e,t){let r=new FileReader;r.readAsDataURL(e),r.onload=function(){t(r.result)},r.onerror=function(){t(null)},r.onabort=function(){t(null)}}function It(e,t,r,n){t=t>0?t:1024;let d=t,s=t,a=new Image;a.addEventListener("load",function(o){let i,c=!1;if(d<a.naturalWidth&&(c=!0,i=a.naturalWidth/d,s=a.naturalHeight/i),s<a.naturalHeight&&(c=!0,i=a.naturalHeight/s,d=a.naturalWidth/i),!c){d=a.naturalWidth,s=a.naturalHeight,n&&n(e,d,s);return}let m=document.createElement("canvas");m.width=d,m.height=s;let C=m.getContext("2d");C?.clearRect(0,0,d,s),C?.drawImage(a,0,0,d,s);let b=m.toDataURL(r||"image/png");m=null,n&&n(b,d,s)}),a.src=e}import{jsx as ue,jsxs as fn}from"react/jsx-runtime";var ri=({onUpload:e,accept:t="image/*",maxSize:r=5,aspectRatio:n,className:d="",useBase64:s=!1,id:a})=>{let[o,i]=We(!1),[c,m]=We(""),[C,b]=We({unit:"%",width:90,height:90,x:5,y:5}),[w,_]=We(null),[j,P]=We(null),A=mn(null),N=R=>{let T=R.target.files?.[0];if(!T)return;if(T.size>r*1024*1024){wt.error(`\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${r}MB`);return}if(!T.type.startsWith("image/")){wt.error("\u8BF7\u4E0A\u4F20\u56FE\u7247\u6587\u4EF6");return}P(T);let D=new FileReader;D.onload=O=>{m(O.target?.result),i(!0)},D.readAsDataURL(T)},I=async R=>{if(!w||!j)return;let T=w.width,D=w.height,O=w.naturalWidth/T,x=w.naturalHeight/D,B=R.unit=="%"?T/100:1,W=R.unit=="%"?D/100:1,v=R.x*O*B,S=R.y*x*W,G=R.width*O*B,K=R.height*x*W;try{let X=document.createElement("canvas");X.width=G,X.height=K;let fe=X.getContext("2d");if(!fe)return;fe.drawImage(w,v,S,G,K,0,0,G,K),X.toBlob(ye=>{if(!ye)return;let oe=new File([ye],j.name,{type:j.type});if(s){it(oe,he=>{It(he,0,"image/jpeg",me=>{i(!1),e(me)})});return}else i(!1),e(oe)},j.type),i(!1),m(""),P(null),A.current&&(A.current.value="")}catch{wt.error("\u56FE\u7247\u5904\u7406\u5931\u8D25")}};return fn("div",{className:d,children:[ue("input",{type:"file",ref:A,accept:t,onChange:N,style:{display:"none"}}),ue(Rt,{id:a,icon:ue(gn,{}),onClick:()=>A.current?.click(),className:"btn-primary",children:"\u9009\u62E9\u56FE\u7247"}),ue(un,{title:"\u88C1\u526A\u56FE\u7247",open:o,onCancel:()=>{i(!1),m(""),P(null),A.current&&(A.current.value="")},footer:[ue(Rt,{onClick:()=>i(!1),className:"btn-outline",children:"\u53D6\u6D88"},"cancel"),ue(Rt,{type:"primary",onClick:()=>I(C),className:"btn-primary",children:"\u786E\u8BA4"},"confirm")],width:500,children:ue("div",{className:"flex justify-center",children:c&&ue(pn,{crop:C,onChange:R=>b(R),aspect:n,className:"max-w-full",children:ue("img",{src:c,alt:"\u9884\u89C8",ref:R=>_(R),className:"max-w-full"})})})})]})};import{Spin as yn}from"antd";import{LoadingOutlined as hn}from"@ant-design/icons";import{createRoot as bn}from"react-dom/client";import{jsx as Ve}from"react/jsx-runtime";var or=Symbol("loading");function ir(){let e=window[or];return e||(e={count:0,timeoutId:0,inTimeout:!1},window[or]=e),e}var lr={tip:"",fullscreen:!0,delay:0,mask:!0,iconSize:40,wrapperClassName:"ui-loading-wrapper"},vn=e=>{let t={...lr,...e},{tip:r,fullscreen:n,mask:d,maskStyle:s,iconSize:a,iconStyle:o,containerStyle:i,wrapperClassName:c}=t,m=Ve(hn,{style:{fontSize:a,color:"#1677ff",...o},spin:!0}),C=n?{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9999,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:d?"rgba(0, 0, 0, 0.45)":"transparent",...s}:{},b={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...i};return Ve("div",{style:C,className:c,children:Ve("div",{style:b,children:Ve(yn,{indicator:m,children:r})})})},le=null,be=null,ar=(e={})=>(le&&be&&(be.unmount(),document.body.removeChild(le),le=null,be=null),le=document.createElement("div"),document.body.appendChild(le),be=bn(le),be.render(Ve(vn,{...e})),le),ve={show:(e={})=>{let t=ir();t.count++;let r={...lr,...e};if(r.delay&&r.delay>0){t.timeoutId!=0&&(window.clearTimeout(t.timeoutId),t.timeoutId=0),t.timeoutId=window.setTimeout(()=>{t.timeoutId=0,ar(r)},r.delay);return}else ar(r)},hide:()=>{let e=ir();if(e.count<=0){console.warn("Loading count is less than 0");return}e.count--,e.timeoutId!=0&&(window.clearTimeout(e.timeoutId),e.timeoutId=0),e.count==0&&le&&be&&(be.unmount(),document.body.removeChild(le),le=null,be=null)},service:(e,t={})=>(ve.show(t),e.then(r=>(ve.hide(),r)).catch(r=>{throw ve.hide(),r}))};import{useState as Cn,useRef as In,useEffect as Rn}from"react";import{ChevronDown as wn}from"lucide-react";import{Button as Tn}from"antd";import{jsx as Ce,jsxs as Tt}from"react/jsx-runtime";function fi({options:e,value:t,onChange:r,placeholder:n="\u8BF7\u9009\u62E9",className:d=""}){let[s,a]=Cn(!1),o=In(null),i=e.find(c=>c.value===t);return Rn(()=>{function c(m){o.current&&!o.current.contains(m.target)&&a(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]),Tt("div",{className:`relative ${d}`,ref:o,children:[Tt(Tn,{type:"text",onClick:()=>a(!s),className:"w-full bg-white border border-ios-gray-200 rounded-ios py-2.5 pl-3 pr-10 text-left shadow-ios focus:outline-none focus:ring-2 focus:ring-ios-blue-400 focus:border-transparent transition-all duration-200 hover:border-ios-blue-300",children:[Ce("span",{className:"block truncate text-sm text-ios-gray-700",children:i?i.label:n}),Ce("span",{className:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none",children:Ce(wn,{className:`h-4 w-4 text-ios-gray-400 transition-transform duration-200 ${s?"transform rotate-180":""}`})})]}),s&&Ce("div",{className:"absolute z-10 mt-1 w-full bg-white shadow-ios-md max-h-60 rounded-ios py-1 text-base ring-1 ring-ios-gray-200 ring-opacity-5 overflow-auto focus:outline-none sm:text-sm",children:e.map(c=>Tt("div",{className:`cursor-pointer select-none relative py-2.5 pl-3 pr-9 hover:bg-ios-blue-50 transition-colors duration-150 ${c.value===t?"bg-ios-blue-50 text-ios-blue-600 font-medium":"text-ios-gray-700"}`,onClick:()=>{r(c.value),a(!1)},children:[Ce("span",{className:"block truncate text-sm",children:c.label}),c.value===t&&Ce("span",{className:"absolute inset-y-0 right-0 flex items-center pr-4 text-ios-blue-500",children:Ce("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:Ce("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},c.value))})]})}import{useEffect as cr,useState as Pn,useRef as xn}from"react";import{notification as ee}from"antd";import{CheckCircleOutlined as Sn,CloseCircleOutlined as _n,InfoCircleOutlined as kn,WarningOutlined as Nn}from"@ant-design/icons";import{Fragment as dr,jsx as $e,jsxs as Dn}from"react/jsx-runtime";var xt={success:$e(Sn,{style:{color:"#52c41a"}}),error:$e(_n,{style:{color:"#ff4d4f"}}),info:$e(kn,{style:{color:"#1677ff"}}),warning:$e(Nn,{style:{color:"#faad14"}})},Ri=({type:e,message:t,descs:r="",duration:n=3,placement:d="topRight",onClose:s})=>{let[a,o]=ee.useNotification(),[i,c]=Pn(!0);return cr(()=>{let m={message:t,descs:r,placement:d,duration:n,icon:xt[e],onClose:()=>{c(!1),s?.()}};if(i)switch(e){case"success":a.success(m);break;case"error":a.error(m);break;case"info":a.info(m);break;case"warning":a.warning(m);break;default:a.info(m)}},[e,t,r,n,d,i,a,s]),$e(dr,{children:o})};ee.config({placement:"topRight",duration:3,zIndex:1e4});var Pe=class Pe{constructor(){F(this,"currentToast",null);F(this,"api",null);F(this,"isInitialized",!1);F(this,"pendingToast",null)}static getInstance(){return Pe.instance||(Pe.instance=new Pe),Pe.instance}init(t){if(this.api=t,this.isInitialized=!0,this.pendingToast){let r=this.pendingToast;this.pendingToast=null,this.show(r)}}show(t){let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t;if(!this.isInitialized||!this.api){this.pendingToast=t;return}this.currentToast?.timer&&clearTimeout(this.currentToast.timer),this.currentToast&&this.currentToast.key===r?(ee.destroy(r),this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i})):(this.currentToast&&ee.destroy(this.currentToast.key),this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}))}createNotification(t){if(!this.api)return;let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t,c={success:this.api.success.bind(this.api),error:this.api.error.bind(this.api),info:this.api.info.bind(this.api),warning:this.api.warning.bind(this.api)}[n];c({key:r,message:d,description:s,duration:a,placement:o||"topRight",icon:xt[n],onClose:()=>{this.currentToast?.key===r&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),this.currentToast=null),i?.()}}),this.currentToast={key:r,type:n,message:d,descs:s,duration:a,placement:o,timer:null}}close(){this.currentToast&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),ee.destroy(this.currentToast.key),this.currentToast=null)}destroy(){this.close(),ee.destroy()}};F(Pe,"instance");var Pt=Pe,Un=Pt.getInstance();function at(e){return typeof e=="string"?{message:e,duration:3}:e}function qe(e){return xt[e]}var Y={success:e=>{if(!e)return;let t=at(e);ee.success({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("success"),onClose:t.onClose})},error:e=>{if(!e)return;let t=at(e);ee.error({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("error"),onClose:t.onClose})},info:e=>{if(!e)return;let t=at(e);ee.info({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("info"),onClose:t.onClose})},warning:e=>{if(!e)return;let t=at(e);ee.warning({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("warning"),onClose:t.onClose})},custom:(e,t)=>{let{message:r,descs:n,duration:d,placement:s,onClose:a}=t;ee[e]({message:r,description:n,duration:d,placement:s,icon:qe(e),onClose:a})}},wi=({children:e})=>{let[t,r]=ee.useNotification(),n=xn(!1);return cr(()=>{n.current||(Un.init(t),n.current=!0)},[t]),Dn(dr,{children:[r,e]})};import{notification as Ie}from"antd";import{CheckCircleOutlined as En,CloseCircleOutlined as jn,InfoCircleOutlined as An,WarningOutlined as On}from"@ant-design/icons";import{Fragment as Fn,jsx as Ge}from"react/jsx-runtime";var Mn={success:Ge(En,{style:{color:"#52c41a"}}),error:Ge(jn,{style:{color:"#ff4d4f"}}),info:Ge(An,{style:{color:"#1890ff"}}),warning:Ge(On,{style:{color:"#faad14"}})},St=class{constructor(){F(this,"currentToast",null);F(this,"suppressedCloseKeys",new Set)}destroySilently(t){this.suppressedCloseKeys.add(t),Ie.destroy(t)}show(t){let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t;this.currentToast&&this.currentToast.key===r?this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}):(this.currentToast&&this.destroySilently(this.currentToast.key),this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}))}createNotification(t){let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t;this.suppressedCloseKeys.delete(r);let c={success:Ie.success,error:Ie.error,info:Ie.info,warning:Ie.warning}[n];c({key:r,message:d,description:s,duration:a,placement:o||"topRight",icon:Mn[n],onClose:()=>{if(this.suppressedCloseKeys.has(r)){this.suppressedCloseKeys.delete(r),this.currentToast?.key===r&&(this.currentToast=null);return}this.currentToast?.key===r&&(this.currentToast=null),i?.()}}),this.currentToast={key:r,type:n,message:d,descs:s,duration:a,placement:o}}close(t){if(!this.currentToast){t&&Ie.destroy(t);return}let r=t||this.currentToast.key;if(r!==this.currentToast.key){Ie.destroy(t);return}this.destroySilently(r),this.currentToast=null}destroy(){this.currentToast&&(this.destroySilently(this.currentToast.key),this.currentToast=null),Ie.destroy()}},xe=new St,ki={success:(e,t=3)=>{let r=Xe("success",e,t);xe.show(r)},error:(e,t=3)=>{let r=Xe("error",e,t);xe.show(r)},info:(e,t=3)=>{let r=Xe("info",e,t);xe.show(r)},warning:(e,t=3)=>{let r=Xe("warning",e,t);xe.show(r)},custom:(e,t,r=3)=>{let n=Xe(e,t,r);xe.show(n)},close:e=>{xe.close(e)},destroy:()=>{xe.destroy()}};function Xe(e,t,r){let n=typeof t=="object"&&t!==null?t:{message:t};return{key:n.key||`singleton-${e}`,type:e,message:n.message,descs:n.descs,duration:n.duration??r,placement:n.placement,onClose:n.onClose}}var Ni=({children:e})=>Ge(Fn,{children:e});import{Button as Bn}from"antd";import{TableOutlined as Ln,AppstoreOutlined as zn}from"@ant-design/icons";import{jsx as De}from"react/jsx-runtime";function Hn({className:e="",viewMode:t,onToggle:r,options:n=[]}){return De("div",{className:`flex justify-end ${e}`,children:De("div",{className:"bg-gray-100 rounded-button p-1 flex",children:n.map((d,s)=>De(Bn,{type:t===d.value?"primary":"text",icon:d.icon,onClick:()=>r(d.value),className:`${s<n.length-1?"mr-1":""} rounded-button`,size:"small",title:d.tooltip},d.value))})})}function Oi({viewMode:e,onToggle:t,className:r=""}){return De(Hn,{viewMode:e,onToggle:t,className:r,options:[{value:"table",icon:De(Ln,{}),tooltip:"\u8868\u683C\u89C6\u56FE"},{value:"grid",icon:De(zn,{}),tooltip:"\u7F51\u683C\u89C6\u56FE"}]})}import{useMemo as mr,useState as _t}from"react";import{Table as Wn}from"antd";import{jsx as kt,jsxs as Jn}from"react/jsx-runtime";var Vn=Wn,qn=60,ur=9,$n={position:"absolute",top:0,bottom:0,right:-(ur/2),width:ur,zIndex:2,cursor:"col-resize",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none"},Xn={width:1,height:"60%",background:"transparent"},Gn=({onResizeStart:e,style:t,children:r,...n})=>{let[d,s]=_t(!1),[a,o]=_t(!1),i=c=>{if(!e)return;let m=c.currentTarget.closest("th"),C=m?m.getBoundingClientRect().width:0;o(!0);let b=()=>o(!1);document.addEventListener("mouseup",b,{once:!0}),e(c,C)};return Jn("th",{style:{...t,position:"relative"},...n,children:[r,e&&kt("span",{style:$n,onMouseDown:i,onClick:c=>c.stopPropagation(),onDoubleClick:c=>c.stopPropagation(),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:kt("span",{style:{...Xn,background:d||a?"#1677ff":"transparent"}})})]})},gr=(e,t)=>{let r=e.key;if(typeof r=="string"||typeof r=="number")return String(r);let n=e.dataIndex;return Array.isArray(n)?n.join("."):typeof n=="string"||typeof n=="number"?String(n):`col-${t}`};function Hi(e){let{columns:t,components:r,tableLayout:n,...d}=e,[s,a]=_t({}),o=(m,C)=>(b,w)=>{if(b.preventDefault(),b.stopPropagation(),Object.keys(s).length===0&&t){let A=b.currentTarget.closest("th"),N=A?.parentElement,I=N?Array.from(N.children):[],R=A&&I.length>0?I.indexOf(A)-m:0,T={};t.forEach((D,O)=>{let x=I[O+R];x&&(T[gr(D,O)]=Math.round(x.getBoundingClientRect().width))}),Object.keys(T).length>0&&a(D=>({...T,...D}))}let _=b.clientX,j=A=>{let N=Math.max(qn,Math.round(w+A.clientX-_));a(I=>I[C]===N?I:{...I,[C]:N})},P=()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",P),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",j),document.addEventListener("mouseup",P),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},i=mr(()=>t&&t.map((m,C)=>{if("children"in m&&m.children)return m;let b=gr(m,C),w=s[b]??m.width;return{...m,width:w,onHeaderCell:_=>({...m.onHeaderCell?.(_)??{},onResizeStart:o(C,b)})}}),[t,s]),c=mr(()=>({...r,header:{...r?.header??{},cell:Gn}}),[r]);return kt(Vn,{...d,columns:i,components:c,tableLayout:Object.keys(s).length>0?"fixed":n})}import Re from"react";import{Timeline as Cs,Avatar as Rr,Button as gt,Dropdown as Is,DatePicker as Rs}from"antd";var Je=e=>!e||(typeof e=="string"&&(e=new Date(e)),e.getTime()==0)||isNaN(e.getTime())?"\u65E0":e.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"numeric",hour:"2-digit",minute:"2-digit"});import{Modal as wr,Form as ke,Input as Tr}from"antd";import{EllipsisOutlined as ws,EditOutlined as Ts,DeleteOutlined as Ps,CommentOutlined as xs}from"@ant-design/icons";import{useEffect as Kn,useRef as pr}from"react";import{jsx as Ee,jsxs as lt}from"react/jsx-runtime";function fr(){return lt("div",{className:"ant-empty ant-empty-normal justify-self-center text-muted py-4",children:[Ee("div",{className:"ant-empty-image",children:lt("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[Ee("title",{children:" \u65E0\u6570\u636E "}),lt("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[Ee("ellipse",{fill:"rgb(var(--color-muted) / 0.12)",cx:"32",cy:"33",rx:"32",ry:"7"}),lt("g",{fillRule:"nonzero",stroke:"rgb(var(--color-border))",children:[Ee("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),Ee("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:"rgb(var(--color-surface))"})]})]})]})}),Ee("div",{className:"ant-empty-description justify-self-center text-sm font-thin text-muted",children:" \u65E0\u6570\u636E "})]})}function yr(e,t,r=768){let n=pr(e),d=pr(t);n.current=e,d.current=t,Kn(()=>{let s=window.innerWidth<=r,a=()=>{let o=window.innerWidth<=r;o!==s&&(s=o,o?n.current():d.current())};return s?n.current():d.current(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[r])}import Pr from"dayjs";import*as Et from"febs-browser";import vr from"dexie";var Nt={};ht(Nt,{AuthorizationHandler:()=>ge,HttpRequest:()=>l,ResponseCode:()=>mt});import Qn,{AxiosError as Yn}from"axios";import*as dt from"febs-browser";import*as Ke from"febs-browser";import hr from"store2";var ct=class{constructor(t){F(this,"s");this.s=t}get length(){return this.s.size()}keys(){return this.s.keys()}set(t,r){return r?(r=JSON.stringify(r),r=Ke.crypt.base64_encode(r),this.s.set(t,r,!0),this):this.remove(t)}get(t,r=null){if(!this.s.has(t))return r;let n=this.s.get(t);if(n){n=Ke.crypt.base64_decode(n),n=Ke.string.bytesToUtf8(n||[]);try{return JSON.parse(n)}catch{return this.remove(t),null}}return n}remove(t){return this.s.remove(t),this}clear(){return this.s.clearAll(),this}},te={namespace:function(e){return new ct(hr.namespace(e||"default"))},namespace_session:function(e){return new ct(hr.session.namespace(e||"default"))}};var mt=(i=>(i[i.SUCCESS=200]="SUCCESS",i[i.OPERATOR_ERROR=400]="OPERATOR_ERROR",i[i.UNAUTHORIZED=401]="UNAUTHORIZED",i[i.UNPERMISSION=402]="UNPERMISSION",i[i.NOT_FOUND=404]="NOT_FOUND",i[i.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",i[i.PARAM_ERROR=601]="PARAM_ERROR",i[i.REQUEST_LIMIT=602]="REQUEST_LIMIT",i))(mt||{});function Zn(e){switch(e){case 404:return"\u8D44\u6E90\u4E0D\u5B58\u5728";case 400:return"\u7CFB\u7EDF\u64CD\u4F5C\u9519\u8BEF";case 601:return"\u53C2\u6570\u9519\u8BEF";case 602:return"\u8FBE\u5230\u8BBF\u95EE\u9650\u5236";case 503:return"\u670D\u52A1\u4E0D\u53EF\u7528";case 401:return"\u672A\u767B\u5F55";case 402:return"\u65E0\u6743\u9650";default:return"\u672A\u77E5\u9519\u8BEF"}}var je=Qn.create({baseURL:import.meta.env.VITE_API_BASE,timeout:Number(import.meta.env.VITE_API_TIMEOUT)||5e3,headers:{"Content-Type":"application/json;charset=UTF-8"},withCredentials:!0}),$=class ${static clearStoreToken(){this.setStoreToken(null,0)}static getStoreToken(){let t=te.namespace("bp.ss").get("ss");if(t){let r=te.namespace("bp.ss").get("exp");return{token:JSON.parse(t),exp:r?JSON.parse(r):0}}return null}static getValidStoreToken(){let t=$.getStoreToken();return t&&t.exp>Date.now()-$.TOKEN_EXP?t.token:null}static setStoreToken(t,r){t?(te.namespace("bp.ss").set("ss",JSON.stringify(t)),te.namespace("bp.ss").set("exp",JSON.stringify(r))):te.namespace("bp.ss").clear()}static requestHandleSid(t){let r=$.getStoreToken();r&&r.exp>Date.now()-$.TOKEN_EXP&&t.headers.set($.HEADER_NAME,$.HEADER_PREFIX+r.token)}static responseHandleSid(t){let r=t.headers.get($.HEADER_NAME);if(r&&r.startsWith($.HEADER_PREFIX.trim())){r=r.replace($.HEADER_PREFIX,"");let n=r;if(r=r.split(".")[1],r&&(r=dt.string.bytesToUtf8(dt.crypt.base64_decode(r)),r)){let d=JSON.parse(r);return d.exp<Date.now()-$.TOKEN_EXP?($.clearStoreToken(),!1):($.setStoreToken(n,d.exp),!0)}$.clearStoreToken(),typeof navigator<"u"&&navigator.onLine&&(window.location.href="/")}return!1}};F($,"HEADER_NAME","Authorization"),F($,"HEADER_PREFIX","SPBearer "),F($,"TOKEN_EXP",20*1e3);var ge=$;je.interceptors.request.use(e=>(ve.show({delay:5e3}),ge.requestHandleSid(e),e),e=>(ve.hide(),console.log("Request Error =========="),Promise.reject(e)));je.interceptors.response.use(e=>(ve.hide(),e.data.code!==200&&Y.warning(e.data.message||Zn(e.data.code)),ge.responseHandleSid(e),e.data),e=>(ve.hide(),e instanceof Yn&&(e.code==="ERR_NETWORK"||e.code==="ECONNABORTED"?Y.error("\u7F51\u7EDC\u9519\u8BEF"):e.code==="ERR_BAD_RESPONSE"&&Y.error("\u670D\u52A1\u5668\u65E0\u54CD\u5E94")),console.log("Response Error =========="),Promise.reject(e)));var l={get(e,t,r){return je({method:"get",url:e,params:t,data:r})},post(e,t,r){return je({method:"post",url:e,params:t,data:r})},put(e,t,r){return je({method:"put",url:e,params:t,data:r})},delete(e,t,r){return je({method:"delete",url:e,params:t,data:r})}};var Ut={};ht(Ut,{admin:()=>es,gateway:()=>ts,message:()=>rs,role:()=>ns,user:()=>ss});var es={registerAdmin:e=>l.post("/api/admin/registerAdmin",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode}).then(t=>t),registerUser:e=>l.post("/api/admin/registerUser",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id}).then(t=>t),updateInfoByAdmin:e=>l.post("/api/admin/updateByAdmin",null,{id:e.id,is_forbidden:e.is_forbidden,title:e.title,phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id,created_at:e.created_at,tick_avatar_self:e.tick_avatar_self,role_ids:e.role_ids,isAdmin:e.isAdmin,thirdPlatformInfo:e.thirdPlatformInfo,unreadMessageCount:e.unreadMessageCount}).then(t=>t),list:e=>l.get("/api/admin/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)},ts={register:e=>l.post("/api/register",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id}).then(t=>t),sendSms:e=>l.post("/api/sendSms",{phone:e.phone,imageCode:e.imageCode},null).then(t=>t),isLogin:()=>l.get("/api/isLogin",null,null).then(e=>e),login:e=>l.post("/api/login",null,{phone:e.phone,pwd:e.pwd,pwdSN:e.pwdSN,smsCode:e.smsCode}).then(t=>t),verifyPasswordHash:e=>l.post("/api/verifyPasswordHash",null,{passwordHash:e.passwordHash,passwordSalt:e.passwordSalt}).then(t=>t),logout:()=>l.get("/api/logout",null,null).then(e=>e),listPermissions:()=>l.get("/api/listPermissions",null,null).then(e=>e),listRolePermissions:e=>l.get("/api/listRolePermissions",{id:e.id},null).then(t=>t)},rs={list:e=>l.get("/api/user/message/list",{pageNum:e.pageNum,pageSize:e.pageSize,unread_only:e.unread_only},null).then(t=>t),countUnread:()=>l.get("/api/user/message/unread/count",null,null).then(e=>e),markRead:e=>l.post("/api/user/message/read",null,{messageIds:e.messageIds}).then(t=>t),clearReaded:e=>l.delete("/api/user/message/clearReaded",null,{messageIds:e.messageIds}).then(t=>t)},ns={listRoles:()=>l.get("/api/role/listRoles",null,null).then(e=>e),createRole:e=>l.post("/api/role/createRole",{name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id},null).then(t=>t),updateRole:e=>l.post("/api/role/updateRole",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id},null).then(t=>t),assignPermissionsToRole:e=>l.post("/api/role/assignPermissionsToRole",null,{role_id:e.role_id,permissions:e.permissions}).then(t=>t),assignRoleToUserPermission:()=>l.post("/api/role/assignRoleToUserPermission",null,null).then(e=>e),assignRoleToUser:e=>l.post("/api/role/assignRoleToUser",null,{user_id:e.user_id,role_ids:e.role_ids}).then(t=>t),listUserRoles:e=>l.get("/api/role/listUserRoles",{user_id:e.user_id},null).then(t=>t),listUserPermissions:e=>l.get("/api/role/listUserPermissions",{user_id:e.user_id},null).then(t=>t),listCompanies:()=>l.get("/api/role/listCompanies",null,null).then(e=>e),createCompany:e=>l.post("/api/role/createCompany",{name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id,is_spv_company:e.is_spv_company},null).then(t=>t),updateCompany:e=>l.post("/api/role/updateCompany",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id,is_spv_company:e.is_spv_company},null).then(t=>t),listDepartments:()=>l.get("/api/role/listDepartments",null,null).then(e=>e),createDepartment:e=>l.post("/api/role/createDepartment",{name:e.name,descs:e.descs,admin_id:e.admin_id,company_id:e.company_id,parent_id:e.parent_id},null).then(t=>t),updateDepartment:e=>l.post("/api/role/updateDepartment",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,company_id:e.company_id,parent_id:e.parent_id},null).then(t=>t),assignUserToDepartment:e=>l.post("/api/role/assignUserToDepartment",{user_id:e.user_id,department_id:e.department_id,position:e.position},null).then(t=>t),removeUserFromDepartment:e=>l.post("/api/role/removeUserFromDepartment",{user_id:e.user_id,department_id:e.department_id},null).then(t=>t),listCompanyDepartments:e=>l.get("/api/role/listCompanyDepartments",{company_id:e.company_id},null).then(t=>t),listUserDepartments:e=>l.get("/api/role/listUserDepartments",{user_id:e.user_id},null).then(t=>t),listDepartmentUsers:e=>l.get("/api/role/listDepartmentUsers",{department_id:e.department_id},null).then(t=>t)},ss={getInfoByUsername:e=>l.get("/api/user/infoByUsername",{username:e.username},null).then(t=>t),getInfo:e=>l.get("/api/user/info",{id:e.id},null).then(t=>t),getAvatar:e=>l.get("/api/user/avatar",{id:e.id,tick:e.tick},null).then(t=>t),getAvatarList:e=>l.get("/api/user/avatar_list",{ids:e.ids},null).then(t=>t),updateAvatar:e=>l.post("/api/user/updateAvatar",null,{id:e.id,avatar:e.avatar,avatar_small:e.avatar_small,tick_self:e.tick_self}).then(t=>t),updateManager:e=>l.post("/api/user/updateManager",{id:e.id,managerid:e.managerid},null).then(t=>t),updateInfo:e=>l.post("/api/user/update",null,{id:e.id,is_forbidden:e.is_forbidden,title:e.title,phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id,created_at:e.created_at,tick_avatar_self:e.tick_avatar_self,role_ids:e.role_ids,isAdmin:e.isAdmin,thirdPlatformInfo:e.thirdPlatformInfo,unreadMessageCount:e.unreadMessageCount}).then(t=>t),updatePassword:e=>l.post("/api/user/updatePassword",null,{old_password:e.old_password,old_password_sn:e.old_password_sn,new_password:e.new_password}).then(t=>t),deleteUser:e=>l.post("/api/user/delete",{id:e.id},null).then(t=>t),list:e=>l.get("/api/user/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),listByIds:e=>l.get("/api/user/list_by_ids",{ids:e.ids},null).then(t=>t),search:e=>l.get("/api/user/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),forbid:e=>l.post("/api/user/forbid",{id:e.id,forbid:e.forbid},null).then(t=>t)};var Dt={};ht(Dt,{contract:()=>os,file:()=>is,fileversion:()=>as,project:()=>ls,projectprogress:()=>cs});var os={createContract:e=>l.post("/api/project/contract/create",null,{projectId:e.projectId,name:e.name,tag:e.tag,code:e.code,partyA:e.partyA,partyB:e.partyB,amount:e.amount,startDate:e.startDate,endDate:e.endDate,descs:e.descs}).then(t=>t),deleteContract:e=>l.delete("/api/project/contract/delete",{id:e.id},null).then(t=>t),updateContract:e=>l.post("/api/project/contract/update",null,{id:e.id,name:e.name,code:e.code,tag:e.tag,partyA:e.partyA,partyB:e.partyB,amount:e.amount,startDate:e.startDate,endDate:e.endDate,descs:e.descs,markdown:e.markdown}).then(t=>t),getContractDetail:e=>l.get("/api/project/contract/detail",{id:e.id},null).then(t=>t),getContractList:e=>l.get("/api/project/contract/list",{projectId:e.projectId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),submitApproval:e=>l.post("/api/project/contract/submit",{id:e.id,sealType:e.sealType},null).then(t=>t),cancelApproval:e=>l.post("/api/project/contract/cancelApproval",{id:e.id},null).then(t=>t),uploadVersion:e=>l.post("/api/project/contract/version/upload",null,{contractId:e.contractId,fileName:e.fileName,fileType:e.fileType,fileSize:e.fileSize,changeLog:e.changeLog}).then(t=>t),getVersionList:e=>l.get("/api/project/contract/version/list",{contractId:e.contractId},null).then(t=>t),deleteVersion:e=>l.delete("/api/project/contract/version/delete",{id:e.id},null).then(t=>t),renameVersion:e=>l.post("/api/project/contract/version/rename",null,{id:e.id,fileName:e.fileName}).then(t=>t),getVersionDetail:e=>l.get("/api/project/contract/version/detail",{id:e.id},null).then(t=>t),setVersionLayerOpinion:e=>l.post("/api/project/contract/version/layerOpinion",null,{contractId:e.contractId,version:e.version,opinion:e.opinion}).then(t=>t),getNewContractCode:e=>l.get("/api/project/contract/newCode",{contractCode:e.contractCode,sequenceLength:e.sequenceLength},null).then(t=>t),getContractHistoryParties:()=>l.get("/api/project/contract/historyParties",null,null).then(e=>e)},is={getDetail:e=>l.get("/api/project/files/detail",{fileId:e.fileId},null).then(t=>t),listFiles:e=>l.get("/api/project/files/list",{projectId:e.projectId},null).then(t=>t),searchFiles:e=>l.get("/api/project/files/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),addFile:(e,t)=>l.post("/api/project/files/add",{projectId:e.projectId},{fileName:t.fileName,filePath:t.filePath,isSecure:t.isSecure,descs:t.descs,fileType:t.fileType,fileSize:t.fileSize,crc32:t.crc32,fileResourcePath:t.fileResourcePath}).then(r=>r),removeFile:e=>l.post("/api/project/files/remove",{fileId:e.fileId},null).then(t=>t),listTrashFiles:e=>l.get("/api/project/files/trash/list",{projectId:e.projectId},null).then(t=>t),restoreTrashFile:e=>l.post("/api/project/files/trash/restore",{fileId:e.fileId},null).then(t=>t),permanentDeleteTrashFile:e=>l.post("/api/project/files/trash/remove",{fileId:e.fileId},null).then(t=>t),emptyTrash:e=>l.post("/api/project/files/trash/empty",{projectId:e.projectId},null).then(t=>t),moveFile:(e,t)=>l.post("/api/project/files/move",{projectId:e.projectId},{oldFileName:t.oldFileName,oldFilePath:t.oldFilePath,newFileName:t.newFileName,newFilePath:t.newFilePath}).then(r=>r),updateFileDescs:e=>l.post("/api/project/files/updateDescs",null,{fileId:e.fileId,descs:e.descs}).then(t=>t),copyFileToProject:e=>l.post("/api/project/files/copyToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),moveFileToProject:e=>l.post("/api/project/files/moveToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),updateFileDelta:e=>l.post("/api/project/files/updateDelta",null,{fileId:e.fileId,deltaData:e.deltaData,deltaSize:e.deltaSize,newFileSize:e.newFileSize,crc32:e.crc32,recordVersion:e.recordVersion,rotateResourcePath:e.rotateResourcePath}).then(t=>t),updateFile:e=>l.post("/api/project/files/updateData",null,{fileId:e.fileId,fileSize:e.fileSize,crc32:e.crc32,fileName:e.fileName,fileResourcePath:e.fileResourcePath,recordVersion:e.recordVersion,rotateResourcePath:e.rotateResourcePath}).then(t=>t),generateTempAccessToken:e=>l.post("/api/project/files/generateTempAccessToken",{fileId:e.fileId,expireSeconds:e.expireSeconds},null).then(t=>t),folderDownload:(e,t)=>l.post("/api/project/files/folderDownload",{projectId:e.projectId},{folderPath:t.folderPath,folderName:t.folderName}).then(r=>r),folderDownloadStatus:e=>l.get("/api/project/files/folderDownloadStatus",{jobId:e.jobId},null).then(t=>t),listFilesByTempAccessToken:e=>l.get("/api/project/files/listByTempAccessToken",{tempToken:e.tempToken},null).then(t=>t)},as={listVersions:e=>l.get("/api/project/files/version/list",{fileId:e.fileId},null).then(t=>t),getVersionDetail:e=>l.get("/api/project/files/version/detail",{versionId:e.versionId},null).then(t=>t)},ls={enableUserPrivateProject:()=>l.post("/api/project/enablePrivateProject",null,null).then(e=>e),createProject:e=>l.post("/api/project/create",null,{name:e.name,descs:e.descs,companyId:e.companyId,markdown:e.markdown,startTime:e.startTime,plannedEndTime:e.plannedEndTime,endTime:e.endTime,leaderId:e.leaderId,customerId:e.customerId,order:e.order,isUserPrivate:e.isUserPrivate}).then(t=>t),updateProject:e=>l.post("/api/project/update",null,{id:e.id,name:e.name,descs:e.descs,companyId:e.companyId,markdown:e.markdown,status:e.status,startTime:e.startTime,plannedEndTime:e.plannedEndTime,endTime:e.endTime,leaderId:e.leaderId,customerId:e.customerId,order:e.order,isUserPrivate:e.isUserPrivate,createTime:e.createTime,updateTime:e.updateTime,createBy:e.createBy,updateBy:e.updateBy}).then(t=>t),updateUserdataOrder:e=>l.post("/api/project/updateUserdataOrder",null,{projectIds:e.projectIds}).then(t=>t),getUserdataOrder:()=>l.get("/api/project/userdataOrder",null,null).then(e=>e),getProjectDetail:e=>l.get("/api/project/detail",{id:e.id},null).then(t=>t),getProjectName:e=>l.get("/api/project/name",{projectId:e.projectId},null).then(t=>t),listProjects:e=>l.get("/api/project/list",{pageNum:e.pageNum,pageSize:e.pageSize,status:e.status,companyId:e.companyId,customerId:e.customerId,userId:e.userId},null).then(t=>t),listProjectsByManager:e=>l.get("/api/project/listByManager",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),changeStatus:e=>l.put("/api/project/status",{id:e.id,status:e.status},null).then(t=>t),getProjectMembers:e=>l.get("/api/project/members",{projectId:e.projectId},null).then(t=>t),getMemberRole:e=>l.get("/api/project/member/role",{projectId:e.projectId,userId:e.userId},null).then(t=>t),assignMember:e=>l.post("/api/project/members/assign",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t),removeMember:e=>l.post("/api/project/members/remove",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t)},cs={createProgress:e=>l.post("/api/project/progress/create",null,{projectId:e.projectId,descs:e.descs,commentCount:e.commentCount,progressTime:e.progressTime}).then(t=>t),updateProgress:e=>l.put("/api/project/progress/update",null,{id:e.id,descs:e.descs,progressTime:e.progressTime}).then(t=>t),deleteProgress:e=>l.delete("/api/project/progress/delete",{id:e.id},null).then(t=>t),getProgressList:e=>l.get("/api/project/progress/list",{projectId:e.projectId},null).then(t=>t),addComment:e=>l.post("/api/project/progress/comment/add",null,{progressId:e.progressId,comment:e.comment}).then(t=>t),deleteComment:e=>l.delete("/api/project/progress/comment/delete",{id:e.id},null).then(t=>t),updateComment:e=>l.put("/api/project/progress/comment/update",{id:e.id},{}).then(t=>t),getCommentList:e=>l.get("/api/project/progress/comment/list",{progressId:e.progressId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)};var ne={base:Nt,user:Ut,project:Dt};var _e=1440*60*1e3,jt=class extends vr{constructor(){super("UserInfoDB");F(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},At=class extends vr{constructor(){super("UserAvatarDB");F(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},ce=new jt,de=new At,Cr=async e=>{try{let t=await de.userCache.get(e);if(t){if(Date.now()-t.timestamp<_e)return t.avatar;await de.userCache.delete(e)}return null}catch(t){return console.error("\u8BFB\u53D6\u7528\u6237\u5934\u50CF\u7F13\u5B58\u5931\u8D25:",t),null}},Ot=async e=>{try{let t=await ce.userCache.get(e);if(t){let r=Date.now(),n=await de.userCache.get(e);if(n?r-n.timestamp<_e?t.data.avatar=n.avatar:(t.data.avatar=void 0,await de.userCache.delete(e)):t.data.avatar=void 0,r-t.timestamp<_e)return t.data;await ce.userCache.delete(e)}return null}catch(t){return console.error("\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",t),null}},ds=async(e,t)=>{try{t&&await de.userCache.put({id:e,avatar:t,timestamp:Date.now()})}catch(r){console.error("\u5199\u5165\u7528\u6237\u5934\u50CF\u7F13\u5B58\u5931\u8D25:",r)}},ms=async(e,t)=>{try{t.avatar&&await de.userCache.put({id:e,avatar:t.avatar,timestamp:Date.now()});let r=t.avatar;t.avatar=void 0,await ce.userCache.put({id:e,data:t,timestamp:Date.now()}),t.avatar=r}catch(r){console.error("\u5199\u5165\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}},us=async e=>{let t=new Map;try{let r=await ce.userCache.bulkGet(e),n=Date.now();for(let s=0;s<e.length;s++){let a=r[s];a&&n-a.timestamp<_e&&t.set(e[s],a.data)}let d=await de.userCache.bulkGet(e);for(let s=0;s<e.length;s++){let a=d[s];if(!a)continue;let o=t.get(a.id);o&&n-a.timestamp<_e&&(o.avatar=a.avatar)}}catch(r){console.error("\u6279\u91CF\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}return t},br=async e=>{try{let t=e.map(n=>({id:n.id,data:n.data,timestamp:Date.now()})),r=e.map(n=>({id:n.id,avatar:n.data.avatar,timestamp:Date.now()}));r=r.filter(n=>n.avatar),await de.userCache.bulkPut(r),t.forEach(n=>{n.data.avatar=void 0}),await ce.userCache.bulkPut(t)}catch(t){console.error("\u6279\u91CF\u5199\u5165\u7528\u6237\u7F13\u5B58\u5931\u8D25:",t)}},gs=async()=>{let e=new Map;try{let t=Date.now(),r=await ce.userCache.toArray();for(let n of r)if(t-n.timestamp<_e){let d=await de.userCache.get(n.id);d&&t-d.timestamp<_e&&(n.data.avatar=d.avatar),e.set(n.id,n.data)}else await ce.userCache.delete(n.id)}catch(t){console.error("\u83B7\u53D6\u6240\u6709\u7F13\u5B58\u5931\u8D25:",t)}return e},ps=async()=>{try{await ce.userCache.clear(),await de.userCache.clear()}catch(e){console.error("\u6E05\u9664\u7528\u6237\u7F13\u5B58\u5931\u8D25:",e)}},Ir=async({user_id:e,forceRefresh:t=!1,forceAvatar:r=!1})=>{let n={code:200,data:{user_id:e,isLogin:!0}},d=!1;if(!e)try{n=await ne.user.gateway.isLogin()}catch{d=!0}if(d){let s;try{let o=te.namespace("bp.ss").get("user");o&&(s=JSON.parse(o)?.id)}catch{}let a=e??s;if(a){let o=await Ot(a);if(o){let i=await Se({user_id:a,forceRefresh:!1,serverTick:o.tick_avatar_self});return i&&(o.avatar=i),o}}try{let o=te.namespace("bp.ss").get("user");if(o)return JSON.parse(o)}catch{}return null}if(n?.code===200&&n.data?.isLogin){let s=n.data?.user_id,a=n.data?.isAdmin||!1,o=await Ot(s);if(t||!o)try{let i=await ne.user.user.getInfo({id:s});if(i?.code==200){e||te.namespace("bp.ss").set("user",JSON.stringify(i.data));let c={...i.data};s&&await ms(s,c);try{let m=await Se({user_id:s,forceRefresh:r,serverTick:i.data?.tick_avatar_self});m&&(c.avatar=m)}catch{}return c}else return o||null}catch{if(o)return o;try{let c=te.namespace("bp.ss").get("user");if(c)return JSON.parse(c)}catch{}return null}try{let i=await Se({user_id:s,forceRefresh:r,serverTick:o.tick_avatar_self});i&&(o.avatar=i)}catch{}return o}else return ge.clearStoreToken(),null},Se=async({user_id:e,forceRefresh:t=!1,serverTick:r=Number.MAX_SAFE_INTEGER})=>{if(!e)return;let n=await Cr(e);if(t||!n){let d=n?.avatar_tick||-1;if(d<r)try{let s=await ne.user.user.getAvatar({id:e,tick:d});s?.code==200&&d!=s.data?.tick_self&&(n={avatar:Et.string.isEmpty(s.data?.avatar)?void 0:s.data?.avatar,avatar_small:Et.string.isEmpty(s.data?.avatar_small)?void 0:s.data?.avatar_small,avatar_tick:s.data?.tick_self||-1},await ds(e,n))}catch{}}return n||void 0},fs=async e=>(e=e||{forceRefresh:!1},await Ir(e)),ys=()=>{let e=te.namespace("bp.ss").get("user");return e?JSON.parse(e):null},hs=async({userIds:e,keywords:t,forceRefresh:r=!1})=>{let n=new Map;if(!e){if(!r&&(!t||t.length===0)){let c=await gs();if(c.size>=100){let m=new Map,C=0;for(let[b,w]of c){if(C>=100)break;let _=await Se({user_id:b,forceRefresh:!1,serverTick:w.tick_avatar_self});w.avatar=_,m.set(b,w),C++}return m}return c}let a;if(t&&t.length>0){if(a=await ne.user.user.search({pageNum:1,pageSize:100,keyword:t}),a?.code!==200)return n}else if(a=await ne.user.user.list({pageNum:1,pageSize:100}),a?.code!==200)return n;let o=a.data?.list||[],i=[];for(let c of o){let m={...c};n.set(c.id,m),i.push({id:c.id,data:m})}i.length>0&&await br(i);for(let c=0;c<i.length;c++){let m=await Se({user_id:i[c].id,serverTick:i[c].data.tick_avatar_self});i[c].data.avatar=m}return n}if(e.length==0)return n;let d=[...new Set(e)];r||(await us(d)).forEach((o,i)=>{n.set(i,o)});let s=d.filter(a=>!n.has(a));if(s.length===0)return n;try{let a=await ne.user.user.listByIds({ids:JSON.stringify(s)});if(a?.code!=200)return n;let o=a.data?.list||[];if(o.length>0){let c=[];for(let m of o){let C={...m};c.push({id:m.id,data:C})}await br(c)}let i=[];if(o.length>0)for(let c of o){let m=await Se({user_id:c.id,serverTick:c.tick_avatar_self||-1});i.push({id:c.id,avatar_small:m?.avatar_small||"",avatar_tick:c.tick_avatar_self||-1})}for(let c of o){let m=i.find(b=>b.id==c.id),C={...c,avatar:{avatar:"",avatar_small:m?.avatar_small||"",avatar_tick:m?.avatar_tick||-1}};n.set(c.id,C)}}catch(a){console.error("\u6279\u91CF\u83B7\u53D6\u7528\u6237\u4FE1\u606F\u5931\u8D25:",a)}return n},bs=async e=>{e?await ce.userCache.delete(e):await ps()},vs=async()=>{try{let e=await ce.userCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},ut={getFromCache:Ot,getAvatarFromCache:Cr,getUserInfo:Ir,getUserAvatar:Se,current:fs,currentLocalUser:ys,getUserInfos:hs,clearUserCache:bs,getCacheStats:vs};import{Fragment as Mt,jsx as U,jsxs as se}from"react/jsx-runtime";var ka=({commentList:e,showTitle:t,showTimePicker:r,onDeleteComment:n,onLoadSubComments:d,commentListMap:s,onSaveComment:a,onSaveSubComment:o})=>{let[i,c]=Re.useState(window.innerWidth<768),[m,C]=Re.useState(new Map),[b,w]=Re.useState(!1),[_,j]=Re.useState(null),[P]=ke.useForm(),[A,N]=Re.useState(!1),[I,R]=Re.useState(null),[T]=ke.useForm(),D=Re.useMemo(()=>{let v=new Set;return e.forEach(S=>{S.createBy&&v.add(S.createBy),s[S.id]?.comments.forEach(G=>{G.createBy&&v.add(G.createBy)})}),Array.from(v)},[e,s]);Re.useEffect(()=>{if(D.length===0)return;let v=!0;return ut.getUserInfos({userIds:D}).then(S=>{v&&C(G=>new Map([...G,...S]))}).catch(S=>{console.error("\u52A0\u8F7D\u8BC4\u8BBA\u7528\u6237\u4FE1\u606F\u5931\u8D25:",S)}),()=>{v=!1}},[D]),yr(()=>{c(!0)},()=>{c(!1)},768);let O=async v=>{j(v),P.resetFields(),w(!0)},x=v=>{v?(R(v),T.setFieldsValue({descs:v.descs,progressTime2:Pr(v.progressTime)})):(R(null),T.resetFields(),T.setFieldsValue({progressTime2:Pr()})),N(!0)},B=async()=>{try{if(!_)return;let v=await P.validateFields();if(!v)return;await o?.({commentId:_.id,comment:v.comment})&&(Y.success("\u56DE\u590D\u5DF2\u63D0\u4EA4"),w(!1),d?.(_.id))}catch(v){console.error(v),Y.error("\u63D0\u4EA4\u56DE\u590D\u5931\u8D25")}},W=async()=>{try{let v=await T.validateFields();I?(await a?.({commentItem:I,comment:v.descs,time:v.progressTime2.toDate()}),Y.success("\u66F4\u65B0\u6210\u529F")):(await a?.({commentItem:null,comment:v.descs,time:v.progressTime2.toDate()}),Y.success("\u65B0\u589E\u6210\u529F")),N(!1),R(null)}catch(v){console.error(v),Y.error("\u4FDD\u5B58\u5931\u8D25")}};return se(Mt,{children:[U("div",{className:"flex justify-end items-center mb-5 ml-4",children:U(gt,{type:"primary",onClick:()=>x(),className:"px-4 py-2 btn-primary flex items-center",children:"\u65B0\u589E"})}),e.length?U(Cs,{mode:"left",className:"ml-5 md:pr-[200px]",items:e.map(v=>({key:v.id,color:"blue",label:i&&t?null:Je(new Date(v.progressTime)),style:{paddingBottom:"5px"},children:se(Mt,{children:[i&&t&&U("div",{className:"mt-2 mb-1 font-bold",children:Je(new Date(v.progressTime))}),se("div",{className:"rounded border border-gray-100 bg-gray-50 p-2",children:[se("div",{className:"flex justify-between items-start mb-2 ",children:[se("div",{className:"flex items-center space-x-2",children:[U(Rr,{src:m.get(v.createBy)?.avatar?.avatar_small||null,size:40,children:m.get(v.createBy)?.nickname?.[0]}),se("div",{children:[U("div",{className:"",children:m.get(v.createBy)?.nickname}),U("div",{className:"text-xs font-thin",children:Je(new Date(v.updateTime))})]})]}),U("div",{className:"mt-4 flex justify-end absolute right-1 top-1",children:U(Is,{menu:{items:[{key:"edit",icon:U(Ts,{}),label:"\u7F16\u8F91",onClick:S=>{x?.(v),S.domEvent.stopPropagation()}},{key:"delete",icon:U(Ps,{}),label:"\u5220\u9664",danger:!0,onClick:S=>{n?.(v.id),S.domEvent.stopPropagation()}}]},trigger:["click"],children:U(gt,{type:"text",icon:U(ws,{}),onClick:S=>S.stopPropagation()})})})]}),U("div",{className:"whitespace-pre-wrap ml-2",style:{whiteSpace:"pre-wrap"},children:v.descs}),se("div",{className:"flex items-center space-x-1 mt-1",children:[U(gt,{type:"text",icon:U(xs,{}),className:"font-thin text-xs",size:"small",style:{color:"#666"},onClick:()=>O(v),children:"\u56DE\u590D"}),se(gt,{type:"text",size:"small",style:{color:"#666"},className:"font-thin text-xs",onClick:()=>d?.(v.id),children:[s[v.id]&&s[v.id].expanded?"\u6536\u8D77":"\u5C55\u5F00"+v.commentCount+"\u6761","\u56DE\u590D"]})]})]}),U("div",{className:"border-l border-gray-200 pl-3",children:s[v.id]&&s[v.id].expanded&&s[v.id].comments.length>0?s[v.id].comments.map(S=>U("div",{className:"p-1 text-sm",children:U("div",{className:"flex items-center space-y-2 mb-1 mt-1",children:se("div",{className:"flex items-center space-x-2",children:[U(Rr,{src:m.get(S.createBy)?.avatar?.avatar_small||null,size:40,className:"self-start",children:m.get(S.createBy)?.nickname?.[0]}),se("div",{children:[U("div",{className:"text-gray-600 text-xs",children:m.get(S.createBy)?.nickname}),U("div",{className:"text-gray-700",children:S.comment}),U("div",{className:"text-xs mt-1 font-thin",children:Je(new Date(S.createTime))})]})]})})},S.id)):U(Mt,{})})]})}))}):fr(),U(wr,{open:b,onCancel:()=>{j(null),w(!1)},className:"ant-modal-nofull",onOk:B,okText:"\u63D0\u4EA4",cancelText:"\u53D6\u6D88",children:U(ke,{form:P,layout:"horizontal",className:"mt-6",children:U(ke.Item,{name:"comment",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56DE\u590D\u5185\u5BB9"}],children:U(Tr.TextArea,{rows:4,placeholder:"\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u590D"})})})}),U(wr,{title:I?"\u7F16\u8F91":"\u65B0\u589E",open:A,className:"ant-modal-nofull",onCancel:()=>{N(!1),R(null)},onOk:W,okText:"\u4FDD\u5B58",cancelText:"\u53D6\u6D88",children:se(ke,{form:T,layout:"horizontal",children:[r&&U(ke.Item,{name:"progressTime2",label:"\u65F6\u95F4",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u65F6\u95F4"}],children:U(Rs,{showTime:!0,style:{width:"100%"}})}),U(ke.Item,{name:"descs",label:"\u5185\u5BB9",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5185\u5BB9"}],children:U(Tr.TextArea,{rows:4,placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9"})})]})})]})};import{useEffect as Qe,useState as Ae,useCallback as we,useRef as Lt,useMemo as xr}from"react";import{Select as Ss,Spin as _s,message as ks,Popover as zt,Card as Ns,Typography as Us,Space as Ds}from"antd";import{debounce as Es}from"lodash-es";import js from"react-dom/client";var Ft=class{constructor(){F(this,"cache",new Map);F(this,"defaultExpireTime",300*1e3)}set(t,r,n=this.defaultExpireTime){this.cache.set(t,{data:r,timestamp:Date.now(),expireTime:n})}get(t){let r=this.cache.get(t);return r?Date.now()-r.timestamp>r.expireTime?(this.cache.delete(t),null):r.data:null}clear(){this.cache.clear()}},Bt=new Ft;import{jsx as z,jsxs as Sr}from"react/jsx-runtime";var{Text:Wa}=Us,Va=({multiple:e=!1,allowClear:t=!0,timeout:r=1e4,retryCount:n=3,enableCache:d=!0,excludeProjectIds:s=[],cacheExpireTime:a,value:o,onChange:i,...c})=>{let[m,C]=Ae(!1),[b,w]=Ae([]),[_,j]=Ae(""),[P,A]=Ae(1),[N,I]=Ae(!0),[R,T]=Ae([]),D=Lt(null),O=Lt([]),x=Lt([]);Qe(()=>{O.current=b},[b]),Qe(()=>{x.current=R},[R]);let B=we(g=>g.map(y=>{let h=O.current.find(u=>u.id===y);return h||x.current.find(u=>u.id===y)}).filter(y=>y!==void 0),[]),W=we(g=>{if(!g){T([]),i?.([],[]);return}let y=e?Array.isArray(g)?g:[g]:typeof g=="string"?[g]:[];if(y.length===0){T([]),i?.([],[]);return}let h=B(y);T(h),i?.(y,h)},[B,i,e]);Qe(()=>{if(!o||o.length==0){T([]);return}let g=e?Array.isArray(o)?o:[]:typeof o=="string"?[o]:[],y=B(g);T(y)},[o,B,e]);let v=we(async(g,y=n)=>{try{D.current=new AbortController;let h=D.current.signal,u=new Promise((p,E)=>{setTimeout(()=>{E(new Error("\u8BF7\u6C42\u8D85\u65F6")),D.current?.abort()},r)});return await Promise.race([g(),u])}catch(h){if(y>0&&!(h instanceof Error&&h.name==="AbortError"))return await new Promise(u=>setTimeout(u,1e3)),v(g,y-1);throw h}},[r,n]),S=we(async(g,y=!1)=>{try{C(!0);let h=`projects_${g}`;if(d&&!g){let f=Bt.get(h);if(f){w(p=>y?[...p,...f]:f),I(!1);return}}let u=await v(async()=>{let f=await ne.project.project.listProjects({pageNum:P,pageSize:1e3});return f.code===200&&f.data?{...f,data:f.data.list.map(p=>({id:p.id,name:p.name,descs:p.descs}))}:f});if(u.code===200&&u.data){let f=u.data.filter(p=>!s.includes(p.id));d&&!g&&Bt.set(h,f,a),w(p=>y?[...p,...f]:f),I(!1)}}catch(h){console.error("\u83B7\u53D6\u9879\u76EE\u5217\u8868\u5931\u8D25:",h),ks.error("\u83B7\u53D6\u9879\u76EE\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{C(!1)}},[s,v,P,d,a]);Qe(()=>()=>{D.current?.abort()},[]);let G=xr(()=>Es(g=>{j(g),A(1),S(g,!1)},300),[S]),K=we(g=>{let{target:y}=g;if(!y)return;let{scrollTop:h,scrollHeight:u,clientHeight:f}=y;if(u-h<=f*1.5&&!m&&N){let p=P+1;A(p),S(_,!0)}},[m,N,P,_,S]);Qe(()=>{S("",!1)},[S]);let X=g=>z(Ns,{size:"small",style:{width:280},children:z(Ds,{direction:"vertical",size:"small",style:{width:"100%"},children:z("div",{style:{display:"flex",alignItems:"center",gap:8},children:z("div",{children:z("div",{style:{fontWeight:"bold"},children:g.name})})})})}),fe=g=>{let y=[];return y.push(z("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:g.name},"name")),z("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:y})},ye=xr(()=>b.map(g=>({key:g.id,label:fe(g),value:g.id,user:g})),[b]),oe=we(g=>{let{value:y,closable:h,onClose:u}=g,f=b.find(p=>p.id===y)||R.find(p=>p.id===y);return f?z(zt,{content:X(f),trigger:"click",placement:"right",children:Sr("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[z("span",{style:{marginRight:8},children:f.name}),h&&z("span",{onClick:u,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):z("div",{children:y})},[b,R]),he=we(g=>{let y=b.find(h=>h.id===g)||R.find(h=>h.id===g);return y?z(zt,{content:X(y),trigger:"click",placement:"right",children:z("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:z("span",{children:y.name})})}):z("div",{children:g})},[b,R]),me=we(g=>{if(!g)return null;let y=Array.isArray(g)?g[0]:g;return b.find(h=>h.id===y)||R.find(h=>h.id===y)},[b,R]);return z(Ss,{...c,mode:e?"multiple":void 0,showSearch:!0,loading:m,filterOption:!1,onSearch:G,onPopupScroll:K,notFoundContent:m?z(_s,{size:"small"}):null,allowClear:t,value:e||typeof o=="string"?o:o?.toString(),onChange:W,options:ye,style:{...c.style,minHeight:"32px"},tagRender:e?oe:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:g=>{let y=me(o);return y?Sr("div",{children:[z("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:he(y.id)}),g]}):g},suffixIcon:e?void 0:o?z("div",{onClick:g=>{g.stopPropagation();let y=me(o);if(y){let h=document.createElement("div");document.body.appendChild(h);let u=js.createRoot(h);u.render(z(zt,{content:X(y),trigger:"click",placement:"right",open:!0,onOpenChange:f=>{f||(u.unmount(),document.body.removeChild(h))},children:z("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:z("span",{className:"ant-select-arrow"})}):z("span",{className:"ant-select-arrow"})})};import{useEffect as Ze,useState as Oe,useCallback as Te,useRef as $t,useMemo as Nr}from"react";import{Select as qs,Spin as $s,message as Xs,Popover as Xt,Card as Gs,Typography as Js,Space as Ks}from"antd";import{debounce as Qs}from"lodash-es";import Ys from"react-dom/client";import As from"dexie";var Os=3600*1e3,Ht=class extends As{constructor(){super("RoleInfoDB");F(this,"roleCache");this.version(1).stores({roleCache:"id, timestamp"})}},Ye=new Ht,Ms=async()=>{try{let e=await Ye.roleCache.get("ROLE_ALL");if(e){if(Date.now()-e.timestamp<Os)return e.data;await Ye.roleCache.delete("ROLE_ALL")}return null}catch(e){return console.error("\u8BFB\u53D6\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e),null}},Fs=async e=>{try{await Ye.roleCache.put({id:"ROLE_ALL",data:e,timestamp:Date.now()})}catch(t){console.error("\u5199\u5165\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",t)}},Bs=async()=>{try{await Ye.roleCache.clear()}catch(e){console.error("\u6E05\u9664\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e)}},Vt=async({forceRefresh:e=!1})=>{if(!e){let n=await Ms();if(n)return n}let t=await ne.user.role.listRoles();if(t?.code!==200)return null;let r=t.data||[];return await Fs(r),r},_r=async({roleId:e,forceRefresh:t=!1})=>{let r=await Vt({forceRefresh:t});return r&&r.find(n=>n.id===e)||null},Ls=async({roleId:e,forceRefresh:t=!1})=>(await _r({roleId:e,forceRefresh:t}))?.name||"",Wt=async({forceRefresh:e=!1}={})=>{let t=await Vt({forceRefresh:e}),r={};return(t||[]).forEach(n=>{r[n.id]=n.name}),r},zs=async({roleIds:e})=>{let t=await Wt();return(e||[]).filter(n=>!!n&&!t[n]).length>0&&(t=await Wt({forceRefresh:!0})),t},Hs=async()=>{await Bs()},Ws=async()=>{try{let e=await Ye.roleCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},kr={getRoleList:Vt,getRoleById:_r,getRoleNameById:Ls,getRoleNameMap:Wt,getRoleNameMapForIds:zs,clearRoleCache:Hs,getCacheStats:Ws};var qt=class{constructor(){F(this,"cache",new Map);F(this,"defaultExpireTime",300*1e3)}set(t,r,n=this.defaultExpireTime){this.cache.set(t,{data:r,timestamp:Date.now(),expireTime:n})}get(t){let r=this.cache.get(t);return r?Date.now()-r.timestamp>r.expireTime?(this.cache.delete(t),null):r.data:null}clear(){this.cache.clear()}},pt=new qt;function Vs(){pt.clear()}import{jsx as H,jsxs as Ur}from"react/jsx-runtime";var{Text:cl}=Js,dl=({multiple:e=!1,allowClear:t=!0,timeout:r=1e4,retryCount:n=3,enableCache:d=!0,excludeRoleIds:s=[],cacheExpireTime:a,value:o,onChange:i,...c})=>{let[m,C]=Oe(!1),[b,w]=Oe([]),[_,j]=Oe(""),[P,A]=Oe(1),[N,I]=Oe(!0),[R,T]=Oe([]),D=$t(null),O=$t([]),x=$t([]);Ze(()=>{O.current=b},[b]),Ze(()=>{x.current=R},[R]);let B=Te(g=>g.map(y=>{let h=O.current.find(u=>u.id===y);return h||x.current.find(u=>u.id===y)}).filter(y=>y!==void 0),[]),W=Te(g=>{if(!g){T([]),i?.([],[]);return}let y=e?Array.isArray(g)?g:[g]:typeof g=="string"?[g]:g;if(y.length===0){T([]),i?.([],[]);return}let h=B(y);T(h),i?.(y,h)},[B,i,e]);Ze(()=>{if(!o||o.length==0){T([]);return}let g=e?Array.isArray(o)?o:[]:typeof o=="string"?[o]:[],y=B(g);if(R.length==y.length){let h=0;for(h=0;h<y.length&&!R.find(u=>u.id==y[h].id?u:null);h++);if(h<y.length)return}T(y)},[o,B,e]);let v=Te(async(g,y=n)=>{try{D.current=new AbortController;let h=D.current.signal,u=new Promise((p,E)=>{setTimeout(()=>{E(new Error("\u8BF7\u6C42\u8D85\u65F6")),D.current?.abort()},r)});return await Promise.race([g(),u])}catch(h){if(y>0&&!(h instanceof Error&&h.name==="AbortError"))return await new Promise(u=>setTimeout(u,1e3)),v(g,y-1);throw h}},[r,n]),S=Te(async(g,y=!1)=>{try{C(!0);let h=`roles_${g}`;if(d&&!g){let p=pt.get(h);if(p){w(E=>y?[...E,...p]:p),I(!1);return}}let f=(await v(async()=>await kr.getRoleList({forceRefresh:!0})||[])).filter(p=>!s.includes(p.id));d&&!g&&pt.set(h,f,a),w(p=>y?[...p,...f]:f),I(!1)}catch(h){console.error("\u83B7\u53D6\u89D2\u8272\u5217\u8868\u5931\u8D25:",h),Xs.error("\u83B7\u53D6\u89D2\u8272\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{C(!1)}},[s,v,d,a]);Ze(()=>()=>{D.current?.abort()},[]);let G=Nr(()=>Qs(g=>{j(g),A(1),S(g,!1)},300),[S]),K=Te(g=>{let{target:y}=g;if(!y)return;let{scrollTop:h,scrollHeight:u,clientHeight:f}=y;if(u-h<=f*1.5&&!m&&N){let p=P+1;A(p),S(_,!0)}},[m,N,P,_,S]);Ze(()=>{S("",!1)},[S]);let X=g=>H(Gs,{size:"small",style:{width:280},children:H(Ks,{direction:"vertical",size:"small",style:{width:"100%"},children:H("div",{style:{display:"flex",alignItems:"center",gap:8},children:H("div",{children:H("div",{style:{fontWeight:"bold"},children:g.name})})})})}),fe=g=>{let y=[];return y.push(H("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:g.name},"name")),H("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:y})},ye=Nr(()=>b.map(g=>({label:fe(g),value:g.id,user:g})),[b]),oe=Te(g=>{let{value:y,closable:h,onClose:u}=g,f=b.find(p=>p.id===y)||R.find(p=>p.id===y);return f?H(Xt,{content:X(f),trigger:"click",placement:"right",children:Ur("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[H("span",{style:{marginRight:8},children:f.name}),h&&H("span",{onClick:u,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):H("div",{children:y})},[b,R]),he=Te(g=>{let y=b.find(h=>h.id===g)||R.find(h=>h.id===g);return y?H(Xt,{content:X(y),trigger:"click",placement:"right",children:H("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:H("span",{children:y.name})})}):H("div",{children:g})},[b,R]),me=Te(g=>{if(!g)return null;let y=Array.isArray(g)?g[0]:g;return b.find(h=>h.id===y)||R.find(h=>h.id===y)},[b,R]);return H(qs,{...c,mode:e?"multiple":void 0,showSearch:!0,loading:m,filterOption:!1,onSearch:G,onPopupScroll:K,notFoundContent:m?H($s,{size:"small"}):null,allowClear:t,value:e||typeof o=="string"?o:o?.toString(),onChange:W,options:ye,style:{...c.style,minHeight:"32px"},tagRender:e?oe:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:g=>{let y=me(o);return y?Ur("div",{children:[H("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:he(y.id)}),g]}):g},suffixIcon:e?void 0:o?H("div",{onClick:g=>{g.stopPropagation();let y=me(o);if(y){let h=document.createElement("div");document.body.appendChild(h);let u=Ys.createRoot(h);u.render(H(Xt,{content:X(y),trigger:"click",placement:"right",open:!0,onOpenChange:f=>{f||(u.unmount(),document.body.removeChild(h))},children:H("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:H("span",{className:"ant-select-arrow"})}):H("span",{className:"ant-select-arrow"})})};import{useEffect as Me,useState as Fe,useCallback as Ne,useRef as Gt,useMemo as Jt}from"react";import{Select as Zs,Avatar as ft,Spin as eo,message as to,Popover as Kt,Card as ro,Typography as no,Space as so}from"antd";import{debounce as oo}from"lodash-es";import io from"react-dom/client";import{jsx as M,jsxs as pe}from"react/jsx-runtime";var{Text:et}=no,Il=({multiple:e=!1,userType:t="all",excludeUserIds:r=[],showAvatar:n=!0,showUsername:d=!0,showNickname:s=!0,showPhone:a=!0,searchFields:o=["username","nickname","phone"],pageSize:i=10,allowClear:c=!0,value:m,initialUsers:C,onChange:b,...w})=>{let[_,j]=Fe(!1),[P,A]=Fe([]),[N,I]=Fe(""),[R,T]=Fe(1),[D,O]=Fe(!0),[x,B]=Fe([]),W=Gt([]),v=Gt([]),S=Gt([]),G=Ne(u=>W.current.find(f=>f.id===u)||v.current.find(f=>f.id===u)||(S.current||[]).find(f=>f.id===u),[]);Me(()=>{S.current=C||[]},[C]);let K=Ne(async u=>{try{j(!0);let f=await ut.getUserInfos({keywords:u||"",forceRefresh:!1}),p=Array.from(f.values());p=p.filter(k=>k.username!=="admin"),t==="admin"?p=p.filter(k=>k.isAdmin):t==="user"&&(p=p.filter(k=>!k.isAdmin)),u&&(p=p.filter(k=>o.some(J=>{let Qt=k[J];return Qt&&Qt.toLowerCase().includes(u.toLowerCase())}))),r.length>0&&(p=p.filter(k=>!r.includes(k.id))),p.sort((k,J)=>(k.username||"").localeCompare(J.username||""));let E=p;A(k=>[...k,...E]),O(!1)}catch(f){console.error("\u83B7\u53D6\u4EBA\u5458\u5217\u8868\u5931\u8D25:",f),to.error("\u83B7\u53D6\u4EBA\u5458\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{j(!1)}},[t,r,o]);Me(()=>{K(null)},[K]),Me(()=>{W.current=P},[P]),Me(()=>{v.current=x},[x]);let X=Ne(u=>{if(!u||u.length==0){B([]),b?.([],[]);return}let f=Array.isArray(u)?u:[u],p=[];for(let E=0;E<f.length;E++){let k=f[E],J=G(k);J?p.push(J):p.push({id:k,username:k,nickname:"",phone:"",avatar:{avatar_small:""}})}if(x.length==p.length){let E=0;for(E=0;E<p.length&&!x.find(k=>k.id==p[E].id?k:null);E++);if(E<p.length)return}B(p.slice()),b?.(f,p)},[b,x]);Me(()=>{if(!m||m.length==0){if(!x||x.length==0)return;B([]);return}m.sort();let u=[];x&&(u=x.map(f=>f.id),u.sort()),m.join(",")!=u.join(",")&&X(m)},[m,e,X,x]),Me(()=>{if(!m||m.length==0)return;let f=m.map(p=>{let E=G(p);return E||{id:p,username:p,nickname:"",phone:"",type:null}}).filter(p=>p!==void 0);B(p=>p.length!==f.length||p.some((E,k)=>E.id!==f[k]?.id||E.username!==f[k]?.username)?f:p)},[P,m,C,G]);let fe=Jt(()=>oo(u=>{I(u),T(1),K(u)},300),[K]),ye=Ne(u=>{let{target:f}=u;if(!f)return;let{scrollTop:p,scrollHeight:E,clientHeight:k}=f;if(E-p<=k*1.5&&!_&&D){let J=R+1;T(J),K(N)}},[_,D,R,N,K]),oe=u=>M(ro,{size:"small",style:{width:280},children:pe(so,{direction:"vertical",size:"small",style:{width:"100%"},children:[pe("div",{style:{display:"flex",alignItems:"center",gap:8},children:[M(ft,{src:u?.avatar?.avatar_small,size:40,children:u.nickname?.[0]||u.username?.[0]}),pe("div",{children:[M("div",{style:{fontWeight:"bold"},children:u.nickname||u.username}),u.title&&M(et,{type:"secondary",style:{fontSize:12},children:u.title})]})]}),u.phone&&pe("div",{children:[M(et,{type:"secondary",style:{fontSize:12},children:"\u624B\u673A\u53F7\uFF1A"}),M(et,{style:{fontSize:12},children:u.phone})]}),u.departmentInfo?.department_names&&pe("div",{children:[M(et,{type:"secondary",style:{fontSize:12},children:"\u6240\u5C5E\u90E8\u95E8\uFF1A"}),M(et,{style:{fontSize:12},children:u.departmentInfo?.department_names.join("\u3001")})]})]})}),he=Jt(()=>u=>{let f=[];return n&&f.push(M(ft,{src:u?.avatar?.avatar_small,size:20,style:{marginRight:8,verticalAlign:"middle",flexShrink:0},children:u.nickname?.[0]||u.username?.[0]},"avatar")),s&&u.nickname&&f.push(M("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:u.nickname},"nickname")),d&&f.push(pe("span",{style:{marginLeft:8,color:"rgb(var(--color-gray-400))",verticalAlign:"middle",lineHeight:"20px"},children:["(",u.username,")"]},"username")),a&&u.phone&&f.push(M("span",{style:{marginLeft:8,color:"rgb(var(--color-gray-400))",verticalAlign:"middle",lineHeight:"20px"},children:u.phone},"phone")),M("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:f})},[n,d,s,a]),me=Jt(()=>[...P,...x].filter((p,E,k)=>k.findIndex(J=>J.id===p.id)===E).map(p=>({label:he(p),value:p.id,user:p})),[P,x,he]),g=Ne(u=>{let{value:f,closable:p,onClose:E}=u,k=P.find(J=>J.id===f)||x.find(J=>J.id===f)||(C||[]).find(J=>J.id===f);return k?M(Kt,{content:oe(k),trigger:"click",placement:"right",children:pe("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[M(ft,{src:k?.avatar?.avatar_small,size:20,style:{marginRight:8},children:k.nickname?.[0]||k.username?.[0]}),M("span",{style:{marginRight:8},children:k.nickname||k.username}),p&&M("span",{onClick:E,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):M("div",{children:f})},[P,x,C]),y=Ne(u=>{let f=P.find(p=>p.id===u)||x.find(p=>p.id===u)||(C||[]).find(p=>p.id===u);return f?M(Kt,{content:oe(f),trigger:"click",placement:"right",children:pe("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:[M(ft,{src:f?.avatar?.avatar_small,size:20,style:{marginRight:8},children:f.nickname?.[0]||f.username?.[0]}),M("span",{children:f.nickname||f.username})]})}):M("div",{children:u})},[P,x,C]),h=Ne(u=>{if(!u||u.length==0)return null;let f=u[0];return P.find(p=>p.id===f)||x.find(p=>p.id===f)||(C||[]).find(p=>p.id===f)},[P,x,C]);return M(Zs,{...w,mode:e?"multiple":void 0,showSearch:!0,loading:_,filterOption:!1,onSearch:fe,onPopupScroll:ye,notFoundContent:_?M(eo,{size:"small"}):null,allowClear:c,value:m,onChange:X,options:me,style:{...w.style,minHeight:"32px"},tagRender:e?g:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:u=>{let f=h(m);return f?pe("div",{children:[M("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:y(f.id)}),u]}):u},suffixIcon:e?void 0:m?M("div",{onClick:u=>{u.stopPropagation();let f=h(m);if(f){let p=document.createElement("div");document.body.appendChild(p);let E=io.createRoot(p);E.render(M(Kt,{content:oe(f),trigger:"click",placement:"right",open:!0,onOpenChange:k=>{k||(E.unmount(),document.body.removeChild(p))},children:M("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:M("span",{className:"ant-select-arrow"})}):M("span",{className:"ant-select-arrow"})})};import{useEffect as ao,useRef as lo,useState as jr}from"react";import{Upload as Er,Button as rt,Modal as co,Image as mo,Space as uo,message as go,Progress as po}from"antd";import{UploadOutlined as fo,DownloadOutlined as Ar,EyeOutlined as yo,FilePdfFilled as ho,FileExcelFilled as bo,FileWordFilled as vo,FileTextFilled as Co,FileUnknownFilled as Io}from"@ant-design/icons";import*as Be from"febs-browser";function Dr(e,t,r){r.method=r.method||"POST",r.headers=r.headers||{},r.timeout=r.timeout||5e3,r.withCredentials=r.withCredentials||!0,r.crossDomain=r.crossDomain||!0,r.sliceOffset=r.sliceOffset||0,r.sliceLength=r.sliceLength||-1;let n={success:r.success,method:r.method||"POST",url:r.url,mode:r.crossDomain!=!0?"same-origin":"cors",timeout:r.timeout||5e3};r=Be.utils.mergeMap(n,r||{});let d=Be.$(e);if(d.attr("enctype")&&d.attr("enctype").toLowerCase()==="multipart/form-data"){let a=new FormData,o=File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice,i=t.name,c=i.lastIndexOf("/");c>=0&&(i=i.substr(c+1)),c=i.lastIndexOf("\\"),c>=0&&(i=i.substr(c+1));let m=r.sliceLength||-1;m==-1&&(m=t.size-(r.sliceOffset||0));let C=o.call(t,r.sliceOffset,(r.sliceOffset||0)+m);a.append("file",C,i),r.data=a}else throw new Error("only support multipart/form-data");let s;return r.headers?s=r.headers:s={},s["Content-Type"]=!1,Be.net.ajax({url:r.url,type:r.method,headers:s,processData:!1,data:r.data,timeout:r.timeout,withCredentials:r.withCredentials,success:function(a){r.success&&r.success(a)},error:function(a,o,i){r.error&&r.error(i)},complete:r.complete,progress:r.progress})}var yt=class yt{static uploadSingle(t,r,n,d,s){new FormData().append("file",t);let o=document.createElement("form");o.setAttribute("enctype","multipart/form-data");let i={headers:{}};return i.headers.set=(c,m)=>{i.headers[c]=m},ge.requestHandleSid(i),delete i.headers.set,Dr(o,t,{url:yt.UPLOAD_SINGLE_URL+"?size="+t.size+"&crc32="+r,success:(c=>{c=JSON.parse(c),c.code===200?Y.success("\u6587\u4EF6\u4E0A\u4F20\u6210\u529F"):Y.error(c.message||"\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"),s&&s(c)}),error:(c=>{console.error("File upload error:",c),Y.error("\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"),d&&d(c)}),progress:n||(c=>{console.log(`\u4E0A\u4F20\u8FDB\u5EA6: ${c}%`)}),complete:c=>{},data:"",method:"POST",headers:i.headers,timeout:Number(import.meta.env.VITE_API_UPLOAD_TIMEOUT)||5e3,withCredentials:!0,crossDomain:!0,sliceOffset:0,sliceLength:-1})}static copyFromServer(t){return l.post(import.meta.env.VITE_API_BASE+"/api/fs/copy",{sourcePath:t},null)}};F(yt,"UPLOAD_SINGLE_URL",import.meta.env.VITE_API_BASE+"/api/fs/upload");var tt=yt;import*as Or from"febs-browser";import{jsx as L,jsxs as nt}from"react/jsx-runtime";var Ol=({fileList:e,onChange:t,onFinish:r,cancel:n,btnText:d="\u4E0A\u4F20\u6587\u4EF6",maxCount:s=5,disabled:a=!1,multiple:o=!0,accept:i=void 0})=>{let[c,m]=jr(void 0),C=lo(e);ao(()=>{C.current=e},[e]);let b=({fileList:N})=>{t?.(N)},w=N=>{t?.(C.current.filter(I=>I.uid!==N.uid))},_=N=>{let I=N.size/1024/1024<100;return I||go.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7100MB"),I||Er.LIST_IGNORE},j=async N=>{let{file:I,onSuccess:R,onError:T,onProgress:D}=N;try{I.status="uploading",I.percent=0,D({percent:0}),m(0),Or.crypt.crc32_file(I,O=>{if(O==0){I.status="error",T("calc crc32 error");return}let x=tt.uploadSingle(I,O,B=>{let W=Math.floor(B*100);D({percent:W}),I.percent=W,m(W)},B=>{m(void 0),T(B)},B=>{I.status="done",I.percent=100,m(void 0),R("ok"),r&&r([I],B).then(()=>{}).catch(()=>{})});I.cancel=()=>{x.abort(),I.status="error",I.percent=0,m(void 0),T(new Error("\u4E0A\u4F20\u5DF2\u53D6\u6D88")),w(I)}})}catch(O){I.status="error",m(void 0),T(O)}},P=c!==void 0&&c<100;return L(Er,{fileList:e,onChange:b,beforeUpload:_,customRequest:j,multiple:o,maxCount:s,disabled:a,itemRender:(N,I,R,T)=>P?nt("div",{className:"flex items-center justify-between w-full mt-2 rounded border border-blue-100 bg-blue-50 px-3 py-2",children:[L("span",{className:"mr-3 min-w-0 max-w-[120px] flex-1 truncate text-sm text-gray-700",children:I.name}),L(po,{className:"w-[60px]",percent:Math.round(I.percent||0),size:"small",status:"active",showInfo:!0}),L(rt,{className:"ml-3",size:"small",onClick:()=>{n?n(I):I.cancel?.(),w(I)},danger:!0,children:"\u53D6\u6D88"})]}):null,accept:i,showUploadList:!0,children:!P&&L(rt,{icon:L(fo,{}),disabled:a||P,title:o?`\u4E0A\u4F20\u6587\u4EF6\uFF08\u6700\u591A\u652F\u6301${s}\u4E2A\u6587\u4EF6\uFF0C\u5355\u4E2A\u6587\u4EF6\u4E0D\u8D85\u8FC7100MB\uFF09`:"\u4E0A\u4F20\u6587\u4EF6\uFF08\u5355\u4E2A\u6587\u4EF6\u4E0D\u8D85\u8FC7100MB\uFF09",children:P?nt("span",{className:"inline-block w-[85px]",children:["\u4E0A\u4F20\u4E2D ",c,"%"]}):d})})},Ml=({files:e=[],onPreview:t,onDownload:r})=>e.length===0?null:L("div",{className:"p-4 bg-gray-50 rounded",children:e.map((n,d)=>nt("div",{className:"flex items-center mb-2",children:[Mr(n),L("span",{className:"mr-2",children:n.name}),nt(uo,{children:[t&&L(rt,{type:"link",size:"small",icon:L(yo,{}),onClick:()=>t(n),children:"\u67E5\u770B"}),r&&L(rt,{type:"link",size:"small",icon:L(Ar,{}),onClick:()=>r(n),children:"\u4E0B\u8F7D"})]})]},n.uid||d))}),Mr=e=>{let t=e.type||"";return t.includes("pdf")?L(ho,{className:"mr-2 text-red-500"}):t.includes("excel")||t.includes("spreadsheet")||e.name.endsWith(".xlsx")||e.name.endsWith(".xls")?L(bo,{className:"mr-2 text-green-500"}):t.includes("word")||t.includes("document")||e.name.endsWith(".docx")||e.name.endsWith(".doc")?L(vo,{className:"mr-2 text-blue-500"}):t.includes("image")?L(Co,{className:"mr-2 text-purple-500"}):L(Io,{className:"mr-2 text-gray-500"})},Fl=({visible:e,file:t,onClose:r,onDownload:n})=>{if(!t)return null;let[d,s]=jr(""),a=t.name||"",o=t.type?.startsWith("image/");return o&&it(t,i=>{s(i||"")}),L(co,{open:e,title:a,footer:null,onCancel:r,width:800,children:o?L(mo,{alt:a,style:{width:"100%"},src:d}):nt("div",{className:"text-center p-8",children:[L("div",{className:"text-6xl mb-4",children:Mr(t)}),L("p",{className:"mb-4",children:a}),L("p",{className:"text-gray-500 mb-4",children:"\u8BE5\u6587\u4EF6\u7C7B\u578B\u65E0\u6CD5\u76F4\u63A5\u9884\u89C8"}),n&&L(rt,{type:"primary",icon:L(Ar,{}),onClick:()=>n(t),children:"\u4E0B\u8F7D\u6587\u4EF6\u67E5\u770B"})]})})};export{ka as CommentTimeline,tt as FileUploadHandler,Va as ProjectSelector,dl as RoleSelector,wi as SingletonToastProvider,vt as UIDatePicker,Vo as UIDateRangePicker,Ml as UIFileList,Ol as UIFileUpload,Fl as UIFileUploadPreviewModal,ri as UIImageUpload,vn as UILoading,Hi as UIResizableTable,fi as UISelect,Oi as UITableGridViewToggle,Ri as UIToast,ki as UIToastSingle,Ni as UIToastSingleProvider,Hn as UIViewToggle,Il as UserSelector,Vs as clearRoleCache,It as compressImage,So as uiAlert,jo as uiConfirm,ve as uiLoading,Y as uiToast};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spacecorexdev/core",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Vendorsys 基础包:API 基座、公共 UI 组件、工具函数、hooks、类型、样式、WebSocket、导航契约",
package/types/index.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  /**
2
2
  * @spacecorexdev/core 主入口 —— 公共层统一导出。
3
3
  * 消费方应从子路径导入以获得精确的类型和 tree-shaking:
4
- * import { API } from '@spacecorexdev/core/api';
5
- * import { uiConfirm } from '@spacecorexdev/core/ui';
6
- * import { CORE_VERSION } from '@spacecorexdev/core/contract';
4
+ * import { API } from '@spacecorexdev/core';
5
+ * import { uiConfirm } from '@spacecorexdev/core';
6
+ * import { CORE_VERSION } from '@spacecorexdev/core';
7
7
  */
8
8
  export { CORE_VERSION } from './contract';
9
9
  export type { ModuleRuntimeProps, ModuleManifest } from './contract';
10
10
  export * from './api';
11
- export * from './utils';
12
11
  export * from './hooks';
13
12
  export * from './types';
13
+ export * from './ui';
14
+ export * from './utils';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { TableProps } from 'antd';
3
+ /**
4
+ * 与 antd Table 用法完全一致的表格组件,区别是所有列默认支持拖拽表头边界调节宽度。
5
+ * 首次拖拽时会按表头当前实际宽度建立基准,避免列宽跳变。
6
+ */
7
+ export declare function UIResizableTable<RecordType extends object = any>(props: TableProps<RecordType>): React.JSX.Element;
@@ -8,7 +8,7 @@ export * from './UISelect';
8
8
  export * from './UIToast';
9
9
  export * from './UIToastSingle';
10
10
  export * from './UIViewToggle';
11
- export * from './ResizableTable';
11
+ export * from './UIResizableTable';
12
12
  export * from './CommentTimeline';
13
13
  export * from './ProjectSelector';
14
14
  export * from './RoleSelector';