@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 +1 -1
- package/dist/index.js +2 -2
- package/dist/ui/index.js +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +16 -16
- package/types/api/project.d.ts +40 -0
package/dist/ui/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Zt=Object.defineProperty;var Br=(e,t,r)=>t in e?Zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var bt=(e,t)=>{for(var r in t)Zt(e,r,{get:t[r],enumerable:!0})};var F=(e,t,r)=>Br(e,typeof t!="symbol"?t+"":t,r);import{Modal as Lr,Button as st,Space as er,Typography as zr}from"antd";import{CheckCircleFilled as Hr,CloseCircleFilled as Wr,ExclamationCircleFilled as Vr,InfoCircleFilled as qr,QuestionCircleFilled as $r}from"@ant-design/icons";import{createRoot as Xr}from"react-dom/client";import{jsx as q,jsxs as tr}from"react/jsx-runtime";var{Text:Gr,Title:Jr}=zr,rr={type:"info",title:"\u63D0\u793A",content:"",width:420,centered:!0,closable:!0,maskClosable:!0,okText:"\u786E\u5B9A",okType:"primary",cancelText:"\u53D6\u6D88",autoClose:0,showIcon:!1},Z=null,Y=null,Be=null,ot=e=>{let{type:t="info",title:r,content:n,width:d,centered:s,closable:a,maskClosable:o,okText:i,okType:l,cancelText:m,buttons:C,onOk:b,onCancel:w,open:_,onClose:A,className:P,showIcon:O}=e,N={success:q(Hr,{style:{color:"#52c41a",fontSize:24,marginRight:8}}),error:q(Wr,{style:{color:"#ff4d4f",fontSize:24,marginRight:8}}),warning:q(Vr,{style:{color:"#faad14",fontSize:24,marginRight:8}}),info:q(qr,{style:{color:"#1677ff",fontSize:24,marginRight:8}}),confirm:q($r,{style:{color:"#1677ff",fontSize:24,marginRight:8}})},I=async()=>{b&&await b(),A()},R=()=>{w&&w(),A()},T=()=>C&&C.length>0?q(er,{style:{display:"flex",justifyContent:"flex-end"},children:C.map((j,x)=>q(st,{type:j.type||"default",onClick:()=>{j.onClick&&j.onClick(),A()},children:j.text},x))}):t==="confirm"?tr(er,{style:{display:"flex",justifyContent:"flex-end"},children:[q(st,{onClick:R,children:m}),q(st,{type:l,onClick:I,children:i})]}):q(st,{type:l,onClick:I,children:i});return q(Lr,{title:r?tr("div",{style:{display:"flex",alignItems:"center"},children:[O&&N[t],q(Jr,{level:4,style:{margin:0},children:r})]}):null,open:_,width:d,centered:s,closable:a,maskClosable:o,onCancel:R,footer:T(),className:P?P+" ant-modal-nofull":"ant-modal-nofull",children:q("div",{style:{marginLeft:O?32:0},children:typeof n=="string"?q(Gr,{children:n}):n})})},Ne=(e,t=!0)=>{Be&&(window.clearTimeout(Be),Be=null);let r={...rr,...e},n=()=>{Z&&Y&&Y.render(q(ot,{...r,open:!1,onClose:()=>{r.afterClose&&r.afterClose(),Z&&Y&&setTimeout(()=>{Y?.unmount(),document.body.removeChild(Z),Z=null,Y=null},300)}}))};return Z&&Y?Y.render(q(ot,{...r,open:t,onClose:n})):(Z=document.createElement("div"),document.body.appendChild(Z),Y=Xr(Z),Y.render(q(ot,{...r,open:t,onClose:n}))),r.autoClose&&r.autoClose>0&&(Be=window.setTimeout(()=>{n(),Be=null},r.autoClose)),n},Kr={success:e=>{let t=typeof e=="string"?{content:e}:e;return Ne({...t,type:"success",title:t.title||"\u6210\u529F"})},error:e=>{let t=typeof e=="string"?{content:e}:e;return Ne({...t,type:"error",title:t.title||"\u9519\u8BEF"})},warning:e=>{let t=typeof e=="string"?{content:e}:e;return Ne({...t,type:"warning",title:t.title||"\u8B66\u544A"})},info:e=>{let t=typeof e=="string"?{content:e}:e;return Ne({...t,type:"info",title:t.title||"\u63D0\u793A"})},confirm:e=>{let t=typeof e=="string"?{content:e}:e;return Ne({...t,type:"confirm",title:t.title||"\u786E\u8BA4"})},custom:e=>Ne(e),close:()=>{Z&&Y&&Y.render(q(ot,{...rr,open:!1,onClose:()=>{Z&&Y&&(Y.unmount(),document.body.removeChild(Z),Z=null,Y=null)}}))}},Qr=Kr;import{Modal as Yr,Button as nr,Space as Zr}from"antd";import{ExclamationCircleFilled as en,InfoCircleFilled as tn,QuestionCircleFilled as rn,WarningFilled as nn}from"@ant-design/icons";import{createRoot as sn}from"react-dom/client";import{jsx as re,jsxs as or}from"react/jsx-runtime";var on={type:"confirm",title:"\u786E\u8BA4",content:"",width:420,centered:!0,closable:!0,maskClosable:!1,okText:"\u786E\u5B9A",okType:"primary",cancelText:"\u53D6\u6D88",showIcon:!1,keyboard:!0,autoFocusButton:"ok",zIndex:2e4},ie=null,ae=null,sr=e=>{let{type:t="confirm",title:r,content:n,width:d,centered:s,closable:a,maskClosable:o,okText:i,okType:l,cancelText:m,okButtonProps:C,cancelButtonProps:b,onOk:w,onCancel:_,open:A,onClose:P,className:O,showIcon:N,zIndex:I,keyboard:R,autoFocusButton:T}=e,D={confirm:re(rn,{style:{color:"#1677ff",fontSize:22,marginRight:12}}),warning:re(en,{style:{color:"#faad14",fontSize:22,marginRight:12}}),info:re(tn,{style:{color:"#1677ff",fontSize:22,marginRight:12}}),error:re(nn,{style:{color:"#ff4d4f",fontSize:22,marginRight:12}})},j=async()=>{try{if(w){let W=w();W instanceof Promise&&await W}P(!0)}catch(W){console.error("Confirm onOk error:",W)}},x=()=>{_&&_(),P(!1)};return re(Yr,{title:r?or("div",{style:{display:"flex",alignItems:"center"},children:[N&&D[t],re("span",{children:r})]}):null,open:A,width:d,centered:s,closable:a,maskClosable:o,onCancel:x,className:O?O+" ant-modal-nofull":"ant-modal-nofull",zIndex:I,keyboard:R,footer:or(Zr,{children:[re(nr,{onClick:x,...b,autoFocus:T==="cancel",children:m}),re(nr,{type:l,onClick:j,...C,autoFocus:T==="ok",children:i})]}),children:re("div",{style:{marginLeft:N?34:0},children:n})})},Le=e=>{let t={...on,...e};return ie&&ae&&(ae.unmount(),document.body.removeChild(ie),ie=null,ae=null),new Promise(r=>{let n=d=>{ie&&ae&&ae.render(re(sr,{...t,open:!1,onClose:s=>{t.afterClose&&t.afterClose(),setTimeout(()=>{ie&&ae&&(ae.unmount(),document.body.removeChild(ie),ie=null,ae=null),r(s)},300)}})),r(d)};ie=document.createElement("div"),document.body.appendChild(ie),ae=sn(ie),ae.render(re(sr,{...t,open:!0,onClose:n}))})},an={confirm:e=>Le({...typeof e=="string"?{content:e,showIcon:!1,title:""}:e,type:"confirm"}),warning:e=>{let t=typeof e=="string"?{content:e}:e;return Le({...t,type:"warning",title:t.title||"\u8B66\u544A"})},info:e=>{let t=typeof e=="string"?{content:e}:e;return Le({...t,type:"info",title:t.title||"\u4FE1\u606F"})},error:e=>{let t=typeof e=="string"?{content:e}:e;return Le({...t,type:"error",title:t.title||"\u9519\u8BEF"})},custom:e=>Le(e)},ln=an;import{useState as cn,useRef as dn,useEffect as mn}from"react";import{Calendar as un,ChevronLeft as pn,ChevronRight as gn}from"lucide-react";import{Button as vt}from"antd";import{jsx as V,jsxs as ze}from"react/jsx-runtime";function Ct({value:e,onChange:t,type:r="date",placeholder:n="\u9009\u62E9\u65E5\u671F",className:d=""}){let[s,a]=cn(!1),o=dn(null),i=e?l(e,r):"";mn(()=>{function b(w){o.current&&!o.current.contains(w.target)&&a(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]);function l(b,w){if(!b)return"";try{if(w==="month"){let[_,A]=b.split("-");return`${_}\u5E74${A}\u6708`}else return new Date(b).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"})}catch{return b}}let m=b=>{t(b.target.value)},C=()=>{a(!s)};return ze("div",{className:`relative ${d}`,ref:o,children:[ze("div",{className:"relative cursor-pointer",children:[V("input",{type:r,value:e,onChange:m,onClick:C,className:"w-full bg-white border border-ios-gray-200 rounded-ios py-2.5 pl-3 pr-10 text-sm text-ios-gray-700 shadow-ios focus:outline-none focus:ring-2 focus:ring-ios-blue-400 focus:border-transparent transition-all duration-200 hover:border-ios-blue-300 cursor-pointer",placeholder:n}),V("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none",children:V(un,{className:"h-4 w-4 text-ios-gray-400"})})]}),s&&ze("div",{className:"absolute z-10 mt-1 bg-white rounded-ios shadow-ios-md p-4 ring-1 ring-ios-gray-200 ring-opacity-5",children:[ze("div",{className:"flex justify-between items-center mb-4",children:[V(vt,{type:"text",className:"p-1.5 hover:bg-ios-gray-100 rounded-full transition-colors duration-150",icon:V(pn,{className:"h-4 w-4 text-ios-gray-600"})}),V("span",{className:"text-sm font-medium text-ios-gray-700",children:"2024\u5E745\u6708"}),V(vt,{type:"text",className:"p-1.5 hover:bg-ios-gray-100 rounded-full transition-colors duration-150",icon:V(gn,{className:"h-4 w-4 text-ios-gray-600"})})]}),ze("div",{className:"grid grid-cols-7 gap-1 text-center text-xs",children:[V("div",{className:"text-ios-gray-500 font-medium",children:"\u65E5"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E00"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E8C"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E09"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u56DB"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E94"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u516D"}),V("div",{className:"text-ios-gray-300 py-1.5",children:"30"}),V("div",{className:"text-ios-gray-300 py-1.5",children:"31"}),Array.from({length:30}).map((b,w)=>V("div",{className:`py-1.5 hover:bg-ios-blue-50 rounded-full cursor-pointer transition-colors duration-150 ${w===14?"bg-ios-blue-500 text-white":"text-ios-gray-700"}`,onClick:()=>{let _=w+1,A=`2024-05-${_<10?"0"+_:_}`;t(A),a(!1)},children:w+1},w))]}),V("div",{className:"mt-4 flex justify-end",children:V(vt,{type:"text",className:"px-4 py-1.5 text-sm text-ios-blue-500 hover:bg-ios-blue-50 rounded-ios transition-colors duration-150",onClick:()=>a(!1),children:"\u786E\u5B9A"})})]})]})}import{jsx as It,jsxs as fn}from"react/jsx-runtime";function ei({startDate:e,endDate:t,onStartDateChange:r,onEndDateChange:n,type:d="date",className:s=""}){return fn("div",{className:`flex items-center space-x-2 ${s}`,children:[It(Ct,{value:e,onChange:r,type:d,placeholder:"\u5F00\u59CB\u65E5\u671F"}),It("span",{className:"text-gray-500",children:"\u81F3"}),It(Ct,{value:t,onChange:n,type:d,placeholder:"\u7ED3\u675F\u65E5\u671F"})]})}import{useState as He,useRef as yn}from"react";import{Button as wt,Modal as hn,message as Tt}from"antd";import{UploadOutlined as bn}from"@ant-design/icons";import vn from"react-image-crop";import"react-image-crop/dist/ReactCrop.css";function it(e,t){let r=new FileReader;r.readAsDataURL(e),r.onload=function(){t(r.result)},r.onerror=function(){t(null)},r.onabort=function(){t(null)}}function Rt(e,t,r,n){t=t>0?t:1024;let d=t,s=t,a=new Image;a.addEventListener("load",function(o){let i,l=!1;if(d<a.naturalWidth&&(l=!0,i=a.naturalWidth/d,s=a.naturalHeight/i),s<a.naturalHeight&&(l=!0,i=a.naturalHeight/s,d=a.naturalWidth/i),!l){d=a.naturalWidth,s=a.naturalHeight,n&&n(e,d,s);return}let m=document.createElement("canvas");m.width=d,m.height=s;let C=m.getContext("2d");C?.clearRect(0,0,d,s),C?.drawImage(a,0,0,d,s);let b=m.toDataURL(r||"image/png");m=null,n&&n(b,d,s)}),a.src=e}import{jsx as ue,jsxs as Cn}from"react/jsx-runtime";var ui=({onUpload:e,accept:t="image/*",maxSize:r=5,aspectRatio:n,className:d="",useBase64:s=!1,id:a})=>{let[o,i]=He(!1),[l,m]=He(""),[C,b]=He({unit:"%",width:90,height:90,x:5,y:5}),[w,_]=He(null),[A,P]=He(null),O=yn(null),N=R=>{let T=R.target.files?.[0];if(!T)return;if(T.size>r*1024*1024){Tt.error(`\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${r}MB`);return}if(!T.type.startsWith("image/")){Tt.error("\u8BF7\u4E0A\u4F20\u56FE\u7247\u6587\u4EF6");return}P(T);let D=new FileReader;D.onload=j=>{m(j.target?.result),i(!0)},D.readAsDataURL(T)},I=async R=>{if(!w||!A)return;let T=w.width,D=w.height,j=w.naturalWidth/T,x=w.naturalHeight/D,B=R.unit=="%"?T/100:1,W=R.unit=="%"?D/100:1,v=R.x*j*B,S=R.y*x*W,G=R.width*j*B,Q=R.height*x*W;try{let X=document.createElement("canvas");X.width=G,X.height=Q;let fe=X.getContext("2d");if(!fe)return;fe.drawImage(w,v,S,G,Q,0,0,G,Q),X.toBlob(ye=>{if(!ye)return;let oe=new File([ye],A.name,{type:A.type});if(s){it(oe,he=>{Rt(he,0,"image/jpeg",me=>{i(!1),e(me)})});return}else i(!1),e(oe)},A.type),i(!1),m(""),P(null),O.current&&(O.current.value="")}catch{Tt.error("\u56FE\u7247\u5904\u7406\u5931\u8D25")}};return Cn("div",{className:d,children:[ue("input",{type:"file",ref:O,accept:t,onChange:N,style:{display:"none"}}),ue(wt,{id:a,icon:ue(bn,{}),onClick:()=>O.current?.click(),className:"btn-primary",children:"\u9009\u62E9\u56FE\u7247"}),ue(hn,{title:"\u88C1\u526A\u56FE\u7247",open:o,onCancel:()=>{i(!1),m(""),P(null),O.current&&(O.current.value="")},footer:[ue(wt,{onClick:()=>i(!1),className:"btn-outline",children:"\u53D6\u6D88"},"cancel"),ue(wt,{type:"primary",onClick:()=>I(C),className:"btn-primary",children:"\u786E\u8BA4"},"confirm")],width:500,children:ue("div",{className:"flex justify-center",children:l&&ue(vn,{crop:C,onChange:R=>b(R),aspect:n,className:"max-w-full",children:ue("img",{src:l,alt:"\u9884\u89C8",ref:R=>_(R),className:"max-w-full"})})})})]})};import{Spin as In}from"antd";import{LoadingOutlined as Rn}from"@ant-design/icons";import{createRoot as wn}from"react-dom/client";import{jsx as We}from"react/jsx-runtime";var ir=Symbol("loading");function ar(){let e=window[ir];return e||(e={count:0,timeoutId:0,inTimeout:!1},window[ir]=e),e}var cr={tip:"",fullscreen:!0,delay:0,mask:!0,iconSize:40,wrapperClassName:"ui-loading-wrapper"},Tn=e=>{let t={...cr,...e},{tip:r,fullscreen:n,mask:d,maskStyle:s,iconSize:a,iconStyle:o,containerStyle:i,wrapperClassName:l}=t,m=We(Rn,{style:{fontSize:a,color:"#1677ff",...o},spin:!0}),C=n?{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9999,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:d?"rgba(0, 0, 0, 0.45)":"transparent",...s}:{},b={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...i};return We("div",{style:C,className:l,children:We("div",{style:b,children:We(In,{indicator:m,children:r})})})},le=null,be=null,lr=(e={})=>(le&&be&&(be.unmount(),document.body.removeChild(le),le=null,be=null),le=document.createElement("div"),document.body.appendChild(le),be=wn(le),be.render(We(Tn,{...e})),le),at={show:(e={})=>{let t=ar();t.count++;let r={...cr,...e};if(r.delay&&r.delay>0){t.timeoutId!=0&&(window.clearTimeout(t.timeoutId),t.timeoutId=0),t.timeoutId=window.setTimeout(()=>{t.timeoutId=0,lr(r)},r.delay);return}else lr(r)},hide:()=>{let e=ar();if(e.count<=0){console.warn("Loading count is less than 0");return}e.count--,e.timeoutId!=0&&(window.clearTimeout(e.timeoutId),e.timeoutId=0),e.count==0&&le&&be&&(be.unmount(),document.body.removeChild(le),le=null,be=null)},service:(e,t={})=>(at.show(t),e.then(r=>(at.hide(),r)).catch(r=>{throw at.hide(),r}))},Ve=at;import{useState as Pn,useRef as xn,useEffect as Sn}from"react";import{ChevronDown as _n}from"lucide-react";import{Button as kn}from"antd";import{jsx as ve,jsxs as Pt}from"react/jsx-runtime";function Pi({options:e,value:t,onChange:r,placeholder:n="\u8BF7\u9009\u62E9",className:d=""}){let[s,a]=Pn(!1),o=xn(null),i=e.find(l=>l.value===t);return Sn(()=>{function l(m){o.current&&!o.current.contains(m.target)&&a(!1)}return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[]),Pt("div",{className:`relative ${d}`,ref:o,children:[Pt(kn,{type:"text",onClick:()=>a(!s),className:"w-full bg-white border border-ios-gray-200 rounded-ios py-2.5 pl-3 pr-10 text-left shadow-ios focus:outline-none focus:ring-2 focus:ring-ios-blue-400 focus:border-transparent transition-all duration-200 hover:border-ios-blue-300",children:[ve("span",{className:"block truncate text-sm text-ios-gray-700",children:i?i.label:n}),ve("span",{className:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none",children:ve(_n,{className:`h-4 w-4 text-ios-gray-400 transition-transform duration-200 ${s?"transform rotate-180":""}`})})]}),s&&ve("div",{className:"absolute z-10 mt-1 w-full bg-white shadow-ios-md max-h-60 rounded-ios py-1 text-base ring-1 ring-ios-gray-200 ring-opacity-5 overflow-auto focus:outline-none sm:text-sm",children:e.map(l=>Pt("div",{className:`cursor-pointer select-none relative py-2.5 pl-3 pr-9 hover:bg-ios-blue-50 transition-colors duration-150 ${l.value===t?"bg-ios-blue-50 text-ios-blue-600 font-medium":"text-ios-gray-700"}`,onClick:()=>{r(l.value),a(!1)},children:[ve("span",{className:"block truncate text-sm",children:l.label}),l.value===t&&ve("span",{className:"absolute inset-y-0 right-0 flex items-center pr-4 text-ios-blue-500",children:ve("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:ve("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},l.value))})]})}import{useEffect as dr,useState as Nn,useRef as Un}from"react";import{notification as ee}from"antd";import{CheckCircleOutlined as Dn,CloseCircleOutlined as En,InfoCircleOutlined as An,WarningOutlined as On}from"@ant-design/icons";import{Fragment as mr,jsx as $e,jsxs as Fn}from"react/jsx-runtime";var St={success:$e(Dn,{style:{color:"#52c41a"}}),error:$e(En,{style:{color:"#ff4d4f"}}),info:$e(An,{style:{color:"#1677ff"}}),warning:$e(On,{style:{color:"#faad14"}})},Di=({type:e,message:t,descs:r="",duration:n=3,placement:d="topRight",onClose:s})=>{let[a,o]=ee.useNotification(),[i,l]=Nn(!0);return dr(()=>{let m={message:t,descs:r,placement:d,duration:n,icon:St[e],onClose:()=>{l(!1),s?.()}};if(i)switch(e){case"success":a.success(m);break;case"error":a.error(m);break;case"info":a.info(m);break;case"warning":a.warning(m);break;default:a.info(m)}},[e,t,r,n,d,i,a,s]),$e(mr,{children:o})};ee.config({placement:"topRight",duration:3,zIndex:1e4});var Te=class Te{constructor(){F(this,"currentToast",null);F(this,"api",null);F(this,"isInitialized",!1);F(this,"pendingToast",null)}static getInstance(){return Te.instance||(Te.instance=new Te),Te.instance}init(t){if(this.api=t,this.isInitialized=!0,this.pendingToast){let r=this.pendingToast;this.pendingToast=null,this.show(r)}}show(t){let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t;if(!this.isInitialized||!this.api){this.pendingToast=t;return}this.currentToast?.timer&&clearTimeout(this.currentToast.timer),this.currentToast&&this.currentToast.key===r?(ee.destroy(r),this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i})):(this.currentToast&&ee.destroy(this.currentToast.key),this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}))}createNotification(t){if(!this.api)return;let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t,l={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];l({key:r,message:d,description:s,duration:a,placement:o||"topRight",icon:St[n],onClose:()=>{this.currentToast?.key===r&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),this.currentToast=null),i?.()}}),this.currentToast={key:r,type:n,message:d,descs:s,duration:a,placement:o,timer:null}}close(){this.currentToast&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),ee.destroy(this.currentToast.key),this.currentToast=null)}destroy(){this.close(),ee.destroy()}};F(Te,"instance");var xt=Te,jn=xt.getInstance();function lt(e){return typeof e=="string"?{message:e,duration:3}:e}function qe(e){return St[e]}var Mn={success:e=>{if(!e)return;let t=lt(e);ee.success({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("success"),onClose:t.onClose})},error:e=>{if(!e)return;let t=lt(e);ee.error({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("error"),onClose:t.onClose})},info:e=>{if(!e)return;let t=lt(e);ee.info({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("info"),onClose:t.onClose})},warning:e=>{if(!e)return;let t=lt(e);ee.warning({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("warning"),onClose:t.onClose})},custom:(e,t)=>{let{message:r,descs:n,duration:d,placement:s,onClose:a}=t;ee[e]({message:r,description:n,duration:d,placement:s,icon:qe(e),onClose:a})}},Ei=({children:e})=>{let[t,r]=ee.useNotification(),n=Un(!1);return dr(()=>{n.current||(jn.init(t),n.current=!0)},[t]),Fn(mr,{children:[r,e]})},K=Mn;import{notification as Ce}from"antd";import{CheckCircleOutlined as Bn,CloseCircleOutlined as Ln,InfoCircleOutlined as zn,WarningOutlined as Hn}from"@ant-design/icons";import{Fragment as Vn,jsx as Ge}from"react/jsx-runtime";var Wn={success:Ge(Bn,{style:{color:"#52c41a"}}),error:Ge(Ln,{style:{color:"#ff4d4f"}}),info:Ge(zn,{style:{color:"#1890ff"}}),warning:Ge(Hn,{style:{color:"#faad14"}})},_t=class{constructor(){F(this,"currentToast",null);F(this,"suppressedCloseKeys",new Set)}destroySilently(t){this.suppressedCloseKeys.add(t),Ce.destroy(t)}show(t){let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t;this.currentToast&&this.currentToast.key===r?this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}):(this.currentToast&&this.destroySilently(this.currentToast.key),this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}))}createNotification(t){let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t;this.suppressedCloseKeys.delete(r);let l={success:Ce.success,error:Ce.error,info:Ce.info,warning:Ce.warning}[n];l({key:r,message:d,description:s,duration:a,placement:o||"topRight",icon:Wn[n],onClose:()=>{if(this.suppressedCloseKeys.has(r)){this.suppressedCloseKeys.delete(r),this.currentToast?.key===r&&(this.currentToast=null);return}this.currentToast?.key===r&&(this.currentToast=null),i?.()}}),this.currentToast={key:r,type:n,message:d,descs:s,duration:a,placement:o}}close(t){if(!this.currentToast){t&&Ce.destroy(t);return}let r=t||this.currentToast.key;if(r!==this.currentToast.key){Ce.destroy(t);return}this.destroySilently(r),this.currentToast=null}destroy(){this.currentToast&&(this.destroySilently(this.currentToast.key),this.currentToast=null),Ce.destroy()}},Pe=new _t,Bi={success:(e,t=3)=>{let r=Xe("success",e,t);Pe.show(r)},error:(e,t=3)=>{let r=Xe("error",e,t);Pe.show(r)},info:(e,t=3)=>{let r=Xe("info",e,t);Pe.show(r)},warning:(e,t=3)=>{let r=Xe("warning",e,t);Pe.show(r)},custom:(e,t,r=3)=>{let n=Xe(e,t,r);Pe.show(n)},close:e=>{Pe.close(e)},destroy:()=>{Pe.destroy()}};function Xe(e,t,r){let n=typeof t=="object"&&t!==null?t:{message:t};return{key:n.key||`singleton-${e}`,type:e,message:n.message,descs:n.descs,duration:n.duration??r,placement:n.placement,onClose:n.onClose}}var Li=({children:e})=>Ge(Vn,{children:e});import{Button as qn}from"antd";import{TableOutlined as $n,AppstoreOutlined as Xn}from"@ant-design/icons";import{jsx as Ue}from"react/jsx-runtime";function Gn({className:e="",viewMode:t,onToggle:r,options:n=[]}){return Ue("div",{className:`flex justify-end ${e}`,children:Ue("div",{className:"bg-gray-100 rounded-button p-1 flex",children:n.map((d,s)=>Ue(qn,{type:t===d.value?"primary":"text",icon:d.icon,onClick:()=>r(d.value),className:`${s<n.length-1?"mr-1":""} rounded-button`,size:"small",title:d.tooltip},d.value))})})}function $i({viewMode:e,onToggle:t,className:r=""}){return Ue(Gn,{viewMode:e,onToggle:t,className:r,options:[{value:"table",icon:Ue($n,{}),tooltip:"\u8868\u683C\u89C6\u56FE"},{value:"grid",icon:Ue(Xn,{}),tooltip:"\u7F51\u683C\u89C6\u56FE"}]})}import{useMemo as ur,useState as kt}from"react";import{Table as Jn}from"antd";import{jsx as Nt,jsxs as ts}from"react/jsx-runtime";var Kn=Jn,Qn=60,pr=9,Yn={position:"absolute",top:0,bottom:0,right:-(pr/2),width:pr,zIndex:2,cursor:"col-resize",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none"},Zn={width:1,height:"60%",background:"transparent"},es=({onResizeStart:e,style:t,children:r,...n})=>{let[d,s]=kt(!1),[a,o]=kt(!1),i=l=>{if(!e)return;let m=l.currentTarget.closest("th"),C=m?m.getBoundingClientRect().width:0;o(!0);let b=()=>o(!1);document.addEventListener("mouseup",b,{once:!0}),e(l,C)};return ts("th",{style:{...t,position:"relative"},...n,children:[r,e&&Nt("span",{style:Yn,onMouseDown:i,onClick:l=>l.stopPropagation(),onDoubleClick:l=>l.stopPropagation(),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:Nt("span",{style:{...Zn,background:d||a?"#1677ff":"transparent"}})})]})},gr=(e,t)=>{let r=e.key;if(typeof r=="string"||typeof r=="number")return String(r);let n=e.dataIndex;return Array.isArray(n)?n.join("."):typeof n=="string"||typeof n=="number"?String(n):`col-${t}`};function Yi(e){let{columns:t,components:r,tableLayout:n,...d}=e,[s,a]=kt({}),o=(m,C)=>(b,w)=>{if(b.preventDefault(),b.stopPropagation(),Object.keys(s).length===0&&t){let O=b.currentTarget.closest("th"),N=O?.parentElement,I=N?Array.from(N.children):[],R=O&&I.length>0?I.indexOf(O)-m:0,T={};t.forEach((D,j)=>{let x=I[j+R];x&&(T[gr(D,j)]=Math.round(x.getBoundingClientRect().width))}),Object.keys(T).length>0&&a(D=>({...T,...D}))}let _=b.clientX,A=O=>{let N=Math.max(Qn,Math.round(w+O.clientX-_));a(I=>I[C]===N?I:{...I,[C]:N})},P=()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",P),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",A),document.addEventListener("mouseup",P),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},i=ur(()=>t&&t.map((m,C)=>{if("children"in m&&m.children)return m;let b=gr(m,C),w=s[b]??m.width;return{...m,width:w,onHeaderCell:_=>({...m.onHeaderCell?.(_)??{},onResizeStart:o(C,b)})}}),[t,s]),l=ur(()=>({...r,header:{...r?.header??{},cell:es}}),[r]);return Nt(Kn,{...d,columns:i,components:l,tableLayout:Object.keys(s).length>0?"fixed":n})}import Ie from"react";import{Timeline as xs,Avatar as wr,Button as gt,Dropdown as Ss,DatePicker as _s}from"antd";var Je=e=>!e||(typeof e=="string"&&(e=new Date(e)),e.getTime()==0)||isNaN(e.getTime())?"\u65E0":e.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"numeric",hour:"2-digit",minute:"2-digit"});import{Modal as Tr,Form as _e,Input as Pr}from"antd";import{EllipsisOutlined as ks,EditOutlined as Ns,DeleteOutlined as Us,CommentOutlined as Ds}from"@ant-design/icons";import{useEffect as rs,useRef as fr}from"react";import{jsx as De,jsxs as ct}from"react/jsx-runtime";function yr(){return ct("div",{className:"ant-empty ant-empty-normal justify-self-center text-muted py-4",children:[De("div",{className:"ant-empty-image",children:ct("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[De("title",{children:" \u65E0\u6570\u636E "}),ct("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[De("ellipse",{fill:"rgb(var(--color-muted) / 0.12)",cx:"32",cy:"33",rx:"32",ry:"7"}),ct("g",{fillRule:"nonzero",stroke:"rgb(var(--color-border))",children:[De("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"}),De("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))"})]})]})]})}),De("div",{className:"ant-empty-description justify-self-center text-sm font-thin text-muted",children:" \u65E0\u6570\u636E "})]})}function hr(e,t,r=768){let n=fr(e),d=fr(t);n.current=e,d.current=t,rs(()=>{let s=window.innerWidth<=r,a=()=>{let o=window.innerWidth<=r;o!==s&&(s=o,o?n.current():d.current())};return s?n.current():d.current(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[r])}import xr from"dayjs";import*as At from"febs-browser";import Cr from"dexie";var Ut={};bt(Ut,{AuthorizationHandler:()=>pe,HttpRequest:()=>c,ResponseCode:()=>ut});import ns,{AxiosError as ss}from"axios";import*as mt from"febs-browser";import*as Ke from"febs-browser";import br from"store2";var dt=class{constructor(t){F(this,"s");this.s=t}get length(){return this.s.size()}keys(){return this.s.keys()}set(t,r){return r?(r=JSON.stringify(r),r=Ke.crypt.base64_encode(r),this.s.set(t,r,!0),this):this.remove(t)}get(t,r=null){if(!this.s.has(t))return r;let n=this.s.get(t);if(n){n=Ke.crypt.base64_decode(n),n=Ke.string.bytesToUtf8(n||[]);try{return JSON.parse(n)}catch{return this.remove(t),null}}return n}remove(t){return this.s.remove(t),this}clear(){return this.s.clearAll(),this}},te={namespace:function(e){return new dt(br.namespace(e||"default"))},namespace_session:function(e){return new dt(br.session.namespace(e||"default"))}};var ut=(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))(ut||{});function os(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 Ee=ns.create({baseURL:import.meta.env.VITE_API_BASE,timeout:Number(import.meta.env.VITE_API_TIMEOUT)||5e3,headers:{"Content-Type":"application/json;charset=UTF-8"},withCredentials:!0}),$=class ${static clearStoreToken(){this.setStoreToken(null,0)}static getStoreToken(){let t=te.namespace("bp.ss").get("ss");if(t){let r=te.namespace("bp.ss").get("exp");return{token:JSON.parse(t),exp:r?JSON.parse(r):0}}return null}static getValidStoreToken(){let t=$.getStoreToken();return t&&t.exp>Date.now()-$.TOKEN_EXP?t.token:null}static setStoreToken(t,r){t?(te.namespace("bp.ss").set("ss",JSON.stringify(t)),te.namespace("bp.ss").set("exp",JSON.stringify(r))):te.namespace("bp.ss").clear()}static requestHandleSid(t){let r=$.getStoreToken();r&&r.exp>Date.now()-$.TOKEN_EXP&&t.headers.set($.HEADER_NAME,$.HEADER_PREFIX+r.token)}static responseHandleSid(t){let r=t.headers.get($.HEADER_NAME);if(r&&r.startsWith($.HEADER_PREFIX.trim())){r=r.replace($.HEADER_PREFIX,"");let n=r;if(r=r.split(".")[1],r&&(r=mt.string.bytesToUtf8(mt.crypt.base64_decode(r)),r)){let d=JSON.parse(r);return d.exp<Date.now()-$.TOKEN_EXP?($.clearStoreToken(),!1):($.setStoreToken(n,d.exp),!0)}$.clearStoreToken(),typeof navigator<"u"&&navigator.onLine&&(window.location.href="/")}return!1}};F($,"HEADER_NAME","Authorization"),F($,"HEADER_PREFIX","SPBearer "),F($,"TOKEN_EXP",20*1e3);var pe=$;Ee.interceptors.request.use(e=>(Ve.show({delay:5e3}),pe.requestHandleSid(e),e),e=>(Ve.hide(),console.log("Request Error =========="),Promise.reject(e)));Ee.interceptors.response.use(e=>(Ve.hide(),e.data.code!==200&&K.warning(e.data.message||os(e.data.code)),pe.responseHandleSid(e),e.data),e=>(Ve.hide(),e instanceof ss&&(e.code==="ERR_NETWORK"||e.code==="ECONNABORTED"?K.error("\u7F51\u7EDC\u9519\u8BEF"):e.code==="ERR_BAD_RESPONSE"&&K.error("\u670D\u52A1\u5668\u65E0\u54CD\u5E94")),console.log("Response Error =========="),Promise.reject(e)));var c={get(e,t,r){return Ee({method:"get",url:e,params:t,data:r})},post(e,t,r){return Ee({method:"post",url:e,params:t,data:r})},put(e,t,r){return Ee({method:"put",url:e,params:t,data:r})},delete(e,t,r){return Ee({method:"delete",url:e,params:t,data:r})}};var Dt={};bt(Dt,{admin:()=>is,gateway:()=>as,message:()=>ls,role:()=>cs,user:()=>ds});var is={registerAdmin:e=>c.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=>c.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=>c.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=>c.get("/api/admin/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)},as={register:e=>c.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=>c.post("/api/sendSms",{phone:e.phone,imageCode:e.imageCode},null).then(t=>t),isLogin:()=>c.get("/api/isLogin",null,null).then(e=>e),login:e=>c.post("/api/login",null,{phone:e.phone,pwd:e.pwd,pwdSN:e.pwdSN,smsCode:e.smsCode}).then(t=>t),verifyPasswordHash:e=>c.post("/api/verifyPasswordHash",null,{passwordHash:e.passwordHash,passwordSalt:e.passwordSalt}).then(t=>t),logout:()=>c.get("/api/logout",null,null).then(e=>e),listPermissions:()=>c.get("/api/listPermissions",null,null).then(e=>e),listRolePermissions:e=>c.get("/api/listRolePermissions",{id:e.id},null).then(t=>t)},ls={list:e=>c.get("/api/user/message/list",{pageNum:e.pageNum,pageSize:e.pageSize,unread_only:e.unread_only},null).then(t=>t),countUnread:()=>c.get("/api/user/message/unread/count",null,null).then(e=>e),markRead:e=>c.post("/api/user/message/read",null,{messageIds:e.messageIds}).then(t=>t),clearReaded:e=>c.delete("/api/user/message/clearReaded",null,{messageIds:e.messageIds}).then(t=>t)},cs={listRoles:()=>c.get("/api/role/listRoles",null,null).then(e=>e),createRole:e=>c.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=>c.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=>c.post("/api/role/assignPermissionsToRole",null,{role_id:e.role_id,permissions:e.permissions}).then(t=>t),assignRoleToUserPermission:()=>c.post("/api/role/assignRoleToUserPermission",null,null).then(e=>e),assignRoleToUser:e=>c.post("/api/role/assignRoleToUser",null,{user_id:e.user_id,role_ids:e.role_ids}).then(t=>t),listUserRoles:e=>c.get("/api/role/listUserRoles",{user_id:e.user_id},null).then(t=>t),listUserPermissions:e=>c.get("/api/role/listUserPermissions",{user_id:e.user_id},null).then(t=>t),listCompanies:()=>c.get("/api/role/listCompanies",null,null).then(e=>e),createCompany:e=>c.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=>c.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:()=>c.get("/api/role/listDepartments",null,null).then(e=>e),createDepartment:e=>c.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=>c.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=>c.post("/api/role/assignUserToDepartment",{user_id:e.user_id,department_id:e.department_id,position:e.position},null).then(t=>t),removeUserFromDepartment:e=>c.post("/api/role/removeUserFromDepartment",{user_id:e.user_id,department_id:e.department_id},null).then(t=>t),listCompanyDepartments:e=>c.get("/api/role/listCompanyDepartments",{company_id:e.company_id},null).then(t=>t),listUserDepartments:e=>c.get("/api/role/listUserDepartments",{user_id:e.user_id},null).then(t=>t),listDepartmentUsers:e=>c.get("/api/role/listDepartmentUsers",{department_id:e.department_id},null).then(t=>t)},ds={getInfoByUsername:e=>c.get("/api/user/infoByUsername",{username:e.username},null).then(t=>t),getInfo:e=>c.get("/api/user/info",{id:e.id},null).then(t=>t),getAvatar:e=>c.get("/api/user/avatar",{id:e.id,tick:e.tick},null).then(t=>t),getAvatarList:e=>c.get("/api/user/avatar_list",{ids:e.ids},null).then(t=>t),updateAvatar:e=>c.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=>c.post("/api/user/updateManager",{id:e.id,managerid:e.managerid},null).then(t=>t),updateInfo:e=>c.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=>c.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=>c.post("/api/user/delete",{id:e.id},null).then(t=>t),list:e=>c.get("/api/user/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),listByIds:e=>c.get("/api/user/list_by_ids",{ids:e.ids},null).then(t=>t),search:e=>c.get("/api/user/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),forbid:e=>c.post("/api/user/forbid",{id:e.id,forbid:e.forbid},null).then(t=>t)};var Et={};bt(Et,{contract:()=>ms,file:()=>us,fileversion:()=>ps,project:()=>gs,projectprogress:()=>fs});var ms={createContract:e=>c.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=>c.delete("/api/project/contract/delete",{id:e.id},null).then(t=>t),updateContract:e=>c.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=>c.get("/api/project/contract/detail",{id:e.id},null).then(t=>t),getContractList:e=>c.get("/api/project/contract/list",{projectId:e.projectId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),submitApproval:e=>c.post("/api/project/contract/submit",{id:e.id,sealType:e.sealType},null).then(t=>t),cancelApproval:e=>c.post("/api/project/contract/cancelApproval",{id:e.id},null).then(t=>t),uploadVersion:e=>c.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=>c.get("/api/project/contract/version/list",{contractId:e.contractId},null).then(t=>t),deleteVersion:e=>c.delete("/api/project/contract/version/delete",{id:e.id},null).then(t=>t),renameVersion:e=>c.post("/api/project/contract/version/rename",null,{id:e.id,fileName:e.fileName}).then(t=>t),getVersionDetail:e=>c.get("/api/project/contract/version/detail",{id:e.id},null).then(t=>t),setVersionLayerOpinion:e=>c.post("/api/project/contract/version/layerOpinion",null,{contractId:e.contractId,version:e.version,opinion:e.opinion}).then(t=>t),getNewContractCode:e=>c.get("/api/project/contract/newCode",{contractCode:e.contractCode,sequenceLength:e.sequenceLength},null).then(t=>t),getContractHistoryParties:()=>c.get("/api/project/contract/historyParties",null,null).then(e=>e)},us={getDetail:e=>c.get("/api/project/files/detail",{fileId:e.fileId},null).then(t=>t),listFiles:e=>c.get("/api/project/files/list",{projectId:e.projectId},null).then(t=>t),searchFiles:e=>c.get("/api/project/files/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),addFile:(e,t)=>c.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=>c.post("/api/project/files/remove",{fileId:e.fileId},null).then(t=>t),moveFile:(e,t)=>c.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=>c.post("/api/project/files/updateDescs",null,{fileId:e.fileId,descs:e.descs}).then(t=>t),copyFileToProject:e=>c.post("/api/project/files/copyToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),moveFileToProject:e=>c.post("/api/project/files/moveToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),updateFileDelta:e=>c.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=>c.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=>c.post("/api/project/files/generateTempAccessToken",{fileId:e.fileId,expireSeconds:e.expireSeconds},null).then(t=>t),folderDownload:(e,t)=>c.post("/api/project/files/folderDownload",{projectId:e.projectId},{folderPath:t.folderPath,folderName:t.folderName}).then(r=>r),folderDownloadStatus:e=>c.get("/api/project/files/folderDownloadStatus",{jobId:e.jobId},null).then(t=>t),listFilesByTempAccessToken:e=>c.get("/api/project/files/listByTempAccessToken",{tempToken:e.tempToken},null).then(t=>t)},ps={listVersions:e=>c.get("/api/project/files/version/list",{fileId:e.fileId},null).then(t=>t),getVersionDetail:e=>c.get("/api/project/files/version/detail",{versionId:e.versionId},null).then(t=>t)},gs={enableUserPrivateProject:()=>c.post("/api/project/enablePrivateProject",null,null).then(e=>e),createProject:e=>c.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=>c.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=>c.post("/api/project/updateUserdataOrder",null,{projectIds:e.projectIds}).then(t=>t),getUserdataOrder:()=>c.get("/api/project/userdataOrder",null,null).then(e=>e),getProjectDetail:e=>c.get("/api/project/detail",{id:e.id},null).then(t=>t),getProjectName:e=>c.get("/api/project/name",{projectId:e.projectId},null).then(t=>t),listProjects:e=>c.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=>c.get("/api/project/listByManager",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),changeStatus:e=>c.put("/api/project/status",{id:e.id,status:e.status},null).then(t=>t),getProjectMembers:e=>c.get("/api/project/members",{projectId:e.projectId},null).then(t=>t),getMemberRole:e=>c.get("/api/project/member/role",{projectId:e.projectId,userId:e.userId},null).then(t=>t),assignMember:e=>c.post("/api/project/members/assign",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t),removeMember:e=>c.post("/api/project/members/remove",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t)},fs={createProgress:e=>c.post("/api/project/progress/create",null,{projectId:e.projectId,descs:e.descs,commentCount:e.commentCount,progressTime:e.progressTime}).then(t=>t),updateProgress:e=>c.put("/api/project/progress/update",null,{id:e.id,descs:e.descs,progressTime:e.progressTime}).then(t=>t),deleteProgress:e=>c.delete("/api/project/progress/delete",{id:e.id},null).then(t=>t),getProgressList:e=>c.get("/api/project/progress/list",{projectId:e.projectId},null).then(t=>t),addComment:e=>c.post("/api/project/progress/comment/add",null,{progressId:e.progressId,comment:e.comment}).then(t=>t),deleteComment:e=>c.delete("/api/project/progress/comment/delete",{id:e.id},null).then(t=>t),updateComment:e=>c.put("/api/project/progress/comment/update",{id:e.id},{}).then(t=>t),getCommentList:e=>c.get("/api/project/progress/comment/list",{progressId:e.progressId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)};var ne={base:Ut,user:Dt,project:Et};var Se=1440*60*1e3,Ot=class extends Cr{constructor(){super("UserInfoDB");F(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},jt=class extends Cr{constructor(){super("UserAvatarDB");F(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},ce=new Ot,de=new jt,Ir=async e=>{try{let t=await de.userCache.get(e);if(t){if(Date.now()-t.timestamp<Se)return t.avatar;await de.userCache.delete(e)}return null}catch(t){return console.error("\u8BFB\u53D6\u7528\u6237\u5934\u50CF\u7F13\u5B58\u5931\u8D25:",t),null}},Mt=async e=>{try{let t=await ce.userCache.get(e);if(t){let r=Date.now(),n=await de.userCache.get(e);if(n?r-n.timestamp<Se?t.data.avatar=n.avatar:(t.data.avatar=void 0,await de.userCache.delete(e)):t.data.avatar=void 0,r-t.timestamp<Se)return t.data;await ce.userCache.delete(e)}return null}catch(t){return console.error("\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",t),null}},ys=async(e,t)=>{try{t&&await de.userCache.put({id:e,avatar:t,timestamp:Date.now()})}catch(r){console.error("\u5199\u5165\u7528\u6237\u5934\u50CF\u7F13\u5B58\u5931\u8D25:",r)}},hs=async(e,t)=>{try{t.avatar&&await de.userCache.put({id:e,avatar:t.avatar,timestamp:Date.now()});let r=t.avatar;t.avatar=void 0,await ce.userCache.put({id:e,data:t,timestamp:Date.now()}),t.avatar=r}catch(r){console.error("\u5199\u5165\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}},bs=async e=>{let t=new Map;try{let r=await ce.userCache.bulkGet(e),n=Date.now();for(let s=0;s<e.length;s++){let a=r[s];a&&n-a.timestamp<Se&&t.set(e[s],a.data)}let d=await de.userCache.bulkGet(e);for(let s=0;s<e.length;s++){let a=d[s];if(!a)continue;let o=t.get(a.id);o&&n-a.timestamp<Se&&(o.avatar=a.avatar)}}catch(r){console.error("\u6279\u91CF\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}return t},vr=async e=>{try{let t=e.map(n=>({id:n.id,data:n.data,timestamp:Date.now()})),r=e.map(n=>({id:n.id,avatar:n.data.avatar,timestamp:Date.now()}));r=r.filter(n=>n.avatar),await de.userCache.bulkPut(r),t.forEach(n=>{n.data.avatar=void 0}),await ce.userCache.bulkPut(t)}catch(t){console.error("\u6279\u91CF\u5199\u5165\u7528\u6237\u7F13\u5B58\u5931\u8D25:",t)}},vs=async()=>{let e=new Map;try{let t=Date.now(),r=await ce.userCache.toArray();for(let n of r)if(t-n.timestamp<Se){let d=await de.userCache.get(n.id);d&&t-d.timestamp<Se&&(n.data.avatar=d.avatar),e.set(n.id,n.data)}else await ce.userCache.delete(n.id)}catch(t){console.error("\u83B7\u53D6\u6240\u6709\u7F13\u5B58\u5931\u8D25:",t)}return e},Cs=async()=>{try{await ce.userCache.clear(),await de.userCache.clear()}catch(e){console.error("\u6E05\u9664\u7528\u6237\u7F13\u5B58\u5931\u8D25:",e)}},Rr=async({user_id:e,forceRefresh:t=!1,forceAvatar:r=!1})=>{let n={code:200,data:{user_id:e,isLogin:!0}},d=!1;if(!e)try{n=await ne.user.gateway.isLogin()}catch{d=!0}if(d){let s;try{let o=te.namespace("bp.ss").get("user");o&&(s=JSON.parse(o)?.id)}catch{}let a=e??s;if(a){let o=await Mt(a);if(o){let i=await xe({user_id:a,forceRefresh:!1,serverTick:o.tick_avatar_self});return i&&(o.avatar=i),o}}try{let o=te.namespace("bp.ss").get("user");if(o)return JSON.parse(o)}catch{}return null}if(n?.code===200&&n.data?.isLogin){let s=n.data?.user_id,a=n.data?.isAdmin||!1,o=await Mt(s);if(t||!o)try{let i=await ne.user.user.getInfo({id:s});if(i?.code==200){e||te.namespace("bp.ss").set("user",JSON.stringify(i.data));let l={...i.data};s&&await hs(s,l);try{let m=await xe({user_id:s,forceRefresh:r,serverTick:i.data?.tick_avatar_self});m&&(l.avatar=m)}catch{}return l}else return o||null}catch{if(o)return o;try{let l=te.namespace("bp.ss").get("user");if(l)return JSON.parse(l)}catch{}return null}try{let i=await xe({user_id:s,forceRefresh:r,serverTick:o.tick_avatar_self});i&&(o.avatar=i)}catch{}return o}else return pe.clearStoreToken(),null},xe=async({user_id:e,forceRefresh:t=!1,serverTick:r=Number.MAX_SAFE_INTEGER})=>{if(!e)return;let n=await Ir(e);if(t||!n){let d=n?.avatar_tick||-1;if(d<r)try{let s=await ne.user.user.getAvatar({id:e,tick:d});s?.code==200&&d!=s.data?.tick_self&&(n={avatar:At.string.isEmpty(s.data?.avatar)?void 0:s.data?.avatar,avatar_small:At.string.isEmpty(s.data?.avatar_small)?void 0:s.data?.avatar_small,avatar_tick:s.data?.tick_self||-1},await ys(e,n))}catch{}}return n||void 0},Is=async e=>(e=e||{forceRefresh:!1},await Rr(e)),Rs=()=>{let e=te.namespace("bp.ss").get("user");return e?JSON.parse(e):null},ws=async({userIds:e,keywords:t,forceRefresh:r=!1})=>{let n=new Map;if(!e){if(!r&&(!t||t.length===0)){let l=await vs();if(l.size>=100){let m=new Map,C=0;for(let[b,w]of l){if(C>=100)break;let _=await xe({user_id:b,forceRefresh:!1,serverTick:w.tick_avatar_self});w.avatar=_,m.set(b,w),C++}return m}return l}let a;if(t&&t.length>0){if(a=await ne.user.user.search({pageNum:1,pageSize:100,keyword:t}),a?.code!==200)return n}else if(a=await ne.user.user.list({pageNum:1,pageSize:100}),a?.code!==200)return n;let o=a.data?.list||[],i=[];for(let l of o){let m={...l};n.set(l.id,m),i.push({id:l.id,data:m})}i.length>0&&await vr(i);for(let l=0;l<i.length;l++){let m=await xe({user_id:i[l].id,serverTick:i[l].data.tick_avatar_self});i[l].data.avatar=m}return n}if(e.length==0)return n;let d=[...new Set(e)];r||(await bs(d)).forEach((o,i)=>{n.set(i,o)});let s=d.filter(a=>!n.has(a));if(s.length===0)return n;try{let a=await ne.user.user.listByIds({ids:JSON.stringify(s)});if(a?.code!=200)return n;let o=a.data?.list||[];if(o.length>0){let l=[];for(let m of o){let C={...m};l.push({id:m.id,data:C})}await vr(l)}let i=[];if(o.length>0)for(let l of o){let m=await xe({user_id:l.id,serverTick:l.tick_avatar_self||-1});i.push({id:l.id,avatar_small:m?.avatar_small||"",avatar_tick:l.tick_avatar_self||-1})}for(let l of o){let m=i.find(b=>b.id==l.id),C={...l,avatar:{avatar:"",avatar_small:m?.avatar_small||"",avatar_tick:m?.avatar_tick||-1}};n.set(l.id,C)}}catch(a){console.error("\u6279\u91CF\u83B7\u53D6\u7528\u6237\u4FE1\u606F\u5931\u8D25:",a)}return n},Ts=async e=>{e?await ce.userCache.delete(e):await Cs()},Ps=async()=>{try{let e=await ce.userCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},pt={getFromCache:Mt,getAvatarFromCache:Ir,getUserInfo:Rr,getUserAvatar:xe,current:Is,currentLocalUser:Rs,getUserInfos:ws,clearUserCache:Ts,getCacheStats:Ps};import{Fragment as Ft,jsx as U,jsxs as se}from"react/jsx-runtime";var Ba=({commentList:e,showTitle:t,showTimePicker:r,onDeleteComment:n,onLoadSubComments:d,commentListMap:s,onSaveComment:a,onSaveSubComment:o})=>{let[i,l]=Ie.useState(window.innerWidth<768),[m,C]=Ie.useState(new Map),[b,w]=Ie.useState(!1),[_,A]=Ie.useState(null),[P]=_e.useForm(),[O,N]=Ie.useState(!1),[I,R]=Ie.useState(null),[T]=_e.useForm(),D=Ie.useMemo(()=>{let v=new Set;return e.forEach(S=>{S.createBy&&v.add(S.createBy),s[S.id]?.comments.forEach(G=>{G.createBy&&v.add(G.createBy)})}),Array.from(v)},[e,s]);Ie.useEffect(()=>{if(D.length===0)return;let v=!0;return pt.getUserInfos({userIds:D}).then(S=>{v&&C(G=>new Map([...G,...S]))}).catch(S=>{console.error("\u52A0\u8F7D\u8BC4\u8BBA\u7528\u6237\u4FE1\u606F\u5931\u8D25:",S)}),()=>{v=!1}},[D]),hr(()=>{l(!0)},()=>{l(!1)},768);let j=async v=>{A(v),P.resetFields(),w(!0)},x=v=>{v?(R(v),T.setFieldsValue({descs:v.descs,progressTime2:xr(v.progressTime)})):(R(null),T.resetFields(),T.setFieldsValue({progressTime2:xr()})),N(!0)},B=async()=>{try{if(!_)return;let v=await P.validateFields();if(!v)return;await o?.({commentId:_.id,comment:v.comment})&&(K.success("\u56DE\u590D\u5DF2\u63D0\u4EA4"),w(!1),d?.(_.id))}catch(v){console.error(v),K.error("\u63D0\u4EA4\u56DE\u590D\u5931\u8D25")}},W=async()=>{try{let v=await T.validateFields();I?(await a?.({commentItem:I,comment:v.descs,time:v.progressTime2.toDate()}),K.success("\u66F4\u65B0\u6210\u529F")):(await a?.({commentItem:null,comment:v.descs,time:v.progressTime2.toDate()}),K.success("\u65B0\u589E\u6210\u529F")),N(!1),R(null)}catch(v){console.error(v),K.error("\u4FDD\u5B58\u5931\u8D25")}};return se(Ft,{children:[U("div",{className:"flex justify-end items-center mb-5 ml-4",children:U(gt,{type:"primary",onClick:()=>x(),className:"px-4 py-2 btn-primary flex items-center",children:"\u65B0\u589E"})}),e.length?U(xs,{mode:"left",className:"ml-5 md:pr-[200px]",items:e.map(v=>({key:v.id,color:"blue",label:i&&t?null:Je(new Date(v.progressTime)),style:{paddingBottom:"5px"},children:se(Ft,{children:[i&&t&&U("div",{className:"mt-2 mb-1 font-bold",children:Je(new Date(v.progressTime))}),se("div",{className:"rounded border border-gray-100 bg-gray-50 p-2",children:[se("div",{className:"flex justify-between items-start mb-2 ",children:[se("div",{className:"flex items-center space-x-2",children:[U(wr,{src:m.get(v.createBy)?.avatar?.avatar_small||null,size:40,children:m.get(v.createBy)?.nickname?.[0]}),se("div",{children:[U("div",{className:"",children:m.get(v.createBy)?.nickname}),U("div",{className:"text-xs font-thin",children:Je(new Date(v.updateTime))})]})]}),U("div",{className:"mt-4 flex justify-end absolute right-1 top-1",children:U(Ss,{menu:{items:[{key:"edit",icon:U(Ns,{}),label:"\u7F16\u8F91",onClick:S=>{x?.(v),S.domEvent.stopPropagation()}},{key:"delete",icon:U(Us,{}),label:"\u5220\u9664",danger:!0,onClick:S=>{n?.(v.id),S.domEvent.stopPropagation()}}]},trigger:["click"],children:U(gt,{type:"text",icon:U(ks,{}),onClick:S=>S.stopPropagation()})})})]}),U("div",{className:"whitespace-pre-wrap ml-2",style:{whiteSpace:"pre-wrap"},children:v.descs}),se("div",{className:"flex items-center space-x-1 mt-1",children:[U(gt,{type:"text",icon:U(Ds,{}),className:"font-thin text-xs",size:"small",style:{color:"#666"},onClick:()=>j(v),children:"\u56DE\u590D"}),se(gt,{type:"text",size:"small",style:{color:"#666"},className:"font-thin text-xs",onClick:()=>d?.(v.id),children:[s[v.id]&&s[v.id].expanded?"\u6536\u8D77":"\u5C55\u5F00"+v.commentCount+"\u6761","\u56DE\u590D"]})]})]}),U("div",{className:"border-l border-gray-200 pl-3",children:s[v.id]&&s[v.id].expanded&&s[v.id].comments.length>0?s[v.id].comments.map(S=>U("div",{className:"p-1 text-sm",children:U("div",{className:"flex items-center space-y-2 mb-1 mt-1",children:se("div",{className:"flex items-center space-x-2",children:[U(wr,{src:m.get(S.createBy)?.avatar?.avatar_small||null,size:40,className:"self-start",children:m.get(S.createBy)?.nickname?.[0]}),se("div",{children:[U("div",{className:"text-gray-600 text-xs",children:m.get(S.createBy)?.nickname}),U("div",{className:"text-gray-700",children:S.comment}),U("div",{className:"text-xs mt-1 font-thin",children:Je(new Date(S.createTime))})]})]})})},S.id)):U(Ft,{})})]})}))}):yr(),U(Tr,{open:b,onCancel:()=>{A(null),w(!1)},className:"ant-modal-nofull",onOk:B,okText:"\u63D0\u4EA4",cancelText:"\u53D6\u6D88",children:U(_e,{form:P,layout:"horizontal",className:"mt-6",children:U(_e.Item,{name:"comment",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56DE\u590D\u5185\u5BB9"}],children:U(Pr.TextArea,{rows:4,placeholder:"\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u590D"})})})}),U(Tr,{title:I?"\u7F16\u8F91":"\u65B0\u589E",open:O,className:"ant-modal-nofull",onCancel:()=>{N(!1),R(null)},onOk:W,okText:"\u4FDD\u5B58",cancelText:"\u53D6\u6D88",children:se(_e,{form:T,layout:"horizontal",children:[r&&U(_e.Item,{name:"progressTime2",label:"\u65F6\u95F4",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u65F6\u95F4"}],children:U(_s,{showTime:!0,style:{width:"100%"}})}),U(_e.Item,{name:"descs",label:"\u5185\u5BB9",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5185\u5BB9"}],children:U(Pr.TextArea,{rows:4,placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9"})})]})})]})};import{useEffect as Qe,useState as Ae,useCallback as Re,useRef as zt,useMemo as Sr}from"react";import{Select as Es,Spin as As,message as Os,Popover as Ht,Card as js,Typography as Ms,Space as Fs}from"antd";import{debounce as Bs}from"lodash-es";import Ls from"react-dom/client";var Bt=class{constructor(){F(this,"cache",new Map);F(this,"defaultExpireTime",300*1e3)}set(t,r,n=this.defaultExpireTime){this.cache.set(t,{data:r,timestamp:Date.now(),expireTime:n})}get(t){let r=this.cache.get(t);return r?Date.now()-r.timestamp>r.expireTime?(this.cache.delete(t),null):r.data:null}clear(){this.cache.clear()}},Lt=new Bt;import{jsx as z,jsxs as _r}from"react/jsx-runtime";var{Text:Za}=Ms,zs=({multiple:e=!1,allowClear:t=!0,timeout:r=1e4,retryCount:n=3,enableCache:d=!0,excludeProjectIds:s=[],cacheExpireTime:a,value:o,onChange:i,...l})=>{let[m,C]=Ae(!1),[b,w]=Ae([]),[_,A]=Ae(""),[P,O]=Ae(1),[N,I]=Ae(!0),[R,T]=Ae([]),D=zt(null),j=zt([]),x=zt([]);Qe(()=>{j.current=b},[b]),Qe(()=>{x.current=R},[R]);let B=Re(p=>p.map(y=>{let h=j.current.find(u=>u.id===y);return h||x.current.find(u=>u.id===y)}).filter(y=>y!==void 0),[]),W=Re(p=>{if(!p){T([]),i?.([],[]);return}let y=e?Array.isArray(p)?p:[p]:typeof p=="string"?[p]:[];if(y.length===0){T([]),i?.([],[]);return}let h=B(y);T(h),i?.(y,h)},[B,i,e]);Qe(()=>{if(!o||o.length==0){T([]);return}let p=e?Array.isArray(o)?o:[]:typeof o=="string"?[o]:[],y=B(p);T(y)},[o,B,e]);let v=Re(async(p,y=n)=>{try{D.current=new AbortController;let h=D.current.signal,u=new Promise((g,E)=>{setTimeout(()=>{E(new Error("\u8BF7\u6C42\u8D85\u65F6")),D.current?.abort()},r)});return await Promise.race([p(),u])}catch(h){if(y>0&&!(h instanceof Error&&h.name==="AbortError"))return await new Promise(u=>setTimeout(u,1e3)),v(p,y-1);throw h}},[r,n]),S=Re(async(p,y=!1)=>{try{C(!0);let h=`projects_${p}`;if(d&&!p){let f=Lt.get(h);if(f){w(g=>y?[...g,...f]:f),I(!1);return}}let u=await v(async()=>{let f=await ne.project.project.listProjects({pageNum:P,pageSize:1e3});return f.code===200&&f.data?{...f,data:f.data.list.map(g=>({id:g.id,name:g.name,descs:g.descs}))}:f});if(u.code===200&&u.data){let f=u.data.filter(g=>!s.includes(g.id));d&&!p&&Lt.set(h,f,a),w(g=>y?[...g,...f]:f),I(!1)}}catch(h){console.error("\u83B7\u53D6\u9879\u76EE\u5217\u8868\u5931\u8D25:",h),Os.error("\u83B7\u53D6\u9879\u76EE\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{C(!1)}},[s,v,P,d,a]);Qe(()=>()=>{D.current?.abort()},[]);let G=Sr(()=>Bs(p=>{A(p),O(1),S(p,!1)},300),[S]),Q=Re(p=>{let{target:y}=p;if(!y)return;let{scrollTop:h,scrollHeight:u,clientHeight:f}=y;if(u-h<=f*1.5&&!m&&N){let g=P+1;O(g),S(_,!0)}},[m,N,P,_,S]);Qe(()=>{S("",!1)},[S]);let X=p=>z(js,{size:"small",style:{width:280},children:z(Fs,{direction:"vertical",size:"small",style:{width:"100%"},children:z("div",{style:{display:"flex",alignItems:"center",gap:8},children:z("div",{children:z("div",{style:{fontWeight:"bold"},children:p.name})})})})}),fe=p=>{let y=[];return y.push(z("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:p.name},"name")),z("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:y})},ye=Sr(()=>b.map(p=>({key:p.id,label:fe(p),value:p.id,user:p})),[b]),oe=Re(p=>{let{value:y,closable:h,onClose:u}=p,f=b.find(g=>g.id===y)||R.find(g=>g.id===y);return f?z(Ht,{content:X(f),trigger:"click",placement:"right",children:_r("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[z("span",{style:{marginRight:8},children:f.name}),h&&z("span",{onClick:u,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):z("div",{children:y})},[b,R]),he=Re(p=>{let y=b.find(h=>h.id===p)||R.find(h=>h.id===p);return y?z(Ht,{content:X(y),trigger:"click",placement:"right",children:z("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:z("span",{children:y.name})})}):z("div",{children:p})},[b,R]),me=Re(p=>{if(!p)return null;let y=Array.isArray(p)?p[0]:p;return b.find(h=>h.id===y)||R.find(h=>h.id===y)},[b,R]);return z(Es,{...l,mode:e?"multiple":void 0,showSearch:!0,loading:m,filterOption:!1,onSearch:G,onPopupScroll:Q,notFoundContent:m?z(As,{size:"small"}):null,allowClear:t,value:e||typeof o=="string"?o:o?.toString(),onChange:W,options:ye,style:{...l.style,minHeight:"32px"},tagRender:e?oe:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:p=>{let y=me(o);return y?_r("div",{children:[z("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:he(y.id)}),p]}):p},suffixIcon:e?void 0:o?z("div",{onClick:p=>{p.stopPropagation();let y=me(o);if(y){let h=document.createElement("div");document.body.appendChild(h);let u=Ls.createRoot(h);u.render(z(Ht,{content:X(y),trigger:"click",placement:"right",open:!0,onOpenChange:f=>{f||(u.unmount(),document.body.removeChild(h))},children:z("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:z("span",{className:"ant-select-arrow"})}):z("span",{className:"ant-select-arrow"})})},Hs=zs;import{useEffect as Ze,useState as Oe,useCallback as we,useRef as Xt,useMemo as Ur}from"react";import{Select as Zs,Spin as eo,message as to,Popover as Gt,Card as ro,Typography as no,Space as so}from"antd";import{debounce as oo}from"lodash-es";import io from"react-dom/client";import Ws from"dexie";var Vs=3600*1e3,Wt=class extends Ws{constructor(){super("RoleInfoDB");F(this,"roleCache");this.version(1).stores({roleCache:"id, timestamp"})}},Ye=new Wt,qs=async()=>{try{let e=await Ye.roleCache.get("ROLE_ALL");if(e){if(Date.now()-e.timestamp<Vs)return e.data;await Ye.roleCache.delete("ROLE_ALL")}return null}catch(e){return console.error("\u8BFB\u53D6\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e),null}},$s=async e=>{try{await Ye.roleCache.put({id:"ROLE_ALL",data:e,timestamp:Date.now()})}catch(t){console.error("\u5199\u5165\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",t)}},Xs=async()=>{try{await Ye.roleCache.clear()}catch(e){console.error("\u6E05\u9664\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e)}},qt=async({forceRefresh:e=!1})=>{if(!e){let n=await qs();if(n)return n}let t=await ne.user.role.listRoles();if(t?.code!==200)return null;let r=t.data||[];return await $s(r),r},kr=async({roleId:e,forceRefresh:t=!1})=>{let r=await qt({forceRefresh:t});return r&&r.find(n=>n.id===e)||null},Gs=async({roleId:e,forceRefresh:t=!1})=>(await kr({roleId:e,forceRefresh:t}))?.name||"",Vt=async({forceRefresh:e=!1}={})=>{let t=await qt({forceRefresh:e}),r={};return(t||[]).forEach(n=>{r[n.id]=n.name}),r},Js=async({roleIds:e})=>{let t=await Vt();return(e||[]).filter(n=>!!n&&!t[n]).length>0&&(t=await Vt({forceRefresh:!0})),t},Ks=async()=>{await Xs()},Qs=async()=>{try{let e=await Ye.roleCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},Nr={getRoleList:qt,getRoleById:kr,getRoleNameById:Gs,getRoleNameMap:Vt,getRoleNameMapForIds:Js,clearRoleCache:Ks,getCacheStats:Qs};var $t=class{constructor(){F(this,"cache",new Map);F(this,"defaultExpireTime",300*1e3)}set(t,r,n=this.defaultExpireTime){this.cache.set(t,{data:r,timestamp:Date.now(),expireTime:n})}get(t){let r=this.cache.get(t);return r?Date.now()-r.timestamp>r.expireTime?(this.cache.delete(t),null):r.data:null}clear(){this.cache.clear()}},ft=new $t;function Ys(){ft.clear()}import{jsx as H,jsxs as Dr}from"react/jsx-runtime";var{Text:bl}=no,ao=({multiple:e=!1,allowClear:t=!0,timeout:r=1e4,retryCount:n=3,enableCache:d=!0,excludeRoleIds:s=[],cacheExpireTime:a,value:o,onChange:i,...l})=>{let[m,C]=Oe(!1),[b,w]=Oe([]),[_,A]=Oe(""),[P,O]=Oe(1),[N,I]=Oe(!0),[R,T]=Oe([]),D=Xt(null),j=Xt([]),x=Xt([]);Ze(()=>{j.current=b},[b]),Ze(()=>{x.current=R},[R]);let B=we(p=>p.map(y=>{let h=j.current.find(u=>u.id===y);return h||x.current.find(u=>u.id===y)}).filter(y=>y!==void 0),[]),W=we(p=>{if(!p){T([]),i?.([],[]);return}let y=e?Array.isArray(p)?p:[p]:typeof p=="string"?[p]:p;if(y.length===0){T([]),i?.([],[]);return}let h=B(y);T(h),i?.(y,h)},[B,i,e]);Ze(()=>{if(!o||o.length==0){T([]);return}let p=e?Array.isArray(o)?o:[]:typeof o=="string"?[o]:[],y=B(p);if(R.length==y.length){let h=0;for(h=0;h<y.length&&!R.find(u=>u.id==y[h].id?u:null);h++);if(h<y.length)return}T(y)},[o,B,e]);let v=we(async(p,y=n)=>{try{D.current=new AbortController;let h=D.current.signal,u=new Promise((g,E)=>{setTimeout(()=>{E(new Error("\u8BF7\u6C42\u8D85\u65F6")),D.current?.abort()},r)});return await Promise.race([p(),u])}catch(h){if(y>0&&!(h instanceof Error&&h.name==="AbortError"))return await new Promise(u=>setTimeout(u,1e3)),v(p,y-1);throw h}},[r,n]),S=we(async(p,y=!1)=>{try{C(!0);let h=`roles_${p}`;if(d&&!p){let g=ft.get(h);if(g){w(E=>y?[...E,...g]:g),I(!1);return}}let f=(await v(async()=>await Nr.getRoleList({forceRefresh:!0})||[])).filter(g=>!s.includes(g.id));d&&!p&&ft.set(h,f,a),w(g=>y?[...g,...f]:f),I(!1)}catch(h){console.error("\u83B7\u53D6\u89D2\u8272\u5217\u8868\u5931\u8D25:",h),to.error("\u83B7\u53D6\u89D2\u8272\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{C(!1)}},[s,v,d,a]);Ze(()=>()=>{D.current?.abort()},[]);let G=Ur(()=>oo(p=>{A(p),O(1),S(p,!1)},300),[S]),Q=we(p=>{let{target:y}=p;if(!y)return;let{scrollTop:h,scrollHeight:u,clientHeight:f}=y;if(u-h<=f*1.5&&!m&&N){let g=P+1;O(g),S(_,!0)}},[m,N,P,_,S]);Ze(()=>{S("",!1)},[S]);let X=p=>H(ro,{size:"small",style:{width:280},children:H(so,{direction:"vertical",size:"small",style:{width:"100%"},children:H("div",{style:{display:"flex",alignItems:"center",gap:8},children:H("div",{children:H("div",{style:{fontWeight:"bold"},children:p.name})})})})}),fe=p=>{let y=[];return y.push(H("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:p.name},"name")),H("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:y})},ye=Ur(()=>b.map(p=>({label:fe(p),value:p.id,user:p})),[b]),oe=we(p=>{let{value:y,closable:h,onClose:u}=p,f=b.find(g=>g.id===y)||R.find(g=>g.id===y);return f?H(Gt,{content:X(f),trigger:"click",placement:"right",children:Dr("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[H("span",{style:{marginRight:8},children:f.name}),h&&H("span",{onClick:u,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):H("div",{children:y})},[b,R]),he=we(p=>{let y=b.find(h=>h.id===p)||R.find(h=>h.id===p);return y?H(Gt,{content:X(y),trigger:"click",placement:"right",children:H("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:H("span",{children:y.name})})}):H("div",{children:p})},[b,R]),me=we(p=>{if(!p)return null;let y=Array.isArray(p)?p[0]:p;return b.find(h=>h.id===y)||R.find(h=>h.id===y)},[b,R]);return H(Zs,{...l,mode:e?"multiple":void 0,showSearch:!0,loading:m,filterOption:!1,onSearch:G,onPopupScroll:Q,notFoundContent:m?H(eo,{size:"small"}):null,allowClear:t,value:e||typeof o=="string"?o:o?.toString(),onChange:W,options:ye,style:{...l.style,minHeight:"32px"},tagRender:e?oe:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:p=>{let y=me(o);return y?Dr("div",{children:[H("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:he(y.id)}),p]}):p},suffixIcon:e?void 0:o?H("div",{onClick:p=>{p.stopPropagation();let y=me(o);if(y){let h=document.createElement("div");document.body.appendChild(h);let u=io.createRoot(h);u.render(H(Gt,{content:X(y),trigger:"click",placement:"right",open:!0,onOpenChange:f=>{f||(u.unmount(),document.body.removeChild(h))},children:H("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:H("span",{className:"ant-select-arrow"})}):H("span",{className:"ant-select-arrow"})})},lo=ao;import{useEffect as je,useState as Me,useCallback as ke,useRef as Jt,useMemo as Kt}from"react";import{Select as co,Avatar as yt,Spin as mo,message as uo,Popover as Qt,Card as po,Typography as go,Space as fo}from"antd";import{debounce as yo}from"lodash-es";import ho from"react-dom/client";import{jsx as M,jsxs as ge}from"react/jsx-runtime";var{Text:et}=go,bo=({multiple:e=!1,userType:t="all",excludeUserIds:r=[],showAvatar:n=!0,showUsername:d=!0,showNickname:s=!0,showPhone:a=!0,searchFields:o=["username","nickname","phone"],pageSize:i=10,allowClear:l=!0,value:m,initialUsers:C,onChange:b,...w})=>{let[_,A]=Me(!1),[P,O]=Me([]),[N,I]=Me(""),[R,T]=Me(1),[D,j]=Me(!0),[x,B]=Me([]),W=Jt([]),v=Jt([]),S=Jt([]),G=ke(u=>W.current.find(f=>f.id===u)||v.current.find(f=>f.id===u)||(S.current||[]).find(f=>f.id===u),[]);je(()=>{S.current=C||[]},[C]);let Q=ke(async u=>{try{A(!0);let f=await pt.getUserInfos({keywords:u||"",forceRefresh:!1}),g=Array.from(f.values());g=g.filter(k=>k.username!=="admin"),t==="admin"?g=g.filter(k=>k.isAdmin):t==="user"&&(g=g.filter(k=>!k.isAdmin)),u&&(g=g.filter(k=>o.some(J=>{let Yt=k[J];return Yt&&Yt.toLowerCase().includes(u.toLowerCase())}))),r.length>0&&(g=g.filter(k=>!r.includes(k.id))),g.sort((k,J)=>(k.username||"").localeCompare(J.username||""));let E=g;O(k=>[...k,...E]),j(!1)}catch(f){console.error("\u83B7\u53D6\u4EBA\u5458\u5217\u8868\u5931\u8D25:",f),uo.error("\u83B7\u53D6\u4EBA\u5458\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{A(!1)}},[t,r,o]);je(()=>{Q(null)},[Q]),je(()=>{W.current=P},[P]),je(()=>{v.current=x},[x]);let X=ke(u=>{if(!u||u.length==0){B([]),b?.([],[]);return}let f=Array.isArray(u)?u:[u],g=[];for(let E=0;E<f.length;E++){let k=f[E],J=G(k);J?g.push(J):g.push({id:k,username:k,nickname:"",phone:"",avatar:{avatar_small:""}})}if(x.length==g.length){let E=0;for(E=0;E<g.length&&!x.find(k=>k.id==g[E].id?k:null);E++);if(E<g.length)return}B(g.slice()),b?.(f,g)},[b,x]);je(()=>{if(!m||m.length==0){if(!x||x.length==0)return;B([]);return}m.sort();let u=[];x&&(u=x.map(f=>f.id),u.sort()),m.join(",")!=u.join(",")&&X(m)},[m,e,X,x]),je(()=>{if(!m||m.length==0)return;let f=m.map(g=>{let E=G(g);return E||{id:g,username:g,nickname:"",phone:"",type:null}}).filter(g=>g!==void 0);B(g=>g.length!==f.length||g.some((E,k)=>E.id!==f[k]?.id||E.username!==f[k]?.username)?f:g)},[P,m,C,G]);let fe=Kt(()=>yo(u=>{I(u),T(1),Q(u)},300),[Q]),ye=ke(u=>{let{target:f}=u;if(!f)return;let{scrollTop:g,scrollHeight:E,clientHeight:k}=f;if(E-g<=k*1.5&&!_&&D){let J=R+1;T(J),Q(N)}},[_,D,R,N,Q]),oe=u=>M(po,{size:"small",style:{width:280},children:ge(fo,{direction:"vertical",size:"small",style:{width:"100%"},children:[ge("div",{style:{display:"flex",alignItems:"center",gap:8},children:[M(yt,{src:u?.avatar?.avatar_small,size:40,children:u.nickname?.[0]||u.username?.[0]}),ge("div",{children:[M("div",{style:{fontWeight:"bold"},children:u.nickname||u.username}),u.title&&M(et,{type:"secondary",style:{fontSize:12},children:u.title})]})]}),u.phone&&ge("div",{children:[M(et,{type:"secondary",style:{fontSize:12},children:"\u624B\u673A\u53F7\uFF1A"}),M(et,{style:{fontSize:12},children:u.phone})]}),u.departmentInfo?.department_names&&ge("div",{children:[M(et,{type:"secondary",style:{fontSize:12},children:"\u6240\u5C5E\u90E8\u95E8\uFF1A"}),M(et,{style:{fontSize:12},children:u.departmentInfo?.department_names.join("\u3001")})]})]})}),he=Kt(()=>u=>{let f=[];return n&&f.push(M(yt,{src:u?.avatar?.avatar_small,size:20,style:{marginRight:8,verticalAlign:"middle",flexShrink:0},children:u.nickname?.[0]||u.username?.[0]},"avatar")),s&&u.nickname&&f.push(M("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:u.nickname},"nickname")),d&&f.push(ge("span",{style:{marginLeft:8,color:"rgb(var(--color-gray-400))",verticalAlign:"middle",lineHeight:"20px"},children:["(",u.username,")"]},"username")),a&&u.phone&&f.push(M("span",{style:{marginLeft:8,color:"rgb(var(--color-gray-400))",verticalAlign:"middle",lineHeight:"20px"},children:u.phone},"phone")),M("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:f})},[n,d,s,a]),me=Kt(()=>[...P,...x].filter((g,E,k)=>k.findIndex(J=>J.id===g.id)===E).map(g=>({label:he(g),value:g.id,user:g})),[P,x,he]),p=ke(u=>{let{value:f,closable:g,onClose:E}=u,k=P.find(J=>J.id===f)||x.find(J=>J.id===f)||(C||[]).find(J=>J.id===f);return k?M(Qt,{content:oe(k),trigger:"click",placement:"right",children:ge("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[M(yt,{src:k?.avatar?.avatar_small,size:20,style:{marginRight:8},children:k.nickname?.[0]||k.username?.[0]}),M("span",{style:{marginRight:8},children:k.nickname||k.username}),g&&M("span",{onClick:E,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):M("div",{children:f})},[P,x,C]),y=ke(u=>{let f=P.find(g=>g.id===u)||x.find(g=>g.id===u)||(C||[]).find(g=>g.id===u);return f?M(Qt,{content:oe(f),trigger:"click",placement:"right",children:ge("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:[M(yt,{src:f?.avatar?.avatar_small,size:20,style:{marginRight:8},children:f.nickname?.[0]||f.username?.[0]}),M("span",{children:f.nickname||f.username})]})}):M("div",{children:u})},[P,x,C]),h=ke(u=>{if(!u||u.length==0)return null;let f=u[0];return P.find(g=>g.id===f)||x.find(g=>g.id===f)||(C||[]).find(g=>g.id===f)},[P,x,C]);return M(co,{...w,mode:e?"multiple":void 0,showSearch:!0,loading:_,filterOption:!1,onSearch:fe,onPopupScroll:ye,notFoundContent:_?M(mo,{size:"small"}):null,allowClear:l,value:m,onChange:X,options:me,style:{...w.style,minHeight:"32px"},tagRender:e?p:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:u=>{let f=h(m);return f?ge("div",{children:[M("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:y(f.id)}),u]}):u},suffixIcon:e?void 0:m?M("div",{onClick:u=>{u.stopPropagation();let f=h(m);if(f){let g=document.createElement("div");document.body.appendChild(g);let E=ho.createRoot(g);E.render(M(Qt,{content:oe(f),trigger:"click",placement:"right",open:!0,onOpenChange:k=>{k||(E.unmount(),document.body.removeChild(g))},children:M("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:M("span",{className:"ant-select-arrow"})}):M("span",{className:"ant-select-arrow"})})},vo=bo;import{useEffect as Co,useRef as Io,useState as Or}from"react";import{Upload as Ar,Button as rt,Modal as Ro,Image as wo,Space as To,message as Po,Progress as xo}from"antd";import{UploadOutlined as So,DownloadOutlined as jr,EyeOutlined as _o,FilePdfFilled as ko,FileExcelFilled as No,FileWordFilled as Uo,FileTextFilled as Do,FileUnknownFilled as Eo}from"@ant-design/icons";import*as Fe from"febs-browser";function Er(e,t,r){r.method=r.method||"POST",r.headers=r.headers||{},r.timeout=r.timeout||5e3,r.withCredentials=r.withCredentials||!0,r.crossDomain=r.crossDomain||!0,r.sliceOffset=r.sliceOffset||0,r.sliceLength=r.sliceLength||-1;let n={success:r.success,method:r.method||"POST",url:r.url,mode:r.crossDomain!=!0?"same-origin":"cors",timeout:r.timeout||5e3};r=Fe.utils.mergeMap(n,r||{});let d=Fe.$(e);if(d.attr("enctype")&&d.attr("enctype").toLowerCase()==="multipart/form-data"){let a=new FormData,o=File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice,i=t.name,l=i.lastIndexOf("/");l>=0&&(i=i.substr(l+1)),l=i.lastIndexOf("\\"),l>=0&&(i=i.substr(l+1));let m=r.sliceLength||-1;m==-1&&(m=t.size-(r.sliceOffset||0));let C=o.call(t,r.sliceOffset,(r.sliceOffset||0)+m);a.append("file",C,i),r.data=a}else throw new Error("only support multipart/form-data");let s;return r.headers?s=r.headers:s={},s["Content-Type"]=!1,Fe.net.ajax({url:r.url,type:r.method,headers:s,processData:!1,data:r.data,timeout:r.timeout,withCredentials:r.withCredentials,success:function(a){r.success&&r.success(a)},error:function(a,o,i){r.error&&r.error(i)},complete:r.complete,progress:r.progress})}var ht=class ht{static uploadSingle(t,r,n,d,s){new FormData().append("file",t);let o=document.createElement("form");o.setAttribute("enctype","multipart/form-data");let i={headers:{}};return i.headers.set=(l,m)=>{i.headers[l]=m},pe.requestHandleSid(i),delete i.headers.set,Er(o,t,{url:ht.UPLOAD_SINGLE_URL+"?size="+t.size+"&crc32="+r,success:(l=>{l=JSON.parse(l),l.code===200?K.success("\u6587\u4EF6\u4E0A\u4F20\u6210\u529F"):K.error(l.message||"\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"),s&&s(l)}),error:(l=>{console.error("File upload error:",l),K.error("\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"),d&&d(l)}),progress:n||(l=>{console.log(`\u4E0A\u4F20\u8FDB\u5EA6: ${l}%`)}),complete:l=>{},data:"",method:"POST",headers:i.headers,timeout:Number(import.meta.env.VITE_API_UPLOAD_TIMEOUT)||5e3,withCredentials:!0,crossDomain:!0,sliceOffset:0,sliceLength:-1})}static copyFromServer(t){return c.post(import.meta.env.VITE_API_BASE+"/api/fs/copy",{sourcePath:t},null)}};F(ht,"UPLOAD_SINGLE_URL",import.meta.env.VITE_API_BASE+"/api/fs/upload");var tt=ht;import*as Mr from"febs-browser";import{jsx as L,jsxs as nt}from"react/jsx-runtime";var Wl=({fileList:e,onChange:t,onFinish:r,cancel:n,btnText:d="\u4E0A\u4F20\u6587\u4EF6",maxCount:s=5,disabled:a=!1,multiple:o=!0,accept:i=void 0})=>{let[l,m]=Or(void 0),C=Io(e);Co(()=>{C.current=e},[e]);let b=({fileList:N})=>{t?.(N)},w=N=>{t?.(C.current.filter(I=>I.uid!==N.uid))},_=N=>{let I=N.size/1024/1024<100;return I||Po.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7100MB"),I||Ar.LIST_IGNORE},A=async N=>{let{file:I,onSuccess:R,onError:T,onProgress:D}=N;try{I.status="uploading",I.percent=0,D({percent:0}),m(0),Mr.crypt.crc32_file(I,j=>{if(j==0){I.status="error",T("calc crc32 error");return}let x=tt.uploadSingle(I,j,B=>{let W=Math.floor(B*100);D({percent:W}),I.percent=W,m(W)},B=>{m(void 0),T(B)},B=>{I.status="done",I.percent=100,m(void 0),R("ok"),r&&r([I],B).then(()=>{}).catch(()=>{})});I.cancel=()=>{x.abort(),I.status="error",I.percent=0,m(void 0),T(new Error("\u4E0A\u4F20\u5DF2\u53D6\u6D88")),w(I)}})}catch(j){I.status="error",m(void 0),T(j)}},P=l!==void 0&&l<100;return L(Ar,{fileList:e,onChange:b,beforeUpload:_,customRequest:A,multiple:o,maxCount:s,disabled:a,itemRender:(N,I,R,T)=>P?nt("div",{className:"flex items-center justify-between w-full mt-2 rounded border border-blue-100 bg-blue-50 px-3 py-2",children:[L("span",{className:"mr-3 min-w-0 max-w-[120px] flex-1 truncate text-sm text-gray-700",children:I.name}),L(xo,{className:"w-[60px]",percent:Math.round(I.percent||0),size:"small",status:"active",showInfo:!0}),L(rt,{className:"ml-3",size:"small",onClick:()=>{n?n(I):I.cancel?.(),w(I)},danger:!0,children:"\u53D6\u6D88"})]}):null,accept:i,showUploadList:!0,children:!P&&L(rt,{icon:L(So,{}),disabled:a||P,title:o?`\u4E0A\u4F20\u6587\u4EF6\uFF08\u6700\u591A\u652F\u6301${s}\u4E2A\u6587\u4EF6\uFF0C\u5355\u4E2A\u6587\u4EF6\u4E0D\u8D85\u8FC7100MB\uFF09`:"\u4E0A\u4F20\u6587\u4EF6\uFF08\u5355\u4E2A\u6587\u4EF6\u4E0D\u8D85\u8FC7100MB\uFF09",children:P?nt("span",{className:"inline-block w-[85px]",children:["\u4E0A\u4F20\u4E2D ",l,"%"]}):d})})},Vl=({files:e=[],onPreview:t,onDownload:r})=>e.length===0?null:L("div",{className:"p-4 bg-gray-50 rounded",children:e.map((n,d)=>nt("div",{className:"flex items-center mb-2",children:[Fr(n),L("span",{className:"mr-2",children:n.name}),nt(To,{children:[t&&L(rt,{type:"link",size:"small",icon:L(_o,{}),onClick:()=>t(n),children:"\u67E5\u770B"}),r&&L(rt,{type:"link",size:"small",icon:L(jr,{}),onClick:()=>r(n),children:"\u4E0B\u8F7D"})]})]},n.uid||d))}),Fr=e=>{let t=e.type||"";return t.includes("pdf")?L(ko,{className:"mr-2 text-red-500"}):t.includes("excel")||t.includes("spreadsheet")||e.name.endsWith(".xlsx")||e.name.endsWith(".xls")?L(No,{className:"mr-2 text-green-500"}):t.includes("word")||t.includes("document")||e.name.endsWith(".docx")||e.name.endsWith(".doc")?L(Uo,{className:"mr-2 text-blue-500"}):t.includes("image")?L(Do,{className:"mr-2 text-purple-500"}):L(Eo,{className:"mr-2 text-gray-500"})},ql=({visible:e,file:t,onClose:r,onDownload:n})=>{if(!t)return null;let[d,s]=Or(""),a=t.name||"",o=t.type?.startsWith("image/");return o&&it(t,i=>{s(i||"")}),L(Ro,{open:e,title:a,footer:null,onCancel:r,width:800,children:o?L(wo,{alt:a,style:{width:"100%"},src:d}):nt("div",{className:"text-center p-8",children:[L("div",{className:"text-6xl mb-4",children:Fr(t)}),L("p",{className:"mb-4",children:a}),L("p",{className:"text-gray-500 mb-4",children:"\u8BE5\u6587\u4EF6\u7C7B\u578B\u65E0\u6CD5\u76F4\u63A5\u9884\u89C8"}),n&&L(rt,{type:"primary",icon:L(jr,{}),onClick:()=>n(t),children:"\u4E0B\u8F7D\u6587\u4EF6\u67E5\u770B"})]})})};export{Ba as CommentTimeline,tt as FileUploadHandler,Hs as ProjectSelector,Yi as ResizableTable,lo as RoleSelector,Ei as SingletonToastProvider,Ct as UIDatePicker,ei as UIDateRangePicker,Vl as UIFileList,Wl as UIFileUpload,ql as UIFileUploadPreviewModal,ui as UIImageUpload,Tn as UILoading,Pi as UISelect,$i as UITableGridViewToggle,Di as UIToast,Bi as UIToastSingle,Li as UIToastSingleProvider,Gn as UIViewToggle,vo as UserSelector,Ys as clearRoleCache,Rt as compressImage,Qr as uiAlert,ln as uiConfirm,K as uiToast};
|
|
1
|
+
var Zt=Object.defineProperty;var Br=(e,t,r)=>t in e?Zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var bt=(e,t)=>{for(var r in t)Zt(e,r,{get:t[r],enumerable:!0})};var F=(e,t,r)=>Br(e,typeof t!="symbol"?t+"":t,r);import{Modal as Lr,Button as st,Space as er,Typography as zr}from"antd";import{CheckCircleFilled as Hr,CloseCircleFilled as Wr,ExclamationCircleFilled as Vr,InfoCircleFilled as qr,QuestionCircleFilled as $r}from"@ant-design/icons";import{createRoot as Xr}from"react-dom/client";import{jsx as q,jsxs as tr}from"react/jsx-runtime";var{Text:Gr,Title:Jr}=zr,rr={type:"info",title:"\u63D0\u793A",content:"",width:420,centered:!0,closable:!0,maskClosable:!0,okText:"\u786E\u5B9A",okType:"primary",cancelText:"\u53D6\u6D88",autoClose:0,showIcon:!1},Z=null,Y=null,Be=null,ot=e=>{let{type:t="info",title:r,content:n,width:d,centered:s,closable:a,maskClosable:o,okText:i,okType:c,cancelText:m,buttons:C,onOk:b,onCancel:w,open:_,onClose:j,className:P,showIcon:A}=e,N={success:q(Hr,{style:{color:"#52c41a",fontSize:24,marginRight:8}}),error:q(Wr,{style:{color:"#ff4d4f",fontSize:24,marginRight:8}}),warning:q(Vr,{style:{color:"#faad14",fontSize:24,marginRight:8}}),info:q(qr,{style:{color:"#1677ff",fontSize:24,marginRight:8}}),confirm:q($r,{style:{color:"#1677ff",fontSize:24,marginRight:8}})},I=async()=>{b&&await b(),j()},R=()=>{w&&w(),j()},T=()=>C&&C.length>0?q(er,{style:{display:"flex",justifyContent:"flex-end"},children:C.map((O,x)=>q(st,{type:O.type||"default",onClick:()=>{O.onClick&&O.onClick(),j()},children:O.text},x))}):t==="confirm"?tr(er,{style:{display:"flex",justifyContent:"flex-end"},children:[q(st,{onClick:R,children:m}),q(st,{type:c,onClick:I,children:i})]}):q(st,{type:c,onClick:I,children:i});return q(Lr,{title:r?tr("div",{style:{display:"flex",alignItems:"center"},children:[A&&N[t],q(Jr,{level:4,style:{margin:0},children:r})]}):null,open:_,width:d,centered:s,closable:a,maskClosable:o,onCancel:R,footer:T(),className:P?P+" ant-modal-nofull":"ant-modal-nofull",children:q("div",{style:{marginLeft:A?32:0},children:typeof n=="string"?q(Gr,{children:n}):n})})},Ne=(e,t=!0)=>{Be&&(window.clearTimeout(Be),Be=null);let r={...rr,...e},n=()=>{Z&&Y&&Y.render(q(ot,{...r,open:!1,onClose:()=>{r.afterClose&&r.afterClose(),Z&&Y&&setTimeout(()=>{Y?.unmount(),document.body.removeChild(Z),Z=null,Y=null},300)}}))};return Z&&Y?Y.render(q(ot,{...r,open:t,onClose:n})):(Z=document.createElement("div"),document.body.appendChild(Z),Y=Xr(Z),Y.render(q(ot,{...r,open:t,onClose:n}))),r.autoClose&&r.autoClose>0&&(Be=window.setTimeout(()=>{n(),Be=null},r.autoClose)),n},Kr={success:e=>{let t=typeof e=="string"?{content:e}:e;return Ne({...t,type:"success",title:t.title||"\u6210\u529F"})},error:e=>{let t=typeof e=="string"?{content:e}:e;return Ne({...t,type:"error",title:t.title||"\u9519\u8BEF"})},warning:e=>{let t=typeof e=="string"?{content:e}:e;return Ne({...t,type:"warning",title:t.title||"\u8B66\u544A"})},info:e=>{let t=typeof e=="string"?{content:e}:e;return Ne({...t,type:"info",title:t.title||"\u63D0\u793A"})},confirm:e=>{let t=typeof e=="string"?{content:e}:e;return Ne({...t,type:"confirm",title:t.title||"\u786E\u8BA4"})},custom:e=>Ne(e),close:()=>{Z&&Y&&Y.render(q(ot,{...rr,open:!1,onClose:()=>{Z&&Y&&(Y.unmount(),document.body.removeChild(Z),Z=null,Y=null)}}))}},Qr=Kr;import{Modal as Yr,Button as nr,Space as Zr}from"antd";import{ExclamationCircleFilled as en,InfoCircleFilled as tn,QuestionCircleFilled as rn,WarningFilled as nn}from"@ant-design/icons";import{createRoot as sn}from"react-dom/client";import{jsx as re,jsxs as or}from"react/jsx-runtime";var on={type:"confirm",title:"\u786E\u8BA4",content:"",width:420,centered:!0,closable:!0,maskClosable:!1,okText:"\u786E\u5B9A",okType:"primary",cancelText:"\u53D6\u6D88",showIcon:!1,keyboard:!0,autoFocusButton:"ok",zIndex:2e4},ie=null,ae=null,sr=e=>{let{type:t="confirm",title:r,content:n,width:d,centered:s,closable:a,maskClosable:o,okText:i,okType:c,cancelText:m,okButtonProps:C,cancelButtonProps:b,onOk:w,onCancel:_,open:j,onClose:P,className:A,showIcon:N,zIndex:I,keyboard:R,autoFocusButton:T}=e,D={confirm:re(rn,{style:{color:"#1677ff",fontSize:22,marginRight:12}}),warning:re(en,{style:{color:"#faad14",fontSize:22,marginRight:12}}),info:re(tn,{style:{color:"#1677ff",fontSize:22,marginRight:12}}),error:re(nn,{style:{color:"#ff4d4f",fontSize:22,marginRight:12}})},O=async()=>{try{if(w){let W=w();W instanceof Promise&&await W}P(!0)}catch(W){console.error("Confirm onOk error:",W)}},x=()=>{_&&_(),P(!1)};return re(Yr,{title:r?or("div",{style:{display:"flex",alignItems:"center"},children:[N&&D[t],re("span",{children:r})]}):null,open:j,width:d,centered:s,closable:a,maskClosable:o,onCancel:x,className:A?A+" ant-modal-nofull":"ant-modal-nofull",zIndex:I,keyboard:R,footer:or(Zr,{children:[re(nr,{onClick:x,...b,autoFocus:T==="cancel",children:m}),re(nr,{type:c,onClick:O,...C,autoFocus:T==="ok",children:i})]}),children:re("div",{style:{marginLeft:N?34:0},children:n})})},Le=e=>{let t={...on,...e};return ie&&ae&&(ae.unmount(),document.body.removeChild(ie),ie=null,ae=null),new Promise(r=>{let n=d=>{ie&&ae&&ae.render(re(sr,{...t,open:!1,onClose:s=>{t.afterClose&&t.afterClose(),setTimeout(()=>{ie&&ae&&(ae.unmount(),document.body.removeChild(ie),ie=null,ae=null),r(s)},300)}})),r(d)};ie=document.createElement("div"),document.body.appendChild(ie),ae=sn(ie),ae.render(re(sr,{...t,open:!0,onClose:n}))})},an={confirm:e=>Le({...typeof e=="string"?{content:e,showIcon:!1,title:""}:e,type:"confirm"}),warning:e=>{let t=typeof e=="string"?{content:e}:e;return Le({...t,type:"warning",title:t.title||"\u8B66\u544A"})},info:e=>{let t=typeof e=="string"?{content:e}:e;return Le({...t,type:"info",title:t.title||"\u4FE1\u606F"})},error:e=>{let t=typeof e=="string"?{content:e}:e;return Le({...t,type:"error",title:t.title||"\u9519\u8BEF"})},custom:e=>Le(e)},ln=an;import{useState as cn,useRef as dn,useEffect as mn}from"react";import{Calendar as un,ChevronLeft as pn,ChevronRight as gn}from"lucide-react";import{Button as vt}from"antd";import{jsx as V,jsxs as ze}from"react/jsx-runtime";function Ct({value:e,onChange:t,type:r="date",placeholder:n="\u9009\u62E9\u65E5\u671F",className:d=""}){let[s,a]=cn(!1),o=dn(null),i=e?c(e,r):"";mn(()=>{function b(w){o.current&&!o.current.contains(w.target)&&a(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]);function c(b,w){if(!b)return"";try{if(w==="month"){let[_,j]=b.split("-");return`${_}\u5E74${j}\u6708`}else return new Date(b).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"})}catch{return b}}let m=b=>{t(b.target.value)},C=()=>{a(!s)};return ze("div",{className:`relative ${d}`,ref:o,children:[ze("div",{className:"relative cursor-pointer",children:[V("input",{type:r,value:e,onChange:m,onClick:C,className:"w-full bg-white border border-ios-gray-200 rounded-ios py-2.5 pl-3 pr-10 text-sm text-ios-gray-700 shadow-ios focus:outline-none focus:ring-2 focus:ring-ios-blue-400 focus:border-transparent transition-all duration-200 hover:border-ios-blue-300 cursor-pointer",placeholder:n}),V("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none",children:V(un,{className:"h-4 w-4 text-ios-gray-400"})})]}),s&&ze("div",{className:"absolute z-10 mt-1 bg-white rounded-ios shadow-ios-md p-4 ring-1 ring-ios-gray-200 ring-opacity-5",children:[ze("div",{className:"flex justify-between items-center mb-4",children:[V(vt,{type:"text",className:"p-1.5 hover:bg-ios-gray-100 rounded-full transition-colors duration-150",icon:V(pn,{className:"h-4 w-4 text-ios-gray-600"})}),V("span",{className:"text-sm font-medium text-ios-gray-700",children:"2024\u5E745\u6708"}),V(vt,{type:"text",className:"p-1.5 hover:bg-ios-gray-100 rounded-full transition-colors duration-150",icon:V(gn,{className:"h-4 w-4 text-ios-gray-600"})})]}),ze("div",{className:"grid grid-cols-7 gap-1 text-center text-xs",children:[V("div",{className:"text-ios-gray-500 font-medium",children:"\u65E5"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E00"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E8C"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E09"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u56DB"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u4E94"}),V("div",{className:"text-ios-gray-500 font-medium",children:"\u516D"}),V("div",{className:"text-ios-gray-300 py-1.5",children:"30"}),V("div",{className:"text-ios-gray-300 py-1.5",children:"31"}),Array.from({length:30}).map((b,w)=>V("div",{className:`py-1.5 hover:bg-ios-blue-50 rounded-full cursor-pointer transition-colors duration-150 ${w===14?"bg-ios-blue-500 text-white":"text-ios-gray-700"}`,onClick:()=>{let _=w+1,j=`2024-05-${_<10?"0"+_:_}`;t(j),a(!1)},children:w+1},w))]}),V("div",{className:"mt-4 flex justify-end",children:V(vt,{type:"text",className:"px-4 py-1.5 text-sm text-ios-blue-500 hover:bg-ios-blue-50 rounded-ios transition-colors duration-150",onClick:()=>a(!1),children:"\u786E\u5B9A"})})]})]})}import{jsx as It,jsxs as fn}from"react/jsx-runtime";function ei({startDate:e,endDate:t,onStartDateChange:r,onEndDateChange:n,type:d="date",className:s=""}){return fn("div",{className:`flex items-center space-x-2 ${s}`,children:[It(Ct,{value:e,onChange:r,type:d,placeholder:"\u5F00\u59CB\u65E5\u671F"}),It("span",{className:"text-gray-500",children:"\u81F3"}),It(Ct,{value:t,onChange:n,type:d,placeholder:"\u7ED3\u675F\u65E5\u671F"})]})}import{useState as He,useRef as yn}from"react";import{Button as wt,Modal as hn,message as Tt}from"antd";import{UploadOutlined as bn}from"@ant-design/icons";import vn from"react-image-crop";import"react-image-crop/dist/ReactCrop.css";function it(e,t){let r=new FileReader;r.readAsDataURL(e),r.onload=function(){t(r.result)},r.onerror=function(){t(null)},r.onabort=function(){t(null)}}function Rt(e,t,r,n){t=t>0?t:1024;let d=t,s=t,a=new Image;a.addEventListener("load",function(o){let i,c=!1;if(d<a.naturalWidth&&(c=!0,i=a.naturalWidth/d,s=a.naturalHeight/i),s<a.naturalHeight&&(c=!0,i=a.naturalHeight/s,d=a.naturalWidth/i),!c){d=a.naturalWidth,s=a.naturalHeight,n&&n(e,d,s);return}let m=document.createElement("canvas");m.width=d,m.height=s;let C=m.getContext("2d");C?.clearRect(0,0,d,s),C?.drawImage(a,0,0,d,s);let b=m.toDataURL(r||"image/png");m=null,n&&n(b,d,s)}),a.src=e}import{jsx as ue,jsxs as Cn}from"react/jsx-runtime";var ui=({onUpload:e,accept:t="image/*",maxSize:r=5,aspectRatio:n,className:d="",useBase64:s=!1,id:a})=>{let[o,i]=He(!1),[c,m]=He(""),[C,b]=He({unit:"%",width:90,height:90,x:5,y:5}),[w,_]=He(null),[j,P]=He(null),A=yn(null),N=R=>{let T=R.target.files?.[0];if(!T)return;if(T.size>r*1024*1024){Tt.error(`\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${r}MB`);return}if(!T.type.startsWith("image/")){Tt.error("\u8BF7\u4E0A\u4F20\u56FE\u7247\u6587\u4EF6");return}P(T);let D=new FileReader;D.onload=O=>{m(O.target?.result),i(!0)},D.readAsDataURL(T)},I=async R=>{if(!w||!j)return;let T=w.width,D=w.height,O=w.naturalWidth/T,x=w.naturalHeight/D,B=R.unit=="%"?T/100:1,W=R.unit=="%"?D/100:1,v=R.x*O*B,S=R.y*x*W,G=R.width*O*B,Q=R.height*x*W;try{let X=document.createElement("canvas");X.width=G,X.height=Q;let fe=X.getContext("2d");if(!fe)return;fe.drawImage(w,v,S,G,Q,0,0,G,Q),X.toBlob(ye=>{if(!ye)return;let oe=new File([ye],j.name,{type:j.type});if(s){it(oe,he=>{Rt(he,0,"image/jpeg",me=>{i(!1),e(me)})});return}else i(!1),e(oe)},j.type),i(!1),m(""),P(null),A.current&&(A.current.value="")}catch{Tt.error("\u56FE\u7247\u5904\u7406\u5931\u8D25")}};return Cn("div",{className:d,children:[ue("input",{type:"file",ref:A,accept:t,onChange:N,style:{display:"none"}}),ue(wt,{id:a,icon:ue(bn,{}),onClick:()=>A.current?.click(),className:"btn-primary",children:"\u9009\u62E9\u56FE\u7247"}),ue(hn,{title:"\u88C1\u526A\u56FE\u7247",open:o,onCancel:()=>{i(!1),m(""),P(null),A.current&&(A.current.value="")},footer:[ue(wt,{onClick:()=>i(!1),className:"btn-outline",children:"\u53D6\u6D88"},"cancel"),ue(wt,{type:"primary",onClick:()=>I(C),className:"btn-primary",children:"\u786E\u8BA4"},"confirm")],width:500,children:ue("div",{className:"flex justify-center",children:c&&ue(vn,{crop:C,onChange:R=>b(R),aspect:n,className:"max-w-full",children:ue("img",{src:c,alt:"\u9884\u89C8",ref:R=>_(R),className:"max-w-full"})})})})]})};import{Spin as In}from"antd";import{LoadingOutlined as Rn}from"@ant-design/icons";import{createRoot as wn}from"react-dom/client";import{jsx as We}from"react/jsx-runtime";var ir=Symbol("loading");function ar(){let e=window[ir];return e||(e={count:0,timeoutId:0,inTimeout:!1},window[ir]=e),e}var cr={tip:"",fullscreen:!0,delay:0,mask:!0,iconSize:40,wrapperClassName:"ui-loading-wrapper"},Tn=e=>{let t={...cr,...e},{tip:r,fullscreen:n,mask:d,maskStyle:s,iconSize:a,iconStyle:o,containerStyle:i,wrapperClassName:c}=t,m=We(Rn,{style:{fontSize:a,color:"#1677ff",...o},spin:!0}),C=n?{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9999,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:d?"rgba(0, 0, 0, 0.45)":"transparent",...s}:{},b={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...i};return We("div",{style:C,className:c,children:We("div",{style:b,children:We(In,{indicator:m,children:r})})})},le=null,be=null,lr=(e={})=>(le&&be&&(be.unmount(),document.body.removeChild(le),le=null,be=null),le=document.createElement("div"),document.body.appendChild(le),be=wn(le),be.render(We(Tn,{...e})),le),at={show:(e={})=>{let t=ar();t.count++;let r={...cr,...e};if(r.delay&&r.delay>0){t.timeoutId!=0&&(window.clearTimeout(t.timeoutId),t.timeoutId=0),t.timeoutId=window.setTimeout(()=>{t.timeoutId=0,lr(r)},r.delay);return}else lr(r)},hide:()=>{let e=ar();if(e.count<=0){console.warn("Loading count is less than 0");return}e.count--,e.timeoutId!=0&&(window.clearTimeout(e.timeoutId),e.timeoutId=0),e.count==0&&le&&be&&(be.unmount(),document.body.removeChild(le),le=null,be=null)},service:(e,t={})=>(at.show(t),e.then(r=>(at.hide(),r)).catch(r=>{throw at.hide(),r}))},Ve=at;import{useState as Pn,useRef as xn,useEffect as Sn}from"react";import{ChevronDown as _n}from"lucide-react";import{Button as kn}from"antd";import{jsx as ve,jsxs as Pt}from"react/jsx-runtime";function Pi({options:e,value:t,onChange:r,placeholder:n="\u8BF7\u9009\u62E9",className:d=""}){let[s,a]=Pn(!1),o=xn(null),i=e.find(c=>c.value===t);return Sn(()=>{function c(m){o.current&&!o.current.contains(m.target)&&a(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]),Pt("div",{className:`relative ${d}`,ref:o,children:[Pt(kn,{type:"text",onClick:()=>a(!s),className:"w-full bg-white border border-ios-gray-200 rounded-ios py-2.5 pl-3 pr-10 text-left shadow-ios focus:outline-none focus:ring-2 focus:ring-ios-blue-400 focus:border-transparent transition-all duration-200 hover:border-ios-blue-300",children:[ve("span",{className:"block truncate text-sm text-ios-gray-700",children:i?i.label:n}),ve("span",{className:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none",children:ve(_n,{className:`h-4 w-4 text-ios-gray-400 transition-transform duration-200 ${s?"transform rotate-180":""}`})})]}),s&&ve("div",{className:"absolute z-10 mt-1 w-full bg-white shadow-ios-md max-h-60 rounded-ios py-1 text-base ring-1 ring-ios-gray-200 ring-opacity-5 overflow-auto focus:outline-none sm:text-sm",children:e.map(c=>Pt("div",{className:`cursor-pointer select-none relative py-2.5 pl-3 pr-9 hover:bg-ios-blue-50 transition-colors duration-150 ${c.value===t?"bg-ios-blue-50 text-ios-blue-600 font-medium":"text-ios-gray-700"}`,onClick:()=>{r(c.value),a(!1)},children:[ve("span",{className:"block truncate text-sm",children:c.label}),c.value===t&&ve("span",{className:"absolute inset-y-0 right-0 flex items-center pr-4 text-ios-blue-500",children:ve("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:ve("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},c.value))})]})}import{useEffect as dr,useState as Nn,useRef as Un}from"react";import{notification as ee}from"antd";import{CheckCircleOutlined as Dn,CloseCircleOutlined as En,InfoCircleOutlined as jn,WarningOutlined as An}from"@ant-design/icons";import{Fragment as mr,jsx as $e,jsxs as Fn}from"react/jsx-runtime";var St={success:$e(Dn,{style:{color:"#52c41a"}}),error:$e(En,{style:{color:"#ff4d4f"}}),info:$e(jn,{style:{color:"#1677ff"}}),warning:$e(An,{style:{color:"#faad14"}})},Di=({type:e,message:t,descs:r="",duration:n=3,placement:d="topRight",onClose:s})=>{let[a,o]=ee.useNotification(),[i,c]=Nn(!0);return dr(()=>{let m={message:t,descs:r,placement:d,duration:n,icon:St[e],onClose:()=>{c(!1),s?.()}};if(i)switch(e){case"success":a.success(m);break;case"error":a.error(m);break;case"info":a.info(m);break;case"warning":a.warning(m);break;default:a.info(m)}},[e,t,r,n,d,i,a,s]),$e(mr,{children:o})};ee.config({placement:"topRight",duration:3,zIndex:1e4});var Te=class Te{constructor(){F(this,"currentToast",null);F(this,"api",null);F(this,"isInitialized",!1);F(this,"pendingToast",null)}static getInstance(){return Te.instance||(Te.instance=new Te),Te.instance}init(t){if(this.api=t,this.isInitialized=!0,this.pendingToast){let r=this.pendingToast;this.pendingToast=null,this.show(r)}}show(t){let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t;if(!this.isInitialized||!this.api){this.pendingToast=t;return}this.currentToast?.timer&&clearTimeout(this.currentToast.timer),this.currentToast&&this.currentToast.key===r?(ee.destroy(r),this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i})):(this.currentToast&&ee.destroy(this.currentToast.key),this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}))}createNotification(t){if(!this.api)return;let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t,c={success:this.api.success.bind(this.api),error:this.api.error.bind(this.api),info:this.api.info.bind(this.api),warning:this.api.warning.bind(this.api)}[n];c({key:r,message:d,description:s,duration:a,placement:o||"topRight",icon:St[n],onClose:()=>{this.currentToast?.key===r&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),this.currentToast=null),i?.()}}),this.currentToast={key:r,type:n,message:d,descs:s,duration:a,placement:o,timer:null}}close(){this.currentToast&&(this.currentToast.timer&&clearTimeout(this.currentToast.timer),ee.destroy(this.currentToast.key),this.currentToast=null)}destroy(){this.close(),ee.destroy()}};F(Te,"instance");var xt=Te,On=xt.getInstance();function lt(e){return typeof e=="string"?{message:e,duration:3}:e}function qe(e){return St[e]}var Mn={success:e=>{if(!e)return;let t=lt(e);ee.success({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("success"),onClose:t.onClose})},error:e=>{if(!e)return;let t=lt(e);ee.error({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("error"),onClose:t.onClose})},info:e=>{if(!e)return;let t=lt(e);ee.info({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("info"),onClose:t.onClose})},warning:e=>{if(!e)return;let t=lt(e);ee.warning({message:t.message,description:t.descs,duration:t.duration,placement:t.placement,icon:qe("warning"),onClose:t.onClose})},custom:(e,t)=>{let{message:r,descs:n,duration:d,placement:s,onClose:a}=t;ee[e]({message:r,description:n,duration:d,placement:s,icon:qe(e),onClose:a})}},Ei=({children:e})=>{let[t,r]=ee.useNotification(),n=Un(!1);return dr(()=>{n.current||(On.init(t),n.current=!0)},[t]),Fn(mr,{children:[r,e]})},K=Mn;import{notification as Ce}from"antd";import{CheckCircleOutlined as Bn,CloseCircleOutlined as Ln,InfoCircleOutlined as zn,WarningOutlined as Hn}from"@ant-design/icons";import{Fragment as Vn,jsx as Ge}from"react/jsx-runtime";var Wn={success:Ge(Bn,{style:{color:"#52c41a"}}),error:Ge(Ln,{style:{color:"#ff4d4f"}}),info:Ge(zn,{style:{color:"#1890ff"}}),warning:Ge(Hn,{style:{color:"#faad14"}})},_t=class{constructor(){F(this,"currentToast",null);F(this,"suppressedCloseKeys",new Set)}destroySilently(t){this.suppressedCloseKeys.add(t),Ce.destroy(t)}show(t){let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t;this.currentToast&&this.currentToast.key===r?this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}):(this.currentToast&&this.destroySilently(this.currentToast.key),this.createNotification({key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}))}createNotification(t){let{key:r,type:n,message:d,descs:s,duration:a,placement:o,onClose:i}=t;this.suppressedCloseKeys.delete(r);let c={success:Ce.success,error:Ce.error,info:Ce.info,warning:Ce.warning}[n];c({key:r,message:d,description:s,duration:a,placement:o||"topRight",icon:Wn[n],onClose:()=>{if(this.suppressedCloseKeys.has(r)){this.suppressedCloseKeys.delete(r),this.currentToast?.key===r&&(this.currentToast=null);return}this.currentToast?.key===r&&(this.currentToast=null),i?.()}}),this.currentToast={key:r,type:n,message:d,descs:s,duration:a,placement:o}}close(t){if(!this.currentToast){t&&Ce.destroy(t);return}let r=t||this.currentToast.key;if(r!==this.currentToast.key){Ce.destroy(t);return}this.destroySilently(r),this.currentToast=null}destroy(){this.currentToast&&(this.destroySilently(this.currentToast.key),this.currentToast=null),Ce.destroy()}},Pe=new _t,Bi={success:(e,t=3)=>{let r=Xe("success",e,t);Pe.show(r)},error:(e,t=3)=>{let r=Xe("error",e,t);Pe.show(r)},info:(e,t=3)=>{let r=Xe("info",e,t);Pe.show(r)},warning:(e,t=3)=>{let r=Xe("warning",e,t);Pe.show(r)},custom:(e,t,r=3)=>{let n=Xe(e,t,r);Pe.show(n)},close:e=>{Pe.close(e)},destroy:()=>{Pe.destroy()}};function Xe(e,t,r){let n=typeof t=="object"&&t!==null?t:{message:t};return{key:n.key||`singleton-${e}`,type:e,message:n.message,descs:n.descs,duration:n.duration??r,placement:n.placement,onClose:n.onClose}}var Li=({children:e})=>Ge(Vn,{children:e});import{Button as qn}from"antd";import{TableOutlined as $n,AppstoreOutlined as Xn}from"@ant-design/icons";import{jsx as Ue}from"react/jsx-runtime";function Gn({className:e="",viewMode:t,onToggle:r,options:n=[]}){return Ue("div",{className:`flex justify-end ${e}`,children:Ue("div",{className:"bg-gray-100 rounded-button p-1 flex",children:n.map((d,s)=>Ue(qn,{type:t===d.value?"primary":"text",icon:d.icon,onClick:()=>r(d.value),className:`${s<n.length-1?"mr-1":""} rounded-button`,size:"small",title:d.tooltip},d.value))})})}function $i({viewMode:e,onToggle:t,className:r=""}){return Ue(Gn,{viewMode:e,onToggle:t,className:r,options:[{value:"table",icon:Ue($n,{}),tooltip:"\u8868\u683C\u89C6\u56FE"},{value:"grid",icon:Ue(Xn,{}),tooltip:"\u7F51\u683C\u89C6\u56FE"}]})}import{useMemo as ur,useState as kt}from"react";import{Table as Jn}from"antd";import{jsx as Nt,jsxs as ts}from"react/jsx-runtime";var Kn=Jn,Qn=60,pr=9,Yn={position:"absolute",top:0,bottom:0,right:-(pr/2),width:pr,zIndex:2,cursor:"col-resize",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none"},Zn={width:1,height:"60%",background:"transparent"},es=({onResizeStart:e,style:t,children:r,...n})=>{let[d,s]=kt(!1),[a,o]=kt(!1),i=c=>{if(!e)return;let m=c.currentTarget.closest("th"),C=m?m.getBoundingClientRect().width:0;o(!0);let b=()=>o(!1);document.addEventListener("mouseup",b,{once:!0}),e(c,C)};return ts("th",{style:{...t,position:"relative"},...n,children:[r,e&&Nt("span",{style:Yn,onMouseDown:i,onClick:c=>c.stopPropagation(),onDoubleClick:c=>c.stopPropagation(),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:Nt("span",{style:{...Zn,background:d||a?"#1677ff":"transparent"}})})]})},gr=(e,t)=>{let r=e.key;if(typeof r=="string"||typeof r=="number")return String(r);let n=e.dataIndex;return Array.isArray(n)?n.join("."):typeof n=="string"||typeof n=="number"?String(n):`col-${t}`};function Yi(e){let{columns:t,components:r,tableLayout:n,...d}=e,[s,a]=kt({}),o=(m,C)=>(b,w)=>{if(b.preventDefault(),b.stopPropagation(),Object.keys(s).length===0&&t){let A=b.currentTarget.closest("th"),N=A?.parentElement,I=N?Array.from(N.children):[],R=A&&I.length>0?I.indexOf(A)-m:0,T={};t.forEach((D,O)=>{let x=I[O+R];x&&(T[gr(D,O)]=Math.round(x.getBoundingClientRect().width))}),Object.keys(T).length>0&&a(D=>({...T,...D}))}let _=b.clientX,j=A=>{let N=Math.max(Qn,Math.round(w+A.clientX-_));a(I=>I[C]===N?I:{...I,[C]:N})},P=()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",P),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",j),document.addEventListener("mouseup",P),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},i=ur(()=>t&&t.map((m,C)=>{if("children"in m&&m.children)return m;let b=gr(m,C),w=s[b]??m.width;return{...m,width:w,onHeaderCell:_=>({...m.onHeaderCell?.(_)??{},onResizeStart:o(C,b)})}}),[t,s]),c=ur(()=>({...r,header:{...r?.header??{},cell:es}}),[r]);return Nt(Kn,{...d,columns:i,components:c,tableLayout:Object.keys(s).length>0?"fixed":n})}import Ie from"react";import{Timeline as xs,Avatar as wr,Button as gt,Dropdown as Ss,DatePicker as _s}from"antd";var Je=e=>!e||(typeof e=="string"&&(e=new Date(e)),e.getTime()==0)||isNaN(e.getTime())?"\u65E0":e.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"numeric",hour:"2-digit",minute:"2-digit"});import{Modal as Tr,Form as _e,Input as Pr}from"antd";import{EllipsisOutlined as ks,EditOutlined as Ns,DeleteOutlined as Us,CommentOutlined as Ds}from"@ant-design/icons";import{useEffect as rs,useRef as fr}from"react";import{jsx as De,jsxs as ct}from"react/jsx-runtime";function yr(){return ct("div",{className:"ant-empty ant-empty-normal justify-self-center text-muted py-4",children:[De("div",{className:"ant-empty-image",children:ct("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[De("title",{children:" \u65E0\u6570\u636E "}),ct("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[De("ellipse",{fill:"rgb(var(--color-muted) / 0.12)",cx:"32",cy:"33",rx:"32",ry:"7"}),ct("g",{fillRule:"nonzero",stroke:"rgb(var(--color-border))",children:[De("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"}),De("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))"})]})]})]})}),De("div",{className:"ant-empty-description justify-self-center text-sm font-thin text-muted",children:" \u65E0\u6570\u636E "})]})}function hr(e,t,r=768){let n=fr(e),d=fr(t);n.current=e,d.current=t,rs(()=>{let s=window.innerWidth<=r,a=()=>{let o=window.innerWidth<=r;o!==s&&(s=o,o?n.current():d.current())};return s?n.current():d.current(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[r])}import xr from"dayjs";import*as jt from"febs-browser";import Cr from"dexie";var Ut={};bt(Ut,{AuthorizationHandler:()=>pe,HttpRequest:()=>l,ResponseCode:()=>ut});import ns,{AxiosError as ss}from"axios";import*as mt from"febs-browser";import*as Ke from"febs-browser";import br from"store2";var dt=class{constructor(t){F(this,"s");this.s=t}get length(){return this.s.size()}keys(){return this.s.keys()}set(t,r){return r?(r=JSON.stringify(r),r=Ke.crypt.base64_encode(r),this.s.set(t,r,!0),this):this.remove(t)}get(t,r=null){if(!this.s.has(t))return r;let n=this.s.get(t);if(n){n=Ke.crypt.base64_decode(n),n=Ke.string.bytesToUtf8(n||[]);try{return JSON.parse(n)}catch{return this.remove(t),null}}return n}remove(t){return this.s.remove(t),this}clear(){return this.s.clearAll(),this}},te={namespace:function(e){return new dt(br.namespace(e||"default"))},namespace_session:function(e){return new dt(br.session.namespace(e||"default"))}};var ut=(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))(ut||{});function os(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 Ee=ns.create({baseURL:import.meta.env.VITE_API_BASE,timeout:Number(import.meta.env.VITE_API_TIMEOUT)||5e3,headers:{"Content-Type":"application/json;charset=UTF-8"},withCredentials:!0}),$=class ${static clearStoreToken(){this.setStoreToken(null,0)}static getStoreToken(){let t=te.namespace("bp.ss").get("ss");if(t){let r=te.namespace("bp.ss").get("exp");return{token:JSON.parse(t),exp:r?JSON.parse(r):0}}return null}static getValidStoreToken(){let t=$.getStoreToken();return t&&t.exp>Date.now()-$.TOKEN_EXP?t.token:null}static setStoreToken(t,r){t?(te.namespace("bp.ss").set("ss",JSON.stringify(t)),te.namespace("bp.ss").set("exp",JSON.stringify(r))):te.namespace("bp.ss").clear()}static requestHandleSid(t){let r=$.getStoreToken();r&&r.exp>Date.now()-$.TOKEN_EXP&&t.headers.set($.HEADER_NAME,$.HEADER_PREFIX+r.token)}static responseHandleSid(t){let r=t.headers.get($.HEADER_NAME);if(r&&r.startsWith($.HEADER_PREFIX.trim())){r=r.replace($.HEADER_PREFIX,"");let n=r;if(r=r.split(".")[1],r&&(r=mt.string.bytesToUtf8(mt.crypt.base64_decode(r)),r)){let d=JSON.parse(r);return d.exp<Date.now()-$.TOKEN_EXP?($.clearStoreToken(),!1):($.setStoreToken(n,d.exp),!0)}$.clearStoreToken(),typeof navigator<"u"&&navigator.onLine&&(window.location.href="/")}return!1}};F($,"HEADER_NAME","Authorization"),F($,"HEADER_PREFIX","SPBearer "),F($,"TOKEN_EXP",20*1e3);var pe=$;Ee.interceptors.request.use(e=>(Ve.show({delay:5e3}),pe.requestHandleSid(e),e),e=>(Ve.hide(),console.log("Request Error =========="),Promise.reject(e)));Ee.interceptors.response.use(e=>(Ve.hide(),e.data.code!==200&&K.warning(e.data.message||os(e.data.code)),pe.responseHandleSid(e),e.data),e=>(Ve.hide(),e instanceof ss&&(e.code==="ERR_NETWORK"||e.code==="ECONNABORTED"?K.error("\u7F51\u7EDC\u9519\u8BEF"):e.code==="ERR_BAD_RESPONSE"&&K.error("\u670D\u52A1\u5668\u65E0\u54CD\u5E94")),console.log("Response Error =========="),Promise.reject(e)));var l={get(e,t,r){return Ee({method:"get",url:e,params:t,data:r})},post(e,t,r){return Ee({method:"post",url:e,params:t,data:r})},put(e,t,r){return Ee({method:"put",url:e,params:t,data:r})},delete(e,t,r){return Ee({method:"delete",url:e,params:t,data:r})}};var Dt={};bt(Dt,{admin:()=>is,gateway:()=>as,message:()=>ls,role:()=>cs,user:()=>ds});var is={registerAdmin:e=>l.post("/api/admin/registerAdmin",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode}).then(t=>t),registerUser:e=>l.post("/api/admin/registerUser",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id}).then(t=>t),updateInfoByAdmin:e=>l.post("/api/admin/updateByAdmin",null,{id:e.id,is_forbidden:e.is_forbidden,title:e.title,phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id,created_at:e.created_at,tick_avatar_self:e.tick_avatar_self,role_ids:e.role_ids,isAdmin:e.isAdmin,thirdPlatformInfo:e.thirdPlatformInfo,unreadMessageCount:e.unreadMessageCount}).then(t=>t),list:e=>l.get("/api/admin/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)},as={register:e=>l.post("/api/register",null,{phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id}).then(t=>t),sendSms:e=>l.post("/api/sendSms",{phone:e.phone,imageCode:e.imageCode},null).then(t=>t),isLogin:()=>l.get("/api/isLogin",null,null).then(e=>e),login:e=>l.post("/api/login",null,{phone:e.phone,pwd:e.pwd,pwdSN:e.pwdSN,smsCode:e.smsCode}).then(t=>t),verifyPasswordHash:e=>l.post("/api/verifyPasswordHash",null,{passwordHash:e.passwordHash,passwordSalt:e.passwordSalt}).then(t=>t),logout:()=>l.get("/api/logout",null,null).then(e=>e),listPermissions:()=>l.get("/api/listPermissions",null,null).then(e=>e),listRolePermissions:e=>l.get("/api/listRolePermissions",{id:e.id},null).then(t=>t)},ls={list:e=>l.get("/api/user/message/list",{pageNum:e.pageNum,pageSize:e.pageSize,unread_only:e.unread_only},null).then(t=>t),countUnread:()=>l.get("/api/user/message/unread/count",null,null).then(e=>e),markRead:e=>l.post("/api/user/message/read",null,{messageIds:e.messageIds}).then(t=>t),clearReaded:e=>l.delete("/api/user/message/clearReaded",null,{messageIds:e.messageIds}).then(t=>t)},cs={listRoles:()=>l.get("/api/role/listRoles",null,null).then(e=>e),createRole:e=>l.post("/api/role/createRole",{name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id},null).then(t=>t),updateRole:e=>l.post("/api/role/updateRole",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id},null).then(t=>t),assignPermissionsToRole:e=>l.post("/api/role/assignPermissionsToRole",null,{role_id:e.role_id,permissions:e.permissions}).then(t=>t),assignRoleToUserPermission:()=>l.post("/api/role/assignRoleToUserPermission",null,null).then(e=>e),assignRoleToUser:e=>l.post("/api/role/assignRoleToUser",null,{user_id:e.user_id,role_ids:e.role_ids}).then(t=>t),listUserRoles:e=>l.get("/api/role/listUserRoles",{user_id:e.user_id},null).then(t=>t),listUserPermissions:e=>l.get("/api/role/listUserPermissions",{user_id:e.user_id},null).then(t=>t),listCompanies:()=>l.get("/api/role/listCompanies",null,null).then(e=>e),createCompany:e=>l.post("/api/role/createCompany",{name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id,is_spv_company:e.is_spv_company},null).then(t=>t),updateCompany:e=>l.post("/api/role/updateCompany",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,parent_id:e.parent_id,is_spv_company:e.is_spv_company},null).then(t=>t),listDepartments:()=>l.get("/api/role/listDepartments",null,null).then(e=>e),createDepartment:e=>l.post("/api/role/createDepartment",{name:e.name,descs:e.descs,admin_id:e.admin_id,company_id:e.company_id,parent_id:e.parent_id},null).then(t=>t),updateDepartment:e=>l.post("/api/role/updateDepartment",{id:e.id,name:e.name,descs:e.descs,admin_id:e.admin_id,company_id:e.company_id,parent_id:e.parent_id},null).then(t=>t),assignUserToDepartment:e=>l.post("/api/role/assignUserToDepartment",{user_id:e.user_id,department_id:e.department_id,position:e.position},null).then(t=>t),removeUserFromDepartment:e=>l.post("/api/role/removeUserFromDepartment",{user_id:e.user_id,department_id:e.department_id},null).then(t=>t),listCompanyDepartments:e=>l.get("/api/role/listCompanyDepartments",{company_id:e.company_id},null).then(t=>t),listUserDepartments:e=>l.get("/api/role/listUserDepartments",{user_id:e.user_id},null).then(t=>t),listDepartmentUsers:e=>l.get("/api/role/listDepartmentUsers",{department_id:e.department_id},null).then(t=>t)},ds={getInfoByUsername:e=>l.get("/api/user/infoByUsername",{username:e.username},null).then(t=>t),getInfo:e=>l.get("/api/user/info",{id:e.id},null).then(t=>t),getAvatar:e=>l.get("/api/user/avatar",{id:e.id,tick:e.tick},null).then(t=>t),getAvatarList:e=>l.get("/api/user/avatar_list",{ids:e.ids},null).then(t=>t),updateAvatar:e=>l.post("/api/user/updateAvatar",null,{id:e.id,avatar:e.avatar,avatar_small:e.avatar_small,tick_self:e.tick_self}).then(t=>t),updateManager:e=>l.post("/api/user/updateManager",{id:e.id,managerid:e.managerid},null).then(t=>t),updateInfo:e=>l.post("/api/user/update",null,{id:e.id,is_forbidden:e.is_forbidden,title:e.title,phone:e.phone,email:e.email,displayModules:e.displayModules,username:e.username,nickname:e.nickname,pwd:e.pwd,smsCode:e.smsCode,manager_id:e.manager_id,created_at:e.created_at,tick_avatar_self:e.tick_avatar_self,role_ids:e.role_ids,isAdmin:e.isAdmin,thirdPlatformInfo:e.thirdPlatformInfo,unreadMessageCount:e.unreadMessageCount}).then(t=>t),updatePassword:e=>l.post("/api/user/updatePassword",null,{old_password:e.old_password,old_password_sn:e.old_password_sn,new_password:e.new_password}).then(t=>t),deleteUser:e=>l.post("/api/user/delete",{id:e.id},null).then(t=>t),list:e=>l.get("/api/user/list",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),listByIds:e=>l.get("/api/user/list_by_ids",{ids:e.ids},null).then(t=>t),search:e=>l.get("/api/user/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),forbid:e=>l.post("/api/user/forbid",{id:e.id,forbid:e.forbid},null).then(t=>t)};var Et={};bt(Et,{contract:()=>ms,file:()=>us,fileversion:()=>ps,project:()=>gs,projectprogress:()=>fs});var ms={createContract:e=>l.post("/api/project/contract/create",null,{projectId:e.projectId,name:e.name,tag:e.tag,code:e.code,partyA:e.partyA,partyB:e.partyB,amount:e.amount,startDate:e.startDate,endDate:e.endDate,descs:e.descs}).then(t=>t),deleteContract:e=>l.delete("/api/project/contract/delete",{id:e.id},null).then(t=>t),updateContract:e=>l.post("/api/project/contract/update",null,{id:e.id,name:e.name,code:e.code,tag:e.tag,partyA:e.partyA,partyB:e.partyB,amount:e.amount,startDate:e.startDate,endDate:e.endDate,descs:e.descs,markdown:e.markdown}).then(t=>t),getContractDetail:e=>l.get("/api/project/contract/detail",{id:e.id},null).then(t=>t),getContractList:e=>l.get("/api/project/contract/list",{projectId:e.projectId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),submitApproval:e=>l.post("/api/project/contract/submit",{id:e.id,sealType:e.sealType},null).then(t=>t),cancelApproval:e=>l.post("/api/project/contract/cancelApproval",{id:e.id},null).then(t=>t),uploadVersion:e=>l.post("/api/project/contract/version/upload",null,{contractId:e.contractId,fileName:e.fileName,fileType:e.fileType,fileSize:e.fileSize,changeLog:e.changeLog}).then(t=>t),getVersionList:e=>l.get("/api/project/contract/version/list",{contractId:e.contractId},null).then(t=>t),deleteVersion:e=>l.delete("/api/project/contract/version/delete",{id:e.id},null).then(t=>t),renameVersion:e=>l.post("/api/project/contract/version/rename",null,{id:e.id,fileName:e.fileName}).then(t=>t),getVersionDetail:e=>l.get("/api/project/contract/version/detail",{id:e.id},null).then(t=>t),setVersionLayerOpinion:e=>l.post("/api/project/contract/version/layerOpinion",null,{contractId:e.contractId,version:e.version,opinion:e.opinion}).then(t=>t),getNewContractCode:e=>l.get("/api/project/contract/newCode",{contractCode:e.contractCode,sequenceLength:e.sequenceLength},null).then(t=>t),getContractHistoryParties:()=>l.get("/api/project/contract/historyParties",null,null).then(e=>e)},us={getDetail:e=>l.get("/api/project/files/detail",{fileId:e.fileId},null).then(t=>t),listFiles:e=>l.get("/api/project/files/list",{projectId:e.projectId},null).then(t=>t),searchFiles:e=>l.get("/api/project/files/search",{keyword:e.keyword,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),addFile:(e,t)=>l.post("/api/project/files/add",{projectId:e.projectId},{fileName:t.fileName,filePath:t.filePath,isSecure:t.isSecure,descs:t.descs,fileType:t.fileType,fileSize:t.fileSize,crc32:t.crc32,fileResourcePath:t.fileResourcePath}).then(r=>r),removeFile:e=>l.post("/api/project/files/remove",{fileId:e.fileId},null).then(t=>t),listTrashFiles:e=>l.get("/api/project/files/trash/list",{projectId:e.projectId},null).then(t=>t),restoreTrashFile:e=>l.post("/api/project/files/trash/restore",{fileId:e.fileId},null).then(t=>t),permanentDeleteTrashFile:e=>l.post("/api/project/files/trash/remove",{fileId:e.fileId},null).then(t=>t),emptyTrash:e=>l.post("/api/project/files/trash/empty",{projectId:e.projectId},null).then(t=>t),moveFile:(e,t)=>l.post("/api/project/files/move",{projectId:e.projectId},{oldFileName:t.oldFileName,oldFilePath:t.oldFilePath,newFileName:t.newFileName,newFilePath:t.newFilePath}).then(r=>r),updateFileDescs:e=>l.post("/api/project/files/updateDescs",null,{fileId:e.fileId,descs:e.descs}).then(t=>t),copyFileToProject:e=>l.post("/api/project/files/copyToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),moveFileToProject:e=>l.post("/api/project/files/moveToProject",{projectId:e.projectId,fileId:e.fileId},null).then(t=>t),updateFileDelta:e=>l.post("/api/project/files/updateDelta",null,{fileId:e.fileId,deltaData:e.deltaData,deltaSize:e.deltaSize,newFileSize:e.newFileSize,crc32:e.crc32,recordVersion:e.recordVersion,rotateResourcePath:e.rotateResourcePath}).then(t=>t),updateFile:e=>l.post("/api/project/files/updateData",null,{fileId:e.fileId,fileSize:e.fileSize,crc32:e.crc32,fileName:e.fileName,fileResourcePath:e.fileResourcePath,recordVersion:e.recordVersion,rotateResourcePath:e.rotateResourcePath}).then(t=>t),generateTempAccessToken:e=>l.post("/api/project/files/generateTempAccessToken",{fileId:e.fileId,expireSeconds:e.expireSeconds},null).then(t=>t),folderDownload:(e,t)=>l.post("/api/project/files/folderDownload",{projectId:e.projectId},{folderPath:t.folderPath,folderName:t.folderName}).then(r=>r),folderDownloadStatus:e=>l.get("/api/project/files/folderDownloadStatus",{jobId:e.jobId},null).then(t=>t),listFilesByTempAccessToken:e=>l.get("/api/project/files/listByTempAccessToken",{tempToken:e.tempToken},null).then(t=>t)},ps={listVersions:e=>l.get("/api/project/files/version/list",{fileId:e.fileId},null).then(t=>t),getVersionDetail:e=>l.get("/api/project/files/version/detail",{versionId:e.versionId},null).then(t=>t)},gs={enableUserPrivateProject:()=>l.post("/api/project/enablePrivateProject",null,null).then(e=>e),createProject:e=>l.post("/api/project/create",null,{name:e.name,descs:e.descs,companyId:e.companyId,markdown:e.markdown,startTime:e.startTime,plannedEndTime:e.plannedEndTime,endTime:e.endTime,leaderId:e.leaderId,customerId:e.customerId,order:e.order,isUserPrivate:e.isUserPrivate}).then(t=>t),updateProject:e=>l.post("/api/project/update",null,{id:e.id,name:e.name,descs:e.descs,companyId:e.companyId,markdown:e.markdown,status:e.status,startTime:e.startTime,plannedEndTime:e.plannedEndTime,endTime:e.endTime,leaderId:e.leaderId,customerId:e.customerId,order:e.order,isUserPrivate:e.isUserPrivate,createTime:e.createTime,updateTime:e.updateTime,createBy:e.createBy,updateBy:e.updateBy}).then(t=>t),updateUserdataOrder:e=>l.post("/api/project/updateUserdataOrder",null,{projectIds:e.projectIds}).then(t=>t),getUserdataOrder:()=>l.get("/api/project/userdataOrder",null,null).then(e=>e),getProjectDetail:e=>l.get("/api/project/detail",{id:e.id},null).then(t=>t),getProjectName:e=>l.get("/api/project/name",{projectId:e.projectId},null).then(t=>t),listProjects:e=>l.get("/api/project/list",{pageNum:e.pageNum,pageSize:e.pageSize,status:e.status,companyId:e.companyId,customerId:e.customerId,userId:e.userId},null).then(t=>t),listProjectsByManager:e=>l.get("/api/project/listByManager",{pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t),changeStatus:e=>l.put("/api/project/status",{id:e.id,status:e.status},null).then(t=>t),getProjectMembers:e=>l.get("/api/project/members",{projectId:e.projectId},null).then(t=>t),getMemberRole:e=>l.get("/api/project/member/role",{projectId:e.projectId,userId:e.userId},null).then(t=>t),assignMember:e=>l.post("/api/project/members/assign",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t),removeMember:e=>l.post("/api/project/members/remove",null,{userId:e.userId,role:e.role,projectId:e.projectId}).then(t=>t)},fs={createProgress:e=>l.post("/api/project/progress/create",null,{projectId:e.projectId,descs:e.descs,commentCount:e.commentCount,progressTime:e.progressTime}).then(t=>t),updateProgress:e=>l.put("/api/project/progress/update",null,{id:e.id,descs:e.descs,progressTime:e.progressTime}).then(t=>t),deleteProgress:e=>l.delete("/api/project/progress/delete",{id:e.id},null).then(t=>t),getProgressList:e=>l.get("/api/project/progress/list",{projectId:e.projectId},null).then(t=>t),addComment:e=>l.post("/api/project/progress/comment/add",null,{progressId:e.progressId,comment:e.comment}).then(t=>t),deleteComment:e=>l.delete("/api/project/progress/comment/delete",{id:e.id},null).then(t=>t),updateComment:e=>l.put("/api/project/progress/comment/update",{id:e.id},{}).then(t=>t),getCommentList:e=>l.get("/api/project/progress/comment/list",{progressId:e.progressId,pageNum:e.pageNum,pageSize:e.pageSize},null).then(t=>t)};var ne={base:Ut,user:Dt,project:Et};var Se=1440*60*1e3,At=class extends Cr{constructor(){super("UserInfoDB");F(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},Ot=class extends Cr{constructor(){super("UserAvatarDB");F(this,"userCache");this.version(1).stores({userCache:"id, timestamp"})}},ce=new At,de=new Ot,Ir=async e=>{try{let t=await de.userCache.get(e);if(t){if(Date.now()-t.timestamp<Se)return t.avatar;await de.userCache.delete(e)}return null}catch(t){return console.error("\u8BFB\u53D6\u7528\u6237\u5934\u50CF\u7F13\u5B58\u5931\u8D25:",t),null}},Mt=async e=>{try{let t=await ce.userCache.get(e);if(t){let r=Date.now(),n=await de.userCache.get(e);if(n?r-n.timestamp<Se?t.data.avatar=n.avatar:(t.data.avatar=void 0,await de.userCache.delete(e)):t.data.avatar=void 0,r-t.timestamp<Se)return t.data;await ce.userCache.delete(e)}return null}catch(t){return console.error("\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",t),null}},ys=async(e,t)=>{try{t&&await de.userCache.put({id:e,avatar:t,timestamp:Date.now()})}catch(r){console.error("\u5199\u5165\u7528\u6237\u5934\u50CF\u7F13\u5B58\u5931\u8D25:",r)}},hs=async(e,t)=>{try{t.avatar&&await de.userCache.put({id:e,avatar:t.avatar,timestamp:Date.now()});let r=t.avatar;t.avatar=void 0,await ce.userCache.put({id:e,data:t,timestamp:Date.now()}),t.avatar=r}catch(r){console.error("\u5199\u5165\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}},bs=async e=>{let t=new Map;try{let r=await ce.userCache.bulkGet(e),n=Date.now();for(let s=0;s<e.length;s++){let a=r[s];a&&n-a.timestamp<Se&&t.set(e[s],a.data)}let d=await de.userCache.bulkGet(e);for(let s=0;s<e.length;s++){let a=d[s];if(!a)continue;let o=t.get(a.id);o&&n-a.timestamp<Se&&(o.avatar=a.avatar)}}catch(r){console.error("\u6279\u91CF\u8BFB\u53D6\u7528\u6237\u7F13\u5B58\u5931\u8D25:",r)}return t},vr=async e=>{try{let t=e.map(n=>({id:n.id,data:n.data,timestamp:Date.now()})),r=e.map(n=>({id:n.id,avatar:n.data.avatar,timestamp:Date.now()}));r=r.filter(n=>n.avatar),await de.userCache.bulkPut(r),t.forEach(n=>{n.data.avatar=void 0}),await ce.userCache.bulkPut(t)}catch(t){console.error("\u6279\u91CF\u5199\u5165\u7528\u6237\u7F13\u5B58\u5931\u8D25:",t)}},vs=async()=>{let e=new Map;try{let t=Date.now(),r=await ce.userCache.toArray();for(let n of r)if(t-n.timestamp<Se){let d=await de.userCache.get(n.id);d&&t-d.timestamp<Se&&(n.data.avatar=d.avatar),e.set(n.id,n.data)}else await ce.userCache.delete(n.id)}catch(t){console.error("\u83B7\u53D6\u6240\u6709\u7F13\u5B58\u5931\u8D25:",t)}return e},Cs=async()=>{try{await ce.userCache.clear(),await de.userCache.clear()}catch(e){console.error("\u6E05\u9664\u7528\u6237\u7F13\u5B58\u5931\u8D25:",e)}},Rr=async({user_id:e,forceRefresh:t=!1,forceAvatar:r=!1})=>{let n={code:200,data:{user_id:e,isLogin:!0}},d=!1;if(!e)try{n=await ne.user.gateway.isLogin()}catch{d=!0}if(d){let s;try{let o=te.namespace("bp.ss").get("user");o&&(s=JSON.parse(o)?.id)}catch{}let a=e??s;if(a){let o=await Mt(a);if(o){let i=await xe({user_id:a,forceRefresh:!1,serverTick:o.tick_avatar_self});return i&&(o.avatar=i),o}}try{let o=te.namespace("bp.ss").get("user");if(o)return JSON.parse(o)}catch{}return null}if(n?.code===200&&n.data?.isLogin){let s=n.data?.user_id,a=n.data?.isAdmin||!1,o=await Mt(s);if(t||!o)try{let i=await ne.user.user.getInfo({id:s});if(i?.code==200){e||te.namespace("bp.ss").set("user",JSON.stringify(i.data));let c={...i.data};s&&await hs(s,c);try{let m=await xe({user_id:s,forceRefresh:r,serverTick:i.data?.tick_avatar_self});m&&(c.avatar=m)}catch{}return c}else return o||null}catch{if(o)return o;try{let c=te.namespace("bp.ss").get("user");if(c)return JSON.parse(c)}catch{}return null}try{let i=await xe({user_id:s,forceRefresh:r,serverTick:o.tick_avatar_self});i&&(o.avatar=i)}catch{}return o}else return pe.clearStoreToken(),null},xe=async({user_id:e,forceRefresh:t=!1,serverTick:r=Number.MAX_SAFE_INTEGER})=>{if(!e)return;let n=await Ir(e);if(t||!n){let d=n?.avatar_tick||-1;if(d<r)try{let s=await ne.user.user.getAvatar({id:e,tick:d});s?.code==200&&d!=s.data?.tick_self&&(n={avatar:jt.string.isEmpty(s.data?.avatar)?void 0:s.data?.avatar,avatar_small:jt.string.isEmpty(s.data?.avatar_small)?void 0:s.data?.avatar_small,avatar_tick:s.data?.tick_self||-1},await ys(e,n))}catch{}}return n||void 0},Is=async e=>(e=e||{forceRefresh:!1},await Rr(e)),Rs=()=>{let e=te.namespace("bp.ss").get("user");return e?JSON.parse(e):null},ws=async({userIds:e,keywords:t,forceRefresh:r=!1})=>{let n=new Map;if(!e){if(!r&&(!t||t.length===0)){let c=await vs();if(c.size>=100){let m=new Map,C=0;for(let[b,w]of c){if(C>=100)break;let _=await xe({user_id:b,forceRefresh:!1,serverTick:w.tick_avatar_self});w.avatar=_,m.set(b,w),C++}return m}return c}let a;if(t&&t.length>0){if(a=await ne.user.user.search({pageNum:1,pageSize:100,keyword:t}),a?.code!==200)return n}else if(a=await ne.user.user.list({pageNum:1,pageSize:100}),a?.code!==200)return n;let o=a.data?.list||[],i=[];for(let c of o){let m={...c};n.set(c.id,m),i.push({id:c.id,data:m})}i.length>0&&await vr(i);for(let c=0;c<i.length;c++){let m=await xe({user_id:i[c].id,serverTick:i[c].data.tick_avatar_self});i[c].data.avatar=m}return n}if(e.length==0)return n;let d=[...new Set(e)];r||(await bs(d)).forEach((o,i)=>{n.set(i,o)});let s=d.filter(a=>!n.has(a));if(s.length===0)return n;try{let a=await ne.user.user.listByIds({ids:JSON.stringify(s)});if(a?.code!=200)return n;let o=a.data?.list||[];if(o.length>0){let c=[];for(let m of o){let C={...m};c.push({id:m.id,data:C})}await vr(c)}let i=[];if(o.length>0)for(let c of o){let m=await xe({user_id:c.id,serverTick:c.tick_avatar_self||-1});i.push({id:c.id,avatar_small:m?.avatar_small||"",avatar_tick:c.tick_avatar_self||-1})}for(let c of o){let m=i.find(b=>b.id==c.id),C={...c,avatar:{avatar:"",avatar_small:m?.avatar_small||"",avatar_tick:m?.avatar_tick||-1}};n.set(c.id,C)}}catch(a){console.error("\u6279\u91CF\u83B7\u53D6\u7528\u6237\u4FE1\u606F\u5931\u8D25:",a)}return n},Ts=async e=>{e?await ce.userCache.delete(e):await Cs()},Ps=async()=>{try{let e=await ce.userCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},pt={getFromCache:Mt,getAvatarFromCache:Ir,getUserInfo:Rr,getUserAvatar:xe,current:Is,currentLocalUser:Rs,getUserInfos:ws,clearUserCache:Ts,getCacheStats:Ps};import{Fragment as Ft,jsx as U,jsxs as se}from"react/jsx-runtime";var Ba=({commentList:e,showTitle:t,showTimePicker:r,onDeleteComment:n,onLoadSubComments:d,commentListMap:s,onSaveComment:a,onSaveSubComment:o})=>{let[i,c]=Ie.useState(window.innerWidth<768),[m,C]=Ie.useState(new Map),[b,w]=Ie.useState(!1),[_,j]=Ie.useState(null),[P]=_e.useForm(),[A,N]=Ie.useState(!1),[I,R]=Ie.useState(null),[T]=_e.useForm(),D=Ie.useMemo(()=>{let v=new Set;return e.forEach(S=>{S.createBy&&v.add(S.createBy),s[S.id]?.comments.forEach(G=>{G.createBy&&v.add(G.createBy)})}),Array.from(v)},[e,s]);Ie.useEffect(()=>{if(D.length===0)return;let v=!0;return pt.getUserInfos({userIds:D}).then(S=>{v&&C(G=>new Map([...G,...S]))}).catch(S=>{console.error("\u52A0\u8F7D\u8BC4\u8BBA\u7528\u6237\u4FE1\u606F\u5931\u8D25:",S)}),()=>{v=!1}},[D]),hr(()=>{c(!0)},()=>{c(!1)},768);let O=async v=>{j(v),P.resetFields(),w(!0)},x=v=>{v?(R(v),T.setFieldsValue({descs:v.descs,progressTime2:xr(v.progressTime)})):(R(null),T.resetFields(),T.setFieldsValue({progressTime2:xr()})),N(!0)},B=async()=>{try{if(!_)return;let v=await P.validateFields();if(!v)return;await o?.({commentId:_.id,comment:v.comment})&&(K.success("\u56DE\u590D\u5DF2\u63D0\u4EA4"),w(!1),d?.(_.id))}catch(v){console.error(v),K.error("\u63D0\u4EA4\u56DE\u590D\u5931\u8D25")}},W=async()=>{try{let v=await T.validateFields();I?(await a?.({commentItem:I,comment:v.descs,time:v.progressTime2.toDate()}),K.success("\u66F4\u65B0\u6210\u529F")):(await a?.({commentItem:null,comment:v.descs,time:v.progressTime2.toDate()}),K.success("\u65B0\u589E\u6210\u529F")),N(!1),R(null)}catch(v){console.error(v),K.error("\u4FDD\u5B58\u5931\u8D25")}};return se(Ft,{children:[U("div",{className:"flex justify-end items-center mb-5 ml-4",children:U(gt,{type:"primary",onClick:()=>x(),className:"px-4 py-2 btn-primary flex items-center",children:"\u65B0\u589E"})}),e.length?U(xs,{mode:"left",className:"ml-5 md:pr-[200px]",items:e.map(v=>({key:v.id,color:"blue",label:i&&t?null:Je(new Date(v.progressTime)),style:{paddingBottom:"5px"},children:se(Ft,{children:[i&&t&&U("div",{className:"mt-2 mb-1 font-bold",children:Je(new Date(v.progressTime))}),se("div",{className:"rounded border border-gray-100 bg-gray-50 p-2",children:[se("div",{className:"flex justify-between items-start mb-2 ",children:[se("div",{className:"flex items-center space-x-2",children:[U(wr,{src:m.get(v.createBy)?.avatar?.avatar_small||null,size:40,children:m.get(v.createBy)?.nickname?.[0]}),se("div",{children:[U("div",{className:"",children:m.get(v.createBy)?.nickname}),U("div",{className:"text-xs font-thin",children:Je(new Date(v.updateTime))})]})]}),U("div",{className:"mt-4 flex justify-end absolute right-1 top-1",children:U(Ss,{menu:{items:[{key:"edit",icon:U(Ns,{}),label:"\u7F16\u8F91",onClick:S=>{x?.(v),S.domEvent.stopPropagation()}},{key:"delete",icon:U(Us,{}),label:"\u5220\u9664",danger:!0,onClick:S=>{n?.(v.id),S.domEvent.stopPropagation()}}]},trigger:["click"],children:U(gt,{type:"text",icon:U(ks,{}),onClick:S=>S.stopPropagation()})})})]}),U("div",{className:"whitespace-pre-wrap ml-2",style:{whiteSpace:"pre-wrap"},children:v.descs}),se("div",{className:"flex items-center space-x-1 mt-1",children:[U(gt,{type:"text",icon:U(Ds,{}),className:"font-thin text-xs",size:"small",style:{color:"#666"},onClick:()=>O(v),children:"\u56DE\u590D"}),se(gt,{type:"text",size:"small",style:{color:"#666"},className:"font-thin text-xs",onClick:()=>d?.(v.id),children:[s[v.id]&&s[v.id].expanded?"\u6536\u8D77":"\u5C55\u5F00"+v.commentCount+"\u6761","\u56DE\u590D"]})]})]}),U("div",{className:"border-l border-gray-200 pl-3",children:s[v.id]&&s[v.id].expanded&&s[v.id].comments.length>0?s[v.id].comments.map(S=>U("div",{className:"p-1 text-sm",children:U("div",{className:"flex items-center space-y-2 mb-1 mt-1",children:se("div",{className:"flex items-center space-x-2",children:[U(wr,{src:m.get(S.createBy)?.avatar?.avatar_small||null,size:40,className:"self-start",children:m.get(S.createBy)?.nickname?.[0]}),se("div",{children:[U("div",{className:"text-gray-600 text-xs",children:m.get(S.createBy)?.nickname}),U("div",{className:"text-gray-700",children:S.comment}),U("div",{className:"text-xs mt-1 font-thin",children:Je(new Date(S.createTime))})]})]})})},S.id)):U(Ft,{})})]})}))}):yr(),U(Tr,{open:b,onCancel:()=>{j(null),w(!1)},className:"ant-modal-nofull",onOk:B,okText:"\u63D0\u4EA4",cancelText:"\u53D6\u6D88",children:U(_e,{form:P,layout:"horizontal",className:"mt-6",children:U(_e.Item,{name:"comment",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56DE\u590D\u5185\u5BB9"}],children:U(Pr.TextArea,{rows:4,placeholder:"\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u590D"})})})}),U(Tr,{title:I?"\u7F16\u8F91":"\u65B0\u589E",open:A,className:"ant-modal-nofull",onCancel:()=>{N(!1),R(null)},onOk:W,okText:"\u4FDD\u5B58",cancelText:"\u53D6\u6D88",children:se(_e,{form:T,layout:"horizontal",children:[r&&U(_e.Item,{name:"progressTime2",label:"\u65F6\u95F4",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u65F6\u95F4"}],children:U(_s,{showTime:!0,style:{width:"100%"}})}),U(_e.Item,{name:"descs",label:"\u5185\u5BB9",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5185\u5BB9"}],children:U(Pr.TextArea,{rows:4,placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9"})})]})})]})};import{useEffect as Qe,useState as je,useCallback as Re,useRef as zt,useMemo as Sr}from"react";import{Select as Es,Spin as js,message as As,Popover as Ht,Card as Os,Typography as Ms,Space as Fs}from"antd";import{debounce as Bs}from"lodash-es";import Ls from"react-dom/client";var Bt=class{constructor(){F(this,"cache",new Map);F(this,"defaultExpireTime",300*1e3)}set(t,r,n=this.defaultExpireTime){this.cache.set(t,{data:r,timestamp:Date.now(),expireTime:n})}get(t){let r=this.cache.get(t);return r?Date.now()-r.timestamp>r.expireTime?(this.cache.delete(t),null):r.data:null}clear(){this.cache.clear()}},Lt=new Bt;import{jsx as z,jsxs as _r}from"react/jsx-runtime";var{Text:Za}=Ms,zs=({multiple:e=!1,allowClear:t=!0,timeout:r=1e4,retryCount:n=3,enableCache:d=!0,excludeProjectIds:s=[],cacheExpireTime:a,value:o,onChange:i,...c})=>{let[m,C]=je(!1),[b,w]=je([]),[_,j]=je(""),[P,A]=je(1),[N,I]=je(!0),[R,T]=je([]),D=zt(null),O=zt([]),x=zt([]);Qe(()=>{O.current=b},[b]),Qe(()=>{x.current=R},[R]);let B=Re(p=>p.map(y=>{let h=O.current.find(u=>u.id===y);return h||x.current.find(u=>u.id===y)}).filter(y=>y!==void 0),[]),W=Re(p=>{if(!p){T([]),i?.([],[]);return}let y=e?Array.isArray(p)?p:[p]:typeof p=="string"?[p]:[];if(y.length===0){T([]),i?.([],[]);return}let h=B(y);T(h),i?.(y,h)},[B,i,e]);Qe(()=>{if(!o||o.length==0){T([]);return}let p=e?Array.isArray(o)?o:[]:typeof o=="string"?[o]:[],y=B(p);T(y)},[o,B,e]);let v=Re(async(p,y=n)=>{try{D.current=new AbortController;let h=D.current.signal,u=new Promise((g,E)=>{setTimeout(()=>{E(new Error("\u8BF7\u6C42\u8D85\u65F6")),D.current?.abort()},r)});return await Promise.race([p(),u])}catch(h){if(y>0&&!(h instanceof Error&&h.name==="AbortError"))return await new Promise(u=>setTimeout(u,1e3)),v(p,y-1);throw h}},[r,n]),S=Re(async(p,y=!1)=>{try{C(!0);let h=`projects_${p}`;if(d&&!p){let f=Lt.get(h);if(f){w(g=>y?[...g,...f]:f),I(!1);return}}let u=await v(async()=>{let f=await ne.project.project.listProjects({pageNum:P,pageSize:1e3});return f.code===200&&f.data?{...f,data:f.data.list.map(g=>({id:g.id,name:g.name,descs:g.descs}))}:f});if(u.code===200&&u.data){let f=u.data.filter(g=>!s.includes(g.id));d&&!p&&Lt.set(h,f,a),w(g=>y?[...g,...f]:f),I(!1)}}catch(h){console.error("\u83B7\u53D6\u9879\u76EE\u5217\u8868\u5931\u8D25:",h),As.error("\u83B7\u53D6\u9879\u76EE\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{C(!1)}},[s,v,P,d,a]);Qe(()=>()=>{D.current?.abort()},[]);let G=Sr(()=>Bs(p=>{j(p),A(1),S(p,!1)},300),[S]),Q=Re(p=>{let{target:y}=p;if(!y)return;let{scrollTop:h,scrollHeight:u,clientHeight:f}=y;if(u-h<=f*1.5&&!m&&N){let g=P+1;A(g),S(_,!0)}},[m,N,P,_,S]);Qe(()=>{S("",!1)},[S]);let X=p=>z(Os,{size:"small",style:{width:280},children:z(Fs,{direction:"vertical",size:"small",style:{width:"100%"},children:z("div",{style:{display:"flex",alignItems:"center",gap:8},children:z("div",{children:z("div",{style:{fontWeight:"bold"},children:p.name})})})})}),fe=p=>{let y=[];return y.push(z("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:p.name},"name")),z("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:y})},ye=Sr(()=>b.map(p=>({key:p.id,label:fe(p),value:p.id,user:p})),[b]),oe=Re(p=>{let{value:y,closable:h,onClose:u}=p,f=b.find(g=>g.id===y)||R.find(g=>g.id===y);return f?z(Ht,{content:X(f),trigger:"click",placement:"right",children:_r("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[z("span",{style:{marginRight:8},children:f.name}),h&&z("span",{onClick:u,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):z("div",{children:y})},[b,R]),he=Re(p=>{let y=b.find(h=>h.id===p)||R.find(h=>h.id===p);return y?z(Ht,{content:X(y),trigger:"click",placement:"right",children:z("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:z("span",{children:y.name})})}):z("div",{children:p})},[b,R]),me=Re(p=>{if(!p)return null;let y=Array.isArray(p)?p[0]:p;return b.find(h=>h.id===y)||R.find(h=>h.id===y)},[b,R]);return z(Es,{...c,mode:e?"multiple":void 0,showSearch:!0,loading:m,filterOption:!1,onSearch:G,onPopupScroll:Q,notFoundContent:m?z(js,{size:"small"}):null,allowClear:t,value:e||typeof o=="string"?o:o?.toString(),onChange:W,options:ye,style:{...c.style,minHeight:"32px"},tagRender:e?oe:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:p=>{let y=me(o);return y?_r("div",{children:[z("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:he(y.id)}),p]}):p},suffixIcon:e?void 0:o?z("div",{onClick:p=>{p.stopPropagation();let y=me(o);if(y){let h=document.createElement("div");document.body.appendChild(h);let u=Ls.createRoot(h);u.render(z(Ht,{content:X(y),trigger:"click",placement:"right",open:!0,onOpenChange:f=>{f||(u.unmount(),document.body.removeChild(h))},children:z("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:z("span",{className:"ant-select-arrow"})}):z("span",{className:"ant-select-arrow"})})},Hs=zs;import{useEffect as Ze,useState as Ae,useCallback as we,useRef as Xt,useMemo as Ur}from"react";import{Select as Zs,Spin as eo,message as to,Popover as Gt,Card as ro,Typography as no,Space as so}from"antd";import{debounce as oo}from"lodash-es";import io from"react-dom/client";import Ws from"dexie";var Vs=3600*1e3,Wt=class extends Ws{constructor(){super("RoleInfoDB");F(this,"roleCache");this.version(1).stores({roleCache:"id, timestamp"})}},Ye=new Wt,qs=async()=>{try{let e=await Ye.roleCache.get("ROLE_ALL");if(e){if(Date.now()-e.timestamp<Vs)return e.data;await Ye.roleCache.delete("ROLE_ALL")}return null}catch(e){return console.error("\u8BFB\u53D6\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e),null}},$s=async e=>{try{await Ye.roleCache.put({id:"ROLE_ALL",data:e,timestamp:Date.now()})}catch(t){console.error("\u5199\u5165\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",t)}},Xs=async()=>{try{await Ye.roleCache.clear()}catch(e){console.error("\u6E05\u9664\u89D2\u8272\u7F13\u5B58\u5931\u8D25:",e)}},qt=async({forceRefresh:e=!1})=>{if(!e){let n=await qs();if(n)return n}let t=await ne.user.role.listRoles();if(t?.code!==200)return null;let r=t.data||[];return await $s(r),r},kr=async({roleId:e,forceRefresh:t=!1})=>{let r=await qt({forceRefresh:t});return r&&r.find(n=>n.id===e)||null},Gs=async({roleId:e,forceRefresh:t=!1})=>(await kr({roleId:e,forceRefresh:t}))?.name||"",Vt=async({forceRefresh:e=!1}={})=>{let t=await qt({forceRefresh:e}),r={};return(t||[]).forEach(n=>{r[n.id]=n.name}),r},Js=async({roleIds:e})=>{let t=await Vt();return(e||[]).filter(n=>!!n&&!t[n]).length>0&&(t=await Vt({forceRefresh:!0})),t},Ks=async()=>{await Xs()},Qs=async()=>{try{let e=await Ye.roleCache.toArray();if(e.length===0)return{count:0,oldest:null,newest:null};let t=e.map(r=>r.timestamp);return{count:e.length,oldest:Math.min(...t),newest:Math.max(...t)}}catch(e){return console.error("\u83B7\u53D6\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",e),{count:0,oldest:null,newest:null}}},Nr={getRoleList:qt,getRoleById:kr,getRoleNameById:Gs,getRoleNameMap:Vt,getRoleNameMapForIds:Js,clearRoleCache:Ks,getCacheStats:Qs};var $t=class{constructor(){F(this,"cache",new Map);F(this,"defaultExpireTime",300*1e3)}set(t,r,n=this.defaultExpireTime){this.cache.set(t,{data:r,timestamp:Date.now(),expireTime:n})}get(t){let r=this.cache.get(t);return r?Date.now()-r.timestamp>r.expireTime?(this.cache.delete(t),null):r.data:null}clear(){this.cache.clear()}},ft=new $t;function Ys(){ft.clear()}import{jsx as H,jsxs as Dr}from"react/jsx-runtime";var{Text:bl}=no,ao=({multiple:e=!1,allowClear:t=!0,timeout:r=1e4,retryCount:n=3,enableCache:d=!0,excludeRoleIds:s=[],cacheExpireTime:a,value:o,onChange:i,...c})=>{let[m,C]=Ae(!1),[b,w]=Ae([]),[_,j]=Ae(""),[P,A]=Ae(1),[N,I]=Ae(!0),[R,T]=Ae([]),D=Xt(null),O=Xt([]),x=Xt([]);Ze(()=>{O.current=b},[b]),Ze(()=>{x.current=R},[R]);let B=we(p=>p.map(y=>{let h=O.current.find(u=>u.id===y);return h||x.current.find(u=>u.id===y)}).filter(y=>y!==void 0),[]),W=we(p=>{if(!p){T([]),i?.([],[]);return}let y=e?Array.isArray(p)?p:[p]:typeof p=="string"?[p]:p;if(y.length===0){T([]),i?.([],[]);return}let h=B(y);T(h),i?.(y,h)},[B,i,e]);Ze(()=>{if(!o||o.length==0){T([]);return}let p=e?Array.isArray(o)?o:[]:typeof o=="string"?[o]:[],y=B(p);if(R.length==y.length){let h=0;for(h=0;h<y.length&&!R.find(u=>u.id==y[h].id?u:null);h++);if(h<y.length)return}T(y)},[o,B,e]);let v=we(async(p,y=n)=>{try{D.current=new AbortController;let h=D.current.signal,u=new Promise((g,E)=>{setTimeout(()=>{E(new Error("\u8BF7\u6C42\u8D85\u65F6")),D.current?.abort()},r)});return await Promise.race([p(),u])}catch(h){if(y>0&&!(h instanceof Error&&h.name==="AbortError"))return await new Promise(u=>setTimeout(u,1e3)),v(p,y-1);throw h}},[r,n]),S=we(async(p,y=!1)=>{try{C(!0);let h=`roles_${p}`;if(d&&!p){let g=ft.get(h);if(g){w(E=>y?[...E,...g]:g),I(!1);return}}let f=(await v(async()=>await Nr.getRoleList({forceRefresh:!0})||[])).filter(g=>!s.includes(g.id));d&&!p&&ft.set(h,f,a),w(g=>y?[...g,...f]:f),I(!1)}catch(h){console.error("\u83B7\u53D6\u89D2\u8272\u5217\u8868\u5931\u8D25:",h),to.error("\u83B7\u53D6\u89D2\u8272\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{C(!1)}},[s,v,d,a]);Ze(()=>()=>{D.current?.abort()},[]);let G=Ur(()=>oo(p=>{j(p),A(1),S(p,!1)},300),[S]),Q=we(p=>{let{target:y}=p;if(!y)return;let{scrollTop:h,scrollHeight:u,clientHeight:f}=y;if(u-h<=f*1.5&&!m&&N){let g=P+1;A(g),S(_,!0)}},[m,N,P,_,S]);Ze(()=>{S("",!1)},[S]);let X=p=>H(ro,{size:"small",style:{width:280},children:H(so,{direction:"vertical",size:"small",style:{width:"100%"},children:H("div",{style:{display:"flex",alignItems:"center",gap:8},children:H("div",{children:H("div",{style:{fontWeight:"bold"},children:p.name})})})})}),fe=p=>{let y=[];return y.push(H("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:p.name},"name")),H("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:y})},ye=Ur(()=>b.map(p=>({label:fe(p),value:p.id,user:p})),[b]),oe=we(p=>{let{value:y,closable:h,onClose:u}=p,f=b.find(g=>g.id===y)||R.find(g=>g.id===y);return f?H(Gt,{content:X(f),trigger:"click",placement:"right",children:Dr("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[H("span",{style:{marginRight:8},children:f.name}),h&&H("span",{onClick:u,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):H("div",{children:y})},[b,R]),he=we(p=>{let y=b.find(h=>h.id===p)||R.find(h=>h.id===p);return y?H(Gt,{content:X(y),trigger:"click",placement:"right",children:H("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:H("span",{children:y.name})})}):H("div",{children:p})},[b,R]),me=we(p=>{if(!p)return null;let y=Array.isArray(p)?p[0]:p;return b.find(h=>h.id===y)||R.find(h=>h.id===y)},[b,R]);return H(Zs,{...c,mode:e?"multiple":void 0,showSearch:!0,loading:m,filterOption:!1,onSearch:G,onPopupScroll:Q,notFoundContent:m?H(eo,{size:"small"}):null,allowClear:t,value:e||typeof o=="string"?o:o?.toString(),onChange:W,options:ye,style:{...c.style,minHeight:"32px"},tagRender:e?oe:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:p=>{let y=me(o);return y?Dr("div",{children:[H("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:he(y.id)}),p]}):p},suffixIcon:e?void 0:o?H("div",{onClick:p=>{p.stopPropagation();let y=me(o);if(y){let h=document.createElement("div");document.body.appendChild(h);let u=io.createRoot(h);u.render(H(Gt,{content:X(y),trigger:"click",placement:"right",open:!0,onOpenChange:f=>{f||(u.unmount(),document.body.removeChild(h))},children:H("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:H("span",{className:"ant-select-arrow"})}):H("span",{className:"ant-select-arrow"})})},lo=ao;import{useEffect as Oe,useState as Me,useCallback as ke,useRef as Jt,useMemo as Kt}from"react";import{Select as co,Avatar as yt,Spin as mo,message as uo,Popover as Qt,Card as po,Typography as go,Space as fo}from"antd";import{debounce as yo}from"lodash-es";import ho from"react-dom/client";import{jsx as M,jsxs as ge}from"react/jsx-runtime";var{Text:et}=go,bo=({multiple:e=!1,userType:t="all",excludeUserIds:r=[],showAvatar:n=!0,showUsername:d=!0,showNickname:s=!0,showPhone:a=!0,searchFields:o=["username","nickname","phone"],pageSize:i=10,allowClear:c=!0,value:m,initialUsers:C,onChange:b,...w})=>{let[_,j]=Me(!1),[P,A]=Me([]),[N,I]=Me(""),[R,T]=Me(1),[D,O]=Me(!0),[x,B]=Me([]),W=Jt([]),v=Jt([]),S=Jt([]),G=ke(u=>W.current.find(f=>f.id===u)||v.current.find(f=>f.id===u)||(S.current||[]).find(f=>f.id===u),[]);Oe(()=>{S.current=C||[]},[C]);let Q=ke(async u=>{try{j(!0);let f=await pt.getUserInfos({keywords:u||"",forceRefresh:!1}),g=Array.from(f.values());g=g.filter(k=>k.username!=="admin"),t==="admin"?g=g.filter(k=>k.isAdmin):t==="user"&&(g=g.filter(k=>!k.isAdmin)),u&&(g=g.filter(k=>o.some(J=>{let Yt=k[J];return Yt&&Yt.toLowerCase().includes(u.toLowerCase())}))),r.length>0&&(g=g.filter(k=>!r.includes(k.id))),g.sort((k,J)=>(k.username||"").localeCompare(J.username||""));let E=g;A(k=>[...k,...E]),O(!1)}catch(f){console.error("\u83B7\u53D6\u4EBA\u5458\u5217\u8868\u5931\u8D25:",f),uo.error("\u83B7\u53D6\u4EBA\u5458\u5217\u8868\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{j(!1)}},[t,r,o]);Oe(()=>{Q(null)},[Q]),Oe(()=>{W.current=P},[P]),Oe(()=>{v.current=x},[x]);let X=ke(u=>{if(!u||u.length==0){B([]),b?.([],[]);return}let f=Array.isArray(u)?u:[u],g=[];for(let E=0;E<f.length;E++){let k=f[E],J=G(k);J?g.push(J):g.push({id:k,username:k,nickname:"",phone:"",avatar:{avatar_small:""}})}if(x.length==g.length){let E=0;for(E=0;E<g.length&&!x.find(k=>k.id==g[E].id?k:null);E++);if(E<g.length)return}B(g.slice()),b?.(f,g)},[b,x]);Oe(()=>{if(!m||m.length==0){if(!x||x.length==0)return;B([]);return}m.sort();let u=[];x&&(u=x.map(f=>f.id),u.sort()),m.join(",")!=u.join(",")&&X(m)},[m,e,X,x]),Oe(()=>{if(!m||m.length==0)return;let f=m.map(g=>{let E=G(g);return E||{id:g,username:g,nickname:"",phone:"",type:null}}).filter(g=>g!==void 0);B(g=>g.length!==f.length||g.some((E,k)=>E.id!==f[k]?.id||E.username!==f[k]?.username)?f:g)},[P,m,C,G]);let fe=Kt(()=>yo(u=>{I(u),T(1),Q(u)},300),[Q]),ye=ke(u=>{let{target:f}=u;if(!f)return;let{scrollTop:g,scrollHeight:E,clientHeight:k}=f;if(E-g<=k*1.5&&!_&&D){let J=R+1;T(J),Q(N)}},[_,D,R,N,Q]),oe=u=>M(po,{size:"small",style:{width:280},children:ge(fo,{direction:"vertical",size:"small",style:{width:"100%"},children:[ge("div",{style:{display:"flex",alignItems:"center",gap:8},children:[M(yt,{src:u?.avatar?.avatar_small,size:40,children:u.nickname?.[0]||u.username?.[0]}),ge("div",{children:[M("div",{style:{fontWeight:"bold"},children:u.nickname||u.username}),u.title&&M(et,{type:"secondary",style:{fontSize:12},children:u.title})]})]}),u.phone&&ge("div",{children:[M(et,{type:"secondary",style:{fontSize:12},children:"\u624B\u673A\u53F7\uFF1A"}),M(et,{style:{fontSize:12},children:u.phone})]}),u.departmentInfo?.department_names&&ge("div",{children:[M(et,{type:"secondary",style:{fontSize:12},children:"\u6240\u5C5E\u90E8\u95E8\uFF1A"}),M(et,{style:{fontSize:12},children:u.departmentInfo?.department_names.join("\u3001")})]})]})}),he=Kt(()=>u=>{let f=[];return n&&f.push(M(yt,{src:u?.avatar?.avatar_small,size:20,style:{marginRight:8,verticalAlign:"middle",flexShrink:0},children:u.nickname?.[0]||u.username?.[0]},"avatar")),s&&u.nickname&&f.push(M("span",{style:{verticalAlign:"middle",lineHeight:"20px"},children:u.nickname},"nickname")),d&&f.push(ge("span",{style:{marginLeft:8,color:"rgb(var(--color-gray-400))",verticalAlign:"middle",lineHeight:"20px"},children:["(",u.username,")"]},"username")),a&&u.phone&&f.push(M("span",{style:{marginLeft:8,color:"rgb(var(--color-gray-400))",verticalAlign:"middle",lineHeight:"20px"},children:u.phone},"phone")),M("div",{style:{display:"flex",alignItems:"center",minHeight:"24px"},children:f})},[n,d,s,a]),me=Kt(()=>[...P,...x].filter((g,E,k)=>k.findIndex(J=>J.id===g.id)===E).map(g=>({label:he(g),value:g.id,user:g})),[P,x,he]),p=ke(u=>{let{value:f,closable:g,onClose:E}=u,k=P.find(J=>J.id===f)||x.find(J=>J.id===f)||(C||[]).find(J=>J.id===f);return k?M(Qt,{content:oe(k),trigger:"click",placement:"right",children:ge("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 8px",background:"rgb(var(--color-gray-100))",borderRadius:4,margin:"2px 4px",border:"1px solid rgb(var(--color-border))"},children:[M(yt,{src:k?.avatar?.avatar_small,size:20,style:{marginRight:8},children:k.nickname?.[0]||k.username?.[0]}),M("span",{style:{marginRight:8},children:k.nickname||k.username}),g&&M("span",{onClick:E,style:{cursor:"pointer",color:"rgb(var(--color-gray-400))",fontSize:12,padding:"0 4px"},children:"\xD7"})]})}):M("div",{children:f})},[P,x,C]),y=ke(u=>{let f=P.find(g=>g.id===u)||x.find(g=>g.id===u)||(C||[]).find(g=>g.id===u);return f?M(Qt,{content:oe(f),trigger:"click",placement:"right",children:ge("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",height:"100%"},children:[M(yt,{src:f?.avatar?.avatar_small,size:20,style:{marginRight:8},children:f.nickname?.[0]||f.username?.[0]}),M("span",{children:f.nickname||f.username})]})}):M("div",{children:u})},[P,x,C]),h=ke(u=>{if(!u||u.length==0)return null;let f=u[0];return P.find(g=>g.id===f)||x.find(g=>g.id===f)||(C||[]).find(g=>g.id===f)},[P,x,C]);return M(co,{...w,mode:e?"multiple":void 0,showSearch:!0,loading:_,filterOption:!1,onSearch:fe,onPopupScroll:ye,notFoundContent:_?M(mo,{size:"small"}):null,allowClear:c,value:m,onChange:X,options:me,style:{...w.style,minHeight:"32px"},tagRender:e?p:void 0,fieldNames:{label:"label",value:"value"},popupRender:e?void 0:u=>{let f=h(m);return f?ge("div",{children:[M("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgb(var(--color-border))",cursor:"pointer"},children:y(f.id)}),u]}):u},suffixIcon:e?void 0:m?M("div",{onClick:u=>{u.stopPropagation();let f=h(m);if(f){let g=document.createElement("div");document.body.appendChild(g);let E=ho.createRoot(g);E.render(M(Qt,{content:oe(f),trigger:"click",placement:"right",open:!0,onOpenChange:k=>{k||(E.unmount(),document.body.removeChild(g))},children:M("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%"}})}))}},style:{cursor:"pointer",padding:"0 8px",height:"100%",display:"flex",alignItems:"center"},children:M("span",{className:"ant-select-arrow"})}):M("span",{className:"ant-select-arrow"})})},vo=bo;import{useEffect as Co,useRef as Io,useState as Ar}from"react";import{Upload as jr,Button as rt,Modal as Ro,Image as wo,Space as To,message as Po,Progress as xo}from"antd";import{UploadOutlined as So,DownloadOutlined as Or,EyeOutlined as _o,FilePdfFilled as ko,FileExcelFilled as No,FileWordFilled as Uo,FileTextFilled as Do,FileUnknownFilled as Eo}from"@ant-design/icons";import*as Fe from"febs-browser";function Er(e,t,r){r.method=r.method||"POST",r.headers=r.headers||{},r.timeout=r.timeout||5e3,r.withCredentials=r.withCredentials||!0,r.crossDomain=r.crossDomain||!0,r.sliceOffset=r.sliceOffset||0,r.sliceLength=r.sliceLength||-1;let n={success:r.success,method:r.method||"POST",url:r.url,mode:r.crossDomain!=!0?"same-origin":"cors",timeout:r.timeout||5e3};r=Fe.utils.mergeMap(n,r||{});let d=Fe.$(e);if(d.attr("enctype")&&d.attr("enctype").toLowerCase()==="multipart/form-data"){let a=new FormData,o=File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice,i=t.name,c=i.lastIndexOf("/");c>=0&&(i=i.substr(c+1)),c=i.lastIndexOf("\\"),c>=0&&(i=i.substr(c+1));let m=r.sliceLength||-1;m==-1&&(m=t.size-(r.sliceOffset||0));let C=o.call(t,r.sliceOffset,(r.sliceOffset||0)+m);a.append("file",C,i),r.data=a}else throw new Error("only support multipart/form-data");let s;return r.headers?s=r.headers:s={},s["Content-Type"]=!1,Fe.net.ajax({url:r.url,type:r.method,headers:s,processData:!1,data:r.data,timeout:r.timeout,withCredentials:r.withCredentials,success:function(a){r.success&&r.success(a)},error:function(a,o,i){r.error&&r.error(i)},complete:r.complete,progress:r.progress})}var ht=class ht{static uploadSingle(t,r,n,d,s){new FormData().append("file",t);let o=document.createElement("form");o.setAttribute("enctype","multipart/form-data");let i={headers:{}};return i.headers.set=(c,m)=>{i.headers[c]=m},pe.requestHandleSid(i),delete i.headers.set,Er(o,t,{url:ht.UPLOAD_SINGLE_URL+"?size="+t.size+"&crc32="+r,success:(c=>{c=JSON.parse(c),c.code===200?K.success("\u6587\u4EF6\u4E0A\u4F20\u6210\u529F"):K.error(c.message||"\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"),s&&s(c)}),error:(c=>{console.error("File upload error:",c),K.error("\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"),d&&d(c)}),progress:n||(c=>{console.log(`\u4E0A\u4F20\u8FDB\u5EA6: ${c}%`)}),complete:c=>{},data:"",method:"POST",headers:i.headers,timeout:Number(import.meta.env.VITE_API_UPLOAD_TIMEOUT)||5e3,withCredentials:!0,crossDomain:!0,sliceOffset:0,sliceLength:-1})}static copyFromServer(t){return l.post(import.meta.env.VITE_API_BASE+"/api/fs/copy",{sourcePath:t},null)}};F(ht,"UPLOAD_SINGLE_URL",import.meta.env.VITE_API_BASE+"/api/fs/upload");var tt=ht;import*as Mr from"febs-browser";import{jsx as L,jsxs as nt}from"react/jsx-runtime";var Wl=({fileList:e,onChange:t,onFinish:r,cancel:n,btnText:d="\u4E0A\u4F20\u6587\u4EF6",maxCount:s=5,disabled:a=!1,multiple:o=!0,accept:i=void 0})=>{let[c,m]=Ar(void 0),C=Io(e);Co(()=>{C.current=e},[e]);let b=({fileList:N})=>{t?.(N)},w=N=>{t?.(C.current.filter(I=>I.uid!==N.uid))},_=N=>{let I=N.size/1024/1024<100;return I||Po.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7100MB"),I||jr.LIST_IGNORE},j=async N=>{let{file:I,onSuccess:R,onError:T,onProgress:D}=N;try{I.status="uploading",I.percent=0,D({percent:0}),m(0),Mr.crypt.crc32_file(I,O=>{if(O==0){I.status="error",T("calc crc32 error");return}let x=tt.uploadSingle(I,O,B=>{let W=Math.floor(B*100);D({percent:W}),I.percent=W,m(W)},B=>{m(void 0),T(B)},B=>{I.status="done",I.percent=100,m(void 0),R("ok"),r&&r([I],B).then(()=>{}).catch(()=>{})});I.cancel=()=>{x.abort(),I.status="error",I.percent=0,m(void 0),T(new Error("\u4E0A\u4F20\u5DF2\u53D6\u6D88")),w(I)}})}catch(O){I.status="error",m(void 0),T(O)}},P=c!==void 0&&c<100;return L(jr,{fileList:e,onChange:b,beforeUpload:_,customRequest:j,multiple:o,maxCount:s,disabled:a,itemRender:(N,I,R,T)=>P?nt("div",{className:"flex items-center justify-between w-full mt-2 rounded border border-blue-100 bg-blue-50 px-3 py-2",children:[L("span",{className:"mr-3 min-w-0 max-w-[120px] flex-1 truncate text-sm text-gray-700",children:I.name}),L(xo,{className:"w-[60px]",percent:Math.round(I.percent||0),size:"small",status:"active",showInfo:!0}),L(rt,{className:"ml-3",size:"small",onClick:()=>{n?n(I):I.cancel?.(),w(I)},danger:!0,children:"\u53D6\u6D88"})]}):null,accept:i,showUploadList:!0,children:!P&&L(rt,{icon:L(So,{}),disabled:a||P,title:o?`\u4E0A\u4F20\u6587\u4EF6\uFF08\u6700\u591A\u652F\u6301${s}\u4E2A\u6587\u4EF6\uFF0C\u5355\u4E2A\u6587\u4EF6\u4E0D\u8D85\u8FC7100MB\uFF09`:"\u4E0A\u4F20\u6587\u4EF6\uFF08\u5355\u4E2A\u6587\u4EF6\u4E0D\u8D85\u8FC7100MB\uFF09",children:P?nt("span",{className:"inline-block w-[85px]",children:["\u4E0A\u4F20\u4E2D ",c,"%"]}):d})})},Vl=({files:e=[],onPreview:t,onDownload:r})=>e.length===0?null:L("div",{className:"p-4 bg-gray-50 rounded",children:e.map((n,d)=>nt("div",{className:"flex items-center mb-2",children:[Fr(n),L("span",{className:"mr-2",children:n.name}),nt(To,{children:[t&&L(rt,{type:"link",size:"small",icon:L(_o,{}),onClick:()=>t(n),children:"\u67E5\u770B"}),r&&L(rt,{type:"link",size:"small",icon:L(Or,{}),onClick:()=>r(n),children:"\u4E0B\u8F7D"})]})]},n.uid||d))}),Fr=e=>{let t=e.type||"";return t.includes("pdf")?L(ko,{className:"mr-2 text-red-500"}):t.includes("excel")||t.includes("spreadsheet")||e.name.endsWith(".xlsx")||e.name.endsWith(".xls")?L(No,{className:"mr-2 text-green-500"}):t.includes("word")||t.includes("document")||e.name.endsWith(".docx")||e.name.endsWith(".doc")?L(Uo,{className:"mr-2 text-blue-500"}):t.includes("image")?L(Do,{className:"mr-2 text-purple-500"}):L(Eo,{className:"mr-2 text-gray-500"})},ql=({visible:e,file:t,onClose:r,onDownload:n})=>{if(!t)return null;let[d,s]=Ar(""),a=t.name||"",o=t.type?.startsWith("image/");return o&&it(t,i=>{s(i||"")}),L(Ro,{open:e,title:a,footer:null,onCancel:r,width:800,children:o?L(wo,{alt:a,style:{width:"100%"},src:d}):nt("div",{className:"text-center p-8",children:[L("div",{className:"text-6xl mb-4",children:Fr(t)}),L("p",{className:"mb-4",children:a}),L("p",{className:"text-gray-500 mb-4",children:"\u8BE5\u6587\u4EF6\u7C7B\u578B\u65E0\u6CD5\u76F4\u63A5\u9884\u89C8"}),n&&L(rt,{type:"primary",icon:L(Or,{}),onClick:()=>n(t),children:"\u4E0B\u8F7D\u6587\u4EF6\u67E5\u770B"})]})})};export{Ba as CommentTimeline,tt as FileUploadHandler,Hs as ProjectSelector,Yi as ResizableTable,lo as RoleSelector,Ei as SingletonToastProvider,Ct as UIDatePicker,ei as UIDateRangePicker,Vl as UIFileList,Wl as UIFileUpload,ql as UIFileUploadPreviewModal,ui as UIImageUpload,Tn as UILoading,Pi as UISelect,$i as UITableGridViewToggle,Di as UIToast,Bi as UIToastSingle,Li as UIToastSingleProvider,Gn as UIViewToggle,vo as UserSelector,Ys as clearRoleCache,Rt as compressImage,Qr as uiAlert,ln as uiConfirm,K as uiToast};
|