@ehfuse/taskbox 0.11.70 → 0.11.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -8,7 +8,7 @@ import{a as il,b as Wf,c as iu,d as iz,e as az,f as lz,g as sz,h as cz}from"./ch
|
|
|
8
8
|
`).replace(/<\/(p|div|li|h[1-6]|blockquote)>/gi,`
|
|
9
9
|
`),o=document.createElement("div");return o.innerHTML=t,(o.textContent??"").replace(/\n{3,}/g,`
|
|
10
10
|
|
|
11
|
-
`).trim()}var FR={...dh,left:(dh.left??[]).map(e=>e.filter(t=>t!=="undo"&&t!=="redo")).filter(e=>e.length>0).flatMap(e=>e.includes("indent")?[["bulletList","numberList"],e]:[e]).concat([["blocks"]])},HR=!1;function Vl(){let e=Ge(),t=gh(),o=ar({});return{switcher:HR&&!e&&t.length>0?Et(Vi,{role:"group","aria-label":n("common.content"),sx:{ml:"auto",display:"flex",alignItems:"center",gap:.5},children:t.map(r=>{let a=jc[r];return Et(Xc,{size:"small",onMouseDown:l=>l.preventDefault(),onClick:()=>o.current.insert?.(r),startIcon:Et(a,{sx:{fontSize:"18px !important"}}),sx:{py:.25,px:1,minWidth:0,fontSize:13,fontWeight:400,lineHeight:1.6,textTransform:"none",color:"text.secondary","& .MuiButton-startIcon":{mr:.5,ml:0},"&:hover":{bgcolor:"action.hover"}},children:n(Yc[r])},r)})}):null,bridge:o.current}}function gh(){let e=fe();return[e.contentSheet?"sheet":null,e.contentDraw?"draw":null,e.contentMindmap?"mindmap":null].filter(Boolean)}function Qc({syncKey:e,value:t,onChange:o,readOnly:i=!1,viewFirst:r=!1,onTranslate:a,minHeight:l=180,editing:s,onEditingChange:c,modeControl:u}){O();let{uploadContentImage:m,openExternalUrl:p,openContentImage:d,contentFullBleed:f}=fe(),g=!!f,x=g?{mx:-2,mb:-1.5}:{},b=g?"16px":"12px",_=Q=>{p?p(Q):window.open(Q,"_blank","noopener,noreferrer")},[h,v]=ch(()=>!r||!Ki(t).trim()),k=s!==void 0,A=k?s:h,T=ar(c);T.current=c;let B=Q=>{k||v(Q),T.current?.(Q)};sh(()=>{r&&B(!Ki(t).trim())},[e,r]);let E=Vl(),q=u?.bridge??E.bridge,R=u||!E.switcher?null:Et(Vi,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mb:-.5},children:E.switcher}),C=ar(null),S=ar(new NR),D=ar(null),y=ar(Date.now()+800),M=ar({value:t,touched:!1}),z=()=>{M.current.touched=!0},K=Ge(),w=gh(),P=ar(null),U=lh({editorRef:C,wrapperRef:P,kinds:w,isMobile:K,onBeforeNotify:()=>{z(),y.current=0}});q.insert=U.insert;let N=MR(),ee=PR(N.breakpoints.down("sm")),[ne,pe]=ch(!1),G=()=>{let Q=Ki(t);Q&&navigator.clipboard.writeText(Q).then(()=>{pe(!0),window.setTimeout(()=>pe(!1),1500)})},te=(Q,ae=!1)=>Q instanceof Element?Q.closest(ae?".taskbox-content-readview a[href]":".ehfuse-editor-content a[href]"):null,H=Q=>K||Q.ctrlKey||Q.metaKey;sh(()=>{if(i)return;let Q=ph(t);D.current===Q||D.current===t||(D.current=Q,y.current=Date.now()+800,M.current={value:t,touched:!1},C.current?.setHtml(Q))},[e,t,i]);let Y=fh(t),ce=ar(null),he=ar({el:null,html:""});return RR(()=>{let Q=ce.current;Q&&(he.current.el===Q&&he.current.html===Y||(Q.innerHTML=Y,Ib(Q),he.current={el:Q,html:Y}))}),i||!A?$l(Vi,{sx:{position:"relative",mt:1},children:[Et(Vi,{onClickCapture:Q=>{let ae=Q.target;if(ae?.tagName==="IMG"&&ae.src){Q.preventDefault(),Q.stopPropagation();let I=Array.from(Q.currentTarget.querySelectorAll("img")).filter(oe=>oe.src),V=I.map((oe,ge)=>({src:oe.src,name:oe.alt||decodeURIComponent(oe.src.split("/").pop()||"")||`image-${ge+1}`})),j=Math.max(0,I.indexOf(ae));d?d(V,j):_(V[j].src);return}let Z=te(Q.target,!0);Z&&(Q.preventDefault(),Q.stopPropagation(),_(Z.href))},ref:ce,className:"taskbox-content-readview","data-drag-scroll":"off",sx:{...g?{...x,border:0,borderTop:"1px solid #e0e0e0",borderRadius:0}:{border:"1px solid #e0e0e0",borderRadius:1},p:"12px",pl:b,pr:ee?b:"52px",pb:"28px",minHeight:l,fontSize:16,lineHeight:1.6,color:"#37352f",wordBreak:"break-word",userSelect:"text","& > p:first-of-type":{mt:0},"& > p:last-of-type":{mb:0},"& a[href]":{color:"#2563eb",textDecoration:"underline",cursor:"pointer"},"& img":{maxWidth:"100%",cursor:"zoom-in"},"& ul, & ol":{pl:"1.5em",my:.5},"& ul":{listStyleType:"disc"},"& ol":{listStyleType:"decimal"},"& li > p":{my:0},...hp}}),ee?$l(Vi,{sx:{display:"flex",gap:1,mt:1},children:[Et(Xc,{variant:"outlined",color:"inherit",startIcon:Et(LR,{sx:{fontSize:18}}),onClick:G,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:ne?n("section.copied"):n("common.copy")}),i?null:Et(Xc,{variant:"outlined",color:"inherit",startIcon:Et(mh,{sx:{fontSize:18}}),onClick:()=>B(!0),sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:n("common.edit")}),a?Et(Xc,{variant:"outlined",color:"inherit",startIcon:Et(uh,{sx:{fontSize:18}}),onClick:a,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:n("section.translate")}):null]}):$l(Vi,{sx:{position:"absolute",top:6,right:6,display:"flex",flexDirection:"column",gap:.25},children:[i?null:Et(Tp,{title:n("section.editContent"),arrow:!0,placement:"left",children:Et(kp,{size:"small","aria-label":n("section.editContent"),onClick:()=>B(!0),sx:{color:"#9a9a97"},children:Et(mh,{sx:{fontSize:17}})})}),a?Et(Tp,{title:n("section.translate"),arrow:!0,placement:"left",children:Et(kp,{size:"small","aria-label":n("section.translate"),onClick:a,sx:{color:"#9a9a97"},children:Et(uh,{sx:{fontSize:17}})})}):null]})]}):$l(WR,{children:[K?null:R,$l(Vi,{onDragOver:Q=>Q.stopPropagation(),onDrop:Q=>Q.stopPropagation(),onClickCapture:Q=>{let ae=H(Q)?te(Q.target):null;ae&&(Q.preventDefault(),Q.stopPropagation(),_(ae.href))},ref:P,onMouseLeave:U.onMouseLeave,onKeyDownCapture:Q=>{let ae=(Q.ctrlKey||Q.metaKey)&&/^[ac]$/i.test(Q.key);!zR.has(Q.key)&&!ae&&z()},onInputCapture:z,onPasteCapture:z,onDropCapture:z,onMouseDownCapture:Q=>{H(Q)&&te(Q.target)&&Q.preventDefault(),Q.target?.closest?.(".ehfuse-toolbar")&&z()},sx:{mt:Nl,[`& .ehfuse-editor-content :is(${Pr})`]:{my:"10px",border:"1px solid #e0e0e0",borderRadius:1,overflow:"hidden",cursor:"pointer",userSelect:"none","& img":{display:"block",maxWidth:"100%",height:"auto"},"& table:not([border])":{my:0}},"& .ehfuse-editor-content [data-tb-block=sheet]":{maxHeight:`calc(${qR} * (1.5em + 13px))`},"& .ehfuse-editor-content > p:first-of-type":{mt:0},"& .ehfuse-editor-content > p:last-of-type":{mb:0},"& .ehfuse-editor-content.ehfuse-editor-empty::before":{top:"12px",left:b},...g?{...x,"& .ehfuse-editor-wrapper":{borderLeftWidth:0,borderRightWidth:0,borderBottomWidth:0,borderRadius:0},"& .ehfuse-editor-wrapper.ehfuse-focus-border::after":{inset:"-1px 0 auto 0 !important",height:"0 !important",border:"0 !important",borderTop:Q=>`1px solid ${Q.palette.primary.main} !important`,borderRadius:"0 !important"}}:{},...K?{"& .ehfuse-editor-content a[href]":{cursor:"pointer"}}:{},position:"relative"},children:[r&&!k?Et(Tp,{title:n("section.finishEditingTooltip"),arrow:!0,children:Et(kp,{size:"small","aria-label":n("section.finishEditing"),onMouseDown:Q=>Q.preventDefault(),onClick:()=>B(!1),sx:{position:"absolute",top:4,right:6,zIndex:2,color:"#2f9e5b"},children:Et(OR,{sx:{fontSize:19}})})}):null,Et(AR,{ref:C,defaultValue:ph(t),autoHeight:!0,showToolbar:!K,focusBorder:!0,styles:{focusBorderColor:"var(--primary)"},toolbarOptions:FR,blockMenu:w.map(Q=>{let ae=jc[Q];return{key:Q,label:n(Yc[Q]),icon:Et(ae,{sx:{fontSize:18}}),onSelect:()=>U.insert(Q)}}),plugins:[S.current],locale:go(),minHeight:l,placeholder:n("section.contentPlaceholder"),blocks:Yb,onReady:U.onReady,onImageUpload:m,contentStyle:{padding:`12px ${b}`},onChange:Q=>{let ae=Date.now()<y.current,Z=Q===D.current;if(D.current=Q,ae||Z)return;let I=M.current;!I.touched&&Zb(Q,I.value)||o(Q)}}),U.overlay]})]})}import{Fragment as JR,jsx as Do,jsxs as Zc}from"react/jsx-runtime";function Sp(e){return String(e??"").replace(/<[^>]*>/g,"").replace(/ /g," ").trim().length>0}function em({content:e,templates:t,onApply:o,onSave:i,onRemove:r,readOnly:a=!1}){O();let[l,s]=yp(null),[c,u]=yp(!1),[m,p]=yp(""),d=async g=>{s(null),!(Sp(e)&&!await GR({title:n("section.loadTemplate"),message:n("section.loadTemplateConfirm",{name:g.name})}))&&o(g.content)},f=()=>{s(null);let g=Ki(e);g&&navigator.clipboard.writeText(g).then(()=>YR(n("section.contentCopied"))).catch(()=>jR(n("section.contentCopyFailed")))};return Zc(JR,{children:[Do(KR,{title:n("section.contentMenu"),arrow:!0,disableInteractive:!0,children:Do(bh,{size:"small","aria-label":n("section.contentMenu"),onClick:g=>s(g.currentTarget),sx:{ml:"auto",color:"#9a9a97"},children:Do(UR,{sx:{fontSize:18}})})}),Zc(VR,{anchorEl:l,open:!!l,onClose:()=>s(null),transitionDuration:0,children:[Do(Jc,{disabled:!Sp(e),onClick:f,sx:{fontSize:14,minWidth:220},children:n("menu.copyContent")}),a?null:Do(xh,{sx:{my:.5}}),!a&&i?Do(Jc,{disabled:!Sp(e),onClick:()=>{s(null),p(""),u(!0)},sx:{fontSize:14,minWidth:220},children:n("section.saveAsTemplate")}):null,!a&&i?Do(xh,{sx:{my:.5}}):null,a?null:t.length===0?Do(Jc,{disabled:!0,sx:{fontSize:14,minWidth:220},children:n("section.noSavedTemplates")}):t.map(g=>Zc(Jc,{onClick:()=>{d(g)},sx:{fontSize:14,minWidth:220,gap:1},children:[Do(Cp,{sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.name}),r?Do(bh,{size:"small","aria-label":n("section.deleteTemplateAria",{name:g.name}),onClick:x=>{x.stopPropagation(),r(g.seq)},sx:{color:"#9a9a97"},children:Do(Xt,{sx:{fontSize:16}})}):null]},g.seq))]}),Do(XR,{open:c,onClose:()=>u(!1),maxWidth:"xs",title:n("section.saveTemplateTitle"),locale:Ee(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},tabs:{visible:!1},actions:{showCancelButton:!0,right:Do($R,{variant:"contained",disabled:!m.trim(),onClick:()=>{i?.(m.trim(),e),u(!1)},children:n("common.save")})},sections:[{id:"template-name",title:"",showTitle:!1,children:Zc(Cp,{sx:{display:"flex",flexDirection:"column",gap:1},children:[Do(Cp,{sx:{fontSize:15,color:"#37352f"},children:n("section.saveTemplateHint")}),Do(QR,{size:"medium",fullWidth:!0,autoFocus:!0,placeholder:n("section.templateNamePlaceholder"),value:m,onChange:g=>p(g.target.value)})]})}]})]})}import{useState as Gl}from"react";import{Box as $t,Button as Th,Dialog as dP,IconButton as Ma,Switch as pP,TextField as fP,Tooltip as vp}from"@mui/material";import{DndContext as gP,PointerSensor as xP,closestCenter as bP,useSensor as hP,useSensors as kP}from"@dnd-kit/core";import{restrictToParentElement as TP,restrictToVerticalAxis as yP}from"@dnd-kit/modifiers";import{SortableContext as CP,arrayMove as SP,useSortable as vP,verticalListSortingStrategy as BP}from"@dnd-kit/sortable";import{CSS as _P}from"@dnd-kit/utilities";import yh from"@mui/icons-material/Close";import IP from"@mui/icons-material/AddCircle";import Ch from"@mui/icons-material/AddTask";import wP from"@mui/icons-material/Checklist";import DP from"@mui/icons-material/CheckCircle";import EP from"@mui/icons-material/DragIndicator";import RP from"@mui/icons-material/Launch";import PP from"@mui/icons-material/LinkOutlined";import MP from"@mui/icons-material/RadioButtonUnchecked";import{useMemo as nP}from"react";import{Box as lr,Button as rP,Tab as iP,Tabs as aP}from"@mui/material";import{FormDialog as lP}from"@ehfuse/mui-form-dialog";import{ClearTextField as sP}from"@ehfuse/mui-form-controls";import cP from"@mui/icons-material/CheckCircle";import mP from"@mui/icons-material/RadioButtonUnchecked";import{OverlayScrollbar as uP}from"@ehfuse/overlay-scrollbar";import{useRef as ZR}from"react";import{useGlobalForm as eP,useModal as tP}from"@ehfuse/forma";import{ErrorAlert as oP}from"@ehfuse/alerts";var hh={type:"related",search:"",selectedSeqs:[]};function Kl(e){O();let t=ZR(e);t.current=e;let o={link:tP({modalId:Oe("taskbox-task-link")})},i=eP({formId:Oe("taskbox-task-link-form"),initialValues:hh,onValidate:s=>s.selectedSeqs.length===0?(oP(n("link.selectTask")),!1):!0,onSubmit:s=>{let c=a(s.type)?s.selectedSeqs:s.selectedSeqs.slice(-1);for(let u of c)t.current.onSubmit(u,s.type);return o.link.close(),!0}}),r=()=>{i.setFormValues({...hh,selectedSeqs:[]}),o.link.open()};function a(s){let c=t.current.multiSelect;return typeof c=="function"?c(s):!!c}return{form:i,modals:o,openDialog:r,toggleSelected:s=>{let c=i.getFormValue("selectedSeqs")??[];if(c.includes(s)){i.setFormValue("selectedSeqs",c.filter(m=>m!==s));return}let u=i.getFormValue("type")??"related";i.setFormValue("selectedSeqs",a(u)?[...c,s]:[s])},isMulti:a}}import{jsx as ko,jsxs as tm}from"react/jsx-runtime";var kh=[{type:"related",get label(){return n("link.related")},get hint(){return n("link.relatedHint")}},{type:"follow_up",get label(){return n("link.previous")},get hint(){return n("link.previousHint")}},{type:"duplicate_of",get label(){return n("link.duplicate")},get hint(){return n("link.duplicateHint")}}];function om({controller:e,task:t,tasks:o,excludeSeqs:i=[],hideRelationType:r=!1,title:a=n("link.title"),confirmLabel:l=n("link.confirm")}){O();let s=Ge(),{form:c}=e,u=e.modals.link,m=c.useValue("type")??"related",p=String(c.useValue("search")??""),d=c.useValue("selectedSeqs")??[],f=nP(()=>{let b=new Set([t.seq,...i]),_=p.trim().toLowerCase();return o.filter(h=>b.has(h.seq)||h.is_event||h.is_notice||h.linked_only?!1:_?h.title.toLowerCase().includes(_)||(h.ticket_no??"").toLowerCase().includes(_):!0).sort((h,v)=>!!h.completed!=!!v.completed?h.completed?1:-1:v.seq-h.seq)},[o,t.seq,i,p]),g=kh.find(b=>b.type===m)?.hint??"",x=tm(lr,{sx:{display:"flex",flexDirection:"column",minHeight:0,height:s?"100%":"auto"},children:[r?null:ko(aP,{value:m,onChange:(b,_)=>{c.setFormValue("type",_),!e.isMulti(_)&&d.length>1&&c.setFormValue("selectedSeqs",d.slice(-1))},sx:{minHeight:38,flexShrink:0,borderBottom:`1px solid ${se}`,"& .MuiTab-root":{minHeight:38,py:.5,fontSize:16,color:"#333333"}},children:kh.map(b=>ko(iP,{value:b.type,label:b.label},b.type))}),r?null:ko(lr,{sx:{mt:1,mb:1.5,fontSize:14,flexShrink:0},children:g}),tm(lr,{sx:{...s?{height:"100%",minHeight:0}:{height:560},display:"flex",flexDirection:"column",...s?{}:{border:"1px solid #cccccc",borderRadius:1},overflow:"hidden",userSelect:"none"},children:[ko(lr,{sx:{px:1.5,py:1,borderBottom:"1px solid #cccccc",flexShrink:0},children:ko(sP,{placeholder:n("link.searchPlaceholder"),name:"search",form:c,fullWidth:!0,autoFocus:!0,size:"small",sx:{"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiInputBase-root":{px:0}}})}),ko(lr,{sx:{flex:1,minHeight:0},children:ko(uP,{style:{height:"100%"},contentStyle:{paddingTop:0},children:ko(lr,{sx:{display:"flex",flexDirection:"column"},children:f.length===0?ko(lr,{sx:{py:4,textAlign:"center",fontSize:13.5,color:"#9a9a97"},children:n("link.empty")}):f.map(b=>{let _=b.is_notice||b.is_event?He(b.icon||(b.is_notice?wt:Ft)):null,h=d.includes(b.seq);return tm(lr,{onClick:()=>e.toggleSelected(b.seq),sx:{display:"flex",alignItems:"center",gap:.75,px:1.5,py:1.25,flexShrink:0,cursor:"pointer",borderBottom:`1px solid ${se}`,"&:last-of-type":{borderBottom:"none"},bgcolor:h?"#e3eefb":"transparent","&:hover":{bgcolor:h?"#e3eefb":"#f7f7f5"}},children:[h?ko(cP,{sx:{fontSize:20,flexShrink:0,color:"#2f6fd0"}}):ko(mP,{sx:{fontSize:20,flexShrink:0,color:"#c9c8c5"}}),_?ko(_,{sx:{fontSize:17,flexShrink:0,color:b.icon_color||"#1e3a8a"}}):null,tm(lr,{component:"span",sx:{flex:1,minWidth:0,fontSize:15,color:"#37352f",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,overflow:"hidden",lineHeight:1.5,wordBreak:"break-word"},children:[b.ticket_no?`${b.ticket_no} `:"",b.title]}),ko(lr,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:ko(Ze,{option:Ht(b)})})]},b.seq)})})})})]})]});return ko(lP,{open:u.isOpen,onClose:u.close,maxWidth:"sm",fullScreen:s,mobilePresentation:s?"slide":"dialog",...s?{contentPaddingX:0,contentTopPadding:0,sectionsPaddingTop:0}:{},sx:s?{DialogContent:{pb:0,"& .os-content > div":{height:"100%",boxSizing:"border-box",paddingBottom:0,marginBottom:0},"& .FormSection-content, & .section-content":{height:"100%",paddingBottom:0,marginBottom:0}}}:void 0,title:a,locale:Ee(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-link",sections:[{id:"task-link",showTitle:!1,children:x}],scrollPastLastSection:!1,sectionContentPaddingTop:0,contentTopPadding:12,actions:{showCancelButton:!0,right:ko(rP,{variant:"contained",disabled:d.length===0,onClick:()=>{c.submit()},children:l})}})}import{ConfirmActionPopper as OP}from"@ehfuse/mui-confirm-action";var Ul={display:"inline-flex",alignItems:"center",gap:.4,flexShrink:0,px:.75,py:.2,borderRadius:1,fontSize:12,fontWeight:500,color:"#1d4f91",bgcolor:"#e3eefb",whiteSpace:"nowrap"};import{Fragment as NP,jsx as Re,jsxs as sr}from"react/jsx-runtime";var Sh="taskbox.checklist.hideCompleted";function LP({id:e,children:t}){let{attributes:o,listeners:i,setNodeRef:r,transform:a,transition:l,isDragging:s}=vP({id:e});return Re($t,{ref:r,sx:{transform:_P.Transform.toString(a),transition:l,...s?{opacity:.6,position:"relative",zIndex:1}:{}},children:t({handleProps:{...o,...i},dragging:s})})}function AP({sortable:e,sensors:t,rowIds:o,onDragEnd:i,compact:r,children:a}){let l=Re($t,{sx:{display:"flex",flexDirection:"column",mt:.5,pl:r?0:3.25},children:a});return e?Re(gP,{sensors:t,collisionDetection:bP,modifiers:[yP,TP],onDragEnd:i,children:Re(CP,{items:o,strategy:BP,children:l})}):l}function nm({taskSeq:e,checklist:t,onAdd:o,onToggle:i,confirmOnToggle:r=!1,onRemove:a,onUpdate:l,onReorder:s,removeLocked:c=!1,onConvertToTask:u,onOpenLinkedTask:m,linkCandidates:p,linkBaseTask:d,onLinkExistingTask:f,resolveLinkedTask:g,myAccountSeq:x=0}){O();let[b,_]=Gl(""),h=Kl({multiSelect:!0,onSubmit:G=>{if(!f)return;let te=p?.find(H=>H.seq===G);f(e,G,String(te?.title??"").trim())}}),[v,k]=Gl(null),A=Ge(),[T,B]=Gl(null),[E,q]=Gl(null),R=G=>{let te=G.task_seq?g?.(G.task_seq):void 0;return te?te.completed:G.checked},C=G=>{if(!G.task_seq||x<=0)return!1;let te=g?.(G.task_seq);return te?!$g(te,x):!1},S=G=>!!G.task_seq&&!!g&&!g?.(G.task_seq),D=t.filter(G=>!S(G)),y=D.filter(R).length,[M,z]=Gl(()=>{try{return localStorage.getItem(Sh)==="1"}catch{return!1}}),K=G=>{z(G);try{localStorage.setItem(Sh,G?"1":"0")}catch{}},w=!!s&&!A&&!c,P=kP(hP(xP,{activationConstraint:{distance:5}})),U=(G,te)=>G.task_seq?`linked-${G.task_seq}`:`row-${te}`,N=t.map(U),ee=N.filter((G,te)=>{let H=t[te];return S(H)?!1:!(M&&R(H))}),ne=G=>{let{active:te,over:H}=G;if(!H||te.id===H.id)return;let Y=N.indexOf(String(te.id)),ce=N.indexOf(String(H.id));Y<0||ce<0||s?.(e,SP(t,Y,ce))},pe=()=>{b.trim()&&(o(e,b),_(""))};return sr(Fo,{icon:Re(wP,{sx:{fontSize:19,display:"block"}}),title:sr(NP,{children:[n("section.todo"),t.length>0?sr($t,{component:"span",sx:{fontSize:12.5,color:"#9a9a97"},children:[y," / ",t.length]}):null]}),titleExtra:D.length>0?sr($t,{sx:{flex:1,minWidth:0,ml:1,display:"flex",alignItems:"center",gap:1},children:[Re($t,{sx:{flex:1,minWidth:0,height:6,borderRadius:3,bgcolor:"#ececea"},children:Re($t,{sx:{height:"100%",borderRadius:3,width:`${Math.round(y/D.length*100)}%`,bgcolor:"#2f80ed",transition:"width 0.2s"}})}),y>0?sr($t,{component:"label",sx:{display:"inline-flex",alignItems:"center",gap:.25,flexShrink:0,cursor:"pointer",fontSize:13.5,fontWeight:400,color:"#57564f",userSelect:"none"},children:[Re(pP,{size:"small",checked:M,onChange:(G,te)=>K(te)}),n("section.hideDone")]}):null]}):null,children:[Re(AP,{sortable:w,sensors:P,rowIds:ee,onDragEnd:ne,compact:A,children:t.map((G,te)=>{let H=G.task_seq?g?.(G.task_seq):void 0,Y=R(G);if(M&&Y||S(G))return null;let ce=!!G.task_seq,he=C(G),Q=ae=>sr($t,{sx:{display:"flex",alignItems:A?"flex-start":"center",gap:1,px:1.25,...w?{ml:-3,pl:.5}:{},py:.5,borderRadius:1,"&:hover":{bgcolor:"#f7f7f5"},"&:hover .taskbox-checklist-remove":{opacity:1},"&:hover .taskbox-checklist-convert":{opacity:1},"&:hover .taskbox-checklist-handle":{opacity:1}},children:[ae?Re($t,{className:"taskbox-checklist-handle",...ae,sx:{display:"inline-flex",flexShrink:0,alignItems:"center",color:"#c9c8c5",opacity:0,transition:"opacity 0.15s",cursor:"grab","&:active":{cursor:"grabbing"},touchAction:"none",userSelect:"none"},children:Re(EP,{sx:{fontSize:16}})}):null,Re(vp,{title:he?n("section.toggleLocked"):"",arrow:!0,disableInteractive:!0,children:Re($t,{component:"span",onClick:he?void 0:Z=>r?q({anchorEl:Z.currentTarget,index:te,checked:!Y}):i(e,te,!Y),sx:{display:"inline-flex",flexShrink:0,cursor:he?"default":"pointer",...A?{mt:"1px"}:{}},children:Y?Re(DP,{sx:{fontSize:18,color:he?"#a9c6ec":"#2f80ed"}}):Re(MP,{sx:{fontSize:18,color:he?"#d6d5d1":"#9a9a97"}})})}),v?.index===te?Re($t,{component:"input",autoFocus:!0,spellCheck:!1,value:v.label,enterKeyHint:"done",onChange:Z=>k({index:te,label:Z.target.value}),onBlur:()=>{v.label.trim()&&v.label.trim()!==G.label&&l?.(e,te,v.label),k(null)},onKeyDown:Z=>{Z.key==="Enter"&&Z.target.blur(),Z.key==="Escape"&&k(null)},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",p:0}}):Re($t,{component:"span",onClick:ce?G.task_seq&&m?()=>m(G.task_seq):void 0:c||!l?void 0:A?()=>B({index:te,label:G.label}):()=>k({index:te,label:G.label}),sx:{flex:1,minWidth:0,fontSize:14.5,color:"#37352f",textDecoration:Y?"line-through":"none",overflow:"hidden",textOverflow:"ellipsis",...A?{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,lineHeight:1.4,wordBreak:"break-word"}:{whiteSpace:"nowrap"},...ce?m?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}:c||!l?{}:{cursor:"text"}},children:G.label}),ce?sr($t,{component:"span",onClick:G.task_seq&&m?()=>m(G.task_seq):void 0,sx:{...Ul,...A?{mt:"1px"}:{},...m?{cursor:"pointer"}:{}},children:[Re(RP,{sx:{fontSize:12}}),H?.manager_name?.trim()||n("template.task")]}):null,!c&&!ce&&u?Re(vp,{title:n("section.makeTask"),arrow:!0,enterDelay:300,disableInteractive:!0,children:Re(Ma,{className:"taskbox-checklist-convert",size:"small","aria-label":n("section.makeTask"),onClick:()=>u(e,te,G.label),sx:{display:A?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:Re(Ch,{sx:{fontSize:16}})})}):null,c?null:Re(Ma,{className:"taskbox-checklist-remove",size:"small","aria-label":n("section.deleteTodo"),onClick:()=>a(e,te),sx:{display:A?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:Re(yh,{sx:{fontSize:15}})})]});return w?Re(LP,{id:N[te],children:({handleProps:ae})=>Q(ae)},N[te]):Re($t,{children:Q(null)},N[te])})}),sr($t,{sx:{mt:.5,ml:A?0:3.25,display:"flex",alignItems:"center",gap:.5},children:[Re($t,{component:"input",spellCheck:!1,value:b,placeholder:n("section.addTodoPlaceholder"),enterKeyHint:"done",onChange:G=>_(G.target.value),onKeyDown:G=>{G.key==="Enter"&&pe()},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",px:1.25,py:.75,"&::placeholder":{color:"#9a9a97"}}}),p&&d&&f?Re(vp,{title:n("section.attachExisting"),arrow:!0,children:Re(Ma,{size:"small","aria-label":n("section.attachExisting"),onMouseDown:G=>G.preventDefault(),onClick:h.openDialog,sx:{flexShrink:0,color:"#9a9a97"},children:Re(PP,{sx:{fontSize:20}})})}):null,Re(Ma,{size:"small","aria-label":n("section.addTodo"),disabled:!b.trim(),onMouseDown:G=>G.preventDefault(),onClick:pe,sx:{flexShrink:0,color:b.trim()?"#2f80ed":"#c9c8c5"},children:Re(IP,{sx:{fontSize:20}})})]}),p&&d&&f?Re(om,{controller:h,task:d,tasks:p,excludeSeqs:t.map(G=>Number(G.task_seq??0)).filter(G=>G>0),hideRelationType:!0,title:n("section.attachExisting"),confirmLabel:n("section.attach")}):null,Re(OP,{open:!!E,anchorEl:E?.anchorEl??null,title:E?.checked?n("calendar.checklistCompleteConfirm"):n("task.uncompleteConfirm"),confirmText:E?.checked?n("common.done"):n("task.unmark"),onCancel:()=>q(null),onConfirm:()=>{E&&i(e,E.index,E.checked),q(null)}}),Re(dP,{open:!!T,onClose:()=>B(null),maxWidth:"xs",fullWidth:!0,slotProps:{paper:{sx:{borderRadius:2,m:2}}},children:sr($t,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5},children:[Re($t,{sx:{fontSize:15.5,fontWeight:600,color:"#37352f"},children:n("section.editTodo")}),Re(fP,{autoFocus:!0,fullWidth:!0,size:"medium",value:T?.label??"",onChange:G=>B(te=>te&&{...te,label:G.target.value}),onKeyDown:G=>{if(G.key!=="Enter")return;let te=T;te&&te.label.trim()&&l?.(e,te.index,te.label.trim()),B(null)}}),sr($t,{sx:{display:"flex",alignItems:"center",gap:1},children:[!c&&u&&T&&!t[T.index]?.task_seq?Re(Ma,{"aria-label":n("section.makeTask"),onClick:()=>{u(e,T.index,t[T.index]?.label??""),B(null)},sx:{color:"#57564f"},children:Re(Ch,{sx:{fontSize:20}})}):null,!c&&T?Re(Ma,{"aria-label":n("section.deleteTodo"),onClick:()=>{a(e,T.index),B(null)},sx:{color:"#e5484d"},children:Re(yh,{sx:{fontSize:19}})}):null,Re($t,{sx:{flex:1}}),Re(Th,{color:"inherit",onClick:()=>B(null),children:n("common.cancel")}),Re(Th,{variant:"contained",disabled:!T?.label.trim(),onClick:()=>{T&&T.label.trim()&&l?.(e,T.index,T.label.trim()),B(null)},children:n("common.confirm")})]})]})})]})}import{useRef as $P,useState as VP}from"react";import{Box as Zo,IconButton as KP}from"@mui/material";import{DndContext as UP,PointerSensor as GP,closestCenter as jP,useSensor as YP,useSensors as XP}from"@dnd-kit/core";import{restrictToParentElement as QP,restrictToVerticalAxis as JP}from"@dnd-kit/modifiers";import{SortableContext as ZP,useSortable as eM,verticalListSortingStrategy as tM}from"@dnd-kit/sortable";import{CSS as oM}from"@dnd-kit/utilities";import nM from"@mui/icons-material/DragIndicator";import rM from"@mui/icons-material/Close";import iM from"@mui/icons-material/AttachFileOutlined";import{FileTypeIcon as aM}from"@ehfuse/file-viewer/icons";var qP=new Set(["jpg","jpeg","png","gif","bmp","webp","svg","pdf","txt","json","xml","log","md","markdown","csv","xls","xlsx","html","htm","js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf","mp4","avi","mov","wmv","flv","webm","mp3","wav","ogg","m4a","aac"]),rm=e=>{let t=e?.split(".").pop()?.toLowerCase()??"";return qP.has(t)};import{LinearProgress as zP}from"@mui/material";import{Fragment as FP,jsx as WP,jsxs as HP}from"react/jsx-runtime";function vh(e){let t=_n(),o=t.useValue("attachmentUpload.taskSeq"),i=t.useValue("attachmentUpload.index"),r=t.useValue("attachmentUpload.total"),a=t.useValue("attachmentUpload.queue"),l=i??0;return!l||e>0&&(o??0)!==e?null:{index:l,total:r??0,queue:a??[]}}function Bp(){let t=_n().useValue("attachmentUpload.progress");return HP(FP,{children:[t??0,"%"]})}function Bh(){let t=_n().useValue("attachmentUpload.progress");return WP(zP,{variant:"determinate",value:t??0,sx:{height:4,borderRadius:2,bgcolor:"#dbe9fb",mt:.75}})}import{Fragment as _h,jsx as St,jsxs as Yl}from"react/jsx-runtime";function lM({id:e,children:t}){let{attributes:o,listeners:i,setNodeRef:r,transform:a,transition:l,isDragging:s}=eM({id:e});return St(Zo,{ref:r,sx:{transform:oM.Transform.toString(a),transition:l,...s?{opacity:.6,position:"relative",zIndex:1}:{}},children:t({...o,...i})})}function jl(e){return e>=1048576?`${(e/1048576).toFixed(1)}MB`:`${Math.max(1,Math.round(e/1024))}KB`}var im={flex:1,minWidth:0,fontSize:13.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function am({taskSeq:e,attachments:t,onAdd:o,onRemove:i,removeLocked:r=!1,onPreview:a,onDownload:l,onReorder:s}){O();let[c,u]=VP(!1),m=$P(null),p=Ge(),d=sl(),f=ll(),g=vh(e),x=e===0,b=!!s&&!x&&!p&&!r&&!g&&t.length>1,_=XP(YP(GP,{activationConstraint:{distance:5}})),h=(R,C)=>R.uuid?`file-${R.uuid}`:`file-${C}`,v=t.map(h),k=R=>{let{active:C,over:S}=R;if(!S||C.id===S.id)return;let D=v.indexOf(String(C.id)),y=v.indexOf(String(S.id));D<0||y<0||s?.(e,D,y)},A=R=>{if(a){a(R);return}window.open(f(R.uuid??""),"_blank","noopener,noreferrer")},T=R=>{if(l){l(R);return}window.open(f(R.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},B=R=>g?R+1<g.index?"done":R+1===g.index?"uploading":"waiting":"waiting",E=(R,C,S,D,y={})=>Yl(Zo,{sx:{px:1,py:.5,borderRadius:1,border:"1px solid",borderColor:y.uploading?"#d5e6fb":se,bgcolor:y.uploading?"#f4f9ff":"transparent","&:hover .taskbox-file-remove":{opacity:1},"&:hover .taskbox-file-handle":{opacity:1}},children:[Yl(Zo,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[y.handleProps?St(Zo,{className:"taskbox-file-handle","aria-label":n("section.reorder"),...y.handleProps,sx:{display:"inline-flex",flexShrink:0,alignItems:"center",ml:-.5,mr:-.5,color:"#c9c8c5",opacity:0,transition:"opacity 0.15s",cursor:"grab","&:active":{cursor:"grabbing"},touchAction:"none",userSelect:"none"},children:St(nM,{sx:{fontSize:16}})}):null,St(Zo,{component:"span",sx:{display:"inline-flex",flexShrink:0},children:St(aM,{fileName:C,size:18})}),S,St(Zo,{component:"span",sx:{fontSize:12,color:y.uploading?"#2f80ed":"#9a9a97",flexShrink:0},children:D}),y.removeIndex!==void 0?St(KP,{className:"taskbox-file-remove",size:"small","aria-label":n("section.deleteAttachment"),onClick:()=>i(e,y.removeIndex),sx:{opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:St(rM,{sx:{fontSize:15}})}):null]}),y.uploading?St(Bh,{}):null]},R),q=R=>{let C=rm(R.name);return St(Zo,{component:"button",type:"button",onClick:()=>C?A(R):T(R),title:n("section.fileAction",{name:R.name,value:C?n("section.preview"):n("section.download")}),sx:{...im,color:"#37352f",textAlign:"left",p:0,border:"none",background:"none",font:"inherit",fontSize:13.5,cursor:"pointer",outline:"none","&:focus-visible":{textDecoration:"underline",color:"#2f80ed"},"&:hover":{textDecoration:"underline",color:"#2f80ed"}},children:R.name})};return Yl(Fo,{icon:St(iM,{sx:{fontSize:18,display:"block"}}),title:Yl(_h,{children:[n("section.files")," ",t.length>0?t.length:""]}),children:[St(sM,{sortable:b,sensors:_,rowIds:v,onDragEnd:k,children:Yl(Zo,{sx:{display:"flex",flexDirection:"column",gap:.5,mt:1},children:[t.map((R,C)=>{let S=`${R.uuid||R.name}-${C}`;if(x){let D=B(C),y=D==="uploading";return E(S,R.name,St(Zo,{component:"span",sx:{...im,color:D==="done"?"#37352f":"#9a9a97"},children:R.name}),y?St(Bp,{}):jl(R.size),{uploading:y,removeIndex:!r&&!g?C:void 0})}return R.uuid?b?St(lM,{id:h(R,C),children:D=>E(S,R.name,q(R),jl(R.size),{removeIndex:r?void 0:C,handleProps:D})},h(R,C)):E(S,R.name,q(R),jl(R.size),{removeIndex:r?void 0:C}):E(S,R.name,St(Zo,{component:"span",title:n("section.legacyAttachment"),sx:{...im,color:"#9a9a97"},children:R.name}),jl(R.size),{removeIndex:r?void 0:C})}),!x&&g?g.queue.slice(g.index-1).map((R,C)=>{let S=C===0;return E(`uploading-${g.index+C}-${R.name}`,R.name,St(Zo,{component:"span",sx:{...im,color:"#9a9a97"},children:R.name}),S?St(Bp,{}):jl(R.size),{uploading:S})}):null]})}),St(Zo,{onClick:()=>m.current?.click(),onDragOver:R=>{R.preventDefault(),u(!0)},onDragLeave:()=>u(!1),onDrop:R=>{R.preventDefault(),u(!1);let C=Array.from(R.dataTransfer.files);C.length>0&&o(e,C)},sx:{mt:1,py:2.5,display:"flex",alignItems:"center",justifyContent:"center",gap:.5,border:"1.5px dashed",borderColor:c?"#2f80ed":"#cfcfcc",borderRadius:1,bgcolor:c?"#eef6ff":"transparent",color:"#787774",fontSize:13.5,cursor:"pointer",transition:"background-color 0.15s, border-color 0.15s","&:hover":{bgcolor:"#fafaf9",borderColor:"#9a9a97"}},children:p?n("section.attachHint",{uploadMaxMb:d}):n("section.attachHintDrag",{uploadMaxMb:d})}),St(Zo,{component:"input",ref:m,type:"file",multiple:!0,onChange:R=>{let C=Array.from(R.target.files??[]);C.length>0&&o(e,C),R.target.value=""},sx:{display:"none"}})]})}function sM({sortable:e,sensors:t,rowIds:o,onDragEnd:i,children:r}){return e?St(UP,{sensors:t,collisionDetection:jP,modifiers:[JP,QP],onDragEnd:i,children:St(ZP,{items:o,strategy:tM,children:r})}):St(_h,{children:r})}import{useState as gM}from"react";import{Checkbox as xM,Divider as bM,ListItemIcon as hM,Menu as kM,MenuItem as Eh}from"@mui/material";import TM from"@mui/icons-material/Add";import{Box as _p,Button as uM}from"@mui/material";import{FormDialog as dM}from"@ehfuse/mui-form-dialog";import{ClearTextField as pM}from"@ehfuse/mui-form-controls";import{ColorPicker as fM}from"@ehfuse/mui-color-picker";import{useGlobalForm as cM}from"@ehfuse/forma";import{ErrorAlert as mM}from"@ehfuse/alerts";var Ih="#2f80ed";function wh({open:e,onClose:t,onSubmit:o}){O();let i=cM({formId:Oe("taskbox-add-label-form"),initialValues:{name:"",color:Ih},onValidate:a=>String(a.name??"").trim()?!0:(mM(n("dialog.enterLabelName")),!1),onSubmit:a=>(o(String(a.name).trim(),a.color),r.form.close(),!0)}),r={form:mo({modalIdPrefix:"taskbox-add-label-dialog",open:e,onClose:t,onOpen:()=>i.setFormValues({name:"",color:Ih})})};return{form:i,modals:r}}import{jsx as Xl,jsxs as Ip}from"react/jsx-runtime";function Dh({open:e,onClose:t,onSubmit:o}){O();let{form:i,modals:r}=wh({open:e,onClose:t,onSubmit:o}),a=String(i.useFormValue("name")??""),l=String(i.useFormValue("color")??""),s=Cg(l),c=Ip(_p,{children:[Ip(_p,{sx:{display:"flex",alignItems:"center",gap:1.5,mt:.5},children:[Xl(pM,{form:i,name:"name",label:n("dialog.labelName"),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),i.submit())},fullWidth:!0,autoFocus:!0}),Xl(fM,{value:l,onChange:u=>i.setFormValue("color",u),shape:"circle",colorSize:28})]}),Ip(_p,{sx:{mt:2,display:"flex",alignItems:"center",gap:1,fontSize:13,color:"#787774"},children:[n("dialog.preview"),Xl(Ze,{option:{key:"__preview__",name:a.trim()||n("dialog.label"),...s}})]})]});return Xl(dM,{open:r.form.isOpen,onClose:r.form.close,maxWidth:"xs",title:n("dialog.addLabelTitle"),locale:Ee(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-add-label",sections:[{id:"add-label",showTitle:!1,children:c}],actions:{showCancelButton:!0,right:Xl(uM,{variant:"contained",onClick:()=>{i.submit()},children:n("common.add")})}})}import{Fragment as yM,jsx as Oa,jsxs as lm}from"react/jsx-runtime";function sm({anchorEl:e,selectedKeys:t,labelOptions:o,onToggle:i,onAddLabel:r,onClose:a}){O();let[l,s]=gM(!1),c=Xn();return lm(yM,{children:[lm(kM,{anchorEl:e,open:!!e,onClose:a,transitionDuration:0,...c,children:[o.map(u=>{let m=t.includes(u.key);return lm(Eh,{onClick:()=>i(u.key),sx:{fontSize:14,minWidth:170,gap:1},children:[Oa(xM,{size:"small",checked:m,sx:{p:0}}),Oa(Ze,{option:u})]},u.key)}),Oa(bM,{}),lm(Eh,{onClick:()=>s(!0),sx:{fontSize:14,color:"#787774"},children:[Oa(hM,{children:Oa(TM,{sx:{fontSize:18,color:"#787774"}})}),n("menu.addLabel")]})]}),Oa(Dh,{open:l,onClose:()=>s(!1),onSubmit:r})]})}function Rh(e,t){let o=Number(e.author_account_seq??0);return t.filter(i=>{let r=Number(i.account_seq??0);return r>0&&r!==o})}function Ph(e,t){let o=(e.target_account_seqs??[]).filter(p=>p>0);if(o.length===0)return null;let i=new Set(o),r=Rh(e,t),a=new Map;for(let p of r){let d=String(p.department??"").trim();if(!d)continue;let f=a.get(d)??[];f.push(p),a.set(d,f)}let l=[],s=new Set;for(let[p,d]of a)if(d.every(g=>i.has(Number(g.account_seq??0)))){l.push(p);for(let g of d)s.add(Number(g.account_seq??0))}let c=new Map(r.map(p=>[Number(p.account_seq??0),p.name])),u=e.target_names??[],m=[];return o.forEach((p,d)=>{s.has(p)||m.push(c.get(p)??u[d]??n("dialog.noName"))}),{teamNames:l,individualNames:m}}function cm(e,t){let o=Ph(e,t);return o?[...o.teamNames,...o.individualNames].join(", "):n("col.allEmployees")}function dQ(e,t){let o=Ph(e,t);return o?{kind:"members",teamNames:o.teamNames,individualNames:o.individualNames}:{kind:"everyone"}}function CM(e,t,o){let i=t.length>0?new Set(t):new Set(o.map(r=>Number(r.account_seq??0)).filter(r=>r>0));return i.size===0?e.length:new Set(e.map(r=>Number(r.account_seq)).filter(r=>i.has(r))).size}function Mh(e,t,o){let i=(e.target_account_seqs??[]).filter(f=>f>0),r=Rh(e,t),a=i.length>0?i.length:r.length,l=e.acks??[],s=o>0&&l.some(f=>f.account_seq===o),c=o>0&&Number(e.author_account_seq??0)===o,u=i.length===0||i.includes(o),m=new Set(l.map(f=>f.account_seq)),d=(i.length>0?r.filter(f=>i.includes(Number(f.account_seq??0))):r).filter(f=>!m.has(Number(f.account_seq??0))).map(f=>String(f.name??"").trim()).filter(f=>f.length>0);return{count:CM(l,i,r),total:a,acked:s,pendingNames:d,canAck:o>0&&!c&&u&&!s&&!e.completed}}import{DatePicker as WM}from"@ehfuse/mui-datetime-picker";import{useState as SM}from"react";import{Box as Ui,IconButton as vM,Popover as BM}from"@mui/material";import _M from"@mui/icons-material/InfoOutlined";import IM from"@mui/icons-material/LockOutlined";import wM from"@mui/icons-material/PublicOutlined";import DM from"@mui/icons-material/Group";import{jsx as en,jsxs as Gi}from"react/jsx-runtime";var EM=[{key:"all",icon:en(wM,{sx:{fontSize:17,color:"#2f80ed"}}),label:"create.visibilityPublic",who:"create.visibilityInfoAll"},{key:"group",icon:en(DM,{sx:{fontSize:17,color:"#d9730d"}}),label:"create.visibilityDeptShort",who:"create.visibilityInfoGroup"},{key:"involved",icon:en(IM,{sx:{fontSize:17}}),label:"create.visibilityPrivate",who:"create.visibilityInfoPrivate"}];function mm(){let[e,t]=SM(null),{colors:o}=Se(),i=String(qi.labelColor??"#787774");return Gi(Ui,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.25},children:[n("create.visibility"),en(vM,{size:"small","aria-label":n("create.visibilityInfo"),onClick:r=>{r.stopPropagation(),t(r.currentTarget)},sx:{p:.25,color:i},children:en(_M,{sx:{fontSize:16}})}),Gi(BM,{open:!!e,anchorEl:e,onClose:()=>t(null),onClick:r=>r.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},transitionDuration:0,slotProps:{paper:{sx:{width:380,maxWidth:"calc(100vw - 32px)",p:2,borderRadius:2}}},children:[Gi(Ui,{sx:{fontSize:14,lineHeight:1.6,mb:1.5,px:1.5,py:1.25,borderRadius:1.5,bgcolor:o.accentSoft,color:o.textSecondary,wordBreak:"keep-all"},children:[en(Ui,{component:"strong",sx:{fontWeight:700,color:o.accentOnSurface},children:n("create.visibilityInfoNoteStrong")})," ",n("create.visibilityInfoNote")]}),en(Ui,{sx:{border:`1px solid ${o.border}`,borderRadius:1.5,overflow:"hidden"},children:Gi(Ui,{component:"table",sx:{width:"100%",borderCollapse:"collapse",fontSize:14,"& th, & td":{border:`1px solid ${o.border}`,py:1,px:1.25,textAlign:"left",verticalAlign:"middle"},"& tr > :first-of-type":{borderLeft:"none"},"& tr > :last-child":{borderRight:"none"},"& thead th":{borderTop:"none",bgcolor:o.surfaceSubtle,color:o.textSecondary,fontWeight:600},"& tbody tr:last-child td":{borderBottom:"none"},"& td":{color:o.textPrimary,wordBreak:"keep-all",lineHeight:1.5}},children:[en("thead",{children:Gi("tr",{children:[en("th",{children:n("create.visibilityInfoColScope")}),en("th",{children:n("create.visibilityInfoColWho")})]})}),en("tbody",{children:EM.map(r=>Gi("tr",{children:[en(Ui,{component:"td",sx:{whiteSpace:"nowrap"},children:Gi(Ui,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[r.icon,n(r.label)]})}),en("td",{children:n(r.who)})]},r.key))})]})})]})]})}import{Fragment as ji,jsx as ye,jsxs as Tn}from"react/jsx-runtime";var qh="taskbox:create-expanded";function $M(){try{return window.localStorage.getItem(qh)!=="0"}catch{return!0}}function Ep({form:e,statusOptions:t,customTabs:o,sprints:i=[],avatarSrcByName:r,isNotice:a=!1,hideProject:l=!1,hideBug:s=!1,hideTypeToggle:c=!1,leadingRow:u,afterProject:m,extraRows:p,hideLabel:d=!1,simple:f=!1,hideMembers:g=!1,templateItem:x=!1,postMode:b=!1,employees:_=[],workspaceName:h="",workspaceSlot:v,myAccountSeq:k=0,departments:A=[],myGroupSeq:T=0,onMemberEdit:B,onAddProject:E,onAddLabelOption:q,contentSyncKey:R="create",contentTemplates:C,contentTitleExtra:S,onSaveContentTemplate:D,onRemoveContentTemplate:y}){O();let M=_n(),z=sl(),K=e.useFormValue("manager_name"),w=e.useFormValue("receiver_names"),P=e.useFormValue("start_date"),U=!!e.useFormValue("is_event"),N=!!e.useFormValue("is_bug"),ee=e.useFormValue("bug_repro")??"",ne=e.useFormValue("bug_device")??"",pe=e.useFormValue("bug_where")??"",G=e.useFormValue("bug_version")??"",te=e.useFormValue("event_time")??"",H=e.useFormValue("event_place")??"",Y=e.useFormValue("event_address")??"",ce=e.useFormValue("due_date"),he=e.useFormValue("reminders")??[],Q=e.useFormValue("priority"),ae=e.useFormValue("content"),Z=Vl(),I=e.useFormValue("note")??"",j=e.useFormValue("checklist")??[],oe=e.useFormValue("tab_key"),ge=e.useFormValue("sprint_seq")??0,xe=e.useFormValue("story_points")??0,Pe=o.find(W=>W.key===oe&&W.useSprints),Le=Pe?i.filter(W=>`custom-${W.group_seq}`===oe):[],[de,Be]=La(null),ze=e.useFormValue("label_keys"),[ft,eo]=La(null),re=e.useFormValue("visibility")||"involved",Me=Number(e.useFormValue("visibility_group_seq")??0),[st,Qe]=La(null),vo=e.useFormValue("repeat_rule")||"",Fn=e.useFormValue("repeat_until")||"",[Bo,Hn]=La(null),[Wn,$n]=La(null),sn=e.useFormValue("target_names"),cn=e.useFormValue("target_account_seqs"),qt=M.useValue("createAttachmentFiles")??[],Ut=a?cm({author_account_seq:k,target_names:sn,target_account_seqs:cn},_):"",[Je,Vn]=La($M),Vo=f&&!U&&!a&&!b,Ot=Vo&&!Je,Ye=()=>{let W=!Je;Vn(W);try{window.localStorage.setItem(qh,W?"1":"0")}catch{}},X=!b,le=g?1:2;return Tn(ji,{children:[u,!a&&!c?Tn(cr,{sx:{display:"flex",gap:1.25,px:2,pt:1.5,pb:1.5,flexShrink:0},children:[v?ye(cr,{sx:{alignSelf:"center",mr:"6px",minWidth:0,display:"flex"},children:v}):h?ye(cr,{sx:{alignSelf:"center",fontSize:13.5,fontWeight:600,color:"#37352f",mr:"6px",maxWidth:160,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:h,children:h}):null,[{value:"task",label:n("kind.task")},{value:"event",label:n("kind.event")},...s?[]:[{value:"bug",label:n("kind.bug")}]].map(W=>{let qe=(N?"bug":U?"event":"task")===W.value;return ye(Oh,{onClick:()=>Iu(e,W.value),sx:{px:1.75,lineHeight:1,pt:"8px",pb:"10px",borderRadius:99,fontSize:13.5,fontWeight:qe?600:400,color:qe?"#ffffff":"#787774",bgcolor:qe?"#2563eb":"#f4f4f2"},children:W.label},W.label)})]}):null,u||!a&&!c?ye(Ql,{sx:{borderColor:se}}):null,Tn(cr,{sx:{pt:1.5,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[ye(Wc,{afterProject:m,hideProject:l||Ot&&!oe,hideManager:g||b||Ot&&!K,hideReceivers:x||g||b&&re==="all"||Ot&&w.length===0,hideStartDate:Ot||b,hideReminder:x||b||Ot&&he.length===0,hidePriority:b,hideDueDate:b||!U&&!!vo,values:{tabKey:oe,managerName:K,receiverNames:w,startDate:P,dueDate:ce,reminders:he,priority:Q,eventTime:te,eventPlace:H,eventAddress:Y},customTabs:o,avatarSrcByName:r,notice:a,event:U,onChangeEventTime:W=>e.setFormValue("event_time",W),onChangeEventPlace:W=>e.setFormValue("event_place",W),onChangeEventAddress:W=>e.setFormValue("event_address",W),targetSummary:Ut,onChangeProject:W=>e.setFormValue("tab_key",W),onAddProject:E,onChangeStartDate:W=>e.setFormValue("start_date",W),onClearStartDate:()=>e.setFormValue("start_date",""),onChangeDueDate:W=>e.setFormValue("due_date",W),onChangeReminder:W=>e.setFormValue("reminders",W),onChangePriority:W=>e.setFormValue("priority",W),onMemberEdit:B,pinColumns:X,beforeStart:Tn(ji,{children:[!x&&!N&&!b&&!(Ot&&!vo)?ye(Ie,{icon:ye(qM,{sx:{fontSize:17,...vo?{color:"#2f80ed"}:{}}}),label:n("create.repeat"),onClick:W=>Hn(W),sx:U||!X?void 0:ut(le),children:vo?Vs(vo):ye(cr,{component:"span",sx:{color:"#9a9a97"},children:n("common.none")})}):null,!x&&!N&&!b&&vo?ye(Ie,{icon:ye(zM,{sx:{fontSize:17}}),label:n("create.repeatUntil"),onClick:W=>$n(W),sx:U||!X?void 0:ut(le),children:Fn?jo(Fn):ye(cr,{component:"span",sx:{color:"#9a9a97"},children:n("create.auto")})}):null]}),trailing:Tn(ji,{children:[!a&&!g&&!(Ot&&re==="involved")?ye(Ie,{icon:re==="all"?ye(Ah,{sx:{fontSize:17,color:"#2f80ed"}}):re==="group"?ye(Nh,{sx:{fontSize:17,color:"#d9730d"}}):ye(Lh,{sx:{fontSize:17}}),label:ye(mm,{}),onClick:W=>Qe(W),sx:U||!X?void 0:ut(1),children:re==="all"?n("create.visibilityPublic"):re==="group"?n("create.visibilityDept",{value:A.find(W=>W.seq===Me)?.name??n("create.department")}):n("create.visibilityPrivate")}):null,Pe&&!U&&!a&&!b&&!(Ot&&ge===0&&xe===0)?Tn(ji,{children:[ye(Ie,{icon:ye(NM,{sx:{fontSize:17}}),label:n("col.goal"),onClick:W=>Be(W),sx:X?ut(1):void 0,children:ge>0?Le.find(W=>W.seq===ge)?.name??n("create.deletedGoal"):ye(cr,{component:"span",sx:{color:"#9a9a97"},children:n("board.unassigned")})}),ye(Ie,{icon:ye(FM,{sx:{fontSize:17}}),label:"\uD3EC\uC778\uD2B8",sx:X?ut(1):void 0,children:ye(Er,{value:xe>0?String(xe):"",placeholder:n("create.notEstimated"),onCommit:W=>e.setFormValue("story_points",Number(W.replace(/[^0-9.]/g,""))||0)})})]}):null,N?ye($c,{values:{repro:ee,device:ne,where:pe,version:G},onChangeRepro:W=>e.setFormValue("bug_repro",W),onChangeDevice:W=>e.setFormValue("bug_device",W),onChangeWhere:W=>e.setFormValue("bug_where",W),onChangeVersion:W=>e.setFormValue("bug_version",W)}):null,!x&&!b&&!a?(p??[]).filter(W=>!(Ot&&!W.filled)).map(W=>ye(Ie,{icon:W.icon,label:W.label,onClick:W.onClick,sx:U||!X?void 0:ut(le),children:W.value},W.key)):null]}),leading:U||d?null:ye(cr,{sx:{gridColumn:"1 / -1"},children:ye(Ie,{icon:ye(AM,{sx:{fontSize:17}}),label:n("dialog.label"),onClick:W=>eo(W),children:(ze??[]).length>0?ye(Qr,{labelKeys:ze??[],labelOptions:t}):ye(cr,{component:"span",sx:{color:"#9a9a97"},children:n("menu.empty")})})})}),Vo?Tn(Oh,{onClick:Ye,"aria-expanded":Je,sx:{alignSelf:"flex-start",display:"flex",alignItems:"center",gap:.5,minHeight:32,mx:2,pr:1,borderRadius:1,fontSize:14,color:"#2563eb","&:hover":{bgcolor:"#f2f2f0"}},children:[Je?ye(RM,{sx:{fontSize:17}}):ye(PM,{sx:{fontSize:17}}),Je?n("create.collapseFields"):n("create.expandFields")]}):null,ye(Ql,{sx:{my:1.5,borderColor:se}}),ye(Fo,{icon:ye(OM,{sx:{fontSize:18,display:"block"}}),title:n("common.content"),titleExtra:Tn(ji,{children:[S,Tn(cr,{sx:{ml:"auto",display:"flex",alignItems:"center",gap:.5},children:[Z.switcher,C?ye(em,{content:ae,templates:C,onApply:W=>e.setFormValue("content",W),onSave:D,onRemove:y}):null]})]}),children:ye(Qc,{syncKey:R,value:ae,modeControl:Z,onChange:W=>e.setFormValue("content",W)})}),N||b||Ot&&!I?null:Tn(ji,{children:[ye(Ql,{sx:{my:1.5,borderColor:se}}),ye(Fo,{icon:ye(LM,{sx:{fontSize:18,display:"block"}}),title:n("col.note"),children:ye(HM,{form:e,name:"note",placeholder:n("create.notePlaceholder"),fullWidth:!0,size:"medium",sx:{mt:1}})})]}),U||b||Ot&&j.length===0?null:ye(Ql,{sx:{my:1.5,borderColor:se}}),U||b||Ot&&j.length===0?null:ye(nm,{taskSeq:0,checklist:j,onAdd:(W,ke)=>Eu(e,ke),onToggle:(W,ke,qe)=>Ru(e,ke,qe),onRemove:(W,ke)=>Pu(e,ke),onUpdate:(W,ke,qe)=>Mu(e,ke,qe)}),x?null:Tn(ji,{children:[ye(Ql,{sx:{my:1.5,borderColor:se}}),ye(am,{taskSeq:0,attachments:qt.map(W=>({name:W.name,size:W.size})),onAdd:(W,ke)=>Ou(M,ke,z),onRemove:(W,ke)=>Lu(M,ke)})]})]}),ye(wp,{transitionDuration:0,anchorEl:de,open:!!de,onClose:()=>Be(null),children:[{seq:0,label:n("board.unassigned")},...Le.map(W=>({seq:W.seq,label:xn(W)}))].map(W=>ye(Dp,{onClick:()=>{e.setFormValue("sprint_seq",W.seq),Be(null)},sx:{fontSize:14,minWidth:170},children:W.label},W.seq))}),ye(wp,{transitionDuration:0,anchorEl:Bo,open:!!Bo,onClose:()=>Hn(null),children:[{value:"",label:n("common.none")},...gl].map(W=>ye(Dp,{selected:vo===W.value,onClick:()=>{Hn(null),wu(e,W.value)},sx:{fontSize:14,minWidth:140},children:W.label},W.value||"none"))}),ye(WM,{anchorEl:Wn,open:!!Wn,onClose:()=>$n(null),selectedDate:Fn?new Date(`${Fn}T00:00:00`):new Date,onDateChange:W=>{Du(e,W),$n(null)}}),ye(wp,{transitionDuration:0,anchorEl:st,open:!!st,onClose:()=>Qe(null),children:[{key:"involved",label:n("create.visibilityPrivate"),tip:n("create.privateTip"),icon:ye(Lh,{sx:{fontSize:17,color:"#57564f"}}),selected:re==="involved",onPick:()=>xl(e,"involved")},{key:"all",label:n("create.visibilityPublic"),tip:n("create.publicTip"),icon:ye(Ah,{sx:{fontSize:17,color:"#2f80ed"}}),selected:re==="all",onPick:()=>xl(e,"all")},...[...A].sort((W,ke)=>W.seq===T?-1:ke.seq===T?1:0).map(W=>({key:`group-${W.seq}`,label:n("create.visibilityDeptName",{name:W.name}),tip:n("create.deptTip",{name:W.name}),icon:ye(Nh,{sx:{fontSize:17,color:"#d9730d"}}),selected:re==="group"&&Me===W.seq,onPick:()=>xl(e,"group",W.seq)}))].map(W=>ye(MM,{title:W.tip,arrow:!0,disableInteractive:!0,placement:"right",children:Tn(Dp,{selected:W.selected,onClick:()=>{W.onPick(),b&&W.key==="all"&&(e.setFormValue("receiver_names",[]),e.setFormValue("receiver_account_seqs",[])),Qe(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[W.icon,W.label]})},W.key))}),ye(sm,{anchorEl:ft,selectedKeys:ze??[],labelOptions:t,onToggle:W=>e.setFormValue("label_keys",Zs(ze??[],W)),onAddLabel:(W,ke)=>q?.(W,ke),onClose:()=>eo(null)})]})}import{Fragment as Hh,jsx as vt,jsxs as Jl}from"react/jsx-runtime";var ZM={gap:"0.75rem !important","& .left-actions, & .right-actions":{display:"contents"},"& .left-actions > span:empty":{display:"none"},"& .left-actions:not(:has(*:not(:empty)))":{display:"none"},"& .left-actions .MuiButton-root, & .right-actions .MuiButton-root":{flex:"1 1 0",minWidth:0,margin:"0 !important",paddingLeft:"8px !important",paddingRight:"8px !important",whiteSpace:"nowrap"},"& .right-actions .MuiButton-text":{border:"1px solid rgba(0, 0, 0, 0.23)"},"& .right-actions .MuiButton-contained":{border:"1px solid transparent"}};function Wh({open:e,onClose:t,desktopPresentation:o="drawer",submitLabel:i,...r}){O();let{form:a,presetTitle:l="",presetContent:s="",presetVisibility:c,presetVisibilityGroupSeq:u=0,presetDueDate:m="",presetTabKey:p="",presetManager:d=null,isNotice:f=!1,defaultBug:g=!1}=r,x=_n(),b=KM(!1),[_,h]=zh(0),v=a.useFormValue("title"),k=a.useFormValue("icon"),A=a.useFormValue("icon_color"),T=!!a.useFormValue("is_event"),B=!!a.useFormValue("is_bug"),E=Ge(),R=x.useValue("createSubmitting")??!1,C=f||T?He(k||(f?wt:Ft)):null,S=f?n("create.titleNotice"):T?n("create.titleEvent"):B?n("task.createBug"):n("task.createTask"),D=f?n("create.noticeTitlePlaceholder"):T?n("create.eventTitlePlaceholder"):B?n("create.bugTitlePlaceholder"):n("create.taskTitlePlaceholder");VM(()=>{let w=b.current;b.current=e,!(!e||w)&&(_u(a,x,{presetTitle:l,presetContent:s,presetVisibility:c,presetVisibilityGroupSeq:u,presetDueDate:m,presetTabKey:p,presetManager:d,isNotice:f,defaultBug:g}),h(P=>P+1))},[e]);let[y,M]=zh(null),z=w=>C?T?vt(YM,{title:n("col.changeIcon"),arrow:!0,enterDelay:400,disableInteractive:!0,children:vt(UM,{onClick:P=>M(P.currentTarget),sx:{display:"flex",p:.5,borderRadius:1,color:A||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:vt(C,{sx:{fontSize:20}})})}):vt(Mr,{sx:[{display:"flex",color:A||"#1e3a8a"},w],children:vt(C,{sx:{fontSize:20}})}):null,K=Jl(Mr,{sx:{display:"flex",alignItems:"center",gap:1,px:2,pt:2,pb:1},children:[z({p:0}),vt(Mr,{component:"input",autoFocus:!0,spellCheck:!1,value:v,placeholder:D,onChange:w=>a.setFormValue("title",w.target.value),sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:19,fontWeight:600,color:"#37352f",p:0,m:0,"&::placeholder":{color:"#c9c8c5",fontWeight:400}}})]});return E||o==="dialog"?vt(Hh,{children:vt(JM,{open:e,onClose:t,backdropClick:!1,locale:Ee(),fontScale:E?{enabled:!0,default:1.1,min:.6}:{enabled:!0},title:S,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fullScreen:E,mobilePresentation:E?"slide":"dialog",maxWidth:"md",actions:{showCancelButton:!0,right:vt(Rp,{variant:"contained",disableElevation:!0,disabled:R,onClick:R?void 0:a.submit,children:R?n("create.saving"):i??n("create.saveButton")})},dialogActionSx:E?ZM:void 0,tabs:{visible:!1},contentTopPadding:0,contentPaddingX:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,contentBottomPadding:0,scrollPastLastSection:!1,overlayScrollbar:{enabled:!0,contentStyle:{minWidth:0}},sections:[{id:"task-create",title:"",showTitle:!1,children:vt(Mr,{sx:{width:"100%",minWidth:0,display:"flex",flexDirection:"column",gap:0},children:vt(Ep,{...r,contentSyncKey:`create-${_}`,leadingRow:K})})}]})}):Jl(Hh,{children:[vt(GM,{anchor:"right",open:e,onClose:(w,P)=>{P!=="backdropClick"&&t()},"aria-label":n("create.newTaskAria"),sx:{zIndex:w=>w.zIndex.modal},slotProps:{paper:{sx:{width:720,maxWidth:"100vw"}}},children:Jl(Mr,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[Jl(Mr,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1.5,flexShrink:0},children:[z({px:.5}),vt(Mr,{component:"input",autoFocus:!0,spellCheck:!1,value:v,placeholder:D,onChange:w=>a.setFormValue("title",w.target.value),sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:18,fontWeight:500,color:"#37352f",p:0,m:0,"&::placeholder":{color:"#c9c8c5",fontWeight:400}}}),vt(jM,{"aria-label":n("common.close"),onClick:t,sx:{color:"#6b7280"},children:vt(XM,{})})]}),vt(Fh,{sx:{borderColor:se}}),vt(Mr,{sx:{flex:1,minHeight:0},children:vt(QM,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:vt(Ep,{...r,contentSyncKey:`create-${_}`})})}),vt(Fh,{sx:{borderColor:se}}),Jl(Mr,{sx:{display:"flex",justifyContent:"flex-end",gap:.5,px:2,py:1.5,flexShrink:0},children:[vt(Rp,{onClick:t,color:"inherit",disabled:R,children:n("common.cancel")}),vt(Rp,{onClick:a.submit,variant:"contained",disabled:R,children:R?n("create.creating"):i??n("common.register")})]})]})}),vt(Zr,{anchorEl:y,value:k,color:A,onSelect:w=>{a.setFormValue("icon",w),M(null)},onSelectColor:w=>a.setFormValue("icon_color",w),onClose:()=>M(null)})]})}import{useEffect as Fk,useRef as Hk,useState as Wk}from"react";import{Box as Dm,Button as h2,Divider as $k,Drawer as k2,IconButton as T2,ListItemIcon as rf,ListItemText as af,Menu as y2,MenuItem as lf}from"@mui/material";import C2 from"@mui/icons-material/MoreVert";import S2 from"@mui/icons-material/DeleteOutline";import v2 from"@mui/icons-material/ShareOutlined";import B2 from"@mui/icons-material/HistoryOutlined";import _2 from"@ehfuse/overlay-scrollbar";import{FormDialog as I2}from"@ehfuse/mui-form-dialog";import{useRef as bm,useState as Or}from"react";import{Box as _e,Button as ok,Chip as hm,IconButton as tn,Popover as vO,Tooltip as ak}from"@mui/material";import BO from"@mui/icons-material/ArrowUpwardRounded";import{TextField as _O}from"@ehfuse/mui-form-controls";import km from"@mui/icons-material/Close";import IO from"@mui/icons-material/EditOutlined";import nk from"@mui/icons-material/ContentCopyOutlined";import rk from"@mui/icons-material/Check";import wO from"@mui/icons-material/Favorite";import DO from"@mui/icons-material/FavoriteBorderOutlined";import EO from"@mui/icons-material/CheckCircle";import RO from"@mui/icons-material/CheckCircleOutlineOutlined";import za from"@mui/icons-material/AttachFileOutlined";import PO from"@mui/icons-material/AddCircleOutline";import MO from"@mui/icons-material/ImageOutlined";var Pp=e=>{if(e===0)return"0 Bytes";let t=1024,o=["Bytes","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,i)).toFixed(2))+" "+o[i]};import{useCallback as um,useEffect as eO,useMemo as tO,useRef as $h,useState as Mp}from"react";import{Box as dm,Paper as oO,Popper as nO}from"@mui/material";import{jsx as Yi,jsxs as iO}from"react/jsx-runtime";var Vh=8,rO=[{key:"\uC88B\uC544\uC694",get label(){return n("emoji.like")},insert:"\u{1F44D}",keywords:["like","\uC5C4\uC9C0","\uAD7F"]},{key:"\uD655\uC778",get label(){return n("emoji.check")},insert:"\u2705",keywords:["check","\uC644\uB8CC","\uCCB4\uD06C"]},{key:"\uAC10\uC0AC",get label(){return n("emoji.thanks")},insert:"\u{1F64F}",keywords:["thanks","\uACE0\uB9C8\uC6CC","\uBD80\uD0C1"]},{key:"\uCD95\uD558",get label(){return n("emoji.party")},insert:"\u{1F389}",keywords:["party","\uD30C\uD2F0","\uC9DD\uC9DD"]},{key:"\uBC15\uC218",get label(){return n("emoji.clap")},insert:"\u{1F44F}",keywords:["clap","\uC798\uD588\uC5B4"]},{key:"\uD558\uD2B8",get label(){return n("emoji.heart")},insert:"\u2764\uFE0F",keywords:["heart","\uC0AC\uB791"]},{key:"\uC6C3\uC74C",get label(){return n("emoji.laugh")},insert:"\u{1F604}",keywords:["smile","\uC6C3\uAE40","\u314B\u314B"]},{key:"\uBBF8\uC18C",get label(){return n("emoji.smile")},insert:"\u{1F642}",keywords:["smile","\uC88B\uC74C"]},{key:"\uB208\uBB3C",get label(){return n("emoji.tears")},insert:"\u{1F622}",keywords:["sad","\uC2AC\uD514","\u3160\u3160"]},{key:"\uB180\uB78C",get label(){return n("emoji.wow")},insert:"\u{1F62E}",keywords:["wow","\uD5C9"]},{key:"\uACE0\uBBFC",get label(){return n("emoji.think")},insert:"\u{1F914}",keywords:["think","\uC0DD\uAC01","\uC74C"]},{key:"\uC624\uCF00\uC774",get label(){return n("emoji.ok")},insert:"\u{1F44C}",keywords:["ok","\uC54C\uACA0\uC5B4"]},{key:"\uBD88",get label(){return n("emoji.fire")},insert:"\u{1F525}",keywords:["fire","\uAE09\uD568","\uB300\uBC15"]},{key:"\uC544\uC774\uB514\uC5B4",get label(){return n("emoji.idea")},insert:"\u{1F4A1}",keywords:["idea","\uC804\uAD6C"]},{key:"\uACBD\uACE0",get label(){return n("emoji.warning")},insert:"\u26A0\uFE0F",keywords:["warning","\uC8FC\uC758"]},{key:"\uC9C8\uBB38",get label(){return n("emoji.question")},insert:"\u2753",keywords:["question","\uBB3C\uC74C"]},{key:"\uC2DC\uACC4",get label(){return n("emoji.clock")},insert:"\u23F0",keywords:["time","\uC2DC\uAC04","\uC54C\uB78C"]},{key:"\uB2EC\uB825",get label(){return n("emoji.calendar")},insert:"\u{1F4C5}",keywords:["calendar","\uC77C\uC815","\uB0A0\uC9DC"]},{key:"\uBA54\uBAA8",get label(){return n("emoji.note")},insert:"\u{1F4DD}",keywords:["note","\uAE30\uB85D"]},{key:"\uCCA8\uBD80",get label(){return n("emoji.attach")},insert:"\u{1F4CE}",keywords:["attach","\uD074\uB9BD","\uD30C\uC77C"]},{key:"\uB9C1\uD06C",get label(){return n("emoji.link")},insert:"\u{1F517}",keywords:["link","\uC8FC\uC18C"]},{key:"\uB85C\uCF13",get label(){return n("emoji.rocket")},insert:"\u{1F680}",keywords:["rocket","\uCD9C\uBC1C","\uBC30\uD3EC"]},{key:"\uBCC4",get label(){return n("emoji.star")},insert:"\u2B50",keywords:["star","\uC911\uC694"]},{key:"\uC5D1\uC2A4",get label(){return n("emoji.x")},insert:"\u274C",keywords:["x","\uC548\uB428","\uCDE8\uC18C"]}];function Zl(e,t,o){let i=e.slice(0,t),a=(o==="@"?/(^|[\s(])@([^\s@]{0,20})$/:/(^|[\s(])\/([^\s/]{0,20})$/).exec(i);return a?{start:t-a[2].length-1,query:a[2]}:null}function Op(e,t){let o=fe(),i=e??o.mentionCandidates??[],r=t??o.slashCommands,a=r===!0?rO:Array.isArray(r)?r:[];return{people:i,commands:a,enabled:i.length>0||a.length>0}}function Lp(e,t,o){if(!o)return[];let i=o.query.toLowerCase();return o.trigger==="@"?e.filter(r=>r.name.toLowerCase().includes(i)).slice(0,Vh).map((r,a)=>({id:`p${a}-${r.name}`,text:`@${r.name} `,label:r.name,subtitle:r.subtitle,icon:Yi(bo,{src:r.avatar??"",name:r.name,avatarSx:{width:24,height:24,fontSize:14},iconFontSize:16})})):t.filter(r=>[r.key,r.label,...r.keywords??[]].some(a=>a.toLowerCase().includes(i))).slice(0,Vh).map(r=>({id:`c-${r.key}`,text:r.insert,label:`/${r.label}`,icon:Yi(dm,{component:"span",sx:{width:24,textAlign:"center",fontSize:18,lineHeight:1},children:r.insert})}))}function Ap({open:e,anchor:t,items:o,active:i,onPick:r,onHover:a}){return Yi(nO,{open:e,anchorEl:t,placement:"top-start",sx:{zIndex:1500},children:Yi(oO,{elevation:4,sx:{minWidth:220,maxWidth:320,py:.5,borderRadius:1.5},children:o.map((l,s)=>iO(dm,{role:"option","aria-selected":s===i,onMouseDown:c=>c.preventDefault(),onClick:()=>r(l),onMouseEnter:()=>a(s),sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:.75,cursor:"pointer",fontSize:14,bgcolor:s===i?"action.selected":"transparent"},children:[l.icon,Yi(dm,{component:"span",sx:{fontWeight:500,whiteSpace:"nowrap"},children:l.label}),l.subtitle?Yi(dm,{component:"span",sx:{color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.subtitle}):null]},l.id))})})}function Kh({value:e,setValue:t,candidates:o,slashCommands:i}){let{people:r,commands:a,enabled:l}=Op(o,i),s=$h(null),[c,u]=Mp(null),[m,p]=Mp(null),[d,f]=Mp(0),g=tO(()=>Lp(r,a,m),[a,r,m]),x=!!(c&&m&&g.length>0),b=um(()=>{let T=s.current;if(!l||!T)return;let B=T.selectionStart??T.value.length,E=r.length>0?Zl(T.value,B,"@"):null,q=!E&&a.length>0?Zl(T.value,B,"/"):null,R=E?{...E,trigger:"@"}:q?{...q,trigger:"/"}:null;p(R),f(0),u(R?T.closest(".MuiInputBase-root")??T:null)},[a.length,l,r.length]),_=$h(null);eO(()=>{let T=s.current,B=_.current;if(B!==null&&T){_.current=null,T.setSelectionRange(B,B);return}document.activeElement===T&&b()},[e,b]);let h=um(T=>{let B=s.current;if(!m||!B)return;let E=B.selectionStart??e.length,q=e.slice(0,m.start)+T.text+e.slice(E),R=m.start+T.text.length;_.current=q===e?null:R,t(q),p(null),u(null),requestAnimationFrame(()=>{_.current=null,B.focus(),B.setSelectionRange(R,R)})},[m,t,e]),v=um(T=>!x||T.nativeEvent.isComposing?!1:T.key==="ArrowDown"||T.key==="ArrowUp"?(T.preventDefault(),f(B=>(B+(T.key==="ArrowDown"?1:g.length-1))%g.length),!0):T.key==="Enter"||T.key==="Tab"?(T.preventDefault(),h(g[Math.min(d,g.length-1)]),!0):T.key==="Escape"?(T.preventDefault(),T.stopPropagation(),p(null),u(null),!0):!1,[d,g,x,h]);return{inputRef:um(T=>{s.current=T},[]),onKeyDown:v,onSelectionChange:b,popper:l?Yi(Ap,{open:x,anchor:c,items:g,active:d,onPick:h,onHover:f}):null}}import{useCallback as Np,useEffect as aO,useRef as Uh,useState as Gh}from"react";import{Box as es,Tab as lO,Tabs as sO}from"@mui/material";import{jsx as Aa,jsxs as uO}from"react/jsx-runtime";var jh=[{key:"smile",labelKey:"section.emojiSmileys",items:["\u{1F600}","\u{1F603}","\u{1F604}","\u{1F601}","\u{1F606}","\u{1F605}","\u{1F923}","\u{1F602}","\u{1F642}","\u{1F643}","\u{1F609}","\u{1F60A}","\u{1F607}","\u{1F970}","\u{1F60D}","\u{1F929}","\u{1F618}","\u{1F617}","\u{1F61A}","\u{1F619}","\u{1F60B}","\u{1F61B}","\u{1F61C}","\u{1F92A}","\u{1F61D}","\u{1F917}","\u{1F92D}","\u{1F92B}","\u{1F914}","\u{1F928}","\u{1F610}","\u{1F611}","\u{1F636}","\u{1F60F}","\u{1F612}","\u{1F644}","\u{1F62C}","\u{1F60C}","\u{1F614}","\u{1F62A}","\u{1F634}","\u{1F637}","\u{1F912}","\u{1F915}","\u{1F975}","\u{1F976}","\u{1F635}","\u{1F92F}","\u{1F60E}","\u{1F973}","\u{1F622}","\u{1F62D}","\u{1F624}","\u{1F620}","\u{1F621}","\u{1F97A}","\u{1F633}","\u{1F631}","\u{1F628}","\u{1F630}","\u{1F625}","\u{1F910}","\u{1F62F}","\u{1F62E}"]},{key:"gesture",labelKey:"section.emojiPeople",items:["\u{1F44D}","\u{1F44E}","\u{1F44C}","\u270C\uFE0F","\u{1F91E}","\u{1F91F}","\u{1F918}","\u{1F919}","\u{1F448}","\u{1F449}","\u{1F446}","\u{1F447}","\u261D\uFE0F","\u270B","\u{1F91A}","\u{1F590}\uFE0F","\u{1F596}","\u{1F44B}","\u{1F91D}","\u{1F64F}","\u{1F4AA}","\u{1F9BE}","\u{1F44F}","\u{1F64C}","\u{1F450}","\u{1F932}","\u{1FAF6}","\u270D\uFE0F","\u{1F485}","\u{1F933}","\u{1F9E0}","\u{1F440}","\u{1F647}","\u{1F64B}","\u{1F646}","\u{1F645}","\u{1F481}","\u{1F937}","\u{1F926}","\u{1F9D1}\u200D\u{1F4BB}","\u{1F468}\u200D\u{1F4BC}","\u{1F469}\u200D\u{1F4BC}","\u{1F6B6}","\u{1F3C3}","\u{1F483}","\u{1F57A}","\u{1F476}","\u{1F9D3}"]},{key:"heart",labelKey:"section.emojiHearts",items:["\u2764\uFE0F","\u{1F9E1}","\u{1F49B}","\u{1F49A}","\u{1F499}","\u{1F49C}","\u{1F5A4}","\u{1F90D}","\u{1F90E}","\u{1F494}","\u2763\uFE0F","\u{1F495}","\u{1F49E}","\u{1F493}","\u{1F497}","\u{1F496}","\u{1F498}","\u{1F49D}","\u{1F49F}","\u2728","\u{1F4AB}","\u{1F4A5}","\u{1F389}","\u{1F38A}","\u{1F388}","\u{1F381}","\u{1F451}","\u{1FAC2}","\u{1F63B}","\u{1F490}","\u{1F380}","\u{1F48C}"]},{key:"work",labelKey:"section.emojiWork",items:["\u{1F4CC}","\u{1F4CE}","\u{1F4DD}","\u{1F4C4}","\u{1F4D1}","\u{1F4CA}","\u{1F4C8}","\u{1F4C9}","\u{1F5C2}\uFE0F","\u{1F4C5}","\u{1F4C6}","\u23F0","\u231B","\u2705","\u2611\uFE0F","\u274C","\u2B55","\u2757","\u2753","\u{1F4A1}","\u{1F514}","\u{1F515}","\u{1F4E2}","\u{1F4E3}","\u{1F4AC}","\u{1F4AD}","\u{1F517}","\u{1F512}","\u{1F511}","\u2699\uFE0F","\u{1F6E0}\uFE0F","\u{1F4EC}","\u{1F4BB}","\u{1F5A5}\uFE0F","\u{1F5A8}\uFE0F","\u{1F4DE}","\u{1F4F1}","\u{1F4B0}","\u{1F4B3}","\u{1F9FE}","\u{1F4E6}","\u{1F550}","\u{1F4CB}","\u{1F587}\uFE0F","\u270F\uFE0F","\u{1F5D1}\uFE0F","\u267B\uFE0F","\u{1F50D}"]},{key:"food",labelKey:"section.emojiFood",items:["\u2615","\u{1F375}","\u{1F964}","\u{1F9C3}","\u{1F37A}","\u{1F37B}","\u{1F942}","\u{1F377}","\u{1F378}","\u{1F943}","\u{1F35A}","\u{1F35C}","\u{1F372}","\u{1F35B}","\u{1F371}","\u{1F359}","\u{1F354}","\u{1F35F}","\u{1F355}","\u{1F32D}","\u{1F96A}","\u{1F32E}","\u{1F35D}","\u{1F957}","\u{1F356}","\u{1F357}","\u{1F969}","\u{1F373}","\u{1F95E}","\u{1F9C7}","\u{1F35E}","\u{1F950}","\u{1F370}","\u{1F382}","\u{1F9C1}","\u{1F36A}","\u{1F369}","\u{1F36B}","\u{1F36C}","\u{1F36D}","\u{1F366}","\u{1F34E}","\u{1F34A}","\u{1F34B}","\u{1F34C}","\u{1F349}","\u{1F347}","\u{1F353}"]},{key:"etc",labelKey:"section.emojiOther",items:["\u{1F525}","\u2B50","\u{1F31F}","\u{1F4AF}","\u{1F3AF}","\u{1F3C6}","\u{1F947}","\u{1F680}","\u{1F308}","\u2600\uFE0F","\u{1F319}","\u26C5","\u2601\uFE0F","\u{1F327}\uFE0F","\u2744\uFE0F","\u26A1","\u{1F338}","\u{1F33A}","\u{1F337}","\u{1F339}","\u{1F33B}","\u{1F340}","\u{1F33F}","\u{1F331}","\u{1F436}","\u{1F431}","\u{1F430}","\u{1F43C}","\u{1F98A}","\u{1F43B}","\u{1F425}","\u{1F98B}","\u{1F697}","\u2708\uFE0F","\u{1F3E0}","\u{1F3E2}","\u{1F3B5}","\u{1F3B6}","\u{1F4DA}","\u{1F3AE}","\u26BD","\u{1F3C0}","\u{1F48A}","\u{1FA7A}","\u{1F9F3}","\u{1F382}","\u{1F6D2}","\u{1F9F9}"]}],cO="'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif",Yh="taskbox.recentEmojis",Xh=24;function Qh(){try{let e=JSON.parse(window.localStorage.getItem(Yh)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string").slice(0,Xh):[]}catch{return[]}}function mO(e){let t=[e,...Qh().filter(o=>o!==e)].slice(0,Xh);try{window.localStorage.setItem(Yh,JSON.stringify(t))}catch{}return t}function Jh({onPick:e}){let[t,o]=Gh(()=>Qh()),[i,r]=Gh(0),a=Uh(null),l=Uh(!1),s=t.length>0?[{key:"recent",labelKey:"section.emojiFrequent",items:t},...jh]:jh,c=Math.min(i,s.length-1),u=Np(d=>{o(mO(d)),e(d)},[e]),m=Np(d=>{r(d);let f=a.current;f&&(l.current=!0,f.scrollTo({left:f.clientWidth*d,behavior:"smooth"}),window.setTimeout(()=>{l.current=!1},350))},[]),p=Np(()=>{let d=a.current;if(!d||l.current||d.clientWidth===0)return;let f=Math.round(d.scrollLeft/d.clientWidth);r(g=>f!==g&&f>=0?f:g)},[]);return aO(()=>{let d=a.current;d&&(d.scrollLeft=d.clientWidth*c)},[]),uO(es,{children:[Aa(sO,{value:c,onChange:(d,f)=>m(f),variant:"scrollable",scrollButtons:!1,sx:{minHeight:36,borderBottom:`1px solid ${se}`,"& .MuiTab-root":{minHeight:36,minWidth:0,px:1.5,fontSize:13}},children:s.map(d=>Aa(lO,{label:n(d.labelKey)},d.key))}),Aa(es,{ref:a,onScroll:p,sx:{display:"flex",height:352,overflowX:"auto",overflowY:"hidden",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},children:s.map(d=>Aa(es,{sx:{flex:"0 0 100%",width:"100%",height:"100%",overflowY:"auto",scrollSnapAlign:"start",scrollSnapStop:"always",p:1},children:Aa(es,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(40px, 1fr))"},children:d.items.map((f,g)=>Aa(es,{component:"button",type:"button",onClick:()=>u(f),"aria-label":f,sx:{border:0,bgcolor:"transparent",color:"#000",cursor:"pointer",fontFamily:cO,fontSize:24,lineHeight:1,py:.75,borderRadius:"8px","&:hover":{bgcolor:"rgba(15, 23, 42, 0.06)"},"&:active":{bgcolor:"rgba(15, 23, 42, 0.1)"}},children:f},`${f}-${g}`))})},d.key))})]})}import{forwardRef as kO,useImperativeHandle as TO,useLayoutEffect as tk,useRef as fm,useState as ek}from"react";import{Box as Wp}from"@mui/material";import{EhfuseEditor as yO}from"@ehfuse/editor";import{useCallback as qp,useMemo as dO,useRef as pO,useState as zp}from"react";import{jsx as fO}from"react/jsx-runtime";function Zh(e,t){let{people:o,commands:i,enabled:r}=Op(e,t),[a,l]=zp(null),[s,c]=zp(null),u=pO(""),[m,p]=zp(0),d=dO(()=>Lp(o,i,a),[i,o,a]),f=!!(r&&s&&a&&d.length>0),g=qp(()=>{if(!r)return;let h=window.getSelection();if(!h||h.rangeCount===0||!h.isCollapsed)return void l(null);let v=h.anchorNode;if(!v||v.nodeType!==Node.TEXT_NODE||!v.parentElement?.closest(".ehfuse-editor-content"))return void l(null);let k=v.data,A=h.anchorOffset,T=o.length>0?Zl(k,A,"@"):null,B=!T&&i.length>0?Zl(k,A,"/"):null,E=T?{...T,trigger:"@"}:B?{...B,trigger:"/"}:null;if(!E){u.current="",l(null),c(null);return}l({node:v,start:E.start,end:A,query:E.query,trigger:E.trigger});let q=`${E.trigger}${E.query}`;q!==u.current&&p(0),u.current=q;let R=document.createRange();R.setStart(v,E.start),R.setEnd(v,Math.min(E.start+1,k.length));let C=R.getBoundingClientRect();c({getBoundingClientRect:()=>C})},[i.length,r,o.length]),x=qp(h=>{if(!a)return;let{node:v,start:k,end:A}=a;if(!v.isConnected)return void l(null);let T=window.getSelection(),B=document.createRange();B.setStart(v,k),B.setEnd(v,Math.min(A,v.data.length)),T?.removeAllRanges(),T?.addRange(B),document.execCommand("insertText",!1,h.text),l(null),c(null)},[a]);return{handlers:{onKeyDownCapture:qp(h=>{!f||h.nativeEvent.isComposing||(h.key==="ArrowDown"||h.key==="ArrowUp"?(h.preventDefault(),h.stopPropagation(),p(v=>(v+(h.key==="ArrowDown"?1:d.length-1))%d.length)):h.key==="Enter"||h.key==="Tab"?(h.preventDefault(),h.stopPropagation(),x(d[Math.min(m,d.length-1)])):h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),l(null),c(null)))},[m,d,f,x]),onKeyUp:g,onMouseUp:g,onInput:g},popper:r?fO(Ap,{open:f,anchor:s,items:d,active:m,onPick:x,onHover:p}):null,isOpen:f}}function Na(e){return/^\s*<(p|div|ul|ol|h[1-6]|blockquote|pre)[\s>]/i.test(e)}var gO=new Set(["P","BR","DIV","SPAN","STRONG","B","EM","I","U","S","STRIKE","DEL","CODE","PRE","UL","OL","LI","H1","H2","H3","H4","BLOCKQUOTE","A","MARK"]),xO=new Set(["background-color","color","text-decoration"]);function pm(e){if(typeof DOMParser>"u")return"";let o=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html").body.firstElementChild;if(!o)return"";let i=r=>{for(let a of Array.from(r.children)){if(!gO.has(a.tagName)){if(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE"].includes(a.tagName)){a.remove();continue}i(a),a.replaceWith(...Array.from(a.childNodes));continue}for(let l of Array.from(a.attributes)){let s=l.name.toLowerCase();if(a.tagName==="A"&&s==="href"){/^(https?:|mailto:|tel:)/i.test(l.value.trim())||a.removeAttribute(l.name);continue}if(s==="style"){let c=l.value.split(";").map(u=>u.trim()).filter(u=>xO.has(u.split(":")[0]?.trim().toLowerCase()??"")&&!/url\(|expression/i.test(u)).join("; ");c?a.setAttribute("style",c):a.removeAttribute("style");continue}a.removeAttribute(l.name)}i(a)}};return i(o),o.innerHTML}function ts(e){if(typeof DOMParser>"u")return e.replace(/<[^>]*>/g,"");let t=e.replace(/<br\s*\/?>/gi,`
|
|
11
|
+
`).trim()}var FR={...dh,left:(dh.left??[]).map(e=>e.filter(t=>t!=="undo"&&t!=="redo")).filter(e=>e.length>0).flatMap(e=>e.includes("indent")?[["bulletList","numberList"],e]:[e]).map(e=>e.includes("link")?[...e,"table"]:e).concat([["blocks"]])},HR=!1;function Vl(){let e=Ge(),t=gh(),o=ar({});return{switcher:HR&&!e&&t.length>0?Et(Vi,{role:"group","aria-label":n("common.content"),sx:{ml:"auto",display:"flex",alignItems:"center",gap:.5},children:t.map(r=>{let a=jc[r];return Et(Xc,{size:"small",onMouseDown:l=>l.preventDefault(),onClick:()=>o.current.insert?.(r),startIcon:Et(a,{sx:{fontSize:"18px !important"}}),sx:{py:.25,px:1,minWidth:0,fontSize:13,fontWeight:400,lineHeight:1.6,textTransform:"none",color:"text.secondary","& .MuiButton-startIcon":{mr:.5,ml:0},"&:hover":{bgcolor:"action.hover"}},children:n(Yc[r])},r)})}):null,bridge:o.current}}function gh(){let e=fe();return[e.contentSheet?"sheet":null,e.contentDraw?"draw":null,e.contentMindmap?"mindmap":null].filter(Boolean)}function Qc({syncKey:e,value:t,onChange:o,readOnly:i=!1,viewFirst:r=!1,onTranslate:a,minHeight:l=180,editing:s,onEditingChange:c,modeControl:u}){O();let{uploadContentImage:m,openExternalUrl:p,openContentImage:d,contentFullBleed:f}=fe(),g=!!f,x=g?{mx:-2,mb:-1.5}:{},b=g?"16px":"12px",_=Q=>{p?p(Q):window.open(Q,"_blank","noopener,noreferrer")},[h,v]=ch(()=>!r||!Ki(t).trim()),k=s!==void 0,A=k?s:h,T=ar(c);T.current=c;let B=Q=>{k||v(Q),T.current?.(Q)};sh(()=>{r&&B(!Ki(t).trim())},[e,r]);let E=Vl(),q=u?.bridge??E.bridge,R=u||!E.switcher?null:Et(Vi,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mb:-.5},children:E.switcher}),C=ar(null),S=ar(new NR),D=ar(null),y=ar(Date.now()+800),M=ar({value:t,touched:!1}),z=()=>{M.current.touched=!0},K=Ge(),w=gh(),P=ar(null),U=lh({editorRef:C,wrapperRef:P,kinds:w,isMobile:K,onBeforeNotify:()=>{z(),y.current=0}});q.insert=U.insert;let N=MR(),ee=PR(N.breakpoints.down("sm")),[ne,pe]=ch(!1),G=()=>{let Q=Ki(t);Q&&navigator.clipboard.writeText(Q).then(()=>{pe(!0),window.setTimeout(()=>pe(!1),1500)})},te=(Q,ae=!1)=>Q instanceof Element?Q.closest(ae?".taskbox-content-readview a[href]":".ehfuse-editor-content a[href]"):null,H=Q=>K||Q.ctrlKey||Q.metaKey;sh(()=>{if(i)return;let Q=ph(t);D.current===Q||D.current===t||(D.current=Q,y.current=Date.now()+800,M.current={value:t,touched:!1},C.current?.setHtml(Q))},[e,t,i]);let Y=fh(t),ce=ar(null),he=ar({el:null,html:""});return RR(()=>{let Q=ce.current;Q&&(he.current.el===Q&&he.current.html===Y||(Q.innerHTML=Y,Ib(Q),he.current={el:Q,html:Y}))}),i||!A?$l(Vi,{sx:{position:"relative",mt:1},children:[Et(Vi,{onClickCapture:Q=>{let ae=Q.target;if(ae?.tagName==="IMG"&&ae.src){Q.preventDefault(),Q.stopPropagation();let I=Array.from(Q.currentTarget.querySelectorAll("img")).filter(oe=>oe.src),V=I.map((oe,ge)=>({src:oe.src,name:oe.alt||decodeURIComponent(oe.src.split("/").pop()||"")||`image-${ge+1}`})),j=Math.max(0,I.indexOf(ae));d?d(V,j):_(V[j].src);return}let Z=te(Q.target,!0);Z&&(Q.preventDefault(),Q.stopPropagation(),_(Z.href))},ref:ce,className:"taskbox-content-readview","data-drag-scroll":"off",sx:{...g?{...x,border:0,borderTop:"1px solid #e0e0e0",borderRadius:0}:{border:"1px solid #e0e0e0",borderRadius:1},p:"12px",pl:b,pr:ee?b:"52px",pb:"28px",minHeight:l,fontSize:16,lineHeight:1.6,color:"#37352f",wordBreak:"break-word",userSelect:"text","& > p:first-of-type":{mt:0},"& > p:last-of-type":{mb:0},"& a[href]":{color:"#2563eb",textDecoration:"underline",cursor:"pointer"},"& img":{maxWidth:"100%",cursor:"zoom-in"},"& ul, & ol":{pl:"1.5em",my:.5},"& ul":{listStyleType:"disc"},"& ol":{listStyleType:"decimal"},"& li > p":{my:0},...hp}}),ee?$l(Vi,{sx:{display:"flex",gap:1,mt:1},children:[Et(Xc,{variant:"outlined",color:"inherit",startIcon:Et(LR,{sx:{fontSize:18}}),onClick:G,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:ne?n("section.copied"):n("common.copy")}),i?null:Et(Xc,{variant:"outlined",color:"inherit",startIcon:Et(mh,{sx:{fontSize:18}}),onClick:()=>B(!0),sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:n("common.edit")}),a?Et(Xc,{variant:"outlined",color:"inherit",startIcon:Et(uh,{sx:{fontSize:18}}),onClick:a,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:n("section.translate")}):null]}):$l(Vi,{sx:{position:"absolute",top:6,right:6,display:"flex",flexDirection:"column",gap:.25},children:[i?null:Et(Tp,{title:n("section.editContent"),arrow:!0,placement:"left",children:Et(kp,{size:"small","aria-label":n("section.editContent"),onClick:()=>B(!0),sx:{color:"#9a9a97"},children:Et(mh,{sx:{fontSize:17}})})}),a?Et(Tp,{title:n("section.translate"),arrow:!0,placement:"left",children:Et(kp,{size:"small","aria-label":n("section.translate"),onClick:a,sx:{color:"#9a9a97"},children:Et(uh,{sx:{fontSize:17}})})}):null]})]}):$l(WR,{children:[K?null:R,$l(Vi,{onDragOver:Q=>Q.stopPropagation(),onDrop:Q=>Q.stopPropagation(),onClickCapture:Q=>{let ae=H(Q)?te(Q.target):null;ae&&(Q.preventDefault(),Q.stopPropagation(),_(ae.href))},ref:P,onMouseLeave:U.onMouseLeave,onKeyDownCapture:Q=>{let ae=(Q.ctrlKey||Q.metaKey)&&/^[ac]$/i.test(Q.key);!zR.has(Q.key)&&!ae&&z()},onInputCapture:z,onPasteCapture:z,onDropCapture:z,onMouseDownCapture:Q=>{H(Q)&&te(Q.target)&&Q.preventDefault(),Q.target?.closest?.(".ehfuse-toolbar")&&z()},sx:{mt:Nl,[`& .ehfuse-editor-content :is(${Pr})`]:{my:"10px",border:"1px solid #e0e0e0",borderRadius:1,overflow:"hidden",cursor:"pointer",userSelect:"none","& img":{display:"block",maxWidth:"100%",height:"auto"},"& table:not([border])":{my:0}},"& .ehfuse-editor-content [data-tb-block=sheet]":{maxHeight:`calc(${qR} * (1.5em + 13px))`},"& .ehfuse-editor-content > p:first-of-type":{mt:0},"& .ehfuse-editor-content > p:last-of-type":{mb:0},"& .ehfuse-editor-content.ehfuse-editor-empty::before":{top:"12px",left:b},...g?{...x,"& .ehfuse-editor-wrapper":{borderLeftWidth:0,borderRightWidth:0,borderBottomWidth:0,borderRadius:0},"& .ehfuse-editor-wrapper.ehfuse-focus-border::after":{inset:"-1px 0 auto 0 !important",height:"0 !important",border:"0 !important",borderTop:Q=>`1px solid ${Q.palette.primary.main} !important`,borderRadius:"0 !important"}}:{},...K?{"& .ehfuse-editor-content a[href]":{cursor:"pointer"}}:{},position:"relative"},children:[r&&!k?Et(Tp,{title:n("section.finishEditingTooltip"),arrow:!0,children:Et(kp,{size:"small","aria-label":n("section.finishEditing"),onMouseDown:Q=>Q.preventDefault(),onClick:()=>B(!1),sx:{position:"absolute",top:4,right:6,zIndex:2,color:"#2f9e5b"},children:Et(OR,{sx:{fontSize:19}})})}):null,Et(AR,{ref:C,defaultValue:ph(t),autoHeight:!0,showToolbar:!K,focusBorder:!0,styles:{focusBorderColor:"var(--primary)"},toolbarOptions:FR,blockMenu:w.map(Q=>{let ae=jc[Q];return{key:Q,label:n(Yc[Q]),icon:Et(ae,{sx:{fontSize:18}}),onSelect:()=>U.insert(Q)}}),plugins:[S.current],locale:go(),minHeight:l,placeholder:n("section.contentPlaceholder"),blocks:Yb,onReady:U.onReady,onImageUpload:m,contentStyle:{padding:`12px ${b}`},onChange:Q=>{let ae=Date.now()<y.current,Z=Q===D.current;if(D.current=Q,ae||Z)return;let I=M.current;!I.touched&&Zb(Q,I.value)||o(Q)}}),U.overlay]})]})}import{Fragment as JR,jsx as Do,jsxs as Zc}from"react/jsx-runtime";function Sp(e){return String(e??"").replace(/<[^>]*>/g,"").replace(/ /g," ").trim().length>0}function em({content:e,templates:t,onApply:o,onSave:i,onRemove:r,readOnly:a=!1}){O();let[l,s]=yp(null),[c,u]=yp(!1),[m,p]=yp(""),d=async g=>{s(null),!(Sp(e)&&!await GR({title:n("section.loadTemplate"),message:n("section.loadTemplateConfirm",{name:g.name})}))&&o(g.content)},f=()=>{s(null);let g=Ki(e);g&&navigator.clipboard.writeText(g).then(()=>YR(n("section.contentCopied"))).catch(()=>jR(n("section.contentCopyFailed")))};return Zc(JR,{children:[Do(KR,{title:n("section.contentMenu"),arrow:!0,disableInteractive:!0,children:Do(bh,{size:"small","aria-label":n("section.contentMenu"),onClick:g=>s(g.currentTarget),sx:{ml:"auto",color:"#9a9a97"},children:Do(UR,{sx:{fontSize:18}})})}),Zc(VR,{anchorEl:l,open:!!l,onClose:()=>s(null),transitionDuration:0,children:[Do(Jc,{disabled:!Sp(e),onClick:f,sx:{fontSize:14,minWidth:220},children:n("menu.copyContent")}),a?null:Do(xh,{sx:{my:.5}}),!a&&i?Do(Jc,{disabled:!Sp(e),onClick:()=>{s(null),p(""),u(!0)},sx:{fontSize:14,minWidth:220},children:n("section.saveAsTemplate")}):null,!a&&i?Do(xh,{sx:{my:.5}}):null,a?null:t.length===0?Do(Jc,{disabled:!0,sx:{fontSize:14,minWidth:220},children:n("section.noSavedTemplates")}):t.map(g=>Zc(Jc,{onClick:()=>{d(g)},sx:{fontSize:14,minWidth:220,gap:1},children:[Do(Cp,{sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.name}),r?Do(bh,{size:"small","aria-label":n("section.deleteTemplateAria",{name:g.name}),onClick:x=>{x.stopPropagation(),r(g.seq)},sx:{color:"#9a9a97"},children:Do(Xt,{sx:{fontSize:16}})}):null]},g.seq))]}),Do(XR,{open:c,onClose:()=>u(!1),maxWidth:"xs",title:n("section.saveTemplateTitle"),locale:Ee(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},tabs:{visible:!1},actions:{showCancelButton:!0,right:Do($R,{variant:"contained",disabled:!m.trim(),onClick:()=>{i?.(m.trim(),e),u(!1)},children:n("common.save")})},sections:[{id:"template-name",title:"",showTitle:!1,children:Zc(Cp,{sx:{display:"flex",flexDirection:"column",gap:1},children:[Do(Cp,{sx:{fontSize:15,color:"#37352f"},children:n("section.saveTemplateHint")}),Do(QR,{size:"medium",fullWidth:!0,autoFocus:!0,placeholder:n("section.templateNamePlaceholder"),value:m,onChange:g=>p(g.target.value)})]})}]})]})}import{useState as Gl}from"react";import{Box as $t,Button as Th,Dialog as dP,IconButton as Ma,Switch as pP,TextField as fP,Tooltip as vp}from"@mui/material";import{DndContext as gP,PointerSensor as xP,closestCenter as bP,useSensor as hP,useSensors as kP}from"@dnd-kit/core";import{restrictToParentElement as TP,restrictToVerticalAxis as yP}from"@dnd-kit/modifiers";import{SortableContext as CP,arrayMove as SP,useSortable as vP,verticalListSortingStrategy as BP}from"@dnd-kit/sortable";import{CSS as _P}from"@dnd-kit/utilities";import yh from"@mui/icons-material/Close";import IP from"@mui/icons-material/AddCircle";import Ch from"@mui/icons-material/AddTask";import wP from"@mui/icons-material/Checklist";import DP from"@mui/icons-material/CheckCircle";import EP from"@mui/icons-material/DragIndicator";import RP from"@mui/icons-material/Launch";import PP from"@mui/icons-material/LinkOutlined";import MP from"@mui/icons-material/RadioButtonUnchecked";import{useMemo as nP}from"react";import{Box as lr,Button as rP,Tab as iP,Tabs as aP}from"@mui/material";import{FormDialog as lP}from"@ehfuse/mui-form-dialog";import{ClearTextField as sP}from"@ehfuse/mui-form-controls";import cP from"@mui/icons-material/CheckCircle";import mP from"@mui/icons-material/RadioButtonUnchecked";import{OverlayScrollbar as uP}from"@ehfuse/overlay-scrollbar";import{useRef as ZR}from"react";import{useGlobalForm as eP,useModal as tP}from"@ehfuse/forma";import{ErrorAlert as oP}from"@ehfuse/alerts";var hh={type:"related",search:"",selectedSeqs:[]};function Kl(e){O();let t=ZR(e);t.current=e;let o={link:tP({modalId:Oe("taskbox-task-link")})},i=eP({formId:Oe("taskbox-task-link-form"),initialValues:hh,onValidate:s=>s.selectedSeqs.length===0?(oP(n("link.selectTask")),!1):!0,onSubmit:s=>{let c=a(s.type)?s.selectedSeqs:s.selectedSeqs.slice(-1);for(let u of c)t.current.onSubmit(u,s.type);return o.link.close(),!0}}),r=()=>{i.setFormValues({...hh,selectedSeqs:[]}),o.link.open()};function a(s){let c=t.current.multiSelect;return typeof c=="function"?c(s):!!c}return{form:i,modals:o,openDialog:r,toggleSelected:s=>{let c=i.getFormValue("selectedSeqs")??[];if(c.includes(s)){i.setFormValue("selectedSeqs",c.filter(m=>m!==s));return}let u=i.getFormValue("type")??"related";i.setFormValue("selectedSeqs",a(u)?[...c,s]:[s])},isMulti:a}}import{jsx as ko,jsxs as tm}from"react/jsx-runtime";var kh=[{type:"related",get label(){return n("link.related")},get hint(){return n("link.relatedHint")}},{type:"follow_up",get label(){return n("link.previous")},get hint(){return n("link.previousHint")}},{type:"duplicate_of",get label(){return n("link.duplicate")},get hint(){return n("link.duplicateHint")}}];function om({controller:e,task:t,tasks:o,excludeSeqs:i=[],hideRelationType:r=!1,title:a=n("link.title"),confirmLabel:l=n("link.confirm")}){O();let s=Ge(),{form:c}=e,u=e.modals.link,m=c.useValue("type")??"related",p=String(c.useValue("search")??""),d=c.useValue("selectedSeqs")??[],f=nP(()=>{let b=new Set([t.seq,...i]),_=p.trim().toLowerCase();return o.filter(h=>b.has(h.seq)||h.is_event||h.is_notice||h.linked_only?!1:_?h.title.toLowerCase().includes(_)||(h.ticket_no??"").toLowerCase().includes(_):!0).sort((h,v)=>!!h.completed!=!!v.completed?h.completed?1:-1:v.seq-h.seq)},[o,t.seq,i,p]),g=kh.find(b=>b.type===m)?.hint??"",x=tm(lr,{sx:{display:"flex",flexDirection:"column",minHeight:0,height:s?"100%":"auto"},children:[r?null:ko(aP,{value:m,onChange:(b,_)=>{c.setFormValue("type",_),!e.isMulti(_)&&d.length>1&&c.setFormValue("selectedSeqs",d.slice(-1))},sx:{minHeight:38,flexShrink:0,borderBottom:`1px solid ${se}`,"& .MuiTab-root":{minHeight:38,py:.5,fontSize:16,color:"#333333"}},children:kh.map(b=>ko(iP,{value:b.type,label:b.label},b.type))}),r?null:ko(lr,{sx:{mt:1,mb:1.5,fontSize:14,flexShrink:0},children:g}),tm(lr,{sx:{...s?{height:"100%",minHeight:0}:{height:560},display:"flex",flexDirection:"column",...s?{}:{border:"1px solid #cccccc",borderRadius:1},overflow:"hidden",userSelect:"none"},children:[ko(lr,{sx:{px:1.5,py:1,borderBottom:"1px solid #cccccc",flexShrink:0},children:ko(sP,{placeholder:n("link.searchPlaceholder"),name:"search",form:c,fullWidth:!0,autoFocus:!0,size:"small",sx:{"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiInputBase-root":{px:0}}})}),ko(lr,{sx:{flex:1,minHeight:0},children:ko(uP,{style:{height:"100%"},contentStyle:{paddingTop:0},children:ko(lr,{sx:{display:"flex",flexDirection:"column"},children:f.length===0?ko(lr,{sx:{py:4,textAlign:"center",fontSize:13.5,color:"#9a9a97"},children:n("link.empty")}):f.map(b=>{let _=b.is_notice||b.is_event?He(b.icon||(b.is_notice?wt:Ft)):null,h=d.includes(b.seq);return tm(lr,{onClick:()=>e.toggleSelected(b.seq),sx:{display:"flex",alignItems:"center",gap:.75,px:1.5,py:1.25,flexShrink:0,cursor:"pointer",borderBottom:`1px solid ${se}`,"&:last-of-type":{borderBottom:"none"},bgcolor:h?"#e3eefb":"transparent","&:hover":{bgcolor:h?"#e3eefb":"#f7f7f5"}},children:[h?ko(cP,{sx:{fontSize:20,flexShrink:0,color:"#2f6fd0"}}):ko(mP,{sx:{fontSize:20,flexShrink:0,color:"#c9c8c5"}}),_?ko(_,{sx:{fontSize:17,flexShrink:0,color:b.icon_color||"#1e3a8a"}}):null,tm(lr,{component:"span",sx:{flex:1,minWidth:0,fontSize:15,color:"#37352f",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,overflow:"hidden",lineHeight:1.5,wordBreak:"break-word"},children:[b.ticket_no?`${b.ticket_no} `:"",b.title]}),ko(lr,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:ko(Ze,{option:Ht(b)})})]},b.seq)})})})})]})]});return ko(lP,{open:u.isOpen,onClose:u.close,maxWidth:"sm",fullScreen:s,mobilePresentation:s?"slide":"dialog",...s?{contentPaddingX:0,contentTopPadding:0,sectionsPaddingTop:0}:{},sx:s?{DialogContent:{pb:0,"& .os-content > div":{height:"100%",boxSizing:"border-box",paddingBottom:0,marginBottom:0},"& .FormSection-content, & .section-content":{height:"100%",paddingBottom:0,marginBottom:0}}}:void 0,title:a,locale:Ee(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-link",sections:[{id:"task-link",showTitle:!1,children:x}],scrollPastLastSection:!1,sectionContentPaddingTop:0,contentTopPadding:12,actions:{showCancelButton:!0,right:ko(rP,{variant:"contained",disabled:d.length===0,onClick:()=>{c.submit()},children:l})}})}import{ConfirmActionPopper as OP}from"@ehfuse/mui-confirm-action";var Ul={display:"inline-flex",alignItems:"center",gap:.4,flexShrink:0,px:.75,py:.2,borderRadius:1,fontSize:12,fontWeight:500,color:"#1d4f91",bgcolor:"#e3eefb",whiteSpace:"nowrap"};import{Fragment as NP,jsx as Re,jsxs as sr}from"react/jsx-runtime";var Sh="taskbox.checklist.hideCompleted";function LP({id:e,children:t}){let{attributes:o,listeners:i,setNodeRef:r,transform:a,transition:l,isDragging:s}=vP({id:e});return Re($t,{ref:r,sx:{transform:_P.Transform.toString(a),transition:l,...s?{opacity:.6,position:"relative",zIndex:1}:{}},children:t({handleProps:{...o,...i},dragging:s})})}function AP({sortable:e,sensors:t,rowIds:o,onDragEnd:i,compact:r,children:a}){let l=Re($t,{sx:{display:"flex",flexDirection:"column",mt:.5,pl:r?0:3.25},children:a});return e?Re(gP,{sensors:t,collisionDetection:bP,modifiers:[yP,TP],onDragEnd:i,children:Re(CP,{items:o,strategy:BP,children:l})}):l}function nm({taskSeq:e,checklist:t,onAdd:o,onToggle:i,confirmOnToggle:r=!1,onRemove:a,onUpdate:l,onReorder:s,removeLocked:c=!1,onConvertToTask:u,onOpenLinkedTask:m,linkCandidates:p,linkBaseTask:d,onLinkExistingTask:f,resolveLinkedTask:g,myAccountSeq:x=0}){O();let[b,_]=Gl(""),h=Kl({multiSelect:!0,onSubmit:G=>{if(!f)return;let te=p?.find(H=>H.seq===G);f(e,G,String(te?.title??"").trim())}}),[v,k]=Gl(null),A=Ge(),[T,B]=Gl(null),[E,q]=Gl(null),R=G=>{let te=G.task_seq?g?.(G.task_seq):void 0;return te?te.completed:G.checked},C=G=>{if(!G.task_seq||x<=0)return!1;let te=g?.(G.task_seq);return te?!$g(te,x):!1},S=G=>!!G.task_seq&&!!g&&!g?.(G.task_seq),D=t.filter(G=>!S(G)),y=D.filter(R).length,[M,z]=Gl(()=>{try{return localStorage.getItem(Sh)==="1"}catch{return!1}}),K=G=>{z(G);try{localStorage.setItem(Sh,G?"1":"0")}catch{}},w=!!s&&!A&&!c,P=kP(hP(xP,{activationConstraint:{distance:5}})),U=(G,te)=>G.task_seq?`linked-${G.task_seq}`:`row-${te}`,N=t.map(U),ee=N.filter((G,te)=>{let H=t[te];return S(H)?!1:!(M&&R(H))}),ne=G=>{let{active:te,over:H}=G;if(!H||te.id===H.id)return;let Y=N.indexOf(String(te.id)),ce=N.indexOf(String(H.id));Y<0||ce<0||s?.(e,SP(t,Y,ce))},pe=()=>{b.trim()&&(o(e,b),_(""))};return sr(Fo,{icon:Re(wP,{sx:{fontSize:19,display:"block"}}),title:sr(NP,{children:[n("section.todo"),t.length>0?sr($t,{component:"span",sx:{fontSize:12.5,color:"#9a9a97"},children:[y," / ",t.length]}):null]}),titleExtra:D.length>0?sr($t,{sx:{flex:1,minWidth:0,ml:1,display:"flex",alignItems:"center",gap:1},children:[Re($t,{sx:{flex:1,minWidth:0,height:6,borderRadius:3,bgcolor:"#ececea"},children:Re($t,{sx:{height:"100%",borderRadius:3,width:`${Math.round(y/D.length*100)}%`,bgcolor:"#2f80ed",transition:"width 0.2s"}})}),y>0?sr($t,{component:"label",sx:{display:"inline-flex",alignItems:"center",gap:.25,flexShrink:0,cursor:"pointer",fontSize:13.5,fontWeight:400,color:"#57564f",userSelect:"none"},children:[Re(pP,{size:"small",checked:M,onChange:(G,te)=>K(te)}),n("section.hideDone")]}):null]}):null,children:[Re(AP,{sortable:w,sensors:P,rowIds:ee,onDragEnd:ne,compact:A,children:t.map((G,te)=>{let H=G.task_seq?g?.(G.task_seq):void 0,Y=R(G);if(M&&Y||S(G))return null;let ce=!!G.task_seq,he=C(G),Q=ae=>sr($t,{sx:{display:"flex",alignItems:A?"flex-start":"center",gap:1,px:1.25,...w?{ml:-3,pl:.5}:{},py:.5,borderRadius:1,"&:hover":{bgcolor:"#f7f7f5"},"&:hover .taskbox-checklist-remove":{opacity:1},"&:hover .taskbox-checklist-convert":{opacity:1},"&:hover .taskbox-checklist-handle":{opacity:1}},children:[ae?Re($t,{className:"taskbox-checklist-handle",...ae,sx:{display:"inline-flex",flexShrink:0,alignItems:"center",color:"#c9c8c5",opacity:0,transition:"opacity 0.15s",cursor:"grab","&:active":{cursor:"grabbing"},touchAction:"none",userSelect:"none"},children:Re(EP,{sx:{fontSize:16}})}):null,Re(vp,{title:he?n("section.toggleLocked"):"",arrow:!0,disableInteractive:!0,children:Re($t,{component:"span",onClick:he?void 0:Z=>r?q({anchorEl:Z.currentTarget,index:te,checked:!Y}):i(e,te,!Y),sx:{display:"inline-flex",flexShrink:0,cursor:he?"default":"pointer",...A?{mt:"1px"}:{}},children:Y?Re(DP,{sx:{fontSize:18,color:he?"#a9c6ec":"#2f80ed"}}):Re(MP,{sx:{fontSize:18,color:he?"#d6d5d1":"#9a9a97"}})})}),v?.index===te?Re($t,{component:"input",autoFocus:!0,spellCheck:!1,value:v.label,enterKeyHint:"done",onChange:Z=>k({index:te,label:Z.target.value}),onBlur:()=>{v.label.trim()&&v.label.trim()!==G.label&&l?.(e,te,v.label),k(null)},onKeyDown:Z=>{Z.key==="Enter"&&Z.target.blur(),Z.key==="Escape"&&k(null)},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",p:0}}):Re($t,{component:"span",onClick:ce?G.task_seq&&m?()=>m(G.task_seq):void 0:c||!l?void 0:A?()=>B({index:te,label:G.label}):()=>k({index:te,label:G.label}),sx:{flex:1,minWidth:0,fontSize:14.5,color:"#37352f",textDecoration:Y?"line-through":"none",overflow:"hidden",textOverflow:"ellipsis",...A?{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,lineHeight:1.4,wordBreak:"break-word"}:{whiteSpace:"nowrap"},...ce?m?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}:c||!l?{}:{cursor:"text"}},children:G.label}),ce?sr($t,{component:"span",onClick:G.task_seq&&m?()=>m(G.task_seq):void 0,sx:{...Ul,...A?{mt:"1px"}:{},...m?{cursor:"pointer"}:{}},children:[Re(RP,{sx:{fontSize:12}}),H?.manager_name?.trim()||n("template.task")]}):null,!c&&!ce&&u?Re(vp,{title:n("section.makeTask"),arrow:!0,enterDelay:300,disableInteractive:!0,children:Re(Ma,{className:"taskbox-checklist-convert",size:"small","aria-label":n("section.makeTask"),onClick:()=>u(e,te,G.label),sx:{display:A?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:Re(Ch,{sx:{fontSize:16}})})}):null,c?null:Re(Ma,{className:"taskbox-checklist-remove",size:"small","aria-label":n("section.deleteTodo"),onClick:()=>a(e,te),sx:{display:A?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:Re(yh,{sx:{fontSize:15}})})]});return w?Re(LP,{id:N[te],children:({handleProps:ae})=>Q(ae)},N[te]):Re($t,{children:Q(null)},N[te])})}),sr($t,{sx:{mt:.5,ml:A?0:3.25,display:"flex",alignItems:"center",gap:.5},children:[Re($t,{component:"input",spellCheck:!1,value:b,placeholder:n("section.addTodoPlaceholder"),enterKeyHint:"done",onChange:G=>_(G.target.value),onKeyDown:G=>{G.key==="Enter"&&pe()},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",px:1.25,py:.75,"&::placeholder":{color:"#9a9a97"}}}),p&&d&&f?Re(vp,{title:n("section.attachExisting"),arrow:!0,children:Re(Ma,{size:"small","aria-label":n("section.attachExisting"),onMouseDown:G=>G.preventDefault(),onClick:h.openDialog,sx:{flexShrink:0,color:"#9a9a97"},children:Re(PP,{sx:{fontSize:20}})})}):null,Re(Ma,{size:"small","aria-label":n("section.addTodo"),disabled:!b.trim(),onMouseDown:G=>G.preventDefault(),onClick:pe,sx:{flexShrink:0,color:b.trim()?"#2f80ed":"#c9c8c5"},children:Re(IP,{sx:{fontSize:20}})})]}),p&&d&&f?Re(om,{controller:h,task:d,tasks:p,excludeSeqs:t.map(G=>Number(G.task_seq??0)).filter(G=>G>0),hideRelationType:!0,title:n("section.attachExisting"),confirmLabel:n("section.attach")}):null,Re(OP,{open:!!E,anchorEl:E?.anchorEl??null,title:E?.checked?n("calendar.checklistCompleteConfirm"):n("task.uncompleteConfirm"),confirmText:E?.checked?n("common.done"):n("task.unmark"),onCancel:()=>q(null),onConfirm:()=>{E&&i(e,E.index,E.checked),q(null)}}),Re(dP,{open:!!T,onClose:()=>B(null),maxWidth:"xs",fullWidth:!0,slotProps:{paper:{sx:{borderRadius:2,m:2}}},children:sr($t,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5},children:[Re($t,{sx:{fontSize:15.5,fontWeight:600,color:"#37352f"},children:n("section.editTodo")}),Re(fP,{autoFocus:!0,fullWidth:!0,size:"medium",value:T?.label??"",onChange:G=>B(te=>te&&{...te,label:G.target.value}),onKeyDown:G=>{if(G.key!=="Enter")return;let te=T;te&&te.label.trim()&&l?.(e,te.index,te.label.trim()),B(null)}}),sr($t,{sx:{display:"flex",alignItems:"center",gap:1},children:[!c&&u&&T&&!t[T.index]?.task_seq?Re(Ma,{"aria-label":n("section.makeTask"),onClick:()=>{u(e,T.index,t[T.index]?.label??""),B(null)},sx:{color:"#57564f"},children:Re(Ch,{sx:{fontSize:20}})}):null,!c&&T?Re(Ma,{"aria-label":n("section.deleteTodo"),onClick:()=>{a(e,T.index),B(null)},sx:{color:"#e5484d"},children:Re(yh,{sx:{fontSize:19}})}):null,Re($t,{sx:{flex:1}}),Re(Th,{color:"inherit",onClick:()=>B(null),children:n("common.cancel")}),Re(Th,{variant:"contained",disabled:!T?.label.trim(),onClick:()=>{T&&T.label.trim()&&l?.(e,T.index,T.label.trim()),B(null)},children:n("common.confirm")})]})]})})]})}import{useRef as $P,useState as VP}from"react";import{Box as Zo,IconButton as KP}from"@mui/material";import{DndContext as UP,PointerSensor as GP,closestCenter as jP,useSensor as YP,useSensors as XP}from"@dnd-kit/core";import{restrictToParentElement as QP,restrictToVerticalAxis as JP}from"@dnd-kit/modifiers";import{SortableContext as ZP,useSortable as eM,verticalListSortingStrategy as tM}from"@dnd-kit/sortable";import{CSS as oM}from"@dnd-kit/utilities";import nM from"@mui/icons-material/DragIndicator";import rM from"@mui/icons-material/Close";import iM from"@mui/icons-material/AttachFileOutlined";import{FileTypeIcon as aM}from"@ehfuse/file-viewer/icons";var qP=new Set(["jpg","jpeg","png","gif","bmp","webp","svg","pdf","txt","json","xml","log","md","markdown","csv","xls","xlsx","html","htm","js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf","mp4","avi","mov","wmv","flv","webm","mp3","wav","ogg","m4a","aac"]),rm=e=>{let t=e?.split(".").pop()?.toLowerCase()??"";return qP.has(t)};import{LinearProgress as zP}from"@mui/material";import{Fragment as FP,jsx as WP,jsxs as HP}from"react/jsx-runtime";function vh(e){let t=_n(),o=t.useValue("attachmentUpload.taskSeq"),i=t.useValue("attachmentUpload.index"),r=t.useValue("attachmentUpload.total"),a=t.useValue("attachmentUpload.queue"),l=i??0;return!l||e>0&&(o??0)!==e?null:{index:l,total:r??0,queue:a??[]}}function Bp(){let t=_n().useValue("attachmentUpload.progress");return HP(FP,{children:[t??0,"%"]})}function Bh(){let t=_n().useValue("attachmentUpload.progress");return WP(zP,{variant:"determinate",value:t??0,sx:{height:4,borderRadius:2,bgcolor:"#dbe9fb",mt:.75}})}import{Fragment as _h,jsx as St,jsxs as Yl}from"react/jsx-runtime";function lM({id:e,children:t}){let{attributes:o,listeners:i,setNodeRef:r,transform:a,transition:l,isDragging:s}=eM({id:e});return St(Zo,{ref:r,sx:{transform:oM.Transform.toString(a),transition:l,...s?{opacity:.6,position:"relative",zIndex:1}:{}},children:t({...o,...i})})}function jl(e){return e>=1048576?`${(e/1048576).toFixed(1)}MB`:`${Math.max(1,Math.round(e/1024))}KB`}var im={flex:1,minWidth:0,fontSize:13.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function am({taskSeq:e,attachments:t,onAdd:o,onRemove:i,removeLocked:r=!1,onPreview:a,onDownload:l,onReorder:s}){O();let[c,u]=VP(!1),m=$P(null),p=Ge(),d=sl(),f=ll(),g=vh(e),x=e===0,b=!!s&&!x&&!p&&!r&&!g&&t.length>1,_=XP(YP(GP,{activationConstraint:{distance:5}})),h=(R,C)=>R.uuid?`file-${R.uuid}`:`file-${C}`,v=t.map(h),k=R=>{let{active:C,over:S}=R;if(!S||C.id===S.id)return;let D=v.indexOf(String(C.id)),y=v.indexOf(String(S.id));D<0||y<0||s?.(e,D,y)},A=R=>{if(a){a(R);return}window.open(f(R.uuid??""),"_blank","noopener,noreferrer")},T=R=>{if(l){l(R);return}window.open(f(R.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},B=R=>g?R+1<g.index?"done":R+1===g.index?"uploading":"waiting":"waiting",E=(R,C,S,D,y={})=>Yl(Zo,{sx:{px:1,py:.5,borderRadius:1,border:"1px solid",borderColor:y.uploading?"#d5e6fb":se,bgcolor:y.uploading?"#f4f9ff":"transparent","&:hover .taskbox-file-remove":{opacity:1},"&:hover .taskbox-file-handle":{opacity:1}},children:[Yl(Zo,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[y.handleProps?St(Zo,{className:"taskbox-file-handle","aria-label":n("section.reorder"),...y.handleProps,sx:{display:"inline-flex",flexShrink:0,alignItems:"center",ml:-.5,mr:-.5,color:"#c9c8c5",opacity:0,transition:"opacity 0.15s",cursor:"grab","&:active":{cursor:"grabbing"},touchAction:"none",userSelect:"none"},children:St(nM,{sx:{fontSize:16}})}):null,St(Zo,{component:"span",sx:{display:"inline-flex",flexShrink:0},children:St(aM,{fileName:C,size:18})}),S,St(Zo,{component:"span",sx:{fontSize:12,color:y.uploading?"#2f80ed":"#9a9a97",flexShrink:0},children:D}),y.removeIndex!==void 0?St(KP,{className:"taskbox-file-remove",size:"small","aria-label":n("section.deleteAttachment"),onClick:()=>i(e,y.removeIndex),sx:{opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:St(rM,{sx:{fontSize:15}})}):null]}),y.uploading?St(Bh,{}):null]},R),q=R=>{let C=rm(R.name);return St(Zo,{component:"button",type:"button",onClick:()=>C?A(R):T(R),title:n("section.fileAction",{name:R.name,value:C?n("section.preview"):n("section.download")}),sx:{...im,color:"#37352f",textAlign:"left",p:0,border:"none",background:"none",font:"inherit",fontSize:13.5,cursor:"pointer",outline:"none","&:focus-visible":{textDecoration:"underline",color:"#2f80ed"},"&:hover":{textDecoration:"underline",color:"#2f80ed"}},children:R.name})};return Yl(Fo,{icon:St(iM,{sx:{fontSize:18,display:"block"}}),title:Yl(_h,{children:[n("section.files")," ",t.length>0?t.length:""]}),children:[St(sM,{sortable:b,sensors:_,rowIds:v,onDragEnd:k,children:Yl(Zo,{sx:{display:"flex",flexDirection:"column",gap:.5,mt:1},children:[t.map((R,C)=>{let S=`${R.uuid||R.name}-${C}`;if(x){let D=B(C),y=D==="uploading";return E(S,R.name,St(Zo,{component:"span",sx:{...im,color:D==="done"?"#37352f":"#9a9a97"},children:R.name}),y?St(Bp,{}):jl(R.size),{uploading:y,removeIndex:!r&&!g?C:void 0})}return R.uuid?b?St(lM,{id:h(R,C),children:D=>E(S,R.name,q(R),jl(R.size),{removeIndex:r?void 0:C,handleProps:D})},h(R,C)):E(S,R.name,q(R),jl(R.size),{removeIndex:r?void 0:C}):E(S,R.name,St(Zo,{component:"span",title:n("section.legacyAttachment"),sx:{...im,color:"#9a9a97"},children:R.name}),jl(R.size),{removeIndex:r?void 0:C})}),!x&&g?g.queue.slice(g.index-1).map((R,C)=>{let S=C===0;return E(`uploading-${g.index+C}-${R.name}`,R.name,St(Zo,{component:"span",sx:{...im,color:"#9a9a97"},children:R.name}),S?St(Bp,{}):jl(R.size),{uploading:S})}):null]})}),St(Zo,{onClick:()=>m.current?.click(),onDragOver:R=>{R.preventDefault(),u(!0)},onDragLeave:()=>u(!1),onDrop:R=>{R.preventDefault(),u(!1);let C=Array.from(R.dataTransfer.files);C.length>0&&o(e,C)},sx:{mt:1,py:2.5,display:"flex",alignItems:"center",justifyContent:"center",gap:.5,border:"1.5px dashed",borderColor:c?"#2f80ed":"#cfcfcc",borderRadius:1,bgcolor:c?"#eef6ff":"transparent",color:"#787774",fontSize:13.5,cursor:"pointer",transition:"background-color 0.15s, border-color 0.15s","&:hover":{bgcolor:"#fafaf9",borderColor:"#9a9a97"}},children:p?n("section.attachHint",{uploadMaxMb:d}):n("section.attachHintDrag",{uploadMaxMb:d})}),St(Zo,{component:"input",ref:m,type:"file",multiple:!0,onChange:R=>{let C=Array.from(R.target.files??[]);C.length>0&&o(e,C),R.target.value=""},sx:{display:"none"}})]})}function sM({sortable:e,sensors:t,rowIds:o,onDragEnd:i,children:r}){return e?St(UP,{sensors:t,collisionDetection:jP,modifiers:[JP,QP],onDragEnd:i,children:St(ZP,{items:o,strategy:tM,children:r})}):St(_h,{children:r})}import{useState as gM}from"react";import{Checkbox as xM,Divider as bM,ListItemIcon as hM,Menu as kM,MenuItem as Eh}from"@mui/material";import TM from"@mui/icons-material/Add";import{Box as _p,Button as uM}from"@mui/material";import{FormDialog as dM}from"@ehfuse/mui-form-dialog";import{ClearTextField as pM}from"@ehfuse/mui-form-controls";import{ColorPicker as fM}from"@ehfuse/mui-color-picker";import{useGlobalForm as cM}from"@ehfuse/forma";import{ErrorAlert as mM}from"@ehfuse/alerts";var Ih="#2f80ed";function wh({open:e,onClose:t,onSubmit:o}){O();let i=cM({formId:Oe("taskbox-add-label-form"),initialValues:{name:"",color:Ih},onValidate:a=>String(a.name??"").trim()?!0:(mM(n("dialog.enterLabelName")),!1),onSubmit:a=>(o(String(a.name).trim(),a.color),r.form.close(),!0)}),r={form:mo({modalIdPrefix:"taskbox-add-label-dialog",open:e,onClose:t,onOpen:()=>i.setFormValues({name:"",color:Ih})})};return{form:i,modals:r}}import{jsx as Xl,jsxs as Ip}from"react/jsx-runtime";function Dh({open:e,onClose:t,onSubmit:o}){O();let{form:i,modals:r}=wh({open:e,onClose:t,onSubmit:o}),a=String(i.useFormValue("name")??""),l=String(i.useFormValue("color")??""),s=Cg(l),c=Ip(_p,{children:[Ip(_p,{sx:{display:"flex",alignItems:"center",gap:1.5,mt:.5},children:[Xl(pM,{form:i,name:"name",label:n("dialog.labelName"),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),i.submit())},fullWidth:!0,autoFocus:!0}),Xl(fM,{value:l,onChange:u=>i.setFormValue("color",u),shape:"circle",colorSize:28})]}),Ip(_p,{sx:{mt:2,display:"flex",alignItems:"center",gap:1,fontSize:13,color:"#787774"},children:[n("dialog.preview"),Xl(Ze,{option:{key:"__preview__",name:a.trim()||n("dialog.label"),...s}})]})]});return Xl(dM,{open:r.form.isOpen,onClose:r.form.close,maxWidth:"xs",title:n("dialog.addLabelTitle"),locale:Ee(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-add-label",sections:[{id:"add-label",showTitle:!1,children:c}],actions:{showCancelButton:!0,right:Xl(uM,{variant:"contained",onClick:()=>{i.submit()},children:n("common.add")})}})}import{Fragment as yM,jsx as Oa,jsxs as lm}from"react/jsx-runtime";function sm({anchorEl:e,selectedKeys:t,labelOptions:o,onToggle:i,onAddLabel:r,onClose:a}){O();let[l,s]=gM(!1),c=Xn();return lm(yM,{children:[lm(kM,{anchorEl:e,open:!!e,onClose:a,transitionDuration:0,...c,children:[o.map(u=>{let m=t.includes(u.key);return lm(Eh,{onClick:()=>i(u.key),sx:{fontSize:14,minWidth:170,gap:1},children:[Oa(xM,{size:"small",checked:m,sx:{p:0}}),Oa(Ze,{option:u})]},u.key)}),Oa(bM,{}),lm(Eh,{onClick:()=>s(!0),sx:{fontSize:14,color:"#787774"},children:[Oa(hM,{children:Oa(TM,{sx:{fontSize:18,color:"#787774"}})}),n("menu.addLabel")]})]}),Oa(Dh,{open:l,onClose:()=>s(!1),onSubmit:r})]})}function Rh(e,t){let o=Number(e.author_account_seq??0);return t.filter(i=>{let r=Number(i.account_seq??0);return r>0&&r!==o})}function Ph(e,t){let o=(e.target_account_seqs??[]).filter(p=>p>0);if(o.length===0)return null;let i=new Set(o),r=Rh(e,t),a=new Map;for(let p of r){let d=String(p.department??"").trim();if(!d)continue;let f=a.get(d)??[];f.push(p),a.set(d,f)}let l=[],s=new Set;for(let[p,d]of a)if(d.every(g=>i.has(Number(g.account_seq??0)))){l.push(p);for(let g of d)s.add(Number(g.account_seq??0))}let c=new Map(r.map(p=>[Number(p.account_seq??0),p.name])),u=e.target_names??[],m=[];return o.forEach((p,d)=>{s.has(p)||m.push(c.get(p)??u[d]??n("dialog.noName"))}),{teamNames:l,individualNames:m}}function cm(e,t){let o=Ph(e,t);return o?[...o.teamNames,...o.individualNames].join(", "):n("col.allEmployees")}function dQ(e,t){let o=Ph(e,t);return o?{kind:"members",teamNames:o.teamNames,individualNames:o.individualNames}:{kind:"everyone"}}function CM(e,t,o){let i=t.length>0?new Set(t):new Set(o.map(r=>Number(r.account_seq??0)).filter(r=>r>0));return i.size===0?e.length:new Set(e.map(r=>Number(r.account_seq)).filter(r=>i.has(r))).size}function Mh(e,t,o){let i=(e.target_account_seqs??[]).filter(f=>f>0),r=Rh(e,t),a=i.length>0?i.length:r.length,l=e.acks??[],s=o>0&&l.some(f=>f.account_seq===o),c=o>0&&Number(e.author_account_seq??0)===o,u=i.length===0||i.includes(o),m=new Set(l.map(f=>f.account_seq)),d=(i.length>0?r.filter(f=>i.includes(Number(f.account_seq??0))):r).filter(f=>!m.has(Number(f.account_seq??0))).map(f=>String(f.name??"").trim()).filter(f=>f.length>0);return{count:CM(l,i,r),total:a,acked:s,pendingNames:d,canAck:o>0&&!c&&u&&!s&&!e.completed}}import{DatePicker as WM}from"@ehfuse/mui-datetime-picker";import{useState as SM}from"react";import{Box as Ui,IconButton as vM,Popover as BM}from"@mui/material";import _M from"@mui/icons-material/InfoOutlined";import IM from"@mui/icons-material/LockOutlined";import wM from"@mui/icons-material/PublicOutlined";import DM from"@mui/icons-material/Group";import{jsx as en,jsxs as Gi}from"react/jsx-runtime";var EM=[{key:"all",icon:en(wM,{sx:{fontSize:17,color:"#2f80ed"}}),label:"create.visibilityPublic",who:"create.visibilityInfoAll"},{key:"group",icon:en(DM,{sx:{fontSize:17,color:"#d9730d"}}),label:"create.visibilityDeptShort",who:"create.visibilityInfoGroup"},{key:"involved",icon:en(IM,{sx:{fontSize:17}}),label:"create.visibilityPrivate",who:"create.visibilityInfoPrivate"}];function mm(){let[e,t]=SM(null),{colors:o}=Se(),i=String(qi.labelColor??"#787774");return Gi(Ui,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.25},children:[n("create.visibility"),en(vM,{size:"small","aria-label":n("create.visibilityInfo"),onClick:r=>{r.stopPropagation(),t(r.currentTarget)},sx:{p:.25,color:i},children:en(_M,{sx:{fontSize:16}})}),Gi(BM,{open:!!e,anchorEl:e,onClose:()=>t(null),onClick:r=>r.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},transitionDuration:0,slotProps:{paper:{sx:{width:380,maxWidth:"calc(100vw - 32px)",p:2,borderRadius:2}}},children:[Gi(Ui,{sx:{fontSize:14,lineHeight:1.6,mb:1.5,px:1.5,py:1.25,borderRadius:1.5,bgcolor:o.accentSoft,color:o.textSecondary,wordBreak:"keep-all"},children:[en(Ui,{component:"strong",sx:{fontWeight:700,color:o.accentOnSurface},children:n("create.visibilityInfoNoteStrong")})," ",n("create.visibilityInfoNote")]}),en(Ui,{sx:{border:`1px solid ${o.border}`,borderRadius:1.5,overflow:"hidden"},children:Gi(Ui,{component:"table",sx:{width:"100%",borderCollapse:"collapse",fontSize:14,"& th, & td":{border:`1px solid ${o.border}`,py:1,px:1.25,textAlign:"left",verticalAlign:"middle"},"& tr > :first-of-type":{borderLeft:"none"},"& tr > :last-child":{borderRight:"none"},"& thead th":{borderTop:"none",bgcolor:o.surfaceSubtle,color:o.textSecondary,fontWeight:600},"& tbody tr:last-child td":{borderBottom:"none"},"& td":{color:o.textPrimary,wordBreak:"keep-all",lineHeight:1.5}},children:[en("thead",{children:Gi("tr",{children:[en("th",{children:n("create.visibilityInfoColScope")}),en("th",{children:n("create.visibilityInfoColWho")})]})}),en("tbody",{children:EM.map(r=>Gi("tr",{children:[en(Ui,{component:"td",sx:{whiteSpace:"nowrap"},children:Gi(Ui,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[r.icon,n(r.label)]})}),en("td",{children:n(r.who)})]},r.key))})]})})]})]})}import{Fragment as ji,jsx as ye,jsxs as Tn}from"react/jsx-runtime";var qh="taskbox:create-expanded";function $M(){try{return window.localStorage.getItem(qh)!=="0"}catch{return!0}}function Ep({form:e,statusOptions:t,customTabs:o,sprints:i=[],avatarSrcByName:r,isNotice:a=!1,hideProject:l=!1,hideBug:s=!1,hideTypeToggle:c=!1,leadingRow:u,afterProject:m,extraRows:p,hideLabel:d=!1,simple:f=!1,hideMembers:g=!1,templateItem:x=!1,postMode:b=!1,employees:_=[],workspaceName:h="",workspaceSlot:v,myAccountSeq:k=0,departments:A=[],myGroupSeq:T=0,onMemberEdit:B,onAddProject:E,onAddLabelOption:q,contentSyncKey:R="create",contentTemplates:C,contentTitleExtra:S,onSaveContentTemplate:D,onRemoveContentTemplate:y}){O();let M=_n(),z=sl(),K=e.useFormValue("manager_name"),w=e.useFormValue("receiver_names"),P=e.useFormValue("start_date"),U=!!e.useFormValue("is_event"),N=!!e.useFormValue("is_bug"),ee=e.useFormValue("bug_repro")??"",ne=e.useFormValue("bug_device")??"",pe=e.useFormValue("bug_where")??"",G=e.useFormValue("bug_version")??"",te=e.useFormValue("event_time")??"",H=e.useFormValue("event_place")??"",Y=e.useFormValue("event_address")??"",ce=e.useFormValue("due_date"),he=e.useFormValue("reminders")??[],Q=e.useFormValue("priority"),ae=e.useFormValue("content"),Z=Vl(),I=e.useFormValue("note")??"",j=e.useFormValue("checklist")??[],oe=e.useFormValue("tab_key"),ge=e.useFormValue("sprint_seq")??0,xe=e.useFormValue("story_points")??0,Pe=o.find(W=>W.key===oe&&W.useSprints),Le=Pe?i.filter(W=>`custom-${W.group_seq}`===oe):[],[de,Be]=La(null),ze=e.useFormValue("label_keys"),[ft,eo]=La(null),re=e.useFormValue("visibility")||"involved",Me=Number(e.useFormValue("visibility_group_seq")??0),[st,Qe]=La(null),vo=e.useFormValue("repeat_rule")||"",Fn=e.useFormValue("repeat_until")||"",[Bo,Hn]=La(null),[Wn,$n]=La(null),sn=e.useFormValue("target_names"),cn=e.useFormValue("target_account_seqs"),qt=M.useValue("createAttachmentFiles")??[],Ut=a?cm({author_account_seq:k,target_names:sn,target_account_seqs:cn},_):"",[Je,Vn]=La($M),Vo=f&&!U&&!a&&!b,Ot=Vo&&!Je,Ye=()=>{let W=!Je;Vn(W);try{window.localStorage.setItem(qh,W?"1":"0")}catch{}},X=!b,le=g?1:2;return Tn(ji,{children:[u,!a&&!c?Tn(cr,{sx:{display:"flex",gap:1.25,px:2,pt:1.5,pb:1.5,flexShrink:0},children:[v?ye(cr,{sx:{alignSelf:"center",mr:"6px",minWidth:0,display:"flex"},children:v}):h?ye(cr,{sx:{alignSelf:"center",fontSize:13.5,fontWeight:600,color:"#37352f",mr:"6px",maxWidth:160,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:h,children:h}):null,[{value:"task",label:n("kind.task")},{value:"event",label:n("kind.event")},...s?[]:[{value:"bug",label:n("kind.bug")}]].map(W=>{let qe=(N?"bug":U?"event":"task")===W.value;return ye(Oh,{onClick:()=>Iu(e,W.value),sx:{px:1.75,lineHeight:1,pt:"8px",pb:"10px",borderRadius:99,fontSize:13.5,fontWeight:qe?600:400,color:qe?"#ffffff":"#787774",bgcolor:qe?"#2563eb":"#f4f4f2"},children:W.label},W.label)})]}):null,u||!a&&!c?ye(Ql,{sx:{borderColor:se}}):null,Tn(cr,{sx:{pt:1.5,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[ye(Wc,{afterProject:m,hideProject:l||Ot&&!oe,hideManager:g||b||Ot&&!K,hideReceivers:x||g||b&&re==="all"||Ot&&w.length===0,hideStartDate:Ot||b,hideReminder:x||b||Ot&&he.length===0,hidePriority:b,hideDueDate:b||!U&&!!vo,values:{tabKey:oe,managerName:K,receiverNames:w,startDate:P,dueDate:ce,reminders:he,priority:Q,eventTime:te,eventPlace:H,eventAddress:Y},customTabs:o,avatarSrcByName:r,notice:a,event:U,onChangeEventTime:W=>e.setFormValue("event_time",W),onChangeEventPlace:W=>e.setFormValue("event_place",W),onChangeEventAddress:W=>e.setFormValue("event_address",W),targetSummary:Ut,onChangeProject:W=>e.setFormValue("tab_key",W),onAddProject:E,onChangeStartDate:W=>e.setFormValue("start_date",W),onClearStartDate:()=>e.setFormValue("start_date",""),onChangeDueDate:W=>e.setFormValue("due_date",W),onChangeReminder:W=>e.setFormValue("reminders",W),onChangePriority:W=>e.setFormValue("priority",W),onMemberEdit:B,pinColumns:X,beforeStart:Tn(ji,{children:[!x&&!N&&!b&&!(Ot&&!vo)?ye(Ie,{icon:ye(qM,{sx:{fontSize:17,...vo?{color:"#2f80ed"}:{}}}),label:n("create.repeat"),onClick:W=>Hn(W),sx:U||!X?void 0:ut(le),children:vo?Vs(vo):ye(cr,{component:"span",sx:{color:"#9a9a97"},children:n("common.none")})}):null,!x&&!N&&!b&&vo?ye(Ie,{icon:ye(zM,{sx:{fontSize:17}}),label:n("create.repeatUntil"),onClick:W=>$n(W),sx:U||!X?void 0:ut(le),children:Fn?jo(Fn):ye(cr,{component:"span",sx:{color:"#9a9a97"},children:n("create.auto")})}):null]}),trailing:Tn(ji,{children:[!a&&!g&&!(Ot&&re==="involved")?ye(Ie,{icon:re==="all"?ye(Ah,{sx:{fontSize:17,color:"#2f80ed"}}):re==="group"?ye(Nh,{sx:{fontSize:17,color:"#d9730d"}}):ye(Lh,{sx:{fontSize:17}}),label:ye(mm,{}),onClick:W=>Qe(W),sx:U||!X?void 0:ut(1),children:re==="all"?n("create.visibilityPublic"):re==="group"?n("create.visibilityDept",{value:A.find(W=>W.seq===Me)?.name??n("create.department")}):n("create.visibilityPrivate")}):null,Pe&&!U&&!a&&!b&&!(Ot&&ge===0&&xe===0)?Tn(ji,{children:[ye(Ie,{icon:ye(NM,{sx:{fontSize:17}}),label:n("col.goal"),onClick:W=>Be(W),sx:X?ut(1):void 0,children:ge>0?Le.find(W=>W.seq===ge)?.name??n("create.deletedGoal"):ye(cr,{component:"span",sx:{color:"#9a9a97"},children:n("board.unassigned")})}),ye(Ie,{icon:ye(FM,{sx:{fontSize:17}}),label:"\uD3EC\uC778\uD2B8",sx:X?ut(1):void 0,children:ye(Er,{value:xe>0?String(xe):"",placeholder:n("create.notEstimated"),onCommit:W=>e.setFormValue("story_points",Number(W.replace(/[^0-9.]/g,""))||0)})})]}):null,N?ye($c,{values:{repro:ee,device:ne,where:pe,version:G},onChangeRepro:W=>e.setFormValue("bug_repro",W),onChangeDevice:W=>e.setFormValue("bug_device",W),onChangeWhere:W=>e.setFormValue("bug_where",W),onChangeVersion:W=>e.setFormValue("bug_version",W)}):null,!x&&!b&&!a?(p??[]).filter(W=>!(Ot&&!W.filled)).map(W=>ye(Ie,{icon:W.icon,label:W.label,onClick:W.onClick,sx:U||!X?void 0:ut(le),children:W.value},W.key)):null]}),leading:U||d?null:ye(cr,{sx:{gridColumn:"1 / -1"},children:ye(Ie,{icon:ye(AM,{sx:{fontSize:17}}),label:n("dialog.label"),onClick:W=>eo(W),children:(ze??[]).length>0?ye(Qr,{labelKeys:ze??[],labelOptions:t}):ye(cr,{component:"span",sx:{color:"#9a9a97"},children:n("menu.empty")})})})}),Vo?Tn(Oh,{onClick:Ye,"aria-expanded":Je,sx:{alignSelf:"flex-start",display:"flex",alignItems:"center",gap:.5,minHeight:32,mx:2,pr:1,borderRadius:1,fontSize:14,color:"#2563eb","&:hover":{bgcolor:"#f2f2f0"}},children:[Je?ye(RM,{sx:{fontSize:17}}):ye(PM,{sx:{fontSize:17}}),Je?n("create.collapseFields"):n("create.expandFields")]}):null,ye(Ql,{sx:{my:1.5,borderColor:se}}),ye(Fo,{icon:ye(OM,{sx:{fontSize:18,display:"block"}}),title:n("common.content"),titleExtra:Tn(ji,{children:[S,Tn(cr,{sx:{ml:"auto",display:"flex",alignItems:"center",gap:.5},children:[Z.switcher,C?ye(em,{content:ae,templates:C,onApply:W=>e.setFormValue("content",W),onSave:D,onRemove:y}):null]})]}),children:ye(Qc,{syncKey:R,value:ae,modeControl:Z,onChange:W=>e.setFormValue("content",W)})}),N||b||Ot&&!I?null:Tn(ji,{children:[ye(Ql,{sx:{my:1.5,borderColor:se}}),ye(Fo,{icon:ye(LM,{sx:{fontSize:18,display:"block"}}),title:n("col.note"),children:ye(HM,{form:e,name:"note",placeholder:n("create.notePlaceholder"),fullWidth:!0,size:"medium",sx:{mt:1}})})]}),U||b||Ot&&j.length===0?null:ye(Ql,{sx:{my:1.5,borderColor:se}}),U||b||Ot&&j.length===0?null:ye(nm,{taskSeq:0,checklist:j,onAdd:(W,ke)=>Eu(e,ke),onToggle:(W,ke,qe)=>Ru(e,ke,qe),onRemove:(W,ke)=>Pu(e,ke),onUpdate:(W,ke,qe)=>Mu(e,ke,qe)}),x?null:Tn(ji,{children:[ye(Ql,{sx:{my:1.5,borderColor:se}}),ye(am,{taskSeq:0,attachments:qt.map(W=>({name:W.name,size:W.size})),onAdd:(W,ke)=>Ou(M,ke,z),onRemove:(W,ke)=>Lu(M,ke)})]})]}),ye(wp,{transitionDuration:0,anchorEl:de,open:!!de,onClose:()=>Be(null),children:[{seq:0,label:n("board.unassigned")},...Le.map(W=>({seq:W.seq,label:xn(W)}))].map(W=>ye(Dp,{onClick:()=>{e.setFormValue("sprint_seq",W.seq),Be(null)},sx:{fontSize:14,minWidth:170},children:W.label},W.seq))}),ye(wp,{transitionDuration:0,anchorEl:Bo,open:!!Bo,onClose:()=>Hn(null),children:[{value:"",label:n("common.none")},...gl].map(W=>ye(Dp,{selected:vo===W.value,onClick:()=>{Hn(null),wu(e,W.value)},sx:{fontSize:14,minWidth:140},children:W.label},W.value||"none"))}),ye(WM,{anchorEl:Wn,open:!!Wn,onClose:()=>$n(null),selectedDate:Fn?new Date(`${Fn}T00:00:00`):new Date,onDateChange:W=>{Du(e,W),$n(null)}}),ye(wp,{transitionDuration:0,anchorEl:st,open:!!st,onClose:()=>Qe(null),children:[{key:"involved",label:n("create.visibilityPrivate"),tip:n("create.privateTip"),icon:ye(Lh,{sx:{fontSize:17,color:"#57564f"}}),selected:re==="involved",onPick:()=>xl(e,"involved")},{key:"all",label:n("create.visibilityPublic"),tip:n("create.publicTip"),icon:ye(Ah,{sx:{fontSize:17,color:"#2f80ed"}}),selected:re==="all",onPick:()=>xl(e,"all")},...[...A].sort((W,ke)=>W.seq===T?-1:ke.seq===T?1:0).map(W=>({key:`group-${W.seq}`,label:n("create.visibilityDeptName",{name:W.name}),tip:n("create.deptTip",{name:W.name}),icon:ye(Nh,{sx:{fontSize:17,color:"#d9730d"}}),selected:re==="group"&&Me===W.seq,onPick:()=>xl(e,"group",W.seq)}))].map(W=>ye(MM,{title:W.tip,arrow:!0,disableInteractive:!0,placement:"right",children:Tn(Dp,{selected:W.selected,onClick:()=>{W.onPick(),b&&W.key==="all"&&(e.setFormValue("receiver_names",[]),e.setFormValue("receiver_account_seqs",[])),Qe(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[W.icon,W.label]})},W.key))}),ye(sm,{anchorEl:ft,selectedKeys:ze??[],labelOptions:t,onToggle:W=>e.setFormValue("label_keys",Zs(ze??[],W)),onAddLabel:(W,ke)=>q?.(W,ke),onClose:()=>eo(null)})]})}import{Fragment as Hh,jsx as vt,jsxs as Jl}from"react/jsx-runtime";var ZM={gap:"0.75rem !important","& .left-actions, & .right-actions":{display:"contents"},"& .left-actions > span:empty":{display:"none"},"& .left-actions:not(:has(*:not(:empty)))":{display:"none"},"& .left-actions .MuiButton-root, & .right-actions .MuiButton-root":{flex:"1 1 0",minWidth:0,margin:"0 !important",paddingLeft:"8px !important",paddingRight:"8px !important",whiteSpace:"nowrap"},"& .right-actions .MuiButton-text":{border:"1px solid rgba(0, 0, 0, 0.23)"},"& .right-actions .MuiButton-contained":{border:"1px solid transparent"}};function Wh({open:e,onClose:t,desktopPresentation:o="drawer",submitLabel:i,...r}){O();let{form:a,presetTitle:l="",presetContent:s="",presetVisibility:c,presetVisibilityGroupSeq:u=0,presetDueDate:m="",presetTabKey:p="",presetManager:d=null,isNotice:f=!1,defaultBug:g=!1}=r,x=_n(),b=KM(!1),[_,h]=zh(0),v=a.useFormValue("title"),k=a.useFormValue("icon"),A=a.useFormValue("icon_color"),T=!!a.useFormValue("is_event"),B=!!a.useFormValue("is_bug"),E=Ge(),R=x.useValue("createSubmitting")??!1,C=f||T?He(k||(f?wt:Ft)):null,S=f?n("create.titleNotice"):T?n("create.titleEvent"):B?n("task.createBug"):n("task.createTask"),D=f?n("create.noticeTitlePlaceholder"):T?n("create.eventTitlePlaceholder"):B?n("create.bugTitlePlaceholder"):n("create.taskTitlePlaceholder");VM(()=>{let w=b.current;b.current=e,!(!e||w)&&(_u(a,x,{presetTitle:l,presetContent:s,presetVisibility:c,presetVisibilityGroupSeq:u,presetDueDate:m,presetTabKey:p,presetManager:d,isNotice:f,defaultBug:g}),h(P=>P+1))},[e]);let[y,M]=zh(null),z=w=>C?T?vt(YM,{title:n("col.changeIcon"),arrow:!0,enterDelay:400,disableInteractive:!0,children:vt(UM,{onClick:P=>M(P.currentTarget),sx:{display:"flex",p:.5,borderRadius:1,color:A||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:vt(C,{sx:{fontSize:20}})})}):vt(Mr,{sx:[{display:"flex",color:A||"#1e3a8a"},w],children:vt(C,{sx:{fontSize:20}})}):null,K=Jl(Mr,{sx:{display:"flex",alignItems:"center",gap:1,px:2,pt:2,pb:1},children:[z({p:0}),vt(Mr,{component:"input",autoFocus:!0,spellCheck:!1,value:v,placeholder:D,onChange:w=>a.setFormValue("title",w.target.value),sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:19,fontWeight:600,color:"#37352f",p:0,m:0,"&::placeholder":{color:"#c9c8c5",fontWeight:400}}})]});return E||o==="dialog"?vt(Hh,{children:vt(JM,{open:e,onClose:t,backdropClick:!1,locale:Ee(),fontScale:E?{enabled:!0,default:1.1,min:.6}:{enabled:!0},title:S,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fullScreen:E,mobilePresentation:E?"slide":"dialog",maxWidth:"md",actions:{showCancelButton:!0,right:vt(Rp,{variant:"contained",disableElevation:!0,disabled:R,onClick:R?void 0:a.submit,children:R?n("create.saving"):i??n("create.saveButton")})},dialogActionSx:E?ZM:void 0,tabs:{visible:!1},contentTopPadding:0,contentPaddingX:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,contentBottomPadding:0,scrollPastLastSection:!1,overlayScrollbar:{enabled:!0,contentStyle:{minWidth:0}},sections:[{id:"task-create",title:"",showTitle:!1,children:vt(Mr,{sx:{width:"100%",minWidth:0,display:"flex",flexDirection:"column",gap:0},children:vt(Ep,{...r,contentSyncKey:`create-${_}`,leadingRow:K})})}]})}):Jl(Hh,{children:[vt(GM,{anchor:"right",open:e,onClose:(w,P)=>{P!=="backdropClick"&&t()},"aria-label":n("create.newTaskAria"),sx:{zIndex:w=>w.zIndex.modal},slotProps:{paper:{sx:{width:720,maxWidth:"100vw"}}},children:Jl(Mr,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[Jl(Mr,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1.5,flexShrink:0},children:[z({px:.5}),vt(Mr,{component:"input",autoFocus:!0,spellCheck:!1,value:v,placeholder:D,onChange:w=>a.setFormValue("title",w.target.value),sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:18,fontWeight:500,color:"#37352f",p:0,m:0,"&::placeholder":{color:"#c9c8c5",fontWeight:400}}}),vt(jM,{"aria-label":n("common.close"),onClick:t,sx:{color:"#6b7280"},children:vt(XM,{})})]}),vt(Fh,{sx:{borderColor:se}}),vt(Mr,{sx:{flex:1,minHeight:0},children:vt(QM,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:vt(Ep,{...r,contentSyncKey:`create-${_}`})})}),vt(Fh,{sx:{borderColor:se}}),Jl(Mr,{sx:{display:"flex",justifyContent:"flex-end",gap:.5,px:2,py:1.5,flexShrink:0},children:[vt(Rp,{onClick:t,color:"inherit",disabled:R,children:n("common.cancel")}),vt(Rp,{onClick:a.submit,variant:"contained",disabled:R,children:R?n("create.creating"):i??n("common.register")})]})]})}),vt(Zr,{anchorEl:y,value:k,color:A,onSelect:w=>{a.setFormValue("icon",w),M(null)},onSelectColor:w=>a.setFormValue("icon_color",w),onClose:()=>M(null)})]})}import{useEffect as Fk,useRef as Hk,useState as Wk}from"react";import{Box as Dm,Button as h2,Divider as $k,Drawer as k2,IconButton as T2,ListItemIcon as rf,ListItemText as af,Menu as y2,MenuItem as lf}from"@mui/material";import C2 from"@mui/icons-material/MoreVert";import S2 from"@mui/icons-material/DeleteOutline";import v2 from"@mui/icons-material/ShareOutlined";import B2 from"@mui/icons-material/HistoryOutlined";import _2 from"@ehfuse/overlay-scrollbar";import{FormDialog as I2}from"@ehfuse/mui-form-dialog";import{useRef as bm,useState as Or}from"react";import{Box as _e,Button as ok,Chip as hm,IconButton as tn,Popover as vO,Tooltip as ak}from"@mui/material";import BO from"@mui/icons-material/ArrowUpwardRounded";import{TextField as _O}from"@ehfuse/mui-form-controls";import km from"@mui/icons-material/Close";import IO from"@mui/icons-material/EditOutlined";import nk from"@mui/icons-material/ContentCopyOutlined";import rk from"@mui/icons-material/Check";import wO from"@mui/icons-material/Favorite";import DO from"@mui/icons-material/FavoriteBorderOutlined";import EO from"@mui/icons-material/CheckCircle";import RO from"@mui/icons-material/CheckCircleOutlineOutlined";import za from"@mui/icons-material/AttachFileOutlined";import PO from"@mui/icons-material/AddCircleOutline";import MO from"@mui/icons-material/ImageOutlined";var Pp=e=>{if(e===0)return"0 Bytes";let t=1024,o=["Bytes","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,i)).toFixed(2))+" "+o[i]};import{useCallback as um,useEffect as eO,useMemo as tO,useRef as $h,useState as Mp}from"react";import{Box as dm,Paper as oO,Popper as nO}from"@mui/material";import{jsx as Yi,jsxs as iO}from"react/jsx-runtime";var Vh=8,rO=[{key:"\uC88B\uC544\uC694",get label(){return n("emoji.like")},insert:"\u{1F44D}",keywords:["like","\uC5C4\uC9C0","\uAD7F"]},{key:"\uD655\uC778",get label(){return n("emoji.check")},insert:"\u2705",keywords:["check","\uC644\uB8CC","\uCCB4\uD06C"]},{key:"\uAC10\uC0AC",get label(){return n("emoji.thanks")},insert:"\u{1F64F}",keywords:["thanks","\uACE0\uB9C8\uC6CC","\uBD80\uD0C1"]},{key:"\uCD95\uD558",get label(){return n("emoji.party")},insert:"\u{1F389}",keywords:["party","\uD30C\uD2F0","\uC9DD\uC9DD"]},{key:"\uBC15\uC218",get label(){return n("emoji.clap")},insert:"\u{1F44F}",keywords:["clap","\uC798\uD588\uC5B4"]},{key:"\uD558\uD2B8",get label(){return n("emoji.heart")},insert:"\u2764\uFE0F",keywords:["heart","\uC0AC\uB791"]},{key:"\uC6C3\uC74C",get label(){return n("emoji.laugh")},insert:"\u{1F604}",keywords:["smile","\uC6C3\uAE40","\u314B\u314B"]},{key:"\uBBF8\uC18C",get label(){return n("emoji.smile")},insert:"\u{1F642}",keywords:["smile","\uC88B\uC74C"]},{key:"\uB208\uBB3C",get label(){return n("emoji.tears")},insert:"\u{1F622}",keywords:["sad","\uC2AC\uD514","\u3160\u3160"]},{key:"\uB180\uB78C",get label(){return n("emoji.wow")},insert:"\u{1F62E}",keywords:["wow","\uD5C9"]},{key:"\uACE0\uBBFC",get label(){return n("emoji.think")},insert:"\u{1F914}",keywords:["think","\uC0DD\uAC01","\uC74C"]},{key:"\uC624\uCF00\uC774",get label(){return n("emoji.ok")},insert:"\u{1F44C}",keywords:["ok","\uC54C\uACA0\uC5B4"]},{key:"\uBD88",get label(){return n("emoji.fire")},insert:"\u{1F525}",keywords:["fire","\uAE09\uD568","\uB300\uBC15"]},{key:"\uC544\uC774\uB514\uC5B4",get label(){return n("emoji.idea")},insert:"\u{1F4A1}",keywords:["idea","\uC804\uAD6C"]},{key:"\uACBD\uACE0",get label(){return n("emoji.warning")},insert:"\u26A0\uFE0F",keywords:["warning","\uC8FC\uC758"]},{key:"\uC9C8\uBB38",get label(){return n("emoji.question")},insert:"\u2753",keywords:["question","\uBB3C\uC74C"]},{key:"\uC2DC\uACC4",get label(){return n("emoji.clock")},insert:"\u23F0",keywords:["time","\uC2DC\uAC04","\uC54C\uB78C"]},{key:"\uB2EC\uB825",get label(){return n("emoji.calendar")},insert:"\u{1F4C5}",keywords:["calendar","\uC77C\uC815","\uB0A0\uC9DC"]},{key:"\uBA54\uBAA8",get label(){return n("emoji.note")},insert:"\u{1F4DD}",keywords:["note","\uAE30\uB85D"]},{key:"\uCCA8\uBD80",get label(){return n("emoji.attach")},insert:"\u{1F4CE}",keywords:["attach","\uD074\uB9BD","\uD30C\uC77C"]},{key:"\uB9C1\uD06C",get label(){return n("emoji.link")},insert:"\u{1F517}",keywords:["link","\uC8FC\uC18C"]},{key:"\uB85C\uCF13",get label(){return n("emoji.rocket")},insert:"\u{1F680}",keywords:["rocket","\uCD9C\uBC1C","\uBC30\uD3EC"]},{key:"\uBCC4",get label(){return n("emoji.star")},insert:"\u2B50",keywords:["star","\uC911\uC694"]},{key:"\uC5D1\uC2A4",get label(){return n("emoji.x")},insert:"\u274C",keywords:["x","\uC548\uB428","\uCDE8\uC18C"]}];function Zl(e,t,o){let i=e.slice(0,t),a=(o==="@"?/(^|[\s(])@([^\s@]{0,20})$/:/(^|[\s(])\/([^\s/]{0,20})$/).exec(i);return a?{start:t-a[2].length-1,query:a[2]}:null}function Op(e,t){let o=fe(),i=e??o.mentionCandidates??[],r=t??o.slashCommands,a=r===!0?rO:Array.isArray(r)?r:[];return{people:i,commands:a,enabled:i.length>0||a.length>0}}function Lp(e,t,o){if(!o)return[];let i=o.query.toLowerCase();return o.trigger==="@"?e.filter(r=>r.name.toLowerCase().includes(i)).slice(0,Vh).map((r,a)=>({id:`p${a}-${r.name}`,text:`@${r.name} `,label:r.name,subtitle:r.subtitle,icon:Yi(bo,{src:r.avatar??"",name:r.name,avatarSx:{width:24,height:24,fontSize:14},iconFontSize:16})})):t.filter(r=>[r.key,r.label,...r.keywords??[]].some(a=>a.toLowerCase().includes(i))).slice(0,Vh).map(r=>({id:`c-${r.key}`,text:r.insert,label:`/${r.label}`,icon:Yi(dm,{component:"span",sx:{width:24,textAlign:"center",fontSize:18,lineHeight:1},children:r.insert})}))}function Ap({open:e,anchor:t,items:o,active:i,onPick:r,onHover:a}){return Yi(nO,{open:e,anchorEl:t,placement:"top-start",sx:{zIndex:1500},children:Yi(oO,{elevation:4,sx:{minWidth:220,maxWidth:320,py:.5,borderRadius:1.5},children:o.map((l,s)=>iO(dm,{role:"option","aria-selected":s===i,onMouseDown:c=>c.preventDefault(),onClick:()=>r(l),onMouseEnter:()=>a(s),sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:.75,cursor:"pointer",fontSize:14,bgcolor:s===i?"action.selected":"transparent"},children:[l.icon,Yi(dm,{component:"span",sx:{fontWeight:500,whiteSpace:"nowrap"},children:l.label}),l.subtitle?Yi(dm,{component:"span",sx:{color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.subtitle}):null]},l.id))})})}function Kh({value:e,setValue:t,candidates:o,slashCommands:i}){let{people:r,commands:a,enabled:l}=Op(o,i),s=$h(null),[c,u]=Mp(null),[m,p]=Mp(null),[d,f]=Mp(0),g=tO(()=>Lp(r,a,m),[a,r,m]),x=!!(c&&m&&g.length>0),b=um(()=>{let T=s.current;if(!l||!T)return;let B=T.selectionStart??T.value.length,E=r.length>0?Zl(T.value,B,"@"):null,q=!E&&a.length>0?Zl(T.value,B,"/"):null,R=E?{...E,trigger:"@"}:q?{...q,trigger:"/"}:null;p(R),f(0),u(R?T.closest(".MuiInputBase-root")??T:null)},[a.length,l,r.length]),_=$h(null);eO(()=>{let T=s.current,B=_.current;if(B!==null&&T){_.current=null,T.setSelectionRange(B,B);return}document.activeElement===T&&b()},[e,b]);let h=um(T=>{let B=s.current;if(!m||!B)return;let E=B.selectionStart??e.length,q=e.slice(0,m.start)+T.text+e.slice(E),R=m.start+T.text.length;_.current=q===e?null:R,t(q),p(null),u(null),requestAnimationFrame(()=>{_.current=null,B.focus(),B.setSelectionRange(R,R)})},[m,t,e]),v=um(T=>!x||T.nativeEvent.isComposing?!1:T.key==="ArrowDown"||T.key==="ArrowUp"?(T.preventDefault(),f(B=>(B+(T.key==="ArrowDown"?1:g.length-1))%g.length),!0):T.key==="Enter"||T.key==="Tab"?(T.preventDefault(),h(g[Math.min(d,g.length-1)]),!0):T.key==="Escape"?(T.preventDefault(),T.stopPropagation(),p(null),u(null),!0):!1,[d,g,x,h]);return{inputRef:um(T=>{s.current=T},[]),onKeyDown:v,onSelectionChange:b,popper:l?Yi(Ap,{open:x,anchor:c,items:g,active:d,onPick:h,onHover:f}):null}}import{useCallback as Np,useEffect as aO,useRef as Uh,useState as Gh}from"react";import{Box as es,Tab as lO,Tabs as sO}from"@mui/material";import{jsx as Aa,jsxs as uO}from"react/jsx-runtime";var jh=[{key:"smile",labelKey:"section.emojiSmileys",items:["\u{1F600}","\u{1F603}","\u{1F604}","\u{1F601}","\u{1F606}","\u{1F605}","\u{1F923}","\u{1F602}","\u{1F642}","\u{1F643}","\u{1F609}","\u{1F60A}","\u{1F607}","\u{1F970}","\u{1F60D}","\u{1F929}","\u{1F618}","\u{1F617}","\u{1F61A}","\u{1F619}","\u{1F60B}","\u{1F61B}","\u{1F61C}","\u{1F92A}","\u{1F61D}","\u{1F917}","\u{1F92D}","\u{1F92B}","\u{1F914}","\u{1F928}","\u{1F610}","\u{1F611}","\u{1F636}","\u{1F60F}","\u{1F612}","\u{1F644}","\u{1F62C}","\u{1F60C}","\u{1F614}","\u{1F62A}","\u{1F634}","\u{1F637}","\u{1F912}","\u{1F915}","\u{1F975}","\u{1F976}","\u{1F635}","\u{1F92F}","\u{1F60E}","\u{1F973}","\u{1F622}","\u{1F62D}","\u{1F624}","\u{1F620}","\u{1F621}","\u{1F97A}","\u{1F633}","\u{1F631}","\u{1F628}","\u{1F630}","\u{1F625}","\u{1F910}","\u{1F62F}","\u{1F62E}"]},{key:"gesture",labelKey:"section.emojiPeople",items:["\u{1F44D}","\u{1F44E}","\u{1F44C}","\u270C\uFE0F","\u{1F91E}","\u{1F91F}","\u{1F918}","\u{1F919}","\u{1F448}","\u{1F449}","\u{1F446}","\u{1F447}","\u261D\uFE0F","\u270B","\u{1F91A}","\u{1F590}\uFE0F","\u{1F596}","\u{1F44B}","\u{1F91D}","\u{1F64F}","\u{1F4AA}","\u{1F9BE}","\u{1F44F}","\u{1F64C}","\u{1F450}","\u{1F932}","\u{1FAF6}","\u270D\uFE0F","\u{1F485}","\u{1F933}","\u{1F9E0}","\u{1F440}","\u{1F647}","\u{1F64B}","\u{1F646}","\u{1F645}","\u{1F481}","\u{1F937}","\u{1F926}","\u{1F9D1}\u200D\u{1F4BB}","\u{1F468}\u200D\u{1F4BC}","\u{1F469}\u200D\u{1F4BC}","\u{1F6B6}","\u{1F3C3}","\u{1F483}","\u{1F57A}","\u{1F476}","\u{1F9D3}"]},{key:"heart",labelKey:"section.emojiHearts",items:["\u2764\uFE0F","\u{1F9E1}","\u{1F49B}","\u{1F49A}","\u{1F499}","\u{1F49C}","\u{1F5A4}","\u{1F90D}","\u{1F90E}","\u{1F494}","\u2763\uFE0F","\u{1F495}","\u{1F49E}","\u{1F493}","\u{1F497}","\u{1F496}","\u{1F498}","\u{1F49D}","\u{1F49F}","\u2728","\u{1F4AB}","\u{1F4A5}","\u{1F389}","\u{1F38A}","\u{1F388}","\u{1F381}","\u{1F451}","\u{1FAC2}","\u{1F63B}","\u{1F490}","\u{1F380}","\u{1F48C}"]},{key:"work",labelKey:"section.emojiWork",items:["\u{1F4CC}","\u{1F4CE}","\u{1F4DD}","\u{1F4C4}","\u{1F4D1}","\u{1F4CA}","\u{1F4C8}","\u{1F4C9}","\u{1F5C2}\uFE0F","\u{1F4C5}","\u{1F4C6}","\u23F0","\u231B","\u2705","\u2611\uFE0F","\u274C","\u2B55","\u2757","\u2753","\u{1F4A1}","\u{1F514}","\u{1F515}","\u{1F4E2}","\u{1F4E3}","\u{1F4AC}","\u{1F4AD}","\u{1F517}","\u{1F512}","\u{1F511}","\u2699\uFE0F","\u{1F6E0}\uFE0F","\u{1F4EC}","\u{1F4BB}","\u{1F5A5}\uFE0F","\u{1F5A8}\uFE0F","\u{1F4DE}","\u{1F4F1}","\u{1F4B0}","\u{1F4B3}","\u{1F9FE}","\u{1F4E6}","\u{1F550}","\u{1F4CB}","\u{1F587}\uFE0F","\u270F\uFE0F","\u{1F5D1}\uFE0F","\u267B\uFE0F","\u{1F50D}"]},{key:"food",labelKey:"section.emojiFood",items:["\u2615","\u{1F375}","\u{1F964}","\u{1F9C3}","\u{1F37A}","\u{1F37B}","\u{1F942}","\u{1F377}","\u{1F378}","\u{1F943}","\u{1F35A}","\u{1F35C}","\u{1F372}","\u{1F35B}","\u{1F371}","\u{1F359}","\u{1F354}","\u{1F35F}","\u{1F355}","\u{1F32D}","\u{1F96A}","\u{1F32E}","\u{1F35D}","\u{1F957}","\u{1F356}","\u{1F357}","\u{1F969}","\u{1F373}","\u{1F95E}","\u{1F9C7}","\u{1F35E}","\u{1F950}","\u{1F370}","\u{1F382}","\u{1F9C1}","\u{1F36A}","\u{1F369}","\u{1F36B}","\u{1F36C}","\u{1F36D}","\u{1F366}","\u{1F34E}","\u{1F34A}","\u{1F34B}","\u{1F34C}","\u{1F349}","\u{1F347}","\u{1F353}"]},{key:"etc",labelKey:"section.emojiOther",items:["\u{1F525}","\u2B50","\u{1F31F}","\u{1F4AF}","\u{1F3AF}","\u{1F3C6}","\u{1F947}","\u{1F680}","\u{1F308}","\u2600\uFE0F","\u{1F319}","\u26C5","\u2601\uFE0F","\u{1F327}\uFE0F","\u2744\uFE0F","\u26A1","\u{1F338}","\u{1F33A}","\u{1F337}","\u{1F339}","\u{1F33B}","\u{1F340}","\u{1F33F}","\u{1F331}","\u{1F436}","\u{1F431}","\u{1F430}","\u{1F43C}","\u{1F98A}","\u{1F43B}","\u{1F425}","\u{1F98B}","\u{1F697}","\u2708\uFE0F","\u{1F3E0}","\u{1F3E2}","\u{1F3B5}","\u{1F3B6}","\u{1F4DA}","\u{1F3AE}","\u26BD","\u{1F3C0}","\u{1F48A}","\u{1FA7A}","\u{1F9F3}","\u{1F382}","\u{1F6D2}","\u{1F9F9}"]}],cO="'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif",Yh="taskbox.recentEmojis",Xh=24;function Qh(){try{let e=JSON.parse(window.localStorage.getItem(Yh)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string").slice(0,Xh):[]}catch{return[]}}function mO(e){let t=[e,...Qh().filter(o=>o!==e)].slice(0,Xh);try{window.localStorage.setItem(Yh,JSON.stringify(t))}catch{}return t}function Jh({onPick:e}){let[t,o]=Gh(()=>Qh()),[i,r]=Gh(0),a=Uh(null),l=Uh(!1),s=t.length>0?[{key:"recent",labelKey:"section.emojiFrequent",items:t},...jh]:jh,c=Math.min(i,s.length-1),u=Np(d=>{o(mO(d)),e(d)},[e]),m=Np(d=>{r(d);let f=a.current;f&&(l.current=!0,f.scrollTo({left:f.clientWidth*d,behavior:"smooth"}),window.setTimeout(()=>{l.current=!1},350))},[]),p=Np(()=>{let d=a.current;if(!d||l.current||d.clientWidth===0)return;let f=Math.round(d.scrollLeft/d.clientWidth);r(g=>f!==g&&f>=0?f:g)},[]);return aO(()=>{let d=a.current;d&&(d.scrollLeft=d.clientWidth*c)},[]),uO(es,{children:[Aa(sO,{value:c,onChange:(d,f)=>m(f),variant:"scrollable",scrollButtons:!1,sx:{minHeight:36,borderBottom:`1px solid ${se}`,"& .MuiTab-root":{minHeight:36,minWidth:0,px:1.5,fontSize:13}},children:s.map(d=>Aa(lO,{label:n(d.labelKey)},d.key))}),Aa(es,{ref:a,onScroll:p,sx:{display:"flex",height:352,overflowX:"auto",overflowY:"hidden",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},children:s.map(d=>Aa(es,{sx:{flex:"0 0 100%",width:"100%",height:"100%",overflowY:"auto",scrollSnapAlign:"start",scrollSnapStop:"always",p:1},children:Aa(es,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(40px, 1fr))"},children:d.items.map((f,g)=>Aa(es,{component:"button",type:"button",onClick:()=>u(f),"aria-label":f,sx:{border:0,bgcolor:"transparent",color:"#000",cursor:"pointer",fontFamily:cO,fontSize:24,lineHeight:1,py:.75,borderRadius:"8px","&:hover":{bgcolor:"rgba(15, 23, 42, 0.06)"},"&:active":{bgcolor:"rgba(15, 23, 42, 0.1)"}},children:f},`${f}-${g}`))})},d.key))})]})}import{forwardRef as kO,useImperativeHandle as TO,useLayoutEffect as tk,useRef as fm,useState as ek}from"react";import{Box as Wp}from"@mui/material";import{EhfuseEditor as yO}from"@ehfuse/editor";import{useCallback as qp,useMemo as dO,useRef as pO,useState as zp}from"react";import{jsx as fO}from"react/jsx-runtime";function Zh(e,t){let{people:o,commands:i,enabled:r}=Op(e,t),[a,l]=zp(null),[s,c]=zp(null),u=pO(""),[m,p]=zp(0),d=dO(()=>Lp(o,i,a),[i,o,a]),f=!!(r&&s&&a&&d.length>0),g=qp(()=>{if(!r)return;let h=window.getSelection();if(!h||h.rangeCount===0||!h.isCollapsed)return void l(null);let v=h.anchorNode;if(!v||v.nodeType!==Node.TEXT_NODE||!v.parentElement?.closest(".ehfuse-editor-content"))return void l(null);let k=v.data,A=h.anchorOffset,T=o.length>0?Zl(k,A,"@"):null,B=!T&&i.length>0?Zl(k,A,"/"):null,E=T?{...T,trigger:"@"}:B?{...B,trigger:"/"}:null;if(!E){u.current="",l(null),c(null);return}l({node:v,start:E.start,end:A,query:E.query,trigger:E.trigger});let q=`${E.trigger}${E.query}`;q!==u.current&&p(0),u.current=q;let R=document.createRange();R.setStart(v,E.start),R.setEnd(v,Math.min(E.start+1,k.length));let C=R.getBoundingClientRect();c({getBoundingClientRect:()=>C})},[i.length,r,o.length]),x=qp(h=>{if(!a)return;let{node:v,start:k,end:A}=a;if(!v.isConnected)return void l(null);let T=window.getSelection(),B=document.createRange();B.setStart(v,k),B.setEnd(v,Math.min(A,v.data.length)),T?.removeAllRanges(),T?.addRange(B),document.execCommand("insertText",!1,h.text),l(null),c(null)},[a]);return{handlers:{onKeyDownCapture:qp(h=>{!f||h.nativeEvent.isComposing||(h.key==="ArrowDown"||h.key==="ArrowUp"?(h.preventDefault(),h.stopPropagation(),p(v=>(v+(h.key==="ArrowDown"?1:d.length-1))%d.length)):h.key==="Enter"||h.key==="Tab"?(h.preventDefault(),h.stopPropagation(),x(d[Math.min(m,d.length-1)])):h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),l(null),c(null)))},[m,d,f,x]),onKeyUp:g,onMouseUp:g,onInput:g},popper:r?fO(Ap,{open:f,anchor:s,items:d,active:m,onPick:x,onHover:p}):null,isOpen:f}}function Na(e){return/^\s*<(p|div|ul|ol|h[1-6]|blockquote|pre)[\s>]/i.test(e)}var gO=new Set(["P","BR","DIV","SPAN","STRONG","B","EM","I","U","S","STRIKE","DEL","CODE","PRE","UL","OL","LI","H1","H2","H3","H4","BLOCKQUOTE","A","MARK"]),xO=new Set(["background-color","color","text-decoration"]);function pm(e){if(typeof DOMParser>"u")return"";let o=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html").body.firstElementChild;if(!o)return"";let i=r=>{for(let a of Array.from(r.children)){if(!gO.has(a.tagName)){if(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE"].includes(a.tagName)){a.remove();continue}i(a),a.replaceWith(...Array.from(a.childNodes));continue}for(let l of Array.from(a.attributes)){let s=l.name.toLowerCase();if(a.tagName==="A"&&s==="href"){/^(https?:|mailto:|tel:)/i.test(l.value.trim())||a.removeAttribute(l.name);continue}if(s==="style"){let c=l.value.split(";").map(u=>u.trim()).filter(u=>xO.has(u.split(":")[0]?.trim().toLowerCase()??"")&&!/url\(|expression/i.test(u)).join("; ");c?a.setAttribute("style",c):a.removeAttribute("style");continue}a.removeAttribute(l.name)}i(a)}};return i(o),o.innerHTML}function ts(e){if(typeof DOMParser>"u")return e.replace(/<[^>]*>/g,"");let t=e.replace(/<br\s*\/?>/gi,`
|
|
12
12
|
`).replace(/<\/(p|div|li|h[1-6]|blockquote|pre)>/gi,`
|
|
13
13
|
`).replace(/<li[^>]*>/gi,"\u2022 ");return(new DOMParser().parseFromString(t,"text/html").body.textContent??"").replace(/\n{3,}/g,`
|
|
14
14
|
|