@spacecorexdev/core 0.2.0 → 0.2.2

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/api/index.js CHANGED
@@ -1 +1 @@
1
- var O=Object.defineProperty;var X=(e,t,s)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var v=(e,t)=>{for(var s in t)O(e,s,{get:t[s],enumerable:!0})};var d=(e,t,s)=>X(e,typeof t!="symbol"?t+"":t,s);var U={};v(U,{AuthorizationHandler:()=>C,HttpRequest:()=>n,ResponseCode:()=>V});import ne,{AxiosError as se}from"axios";import{useEffect as Ie,useState as _e,useRef as be}from"react";import{notification as g}from"antd";import{CheckCircleOutlined as K,CloseCircleOutlined as G,InfoCircleOutlined as W,WarningOutlined as Q}from"@ant-design/icons";import{Fragment as Se,jsx as T,jsxs as De}from"react/jsx-runtime";var z={success:T(K,{style:{color:"#52c41a"}}),error:T(G,{style:{color:"#ff4d4f"}}),info:T(W,{style:{color:"#1677ff"}}),warning:T(Q,{style:{color:"#faad14"}})};g.config({placement:"topRight",duration:3,zIndex:1e4});var y=class y{constructor(){d(this,"currentToast",null);d(this,"api",null);d(this,"isInitialized",!1);d(this,"pendingToast",null)}static getInstance(){return y.instance||(y.instance=new y),y.instance}init(t){if(this.api=t,this.isInitialized=!0,this.pendingToast){let s=this.pendingToast;this.pendingToast=null,this.show(s)}}show(t){let{key:s,type:r,message:a,descs:p,duration:m,placement:c,onClose:i}=t;if(!this.isInitialized||!this.api){this.pendingToast=t;return}this.currentToast?.timer&&clearTimeout(this.currentToast.timer),this.currentToast&&this.currentToast.key===s?(g.destroy(s),this.createNotification({key:s,type:r,message:a,descs:p,duration:m,placement:c,onClose:i})):(this.currentToast&&g.destroy(this.currentToast.key),this.createNotification({key:s,type:r,message:a,descs:p,duration:m,placement:c,onClose:i}))}createNotification(t){if(!this.api)return;let{key:s,type:r,message:a,descs:p,duration:m,placement:c,onClose:i}=t,N={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)}[r];N({key:s,message:a,description:p,duration:m,placement:c||"topRight",icon:z[r],onClose:()=>{this.currentToast?.key===s&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),this.currentToast=null),i?.()}}),this.currentToast={key:s,type:r,message:a,descs:p,duration:m,placement:c,timer:null}}close(){this.currentToast&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),g.destroy(this.currentToast.key),this.currentToast=null)}destroy(){this.close(),g.destroy()}};d(y,"instance");var k=y,Re=k.getInstance();function R(e){return typeof e=="string"?{message:e,duration:3}:e}function I(e){return z[e]}var Z={success:e=>{if(!e)return;let t=R(e);g.success({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:I("success"),onClose:t.onClose})},error:e=>{if(!e)return;let t=R(e);g.error({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:I("error"),onClose:t.onClose})},info:e=>{if(!e)return;let t=R(e);g.info({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:I("info"),onClose:t.onClose})},warning:e=>{if(!e)return;let t=R(e);g.warning({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:I("warning"),onClose:t.onClose})},custom:(e,t)=>{let{message:s,descs:r,duration:a,placement:p,onClose:m}=t;g[e]({message:s,description:r,duration:a,placement:p,icon:I(e),onClose:m})}};var S=Z;import{Spin as Y}from"antd";import{LoadingOutlined as $}from"@ant-design/icons";import{createRoot as ee}from"react-dom/client";import{jsx as _}from"react/jsx-runtime";var M=Symbol("loading");function B(){let e=window[M];return e||(e={count:0,timeoutId:0,inTimeout:!1},window[M]=e),e}var L={tip:"",fullscreen:!0,delay:0,mask:!0,iconSize:40,wrapperClassName:"ui-loading-wrapper"},te=e=>{let t={...L,...e},{tip:s,fullscreen:r,mask:a,maskStyle:p,iconSize:m,iconStyle:c,containerStyle:i,wrapperClassName:N}=t,H=_($,{style:{fontSize:m,color:"#1677ff",...c},spin:!0}),q=r?{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9999,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:a?"rgba(0, 0, 0, 0.45)":"transparent",...p}:{},J={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...i};return _("div",{style:q,className:N,children:_("div",{style:J,children:_(Y,{indicator:H,children:s})})})},l=null,u=null,x=(e={})=>(l&&u&&(u.unmount(),document.body.removeChild(l),l=null,u=null),l=document.createElement("div"),document.body.appendChild(l),u=ee(l),u.render(_(te,{...e})),l),D={show:(e={})=>{let t=B();t.count++;let s={...L,...e};if(s.delay&&s.delay>0){t.timeoutId!=0&&(window.clearTimeout(t.timeoutId),t.timeoutId=0),t.timeoutId=window.setTimeout(()=>{t.timeoutId=0,x(s)},s.delay);return}else x(s)},hide:()=>{let e=B();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&&l&&u&&(u.unmount(),document.body.removeChild(l),l=null,u=null)},service:(e,t={})=>(D.show(t),e.then(s=>(D.hide(),s)).catch(s=>{throw D.hide(),s}))},b=D;import*as w from"febs-browser";import*as P from"febs-browser";import F from"store2";var j=class{constructor(t){d(this,"s");this.s=t}get length(){return this.s.size()}keys(){return this.s.keys()}set(t,s){return s?(s=JSON.stringify(s),s=P.crypt.base64_encode(s),this.s.set(t,s,!0),this):this.remove(t)}get(t,s=null){if(!this.s.has(t))return s;let r=this.s.get(t);if(r){r=P.crypt.base64_decode(r),r=P.string.bytesToUtf8(r||[]);try{return JSON.parse(r)}catch{return this.remove(t),null}}return r}remove(t){return this.s.remove(t),this}clear(){return this.s.clearAll(),this}},f={namespace:function(e){return new j(F.namespace(e||"default"))},namespace_session:function(e){return new j(F.session.namespace(e||"default"))}};var V=(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))(V||{});function re(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 h=ne.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}),o=class o{static clearStoreToken(){this.setStoreToken(null,0)}static getStoreToken(){let t=f.namespace("bp.ss").get("ss");if(t){let s=f.namespace("bp.ss").get("exp");return{token:JSON.parse(t),exp:s?JSON.parse(s):0}}return null}static getValidStoreToken(){let t=o.getStoreToken();return t&&t.exp>Date.now()-o.TOKEN_EXP?t.token:null}static setStoreToken(t,s){t?(f.namespace("bp.ss").set("ss",JSON.stringify(t)),f.namespace("bp.ss").set("exp",JSON.stringify(s))):f.namespace("bp.ss").clear()}static requestHandleSid(t){let s=o.getStoreToken();s&&s.exp>Date.now()-o.TOKEN_EXP&&t.headers.set(o.HEADER_NAME,o.HEADER_PREFIX+s.token)}static responseHandleSid(t){let s=t.headers.get(o.HEADER_NAME);if(s&&s.startsWith(o.HEADER_PREFIX.trim())){s=s.replace(o.HEADER_PREFIX,"");let r=s;if(s=s.split(".")[1],s&&(s=w.string.bytesToUtf8(w.crypt.base64_decode(s)),s)){let a=JSON.parse(s);return a.exp<Date.now()-o.TOKEN_EXP?(o.clearStoreToken(),!1):(o.setStoreToken(r,a.exp),!0)}o.clearStoreToken(),typeof navigator<"u"&&navigator.onLine&&(window.location.href="/")}return!1}};d(o,"HEADER_NAME","Authorization"),d(o,"HEADER_PREFIX","SPBearer "),d(o,"TOKEN_EXP",20*1e3);var C=o;h.interceptors.request.use(e=>(b.show({delay:5e3}),C.requestHandleSid(e),e),e=>(b.hide(),console.log("Request Error =========="),Promise.reject(e)));h.interceptors.response.use(e=>(b.hide(),e.data.code!==200&&S.warning(e.data.message||re(e.data.code)),C.responseHandleSid(e),e.data),e=>(b.hide(),e instanceof se&&(e.code==="ERR_NETWORK"||e.code==="ECONNABORTED"?S.error("\u7F51\u7EDC\u9519\u8BEF"):e.code==="ERR_BAD_RESPONSE"&&S.error("\u670D\u52A1\u5668\u65E0\u54CD\u5E94")),console.log("Response Error =========="),Promise.reject(e)));var n={get(e,t,s){return h({method:"get",url:e,params:t,data:s})},post(e,t,s){return h({method:"post",url:e,params:t,data:s})},put(e,t,s){return h({method:"put",url:e,params:t,data:s})},delete(e,t,s){return h({method:"delete",url:e,params:t,data:s})}};var E={};v(E,{admin:()=>ie,gateway:()=>oe,message:()=>ae,role:()=>de,user:()=>ge});var ie={registerAdmin:e=>n.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=>n.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=>n.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=>n.get("/api/admin/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)},oe={register:e=>n.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=>n.post("/api/sendSms",{phone:e.phone,imageCode:e.imageCode},null).then(t=>t),isLogin:()=>n.get("/api/isLogin",null,null).then(e=>e),login:e=>n.post("/api/login",null,{phone:e.phone,pwd:e.pwd,pwdSN:e.pwdSN,smsCode:e.smsCode}).then(t=>t),verifyPasswordHash:e=>n.post("/api/verifyPasswordHash",null,{passwordHash:e.passwordHash,passwordSalt:e.passwordSalt}).then(t=>t),logout:()=>n.get("/api/logout",null,null).then(e=>e),listPermissions:()=>n.get("/api/listPermissions",null,null).then(e=>e),listRolePermissions:e=>n.get("/api/listRolePermissions",{id:e.id},null).then(t=>t)},ae={list:e=>n.get("/api/user/message/list",{pageNum:e.pageNum,pageSize:e.pageSize,unread_only:e.unread_only},null).then(t=>t),countUnread:()=>n.get("/api/user/message/unread/count",null,null).then(e=>e),markRead:e=>n.post("/api/user/message/read",null,{messageIds:e.messageIds}).then(t=>t),clearReaded:e=>n.delete("/api/user/message/clearReaded",null,{messageIds:e.messageIds}).then(t=>t)},de={listRoles:()=>n.get("/api/role/listRoles",null,null).then(e=>e),createRole:e=>n.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=>n.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=>n.post("/api/role/assignPermissionsToRole",null,{role_id:e.role_id,permissions:e.permissions}).then(t=>t),assignRoleToUserPermission:()=>n.post("/api/role/assignRoleToUserPermission",null,null).then(e=>e),assignRoleToUser:e=>n.post("/api/role/assignRoleToUser",null,{user_id:e.user_id,role_ids:e.role_ids}).then(t=>t),listUserRoles:e=>n.get("/api/role/listUserRoles",{user_id:e.user_id},null).then(t=>t),listUserPermissions:e=>n.get("/api/role/listUserPermissions",{user_id:e.user_id},null).then(t=>t),listCompanies:()=>n.get("/api/role/listCompanies",null,null).then(e=>e),createCompany:e=>n.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=>n.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:()=>n.get("/api/role/listDepartments",null,null).then(e=>e),createDepartment:e=>n.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=>n.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=>n.post("/api/role/assignUserToDepartment",{user_id:e.user_id,department_id:e.department_id,position:e.position},null).then(t=>t),removeUserFromDepartment:e=>n.post("/api/role/removeUserFromDepartment",{user_id:e.user_id,department_id:e.department_id},null).then(t=>t),listCompanyDepartments:e=>n.get("/api/role/listCompanyDepartments",{company_id:e.company_id},null).then(t=>t),listUserDepartments:e=>n.get("/api/role/listUserDepartments",{user_id:e.user_id},null).then(t=>t),listDepartmentUsers:e=>n.get("/api/role/listDepartmentUsers",{department_id:e.department_id},null).then(t=>t)},ge={getInfoByUsername:e=>n.get("/api/user/infoByUsername",{username:e.username},null).then(t=>t),getInfo:e=>n.get("/api/user/info",{id:e.id},null).then(t=>t),getAvatar:e=>n.get("/api/user/avatar",{id:e.id,tick:e.tick},null).then(t=>t),getAvatarList:e=>n.get("/api/user/avatar_list",{ids:e.ids},null).then(t=>t),updateAvatar:e=>n.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=>n.post("/api/user/updateManager",{id:e.id,managerid:e.managerid},null).then(t=>t),updateInfo:e=>n.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=>n.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=>n.post("/api/user/delete",{id:e.id},null).then(t=>t),list:e=>n.get("/api/user/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),listByIds:e=>n.get("/api/user/list_by_ids",{ids:e.ids},null).then(t=>t),search:e=>n.get("/api/user/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),forbid:e=>n.post("/api/user/forbid",{id:e.id,forbid:e.forbid},null).then(t=>t)};var A={};v(A,{contract:()=>le,file:()=>pe,fileversion:()=>me,project:()=>ue,projectprogress:()=>ce});var le={createContract:e=>n.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=>n.delete("/api/project/contract/delete",{id:e.id},null).then(t=>t),updateContract:e=>n.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=>n.get("/api/project/contract/detail",{id:e.id},null).then(t=>t),getContractList:e=>n.get("/api/project/contract/list",{projectId:e.projectId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),submitApproval:e=>n.post("/api/project/contract/submit",{id:e.id,sealType:e.sealType},null).then(t=>t),cancelApproval:e=>n.post("/api/project/contract/cancelApproval",{id:e.id},null).then(t=>t),uploadVersion:e=>n.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=>n.get("/api/project/contract/version/list",{contractId:e.contractId},null).then(t=>t),deleteVersion:e=>n.delete("/api/project/contract/version/delete",{id:e.id},null).then(t=>t),renameVersion:e=>n.post("/api/project/contract/version/rename",null,{id:e.id,fileName:e.fileName}).then(t=>t),getVersionDetail:e=>n.get("/api/project/contract/version/detail",{id:e.id},null).then(t=>t),setVersionLayerOpinion:e=>n.post("/api/project/contract/version/layerOpinion",null,{contractId:e.contractId,version:e.version,opinion:e.opinion}).then(t=>t),getNewContractCode:e=>n.get("/api/project/contract/newCode",{contractCode:e.contractCode,sequenceLength:e.sequenceLength},null).then(t=>t),getContractHistoryParties:()=>n.get("/api/project/contract/historyParties",null,null).then(e=>e)},pe={getDetail:e=>n.get("/api/project/files/detail",{fileId:e.fileId},null).then(t=>t),listFiles:e=>n.get("/api/project/files/list",{projectId:e.projectId},null).then(t=>t),searchFiles:e=>n.get("/api/project/files/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),addFile:(e,t)=>n.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(s=>s),removeFile:e=>n.post("/api/project/files/remove",{fileId:e.fileId},null).then(t=>t),moveFile:(e,t)=>n.post("/api/project/files/move",{projectId:e.projectId},{oldFileName:t.oldFileName,oldFilePath:t.oldFilePath,newFileName:t.newFileName,newFilePath:t.newFilePath}).then(s=>s),updateFileDescs:e=>n.post("/api/project/files/updateDescs",null,{fileId:e.fileId,descs:e.descs}).then(t=>t),copyFileToProject:e=>n.post("/api/project/files/copyToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),moveFileToProject:e=>n.post("/api/project/files/moveToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),updateFileDelta:e=>n.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=>n.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=>n.post("/api/project/files/generateTempAccessToken",{fileId:e.fileId,expireSeconds:e.expireSeconds},null).then(t=>t),folderDownload:(e,t)=>n.post("/api/project/files/folderDownload",{projectId:e.projectId},{folderPath:t.folderPath,folderName:t.folderName}).then(s=>s),folderDownloadStatus:e=>n.get("/api/project/files/folderDownloadStatus",{jobId:e.jobId},null).then(t=>t),listFilesByTempAccessToken:e=>n.get("/api/project/files/listByTempAccessToken",{tempToken:e.tempToken},null).then(t=>t)},me={listVersions:e=>n.get("/api/project/files/version/list",{fileId:e.fileId},null).then(t=>t),getVersionDetail:e=>n.get("/api/project/files/version/detail",{versionId:e.versionId},null).then(t=>t)},ue={enableUserPrivateProject:()=>n.post("/api/project/enablePrivateProject",null,null).then(e=>e),createProject:e=>n.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=>n.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=>n.post("/api/project/updateUserdataOrder",null,{projectIds:e.projectIds}).then(t=>t),getUserdataOrder:()=>n.get("/api/project/userdataOrder",null,null).then(e=>e),getProjectDetail:e=>n.get("/api/project/detail",{id:e.id},null).then(t=>t),getProjectName:e=>n.get("/api/project/name",{projectId:e.projectId},null).then(t=>t),listProjects:e=>n.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=>n.get("/api/project/listByManager",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),changeStatus:e=>n.put("/api/project/status",{id:e.id,status:e.status},null).then(t=>t),getProjectMembers:e=>n.get("/api/project/members",{projectId:e.projectId},null).then(t=>t),getMemberRole:e=>n.get("/api/project/member/role",{projectId:e.projectId,userId:e.userId},null).then(t=>t),assignMember:e=>n.post("/api/project/members/assign",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t),removeMember:e=>n.post("/api/project/members/remove",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t)},ce={createProgress:e=>n.post("/api/project/progress/create",null,{projectId:e.projectId,descs:e.descs,commentCount:e.commentCount,progressTime:e.progressTime}).then(t=>t),updateProgress:e=>n.put("/api/project/progress/update",null,{id:e.id,descs:e.descs,progressTime:e.progressTime}).then(t=>t),deleteProgress:e=>n.delete("/api/project/progress/delete",{id:e.id},null).then(t=>t),getProgressList:e=>n.get("/api/project/progress/list",{projectId:e.projectId},null).then(t=>t),addComment:e=>n.post("/api/project/progress/comment/add",null,{progressId:e.progressId,comment:e.comment}).then(t=>t),deleteComment:e=>n.delete("/api/project/progress/comment/delete",{id:e.id},null).then(t=>t),updateComment:e=>n.put("/api/project/progress/comment/update",{id:e.id},{}).then(t=>t),getCommentList:e=>n.get("/api/project/progress/comment/list",{progressId:e.progressId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)};var Ge={base:U,user:E,project:A};export{Ge as API,C as AuthorizationHandler,n as HttpRequest,V as ResponseCode,ie as admin,le as contract,pe as file,me as fileversion,oe as gateway,ae as message,ue as project,ce as projectprogress,de as role,ge as user};
1
+ var O=Object.defineProperty;var X=(e,t,s)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var v=(e,t)=>{for(var s in t)O(e,s,{get:t[s],enumerable:!0})};var d=(e,t,s)=>X(e,typeof t!="symbol"?t+"":t,s);var U={};v(U,{AuthorizationHandler:()=>C,HttpRequest:()=>n,ResponseCode:()=>V});import ne,{AxiosError as se}from"axios";import{useEffect as Ie,useState as _e,useRef as be}from"react";import{notification as g}from"antd";import{CheckCircleOutlined as K,CloseCircleOutlined as G,InfoCircleOutlined as W,WarningOutlined as Q}from"@ant-design/icons";import{Fragment as Se,jsx as R,jsxs as je}from"react/jsx-runtime";var z={success:R(K,{style:{color:"#52c41a"}}),error:R(G,{style:{color:"#ff4d4f"}}),info:R(W,{style:{color:"#1677ff"}}),warning:R(Q,{style:{color:"#faad14"}})};g.config({placement:"topRight",duration:3,zIndex:1e4});var y=class y{constructor(){d(this,"currentToast",null);d(this,"api",null);d(this,"isInitialized",!1);d(this,"pendingToast",null)}static getInstance(){return y.instance||(y.instance=new y),y.instance}init(t){if(this.api=t,this.isInitialized=!0,this.pendingToast){let s=this.pendingToast;this.pendingToast=null,this.show(s)}}show(t){let{key:s,type:r,message:a,descs:p,duration:m,placement:c,onClose:i}=t;if(!this.isInitialized||!this.api){this.pendingToast=t;return}this.currentToast?.timer&&clearTimeout(this.currentToast.timer),this.currentToast&&this.currentToast.key===s?(g.destroy(s),this.createNotification({key:s,type:r,message:a,descs:p,duration:m,placement:c,onClose:i})):(this.currentToast&&g.destroy(this.currentToast.key),this.createNotification({key:s,type:r,message:a,descs:p,duration:m,placement:c,onClose:i}))}createNotification(t){if(!this.api)return;let{key:s,type:r,message:a,descs:p,duration:m,placement:c,onClose:i}=t,N={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)}[r];N({key:s,message:a,description:p,duration:m,placement:c||"topRight",icon:z[r],onClose:()=>{this.currentToast?.key===s&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),this.currentToast=null),i?.()}}),this.currentToast={key:s,type:r,message:a,descs:p,duration:m,placement:c,timer:null}}close(){this.currentToast&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),g.destroy(this.currentToast.key),this.currentToast=null)}destroy(){this.close(),g.destroy()}};d(y,"instance");var k=y,Te=k.getInstance();function T(e){return typeof e=="string"?{message:e,duration:3}:e}function I(e){return z[e]}var Z={success:e=>{if(!e)return;let t=T(e);g.success({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:I("success"),onClose:t.onClose})},error:e=>{if(!e)return;let t=T(e);g.error({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:I("error"),onClose:t.onClose})},info:e=>{if(!e)return;let t=T(e);g.info({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:I("info"),onClose:t.onClose})},warning:e=>{if(!e)return;let t=T(e);g.warning({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:I("warning"),onClose:t.onClose})},custom:(e,t)=>{let{message:s,descs:r,duration:a,placement:p,onClose:m}=t;g[e]({message:s,description:r,duration:a,placement:p,icon:I(e),onClose:m})}};var S=Z;import{Spin as Y}from"antd";import{LoadingOutlined as $}from"@ant-design/icons";import{createRoot as ee}from"react-dom/client";import{jsx as _}from"react/jsx-runtime";var M=Symbol("loading");function B(){let e=window[M];return e||(e={count:0,timeoutId:0,inTimeout:!1},window[M]=e),e}var F={tip:"",fullscreen:!0,delay:0,mask:!0,iconSize:40,wrapperClassName:"ui-loading-wrapper"},te=e=>{let t={...F,...e},{tip:s,fullscreen:r,mask:a,maskStyle:p,iconSize:m,iconStyle:c,containerStyle:i,wrapperClassName:N}=t,H=_($,{style:{fontSize:m,color:"#1677ff",...c},spin:!0}),q=r?{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9999,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:a?"rgba(0, 0, 0, 0.45)":"transparent",...p}:{},J={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...i};return _("div",{style:q,className:N,children:_("div",{style:J,children:_(Y,{indicator:H,children:s})})})},l=null,u=null,x=(e={})=>(l&&u&&(u.unmount(),document.body.removeChild(l),l=null,u=null),l=document.createElement("div"),document.body.appendChild(l),u=ee(l),u.render(_(te,{...e})),l),j={show:(e={})=>{let t=B();t.count++;let s={...F,...e};if(s.delay&&s.delay>0){t.timeoutId!=0&&(window.clearTimeout(t.timeoutId),t.timeoutId=0),t.timeoutId=window.setTimeout(()=>{t.timeoutId=0,x(s)},s.delay);return}else x(s)},hide:()=>{let e=B();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&&l&&u&&(u.unmount(),document.body.removeChild(l),l=null,u=null)},service:(e,t={})=>(j.show(t),e.then(s=>(j.hide(),s)).catch(s=>{throw j.hide(),s}))},b=j;import*as w from"febs-browser";import*as P from"febs-browser";import L from"store2";var D=class{constructor(t){d(this,"s");this.s=t}get length(){return this.s.size()}keys(){return this.s.keys()}set(t,s){return s?(s=JSON.stringify(s),s=P.crypt.base64_encode(s),this.s.set(t,s,!0),this):this.remove(t)}get(t,s=null){if(!this.s.has(t))return s;let r=this.s.get(t);if(r){r=P.crypt.base64_decode(r),r=P.string.bytesToUtf8(r||[]);try{return JSON.parse(r)}catch{return this.remove(t),null}}return r}remove(t){return this.s.remove(t),this}clear(){return this.s.clearAll(),this}},f={namespace:function(e){return new D(L.namespace(e||"default"))},namespace_session:function(e){return new D(L.session.namespace(e||"default"))}};var V=(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))(V||{});function re(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 h=ne.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}),o=class o{static clearStoreToken(){this.setStoreToken(null,0)}static getStoreToken(){let t=f.namespace("bp.ss").get("ss");if(t){let s=f.namespace("bp.ss").get("exp");return{token:JSON.parse(t),exp:s?JSON.parse(s):0}}return null}static getValidStoreToken(){let t=o.getStoreToken();return t&&t.exp>Date.now()-o.TOKEN_EXP?t.token:null}static setStoreToken(t,s){t?(f.namespace("bp.ss").set("ss",JSON.stringify(t)),f.namespace("bp.ss").set("exp",JSON.stringify(s))):f.namespace("bp.ss").clear()}static requestHandleSid(t){let s=o.getStoreToken();s&&s.exp>Date.now()-o.TOKEN_EXP&&t.headers.set(o.HEADER_NAME,o.HEADER_PREFIX+s.token)}static responseHandleSid(t){let s=t.headers.get(o.HEADER_NAME);if(s&&s.startsWith(o.HEADER_PREFIX.trim())){s=s.replace(o.HEADER_PREFIX,"");let r=s;if(s=s.split(".")[1],s&&(s=w.string.bytesToUtf8(w.crypt.base64_decode(s)),s)){let a=JSON.parse(s);return a.exp<Date.now()-o.TOKEN_EXP?(o.clearStoreToken(),!1):(o.setStoreToken(r,a.exp),!0)}o.clearStoreToken(),typeof navigator<"u"&&navigator.onLine&&(window.location.href="/")}return!1}};d(o,"HEADER_NAME","Authorization"),d(o,"HEADER_PREFIX","SPBearer "),d(o,"TOKEN_EXP",20*1e3);var C=o;h.interceptors.request.use(e=>(b.show({delay:5e3}),C.requestHandleSid(e),e),e=>(b.hide(),console.log("Request Error =========="),Promise.reject(e)));h.interceptors.response.use(e=>(b.hide(),e.data.code!==200&&S.warning(e.data.message||re(e.data.code)),C.responseHandleSid(e),e.data),e=>(b.hide(),e instanceof se&&(e.code==="ERR_NETWORK"||e.code==="ECONNABORTED"?S.error("\u7F51\u7EDC\u9519\u8BEF"):e.code==="ERR_BAD_RESPONSE"&&S.error("\u670D\u52A1\u5668\u65E0\u54CD\u5E94")),console.log("Response Error =========="),Promise.reject(e)));var n={get(e,t,s){return h({method:"get",url:e,params:t,data:s})},post(e,t,s){return h({method:"post",url:e,params:t,data:s})},put(e,t,s){return h({method:"put",url:e,params:t,data:s})},delete(e,t,s){return h({method:"delete",url:e,params:t,data:s})}};var E={};v(E,{admin:()=>ie,gateway:()=>oe,message:()=>ae,role:()=>de,user:()=>ge});var ie={registerAdmin:e=>n.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=>n.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=>n.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=>n.get("/api/admin/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)},oe={register:e=>n.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=>n.post("/api/sendSms",{phone:e.phone,imageCode:e.imageCode},null).then(t=>t),isLogin:()=>n.get("/api/isLogin",null,null).then(e=>e),login:e=>n.post("/api/login",null,{phone:e.phone,pwd:e.pwd,pwdSN:e.pwdSN,smsCode:e.smsCode}).then(t=>t),verifyPasswordHash:e=>n.post("/api/verifyPasswordHash",null,{passwordHash:e.passwordHash,passwordSalt:e.passwordSalt}).then(t=>t),logout:()=>n.get("/api/logout",null,null).then(e=>e),listPermissions:()=>n.get("/api/listPermissions",null,null).then(e=>e),listRolePermissions:e=>n.get("/api/listRolePermissions",{id:e.id},null).then(t=>t)},ae={list:e=>n.get("/api/user/message/list",{pageNum:e.pageNum,pageSize:e.pageSize,unread_only:e.unread_only},null).then(t=>t),countUnread:()=>n.get("/api/user/message/unread/count",null,null).then(e=>e),markRead:e=>n.post("/api/user/message/read",null,{messageIds:e.messageIds}).then(t=>t),clearReaded:e=>n.delete("/api/user/message/clearReaded",null,{messageIds:e.messageIds}).then(t=>t)},de={listRoles:()=>n.get("/api/role/listRoles",null,null).then(e=>e),createRole:e=>n.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=>n.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=>n.post("/api/role/assignPermissionsToRole",null,{role_id:e.role_id,permissions:e.permissions}).then(t=>t),assignRoleToUserPermission:()=>n.post("/api/role/assignRoleToUserPermission",null,null).then(e=>e),assignRoleToUser:e=>n.post("/api/role/assignRoleToUser",null,{user_id:e.user_id,role_ids:e.role_ids}).then(t=>t),listUserRoles:e=>n.get("/api/role/listUserRoles",{user_id:e.user_id},null).then(t=>t),listUserPermissions:e=>n.get("/api/role/listUserPermissions",{user_id:e.user_id},null).then(t=>t),listCompanies:()=>n.get("/api/role/listCompanies",null,null).then(e=>e),createCompany:e=>n.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=>n.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:()=>n.get("/api/role/listDepartments",null,null).then(e=>e),createDepartment:e=>n.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=>n.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=>n.post("/api/role/assignUserToDepartment",{user_id:e.user_id,department_id:e.department_id,position:e.position},null).then(t=>t),removeUserFromDepartment:e=>n.post("/api/role/removeUserFromDepartment",{user_id:e.user_id,department_id:e.department_id},null).then(t=>t),listCompanyDepartments:e=>n.get("/api/role/listCompanyDepartments",{company_id:e.company_id},null).then(t=>t),listUserDepartments:e=>n.get("/api/role/listUserDepartments",{user_id:e.user_id},null).then(t=>t),listDepartmentUsers:e=>n.get("/api/role/listDepartmentUsers",{department_id:e.department_id},null).then(t=>t)},ge={getInfoByUsername:e=>n.get("/api/user/infoByUsername",{username:e.username},null).then(t=>t),getInfo:e=>n.get("/api/user/info",{id:e.id},null).then(t=>t),getAvatar:e=>n.get("/api/user/avatar",{id:e.id,tick:e.tick},null).then(t=>t),getAvatarList:e=>n.get("/api/user/avatar_list",{ids:e.ids},null).then(t=>t),updateAvatar:e=>n.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=>n.post("/api/user/updateManager",{id:e.id,managerid:e.managerid},null).then(t=>t),updateInfo:e=>n.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=>n.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=>n.post("/api/user/delete",{id:e.id},null).then(t=>t),list:e=>n.get("/api/user/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),listByIds:e=>n.get("/api/user/list_by_ids",{ids:e.ids},null).then(t=>t),search:e=>n.get("/api/user/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),forbid:e=>n.post("/api/user/forbid",{id:e.id,forbid:e.forbid},null).then(t=>t)};var A={};v(A,{contract:()=>le,file:()=>pe,fileversion:()=>me,project:()=>ue,projectprogress:()=>ce});var le={createContract:e=>n.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=>n.delete("/api/project/contract/delete",{id:e.id},null).then(t=>t),updateContract:e=>n.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=>n.get("/api/project/contract/detail",{id:e.id},null).then(t=>t),getContractList:e=>n.get("/api/project/contract/list",{projectId:e.projectId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),submitApproval:e=>n.post("/api/project/contract/submit",{id:e.id,sealType:e.sealType},null).then(t=>t),cancelApproval:e=>n.post("/api/project/contract/cancelApproval",{id:e.id},null).then(t=>t),uploadVersion:e=>n.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=>n.get("/api/project/contract/version/list",{contractId:e.contractId},null).then(t=>t),deleteVersion:e=>n.delete("/api/project/contract/version/delete",{id:e.id},null).then(t=>t),renameVersion:e=>n.post("/api/project/contract/version/rename",null,{id:e.id,fileName:e.fileName}).then(t=>t),getVersionDetail:e=>n.get("/api/project/contract/version/detail",{id:e.id},null).then(t=>t),setVersionLayerOpinion:e=>n.post("/api/project/contract/version/layerOpinion",null,{contractId:e.contractId,version:e.version,opinion:e.opinion}).then(t=>t),getNewContractCode:e=>n.get("/api/project/contract/newCode",{contractCode:e.contractCode,sequenceLength:e.sequenceLength},null).then(t=>t),getContractHistoryParties:()=>n.get("/api/project/contract/historyParties",null,null).then(e=>e)},pe={getDetail:e=>n.get("/api/project/files/detail",{fileId:e.fileId},null).then(t=>t),listFiles:e=>n.get("/api/project/files/list",{projectId:e.projectId},null).then(t=>t),searchFiles:e=>n.get("/api/project/files/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),addFile:(e,t)=>n.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(s=>s),removeFile:e=>n.post("/api/project/files/remove",{fileId:e.fileId},null).then(t=>t),listTrashFiles:e=>n.get("/api/project/files/trash/list",{projectId:e.projectId},null).then(t=>t),restoreTrashFile:e=>n.post("/api/project/files/trash/restore",{fileId:e.fileId},null).then(t=>t),permanentDeleteTrashFile:e=>n.post("/api/project/files/trash/remove",{fileId:e.fileId},null).then(t=>t),emptyTrash:e=>n.post("/api/project/files/trash/empty",{projectId:e.projectId},null).then(t=>t),moveFile:(e,t)=>n.post("/api/project/files/move",{projectId:e.projectId},{oldFileName:t.oldFileName,oldFilePath:t.oldFilePath,newFileName:t.newFileName,newFilePath:t.newFilePath}).then(s=>s),updateFileDescs:e=>n.post("/api/project/files/updateDescs",null,{fileId:e.fileId,descs:e.descs}).then(t=>t),copyFileToProject:e=>n.post("/api/project/files/copyToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),moveFileToProject:e=>n.post("/api/project/files/moveToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),updateFileDelta:e=>n.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=>n.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=>n.post("/api/project/files/generateTempAccessToken",{fileId:e.fileId,expireSeconds:e.expireSeconds},null).then(t=>t),folderDownload:(e,t)=>n.post("/api/project/files/folderDownload",{projectId:e.projectId},{folderPath:t.folderPath,folderName:t.folderName}).then(s=>s),folderDownloadStatus:e=>n.get("/api/project/files/folderDownloadStatus",{jobId:e.jobId},null).then(t=>t),listFilesByTempAccessToken:e=>n.get("/api/project/files/listByTempAccessToken",{tempToken:e.tempToken},null).then(t=>t)},me={listVersions:e=>n.get("/api/project/files/version/list",{fileId:e.fileId},null).then(t=>t),getVersionDetail:e=>n.get("/api/project/files/version/detail",{versionId:e.versionId},null).then(t=>t)},ue={enableUserPrivateProject:()=>n.post("/api/project/enablePrivateProject",null,null).then(e=>e),createProject:e=>n.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=>n.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=>n.post("/api/project/updateUserdataOrder",null,{projectIds:e.projectIds}).then(t=>t),getUserdataOrder:()=>n.get("/api/project/userdataOrder",null,null).then(e=>e),getProjectDetail:e=>n.get("/api/project/detail",{id:e.id},null).then(t=>t),getProjectName:e=>n.get("/api/project/name",{projectId:e.projectId},null).then(t=>t),listProjects:e=>n.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=>n.get("/api/project/listByManager",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),changeStatus:e=>n.put("/api/project/status",{id:e.id,status:e.status},null).then(t=>t),getProjectMembers:e=>n.get("/api/project/members",{projectId:e.projectId},null).then(t=>t),getMemberRole:e=>n.get("/api/project/member/role",{projectId:e.projectId,userId:e.userId},null).then(t=>t),assignMember:e=>n.post("/api/project/members/assign",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t),removeMember:e=>n.post("/api/project/members/remove",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t)},ce={createProgress:e=>n.post("/api/project/progress/create",null,{projectId:e.projectId,descs:e.descs,commentCount:e.commentCount,progressTime:e.progressTime}).then(t=>t),updateProgress:e=>n.put("/api/project/progress/update",null,{id:e.id,descs:e.descs,progressTime:e.progressTime}).then(t=>t),deleteProgress:e=>n.delete("/api/project/progress/delete",{id:e.id},null).then(t=>t),getProgressList:e=>n.get("/api/project/progress/list",{projectId:e.projectId},null).then(t=>t),addComment:e=>n.post("/api/project/progress/comment/add",null,{progressId:e.progressId,comment:e.comment}).then(t=>t),deleteComment:e=>n.delete("/api/project/progress/comment/delete",{id:e.id},null).then(t=>t),updateComment:e=>n.put("/api/project/progress/comment/update",{id:e.id},{}).then(t=>t),getCommentList:e=>n.get("/api/project/progress/comment/list",{progressId:e.progressId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)};var Ge={base:U,user:E,project:A};export{Ge as API,C as AuthorizationHandler,n as HttpRequest,V as ResponseCode,ie as admin,le as contract,pe as file,me as fileversion,oe as gateway,ae as message,ue as project,ce as projectprogress,de as role,ge as user};
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- var Me=Object.defineProperty;var mt=(e,t,r)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var he=(e,t)=>{for(var r in t)Me(e,r,{get:t[r],enumerable:!0})};var c=(e,t,r)=>mt(e,typeof t!="symbol"?t+"":t,r);var pt="0.1.0";var we={};he(we,{AuthorizationHandler:()=>x,HttpRequest:()=>a,ResponseCode:()=>_e});import It,{AxiosError as Tt}from"axios";import{useEffect as an,useState as ln,useRef as cn}from"react";import{notification as T}from"antd";import{CheckCircleOutlined as gt,CloseCircleOutlined as ft,InfoCircleOutlined as yt,WarningOutlined as ht}from"@ant-design/icons";import{Fragment as gn,jsx as ne,jsxs as fn}from"react/jsx-runtime";var je={success:ne(gt,{style:{color:"#52c41a"}}),error:ne(ft,{style:{color:"#ff4d4f"}}),info:ne(yt,{style:{color:"#1677ff"}}),warning:ne(ht,{style:{color:"#faad14"}})};T.config({placement:"topRight",duration:3,zIndex:1e4});var A=class A{constructor(){c(this,"currentToast",null);c(this,"api",null);c(this,"isInitialized",!1);c(this,"pendingToast",null)}static getInstance(){return A.instance||(A.instance=new A),A.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:o,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:o,placement:l,onClose:d})):(this.currentToast&&T.destroy(this.currentToast.key),this.createNotification({key:r,type:n,message:i,descs:s,duration:o,placement:l,onClose:d}))}createNotification(t){if(!this.api)return;let{key:r,type:n,message:i,descs:s,duration:o,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:o,placement:l||"topRight",icon:je[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:o,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(A,"instance");var be=A,mn=be.getInstance();function re(e){return typeof e=="string"?{message:e,duration:3}:e}function V(e){return je[e]}var bt={success:e=>{if(!e)return;let t=re(e);T.success({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:V("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:V("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:V("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:V("warning"),onClose:t.onClose})},custom:(e,t)=>{let{message:r,descs:n,duration:i,placement:s,onClose:o}=t;T[e]({message:r,description:n,duration:i,placement:s,icon:V(e),onClose:o})}};var se=bt;import{Spin as _t}from"antd";import{LoadingOutlined as wt}from"@ant-design/icons";import{createRoot as Ct}from"react-dom/client";import{jsx as W}from"react/jsx-runtime";var Ue=Symbol("loading");function Be(){let e=window[Ue];return e||(e={count:0,timeoutId:0,inTimeout:!1},window[Ue]=e),e}var Oe={tip:"",fullscreen:!0,delay:0,mask:!0,iconSize:40,wrapperClassName:"ui-loading-wrapper"},Pt=e=>{let t={...Oe,...e},{tip:r,fullscreen:n,mask:i,maskStyle:s,iconSize:o,iconStyle:l,containerStyle:d,wrapperClassName:u}=t,m=W(wt,{style:{fontSize:o,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 W("div",{style:P,className:u,children:W("div",{style:I,children:W(_t,{indicator:m,children:r})})})},v=null,k=null,Le=(e={})=>(v&&k&&(k.unmount(),document.body.removeChild(v),v=null,k=null),v=document.createElement("div"),document.body.appendChild(v),k=Ct(v),k.render(W(Pt,{...e})),v),ie={show:(e={})=>{let t=Be();t.count++;let r={...Oe,...e};if(r.delay&&r.delay>0){t.timeoutId!=0&&(window.clearTimeout(t.timeoutId),t.timeoutId=0),t.timeoutId=window.setTimeout(()=>{t.timeoutId=0,Le(r)},r.delay);return}else Le(r)},hide:()=>{let e=Be();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={})=>(ie.show(t),e.then(r=>(ie.hide(),r)).catch(r=>{throw ie.hide(),r}))},H=ie;import*as ae from"febs-browser";import*as q from"febs-browser";import ze from"store2";var oe=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 oe(ze.namespace(e||"default"))},namespace_session:function(e){return new oe(ze.session.namespace(e||"default"))}};var _e=(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))(_e||{});function vt(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 B=It.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=ae.string.bytesToUtf8(ae.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 x=g;B.interceptors.request.use(e=>(H.show({delay:5e3}),x.requestHandleSid(e),e),e=>(H.hide(),console.log("Request Error =========="),Promise.reject(e)));B.interceptors.response.use(e=>(H.hide(),e.data.code!==200&&se.warning(e.data.message||vt(e.data.code)),x.responseHandleSid(e),e.data),e=>(H.hide(),e instanceof Tt&&(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 a={get(e,t,r){return B({method:"get",url:e,params:t,data:r})},post(e,t,r){return B({method:"post",url:e,params:t,data:r})},put(e,t,r){return B({method:"put",url:e,params:t,data:r})},delete(e,t,r){return B({method:"delete",url:e,params:t,data:r})}};var Ce={};he(Ce,{admin:()=>Rt,gateway:()=>St,message:()=>Dt,role:()=>kt,user:()=>Et});var Rt={registerAdmin:e=>a.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=>a.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=>a.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=>a.get("/api/admin/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)},St={register:e=>a.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=>a.post("/api/sendSms",{phone:e.phone,imageCode:e.imageCode},null).then(t=>t),isLogin:()=>a.get("/api/isLogin",null,null).then(e=>e),login:e=>a.post("/api/login",null,{phone:e.phone,pwd:e.pwd,pwdSN:e.pwdSN,smsCode:e.smsCode}).then(t=>t),verifyPasswordHash:e=>a.post("/api/verifyPasswordHash",null,{passwordHash:e.passwordHash,passwordSalt:e.passwordSalt}).then(t=>t),logout:()=>a.get("/api/logout",null,null).then(e=>e),listPermissions:()=>a.get("/api/listPermissions",null,null).then(e=>e),listRolePermissions:e=>a.get("/api/listRolePermissions",{id:e.id},null).then(t=>t)},Dt={list:e=>a.get("/api/user/message/list",{pageNum:e.pageNum,pageSize:e.pageSize,unread_only:e.unread_only},null).then(t=>t),countUnread:()=>a.get("/api/user/message/unread/count",null,null).then(e=>e),markRead:e=>a.post("/api/user/message/read",null,{messageIds:e.messageIds}).then(t=>t),clearReaded:e=>a.delete("/api/user/message/clearReaded",null,{messageIds:e.messageIds}).then(t=>t)},kt={listRoles:()=>a.get("/api/role/listRoles",null,null).then(e=>e),createRole:e=>a.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=>a.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=>a.post("/api/role/assignPermissionsToRole",null,{role_id:e.role_id,permissions:e.permissions}).then(t=>t),assignRoleToUserPermission:()=>a.post("/api/role/assignRoleToUserPermission",null,null).then(e=>e),assignRoleToUser:e=>a.post("/api/role/assignRoleToUser",null,{user_id:e.user_id,role_ids:e.role_ids}).then(t=>t),listUserRoles:e=>a.get("/api/role/listUserRoles",{user_id:e.user_id},null).then(t=>t),listUserPermissions:e=>a.get("/api/role/listUserPermissions",{user_id:e.user_id},null).then(t=>t),listCompanies:()=>a.get("/api/role/listCompanies",null,null).then(e=>e),createCompany:e=>a.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=>a.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:()=>a.get("/api/role/listDepartments",null,null).then(e=>e),createDepartment:e=>a.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=>a.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=>a.post("/api/role/assignUserToDepartment",{user_id:e.user_id,department_id:e.department_id,position:e.position},null).then(t=>t),removeUserFromDepartment:e=>a.post("/api/role/removeUserFromDepartment",{user_id:e.user_id,department_id:e.department_id},null).then(t=>t),listCompanyDepartments:e=>a.get("/api/role/listCompanyDepartments",{company_id:e.company_id},null).then(t=>t),listUserDepartments:e=>a.get("/api/role/listUserDepartments",{user_id:e.user_id},null).then(t=>t),listDepartmentUsers:e=>a.get("/api/role/listDepartmentUsers",{department_id:e.department_id},null).then(t=>t)},Et={getInfoByUsername:e=>a.get("/api/user/infoByUsername",{username:e.username},null).then(t=>t),getInfo:e=>a.get("/api/user/info",{id:e.id},null).then(t=>t),getAvatar:e=>a.get("/api/user/avatar",{id:e.id,tick:e.tick},null).then(t=>t),getAvatarList:e=>a.get("/api/user/avatar_list",{ids:e.ids},null).then(t=>t),updateAvatar:e=>a.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=>a.post("/api/user/updateManager",{id:e.id,managerid:e.managerid},null).then(t=>t),updateInfo:e=>a.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=>a.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=>a.post("/api/user/delete",{id:e.id},null).then(t=>t),list:e=>a.get("/api/user/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),listByIds:e=>a.get("/api/user/list_by_ids",{ids:e.ids},null).then(t=>t),search:e=>a.get("/api/user/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),forbid:e=>a.post("/api/user/forbid",{id:e.id,forbid:e.forbid},null).then(t=>t)};var Pe={};he(Pe,{contract:()=>Nt,file:()=>At,fileversion:()=>xt,project:()=>Mt,projectprogress:()=>jt});var Nt={createContract:e=>a.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=>a.delete("/api/project/contract/delete",{id:e.id},null).then(t=>t),updateContract:e=>a.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=>a.get("/api/project/contract/detail",{id:e.id},null).then(t=>t),getContractList:e=>a.get("/api/project/contract/list",{projectId:e.projectId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),submitApproval:e=>a.post("/api/project/contract/submit",{id:e.id,sealType:e.sealType},null).then(t=>t),cancelApproval:e=>a.post("/api/project/contract/cancelApproval",{id:e.id},null).then(t=>t),uploadVersion:e=>a.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=>a.get("/api/project/contract/version/list",{contractId:e.contractId},null).then(t=>t),deleteVersion:e=>a.delete("/api/project/contract/version/delete",{id:e.id},null).then(t=>t),renameVersion:e=>a.post("/api/project/contract/version/rename",null,{id:e.id,fileName:e.fileName}).then(t=>t),getVersionDetail:e=>a.get("/api/project/contract/version/detail",{id:e.id},null).then(t=>t),setVersionLayerOpinion:e=>a.post("/api/project/contract/version/layerOpinion",null,{contractId:e.contractId,version:e.version,opinion:e.opinion}).then(t=>t),getNewContractCode:e=>a.get("/api/project/contract/newCode",{contractCode:e.contractCode,sequenceLength:e.sequenceLength},null).then(t=>t),getContractHistoryParties:()=>a.get("/api/project/contract/historyParties",null,null).then(e=>e)},At={getDetail:e=>a.get("/api/project/files/detail",{fileId:e.fileId},null).then(t=>t),listFiles:e=>a.get("/api/project/files/list",{projectId:e.projectId},null).then(t=>t),searchFiles:e=>a.get("/api/project/files/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),addFile:(e,t)=>a.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=>a.post("/api/project/files/remove",{fileId:e.fileId},null).then(t=>t),moveFile:(e,t)=>a.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=>a.post("/api/project/files/updateDescs",null,{fileId:e.fileId,descs:e.descs}).then(t=>t),copyFileToProject:e=>a.post("/api/project/files/copyToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),moveFileToProject:e=>a.post("/api/project/files/moveToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),updateFileDelta:e=>a.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=>a.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=>a.post("/api/project/files/generateTempAccessToken",{fileId:e.fileId,expireSeconds:e.expireSeconds},null).then(t=>t),folderDownload:(e,t)=>a.post("/api/project/files/folderDownload",{projectId:e.projectId},{folderPath:t.folderPath,folderName:t.folderName}).then(r=>r),folderDownloadStatus:e=>a.get("/api/project/files/folderDownloadStatus",{jobId:e.jobId},null).then(t=>t),listFilesByTempAccessToken:e=>a.get("/api/project/files/listByTempAccessToken",{tempToken:e.tempToken},null).then(t=>t)},xt={listVersions:e=>a.get("/api/project/files/version/list",{fileId:e.fileId},null).then(t=>t),getVersionDetail:e=>a.get("/api/project/files/version/detail",{versionId:e.versionId},null).then(t=>t)},Mt={enableUserPrivateProject:()=>a.post("/api/project/enablePrivateProject",null,null).then(e=>e),createProject:e=>a.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=>a.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=>a.post("/api/project/updateUserdataOrder",null,{projectIds:e.projectIds}).then(t=>t),getUserdataOrder:()=>a.get("/api/project/userdataOrder",null,null).then(e=>e),getProjectDetail:e=>a.get("/api/project/detail",{id:e.id},null).then(t=>t),getProjectName:e=>a.get("/api/project/name",{projectId:e.projectId},null).then(t=>t),listProjects:e=>a.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=>a.get("/api/project/listByManager",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),changeStatus:e=>a.put("/api/project/status",{id:e.id,status:e.status},null).then(t=>t),getProjectMembers:e=>a.get("/api/project/members",{projectId:e.projectId},null).then(t=>t),getMemberRole:e=>a.get("/api/project/member/role",{projectId:e.projectId,userId:e.userId},null).then(t=>t),assignMember:e=>a.post("/api/project/members/assign",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t),removeMember:e=>a.post("/api/project/members/remove",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t)},jt={createProgress:e=>a.post("/api/project/progress/create",null,{projectId:e.projectId,descs:e.descs,commentCount:e.commentCount,progressTime:e.progressTime}).then(t=>t),updateProgress:e=>a.put("/api/project/progress/update",null,{id:e.id,descs:e.descs,progressTime:e.progressTime}).then(t=>t),deleteProgress:e=>a.delete("/api/project/progress/delete",{id:e.id},null).then(t=>t),getProgressList:e=>a.get("/api/project/progress/list",{projectId:e.projectId},null).then(t=>t),addComment:e=>a.post("/api/project/progress/comment/add",null,{progressId:e.progressId,comment:e.comment}).then(t=>t),deleteComment:e=>a.delete("/api/project/progress/comment/delete",{id:e.id},null).then(t=>t),updateComment:e=>a.put("/api/project/progress/comment/update",{id:e.id},{}).then(t=>t),getCommentList:e=>a.get("/api/project/progress/comment/list",{progressId:e.progressId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)};var y={base:we,user:Ce,project:Pe};import Ut from"dexie";var Bt=1440*60*1e3,Ie=class extends Ut{constructor(){super("DepartmentInfoDB");c(this,"departmentCache");this.version(1).stores({departmentCache:"id, timestamp"})}},G=new Ie,le=null,Lt=async()=>{try{let e=await G.departmentCache.get("DEPARTMENT_ALL");if(e){if(Date.now()-e.timestamp<Bt)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}},Ot=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)}},zt=async()=>{try{await G.departmentCache.clear()}catch(e){console.error("\u6E05\u9664\u90E8\u95E8\u7F13\u5B58\u5931\u8D25:",e)}},Fe=(e,t)=>e.map(r=>({...r,company_id:r.company_id||t.id,company:t,children:r.children?Fe(r.children,t):void 0})),Ft=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:Fe(i.data||[],n)}));return r.some(n=>n===null)?null:r.flatMap(n=>n||[])},Ve=async({forceRefresh:e=!1})=>{if(!e){let r=await Lt();if(r)return r}le||(le=Ft().then(async r=>(r&&await Ot(r),r)).finally(()=>{le=null}));let t=await le;return t||null},We=async({forceRefresh:e=!1})=>{let t=await Ve({forceRefresh:e});if(!t)return null;let r=n=>{let i=[];for(let s of n){let{children:o,...l}=s;i.push(l),s.children&&s.children.length>0&&(i=i.concat(r(s.children)))}return i};return r(t)},He=async({deptId:e,forceRefresh:t=!1})=>{let r=await We({forceRefresh:t});return r&&r.find(n=>n.id===e)||null},Vt=async({deptId:e,forceRefresh:t=!1})=>(await He({deptId:e,forceRefresh:t}))?.name||"",Wt=async()=>{await zt()},Ht=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}}},Hn={getDepartmentList:Ve,getFlatDepartmentList:We,getDepartmentById:He,getDepartmentNameById:Vt,clearDepartmentCache:Wt,getCacheStats:Ht};var qt="flyfish-file-viewer-cache",Gt=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}},Jt=e=>new Promise(t=>{let r=indexedDB.open(e);r.onsuccess=()=>t(r.result),r.onerror=()=>t(null),r.onblocked=()=>t(null)}),$t=async e=>{if(!(typeof indexedDB>"u"))try{if(!await Gt(e))return;let t=await Jt(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(o=>{s.objectStore(o).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)}},Jn=async()=>{await $t(qt)};import ir from"dexie";import*as Te from"febs-browser";import Ge from"dexie";var j=1440*60*1e3,ve=class extends Ge{constructor(){super("UserInfoDB");c(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},Re=class extends Ge{constructor(){super("UserAvatarDB");c(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},R=new ve,S=new Re,Je=async e=>{try{let t=await S.userCache.get(e);if(t){if(Date.now()-t.timestamp<j)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}},Se=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<j?t.data.avatar=n.avatar:(t.data.avatar=void 0,await S.userCache.delete(e)):t.data.avatar=void 0,r-t.timestamp<j)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}},Kt=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)}},Xt=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)}},Yt=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 o=r[s];o&&n-o.timestamp<j&&t.set(e[s],o.data)}let i=await S.userCache.bulkGet(e);for(let s=0;s<e.length;s++){let o=i[s];if(!o)continue;let l=t.get(o.id);l&&n-o.timestamp<j&&(l.avatar=o.avatar)}}catch(r){console.error("\u6279\u91CF\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}return t},qe=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)}},Zt=async()=>{let e=new Map;try{let t=Date.now(),r=await R.userCache.toArray();for(let n of r)if(t-n.timestamp<j){let i=await S.userCache.get(n.id);i&&t-i.timestamp<j&&(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},Qt=async()=>{try{await R.userCache.clear(),await S.userCache.clear()}catch(e){console.error("\u6E05\u9664\u7528\u6237\u7F13\u5B58\u5931\u8D25:",e)}},$e=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 o=e??s;if(o){let l=await Se(o);if(l){let d=await M({user_id:o,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,o=n.data?.isAdmin||!1,l=await Se(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 Xt(s,u);try{let m=await M({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 M({user_id:s,forceRefresh:r,serverTick:l.tick_avatar_self});d&&(l.avatar=d)}catch{}return l}else return x.clearStoreToken(),null},M=async({user_id:e,forceRefresh:t=!1,serverTick:r=Number.MAX_SAFE_INTEGER})=>{if(!e)return;let n=await Je(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:Te.string.isEmpty(s.data?.avatar)?void 0:s.data?.avatar,avatar_small:Te.string.isEmpty(s.data?.avatar_small)?void 0:s.data?.avatar_small,avatar_tick:s.data?.tick_self||-1},await Kt(e,n))}catch{}}return n||void 0},er=async e=>(e=e||{forceRefresh:!1},await $e(e)),tr=()=>{let e=_.namespace("bp.ss").get("user");return e?JSON.parse(e):null},rr=async({userIds:e,keywords:t,forceRefresh:r=!1})=>{let n=new Map;if(!e){if(!r&&(!t||t.length===0)){let u=await Zt();if(u.size>=100){let m=new Map,P=0;for(let[I,F]of u){if(P>=100)break;let ye=await M({user_id:I,forceRefresh:!1,serverTick:F.tick_avatar_self});F.avatar=ye,m.set(I,F),P++}return m}return u}let o;if(t&&t.length>0){if(o=await y.user.user.search({pageNum:1,pageSize:100,keyword:t}),o?.code!==200)return n}else if(o=await y.user.user.list({pageNum:1,pageSize:100}),o?.code!==200)return n;let l=o.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 qe(d);for(let u=0;u<d.length;u++){let m=await M({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 Yt(i)).forEach((l,d)=>{n.set(d,l)});let s=i.filter(o=>!n.has(o));if(s.length===0)return n;try{let o=await y.user.user.listByIds({ids:JSON.stringify(s)});if(o?.code!=200)return n;let l=o.data?.list||[];if(l.length>0){let u=[];for(let m of l){let P={...m};u.push({id:m.id,data:P})}await qe(u)}let d=[];if(l.length>0)for(let u of l){let m=await M({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(o){console.error("\u6279\u91CF\u83B7\u53D6\u7528\u6237\u4FE1\u606F\u5931\u8D25:",o)}return n},nr=async e=>{e?await R.userCache.delete(e):await Qt()},sr=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}}},Ke={getFromCache:Se,getAvatarFromCache:Je,getUserInfo:$e,getUserAvatar:M,current:er,currentLocalUser:tr,getUserInfos:rr,clearUserCache:nr,getCacheStats:sr};var os="approver:approvalinvoice:getInvoiceList",as="project:projectfile:downloadFolderPermission",ls="crm:customer:createCustomer",cs="crm:customer:updateCustomer",ds="crm:customer:deleteCustomer",us="crm:customer:viewContact",ms="crm:customer:transferCustomer",ps="crm:file:viewFile",gs="crm:file:manageFile",or=600*1e3,De=class extends ir{constructor(){super("PermissionInfoDB");c(this,"permissionCache");this.version(1).stores({permissionCache:"id, timestamp"})}},L=new De,ar=async e=>{try{let t=await L.permissionCache.get(`PERMISSION_${e}`);if(t){if(Date.now()-t.timestamp<or)return t.data;await L.permissionCache.delete(`PERMISSION_${e}`)}return null}catch(t){return console.error("\u8BFB\u53D6\u6743\u9650\u7F13\u5B58\u5931\u8D25:",t),null}},lr=async(e,t)=>{try{await L.permissionCache.put({id:`PERMISSION_${e}`,data:t,timestamp:Date.now()})}catch(r){console.error("\u5199\u5165\u6743\u9650\u7F13\u5B58\u5931\u8D25:",r)}},cr=async e=>{try{e?await L.permissionCache.delete(`PERMISSION_${e}`):await L.permissionCache.clear()}catch(t){console.error("\u6E05\u9664\u6743\u9650\u7F13\u5B58\u5931\u8D25:",t)}},ce=async({userId:e,forceRefresh:t=!1})=>{let r=e?{id:e}:await Ke.getUserInfo({});if(!r)return null;let n=r.id;if(!t){let o=await ar(n);if(o)return o}let i=await y.user.role.listUserPermissions({user_id:n});if(i?.code!==200)return null;let s=i.data||[];return await lr(n,s),s},dr=async({permission:e,userId:t,forceRefresh:r=!1})=>{let n=await ce({userId:t,forceRefresh:r});return n?n.some(i=>i.permission===e):!1},ur=async({permissions:e,userId:t,forceRefresh:r=!1,allRequired:n=!0})=>{let i=await ce({userId:t,forceRefresh:r});if(!i)return!1;let s=new Set(i.map(o=>o.permission));return n?e.every(o=>s.has(o)):e.some(o=>s.has(o))},mr=async({permission:e,userId:t,forceRefresh:r=!1})=>{let n=await ce({userId:t,forceRefresh:r});return n&&n.find(s=>s.permission===e)?.descs||""},pr=async e=>{await cr(e)},gr=async()=>{try{let e=await L.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}}},fs={getUserPermissions:ce,hasPermission:dr,hasPermissions:ur,getPermissionDesc:mr,clearPermissionCache:pr,getCacheStats:gr};import fr from"dexie";var yr=3600*1e3,ke=class extends fr{constructor(){super("RoleInfoDB");c(this,"roleCache");this.version(1).stores({roleCache:"id, timestamp"})}},J=new ke,hr=async()=>{try{let e=await J.roleCache.get("ROLE_ALL");if(e){if(Date.now()-e.timestamp<yr)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}},br=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)}},_r=async()=>{try{await J.roleCache.clear()}catch(e){console.error("\u6E05\u9664\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e)}},Ne=async({forceRefresh:e=!1})=>{if(!e){let n=await hr();if(n)return n}let t=await y.user.role.listRoles();if(t?.code!==200)return null;let r=t.data||[];return await br(r),r},Xe=async({roleId:e,forceRefresh:t=!1})=>{let r=await Ne({forceRefresh:t});return r&&r.find(n=>n.id===e)||null},wr=async({roleId:e,forceRefresh:t=!1})=>(await Xe({roleId:e,forceRefresh:t}))?.name||"",Ee=async({forceRefresh:e=!1}={})=>{let t=await Ne({forceRefresh:e}),r={};return(t||[]).forEach(n=>{r[n.id]=n.name}),r},Cr=async({roleIds:e})=>{let t=await Ee();return(e||[]).filter(n=>!!n&&!t[n]).length>0&&(t=await Ee({forceRefresh:!0})),t},Pr=async()=>{await _r()},Ir=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}}},Cs={getRoleList:Ne,getRoleById:Xe,getRoleNameById:wr,getRoleNameMap:Ee,getRoleNameMapForIds:Cr,clearRoleCache:Pr,getCacheStats:Ir};import Tr from"dexie";var Ae=class extends Tr{constructor(){super("ViewToggleDB");c(this,"viewModeCache");this.version(1).stores({viewModeCache:"pageKey, timestamp"})}},$=new Ae,vr=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}},Rr=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)}},Sr=async e=>{try{await $.viewModeCache.delete(e)}catch(t){console.error("\u6E05\u9664\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",t)}},Dr=async()=>{try{await $.viewModeCache.clear()}catch(e){console.error("\u6E05\u9664\u6240\u6709\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",e)}},kr=async e=>await vr(e),Er=async(e,t)=>{await Rr(e,t)},Nr=async e=>{await Sr(e)},Ar=async()=>{await Dr()},xr=async()=>{try{return await $.viewModeCache.toArray()}catch(e){return console.error("\u83B7\u53D6\u6240\u6709\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",e),[]}},Rs={getViewMode:kr,setViewMode:Er,clearViewModeCache:Nr,clearAllViewModeCache:Ar,getAllCachedViewModes:xr};var Ye={project:"\u9879\u76EE\u52A8\u6001",approval:"\u5BA1\u6279\u52A8\u6001",knowledge:"\u77E5\u8BC6\u5E93",todo:"\u5F85\u529E\u4EFB\u52A1",crm:"\u5BA2\u6237\u7BA1\u7406"},Mr={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"},jr={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"},Ur={kb_new:"\u65B0\u589E\u77E5\u8BC6"},Br={task_assign:"\u4EFB\u52A1\u6307\u6D3E",task_remind:"\u5230\u671F\u63D0\u9192"},Lr={customer_transfer_in:"\u5BA2\u6237\u79FB\u4EA4\uFF08\u63A5\u6536\uFF09",customer_transfer_out:"\u5BA2\u6237\u79FB\u4EA4\uFF08\u79FB\u4EA4\u51FA\uFF09"},Or={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"},Ze=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(Ye,t)}static getTypeLabel(t){return Ye[t]||"\u7CFB\u7EDF\u6D88\u606F"}static getBizTypeLabel(t,r){switch(t){case"project":return Mr[r]||"";case"approval":return jr[r]||"";case"knowledge":return Ur[r]||"";case"todo":return Br[r]||"";case"crm":return Lr[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=Or[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 Es(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{await navigator.clipboard.writeText(e);return}catch{}if(!zr(e))throw new Error("\u590D\u5236\u5230\u526A\u8D34\u677F\u5931\u8D25")}function zr(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 Qe=(import.meta.env.VITE_COMPANY_EMAIL_DOMAINS||"").split(",").map(e=>e.trim().toLowerCase().replace(/^@/,"")).filter(Boolean),Fr=e=>(e||"").trim().toLowerCase(),As=()=>Qe.join("\u3001"),xs=e=>{let t=Fr(e),r=t.split("@")[1];return Qe.some(n=>n.includes("@")?n===t:!!(r&&n===r))};function js(){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 Bs=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"}),Ls=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"}),Os=e=>new Intl.NumberFormat("zh-CN",{style:"currency",currency:"CNY"}).format(e),zs=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 Ws={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),o=n.length,l=()=>{o-=1,o===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 qs(){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,o=()=>{--s===0&&n(i)};r.forEach((l,d)=>{Promise.resolve(l).then(u=>{i[d]={status:"fulfilled",value:u},o()},u=>{i[d]={status:"rejected",reason:u},o()})})})};try{Object.defineProperty(Promise,"allSettled",{configurable:!0,writable:!0,value:e})}catch{}if(typeof Promise.allSettled!="function")try{Promise.allSettled=e}catch{}}catch{}}function Gs(){try{et()}catch{}}var de=class{constructor({highWaterMark:t}){c(this,"highWaterMark");this.highWaterMark=t}size(t){return t?.byteLength??0}},ue=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)}},E=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,o=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;o&&typeof o.ready<"u"&&await o.ready,o&&typeof o.write=="function"?await o.write(u):t&&typeof t.write=="function"&&t.write(u)}}finally{try{l.releaseLock()}catch{}}n||(o&&typeof o.close=="function"?await o.close():t&&typeof t.close=="function"&&t.close())}catch(l){if(!i)try{o&&typeof o.abort=="function"?await o.abort(l):t&&typeof t.abort=="function"&&t.abort(l)}catch{}if(!s)try{await this.cancel(l)}catch{}throw l}finally{if(o&&typeof o.releaseLock=="function")try{o.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:o}=await i.read();if(s)break;n.enqueue(o)}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),o=Math.min(s.length,n.byteLength-r);n.set(s.subarray(0,o),r),r+=o,o<s.length?this._chunks[0].value=s.subarray(o):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=o=>{this._state.errored?s(this._state.error):i(o)},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())}},O=class{constructor(t,r,n){c(this,"readable");c(this,"writable");let i;this.readable=new E({start:s=>{i=s;let o=t?.start;typeof o=="function"&&Promise.resolve(o.call(t,i)).catch(l=>i.error(l))}}),this.writable=new ee({write:async(s,o)=>{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 o=t?.abort;typeof o=="function"&&await o.call(t,s)}})}},me=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 O({transform(s,o){o.enqueue(n.decode(s,{stream:!0}))},flush(s){let o=n.decode();o&&s.enqueue(o)}});this.readable=i.readable,this.writable=i.writable}},pe=class{constructor(){c(this,"readable");c(this,"writable");c(this,"encoding","utf-8");let t=new TextEncoder,r=new O({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 Vr(){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{}}},o=new e(s);try{let l=o.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{o.cancel&&o.cancel()}catch{}}catch(s){let o=String(s?.message??"");if(/ReadableByteStreamController is not implemented|is not implemented|not supported|type bytes|invalid type/i.test(o))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 et(){if(typeof globalThis>"u")return;Vr()?(b("ReadableStream",E),b("ReadableByteStreamController",X),b("ReadableStreamDefaultController",K),b("ReadableStreamDefaultReader",Y),b("ReadableStreamBYOBReader",Z),b("WritableStream",ee),b("WritableStreamDefaultWriter",Q),b("TransformStream",O),b("TextDecoderStream",me),b("TextEncoderStream",pe),b("ByteLengthQueuingStrategy",de),b("CountQueuingStrategy",ue)):(w("ByteLengthQueuingStrategy",de),w("CountQueuingStrategy",ue),w("ReadableStream",E),w("WritableStream",ee),w("TransformStream",O),w("ReadableByteStreamController",X),w("ReadableStreamDefaultController",K),w("ReadableStreamDefaultReader",Y),w("ReadableStreamBYOBReader",Z),w("WritableStreamDefaultWriter",Q),w("TextDecoderStream",me),w("TextEncoderStream",pe));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:E.prototype.pipeTo}),Object.defineProperty(r,"pipeThrough",{configurable:!0,writable:!0,value:E.prototype.pipeThrough}),Object.defineProperty(r,"tee",{configurable:!0,writable:!0,value:E.prototype.tee}))}}catch{}}try{et()}catch(e){console.warn("[polyfills] \u5B89\u88C5 Web Streams polyfill \u5931\u8D25\uFF1A",e)}var Ks=/^(0|[1-9](\d+)?(\.\d\d?)?)$/;var nt=(typeof window<"u"?window.location.origin:"")+"/polyfills/polyfills.js",tt=new Map,rt=new Map;function st(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 Ys(e){let t=tt.get(e);if(t)return t;let r=st(e),n=`/* auto-generated bootstrap: polyfills first, then real worker (${r}) */
1
+ var Me=Object.defineProperty;var mt=(e,t,r)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var he=(e,t)=>{for(var r in t)Me(e,r,{get:t[r],enumerable:!0})};var c=(e,t,r)=>mt(e,typeof t!="symbol"?t+"":t,r);var pt="0.1.0";var we={};he(we,{AuthorizationHandler:()=>x,HttpRequest:()=>o,ResponseCode:()=>_e});import It,{AxiosError as Tt}from"axios";import{useEffect as an,useState as ln,useRef as cn}from"react";import{notification as T}from"antd";import{CheckCircleOutlined as gt,CloseCircleOutlined as ft,InfoCircleOutlined as yt,WarningOutlined as ht}from"@ant-design/icons";import{Fragment as gn,jsx as ne,jsxs as fn}from"react/jsx-runtime";var je={success:ne(gt,{style:{color:"#52c41a"}}),error:ne(ft,{style:{color:"#ff4d4f"}}),info:ne(yt,{style:{color:"#1677ff"}}),warning:ne(ht,{style:{color:"#faad14"}})};T.config({placement:"topRight",duration:3,zIndex:1e4});var A=class A{constructor(){c(this,"currentToast",null);c(this,"api",null);c(this,"isInitialized",!1);c(this,"pendingToast",null)}static getInstance(){return A.instance||(A.instance=new A),A.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:je[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(A,"instance");var be=A,mn=be.getInstance();function re(e){return typeof e=="string"?{message:e,duration:3}:e}function V(e){return je[e]}var bt={success:e=>{if(!e)return;let t=re(e);T.success({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:V("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:V("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:V("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:V("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:V(e),onClose:a})}};var se=bt;import{Spin as _t}from"antd";import{LoadingOutlined as wt}from"@ant-design/icons";import{createRoot as Ct}from"react-dom/client";import{jsx as W}from"react/jsx-runtime";var Ue=Symbol("loading");function Be(){let e=window[Ue];return e||(e={count:0,timeoutId:0,inTimeout:!1},window[Ue]=e),e}var Oe={tip:"",fullscreen:!0,delay:0,mask:!0,iconSize:40,wrapperClassName:"ui-loading-wrapper"},Pt=e=>{let t={...Oe,...e},{tip:r,fullscreen:n,mask:i,maskStyle:s,iconSize:a,iconStyle:l,containerStyle:d,wrapperClassName:u}=t,m=W(wt,{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 W("div",{style:P,className:u,children:W("div",{style:I,children:W(_t,{indicator:m,children:r})})})},v=null,k=null,Le=(e={})=>(v&&k&&(k.unmount(),document.body.removeChild(v),v=null,k=null),v=document.createElement("div"),document.body.appendChild(v),k=Ct(v),k.render(W(Pt,{...e})),v),ie={show:(e={})=>{let t=Be();t.count++;let r={...Oe,...e};if(r.delay&&r.delay>0){t.timeoutId!=0&&(window.clearTimeout(t.timeoutId),t.timeoutId=0),t.timeoutId=window.setTimeout(()=>{t.timeoutId=0,Le(r)},r.delay);return}else Le(r)},hide:()=>{let e=Be();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={})=>(ie.show(t),e.then(r=>(ie.hide(),r)).catch(r=>{throw ie.hide(),r}))},H=ie;import*as ae from"febs-browser";import*as q from"febs-browser";import ze from"store2";var oe=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 oe(ze.namespace(e||"default"))},namespace_session:function(e){return new oe(ze.session.namespace(e||"default"))}};var _e=(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))(_e||{});function vt(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 B=It.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=ae.string.bytesToUtf8(ae.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 x=g;B.interceptors.request.use(e=>(H.show({delay:5e3}),x.requestHandleSid(e),e),e=>(H.hide(),console.log("Request Error =========="),Promise.reject(e)));B.interceptors.response.use(e=>(H.hide(),e.data.code!==200&&se.warning(e.data.message||vt(e.data.code)),x.responseHandleSid(e),e.data),e=>(H.hide(),e instanceof Tt&&(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 B({method:"get",url:e,params:t,data:r})},post(e,t,r){return B({method:"post",url:e,params:t,data:r})},put(e,t,r){return B({method:"put",url:e,params:t,data:r})},delete(e,t,r){return B({method:"delete",url:e,params:t,data:r})}};var Ce={};he(Ce,{admin:()=>Rt,gateway:()=>St,message:()=>Dt,role:()=>kt,user:()=>Et});var Rt={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)},St={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)},Dt={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)},kt={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)},Et={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 Pe={};he(Pe,{contract:()=>Nt,file:()=>At,fileversion:()=>xt,project:()=>Mt,projectprogress:()=>jt});var Nt={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)},At={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)},xt={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)},Mt={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)},jt={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:we,user:Ce,project:Pe};import Ut from"dexie";var Bt=1440*60*1e3,Ie=class extends Ut{constructor(){super("DepartmentInfoDB");c(this,"departmentCache");this.version(1).stores({departmentCache:"id, timestamp"})}},G=new Ie,le=null,Lt=async()=>{try{let e=await G.departmentCache.get("DEPARTMENT_ALL");if(e){if(Date.now()-e.timestamp<Bt)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}},Ot=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)}},zt=async()=>{try{await G.departmentCache.clear()}catch(e){console.error("\u6E05\u9664\u90E8\u95E8\u7F13\u5B58\u5931\u8D25:",e)}},Fe=(e,t)=>e.map(r=>({...r,company_id:r.company_id||t.id,company:t,children:r.children?Fe(r.children,t):void 0})),Ft=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:Fe(i.data||[],n)}));return r.some(n=>n===null)?null:r.flatMap(n=>n||[])},Ve=async({forceRefresh:e=!1})=>{if(!e){let r=await Lt();if(r)return r}le||(le=Ft().then(async r=>(r&&await Ot(r),r)).finally(()=>{le=null}));let t=await le;return t||null},We=async({forceRefresh:e=!1})=>{let t=await Ve({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)},He=async({deptId:e,forceRefresh:t=!1})=>{let r=await We({forceRefresh:t});return r&&r.find(n=>n.id===e)||null},Vt=async({deptId:e,forceRefresh:t=!1})=>(await He({deptId:e,forceRefresh:t}))?.name||"",Wt=async()=>{await zt()},Ht=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}}},Hn={getDepartmentList:Ve,getFlatDepartmentList:We,getDepartmentById:He,getDepartmentNameById:Vt,clearDepartmentCache:Wt,getCacheStats:Ht};var qt="flyfish-file-viewer-cache",Gt=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}},Jt=e=>new Promise(t=>{let r=indexedDB.open(e);r.onsuccess=()=>t(r.result),r.onerror=()=>t(null),r.onblocked=()=>t(null)}),$t=async e=>{if(!(typeof indexedDB>"u"))try{if(!await Gt(e))return;let t=await Jt(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)}},Jn=async()=>{await $t(qt)};import ir from"dexie";import*as Te from"febs-browser";import Ge from"dexie";var j=1440*60*1e3,ve=class extends Ge{constructor(){super("UserInfoDB");c(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},Re=class extends Ge{constructor(){super("UserAvatarDB");c(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},R=new ve,S=new Re,Je=async e=>{try{let t=await S.userCache.get(e);if(t){if(Date.now()-t.timestamp<j)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}},Se=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<j?t.data.avatar=n.avatar:(t.data.avatar=void 0,await S.userCache.delete(e)):t.data.avatar=void 0,r-t.timestamp<j)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}},Kt=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)}},Xt=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)}},Yt=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<j&&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<j&&(l.avatar=a.avatar)}}catch(r){console.error("\u6279\u91CF\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}return t},qe=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)}},Zt=async()=>{let e=new Map;try{let t=Date.now(),r=await R.userCache.toArray();for(let n of r)if(t-n.timestamp<j){let i=await S.userCache.get(n.id);i&&t-i.timestamp<j&&(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},Qt=async()=>{try{await R.userCache.clear(),await S.userCache.clear()}catch(e){console.error("\u6E05\u9664\u7528\u6237\u7F13\u5B58\u5931\u8D25:",e)}},$e=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 Se(a);if(l){let d=await M({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 Se(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 Xt(s,u);try{let m=await M({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 M({user_id:s,forceRefresh:r,serverTick:l.tick_avatar_self});d&&(l.avatar=d)}catch{}return l}else return x.clearStoreToken(),null},M=async({user_id:e,forceRefresh:t=!1,serverTick:r=Number.MAX_SAFE_INTEGER})=>{if(!e)return;let n=await Je(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:Te.string.isEmpty(s.data?.avatar)?void 0:s.data?.avatar,avatar_small:Te.string.isEmpty(s.data?.avatar_small)?void 0:s.data?.avatar_small,avatar_tick:s.data?.tick_self||-1},await Kt(e,n))}catch{}}return n||void 0},er=async e=>(e=e||{forceRefresh:!1},await $e(e)),tr=()=>{let e=_.namespace("bp.ss").get("user");return e?JSON.parse(e):null},rr=async({userIds:e,keywords:t,forceRefresh:r=!1})=>{let n=new Map;if(!e){if(!r&&(!t||t.length===0)){let u=await Zt();if(u.size>=100){let m=new Map,P=0;for(let[I,F]of u){if(P>=100)break;let ye=await M({user_id:I,forceRefresh:!1,serverTick:F.tick_avatar_self});F.avatar=ye,m.set(I,F),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 qe(d);for(let u=0;u<d.length;u++){let m=await M({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 Yt(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 qe(u)}let d=[];if(l.length>0)for(let u of l){let m=await M({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},nr=async e=>{e?await R.userCache.delete(e):await Qt()},sr=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}}},Ke={getFromCache:Se,getAvatarFromCache:Je,getUserInfo:$e,getUserAvatar:M,current:er,currentLocalUser:tr,getUserInfos:rr,clearUserCache:nr,getCacheStats:sr};var os="approver:approvalinvoice:getInvoiceList",as="project:projectfile:downloadFolderPermission",ls="crm:customer:createCustomer",cs="crm:customer:updateCustomer",ds="crm:customer:deleteCustomer",us="crm:customer:viewContact",ms="crm:customer:transferCustomer",ps="crm:file:viewFile",gs="crm:file:manageFile",or=600*1e3,De=class extends ir{constructor(){super("PermissionInfoDB");c(this,"permissionCache");this.version(1).stores({permissionCache:"id, timestamp"})}},L=new De,ar=async e=>{try{let t=await L.permissionCache.get(`PERMISSION_${e}`);if(t){if(Date.now()-t.timestamp<or)return t.data;await L.permissionCache.delete(`PERMISSION_${e}`)}return null}catch(t){return console.error("\u8BFB\u53D6\u6743\u9650\u7F13\u5B58\u5931\u8D25:",t),null}},lr=async(e,t)=>{try{await L.permissionCache.put({id:`PERMISSION_${e}`,data:t,timestamp:Date.now()})}catch(r){console.error("\u5199\u5165\u6743\u9650\u7F13\u5B58\u5931\u8D25:",r)}},cr=async e=>{try{e?await L.permissionCache.delete(`PERMISSION_${e}`):await L.permissionCache.clear()}catch(t){console.error("\u6E05\u9664\u6743\u9650\u7F13\u5B58\u5931\u8D25:",t)}},ce=async({userId:e,forceRefresh:t=!1})=>{let r=e?{id:e}:await Ke.getUserInfo({});if(!r)return null;let n=r.id;if(!t){let a=await ar(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 lr(n,s),s},dr=async({permission:e,userId:t,forceRefresh:r=!1})=>{let n=await ce({userId:t,forceRefresh:r});return n?n.some(i=>i.permission===e):!1},ur=async({permissions:e,userId:t,forceRefresh:r=!1,allRequired:n=!0})=>{let i=await ce({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))},mr=async({permission:e,userId:t,forceRefresh:r=!1})=>{let n=await ce({userId:t,forceRefresh:r});return n&&n.find(s=>s.permission===e)?.descs||""},pr=async e=>{await cr(e)},gr=async()=>{try{let e=await L.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}}},fs={getUserPermissions:ce,hasPermission:dr,hasPermissions:ur,getPermissionDesc:mr,clearPermissionCache:pr,getCacheStats:gr};import fr from"dexie";var yr=3600*1e3,ke=class extends fr{constructor(){super("RoleInfoDB");c(this,"roleCache");this.version(1).stores({roleCache:"id, timestamp"})}},J=new ke,hr=async()=>{try{let e=await J.roleCache.get("ROLE_ALL");if(e){if(Date.now()-e.timestamp<yr)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}},br=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)}},_r=async()=>{try{await J.roleCache.clear()}catch(e){console.error("\u6E05\u9664\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e)}},Ne=async({forceRefresh:e=!1})=>{if(!e){let n=await hr();if(n)return n}let t=await y.user.role.listRoles();if(t?.code!==200)return null;let r=t.data||[];return await br(r),r},Xe=async({roleId:e,forceRefresh:t=!1})=>{let r=await Ne({forceRefresh:t});return r&&r.find(n=>n.id===e)||null},wr=async({roleId:e,forceRefresh:t=!1})=>(await Xe({roleId:e,forceRefresh:t}))?.name||"",Ee=async({forceRefresh:e=!1}={})=>{let t=await Ne({forceRefresh:e}),r={};return(t||[]).forEach(n=>{r[n.id]=n.name}),r},Cr=async({roleIds:e})=>{let t=await Ee();return(e||[]).filter(n=>!!n&&!t[n]).length>0&&(t=await Ee({forceRefresh:!0})),t},Pr=async()=>{await _r()},Ir=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}}},Cs={getRoleList:Ne,getRoleById:Xe,getRoleNameById:wr,getRoleNameMap:Ee,getRoleNameMapForIds:Cr,clearRoleCache:Pr,getCacheStats:Ir};import Tr from"dexie";var Ae=class extends Tr{constructor(){super("ViewToggleDB");c(this,"viewModeCache");this.version(1).stores({viewModeCache:"pageKey, timestamp"})}},$=new Ae,vr=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}},Rr=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)}},Sr=async e=>{try{await $.viewModeCache.delete(e)}catch(t){console.error("\u6E05\u9664\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",t)}},Dr=async()=>{try{await $.viewModeCache.clear()}catch(e){console.error("\u6E05\u9664\u6240\u6709\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",e)}},kr=async e=>await vr(e),Er=async(e,t)=>{await Rr(e,t)},Nr=async e=>{await Sr(e)},Ar=async()=>{await Dr()},xr=async()=>{try{return await $.viewModeCache.toArray()}catch(e){return console.error("\u83B7\u53D6\u6240\u6709\u89C6\u56FE\u6A21\u5F0F\u7F13\u5B58\u5931\u8D25:",e),[]}},Rs={getViewMode:kr,setViewMode:Er,clearViewModeCache:Nr,clearAllViewModeCache:Ar,getAllCachedViewModes:xr};var Ye={project:"\u9879\u76EE\u52A8\u6001",approval:"\u5BA1\u6279\u52A8\u6001",knowledge:"\u77E5\u8BC6\u5E93",todo:"\u5F85\u529E\u4EFB\u52A1",crm:"\u5BA2\u6237\u7BA1\u7406"},Mr={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"},jr={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"},Ur={kb_new:"\u65B0\u589E\u77E5\u8BC6"},Br={task_assign:"\u4EFB\u52A1\u6307\u6D3E",task_remind:"\u5230\u671F\u63D0\u9192"},Lr={customer_transfer_in:"\u5BA2\u6237\u79FB\u4EA4\uFF08\u63A5\u6536\uFF09",customer_transfer_out:"\u5BA2\u6237\u79FB\u4EA4\uFF08\u79FB\u4EA4\u51FA\uFF09"},Or={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"},Ze=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(Ye,t)}static getTypeLabel(t){return Ye[t]||"\u7CFB\u7EDF\u6D88\u606F"}static getBizTypeLabel(t,r){switch(t){case"project":return Mr[r]||"";case"approval":return jr[r]||"";case"knowledge":return Ur[r]||"";case"todo":return Br[r]||"";case"crm":return Lr[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=Or[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 Es(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{await navigator.clipboard.writeText(e);return}catch{}if(!zr(e))throw new Error("\u590D\u5236\u5230\u526A\u8D34\u677F\u5931\u8D25")}function zr(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 Qe=(import.meta.env.VITE_COMPANY_EMAIL_DOMAINS||"").split(",").map(e=>e.trim().toLowerCase().replace(/^@/,"")).filter(Boolean),Fr=e=>(e||"").trim().toLowerCase(),As=()=>Qe.join("\u3001"),xs=e=>{let t=Fr(e),r=t.split("@")[1];return Qe.some(n=>n.includes("@")?n===t:!!(r&&n===r))};function js(){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 Bs=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"}),Ls=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"}),Os=e=>new Intl.NumberFormat("zh-CN",{style:"currency",currency:"CNY"}).format(e),zs=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 Ws={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 qs(){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 Gs(){try{et()}catch{}}var de=class{constructor({highWaterMark:t}){c(this,"highWaterMark");this.highWaterMark=t}size(t){return t?.byteLength??0}},ue=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)}},E=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())}},O=class{constructor(t,r,n){c(this,"readable");c(this,"writable");let i;this.readable=new E({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)}})}},me=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 O({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}},pe=class{constructor(){c(this,"readable");c(this,"writable");c(this,"encoding","utf-8");let t=new TextEncoder,r=new O({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 Vr(){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 et(){if(typeof globalThis>"u")return;Vr()?(b("ReadableStream",E),b("ReadableByteStreamController",X),b("ReadableStreamDefaultController",K),b("ReadableStreamDefaultReader",Y),b("ReadableStreamBYOBReader",Z),b("WritableStream",ee),b("WritableStreamDefaultWriter",Q),b("TransformStream",O),b("TextDecoderStream",me),b("TextEncoderStream",pe),b("ByteLengthQueuingStrategy",de),b("CountQueuingStrategy",ue)):(w("ByteLengthQueuingStrategy",de),w("CountQueuingStrategy",ue),w("ReadableStream",E),w("WritableStream",ee),w("TransformStream",O),w("ReadableByteStreamController",X),w("ReadableStreamDefaultController",K),w("ReadableStreamDefaultReader",Y),w("ReadableStreamBYOBReader",Z),w("WritableStreamDefaultWriter",Q),w("TextDecoderStream",me),w("TextEncoderStream",pe));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:E.prototype.pipeTo}),Object.defineProperty(r,"pipeThrough",{configurable:!0,writable:!0,value:E.prototype.pipeThrough}),Object.defineProperty(r,"tee",{configurable:!0,writable:!0,value:E.prototype.tee}))}}catch{}}try{et()}catch(e){console.warn("[polyfills] \u5B89\u88C5 Web Streams polyfill \u5931\u8D25\uFF1A",e)}var Ks=/^(0|[1-9](\d+)?(\.\d\d?)?)$/;var nt=(typeof window<"u"?window.location.origin:"")+"/polyfills/polyfills.js",tt=new Map,rt=new Map;function st(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 Ys(e){let t=tt.get(e);if(t)return t;let r=st(e),n=`/* auto-generated bootstrap: polyfills first, then real worker (${r}) */
2
2
  try { self.importScripts(${JSON.stringify(nt)}); } catch (e) { console.error('[worker-bootstrap] polyfills load failed:', e); }
3
3
  self.importScripts(${JSON.stringify(r)});
4
4
  `,i=new Blob([n],{type:"text/javascript"}),s=URL.createObjectURL(i);return tt.set(e,s),s}function Zs(e){let t=rt.get(e);if(t)return t;let r=st(e),n=`/* auto-generated module bootstrap: polyfills first, then real worker (${r}) */
5
5
  import ${JSON.stringify(nt)};
6
6
  import ${JSON.stringify(r)};
7
- `,i=new Blob([n],{type:"text/javascript"}),s=URL.createObjectURL(i);return rt.set(e,s),s}import{useEffect as Wr,useRef as it}from"react";import{jsx as z,jsxs as ge}from"react/jsx-runtime";function ti(){return ge("div",{className:"ant-empty ant-empty-normal justify-self-center text-muted py-4",children:[z("div",{className:"ant-empty-image",children:ge("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[z("title",{children:" \u65E0\u6570\u636E "}),ge("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[z("ellipse",{fill:"rgb(var(--color-muted) / 0.12)",cx:"32",cy:"33",rx:"32",ry:"7"}),ge("g",{fillRule:"nonzero",stroke:"rgb(var(--color-border))",children:[z("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"}),z("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))"})]})]})]})}),z("div",{className:"ant-empty-description justify-self-center text-sm font-thin text-muted",children:" \u65E0\u6570\u636E "})]})}function ri(e,t,r=768){let n=it(e),i=it(t);n.current=e,i.current=t,Wr(()=>{let s=window.innerWidth<=r,o=()=>{let l=window.innerWidth<=r;l!==s&&(s=l,l?n.current():i.current())};return s?n.current():i.current(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[r])}var C=e=>{let t=(e||"").trim();return["undefined","null"].includes(t.toLowerCase())?"":t},Hr=e=>{try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}},qr=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:[Hr(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"))}},Gr=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()}`},ii=e=>{let t=qr(e);return t?Gr(t):null},oi=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 N,useEffect as ot,useRef as xe}from"react";var Jr=1200,lt=0,fe=0,at=e=>{Date.now()>lt||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())},$r=()=>{lt=Date.now()+Jr};function ci(e,t={}){let{delay:r=500,smallView:n=!1,moveThreshold:i=10}=t,s=xe(new Map),o=xe(new Map),l=xe(new Map),d=N(p=>typeof p=="string"?p:typeof p=="object"&&p!==null&&"id"in p?String(p.id):String(p),[]);ot(()=>()=>{s.current.forEach(p=>clearTimeout(p)),s.current.clear(),o.current.clear(),l.current.clear()},[]),ot(()=>{if(n)return fe===0&&document.addEventListener("contextmenu",at,!0),fe+=1,()=>{fe-=1,fe===0&&document.removeEventListener("contextmenu",at,!0)}},[n]);let u=N(p=>{let f=s.current.get(p);f&&(clearTimeout(f),s.current.delete(p)),l.current.delete(p)},[]),m=N(p=>f=>{if(!n||f.touches.length!==1)return;let D=d(p);o.current.set(D,!1);let U=f.touches[0];l.current.set(D,{x:U.clientX,y:U.clientY});let te=setTimeout(()=>{$r(),o.current.set(D,!0),e(p,f)},r);s.current.set(D,te)},[n,r,e,d]),P=N(p=>f=>{if(!n)return;let D=d(p),U=l.current.get(D);if(!U||!f.touches[0]){u(D);return}let te=f.touches[0],dt=Math.abs(te.clientX-U.x),ut=Math.abs(te.clientY-U.y);(dt>i||ut>i)&&u(D)},[n,i,d,u]),I=N(p=>()=>{let f=d(p);u(f)},[d,u]),F=N(p=>()=>{I(p)()},[I]),ye=N(p=>{let f=d(p);return o.current.get(f)||!1},[d]),ct=N(p=>{let f=d(p);o.current.set(f,!1)},[d]);return{handleTouchStart:m,handleTouchMove:P,handleTouchEnd:I,handleTouchCancel:F,wasLongPressed:ye,resetLongPress:ct}}import{useEffect as Kr,useState as Xr}from"react";function mi(){let[e,t]=Xr(typeof navigator<"u"?navigator.onLine:!0);return Kr(()=>{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 Yr=(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))(Yr||{});var Zr=(i=>(i.DRAFT="DRAFT",i.APPROVALLING="APPROVALLING",i.PENDING="PENDING",i.SIGNED="SIGNED",i))(Zr||{});import Qr from"react";import{Tag as en}from"antd";var bi=(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 Qr.createElement(en,{color:n?.color,className:t},n?.text)};var tn=(s=>(s.OWNER="owner",s.LAYER="layer",s.MANAGER="manager",s.MEMBER="member",s.VIEWER="viewer",s))(tn||{});export{y as API,jr as APPROVAL_BIZ_LABELS,x as AuthorizationHandler,pt as CORE_VERSION,Lr as CRM_BIZ_LABELS,Hn as CacheDepartmentInfo,fs as CachePermissionInfo,Cs as CacheRoleInfo,Ke as CacheUserInfo,Rs as CacheViewToggleInfo,Zr as ContractStatus,a as HttpRequest,Ur as KNOWLEDGE_BIZ_LABELS,Ye as MESSAGE_TYPE_LABELS,Ze as MessageContentUtils,ls as PERMISSION_CRM_CREATE,ds as PERMISSION_CRM_DELETE,gs as PERMISSION_CRM_MANAGE_FILE,ms as PERMISSION_CRM_TRANSFER,cs as PERMISSION_CRM_UPDATE,us as PERMISSION_CRM_VIEW_CONTACT,ps as PERMISSION_CRM_VIEW_FILE,as as PERMISSION_FOLDER_DOWNLOAD,os as PERMISSION_INVOICE_LIST,Mr as PROJECT_BIZ_LABELS,tn as ProjectRole,Yr as ProjectStatus,_e as ResponseCode,Br as TODO_BIZ_LABELS,Rt as admin,Gr as buildEmailComposePath,ii as buildEmailComposePathFromMailto,Ar as clearAllViewModeCache,Jn as clearFileViewerCache,$t as clearIndexedDBStores,Nr as clearViewModeCache,Nt as contract,Es as copyToClipboard,qs as ensurePromiseAllSettled,Gs as ensureWebStreamsPolyfill,At as file,xt as fileversion,js as forbidDebugger,Os as formatCurrency,Bs as formatDate,Ls as formatDatetime,zs as formatDisksize,St as gateway,As as getCompanyEmailRuleText,bi as getContractStatusTag,kr as getViewMode,ti as htmlNoData,et as installWebStreamsPolyfill,xs as isCompanyEmail,Ws as keyboard,Dt as message,qr as parseMailtoHref,Mt as project,jt as projectprogress,oi as readEmailComposeSearchParams,Ks as regexCurrency,kt as role,Er as setViewMode,_ as storage,ri as useEffectResize,ci as useLongPress,mi as useOnlineStatus,Et as user,Zs as withPolyfillModuleWorkerBootstrap,Ys as withPolyfillWorkerBootstrap};
7
+ `,i=new Blob([n],{type:"text/javascript"}),s=URL.createObjectURL(i);return rt.set(e,s),s}import{useEffect as Wr,useRef as it}from"react";import{jsx as z,jsxs as ge}from"react/jsx-runtime";function ti(){return ge("div",{className:"ant-empty ant-empty-normal justify-self-center text-muted py-4",children:[z("div",{className:"ant-empty-image",children:ge("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[z("title",{children:" \u65E0\u6570\u636E "}),ge("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[z("ellipse",{fill:"rgb(var(--color-muted) / 0.12)",cx:"32",cy:"33",rx:"32",ry:"7"}),ge("g",{fillRule:"nonzero",stroke:"rgb(var(--color-border))",children:[z("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"}),z("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))"})]})]})]})}),z("div",{className:"ant-empty-description justify-self-center text-sm font-thin text-muted",children:" \u65E0\u6570\u636E "})]})}function ri(e,t,r=768){let n=it(e),i=it(t);n.current=e,i.current=t,Wr(()=>{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},Hr=e=>{try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}},qr=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:[Hr(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"))}},Gr=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()}`},ii=e=>{let t=qr(e);return t?Gr(t):null},oi=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 N,useEffect as ot,useRef as xe}from"react";var Jr=1200,lt=0,fe=0,at=e=>{Date.now()>lt||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())},$r=()=>{lt=Date.now()+Jr};function ci(e,t={}){let{delay:r=500,smallView:n=!1,moveThreshold:i=10}=t,s=xe(new Map),a=xe(new Map),l=xe(new Map),d=N(p=>typeof p=="string"?p:typeof p=="object"&&p!==null&&"id"in p?String(p.id):String(p),[]);ot(()=>()=>{s.current.forEach(p=>clearTimeout(p)),s.current.clear(),a.current.clear(),l.current.clear()},[]),ot(()=>{if(n)return fe===0&&document.addEventListener("contextmenu",at,!0),fe+=1,()=>{fe-=1,fe===0&&document.removeEventListener("contextmenu",at,!0)}},[n]);let u=N(p=>{let f=s.current.get(p);f&&(clearTimeout(f),s.current.delete(p)),l.current.delete(p)},[]),m=N(p=>f=>{if(!n||f.touches.length!==1)return;let D=d(p);a.current.set(D,!1);let U=f.touches[0];l.current.set(D,{x:U.clientX,y:U.clientY});let te=setTimeout(()=>{$r(),a.current.set(D,!0),e(p,f)},r);s.current.set(D,te)},[n,r,e,d]),P=N(p=>f=>{if(!n)return;let D=d(p),U=l.current.get(D);if(!U||!f.touches[0]){u(D);return}let te=f.touches[0],dt=Math.abs(te.clientX-U.x),ut=Math.abs(te.clientY-U.y);(dt>i||ut>i)&&u(D)},[n,i,d,u]),I=N(p=>()=>{let f=d(p);u(f)},[d,u]),F=N(p=>()=>{I(p)()},[I]),ye=N(p=>{let f=d(p);return a.current.get(f)||!1},[d]),ct=N(p=>{let f=d(p);a.current.set(f,!1)},[d]);return{handleTouchStart:m,handleTouchMove:P,handleTouchEnd:I,handleTouchCancel:F,wasLongPressed:ye,resetLongPress:ct}}import{useEffect as Kr,useState as Xr}from"react";function mi(){let[e,t]=Xr(typeof navigator<"u"?navigator.onLine:!0);return Kr(()=>{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 Yr=(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))(Yr||{});var Zr=(i=>(i.DRAFT="DRAFT",i.APPROVALLING="APPROVALLING",i.PENDING="PENDING",i.SIGNED="SIGNED",i))(Zr||{});import Qr from"react";import{Tag as en}from"antd";var bi=(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 Qr.createElement(en,{color:n?.color,className:t},n?.text)};var tn=(s=>(s.OWNER="owner",s.LAYER="layer",s.MANAGER="manager",s.MEMBER="member",s.VIEWER="viewer",s))(tn||{});export{y as API,jr as APPROVAL_BIZ_LABELS,x as AuthorizationHandler,pt as CORE_VERSION,Lr as CRM_BIZ_LABELS,Hn as CacheDepartmentInfo,fs as CachePermissionInfo,Cs as CacheRoleInfo,Ke as CacheUserInfo,Rs as CacheViewToggleInfo,Zr as ContractStatus,o as HttpRequest,Ur as KNOWLEDGE_BIZ_LABELS,Ye as MESSAGE_TYPE_LABELS,Ze as MessageContentUtils,ls as PERMISSION_CRM_CREATE,ds as PERMISSION_CRM_DELETE,gs as PERMISSION_CRM_MANAGE_FILE,ms as PERMISSION_CRM_TRANSFER,cs as PERMISSION_CRM_UPDATE,us as PERMISSION_CRM_VIEW_CONTACT,ps as PERMISSION_CRM_VIEW_FILE,as as PERMISSION_FOLDER_DOWNLOAD,os as PERMISSION_INVOICE_LIST,Mr as PROJECT_BIZ_LABELS,tn as ProjectRole,Yr as ProjectStatus,_e as ResponseCode,Br as TODO_BIZ_LABELS,Rt as admin,Gr as buildEmailComposePath,ii as buildEmailComposePathFromMailto,Ar as clearAllViewModeCache,Jn as clearFileViewerCache,$t as clearIndexedDBStores,Nr as clearViewModeCache,Nt as contract,Es as copyToClipboard,qs as ensurePromiseAllSettled,Gs as ensureWebStreamsPolyfill,At as file,xt as fileversion,js as forbidDebugger,Os as formatCurrency,Bs as formatDate,Ls as formatDatetime,zs as formatDisksize,St as gateway,As as getCompanyEmailRuleText,bi as getContractStatusTag,kr as getViewMode,ti as htmlNoData,et as installWebStreamsPolyfill,xs as isCompanyEmail,Ws as keyboard,Dt as message,qr as parseMailtoHref,Mt as project,jt as projectprogress,oi as readEmailComposeSearchParams,Ks as regexCurrency,kt as role,Er as setViewMode,_ as storage,ri as useEffectResize,ci as useLongPress,mi as useOnlineStatus,Et as user,Zs as withPolyfillModuleWorkerBootstrap,Ys as withPolyfillWorkerBootstrap};