@ehfuse/taskbox 0.11.43 → 0.11.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -70,7 +70,7 @@ use chrome, FireFox or Internet Explorer 11`)}var r=e("safe-buffer"),t=e("random
|
|
|
70
70
|
`).replace(/<\/(p|div|li|h[1-6]|blockquote)>/gi,`
|
|
71
71
|
`),c=document.createElement("div");return c.innerHTML=u,(c.textContent??"").replace(/\n{3,}/g,`
|
|
72
72
|
|
|
73
|
-
`).trim()}var SU={...bs.minimalToolbarOptions,left:(bs.minimalToolbarOptions.left??[]).map(e=>e.filter(u=>u!=="undo"&&u!=="redo")).filter(e=>e.length>0).flatMap(e=>e.includes("indent")?[["bulletList","numberList"],e]:[e])};function jc({syncKey:e,value:u,onChange:c,readOnly:l=!1,viewFirst:n=!1,onTranslate:a,minHeight:r=180,editing:t,onEditingChange:o}){ue();let{uploadContentImage:d,openExternalUrl:i,openContentImage:s}=it(),h=T=>{i?i(T):window.open(T,"_blank","noopener,noreferrer")},[f,m]=(0,io.useState)(()=>!n||!Ea(u).trim()),b=t!==void 0,g=b?t:f,w=(0,io.useRef)(o);w.current=o;let S=T=>{b||m(T),w.current?.(T)};(0,io.useEffect)(()=>{n&&S(!Ea(u).trim())},[e,n]);let O=(0,io.useRef)(null),P=(0,io.useRef)(new bs.ImageResizePlugin),j=(0,io.useRef)(null),M=(0,io.useRef)(Date.now()+800),N=Sn(),z=(0,hr.useTheme)(),W=(0,hr.useMediaQuery)(z.breakpoints.down("sm")),[F,C]=(0,io.useState)(!1),B=()=>{let T=Ea(u);T&&navigator.clipboard.writeText(T).then(()=>{C(!0),window.setTimeout(()=>C(!1),1500)})},R=(T,_=!1)=>T instanceof Element?T.closest(_?".taskbox-content-readview a[href]":".ehfuse-editor-content a[href]"):null,p=T=>N||T.ctrlKey||T.metaKey;(0,io.useEffect)(()=>{if(l)return;let T=Vf(u);j.current===T||j.current===u||(j.current=T,M.current=Date.now()+800,O.current?.setHtml(T))},[e,u,l]);let y=Vf(u),x=(0,io.useRef)(null),k=(0,io.useRef)({el:null,html:""});return(0,io.useLayoutEffect)(()=>{let T=x.current;T&&(k.current.el===T&&k.current.html===y||(T.innerHTML=y,zL(T),k.current={el:T,html:y}))}),l||!g?(0,rr.jsxs)(hr.Box,{sx:{position:"relative",mt:1},children:[(0,rr.jsx)(hr.Box,{onClickCapture:T=>{let _=T.target;if(_?.tagName==="IMG"&&_.src){T.preventDefault(),T.stopPropagation();let H=Array.from(T.currentTarget.querySelectorAll("img")).filter(L=>L.src),V=H.map((L,G)=>({src:L.src,name:L.alt||decodeURIComponent(L.src.split("/").pop()||"")||`image-${G+1}`})),U=Math.max(0,H.indexOf(_));s?s(V,U):h(V[U].src);return}let D=R(T.target,!0);D&&(T.preventDefault(),T.stopPropagation(),h(D.href))},ref:x,className:"taskbox-content-readview","data-drag-scroll":"off",sx:{border:"1px solid #e0e0e0",borderRadius:1,p:"12px",pr:W?"12px":"52px",pb:"28px",minHeight:r,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},...Zd}}),W?(0,rr.jsxs)(hr.Box,{sx:{display:"flex",gap:1,mt:1},children:[(0,rr.jsx)(hr.Button,{variant:"outlined",color:"inherit",startIcon:(0,rr.jsx)(jL.default,{sx:{fontSize:18}}),onClick:B,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:F?I("section.copied"):I("common.copy")}),l?null:(0,rr.jsx)(hr.Button,{variant:"outlined",color:"inherit",startIcon:(0,rr.jsx)(Gf.default,{sx:{fontSize:18}}),onClick:()=>S(!0),sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:I("common.edit")}),a?(0,rr.jsx)(hr.Button,{variant:"outlined",color:"inherit",startIcon:(0,rr.jsx)(Uf.default,{sx:{fontSize:18}}),onClick:a,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:I("section.translate")}):null]}):(0,rr.jsxs)(hr.Box,{sx:{position:"absolute",top:6,right:6,display:"flex",flexDirection:"column",gap:.25},children:[l?null:(0,rr.jsx)(hr.Tooltip,{title:I("section.editContent"),arrow:!0,placement:"left",children:(0,rr.jsx)(hr.IconButton,{size:"small","aria-label":I("section.editContent"),onClick:()=>S(!0),sx:{color:"#9a9a97"},children:(0,rr.jsx)(Gf.default,{sx:{fontSize:17}})})}),a?(0,rr.jsx)(hr.Tooltip,{title:I("section.translate"),arrow:!0,placement:"left",children:(0,rr.jsx)(hr.IconButton,{size:"small","aria-label":I("section.translate"),onClick:a,sx:{color:"#9a9a97"},children:(0,rr.jsx)(Uf.default,{sx:{fontSize:17}})})}):null]})]}):(0,rr.jsxs)(hr.Box,{onDragOver:T=>T.stopPropagation(),onDrop:T=>T.stopPropagation(),onMouseDownCapture:T=>{p(T)&&R(T.target)&&T.preventDefault()},onClickCapture:T=>{let _=p(T)?R(T.target):null;_&&(T.preventDefault(),T.stopPropagation(),h(_.href))},sx:{mt:1,"& .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:"12px"},...N?{"& .ehfuse-editor-content a[href]":{cursor:"pointer"}}:{},position:"relative"},children:[n&&!b?(0,rr.jsx)(hr.Tooltip,{title:I("section.finishEditingTooltip"),arrow:!0,children:(0,rr.jsx)(hr.IconButton,{size:"small","aria-label":I("section.finishEditing"),onMouseDown:T=>T.preventDefault(),onClick:()=>S(!1),sx:{position:"absolute",top:4,right:6,zIndex:2,color:"#2f9e5b"},children:(0,rr.jsx)(FL.default,{sx:{fontSize:19}})})}):null,(0,rr.jsx)(bs.EhfuseEditor,{ref:O,defaultValue:Vf(u),autoHeight:!0,showToolbar:!N,focusBorder:!0,styles:{focusBorderColor:"var(--primary)"},toolbarOptions:SU,plugins:[P.current],locale:ya(),minHeight:r,placeholder:I("section.contentPlaceholder"),onImageUpload:d,contentStyle:{padding:"12px"},onChange:T=>{let _=Date.now()<M.current,D=T===j.current;j.current=T,!(_||D)&&c(T)}})]})}_e();var or=require("react/jsx-runtime");function $f(e){return String(e??"").replace(/<[^>]*>/g,"").replace(/ /g," ").trim().length>0}function qc({content:e,templates:u,onApply:c,onSave:l,onRemove:n,readOnly:a=!1}){ue();let[r,t]=(0,Qd.useState)(null),[o,d]=(0,Qd.useState)(!1),[i,s]=(0,Qd.useState)(""),h=async m=>{t(null),!($f(e)&&!await(0,dl.ConfirmDialog)({title:I("section.loadTemplate"),message:I("section.loadTemplateConfirm",{name:m.name})}))&&c(m.content)},f=()=>{t(null);let m=Ea(e);m&&navigator.clipboard.writeText(m).then(()=>(0,dl.SuccessAlert)(I("section.contentCopied"))).catch(()=>(0,dl.ErrorAlert)(I("section.contentCopyFailed")))};return(0,or.jsxs)(or.Fragment,{children:[(0,or.jsx)(Cr.Tooltip,{title:I("section.contentMenu"),arrow:!0,disableInteractive:!0,children:(0,or.jsx)(Cr.IconButton,{size:"small","aria-label":I("section.contentMenu"),onClick:m=>t(m.currentTarget),sx:{ml:"auto",color:"#9a9a97"},children:(0,or.jsx)(qL.default,{sx:{fontSize:18}})})}),(0,or.jsxs)(Cr.Menu,{anchorEl:r,open:!!r,onClose:()=>t(null),transitionDuration:0,children:[(0,or.jsx)(Cr.MenuItem,{disabled:!$f(e),onClick:f,sx:{fontSize:14,minWidth:220},children:I("menu.copyContent")}),a?null:(0,or.jsx)(Cr.Divider,{sx:{my:.5}}),!a&&l?(0,or.jsx)(Cr.MenuItem,{disabled:!$f(e),onClick:()=>{t(null),s(""),d(!0)},sx:{fontSize:14,minWidth:220},children:I("section.saveAsTemplate")}):null,!a&&l?(0,or.jsx)(Cr.Divider,{sx:{my:.5}}):null,a?null:u.length===0?(0,or.jsx)(Cr.MenuItem,{disabled:!0,sx:{fontSize:14,minWidth:220},children:I("section.noSavedTemplates")}):u.map(m=>(0,or.jsxs)(Cr.MenuItem,{onClick:()=>{h(m)},sx:{fontSize:14,minWidth:220,gap:1},children:[(0,or.jsx)(Cr.Box,{sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.name}),n?(0,or.jsx)(Cr.IconButton,{size:"small","aria-label":I("section.deleteTemplateAria",{name:m.name}),onClick:b=>{b.stopPropagation(),n(m.seq)},sx:{color:"#9a9a97"},children:(0,or.jsx)(Dr,{sx:{fontSize:16}})}):null]},m.seq))]}),(0,or.jsx)(HL.FormDialog,{open:o,onClose:()=>d(!1),maxWidth:"xs",title:I("section.saveTemplateTitle"),locale:Pt(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},tabs:{visible:!1},actions:{showCancelButton:!0,right:(0,or.jsx)(Cr.Button,{variant:"contained",disabled:!i.trim(),onClick:()=>{l?.(i.trim(),e),d(!1)},children:I("common.save")})},sections:[{id:"template-name",title:"",showTitle:!1,children:(0,or.jsxs)(Cr.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[(0,or.jsx)(Cr.Box,{sx:{fontSize:15,color:"#37352f"},children:I("section.saveTemplateHint")}),(0,or.jsx)(WL.ClearTextField,{size:"medium",fullWidth:!0,autoFocus:!0,placeholder:I("section.templateNamePlaceholder"),value:i,onChange:m=>s(m.target.value)})]})}]})]})}var hl=require("react"),jt=require("@mui/material"),Oi=require("@dnd-kit/core"),em=require("@dnd-kit/modifiers"),Pa=require("@dnd-kit/sortable"),tz=require("@dnd-kit/utilities"),Kf=v(require("@mui/icons-material/Close"),1),nz=v(require("@mui/icons-material/AddCircle"),1),Xf=v(require("@mui/icons-material/AddTask"),1),rz=v(require("@mui/icons-material/Checklist"),1),oz=v(require("@mui/icons-material/CheckCircle"),1),iz=v(require("@mui/icons-material/DragIndicator"),1),az=v(require("@mui/icons-material/Launch"),1),sz=v(require("@mui/icons-material/LinkOutlined"),1),lz=v(require("@mui/icons-material/RadioButtonUnchecked"),1);pn();var KL=require("react"),Kr=require("@mui/material"),XL=require("@ehfuse/mui-form-dialog"),YL=require("@ehfuse/mui-form-controls"),ZL=v(require("@mui/icons-material/CheckCircle"),1),QL=v(require("@mui/icons-material/RadioButtonUnchecked"),1),JL=require("@ehfuse/overlay-scrollbar");_e();var GL=require("react"),Jd=require("@ehfuse/forma"),UL=require("@ehfuse/alerts");_e();var VL={type:"related",search:"",selectedSeqs:[]};function ml(e){ue();let u=(0,GL.useRef)(e);u.current=e;let c={link:(0,Jd.useModal)({modalId:Dt("taskbox-task-link")})},l=(0,Jd.useGlobalForm)({formId:Dt("taskbox-task-link-form"),initialValues:VL,onValidate:r=>r.selectedSeqs.length===0?((0,UL.ErrorAlert)(I("link.selectTask")),!1):!0,onSubmit:r=>{for(let t of r.selectedSeqs)u.current.onSubmit(t,r.type);return c.link.close(),!0}});return{form:l,modals:c,openDialog:()=>{l.setFormValues({...VL,selectedSeqs:[]}),c.link.open()},toggleSelected:r=>{let t=l.getFormValue("selectedSeqs")??[];if(t.includes(r)){l.setFormValue("selectedSeqs",t.filter(o=>o!==r));return}l.setFormValue("selectedSeqs",u.current.multiSelect?[...t,r]:[r])}}}var fr=require("react/jsx-runtime"),$L=[{type:"related",get label(){return I("link.related")},get hint(){return I("link.relatedHint")}},{type:"follow_up",get label(){return I("link.previous")},get hint(){return I("link.previousHint")}},{type:"duplicate_of",get label(){return I("link.duplicate")},get hint(){return I("link.duplicateHint")}}];function Hc({controller:e,task:u,tasks:c,excludeSeqs:l=[],hideRelationType:n=!1,title:a=I("link.title"),confirmLabel:r=I("link.confirm")}){ue();let t=Sn(),{form:o}=e,d=e.modals.link,i=o.useValue("type")??"related",s=String(o.useValue("search")??""),h=o.useValue("selectedSeqs")??[],f=(0,KL.useMemo)(()=>{let g=new Set([u.seq,...l]),w=s.trim().toLowerCase();return c.filter(S=>g.has(S.seq)||S.is_event||S.is_notice||S.linked_only?!1:w?S.title.toLowerCase().includes(w)||(S.ticket_no??"").toLowerCase().includes(w):!0).sort((S,O)=>!!S.completed!=!!O.completed?S.completed?1:-1:O.seq-S.seq)},[c,u.seq,l,s]),m=$L.find(g=>g.type===i)?.hint??"",b=(0,fr.jsxs)(Kr.Box,{sx:{display:"flex",flexDirection:"column",minHeight:0,height:t?"100%":"auto"},children:[n?null:(0,fr.jsx)(Kr.Tabs,{value:i,onChange:(g,w)=>o.setFormValue("type",w),sx:{minHeight:38,flexShrink:0,borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,"& .MuiTab-root":{minHeight:38,py:.5,fontSize:16,color:"#333333"}},children:$L.map(g=>(0,fr.jsx)(Kr.Tab,{value:g.type,label:g.label},g.type))}),n?null:(0,fr.jsx)(Kr.Box,{sx:{mt:1,mb:1.5,fontSize:14,flexShrink:0},children:m}),(0,fr.jsxs)(Kr.Box,{sx:{...t?{height:"100%",minHeight:0}:{height:560},display:"flex",flexDirection:"column",...t?{}:{border:"1px solid #cccccc",borderRadius:1},overflow:"hidden",userSelect:"none"},children:[(0,fr.jsx)(Kr.Box,{sx:{px:1.5,py:1,borderBottom:"1px solid #cccccc",flexShrink:0},children:(0,fr.jsx)(YL.ClearTextField,{placeholder:I("link.searchPlaceholder"),name:"search",form:o,fullWidth:!0,autoFocus:!0,size:"small",sx:{"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiInputBase-root":{px:0}}})}),(0,fr.jsx)(Kr.Box,{sx:{flex:1,minHeight:0},children:(0,fr.jsx)(JL.OverlayScrollbar,{style:{height:"100%"},contentStyle:{paddingTop:0},children:(0,fr.jsx)(Kr.Box,{sx:{display:"flex",flexDirection:"column"},children:f.length===0?(0,fr.jsx)(Kr.Box,{sx:{py:4,textAlign:"center",fontSize:13.5,color:"#9a9a97"},children:I("link.empty")}):f.map(g=>{let w=g.is_notice||g.is_event?tn(g.icon||(g.is_notice?tr:kr)):null,S=h.includes(g.seq);return(0,fr.jsxs)(Kr.Box,{onClick:()=>e.toggleSelected(g.seq),sx:{display:"flex",alignItems:"center",gap:.75,px:1.5,py:1.25,flexShrink:0,cursor:"pointer",borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,"&:last-of-type":{borderBottom:"none"},bgcolor:S?"#e3eefb":"transparent","&:hover":{bgcolor:S?"#e3eefb":"#f7f7f5"}},children:[S?(0,fr.jsx)(ZL.default,{sx:{fontSize:20,flexShrink:0,color:"#2f6fd0"}}):(0,fr.jsx)(QL.default,{sx:{fontSize:20,flexShrink:0,color:"#c9c8c5"}}),w?(0,fr.jsx)(w,{sx:{fontSize:17,flexShrink:0,color:g.icon_color||"#1e3a8a"}}):null,(0,fr.jsxs)(Kr.Box,{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:[g.ticket_no?`${g.ticket_no} `:"",g.title]}),(0,fr.jsx)(Kr.Box,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:(0,fr.jsx)(Tn,{option:xr(g)})})]},g.seq)})})})})]})]});return(0,fr.jsx)(XL.FormDialog,{open:d.isOpen,onClose:d.close,maxWidth:"sm",fullScreen:t,mobilePresentation:t?"slide":"dialog",...t?{contentPaddingX:0,contentTopPadding:0,sectionsPaddingTop:0}:{},sx:t?{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:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-link",sections:[{id:"task-link",showTitle:!1,children:b}],scrollPastLastSection:!1,sectionContentPaddingTop:0,contentTopPadding:12,actions:{showCancelButton:!0,right:(0,fr.jsx)(Kr.Button,{variant:"contained",disabled:h.length===0,onClick:()=>{o.submit()},children:r})}})}var cz=require("@ehfuse/mui-confirm-action");_e();var Wc={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"};var ht=require("react/jsx-runtime"),ez="taskbox.checklist.hideCompleted";function CU({id:e,children:u}){let{attributes:c,listeners:l,setNodeRef:n,transform:a,transition:r,isDragging:t}=(0,Pa.useSortable)({id:e});return(0,ht.jsx)(jt.Box,{ref:n,sx:{transform:tz.CSS.Transform.toString(a),transition:r,...t?{opacity:.6,position:"relative",zIndex:1}:{}},children:u({handleProps:{...c,...l},dragging:t})})}function _U({sortable:e,sensors:u,rowIds:c,onDragEnd:l,compact:n,children:a}){let r=(0,ht.jsx)(jt.Box,{sx:{display:"flex",flexDirection:"column",mt:.5,pl:n?0:3.25},children:a});return e?(0,ht.jsx)(Oi.DndContext,{sensors:u,collisionDetection:Oi.closestCenter,modifiers:[em.restrictToVerticalAxis,em.restrictToParentElement],onDragEnd:l,children:(0,ht.jsx)(Pa.SortableContext,{items:c,strategy:Pa.verticalListSortingStrategy,children:r})}):r}function Vc({taskSeq:e,checklist:u,onAdd:c,onToggle:l,confirmOnToggle:n=!1,onRemove:a,onUpdate:r,onReorder:t,removeLocked:o=!1,onConvertToTask:d,onOpenLinkedTask:i,linkCandidates:s,linkBaseTask:h,onLinkExistingTask:f,resolveLinkedTask:m,myAccountSeq:b=0}){ue();let[g,w]=(0,hl.useState)(""),S=ml({multiSelect:!0,onSubmit:G=>{if(!f)return;let E=s?.find(A=>A.seq===G);f(e,G,String(E?.title??"").trim())}}),[O,P]=(0,hl.useState)(null),j=Sn(),[M,N]=(0,hl.useState)(null),[z,W]=(0,hl.useState)(null),F=G=>{let E=G.task_seq?m?.(G.task_seq):void 0;return E?E.completed:G.checked},C=G=>{if(!G.task_seq||b<=0)return!1;let E=m?.(G.task_seq);return E?!Zh(E,b):!1},B=G=>!!G.task_seq&&!!m&&!m?.(G.task_seq),R=u.filter(G=>!B(G)),p=R.filter(F).length,[y,x]=(0,hl.useState)(()=>{try{return localStorage.getItem(ez)==="1"}catch{return!1}}),k=G=>{x(G);try{localStorage.setItem(ez,G?"1":"0")}catch{}},T=!!t&&!j&&!o,_=(0,Oi.useSensors)((0,Oi.useSensor)(Oi.PointerSensor,{activationConstraint:{distance:5}})),D=(G,E)=>G.task_seq?`linked-${G.task_seq}`:`row-${E}`,H=u.map(D),V=H.filter((G,E)=>{let A=u[E];return B(A)?!1:!(y&&F(A))}),U=G=>{let{active:E,over:A}=G;if(!A||E.id===A.id)return;let q=H.indexOf(String(E.id)),$=H.indexOf(String(A.id));q<0||$<0||t?.(e,(0,Pa.arrayMove)(u,q,$))},L=()=>{g.trim()&&(c(e,g),w(""))};return(0,ht.jsxs)(ko,{icon:(0,ht.jsx)(rz.default,{sx:{fontSize:19,display:"block"}}),title:(0,ht.jsxs)(ht.Fragment,{children:[I("section.todo"),u.length>0?(0,ht.jsxs)(jt.Box,{component:"span",sx:{fontSize:12.5,color:"#9a9a97"},children:[p," / ",u.length]}):null]}),titleExtra:R.length>0?(0,ht.jsxs)(jt.Box,{sx:{flex:1,minWidth:0,ml:1,display:"flex",alignItems:"center",gap:1},children:[(0,ht.jsx)(jt.Box,{sx:{flex:1,minWidth:0,height:6,borderRadius:3,bgcolor:"#ececea"},children:(0,ht.jsx)(jt.Box,{sx:{height:"100%",borderRadius:3,width:`${Math.round(p/R.length*100)}%`,bgcolor:"#2f80ed",transition:"width 0.2s"}})}),p>0?(0,ht.jsxs)(jt.Box,{component:"label",sx:{display:"inline-flex",alignItems:"center",gap:.25,flexShrink:0,cursor:"pointer",fontSize:13.5,fontWeight:400,color:"#57564f",userSelect:"none"},children:[(0,ht.jsx)(jt.Switch,{size:"small",checked:y,onChange:(G,E)=>k(E)}),I("section.hideDone")]}):null]}):null,children:[(0,ht.jsx)(_U,{sortable:T,sensors:_,rowIds:V,onDragEnd:U,compact:j,children:u.map((G,E)=>{let A=G.task_seq?m?.(G.task_seq):void 0,q=F(G);if(y&&q||B(G))return null;let $=!!G.task_seq,Q=C(G),X=Y=>(0,ht.jsxs)(jt.Box,{sx:{display:"flex",alignItems:j?"flex-start":"center",gap:1,px:1.25,...T?{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:[Y?(0,ht.jsx)(jt.Box,{className:"taskbox-checklist-handle",...Y,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:(0,ht.jsx)(iz.default,{sx:{fontSize:16}})}):null,(0,ht.jsx)(jt.Tooltip,{title:Q?I("section.toggleLocked"):"",arrow:!0,disableInteractive:!0,children:(0,ht.jsx)(jt.Box,{component:"span",onClick:Q?void 0:te=>n?W({anchorEl:te.currentTarget,index:E,checked:!q}):l(e,E,!q),sx:{display:"inline-flex",flexShrink:0,cursor:Q?"default":"pointer",...j?{mt:"1px"}:{}},children:q?(0,ht.jsx)(oz.default,{sx:{fontSize:18,color:Q?"#a9c6ec":"#2f80ed"}}):(0,ht.jsx)(lz.default,{sx:{fontSize:18,color:Q?"#d6d5d1":"#9a9a97"}})})}),O?.index===E?(0,ht.jsx)(jt.Box,{component:"input",autoFocus:!0,spellCheck:!1,value:O.label,enterKeyHint:"done",onChange:te=>P({index:E,label:te.target.value}),onBlur:()=>{O.label.trim()&&O.label.trim()!==G.label&&r?.(e,E,O.label),P(null)},onKeyDown:te=>{te.key==="Enter"&&te.target.blur(),te.key==="Escape"&&P(null)},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",p:0}}):(0,ht.jsx)(jt.Box,{component:"span",onClick:$?G.task_seq&&i?()=>i(G.task_seq):void 0:o||!r?void 0:j?()=>N({index:E,label:G.label}):()=>P({index:E,label:G.label}),sx:{flex:1,minWidth:0,fontSize:14.5,color:"#37352f",textDecoration:q?"line-through":"none",overflow:"hidden",textOverflow:"ellipsis",...j?{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,lineHeight:1.4,wordBreak:"break-word"}:{whiteSpace:"nowrap"},...$?i?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}:o||!r?{}:{cursor:"text"}},children:G.label}),$?(0,ht.jsxs)(jt.Box,{component:"span",onClick:G.task_seq&&i?()=>i(G.task_seq):void 0,sx:{...Wc,...j?{mt:"1px"}:{},...i?{cursor:"pointer"}:{}},children:[(0,ht.jsx)(az.default,{sx:{fontSize:12}}),A?.manager_name?.trim()||I("template.task")]}):null,!o&&!$&&d?(0,ht.jsx)(jt.Tooltip,{title:I("section.makeTask"),arrow:!0,enterDelay:300,disableInteractive:!0,children:(0,ht.jsx)(jt.IconButton,{className:"taskbox-checklist-convert",size:"small","aria-label":I("section.makeTask"),onClick:()=>d(e,E,G.label),sx:{display:j?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:(0,ht.jsx)(Xf.default,{sx:{fontSize:16}})})}):null,o?null:(0,ht.jsx)(jt.IconButton,{className:"taskbox-checklist-remove",size:"small","aria-label":I("section.deleteTodo"),onClick:()=>a(e,E),sx:{display:j?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:(0,ht.jsx)(Kf.default,{sx:{fontSize:15}})})]});return T?(0,ht.jsx)(CU,{id:H[E],children:({handleProps:Y})=>X(Y)},H[E]):(0,ht.jsx)(jt.Box,{children:X(null)},H[E])})}),(0,ht.jsxs)(jt.Box,{sx:{mt:.5,ml:j?0:3.25,display:"flex",alignItems:"center",gap:.5},children:[(0,ht.jsx)(jt.Box,{component:"input",spellCheck:!1,value:g,placeholder:I("section.addTodoPlaceholder"),enterKeyHint:"done",onChange:G=>w(G.target.value),onKeyDown:G=>{G.key==="Enter"&&L()},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"}}}),s&&h&&f?(0,ht.jsx)(jt.Tooltip,{title:I("section.attachExisting"),arrow:!0,children:(0,ht.jsx)(jt.IconButton,{size:"small","aria-label":I("section.attachExisting"),onMouseDown:G=>G.preventDefault(),onClick:S.openDialog,sx:{flexShrink:0,color:"#9a9a97"},children:(0,ht.jsx)(sz.default,{sx:{fontSize:20}})})}):null,(0,ht.jsx)(jt.IconButton,{size:"small","aria-label":I("section.addTodo"),disabled:!g.trim(),onMouseDown:G=>G.preventDefault(),onClick:L,sx:{flexShrink:0,color:g.trim()?"#2f80ed":"#c9c8c5"},children:(0,ht.jsx)(nz.default,{sx:{fontSize:20}})})]}),s&&h&&f?(0,ht.jsx)(Hc,{controller:S,task:h,tasks:s,excludeSeqs:u.map(G=>Number(G.task_seq??0)).filter(G=>G>0),hideRelationType:!0,title:I("section.attachExisting"),confirmLabel:I("section.attach")}):null,(0,ht.jsx)(cz.ConfirmActionPopper,{open:!!z,anchorEl:z?.anchorEl??null,title:z?.checked?I("calendar.checklistCompleteConfirm"):I("task.uncompleteConfirm"),confirmText:z?.checked?I("common.done"):I("task.unmark"),onCancel:()=>W(null),onConfirm:()=>{z&&l(e,z.index,z.checked),W(null)}}),(0,ht.jsx)(jt.Dialog,{open:!!M,onClose:()=>N(null),maxWidth:"xs",fullWidth:!0,slotProps:{paper:{sx:{borderRadius:2,m:2}}},children:(0,ht.jsxs)(jt.Box,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5},children:[(0,ht.jsx)(jt.Box,{sx:{fontSize:15.5,fontWeight:600,color:"#37352f"},children:I("section.editTodo")}),(0,ht.jsx)(jt.TextField,{autoFocus:!0,fullWidth:!0,size:"medium",value:M?.label??"",onChange:G=>N(E=>E&&{...E,label:G.target.value}),onKeyDown:G=>{if(G.key!=="Enter")return;let E=M;E&&E.label.trim()&&r?.(e,E.index,E.label.trim()),N(null)}}),(0,ht.jsxs)(jt.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[!o&&d&&M&&!u[M.index]?.task_seq?(0,ht.jsx)(jt.IconButton,{"aria-label":I("section.makeTask"),onClick:()=>{d(e,M.index,u[M.index]?.label??""),N(null)},sx:{color:"#57564f"},children:(0,ht.jsx)(Xf.default,{sx:{fontSize:20}})}):null,!o&&M?(0,ht.jsx)(jt.IconButton,{"aria-label":I("section.deleteTodo"),onClick:()=>{a(e,M.index),N(null)},sx:{color:"#e5484d"},children:(0,ht.jsx)(Kf.default,{sx:{fontSize:19}})}):null,(0,ht.jsx)(jt.Box,{sx:{flex:1}}),(0,ht.jsx)(jt.Button,{color:"inherit",onClick:()=>N(null),children:I("common.cancel")}),(0,ht.jsx)(jt.Button,{variant:"contained",disabled:!M?.label.trim(),onClick:()=>{M&&M.label.trim()&&r?.(e,M.index,M.label.trim()),N(null)},children:I("common.confirm")})]})]})})]})}pn();var om=require("react"),ao=require("@mui/material"),Ai=require("@dnd-kit/core"),im=require("@dnd-kit/modifiers"),pl=require("@dnd-kit/sortable"),dz=require("@dnd-kit/utilities"),mz=v(require("@mui/icons-material/DragIndicator"),1),hz=v(require("@mui/icons-material/Close"),1),fz=v(require("@mui/icons-material/AttachFileOutlined"),1),pz=require("@ehfuse/file-viewer/icons");var IU=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"]),tm=e=>{let u=e?.split(".").pop()?.toLowerCase()??"";return IU.has(u)};var uz=require("@mui/material");var fl=require("react/jsx-runtime");function Yf(e){let u=Yo(),c=u.useValue("attachmentUpload.taskSeq"),l=u.useValue("attachmentUpload.index"),n=u.useValue("attachmentUpload.total"),a=u.useValue("attachmentUpload.queue"),r=l??0;return!r||e>0&&(c??0)!==e?null:{index:r,total:n??0,queue:a??[]}}function nm(){let u=Yo().useValue("attachmentUpload.progress");return(0,fl.jsxs)(fl.Fragment,{children:[u??0,"%"]})}function Zf(){let u=Yo().useValue("attachmentUpload.progress");return(0,fl.jsx)(uz.LinearProgress,{variant:"determinate",value:u??0,sx:{height:4,borderRadius:2,bgcolor:"#dbe9fb",mt:.75}})}_e();var cn=require("react/jsx-runtime");function BU({id:e,children:u}){let{attributes:c,listeners:l,setNodeRef:n,transform:a,transition:r,isDragging:t}=(0,pl.useSortable)({id:e});return(0,cn.jsx)(ao.Box,{ref:n,sx:{transform:dz.CSS.Transform.toString(a),transition:r,...t?{opacity:.6,position:"relative",zIndex:1}:{}},children:u({...c,...l})})}function Gc(e){return e>=1048576?`${(e/1048576).toFixed(1)}MB`:`${Math.max(1,Math.round(e/1024))}KB`}var rm={flex:1,minWidth:0,fontSize:13.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function Uc({taskSeq:e,attachments:u,onAdd:c,onRemove:l,removeLocked:n=!1,onPreview:a,onDownload:r,onReorder:t}){ue();let[o,d]=(0,om.useState)(!1),i=(0,om.useRef)(null),s=Sn(),h=js(),f=Fs(),m=Yf(e),b=e===0,g=!!t&&!b&&!s&&!n&&!m&&u.length>1,w=(0,Ai.useSensors)((0,Ai.useSensor)(Ai.PointerSensor,{activationConstraint:{distance:5}})),S=(F,C)=>F.uuid?`file-${F.uuid}`:`file-${C}`,O=u.map(S),P=F=>{let{active:C,over:B}=F;if(!B||C.id===B.id)return;let R=O.indexOf(String(C.id)),p=O.indexOf(String(B.id));R<0||p<0||t?.(e,R,p)},j=F=>{if(a){a(F);return}window.open(f(F.uuid??""),"_blank","noopener,noreferrer")},M=F=>{if(r){r(F);return}window.open(f(F.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},N=F=>m?F+1<m.index?"done":F+1===m.index?"uploading":"waiting":"waiting",z=(F,C,B,R,p={})=>(0,cn.jsxs)(ao.Box,{sx:{px:1,py:.5,borderRadius:1,border:"1px solid",borderColor:p.uploading?"#d5e6fb":De.NOTION_LINE_COLOR,bgcolor:p.uploading?"#f4f9ff":"transparent","&:hover .taskbox-file-remove":{opacity:1},"&:hover .taskbox-file-handle":{opacity:1}},children:[(0,cn.jsxs)(ao.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[p.handleProps?(0,cn.jsx)(ao.Box,{className:"taskbox-file-handle","aria-label":I("section.reorder"),...p.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:(0,cn.jsx)(mz.default,{sx:{fontSize:16}})}):null,(0,cn.jsx)(ao.Box,{component:"span",sx:{display:"inline-flex",flexShrink:0},children:(0,cn.jsx)(pz.FileTypeIcon,{fileName:C,size:18})}),B,(0,cn.jsx)(ao.Box,{component:"span",sx:{fontSize:12,color:p.uploading?"#2f80ed":"#9a9a97",flexShrink:0},children:R}),p.removeIndex!==void 0?(0,cn.jsx)(ao.IconButton,{className:"taskbox-file-remove",size:"small","aria-label":I("section.deleteAttachment"),onClick:()=>l(e,p.removeIndex),sx:{opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:(0,cn.jsx)(hz.default,{sx:{fontSize:15}})}):null]}),p.uploading?(0,cn.jsx)(Zf,{}):null]},F),W=F=>{let C=tm(F.name);return(0,cn.jsx)(ao.Box,{component:"button",type:"button",onClick:()=>C?j(F):M(F),title:I("section.fileAction",{name:F.name,value:C?I("section.preview"):I("section.download")}),sx:{...rm,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:F.name})};return(0,cn.jsxs)(ko,{icon:(0,cn.jsx)(fz.default,{sx:{fontSize:18,display:"block"}}),title:(0,cn.jsxs)(cn.Fragment,{children:[I("section.files")," ",u.length>0?u.length:""]}),children:[(0,cn.jsx)(OU,{sortable:g,sensors:w,rowIds:O,onDragEnd:P,children:(0,cn.jsxs)(ao.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mt:1},children:[u.map((F,C)=>{let B=`${F.uuid||F.name}-${C}`;if(b){let R=N(C),p=R==="uploading";return z(B,F.name,(0,cn.jsx)(ao.Box,{component:"span",sx:{...rm,color:R==="done"?"#37352f":"#9a9a97"},children:F.name}),p?(0,cn.jsx)(nm,{}):Gc(F.size),{uploading:p,removeIndex:!n&&!m?C:void 0})}return F.uuid?g?(0,cn.jsx)(BU,{id:S(F,C),children:R=>z(B,F.name,W(F),Gc(F.size),{removeIndex:n?void 0:C,handleProps:R})},S(F,C)):z(B,F.name,W(F),Gc(F.size),{removeIndex:n?void 0:C}):z(B,F.name,(0,cn.jsx)(ao.Box,{component:"span",title:I("section.legacyAttachment"),sx:{...rm,color:"#9a9a97"},children:F.name}),Gc(F.size),{removeIndex:n?void 0:C})}),!b&&m?m.queue.slice(m.index-1).map((F,C)=>{let B=C===0;return z(`uploading-${m.index+C}-${F.name}`,F.name,(0,cn.jsx)(ao.Box,{component:"span",sx:{...rm,color:"#9a9a97"},children:F.name}),B?(0,cn.jsx)(nm,{}):Gc(F.size),{uploading:B})}):null]})}),(0,cn.jsx)(ao.Box,{onClick:()=>i.current?.click(),onDragOver:F=>{F.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:F=>{F.preventDefault(),d(!1);let C=Array.from(F.dataTransfer.files);C.length>0&&c(e,C)},sx:{mt:1,py:2.5,display:"flex",alignItems:"center",justifyContent:"center",gap:.5,border:"1.5px dashed",borderColor:o?"#2f80ed":"#cfcfcc",borderRadius:1,bgcolor:o?"#eef6ff":"transparent",color:"#787774",fontSize:13.5,cursor:"pointer",transition:"background-color 0.15s, border-color 0.15s","&:hover":{bgcolor:"#fafaf9",borderColor:"#9a9a97"}},children:s?I("section.attachHint",{uploadMaxMb:h}):I("section.attachHintDrag",{uploadMaxMb:h})}),(0,cn.jsx)(ao.Box,{component:"input",ref:i,type:"file",multiple:!0,onChange:F=>{let C=Array.from(F.target.files??[]);C.length>0&&c(e,C),F.target.value=""},sx:{display:"none"}})]})}function OU({sortable:e,sensors:u,rowIds:c,onDragEnd:l,children:n}){return e?(0,cn.jsx)(Ai.DndContext,{sensors:u,collisionDetection:Ai.closestCenter,modifiers:[im.restrictToVerticalAxis,im.restrictToParentElement],onDragEnd:l,children:(0,cn.jsx)(pl.SortableContext,{items:c,strategy:pl.verticalListSortingStrategy,children:n})}):(0,cn.jsx)(cn.Fragment,{children:n})}var Tz=require("react"),gi=require("@mui/material"),Sz=v(require("@mui/icons-material/Add"),1);var gl=require("@mui/material"),kz=require("@ehfuse/mui-form-dialog"),xz=require("@ehfuse/mui-form-controls"),wz=require("@ehfuse/mui-color-picker");var bz=require("@ehfuse/forma"),yz=require("@ehfuse/alerts");_e();var gz="#2f80ed";function vz({open:e,onClose:u,onSubmit:c}){ue();let l=(0,bz.useGlobalForm)({formId:Dt("taskbox-add-label-form"),initialValues:{name:"",color:gz},onValidate:a=>String(a.name??"").trim()?!0:((0,yz.ErrorAlert)(I("dialog.enterLabelName")),!1),onSubmit:a=>(c(String(a.name).trim(),a.color),n.form.close(),!0)}),n={form:$r({modalIdPrefix:"taskbox-add-label-dialog",open:e,onClose:u,onOpen:()=>l.setFormValues({name:"",color:gz})})};return{form:l,modals:n}}_e();var Ei=require("react/jsx-runtime");function Qf({open:e,onClose:u,onSubmit:c}){ue();let{form:l,modals:n}=vz({open:e,onClose:u,onSubmit:c}),a=String(l.useFormValue("name")??""),r=String(l.useFormValue("color")??""),t=zh(r),o=(0,Ei.jsxs)(gl.Box,{children:[(0,Ei.jsxs)(gl.Box,{sx:{display:"flex",alignItems:"center",gap:1.5,mt:.5},children:[(0,Ei.jsx)(xz.ClearTextField,{form:l,name:"name",label:I("dialog.labelName"),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),l.submit())},fullWidth:!0,autoFocus:!0}),(0,Ei.jsx)(wz.ColorPicker,{value:r,onChange:d=>l.setFormValue("color",d),shape:"circle",colorSize:28})]}),(0,Ei.jsxs)(gl.Box,{sx:{mt:2,display:"flex",alignItems:"center",gap:1,fontSize:13,color:"#787774"},children:[I("dialog.preview"),(0,Ei.jsx)(Tn,{option:{key:"__preview__",name:a.trim()||I("dialog.label"),...t}})]})]});return(0,Ei.jsx)(kz.FormDialog,{open:n.form.isOpen,onClose:n.form.close,maxWidth:"xs",title:I("dialog.addLabelTitle"),locale:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-add-label",sections:[{id:"add-label",showTitle:!1,children:o}],actions:{showCancelButton:!0,right:(0,Ei.jsx)(gl.Button,{variant:"contained",onClick:()=>{l.submit()},children:I("common.add")})}})}_e();var No=require("react/jsx-runtime");function $c({anchorEl:e,selectedKeys:u,labelOptions:c,onToggle:l,onAddLabel:n,onClose:a}){ue();let[r,t]=(0,Tz.useState)(!1),o=wi();return(0,No.jsxs)(No.Fragment,{children:[(0,No.jsxs)(gi.Menu,{anchorEl:e,open:!!e,onClose:a,transitionDuration:0,...o,children:[c.map(d=>{let i=u.includes(d.key);return(0,No.jsxs)(gi.MenuItem,{onClick:()=>l(d.key),sx:{fontSize:14,minWidth:170,gap:1},children:[(0,No.jsx)(gi.Checkbox,{size:"small",checked:i,sx:{p:0}}),(0,No.jsx)(Tn,{option:d})]},d.key)}),(0,No.jsx)(gi.Divider,{}),(0,No.jsxs)(gi.MenuItem,{onClick:()=>t(!0),sx:{fontSize:14,color:"#787774"},children:[(0,No.jsx)(gi.ListItemIcon,{children:(0,No.jsx)(Sz.default,{sx:{fontSize:18,color:"#787774"}})}),I("menu.addLabel")]})]}),(0,No.jsx)(Qf,{open:r,onClose:()=>t(!1),onSubmit:n})]})}_e();function Cz(e,u){let c=Number(e.author_account_seq??0);return u.filter(l=>{let n=Number(l.account_seq??0);return n>0&&n!==c})}function _z(e,u){let c=(e.target_account_seqs??[]).filter(s=>s>0);if(c.length===0)return null;let l=new Set(c),n=Cz(e,u),a=new Map;for(let s of n){let h=String(s.department??"").trim();if(!h)continue;let f=a.get(h)??[];f.push(s),a.set(h,f)}let r=[],t=new Set;for(let[s,h]of a)if(h.every(m=>l.has(Number(m.account_seq??0)))){r.push(s);for(let m of h)t.add(Number(m.account_seq??0))}let o=new Map(n.map(s=>[Number(s.account_seq??0),s.name])),d=e.target_names??[],i=[];return c.forEach((s,h)=>{t.has(s)||i.push(o.get(s)??d[h]??I("dialog.noName"))}),{teamNames:r,individualNames:i}}function Kc(e,u){let c=_z(e,u);return c?[...c.teamNames,...c.individualNames].join(", "):I("col.allEmployees")}function AU(e,u){let c=_z(e,u);return c?{kind:"members",teamNames:c.teamNames,individualNames:c.individualNames}:{kind:"everyone"}}function EU(e,u,c){let l=u.length>0?new Set(u):new Set(c.map(n=>Number(n.account_seq??0)).filter(n=>n>0));return l.size===0?e.length:new Set(e.map(n=>Number(n.account_seq)).filter(n=>l.has(n))).size}function Jf(e,u,c){let l=(e.target_account_seqs??[]).filter(f=>f>0),n=Cz(e,u),a=l.length>0?l.length:n.length,r=e.acks??[],t=c>0&&r.some(f=>f.account_seq===c),o=c>0&&Number(e.author_account_seq??0)===c,d=l.length===0||l.includes(c),i=new Set(r.map(f=>f.account_seq)),h=(l.length>0?n.filter(f=>l.includes(Number(f.account_seq??0))):n).filter(f=>!i.has(Number(f.account_seq??0))).map(f=>String(f.name??"").trim()).filter(f=>f.length>0);return{count:EU(r,l,n),total:a,acked:t,pendingNames:h,canAck:c>0&&!o&&d&&!t&&!e.completed}}var Hz=require("@ehfuse/mui-datetime-picker");var Iz=require("react"),oi=require("@mui/material"),Bz=v(require("@mui/icons-material/InfoOutlined"),1),Oz=v(require("@mui/icons-material/LockOutlined"),1),Az=v(require("@mui/icons-material/PublicOutlined"),1),Ez=v(require("@mui/icons-material/Group"),1);_e();var pr=require("react/jsx-runtime"),PU=[{key:"all",icon:(0,pr.jsx)(Az.default,{sx:{fontSize:17,color:"#2f80ed"}}),label:"create.visibilityPublic",who:"create.visibilityInfoAll"},{key:"group",icon:(0,pr.jsx)(Ez.default,{sx:{fontSize:17,color:"#d9730d"}}),label:"create.visibilityDeptShort",who:"create.visibilityInfoGroup"},{key:"involved",icon:(0,pr.jsx)(Oz.default,{sx:{fontSize:17}}),label:"create.visibilityPrivate",who:"create.visibilityInfoPrivate"}];function am(){let[e,u]=(0,Iz.useState)(null),{colors:c}=xt(),l=String(Ba.labelColor??"#787774");return(0,pr.jsxs)(oi.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.25},children:[I("create.visibility"),(0,pr.jsx)(oi.IconButton,{size:"small","aria-label":I("create.visibilityInfo"),onClick:n=>{n.stopPropagation(),u(n.currentTarget)},sx:{p:.25,color:l},children:(0,pr.jsx)(Bz.default,{sx:{fontSize:16}})}),(0,pr.jsxs)(oi.Popover,{open:!!e,anchorEl:e,onClose:()=>u(null),onClick:n=>n.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:[(0,pr.jsxs)(oi.Box,{sx:{fontSize:14,lineHeight:1.6,mb:1.5,px:1.5,py:1.25,borderRadius:1.5,bgcolor:c.accentSoft,color:c.textSecondary,wordBreak:"keep-all"},children:[(0,pr.jsx)(oi.Box,{component:"strong",sx:{fontWeight:700,color:c.accentOnSurface},children:I("create.visibilityInfoNoteStrong")})," ",I("create.visibilityInfoNote")]}),(0,pr.jsx)(oi.Box,{sx:{border:`1px solid ${c.border}`,borderRadius:1.5,overflow:"hidden"},children:(0,pr.jsxs)(oi.Box,{component:"table",sx:{width:"100%",borderCollapse:"collapse",fontSize:14,"& th, & td":{border:`1px solid ${c.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:c.surfaceSubtle,color:c.textSecondary,fontWeight:600},"& tbody tr:last-child td":{borderBottom:"none"},"& td":{color:c.textPrimary,wordBreak:"keep-all",lineHeight:1.5}},children:[(0,pr.jsx)("thead",{children:(0,pr.jsxs)("tr",{children:[(0,pr.jsx)("th",{children:I("create.visibilityInfoColScope")}),(0,pr.jsx)("th",{children:I("create.visibilityInfoColWho")})]})}),(0,pr.jsx)("tbody",{children:PU.map(n=>(0,pr.jsxs)("tr",{children:[(0,pr.jsx)(oi.Box,{component:"td",sx:{whiteSpace:"nowrap"},children:(0,pr.jsxs)(oi.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[n.icon,I(n.label)]})}),(0,pr.jsx)("td",{children:I(n.who)})]},n.key))})]})})]})]})}_e();var Ve=require("react/jsx-runtime"),Wz="taskbox:create-expanded";function MU(){try{return window.localStorage.getItem(Wz)==="1"}catch{return!1}}function sm({form:e,statusOptions:u,customTabs:c,sprints:l=[],avatarSrcByName:n,isNotice:a=!1,hideProject:r=!1,hideBug:t=!1,hideTypeToggle:o=!1,leadingRow:d,afterProject:i,extraRows:s,hideLabel:h=!1,simple:f=!1,hideMembers:m=!1,templateItem:b=!1,postMode:g=!1,employees:w=[],workspaceName:S="",workspaceSlot:O,myAccountSeq:P=0,departments:j=[],myGroupSeq:M=0,onMemberEdit:N,onAddProject:z,onAddLabelOption:W,contentSyncKey:F="create",contentTemplates:C,contentTitleExtra:B,onSaveContentTemplate:R,onRemoveContentTemplate:p}){ue();let y=Yo(),x=js(),k=e.useFormValue("manager_name"),T=e.useFormValue("receiver_names"),_=e.useFormValue("start_date"),D=!!e.useFormValue("is_event"),H=!!e.useFormValue("is_bug"),V=e.useFormValue("bug_repro")??"",U=e.useFormValue("bug_device")??"",L=e.useFormValue("bug_where")??"",G=e.useFormValue("bug_version")??"",E=e.useFormValue("event_time")??"",A=e.useFormValue("event_place")??"",q=e.useFormValue("event_address")??"",$=e.useFormValue("due_date"),Q=e.useFormValue("reminders")??[],X=e.useFormValue("priority"),Y=e.useFormValue("content"),te=e.useFormValue("note")??"",K=e.useFormValue("checklist")??[],J=e.useFormValue("tab_key"),ee=e.useFormValue("sprint_seq")??0,ie=e.useFormValue("story_points")??0,ae=c.find(oe=>oe.key===J&&oe.useSprints),le=ae?l.filter(oe=>`custom-${oe.group_seq}`===J):[],[ce,ye]=(0,ys.useState)(null),ke=e.useFormValue("label_keys"),[xe,qe]=(0,ys.useState)(null),Be=e.useFormValue("visibility")||"involved",ge=Number(e.useFormValue("visibility_group_seq")??0),[ze,Le]=(0,ys.useState)(null),Oe=e.useFormValue("repeat_rule")||"",Ze=e.useFormValue("repeat_until")||"",[Re,Ie]=(0,ys.useState)(null),[kt,We]=(0,ys.useState)(null),st=e.useFormValue("target_names"),Xn=e.useFormValue("target_account_seqs"),lt=y.useValue("createAttachmentFiles")??[],Nt=a?Kc({author_account_seq:P,target_names:st,target_account_seqs:Xn},w):"",[Je,Qe]=(0,ys.useState)(MU),Fn=f&&!D&&!a&&!g,Ke=Fn&&!Je,ct=()=>{let oe=!Je;Qe(oe);try{window.localStorage.setItem(Wz,oe?"1":"0")}catch{}},pt=!g,pe=m?1:2;return(0,Ve.jsxs)(Ve.Fragment,{children:[d,!a&&!o?(0,Ve.jsxs)(Cn.Box,{sx:{display:"flex",gap:1.25,px:2,pt:1.5,pb:1.5,flexShrink:0},children:[O?(0,Ve.jsx)(Cn.Box,{sx:{alignSelf:"center",mr:"6px",minWidth:0,display:"flex"},children:O}):S?(0,Ve.jsx)(Cn.Box,{sx:{alignSelf:"center",fontSize:13.5,fontWeight:600,color:"#37352f",mr:"6px",maxWidth:160,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:S,children:S}):null,[{value:"task",label:I("kind.task")},{value:"event",label:I("kind.event")},...t?[]:[{value:"bug",label:I("kind.bug")}]].map(oe=>{let Pe=(H?"bug":D?"event":"task")===oe.value;return(0,Ve.jsx)(Cn.ButtonBase,{onClick:()=>Vu(e,oe.value),sx:{px:1.75,lineHeight:1,pt:"8px",pb:"10px",borderRadius:99,fontSize:13.5,fontWeight:Pe?600:400,color:Pe?"#ffffff":"#787774",bgcolor:Pe?"#2563eb":"#f4f4f2"},children:oe.label},oe.label)})]}):null,(0,Ve.jsx)(Cn.Divider,{sx:{borderColor:De.NOTION_LINE_COLOR}}),(0,Ve.jsxs)(Cn.Box,{sx:{pt:1.5,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[(0,Ve.jsx)(zc,{afterProject:i,hideProject:r||Ke&&!J,hideManager:m||g||Ke&&!k,hideReceivers:b||m||g&&Be==="all"||Ke&&T.length===0,hideStartDate:Ke||g,hideReminder:b||g||Ke&&Q.length===0,hidePriority:g,hideDueDate:g||!D&&!!Oe,values:{tabKey:J,managerName:k,receiverNames:T,startDate:_,dueDate:$,reminders:Q,priority:X,eventTime:E,eventPlace:A,eventAddress:q},customTabs:c,avatarSrcByName:n,notice:a,event:D,onChangeEventTime:oe=>e.setFormValue("event_time",oe),onChangeEventPlace:oe=>e.setFormValue("event_place",oe),onChangeEventAddress:oe=>e.setFormValue("event_address",oe),targetSummary:Nt,onChangeProject:oe=>e.setFormValue("tab_key",oe),onAddProject:z,onChangeStartDate:oe=>e.setFormValue("start_date",oe),onClearStartDate:()=>e.setFormValue("start_date",""),onChangeDueDate:oe=>e.setFormValue("due_date",oe),onChangeReminder:oe=>e.setFormValue("reminders",oe),onChangePriority:oe=>e.setFormValue("priority",oe),onMemberEdit:N,pinColumns:pt,beforeStart:(0,Ve.jsxs)(Ve.Fragment,{children:[!b&&!H&&!g&&!(Ke&&!Oe)?(0,Ve.jsx)(Ot,{icon:(0,Ve.jsx)(zz.default,{sx:{fontSize:17,...Oe?{color:"#2f80ed"}:{}}}),label:I("create.repeat"),onClick:oe=>Ie(oe),sx:D||!pt?void 0:Ln(pe),children:Oe?Jl(Oe):(0,Ve.jsx)(Cn.Box,{component:"span",sx:{color:"#9a9a97"},children:I("common.none")})}):null,!b&&!H&&!g&&Oe?(0,Ve.jsx)(Ot,{icon:(0,Ve.jsx)(Fz.default,{sx:{fontSize:17}}),label:I("create.repeatUntil"),onClick:oe=>We(oe),sx:D||!pt?void 0:Ln(pe),children:Ze?Ao(Ze):(0,Ve.jsx)(Cn.Box,{component:"span",sx:{color:"#9a9a97"},children:I("create.auto")})}):null]}),trailing:(0,Ve.jsxs)(Ve.Fragment,{children:[!a&&!m&&!(Ke&&Be==="involved")?(0,Ve.jsx)(Ot,{icon:Be==="all"?(0,Ve.jsx)(tp.default,{sx:{fontSize:17,color:"#2f80ed"}}):Be==="group"?(0,Ve.jsx)(np.default,{sx:{fontSize:17,color:"#d9730d"}}):(0,Ve.jsx)(ep.default,{sx:{fontSize:17}}),label:(0,Ve.jsx)(am,{}),onClick:oe=>Le(oe),sx:D||!pt?void 0:Ln(1),children:Be==="all"?I("create.visibilityPublic"):Be==="group"?I("create.visibilityDept",{value:j.find(oe=>oe.seq===ge)?.name??I("create.department")}):I("create.visibilityPrivate")}):null,ae&&!D&&!a&&!g&&!(Ke&&ee===0&&ie===0)?(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(Ot,{icon:(0,Ve.jsx)(Lz.default,{sx:{fontSize:17}}),label:I("col.goal"),onClick:oe=>ye(oe),sx:pt?Ln(1):void 0,children:ee>0?le.find(oe=>oe.seq===ee)?.name??I("create.deletedGoal"):(0,Ve.jsx)(Cn.Box,{component:"span",sx:{color:"#9a9a97"},children:I("board.unassigned")})}),(0,Ve.jsx)(Ot,{icon:(0,Ve.jsx)(jz.default,{sx:{fontSize:17}}),label:"\uD3EC\uC778\uD2B8",sx:pt?Ln(1):void 0,children:(0,Ve.jsx)(Bi,{value:ie>0?String(ie):"",placeholder:I("create.notEstimated"),onCommit:oe=>e.setFormValue("story_points",Number(oe.replace(/[^0-9.]/g,""))||0)})})]}):null,H?(0,Ve.jsx)(Fc,{values:{repro:V,device:U,where:L,version:G},onChangeRepro:oe=>e.setFormValue("bug_repro",oe),onChangeDevice:oe=>e.setFormValue("bug_device",oe),onChangeWhere:oe=>e.setFormValue("bug_where",oe),onChangeVersion:oe=>e.setFormValue("bug_version",oe)}):null,!b&&!g&&!a?(s??[]).filter(oe=>!(Ke&&!oe.filled)).map(oe=>(0,Ve.jsx)(Ot,{icon:oe.icon,label:oe.label,onClick:oe.onClick,sx:D||!pt?void 0:Ln(pe),children:oe.value},oe.key)):null]}),leading:D||h?null:(0,Ve.jsx)(Cn.Box,{sx:{gridColumn:"1 / -1"},children:(0,Ve.jsx)(Ot,{icon:(0,Ve.jsx)(Nz.default,{sx:{fontSize:17}}),label:I("dialog.label"),onClick:oe=>qe(oe),children:(ke??[]).length>0?(0,Ve.jsx)(Yi,{labelKeys:ke??[],labelOptions:u}):(0,Ve.jsx)(Cn.Box,{component:"span",sx:{color:"#9a9a97"},children:I("menu.empty")})})})}),Fn?(0,Ve.jsxs)(Cn.ButtonBase,{onClick:ct,"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?(0,Ve.jsx)(Pz.default,{sx:{fontSize:17}}):(0,Ve.jsx)(Mz.default,{sx:{fontSize:17}}),Je?I("create.collapseFields"):I("create.expandFields")]}):null,(0,Ve.jsx)(Cn.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,Ve.jsx)(ko,{icon:(0,Ve.jsx)(Rz.default,{sx:{fontSize:18,display:"block"}}),title:I("common.content"),titleExtra:B||C?(0,Ve.jsxs)(Ve.Fragment,{children:[B,C?(0,Ve.jsx)(qc,{content:Y,templates:C,onApply:oe=>e.setFormValue("content",oe),onSave:R,onRemove:p}):null]}):void 0,children:(0,Ve.jsx)(jc,{syncKey:F,value:Y,onChange:oe=>e.setFormValue("content",oe)})}),H||g||Ke&&!te?null:(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(Cn.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,Ve.jsx)(ko,{icon:(0,Ve.jsx)(Dz.default,{sx:{fontSize:18,display:"block"}}),title:I("col.note"),children:(0,Ve.jsx)(qz.TextField,{form:e,name:"note",placeholder:I("create.notePlaceholder"),fullWidth:!0,size:"medium",sx:{mt:1}})})]}),D||g||Ke&&K.length===0?null:(0,Ve.jsx)(Cn.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),D||g||Ke&&K.length===0?null:(0,Ve.jsx)(Vc,{taskSeq:0,checklist:K,onAdd:(oe,Ge)=>Ku(e,Ge),onToggle:(oe,Ge,Pe)=>Xu(e,Ge,Pe),onRemove:(oe,Ge)=>Yu(e,Ge),onUpdate:(oe,Ge,Pe)=>Zu(e,Ge,Pe)}),b?null:(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(Cn.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,Ve.jsx)(Uc,{taskSeq:0,attachments:lt.map(oe=>({name:oe.name,size:oe.size})),onAdd:(oe,Ge)=>Qu(y,Ge,x),onRemove:(oe,Ge)=>Ju(y,Ge)})]})]}),(0,Ve.jsx)(Cn.Menu,{transitionDuration:0,anchorEl:ce,open:!!ce,onClose:()=>ye(null),children:[{seq:0,label:I("board.unassigned")},...le.map(oe=>({seq:oe.seq,label:Wo(oe)}))].map(oe=>(0,Ve.jsx)(Cn.MenuItem,{onClick:()=>{e.setFormValue("sprint_seq",oe.seq),ye(null)},sx:{fontSize:14,minWidth:170},children:oe.label},oe.seq))}),(0,Ve.jsx)(Cn.Menu,{transitionDuration:0,anchorEl:Re,open:!!Re,onClose:()=>Ie(null),children:[{value:"",label:I("common.none")},...Vs].map(oe=>(0,Ve.jsx)(Cn.MenuItem,{selected:Oe===oe.value,onClick:()=>{Ie(null),Gu(e,oe.value)},sx:{fontSize:14,minWidth:140},children:oe.label},oe.value||"none"))}),(0,Ve.jsx)(Hz.DatePicker,{anchorEl:kt,open:!!kt,onClose:()=>We(null),selectedDate:Ze?new Date(`${Ze}T00:00:00`):new Date,onDateChange:oe=>{Uu(e,oe),We(null)}}),(0,Ve.jsx)(Cn.Menu,{transitionDuration:0,anchorEl:ze,open:!!ze,onClose:()=>Le(null),children:[{key:"involved",label:I("create.visibilityPrivate"),tip:I("create.privateTip"),icon:(0,Ve.jsx)(ep.default,{sx:{fontSize:17,color:"#57564f"}}),selected:Be==="involved",onPick:()=>Gs(e,"involved")},{key:"all",label:I("create.visibilityPublic"),tip:I("create.publicTip"),icon:(0,Ve.jsx)(tp.default,{sx:{fontSize:17,color:"#2f80ed"}}),selected:Be==="all",onPick:()=>Gs(e,"all")},...[...j].sort((oe,Ge)=>oe.seq===M?-1:Ge.seq===M?1:0).map(oe=>({key:`group-${oe.seq}`,label:I("create.visibilityDeptName",{name:oe.name}),tip:I("create.deptTip",{name:oe.name}),icon:(0,Ve.jsx)(np.default,{sx:{fontSize:17,color:"#d9730d"}}),selected:Be==="group"&&ge===oe.seq,onPick:()=>Gs(e,"group",oe.seq)}))].map(oe=>(0,Ve.jsx)(Cn.Tooltip,{title:oe.tip,arrow:!0,disableInteractive:!0,placement:"right",children:(0,Ve.jsxs)(Cn.MenuItem,{selected:oe.selected,onClick:()=>{oe.onPick(),g&&oe.key==="all"&&(e.setFormValue("receiver_names",[]),e.setFormValue("receiver_account_seqs",[])),Le(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[oe.icon,oe.label]})},oe.key))}),(0,Ve.jsx)($c,{anchorEl:xe,selectedKeys:ke??[],labelOptions:u,onToggle:oe=>e.setFormValue("label_keys",cc(ke??[],oe)),onAddLabel:(oe,Ge)=>W?.(oe,Ge),onClose:()=>qe(null)})]})}_e();var un=require("react/jsx-runtime"),RU={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 rp({open:e,onClose:u,desktopPresentation:c="drawer",submitLabel:l,...n}){ue();let{form:a,presetTitle:r="",presetContent:t="",presetVisibility:o,presetVisibilityGroupSeq:d=0,presetDueDate:i="",presetTabKey:s="",presetManager:h=null,isNotice:f=!1,defaultBug:m=!1}=n,b=Yo(),g=(0,vs.useRef)(!1),[w,S]=(0,vs.useState)(0),O=a.useFormValue("title"),P=a.useFormValue("icon"),j=a.useFormValue("icon_color"),M=!!a.useFormValue("is_event"),N=!!a.useFormValue("is_bug"),z=Sn(),F=b.useValue("createSubmitting")??!1,C=f||M?tn(P||(f?tr:kr)):null,B=f?I("create.titleNotice"):M?I("create.titleEvent"):N?I("task.createBug"):I("task.createTask"),R=f?I("create.noticeTitlePlaceholder"):M?I("create.eventTitlePlaceholder"):N?I("create.bugTitlePlaceholder"):I("create.taskTitlePlaceholder");(0,vs.useEffect)(()=>{let T=g.current;g.current=e,!(!e||T)&&(Wu(a,b,{presetTitle:r,presetContent:t,presetVisibility:o,presetVisibilityGroupSeq:d,presetDueDate:i,presetTabKey:s,presetManager:h,isNotice:f,defaultBug:m}),S(_=>_+1))},[e]);let[p,y]=(0,vs.useState)(null),x=T=>C?M?(0,un.jsx)(Gn.Tooltip,{title:I("col.changeIcon"),arrow:!0,enterDelay:400,disableInteractive:!0,children:(0,un.jsx)(Gn.ButtonBase,{onClick:_=>y(_.currentTarget),sx:{display:"flex",p:.5,borderRadius:1,color:j||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:(0,un.jsx)(C,{sx:{fontSize:20}})})}):(0,un.jsx)(Gn.Box,{sx:[{display:"flex",color:j||"#1e3a8a"},T],children:(0,un.jsx)(C,{sx:{fontSize:20}})}):null,k=(0,un.jsxs)(Gn.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:2,pt:2,pb:1},children:[x({p:0}),(0,un.jsx)(Gn.Box,{component:"input",autoFocus:!0,spellCheck:!1,value:O,placeholder:R,onChange:T=>a.setFormValue("title",T.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 z||c==="dialog"?(0,un.jsx)(un.Fragment,{children:(0,un.jsx)(Uz.FormDialog,{open:e,onClose:u,backdropClick:!1,locale:Pt(),fontScale:z?{enabled:!0,default:1.1,min:.6}:{enabled:!0},title:B,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fullScreen:z,mobilePresentation:z?"slide":"dialog",maxWidth:"md",actions:{showCancelButton:!0,right:(0,un.jsx)(Gn.Button,{variant:"contained",disableElevation:!0,disabled:F,onClick:F?void 0:a.submit,children:F?I("create.saving"):l??I("create.saveButton")})},dialogActionSx:z?RU: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:(0,un.jsx)(Gn.Box,{sx:{width:"100%",minWidth:0,display:"flex",flexDirection:"column",gap:0},children:(0,un.jsx)(sm,{...n,contentSyncKey:`create-${w}`,leadingRow:k})})}]})}):(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)(Gn.Drawer,{anchor:"right",open:e,onClose:(T,_)=>{_!=="backdropClick"&&u()},"aria-label":I("create.newTaskAria"),sx:{zIndex:T=>T.zIndex.modal},slotProps:{paper:{sx:{width:720,maxWidth:"100vw"}}},children:(0,un.jsxs)(Gn.Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,un.jsxs)(Gn.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1.5,flexShrink:0},children:[x({px:.5}),(0,un.jsx)(Gn.Box,{component:"input",autoFocus:!0,spellCheck:!1,value:O,placeholder:R,onChange:T=>a.setFormValue("title",T.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}}}),(0,un.jsx)(Gn.IconButton,{"aria-label":I("common.close"),onClick:u,sx:{color:"#6b7280"},children:(0,un.jsx)(Vz.default,{})})]}),(0,un.jsx)(Gn.Divider,{sx:{borderColor:De.NOTION_LINE_COLOR}}),(0,un.jsx)(Gn.Box,{sx:{flex:1,minHeight:0},children:(0,un.jsx)(Gz.default,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:(0,un.jsx)(sm,{...n,contentSyncKey:`create-${w}`})})}),(0,un.jsx)(Gn.Divider,{sx:{borderColor:De.NOTION_LINE_COLOR}}),(0,un.jsxs)(Gn.Box,{sx:{display:"flex",justifyContent:"flex-end",gap:.5,px:2,py:1.5,flexShrink:0},children:[(0,un.jsx)(Gn.Button,{onClick:u,color:"inherit",disabled:F,children:I("common.cancel")}),(0,un.jsx)(Gn.Button,{onClick:a.submit,variant:"contained",disabled:F,children:F?I("create.creating"):l??I("common.register")})]})]})}),(0,un.jsx)(Ji,{anchorEl:p,value:P,color:j,onSelect:T=>{a.setFormValue("icon",T),y(null)},onSelectColor:T=>a.setFormValue("icon_color",T),onClose:()=>y(null)})]})}pn();var ca=require("react"),An=require("@mui/material"),mj=v(require("@mui/icons-material/MoreVert"),1),hj=v(require("@mui/icons-material/DeleteOutline"),1),fj=v(require("@mui/icons-material/ShareOutlined"),1),pj=v(require("@mui/icons-material/HistoryOutlined"),1),gj=v(require("@ehfuse/overlay-scrollbar"),1),bj=require("@ehfuse/mui-form-dialog");pn();var wo=require("react"),$e=require("@mui/material"),oF=v(require("@mui/icons-material/ArrowUpwardRounded"),1),iF=require("@ehfuse/mui-form-controls"),Qc=v(require("@mui/icons-material/Close"),1),aF=v(require("@mui/icons-material/EditOutlined"),1),sp=v(require("@mui/icons-material/ContentCopyOutlined"),1),lp=v(require("@mui/icons-material/Check"),1),sF=v(require("@mui/icons-material/Favorite"),1),lF=v(require("@mui/icons-material/FavoriteBorderOutlined"),1),cF=v(require("@mui/icons-material/CheckCircle"),1),uF=v(require("@mui/icons-material/CheckCircleOutlineOutlined"),1),ws=v(require("@mui/icons-material/AttachFileOutlined"),1),dF=v(require("@mui/icons-material/AddCircleOutline"),1),mF=v(require("@mui/icons-material/ImageOutlined"),1);var op=e=>{if(e===0)return"0 Bytes";let u=1024,c=["Bytes","KB","MB","GB","TB"],l=Math.floor(Math.log(e)/Math.log(u));return parseFloat((e/Math.pow(u,l)).toFixed(2))+" "+c[l]};var so=require("react"),sa=require("@mui/material");_e();var Pi=require("react/jsx-runtime"),$z=8,Kz=[{key:"\uC88B\uC544\uC694",get label(){return I("emoji.like")},insert:"\u{1F44D}",keywords:["like","\uC5C4\uC9C0","\uAD7F"]},{key:"\uD655\uC778",get label(){return I("emoji.check")},insert:"\u2705",keywords:["check","\uC644\uB8CC","\uCCB4\uD06C"]},{key:"\uAC10\uC0AC",get label(){return I("emoji.thanks")},insert:"\u{1F64F}",keywords:["thanks","\uACE0\uB9C8\uC6CC","\uBD80\uD0C1"]},{key:"\uCD95\uD558",get label(){return I("emoji.party")},insert:"\u{1F389}",keywords:["party","\uD30C\uD2F0","\uC9DD\uC9DD"]},{key:"\uBC15\uC218",get label(){return I("emoji.clap")},insert:"\u{1F44F}",keywords:["clap","\uC798\uD588\uC5B4"]},{key:"\uD558\uD2B8",get label(){return I("emoji.heart")},insert:"\u2764\uFE0F",keywords:["heart","\uC0AC\uB791"]},{key:"\uC6C3\uC74C",get label(){return I("emoji.laugh")},insert:"\u{1F604}",keywords:["smile","\uC6C3\uAE40","\u314B\u314B"]},{key:"\uBBF8\uC18C",get label(){return I("emoji.smile")},insert:"\u{1F642}",keywords:["smile","\uC88B\uC74C"]},{key:"\uB208\uBB3C",get label(){return I("emoji.tears")},insert:"\u{1F622}",keywords:["sad","\uC2AC\uD514","\u3160\u3160"]},{key:"\uB180\uB78C",get label(){return I("emoji.wow")},insert:"\u{1F62E}",keywords:["wow","\uD5C9"]},{key:"\uACE0\uBBFC",get label(){return I("emoji.think")},insert:"\u{1F914}",keywords:["think","\uC0DD\uAC01","\uC74C"]},{key:"\uC624\uCF00\uC774",get label(){return I("emoji.ok")},insert:"\u{1F44C}",keywords:["ok","\uC54C\uACA0\uC5B4"]},{key:"\uBD88",get label(){return I("emoji.fire")},insert:"\u{1F525}",keywords:["fire","\uAE09\uD568","\uB300\uBC15"]},{key:"\uC544\uC774\uB514\uC5B4",get label(){return I("emoji.idea")},insert:"\u{1F4A1}",keywords:["idea","\uC804\uAD6C"]},{key:"\uACBD\uACE0",get label(){return I("emoji.warning")},insert:"\u26A0\uFE0F",keywords:["warning","\uC8FC\uC758"]},{key:"\uC9C8\uBB38",get label(){return I("emoji.question")},insert:"\u2753",keywords:["question","\uBB3C\uC74C"]},{key:"\uC2DC\uACC4",get label(){return I("emoji.clock")},insert:"\u23F0",keywords:["time","\uC2DC\uAC04","\uC54C\uB78C"]},{key:"\uB2EC\uB825",get label(){return I("emoji.calendar")},insert:"\u{1F4C5}",keywords:["calendar","\uC77C\uC815","\uB0A0\uC9DC"]},{key:"\uBA54\uBAA8",get label(){return I("emoji.note")},insert:"\u{1F4DD}",keywords:["note","\uAE30\uB85D"]},{key:"\uCCA8\uBD80",get label(){return I("emoji.attach")},insert:"\u{1F4CE}",keywords:["attach","\uD074\uB9BD","\uD30C\uC77C"]},{key:"\uB9C1\uD06C",get label(){return I("emoji.link")},insert:"\u{1F517}",keywords:["link","\uC8FC\uC18C"]},{key:"\uB85C\uCF13",get label(){return I("emoji.rocket")},insert:"\u{1F680}",keywords:["rocket","\uCD9C\uBC1C","\uBC30\uD3EC"]},{key:"\uBCC4",get label(){return I("emoji.star")},insert:"\u2B50",keywords:["star","\uC911\uC694"]},{key:"\uC5D1\uC2A4",get label(){return I("emoji.x")},insert:"\u274C",keywords:["x","\uC548\uB428","\uCDE8\uC18C"]}];function bl(e,u,c){let l=e.slice(0,u),a=(c==="@"?/(^|[\s(])@([^\s@]{0,20})$/:/(^|[\s(])\/([^\s/]{0,20})$/).exec(l);return a?{start:u-a[2].length-1,query:a[2]}:null}function lm(e,u){let c=it(),l=e??c.mentionCandidates??[],n=u??c.slashCommands,a=n===!0?Kz:Array.isArray(n)?n:[];return{people:l,commands:a,enabled:l.length>0||a.length>0}}function cm(e,u,c){if(!c)return[];let l=c.query.toLowerCase();return c.trigger==="@"?e.filter(n=>n.name.toLowerCase().includes(l)).slice(0,$z).map((n,a)=>({id:`p${a}-${n.name}`,text:`@${n.name} `,label:n.name,subtitle:n.subtitle,icon:(0,Pi.jsx)(eo,{src:n.avatar??"",name:n.name,avatarSx:{width:24,height:24,fontSize:14},iconFontSize:16})})):u.filter(n=>[n.key,n.label,...n.keywords??[]].some(a=>a.toLowerCase().includes(l))).slice(0,$z).map(n=>({id:`c-${n.key}`,text:n.insert,label:`/${n.label}`,icon:(0,Pi.jsx)(sa.Box,{component:"span",sx:{width:24,textAlign:"center",fontSize:18,lineHeight:1},children:n.insert})}))}function um({open:e,anchor:u,items:c,active:l,onPick:n,onHover:a}){return(0,Pi.jsx)(sa.Popper,{open:e,anchorEl:u,placement:"top-start",sx:{zIndex:1500},children:(0,Pi.jsx)(sa.Paper,{elevation:4,sx:{minWidth:220,maxWidth:320,py:.5,borderRadius:1.5},children:c.map((r,t)=>(0,Pi.jsxs)(sa.Box,{role:"option","aria-selected":t===l,onMouseDown:o=>o.preventDefault(),onClick:()=>n(r),onMouseEnter:()=>a(t),sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:.75,cursor:"pointer",fontSize:14,bgcolor:t===l?"action.selected":"transparent"},children:[r.icon,(0,Pi.jsx)(sa.Box,{component:"span",sx:{fontWeight:500,whiteSpace:"nowrap"},children:r.label}),r.subtitle?(0,Pi.jsx)(sa.Box,{component:"span",sx:{color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r.subtitle}):null]},r.id))})})}function ip({value:e,setValue:u,candidates:c,slashCommands:l}){let{people:n,commands:a,enabled:r}=lm(c,l),t=(0,so.useRef)(null),[o,d]=(0,so.useState)(null),[i,s]=(0,so.useState)(null),[h,f]=(0,so.useState)(0),m=(0,so.useMemo)(()=>cm(n,a,i),[a,n,i]),b=!!(o&&i&&m.length>0),g=(0,so.useCallback)(()=>{let M=t.current;if(!r||!M)return;let N=M.selectionStart??M.value.length,z=n.length>0?bl(M.value,N,"@"):null,W=!z&&a.length>0?bl(M.value,N,"/"):null,F=z?{...z,trigger:"@"}:W?{...W,trigger:"/"}:null;s(F),f(0),d(F?M.closest(".MuiInputBase-root")??M:null)},[a.length,r,n.length]),w=(0,so.useRef)(null);(0,so.useEffect)(()=>{let M=t.current,N=w.current;if(N!==null&&M){w.current=null,M.setSelectionRange(N,N);return}document.activeElement===M&&g()},[e,g]);let S=(0,so.useCallback)(M=>{let N=t.current;if(!i||!N)return;let z=N.selectionStart??e.length,W=e.slice(0,i.start)+M.text+e.slice(z),F=i.start+M.text.length;w.current=W===e?null:F,u(W),s(null),d(null),requestAnimationFrame(()=>{w.current=null,N.focus(),N.setSelectionRange(F,F)})},[i,u,e]),O=(0,so.useCallback)(M=>!b||M.nativeEvent.isComposing?!1:M.key==="ArrowDown"||M.key==="ArrowUp"?(M.preventDefault(),f(N=>(N+(M.key==="ArrowDown"?1:m.length-1))%m.length),!0):M.key==="Enter"||M.key==="Tab"?(M.preventDefault(),S(m[Math.min(h,m.length-1)]),!0):M.key==="Escape"?(M.preventDefault(),M.stopPropagation(),s(null),d(null),!0):!1,[h,m,b,S]);return{inputRef:(0,so.useCallback)(M=>{t.current=M},[]),onKeyDown:O,onSelectionChange:g,popper:r?(0,Pi.jsx)(um,{open:b,anchor:o,items:m,active:h,onPick:S,onHover:f}):null}}pn();var ii=require("react"),Mi=require("@mui/material");_e();var la=require("react/jsx-runtime"),Xz=[{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}"]}],DU="'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif",Yz="taskbox.recentEmojis",Zz=24;function Qz(){try{let e=JSON.parse(window.localStorage.getItem(Yz)??"[]");return Array.isArray(e)?e.filter(u=>typeof u=="string").slice(0,Zz):[]}catch{return[]}}function NU(e){let u=[e,...Qz().filter(c=>c!==e)].slice(0,Zz);try{window.localStorage.setItem(Yz,JSON.stringify(u))}catch{}return u}function Jz({onPick:e}){let[u,c]=(0,ii.useState)(()=>Qz()),[l,n]=(0,ii.useState)(0),a=(0,ii.useRef)(null),r=(0,ii.useRef)(!1),t=u.length>0?[{key:"recent",labelKey:"section.emojiFrequent",items:u},...Xz]:Xz,o=Math.min(l,t.length-1),d=(0,ii.useCallback)(h=>{c(NU(h)),e(h)},[e]),i=(0,ii.useCallback)(h=>{n(h);let f=a.current;f&&(r.current=!0,f.scrollTo({left:f.clientWidth*h,behavior:"smooth"}),window.setTimeout(()=>{r.current=!1},350))},[]),s=(0,ii.useCallback)(()=>{let h=a.current;if(!h||r.current||h.clientWidth===0)return;let f=Math.round(h.scrollLeft/h.clientWidth);n(m=>f!==m&&f>=0?f:m)},[]);return(0,ii.useEffect)(()=>{let h=a.current;h&&(h.scrollLeft=h.clientWidth*o)},[]),(0,la.jsxs)(Mi.Box,{children:[(0,la.jsx)(Mi.Tabs,{value:o,onChange:(h,f)=>i(f),variant:"scrollable",scrollButtons:!1,sx:{minHeight:36,borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,"& .MuiTab-root":{minHeight:36,minWidth:0,px:1.5,fontSize:13}},children:t.map(h=>(0,la.jsx)(Mi.Tab,{label:I(h.labelKey)},h.key))}),(0,la.jsx)(Mi.Box,{ref:a,onScroll:s,sx:{display:"flex",height:352,overflowX:"auto",overflowY:"hidden",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},children:t.map(h=>(0,la.jsx)(Mi.Box,{sx:{flex:"0 0 100%",width:"100%",height:"100%",overflowY:"auto",scrollSnapAlign:"start",scrollSnapStop:"always",p:1},children:(0,la.jsx)(Mi.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(40px, 1fr))"},children:h.items.map((f,m)=>(0,la.jsx)(Mi.Box,{component:"button",type:"button",onClick:()=>d(f),"aria-label":f,sx:{border:0,bgcolor:"transparent",color:"#000",cursor:"pointer",fontFamily:DU,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}-${m}`))})},h.key))})]})}pn();var xo=require("react"),mm=require("@mui/material"),nF=require("@ehfuse/editor");_e();var ai=require("react");var tF=require("react/jsx-runtime");function eF(e,u){let{people:c,commands:l,enabled:n}=lm(e,u),[a,r]=(0,ai.useState)(null),[t,o]=(0,ai.useState)(null),d=(0,ai.useRef)(""),[i,s]=(0,ai.useState)(0),h=(0,ai.useMemo)(()=>cm(c,l,a),[l,c,a]),f=!!(n&&t&&a&&h.length>0),m=(0,ai.useCallback)(()=>{if(!n)return;let S=window.getSelection();if(!S||S.rangeCount===0||!S.isCollapsed)return void r(null);let O=S.anchorNode;if(!O||O.nodeType!==Node.TEXT_NODE||!O.parentElement?.closest(".ehfuse-editor-content"))return void r(null);let P=O.data,j=S.anchorOffset,M=c.length>0?bl(P,j,"@"):null,N=!M&&l.length>0?bl(P,j,"/"):null,z=M?{...M,trigger:"@"}:N?{...N,trigger:"/"}:null;if(!z){d.current="",r(null),o(null);return}r({node:O,start:z.start,end:j,query:z.query,trigger:z.trigger});let W=`${z.trigger}${z.query}`;W!==d.current&&s(0),d.current=W;let F=document.createRange();F.setStart(O,z.start),F.setEnd(O,Math.min(z.start+1,P.length));let C=F.getBoundingClientRect();o({getBoundingClientRect:()=>C})},[l.length,n,c.length]),b=(0,ai.useCallback)(S=>{if(!a)return;let{node:O,start:P,end:j}=a;if(!O.isConnected)return void r(null);let M=window.getSelection(),N=document.createRange();N.setStart(O,P),N.setEnd(O,Math.min(j,O.data.length)),M?.removeAllRanges(),M?.addRange(N),document.execCommand("insertText",!1,S.text),r(null),o(null)},[a]);return{handlers:{onKeyDownCapture:(0,ai.useCallback)(S=>{!f||S.nativeEvent.isComposing||(S.key==="ArrowDown"||S.key==="ArrowUp"?(S.preventDefault(),S.stopPropagation(),s(O=>(O+(S.key==="ArrowDown"?1:h.length-1))%h.length)):S.key==="Enter"||S.key==="Tab"?(S.preventDefault(),S.stopPropagation(),b(h[Math.min(i,h.length-1)])):S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),r(null),o(null)))},[i,h,f,b]),onKeyUp:m,onMouseUp:m,onInput:m},popper:n?(0,tF.jsx)(um,{open:f,anchor:t,items:h,active:i,onPick:b,onHover:s}):null,isOpen:f}}function ks(e){return/^\s*<(p|div|ul|ol|h[1-6]|blockquote|pre)[\s>]/i.test(e)}var LU=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"]),zU=new Set(["background-color","color","text-decoration"]);function Xc(e){if(typeof DOMParser>"u")return"";let c=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html").body.firstElementChild;if(!c)return"";let l=n=>{for(let a of Array.from(n.children)){if(!LU.has(a.tagName)){if(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE"].includes(a.tagName)){a.remove();continue}l(a),a.replaceWith(...Array.from(a.childNodes));continue}for(let r of Array.from(a.attributes)){let t=r.name.toLowerCase();if(a.tagName==="A"&&t==="href"){/^(https?:|mailto:|tel:)/i.test(r.value.trim())||a.removeAttribute(r.name);continue}if(t==="style"){let o=r.value.split(";").map(d=>d.trim()).filter(d=>zU.has(d.split(":")[0]?.trim().toLowerCase()??"")&&!/url\(|expression/i.test(d)).join("; ");o?a.setAttribute("style",o):a.removeAttribute("style");continue}a.removeAttribute(r.name)}l(a)}};return l(c),c.innerHTML}function yl(e){if(typeof DOMParser>"u")return e.replace(/<[^>]*>/g,"");let u=e.replace(/<br\s*\/?>/gi,`
|
|
73
|
+
`).trim()}var SU={...bs.minimalToolbarOptions,left:(bs.minimalToolbarOptions.left??[]).map(e=>e.filter(u=>u!=="undo"&&u!=="redo")).filter(e=>e.length>0).flatMap(e=>e.includes("indent")?[["bulletList","numberList"],e]:[e])};function jc({syncKey:e,value:u,onChange:c,readOnly:l=!1,viewFirst:n=!1,onTranslate:a,minHeight:r=180,editing:t,onEditingChange:o}){ue();let{uploadContentImage:d,openExternalUrl:i,openContentImage:s}=it(),h=T=>{i?i(T):window.open(T,"_blank","noopener,noreferrer")},[f,m]=(0,io.useState)(()=>!n||!Ea(u).trim()),b=t!==void 0,g=b?t:f,w=(0,io.useRef)(o);w.current=o;let S=T=>{b||m(T),w.current?.(T)};(0,io.useEffect)(()=>{n&&S(!Ea(u).trim())},[e,n]);let O=(0,io.useRef)(null),P=(0,io.useRef)(new bs.ImageResizePlugin),j=(0,io.useRef)(null),M=(0,io.useRef)(Date.now()+800),N=Sn(),z=(0,hr.useTheme)(),W=(0,hr.useMediaQuery)(z.breakpoints.down("sm")),[F,C]=(0,io.useState)(!1),B=()=>{let T=Ea(u);T&&navigator.clipboard.writeText(T).then(()=>{C(!0),window.setTimeout(()=>C(!1),1500)})},R=(T,_=!1)=>T instanceof Element?T.closest(_?".taskbox-content-readview a[href]":".ehfuse-editor-content a[href]"):null,p=T=>N||T.ctrlKey||T.metaKey;(0,io.useEffect)(()=>{if(l)return;let T=Vf(u);j.current===T||j.current===u||(j.current=T,M.current=Date.now()+800,O.current?.setHtml(T))},[e,u,l]);let y=Vf(u),x=(0,io.useRef)(null),k=(0,io.useRef)({el:null,html:""});return(0,io.useLayoutEffect)(()=>{let T=x.current;T&&(k.current.el===T&&k.current.html===y||(T.innerHTML=y,zL(T),k.current={el:T,html:y}))}),l||!g?(0,rr.jsxs)(hr.Box,{sx:{position:"relative",mt:1},children:[(0,rr.jsx)(hr.Box,{onClickCapture:T=>{let _=T.target;if(_?.tagName==="IMG"&&_.src){T.preventDefault(),T.stopPropagation();let H=Array.from(T.currentTarget.querySelectorAll("img")).filter(L=>L.src),V=H.map((L,G)=>({src:L.src,name:L.alt||decodeURIComponent(L.src.split("/").pop()||"")||`image-${G+1}`})),U=Math.max(0,H.indexOf(_));s?s(V,U):h(V[U].src);return}let D=R(T.target,!0);D&&(T.preventDefault(),T.stopPropagation(),h(D.href))},ref:x,className:"taskbox-content-readview","data-drag-scroll":"off",sx:{border:"1px solid #e0e0e0",borderRadius:1,p:"12px",pr:W?"12px":"52px",pb:"28px",minHeight:r,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},...Zd}}),W?(0,rr.jsxs)(hr.Box,{sx:{display:"flex",gap:1,mt:1},children:[(0,rr.jsx)(hr.Button,{variant:"outlined",color:"inherit",startIcon:(0,rr.jsx)(jL.default,{sx:{fontSize:18}}),onClick:B,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:F?I("section.copied"):I("common.copy")}),l?null:(0,rr.jsx)(hr.Button,{variant:"outlined",color:"inherit",startIcon:(0,rr.jsx)(Gf.default,{sx:{fontSize:18}}),onClick:()=>S(!0),sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:I("common.edit")}),a?(0,rr.jsx)(hr.Button,{variant:"outlined",color:"inherit",startIcon:(0,rr.jsx)(Uf.default,{sx:{fontSize:18}}),onClick:a,sx:{flex:1,fontSize:15,color:"#37352f",borderColor:"#d9d9d6"},children:I("section.translate")}):null]}):(0,rr.jsxs)(hr.Box,{sx:{position:"absolute",top:6,right:6,display:"flex",flexDirection:"column",gap:.25},children:[l?null:(0,rr.jsx)(hr.Tooltip,{title:I("section.editContent"),arrow:!0,placement:"left",children:(0,rr.jsx)(hr.IconButton,{size:"small","aria-label":I("section.editContent"),onClick:()=>S(!0),sx:{color:"#9a9a97"},children:(0,rr.jsx)(Gf.default,{sx:{fontSize:17}})})}),a?(0,rr.jsx)(hr.Tooltip,{title:I("section.translate"),arrow:!0,placement:"left",children:(0,rr.jsx)(hr.IconButton,{size:"small","aria-label":I("section.translate"),onClick:a,sx:{color:"#9a9a97"},children:(0,rr.jsx)(Uf.default,{sx:{fontSize:17}})})}):null]})]}):(0,rr.jsxs)(hr.Box,{onDragOver:T=>T.stopPropagation(),onDrop:T=>T.stopPropagation(),onMouseDownCapture:T=>{p(T)&&R(T.target)&&T.preventDefault()},onClickCapture:T=>{let _=p(T)?R(T.target):null;_&&(T.preventDefault(),T.stopPropagation(),h(_.href))},sx:{mt:1,"& .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:"12px"},...N?{"& .ehfuse-editor-content a[href]":{cursor:"pointer"}}:{},position:"relative"},children:[n&&!b?(0,rr.jsx)(hr.Tooltip,{title:I("section.finishEditingTooltip"),arrow:!0,children:(0,rr.jsx)(hr.IconButton,{size:"small","aria-label":I("section.finishEditing"),onMouseDown:T=>T.preventDefault(),onClick:()=>S(!1),sx:{position:"absolute",top:4,right:6,zIndex:2,color:"#2f9e5b"},children:(0,rr.jsx)(FL.default,{sx:{fontSize:19}})})}):null,(0,rr.jsx)(bs.EhfuseEditor,{ref:O,defaultValue:Vf(u),autoHeight:!0,showToolbar:!N,focusBorder:!0,styles:{focusBorderColor:"var(--primary)"},toolbarOptions:SU,plugins:[P.current],locale:ya(),minHeight:r,placeholder:I("section.contentPlaceholder"),onImageUpload:d,contentStyle:{padding:"12px"},onChange:T=>{let _=Date.now()<M.current,D=T===j.current;j.current=T,!(_||D)&&c(T)}})]})}_e();var or=require("react/jsx-runtime");function $f(e){return String(e??"").replace(/<[^>]*>/g,"").replace(/ /g," ").trim().length>0}function qc({content:e,templates:u,onApply:c,onSave:l,onRemove:n,readOnly:a=!1}){ue();let[r,t]=(0,Qd.useState)(null),[o,d]=(0,Qd.useState)(!1),[i,s]=(0,Qd.useState)(""),h=async m=>{t(null),!($f(e)&&!await(0,dl.ConfirmDialog)({title:I("section.loadTemplate"),message:I("section.loadTemplateConfirm",{name:m.name})}))&&c(m.content)},f=()=>{t(null);let m=Ea(e);m&&navigator.clipboard.writeText(m).then(()=>(0,dl.SuccessAlert)(I("section.contentCopied"))).catch(()=>(0,dl.ErrorAlert)(I("section.contentCopyFailed")))};return(0,or.jsxs)(or.Fragment,{children:[(0,or.jsx)(Cr.Tooltip,{title:I("section.contentMenu"),arrow:!0,disableInteractive:!0,children:(0,or.jsx)(Cr.IconButton,{size:"small","aria-label":I("section.contentMenu"),onClick:m=>t(m.currentTarget),sx:{ml:"auto",color:"#9a9a97"},children:(0,or.jsx)(qL.default,{sx:{fontSize:18}})})}),(0,or.jsxs)(Cr.Menu,{anchorEl:r,open:!!r,onClose:()=>t(null),transitionDuration:0,children:[(0,or.jsx)(Cr.MenuItem,{disabled:!$f(e),onClick:f,sx:{fontSize:14,minWidth:220},children:I("menu.copyContent")}),a?null:(0,or.jsx)(Cr.Divider,{sx:{my:.5}}),!a&&l?(0,or.jsx)(Cr.MenuItem,{disabled:!$f(e),onClick:()=>{t(null),s(""),d(!0)},sx:{fontSize:14,minWidth:220},children:I("section.saveAsTemplate")}):null,!a&&l?(0,or.jsx)(Cr.Divider,{sx:{my:.5}}):null,a?null:u.length===0?(0,or.jsx)(Cr.MenuItem,{disabled:!0,sx:{fontSize:14,minWidth:220},children:I("section.noSavedTemplates")}):u.map(m=>(0,or.jsxs)(Cr.MenuItem,{onClick:()=>{h(m)},sx:{fontSize:14,minWidth:220,gap:1},children:[(0,or.jsx)(Cr.Box,{sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.name}),n?(0,or.jsx)(Cr.IconButton,{size:"small","aria-label":I("section.deleteTemplateAria",{name:m.name}),onClick:b=>{b.stopPropagation(),n(m.seq)},sx:{color:"#9a9a97"},children:(0,or.jsx)(Dr,{sx:{fontSize:16}})}):null]},m.seq))]}),(0,or.jsx)(HL.FormDialog,{open:o,onClose:()=>d(!1),maxWidth:"xs",title:I("section.saveTemplateTitle"),locale:Pt(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},tabs:{visible:!1},actions:{showCancelButton:!0,right:(0,or.jsx)(Cr.Button,{variant:"contained",disabled:!i.trim(),onClick:()=>{l?.(i.trim(),e),d(!1)},children:I("common.save")})},sections:[{id:"template-name",title:"",showTitle:!1,children:(0,or.jsxs)(Cr.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[(0,or.jsx)(Cr.Box,{sx:{fontSize:15,color:"#37352f"},children:I("section.saveTemplateHint")}),(0,or.jsx)(WL.ClearTextField,{size:"medium",fullWidth:!0,autoFocus:!0,placeholder:I("section.templateNamePlaceholder"),value:i,onChange:m=>s(m.target.value)})]})}]})]})}var hl=require("react"),jt=require("@mui/material"),Oi=require("@dnd-kit/core"),em=require("@dnd-kit/modifiers"),Pa=require("@dnd-kit/sortable"),tz=require("@dnd-kit/utilities"),Kf=v(require("@mui/icons-material/Close"),1),nz=v(require("@mui/icons-material/AddCircle"),1),Xf=v(require("@mui/icons-material/AddTask"),1),rz=v(require("@mui/icons-material/Checklist"),1),oz=v(require("@mui/icons-material/CheckCircle"),1),iz=v(require("@mui/icons-material/DragIndicator"),1),az=v(require("@mui/icons-material/Launch"),1),sz=v(require("@mui/icons-material/LinkOutlined"),1),lz=v(require("@mui/icons-material/RadioButtonUnchecked"),1);pn();var KL=require("react"),Kr=require("@mui/material"),XL=require("@ehfuse/mui-form-dialog"),YL=require("@ehfuse/mui-form-controls"),ZL=v(require("@mui/icons-material/CheckCircle"),1),QL=v(require("@mui/icons-material/RadioButtonUnchecked"),1),JL=require("@ehfuse/overlay-scrollbar");_e();var GL=require("react"),Jd=require("@ehfuse/forma"),UL=require("@ehfuse/alerts");_e();var VL={type:"related",search:"",selectedSeqs:[]};function ml(e){ue();let u=(0,GL.useRef)(e);u.current=e;let c={link:(0,Jd.useModal)({modalId:Dt("taskbox-task-link")})},l=(0,Jd.useGlobalForm)({formId:Dt("taskbox-task-link-form"),initialValues:VL,onValidate:t=>t.selectedSeqs.length===0?((0,UL.ErrorAlert)(I("link.selectTask")),!1):!0,onSubmit:t=>{let o=a(t.type)?t.selectedSeqs:t.selectedSeqs.slice(-1);for(let d of o)u.current.onSubmit(d,t.type);return c.link.close(),!0}}),n=()=>{l.setFormValues({...VL,selectedSeqs:[]}),c.link.open()};function a(t){let o=u.current.multiSelect;return typeof o=="function"?o(t):!!o}return{form:l,modals:c,openDialog:n,toggleSelected:t=>{let o=l.getFormValue("selectedSeqs")??[];if(o.includes(t)){l.setFormValue("selectedSeqs",o.filter(i=>i!==t));return}let d=l.getFormValue("type")??"related";l.setFormValue("selectedSeqs",a(d)?[...o,t]:[t])},isMulti:a}}var fr=require("react/jsx-runtime"),$L=[{type:"related",get label(){return I("link.related")},get hint(){return I("link.relatedHint")}},{type:"follow_up",get label(){return I("link.previous")},get hint(){return I("link.previousHint")}},{type:"duplicate_of",get label(){return I("link.duplicate")},get hint(){return I("link.duplicateHint")}}];function Hc({controller:e,task:u,tasks:c,excludeSeqs:l=[],hideRelationType:n=!1,title:a=I("link.title"),confirmLabel:r=I("link.confirm")}){ue();let t=Sn(),{form:o}=e,d=e.modals.link,i=o.useValue("type")??"related",s=String(o.useValue("search")??""),h=o.useValue("selectedSeqs")??[],f=(0,KL.useMemo)(()=>{let g=new Set([u.seq,...l]),w=s.trim().toLowerCase();return c.filter(S=>g.has(S.seq)||S.is_event||S.is_notice||S.linked_only?!1:w?S.title.toLowerCase().includes(w)||(S.ticket_no??"").toLowerCase().includes(w):!0).sort((S,O)=>!!S.completed!=!!O.completed?S.completed?1:-1:O.seq-S.seq)},[c,u.seq,l,s]),m=$L.find(g=>g.type===i)?.hint??"",b=(0,fr.jsxs)(Kr.Box,{sx:{display:"flex",flexDirection:"column",minHeight:0,height:t?"100%":"auto"},children:[n?null:(0,fr.jsx)(Kr.Tabs,{value:i,onChange:(g,w)=>{o.setFormValue("type",w),!e.isMulti(w)&&h.length>1&&o.setFormValue("selectedSeqs",h.slice(-1))},sx:{minHeight:38,flexShrink:0,borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,"& .MuiTab-root":{minHeight:38,py:.5,fontSize:16,color:"#333333"}},children:$L.map(g=>(0,fr.jsx)(Kr.Tab,{value:g.type,label:g.label},g.type))}),n?null:(0,fr.jsx)(Kr.Box,{sx:{mt:1,mb:1.5,fontSize:14,flexShrink:0},children:m}),(0,fr.jsxs)(Kr.Box,{sx:{...t?{height:"100%",minHeight:0}:{height:560},display:"flex",flexDirection:"column",...t?{}:{border:"1px solid #cccccc",borderRadius:1},overflow:"hidden",userSelect:"none"},children:[(0,fr.jsx)(Kr.Box,{sx:{px:1.5,py:1,borderBottom:"1px solid #cccccc",flexShrink:0},children:(0,fr.jsx)(YL.ClearTextField,{placeholder:I("link.searchPlaceholder"),name:"search",form:o,fullWidth:!0,autoFocus:!0,size:"small",sx:{"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiInputBase-root":{px:0}}})}),(0,fr.jsx)(Kr.Box,{sx:{flex:1,minHeight:0},children:(0,fr.jsx)(JL.OverlayScrollbar,{style:{height:"100%"},contentStyle:{paddingTop:0},children:(0,fr.jsx)(Kr.Box,{sx:{display:"flex",flexDirection:"column"},children:f.length===0?(0,fr.jsx)(Kr.Box,{sx:{py:4,textAlign:"center",fontSize:13.5,color:"#9a9a97"},children:I("link.empty")}):f.map(g=>{let w=g.is_notice||g.is_event?tn(g.icon||(g.is_notice?tr:kr)):null,S=h.includes(g.seq);return(0,fr.jsxs)(Kr.Box,{onClick:()=>e.toggleSelected(g.seq),sx:{display:"flex",alignItems:"center",gap:.75,px:1.5,py:1.25,flexShrink:0,cursor:"pointer",borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,"&:last-of-type":{borderBottom:"none"},bgcolor:S?"#e3eefb":"transparent","&:hover":{bgcolor:S?"#e3eefb":"#f7f7f5"}},children:[S?(0,fr.jsx)(ZL.default,{sx:{fontSize:20,flexShrink:0,color:"#2f6fd0"}}):(0,fr.jsx)(QL.default,{sx:{fontSize:20,flexShrink:0,color:"#c9c8c5"}}),w?(0,fr.jsx)(w,{sx:{fontSize:17,flexShrink:0,color:g.icon_color||"#1e3a8a"}}):null,(0,fr.jsxs)(Kr.Box,{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:[g.ticket_no?`${g.ticket_no} `:"",g.title]}),(0,fr.jsx)(Kr.Box,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:(0,fr.jsx)(Tn,{option:xr(g)})})]},g.seq)})})})})]})]});return(0,fr.jsx)(XL.FormDialog,{open:d.isOpen,onClose:d.close,maxWidth:"sm",fullScreen:t,mobilePresentation:t?"slide":"dialog",...t?{contentPaddingX:0,contentTopPadding:0,sectionsPaddingTop:0}:{},sx:t?{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:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-link",sections:[{id:"task-link",showTitle:!1,children:b}],scrollPastLastSection:!1,sectionContentPaddingTop:0,contentTopPadding:12,actions:{showCancelButton:!0,right:(0,fr.jsx)(Kr.Button,{variant:"contained",disabled:h.length===0,onClick:()=>{o.submit()},children:r})}})}var cz=require("@ehfuse/mui-confirm-action");_e();var Wc={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"};var ht=require("react/jsx-runtime"),ez="taskbox.checklist.hideCompleted";function CU({id:e,children:u}){let{attributes:c,listeners:l,setNodeRef:n,transform:a,transition:r,isDragging:t}=(0,Pa.useSortable)({id:e});return(0,ht.jsx)(jt.Box,{ref:n,sx:{transform:tz.CSS.Transform.toString(a),transition:r,...t?{opacity:.6,position:"relative",zIndex:1}:{}},children:u({handleProps:{...c,...l},dragging:t})})}function _U({sortable:e,sensors:u,rowIds:c,onDragEnd:l,compact:n,children:a}){let r=(0,ht.jsx)(jt.Box,{sx:{display:"flex",flexDirection:"column",mt:.5,pl:n?0:3.25},children:a});return e?(0,ht.jsx)(Oi.DndContext,{sensors:u,collisionDetection:Oi.closestCenter,modifiers:[em.restrictToVerticalAxis,em.restrictToParentElement],onDragEnd:l,children:(0,ht.jsx)(Pa.SortableContext,{items:c,strategy:Pa.verticalListSortingStrategy,children:r})}):r}function Vc({taskSeq:e,checklist:u,onAdd:c,onToggle:l,confirmOnToggle:n=!1,onRemove:a,onUpdate:r,onReorder:t,removeLocked:o=!1,onConvertToTask:d,onOpenLinkedTask:i,linkCandidates:s,linkBaseTask:h,onLinkExistingTask:f,resolveLinkedTask:m,myAccountSeq:b=0}){ue();let[g,w]=(0,hl.useState)(""),S=ml({multiSelect:!0,onSubmit:G=>{if(!f)return;let E=s?.find(A=>A.seq===G);f(e,G,String(E?.title??"").trim())}}),[O,P]=(0,hl.useState)(null),j=Sn(),[M,N]=(0,hl.useState)(null),[z,W]=(0,hl.useState)(null),F=G=>{let E=G.task_seq?m?.(G.task_seq):void 0;return E?E.completed:G.checked},C=G=>{if(!G.task_seq||b<=0)return!1;let E=m?.(G.task_seq);return E?!Zh(E,b):!1},B=G=>!!G.task_seq&&!!m&&!m?.(G.task_seq),R=u.filter(G=>!B(G)),p=R.filter(F).length,[y,x]=(0,hl.useState)(()=>{try{return localStorage.getItem(ez)==="1"}catch{return!1}}),k=G=>{x(G);try{localStorage.setItem(ez,G?"1":"0")}catch{}},T=!!t&&!j&&!o,_=(0,Oi.useSensors)((0,Oi.useSensor)(Oi.PointerSensor,{activationConstraint:{distance:5}})),D=(G,E)=>G.task_seq?`linked-${G.task_seq}`:`row-${E}`,H=u.map(D),V=H.filter((G,E)=>{let A=u[E];return B(A)?!1:!(y&&F(A))}),U=G=>{let{active:E,over:A}=G;if(!A||E.id===A.id)return;let q=H.indexOf(String(E.id)),$=H.indexOf(String(A.id));q<0||$<0||t?.(e,(0,Pa.arrayMove)(u,q,$))},L=()=>{g.trim()&&(c(e,g),w(""))};return(0,ht.jsxs)(ko,{icon:(0,ht.jsx)(rz.default,{sx:{fontSize:19,display:"block"}}),title:(0,ht.jsxs)(ht.Fragment,{children:[I("section.todo"),u.length>0?(0,ht.jsxs)(jt.Box,{component:"span",sx:{fontSize:12.5,color:"#9a9a97"},children:[p," / ",u.length]}):null]}),titleExtra:R.length>0?(0,ht.jsxs)(jt.Box,{sx:{flex:1,minWidth:0,ml:1,display:"flex",alignItems:"center",gap:1},children:[(0,ht.jsx)(jt.Box,{sx:{flex:1,minWidth:0,height:6,borderRadius:3,bgcolor:"#ececea"},children:(0,ht.jsx)(jt.Box,{sx:{height:"100%",borderRadius:3,width:`${Math.round(p/R.length*100)}%`,bgcolor:"#2f80ed",transition:"width 0.2s"}})}),p>0?(0,ht.jsxs)(jt.Box,{component:"label",sx:{display:"inline-flex",alignItems:"center",gap:.25,flexShrink:0,cursor:"pointer",fontSize:13.5,fontWeight:400,color:"#57564f",userSelect:"none"},children:[(0,ht.jsx)(jt.Switch,{size:"small",checked:y,onChange:(G,E)=>k(E)}),I("section.hideDone")]}):null]}):null,children:[(0,ht.jsx)(_U,{sortable:T,sensors:_,rowIds:V,onDragEnd:U,compact:j,children:u.map((G,E)=>{let A=G.task_seq?m?.(G.task_seq):void 0,q=F(G);if(y&&q||B(G))return null;let $=!!G.task_seq,Q=C(G),X=Y=>(0,ht.jsxs)(jt.Box,{sx:{display:"flex",alignItems:j?"flex-start":"center",gap:1,px:1.25,...T?{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:[Y?(0,ht.jsx)(jt.Box,{className:"taskbox-checklist-handle",...Y,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:(0,ht.jsx)(iz.default,{sx:{fontSize:16}})}):null,(0,ht.jsx)(jt.Tooltip,{title:Q?I("section.toggleLocked"):"",arrow:!0,disableInteractive:!0,children:(0,ht.jsx)(jt.Box,{component:"span",onClick:Q?void 0:te=>n?W({anchorEl:te.currentTarget,index:E,checked:!q}):l(e,E,!q),sx:{display:"inline-flex",flexShrink:0,cursor:Q?"default":"pointer",...j?{mt:"1px"}:{}},children:q?(0,ht.jsx)(oz.default,{sx:{fontSize:18,color:Q?"#a9c6ec":"#2f80ed"}}):(0,ht.jsx)(lz.default,{sx:{fontSize:18,color:Q?"#d6d5d1":"#9a9a97"}})})}),O?.index===E?(0,ht.jsx)(jt.Box,{component:"input",autoFocus:!0,spellCheck:!1,value:O.label,enterKeyHint:"done",onChange:te=>P({index:E,label:te.target.value}),onBlur:()=>{O.label.trim()&&O.label.trim()!==G.label&&r?.(e,E,O.label),P(null)},onKeyDown:te=>{te.key==="Enter"&&te.target.blur(),te.key==="Escape"&&P(null)},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:14,color:"#37352f",bgcolor:"transparent",p:0}}):(0,ht.jsx)(jt.Box,{component:"span",onClick:$?G.task_seq&&i?()=>i(G.task_seq):void 0:o||!r?void 0:j?()=>N({index:E,label:G.label}):()=>P({index:E,label:G.label}),sx:{flex:1,minWidth:0,fontSize:14.5,color:"#37352f",textDecoration:q?"line-through":"none",overflow:"hidden",textOverflow:"ellipsis",...j?{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,lineHeight:1.4,wordBreak:"break-word"}:{whiteSpace:"nowrap"},...$?i?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}:o||!r?{}:{cursor:"text"}},children:G.label}),$?(0,ht.jsxs)(jt.Box,{component:"span",onClick:G.task_seq&&i?()=>i(G.task_seq):void 0,sx:{...Wc,...j?{mt:"1px"}:{},...i?{cursor:"pointer"}:{}},children:[(0,ht.jsx)(az.default,{sx:{fontSize:12}}),A?.manager_name?.trim()||I("template.task")]}):null,!o&&!$&&d?(0,ht.jsx)(jt.Tooltip,{title:I("section.makeTask"),arrow:!0,enterDelay:300,disableInteractive:!0,children:(0,ht.jsx)(jt.IconButton,{className:"taskbox-checklist-convert",size:"small","aria-label":I("section.makeTask"),onClick:()=>d(e,E,G.label),sx:{display:j?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:(0,ht.jsx)(Xf.default,{sx:{fontSize:16}})})}):null,o?null:(0,ht.jsx)(jt.IconButton,{className:"taskbox-checklist-remove",size:"small","aria-label":I("section.deleteTodo"),onClick:()=>a(e,E),sx:{display:j?"none":"inline-flex",opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:(0,ht.jsx)(Kf.default,{sx:{fontSize:15}})})]});return T?(0,ht.jsx)(CU,{id:H[E],children:({handleProps:Y})=>X(Y)},H[E]):(0,ht.jsx)(jt.Box,{children:X(null)},H[E])})}),(0,ht.jsxs)(jt.Box,{sx:{mt:.5,ml:j?0:3.25,display:"flex",alignItems:"center",gap:.5},children:[(0,ht.jsx)(jt.Box,{component:"input",spellCheck:!1,value:g,placeholder:I("section.addTodoPlaceholder"),enterKeyHint:"done",onChange:G=>w(G.target.value),onKeyDown:G=>{G.key==="Enter"&&L()},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"}}}),s&&h&&f?(0,ht.jsx)(jt.Tooltip,{title:I("section.attachExisting"),arrow:!0,children:(0,ht.jsx)(jt.IconButton,{size:"small","aria-label":I("section.attachExisting"),onMouseDown:G=>G.preventDefault(),onClick:S.openDialog,sx:{flexShrink:0,color:"#9a9a97"},children:(0,ht.jsx)(sz.default,{sx:{fontSize:20}})})}):null,(0,ht.jsx)(jt.IconButton,{size:"small","aria-label":I("section.addTodo"),disabled:!g.trim(),onMouseDown:G=>G.preventDefault(),onClick:L,sx:{flexShrink:0,color:g.trim()?"#2f80ed":"#c9c8c5"},children:(0,ht.jsx)(nz.default,{sx:{fontSize:20}})})]}),s&&h&&f?(0,ht.jsx)(Hc,{controller:S,task:h,tasks:s,excludeSeqs:u.map(G=>Number(G.task_seq??0)).filter(G=>G>0),hideRelationType:!0,title:I("section.attachExisting"),confirmLabel:I("section.attach")}):null,(0,ht.jsx)(cz.ConfirmActionPopper,{open:!!z,anchorEl:z?.anchorEl??null,title:z?.checked?I("calendar.checklistCompleteConfirm"):I("task.uncompleteConfirm"),confirmText:z?.checked?I("common.done"):I("task.unmark"),onCancel:()=>W(null),onConfirm:()=>{z&&l(e,z.index,z.checked),W(null)}}),(0,ht.jsx)(jt.Dialog,{open:!!M,onClose:()=>N(null),maxWidth:"xs",fullWidth:!0,slotProps:{paper:{sx:{borderRadius:2,m:2}}},children:(0,ht.jsxs)(jt.Box,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5},children:[(0,ht.jsx)(jt.Box,{sx:{fontSize:15.5,fontWeight:600,color:"#37352f"},children:I("section.editTodo")}),(0,ht.jsx)(jt.TextField,{autoFocus:!0,fullWidth:!0,size:"medium",value:M?.label??"",onChange:G=>N(E=>E&&{...E,label:G.target.value}),onKeyDown:G=>{if(G.key!=="Enter")return;let E=M;E&&E.label.trim()&&r?.(e,E.index,E.label.trim()),N(null)}}),(0,ht.jsxs)(jt.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[!o&&d&&M&&!u[M.index]?.task_seq?(0,ht.jsx)(jt.IconButton,{"aria-label":I("section.makeTask"),onClick:()=>{d(e,M.index,u[M.index]?.label??""),N(null)},sx:{color:"#57564f"},children:(0,ht.jsx)(Xf.default,{sx:{fontSize:20}})}):null,!o&&M?(0,ht.jsx)(jt.IconButton,{"aria-label":I("section.deleteTodo"),onClick:()=>{a(e,M.index),N(null)},sx:{color:"#e5484d"},children:(0,ht.jsx)(Kf.default,{sx:{fontSize:19}})}):null,(0,ht.jsx)(jt.Box,{sx:{flex:1}}),(0,ht.jsx)(jt.Button,{color:"inherit",onClick:()=>N(null),children:I("common.cancel")}),(0,ht.jsx)(jt.Button,{variant:"contained",disabled:!M?.label.trim(),onClick:()=>{M&&M.label.trim()&&r?.(e,M.index,M.label.trim()),N(null)},children:I("common.confirm")})]})]})})]})}pn();var om=require("react"),ao=require("@mui/material"),Ai=require("@dnd-kit/core"),im=require("@dnd-kit/modifiers"),pl=require("@dnd-kit/sortable"),dz=require("@dnd-kit/utilities"),mz=v(require("@mui/icons-material/DragIndicator"),1),hz=v(require("@mui/icons-material/Close"),1),fz=v(require("@mui/icons-material/AttachFileOutlined"),1),pz=require("@ehfuse/file-viewer/icons");var IU=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"]),tm=e=>{let u=e?.split(".").pop()?.toLowerCase()??"";return IU.has(u)};var uz=require("@mui/material");var fl=require("react/jsx-runtime");function Yf(e){let u=Yo(),c=u.useValue("attachmentUpload.taskSeq"),l=u.useValue("attachmentUpload.index"),n=u.useValue("attachmentUpload.total"),a=u.useValue("attachmentUpload.queue"),r=l??0;return!r||e>0&&(c??0)!==e?null:{index:r,total:n??0,queue:a??[]}}function nm(){let u=Yo().useValue("attachmentUpload.progress");return(0,fl.jsxs)(fl.Fragment,{children:[u??0,"%"]})}function Zf(){let u=Yo().useValue("attachmentUpload.progress");return(0,fl.jsx)(uz.LinearProgress,{variant:"determinate",value:u??0,sx:{height:4,borderRadius:2,bgcolor:"#dbe9fb",mt:.75}})}_e();var cn=require("react/jsx-runtime");function BU({id:e,children:u}){let{attributes:c,listeners:l,setNodeRef:n,transform:a,transition:r,isDragging:t}=(0,pl.useSortable)({id:e});return(0,cn.jsx)(ao.Box,{ref:n,sx:{transform:dz.CSS.Transform.toString(a),transition:r,...t?{opacity:.6,position:"relative",zIndex:1}:{}},children:u({...c,...l})})}function Gc(e){return e>=1048576?`${(e/1048576).toFixed(1)}MB`:`${Math.max(1,Math.round(e/1024))}KB`}var rm={flex:1,minWidth:0,fontSize:13.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function Uc({taskSeq:e,attachments:u,onAdd:c,onRemove:l,removeLocked:n=!1,onPreview:a,onDownload:r,onReorder:t}){ue();let[o,d]=(0,om.useState)(!1),i=(0,om.useRef)(null),s=Sn(),h=js(),f=Fs(),m=Yf(e),b=e===0,g=!!t&&!b&&!s&&!n&&!m&&u.length>1,w=(0,Ai.useSensors)((0,Ai.useSensor)(Ai.PointerSensor,{activationConstraint:{distance:5}})),S=(F,C)=>F.uuid?`file-${F.uuid}`:`file-${C}`,O=u.map(S),P=F=>{let{active:C,over:B}=F;if(!B||C.id===B.id)return;let R=O.indexOf(String(C.id)),p=O.indexOf(String(B.id));R<0||p<0||t?.(e,R,p)},j=F=>{if(a){a(F);return}window.open(f(F.uuid??""),"_blank","noopener,noreferrer")},M=F=>{if(r){r(F);return}window.open(f(F.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},N=F=>m?F+1<m.index?"done":F+1===m.index?"uploading":"waiting":"waiting",z=(F,C,B,R,p={})=>(0,cn.jsxs)(ao.Box,{sx:{px:1,py:.5,borderRadius:1,border:"1px solid",borderColor:p.uploading?"#d5e6fb":De.NOTION_LINE_COLOR,bgcolor:p.uploading?"#f4f9ff":"transparent","&:hover .taskbox-file-remove":{opacity:1},"&:hover .taskbox-file-handle":{opacity:1}},children:[(0,cn.jsxs)(ao.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[p.handleProps?(0,cn.jsx)(ao.Box,{className:"taskbox-file-handle","aria-label":I("section.reorder"),...p.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:(0,cn.jsx)(mz.default,{sx:{fontSize:16}})}):null,(0,cn.jsx)(ao.Box,{component:"span",sx:{display:"inline-flex",flexShrink:0},children:(0,cn.jsx)(pz.FileTypeIcon,{fileName:C,size:18})}),B,(0,cn.jsx)(ao.Box,{component:"span",sx:{fontSize:12,color:p.uploading?"#2f80ed":"#9a9a97",flexShrink:0},children:R}),p.removeIndex!==void 0?(0,cn.jsx)(ao.IconButton,{className:"taskbox-file-remove",size:"small","aria-label":I("section.deleteAttachment"),onClick:()=>l(e,p.removeIndex),sx:{opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:(0,cn.jsx)(hz.default,{sx:{fontSize:15}})}):null]}),p.uploading?(0,cn.jsx)(Zf,{}):null]},F),W=F=>{let C=tm(F.name);return(0,cn.jsx)(ao.Box,{component:"button",type:"button",onClick:()=>C?j(F):M(F),title:I("section.fileAction",{name:F.name,value:C?I("section.preview"):I("section.download")}),sx:{...rm,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:F.name})};return(0,cn.jsxs)(ko,{icon:(0,cn.jsx)(fz.default,{sx:{fontSize:18,display:"block"}}),title:(0,cn.jsxs)(cn.Fragment,{children:[I("section.files")," ",u.length>0?u.length:""]}),children:[(0,cn.jsx)(OU,{sortable:g,sensors:w,rowIds:O,onDragEnd:P,children:(0,cn.jsxs)(ao.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mt:1},children:[u.map((F,C)=>{let B=`${F.uuid||F.name}-${C}`;if(b){let R=N(C),p=R==="uploading";return z(B,F.name,(0,cn.jsx)(ao.Box,{component:"span",sx:{...rm,color:R==="done"?"#37352f":"#9a9a97"},children:F.name}),p?(0,cn.jsx)(nm,{}):Gc(F.size),{uploading:p,removeIndex:!n&&!m?C:void 0})}return F.uuid?g?(0,cn.jsx)(BU,{id:S(F,C),children:R=>z(B,F.name,W(F),Gc(F.size),{removeIndex:n?void 0:C,handleProps:R})},S(F,C)):z(B,F.name,W(F),Gc(F.size),{removeIndex:n?void 0:C}):z(B,F.name,(0,cn.jsx)(ao.Box,{component:"span",title:I("section.legacyAttachment"),sx:{...rm,color:"#9a9a97"},children:F.name}),Gc(F.size),{removeIndex:n?void 0:C})}),!b&&m?m.queue.slice(m.index-1).map((F,C)=>{let B=C===0;return z(`uploading-${m.index+C}-${F.name}`,F.name,(0,cn.jsx)(ao.Box,{component:"span",sx:{...rm,color:"#9a9a97"},children:F.name}),B?(0,cn.jsx)(nm,{}):Gc(F.size),{uploading:B})}):null]})}),(0,cn.jsx)(ao.Box,{onClick:()=>i.current?.click(),onDragOver:F=>{F.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:F=>{F.preventDefault(),d(!1);let C=Array.from(F.dataTransfer.files);C.length>0&&c(e,C)},sx:{mt:1,py:2.5,display:"flex",alignItems:"center",justifyContent:"center",gap:.5,border:"1.5px dashed",borderColor:o?"#2f80ed":"#cfcfcc",borderRadius:1,bgcolor:o?"#eef6ff":"transparent",color:"#787774",fontSize:13.5,cursor:"pointer",transition:"background-color 0.15s, border-color 0.15s","&:hover":{bgcolor:"#fafaf9",borderColor:"#9a9a97"}},children:s?I("section.attachHint",{uploadMaxMb:h}):I("section.attachHintDrag",{uploadMaxMb:h})}),(0,cn.jsx)(ao.Box,{component:"input",ref:i,type:"file",multiple:!0,onChange:F=>{let C=Array.from(F.target.files??[]);C.length>0&&c(e,C),F.target.value=""},sx:{display:"none"}})]})}function OU({sortable:e,sensors:u,rowIds:c,onDragEnd:l,children:n}){return e?(0,cn.jsx)(Ai.DndContext,{sensors:u,collisionDetection:Ai.closestCenter,modifiers:[im.restrictToVerticalAxis,im.restrictToParentElement],onDragEnd:l,children:(0,cn.jsx)(pl.SortableContext,{items:c,strategy:pl.verticalListSortingStrategy,children:n})}):(0,cn.jsx)(cn.Fragment,{children:n})}var Tz=require("react"),gi=require("@mui/material"),Sz=v(require("@mui/icons-material/Add"),1);var gl=require("@mui/material"),kz=require("@ehfuse/mui-form-dialog"),xz=require("@ehfuse/mui-form-controls"),wz=require("@ehfuse/mui-color-picker");var bz=require("@ehfuse/forma"),yz=require("@ehfuse/alerts");_e();var gz="#2f80ed";function vz({open:e,onClose:u,onSubmit:c}){ue();let l=(0,bz.useGlobalForm)({formId:Dt("taskbox-add-label-form"),initialValues:{name:"",color:gz},onValidate:a=>String(a.name??"").trim()?!0:((0,yz.ErrorAlert)(I("dialog.enterLabelName")),!1),onSubmit:a=>(c(String(a.name).trim(),a.color),n.form.close(),!0)}),n={form:$r({modalIdPrefix:"taskbox-add-label-dialog",open:e,onClose:u,onOpen:()=>l.setFormValues({name:"",color:gz})})};return{form:l,modals:n}}_e();var Ei=require("react/jsx-runtime");function Qf({open:e,onClose:u,onSubmit:c}){ue();let{form:l,modals:n}=vz({open:e,onClose:u,onSubmit:c}),a=String(l.useFormValue("name")??""),r=String(l.useFormValue("color")??""),t=zh(r),o=(0,Ei.jsxs)(gl.Box,{children:[(0,Ei.jsxs)(gl.Box,{sx:{display:"flex",alignItems:"center",gap:1.5,mt:.5},children:[(0,Ei.jsx)(xz.ClearTextField,{form:l,name:"name",label:I("dialog.labelName"),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),l.submit())},fullWidth:!0,autoFocus:!0}),(0,Ei.jsx)(wz.ColorPicker,{value:r,onChange:d=>l.setFormValue("color",d),shape:"circle",colorSize:28})]}),(0,Ei.jsxs)(gl.Box,{sx:{mt:2,display:"flex",alignItems:"center",gap:1,fontSize:13,color:"#787774"},children:[I("dialog.preview"),(0,Ei.jsx)(Tn,{option:{key:"__preview__",name:a.trim()||I("dialog.label"),...t}})]})]});return(0,Ei.jsx)(kz.FormDialog,{open:n.form.isOpen,onClose:n.form.close,maxWidth:"xs",title:I("dialog.addLabelTitle"),locale:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-add-label",sections:[{id:"add-label",showTitle:!1,children:o}],actions:{showCancelButton:!0,right:(0,Ei.jsx)(gl.Button,{variant:"contained",onClick:()=>{l.submit()},children:I("common.add")})}})}_e();var No=require("react/jsx-runtime");function $c({anchorEl:e,selectedKeys:u,labelOptions:c,onToggle:l,onAddLabel:n,onClose:a}){ue();let[r,t]=(0,Tz.useState)(!1),o=wi();return(0,No.jsxs)(No.Fragment,{children:[(0,No.jsxs)(gi.Menu,{anchorEl:e,open:!!e,onClose:a,transitionDuration:0,...o,children:[c.map(d=>{let i=u.includes(d.key);return(0,No.jsxs)(gi.MenuItem,{onClick:()=>l(d.key),sx:{fontSize:14,minWidth:170,gap:1},children:[(0,No.jsx)(gi.Checkbox,{size:"small",checked:i,sx:{p:0}}),(0,No.jsx)(Tn,{option:d})]},d.key)}),(0,No.jsx)(gi.Divider,{}),(0,No.jsxs)(gi.MenuItem,{onClick:()=>t(!0),sx:{fontSize:14,color:"#787774"},children:[(0,No.jsx)(gi.ListItemIcon,{children:(0,No.jsx)(Sz.default,{sx:{fontSize:18,color:"#787774"}})}),I("menu.addLabel")]})]}),(0,No.jsx)(Qf,{open:r,onClose:()=>t(!1),onSubmit:n})]})}_e();function Cz(e,u){let c=Number(e.author_account_seq??0);return u.filter(l=>{let n=Number(l.account_seq??0);return n>0&&n!==c})}function _z(e,u){let c=(e.target_account_seqs??[]).filter(s=>s>0);if(c.length===0)return null;let l=new Set(c),n=Cz(e,u),a=new Map;for(let s of n){let h=String(s.department??"").trim();if(!h)continue;let f=a.get(h)??[];f.push(s),a.set(h,f)}let r=[],t=new Set;for(let[s,h]of a)if(h.every(m=>l.has(Number(m.account_seq??0)))){r.push(s);for(let m of h)t.add(Number(m.account_seq??0))}let o=new Map(n.map(s=>[Number(s.account_seq??0),s.name])),d=e.target_names??[],i=[];return c.forEach((s,h)=>{t.has(s)||i.push(o.get(s)??d[h]??I("dialog.noName"))}),{teamNames:r,individualNames:i}}function Kc(e,u){let c=_z(e,u);return c?[...c.teamNames,...c.individualNames].join(", "):I("col.allEmployees")}function AU(e,u){let c=_z(e,u);return c?{kind:"members",teamNames:c.teamNames,individualNames:c.individualNames}:{kind:"everyone"}}function EU(e,u,c){let l=u.length>0?new Set(u):new Set(c.map(n=>Number(n.account_seq??0)).filter(n=>n>0));return l.size===0?e.length:new Set(e.map(n=>Number(n.account_seq)).filter(n=>l.has(n))).size}function Jf(e,u,c){let l=(e.target_account_seqs??[]).filter(f=>f>0),n=Cz(e,u),a=l.length>0?l.length:n.length,r=e.acks??[],t=c>0&&r.some(f=>f.account_seq===c),o=c>0&&Number(e.author_account_seq??0)===c,d=l.length===0||l.includes(c),i=new Set(r.map(f=>f.account_seq)),h=(l.length>0?n.filter(f=>l.includes(Number(f.account_seq??0))):n).filter(f=>!i.has(Number(f.account_seq??0))).map(f=>String(f.name??"").trim()).filter(f=>f.length>0);return{count:EU(r,l,n),total:a,acked:t,pendingNames:h,canAck:c>0&&!o&&d&&!t&&!e.completed}}var Hz=require("@ehfuse/mui-datetime-picker");var Iz=require("react"),oi=require("@mui/material"),Bz=v(require("@mui/icons-material/InfoOutlined"),1),Oz=v(require("@mui/icons-material/LockOutlined"),1),Az=v(require("@mui/icons-material/PublicOutlined"),1),Ez=v(require("@mui/icons-material/Group"),1);_e();var pr=require("react/jsx-runtime"),PU=[{key:"all",icon:(0,pr.jsx)(Az.default,{sx:{fontSize:17,color:"#2f80ed"}}),label:"create.visibilityPublic",who:"create.visibilityInfoAll"},{key:"group",icon:(0,pr.jsx)(Ez.default,{sx:{fontSize:17,color:"#d9730d"}}),label:"create.visibilityDeptShort",who:"create.visibilityInfoGroup"},{key:"involved",icon:(0,pr.jsx)(Oz.default,{sx:{fontSize:17}}),label:"create.visibilityPrivate",who:"create.visibilityInfoPrivate"}];function am(){let[e,u]=(0,Iz.useState)(null),{colors:c}=xt(),l=String(Ba.labelColor??"#787774");return(0,pr.jsxs)(oi.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.25},children:[I("create.visibility"),(0,pr.jsx)(oi.IconButton,{size:"small","aria-label":I("create.visibilityInfo"),onClick:n=>{n.stopPropagation(),u(n.currentTarget)},sx:{p:.25,color:l},children:(0,pr.jsx)(Bz.default,{sx:{fontSize:16}})}),(0,pr.jsxs)(oi.Popover,{open:!!e,anchorEl:e,onClose:()=>u(null),onClick:n=>n.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:[(0,pr.jsxs)(oi.Box,{sx:{fontSize:14,lineHeight:1.6,mb:1.5,px:1.5,py:1.25,borderRadius:1.5,bgcolor:c.accentSoft,color:c.textSecondary,wordBreak:"keep-all"},children:[(0,pr.jsx)(oi.Box,{component:"strong",sx:{fontWeight:700,color:c.accentOnSurface},children:I("create.visibilityInfoNoteStrong")})," ",I("create.visibilityInfoNote")]}),(0,pr.jsx)(oi.Box,{sx:{border:`1px solid ${c.border}`,borderRadius:1.5,overflow:"hidden"},children:(0,pr.jsxs)(oi.Box,{component:"table",sx:{width:"100%",borderCollapse:"collapse",fontSize:14,"& th, & td":{border:`1px solid ${c.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:c.surfaceSubtle,color:c.textSecondary,fontWeight:600},"& tbody tr:last-child td":{borderBottom:"none"},"& td":{color:c.textPrimary,wordBreak:"keep-all",lineHeight:1.5}},children:[(0,pr.jsx)("thead",{children:(0,pr.jsxs)("tr",{children:[(0,pr.jsx)("th",{children:I("create.visibilityInfoColScope")}),(0,pr.jsx)("th",{children:I("create.visibilityInfoColWho")})]})}),(0,pr.jsx)("tbody",{children:PU.map(n=>(0,pr.jsxs)("tr",{children:[(0,pr.jsx)(oi.Box,{component:"td",sx:{whiteSpace:"nowrap"},children:(0,pr.jsxs)(oi.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[n.icon,I(n.label)]})}),(0,pr.jsx)("td",{children:I(n.who)})]},n.key))})]})})]})]})}_e();var Ve=require("react/jsx-runtime"),Wz="taskbox:create-expanded";function MU(){try{return window.localStorage.getItem(Wz)==="1"}catch{return!1}}function sm({form:e,statusOptions:u,customTabs:c,sprints:l=[],avatarSrcByName:n,isNotice:a=!1,hideProject:r=!1,hideBug:t=!1,hideTypeToggle:o=!1,leadingRow:d,afterProject:i,extraRows:s,hideLabel:h=!1,simple:f=!1,hideMembers:m=!1,templateItem:b=!1,postMode:g=!1,employees:w=[],workspaceName:S="",workspaceSlot:O,myAccountSeq:P=0,departments:j=[],myGroupSeq:M=0,onMemberEdit:N,onAddProject:z,onAddLabelOption:W,contentSyncKey:F="create",contentTemplates:C,contentTitleExtra:B,onSaveContentTemplate:R,onRemoveContentTemplate:p}){ue();let y=Yo(),x=js(),k=e.useFormValue("manager_name"),T=e.useFormValue("receiver_names"),_=e.useFormValue("start_date"),D=!!e.useFormValue("is_event"),H=!!e.useFormValue("is_bug"),V=e.useFormValue("bug_repro")??"",U=e.useFormValue("bug_device")??"",L=e.useFormValue("bug_where")??"",G=e.useFormValue("bug_version")??"",E=e.useFormValue("event_time")??"",A=e.useFormValue("event_place")??"",q=e.useFormValue("event_address")??"",$=e.useFormValue("due_date"),Q=e.useFormValue("reminders")??[],X=e.useFormValue("priority"),Y=e.useFormValue("content"),te=e.useFormValue("note")??"",K=e.useFormValue("checklist")??[],J=e.useFormValue("tab_key"),ee=e.useFormValue("sprint_seq")??0,ie=e.useFormValue("story_points")??0,ae=c.find(oe=>oe.key===J&&oe.useSprints),le=ae?l.filter(oe=>`custom-${oe.group_seq}`===J):[],[ce,ye]=(0,ys.useState)(null),ke=e.useFormValue("label_keys"),[xe,qe]=(0,ys.useState)(null),Be=e.useFormValue("visibility")||"involved",ge=Number(e.useFormValue("visibility_group_seq")??0),[ze,Le]=(0,ys.useState)(null),Oe=e.useFormValue("repeat_rule")||"",Ze=e.useFormValue("repeat_until")||"",[Re,Ie]=(0,ys.useState)(null),[kt,We]=(0,ys.useState)(null),st=e.useFormValue("target_names"),Xn=e.useFormValue("target_account_seqs"),lt=y.useValue("createAttachmentFiles")??[],Nt=a?Kc({author_account_seq:P,target_names:st,target_account_seqs:Xn},w):"",[Je,Qe]=(0,ys.useState)(MU),Fn=f&&!D&&!a&&!g,Ke=Fn&&!Je,ct=()=>{let oe=!Je;Qe(oe);try{window.localStorage.setItem(Wz,oe?"1":"0")}catch{}},pt=!g,pe=m?1:2;return(0,Ve.jsxs)(Ve.Fragment,{children:[d,!a&&!o?(0,Ve.jsxs)(Cn.Box,{sx:{display:"flex",gap:1.25,px:2,pt:1.5,pb:1.5,flexShrink:0},children:[O?(0,Ve.jsx)(Cn.Box,{sx:{alignSelf:"center",mr:"6px",minWidth:0,display:"flex"},children:O}):S?(0,Ve.jsx)(Cn.Box,{sx:{alignSelf:"center",fontSize:13.5,fontWeight:600,color:"#37352f",mr:"6px",maxWidth:160,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:S,children:S}):null,[{value:"task",label:I("kind.task")},{value:"event",label:I("kind.event")},...t?[]:[{value:"bug",label:I("kind.bug")}]].map(oe=>{let Pe=(H?"bug":D?"event":"task")===oe.value;return(0,Ve.jsx)(Cn.ButtonBase,{onClick:()=>Vu(e,oe.value),sx:{px:1.75,lineHeight:1,pt:"8px",pb:"10px",borderRadius:99,fontSize:13.5,fontWeight:Pe?600:400,color:Pe?"#ffffff":"#787774",bgcolor:Pe?"#2563eb":"#f4f4f2"},children:oe.label},oe.label)})]}):null,(0,Ve.jsx)(Cn.Divider,{sx:{borderColor:De.NOTION_LINE_COLOR}}),(0,Ve.jsxs)(Cn.Box,{sx:{pt:1.5,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[(0,Ve.jsx)(zc,{afterProject:i,hideProject:r||Ke&&!J,hideManager:m||g||Ke&&!k,hideReceivers:b||m||g&&Be==="all"||Ke&&T.length===0,hideStartDate:Ke||g,hideReminder:b||g||Ke&&Q.length===0,hidePriority:g,hideDueDate:g||!D&&!!Oe,values:{tabKey:J,managerName:k,receiverNames:T,startDate:_,dueDate:$,reminders:Q,priority:X,eventTime:E,eventPlace:A,eventAddress:q},customTabs:c,avatarSrcByName:n,notice:a,event:D,onChangeEventTime:oe=>e.setFormValue("event_time",oe),onChangeEventPlace:oe=>e.setFormValue("event_place",oe),onChangeEventAddress:oe=>e.setFormValue("event_address",oe),targetSummary:Nt,onChangeProject:oe=>e.setFormValue("tab_key",oe),onAddProject:z,onChangeStartDate:oe=>e.setFormValue("start_date",oe),onClearStartDate:()=>e.setFormValue("start_date",""),onChangeDueDate:oe=>e.setFormValue("due_date",oe),onChangeReminder:oe=>e.setFormValue("reminders",oe),onChangePriority:oe=>e.setFormValue("priority",oe),onMemberEdit:N,pinColumns:pt,beforeStart:(0,Ve.jsxs)(Ve.Fragment,{children:[!b&&!H&&!g&&!(Ke&&!Oe)?(0,Ve.jsx)(Ot,{icon:(0,Ve.jsx)(zz.default,{sx:{fontSize:17,...Oe?{color:"#2f80ed"}:{}}}),label:I("create.repeat"),onClick:oe=>Ie(oe),sx:D||!pt?void 0:Ln(pe),children:Oe?Jl(Oe):(0,Ve.jsx)(Cn.Box,{component:"span",sx:{color:"#9a9a97"},children:I("common.none")})}):null,!b&&!H&&!g&&Oe?(0,Ve.jsx)(Ot,{icon:(0,Ve.jsx)(Fz.default,{sx:{fontSize:17}}),label:I("create.repeatUntil"),onClick:oe=>We(oe),sx:D||!pt?void 0:Ln(pe),children:Ze?Ao(Ze):(0,Ve.jsx)(Cn.Box,{component:"span",sx:{color:"#9a9a97"},children:I("create.auto")})}):null]}),trailing:(0,Ve.jsxs)(Ve.Fragment,{children:[!a&&!m&&!(Ke&&Be==="involved")?(0,Ve.jsx)(Ot,{icon:Be==="all"?(0,Ve.jsx)(tp.default,{sx:{fontSize:17,color:"#2f80ed"}}):Be==="group"?(0,Ve.jsx)(np.default,{sx:{fontSize:17,color:"#d9730d"}}):(0,Ve.jsx)(ep.default,{sx:{fontSize:17}}),label:(0,Ve.jsx)(am,{}),onClick:oe=>Le(oe),sx:D||!pt?void 0:Ln(1),children:Be==="all"?I("create.visibilityPublic"):Be==="group"?I("create.visibilityDept",{value:j.find(oe=>oe.seq===ge)?.name??I("create.department")}):I("create.visibilityPrivate")}):null,ae&&!D&&!a&&!g&&!(Ke&&ee===0&&ie===0)?(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(Ot,{icon:(0,Ve.jsx)(Lz.default,{sx:{fontSize:17}}),label:I("col.goal"),onClick:oe=>ye(oe),sx:pt?Ln(1):void 0,children:ee>0?le.find(oe=>oe.seq===ee)?.name??I("create.deletedGoal"):(0,Ve.jsx)(Cn.Box,{component:"span",sx:{color:"#9a9a97"},children:I("board.unassigned")})}),(0,Ve.jsx)(Ot,{icon:(0,Ve.jsx)(jz.default,{sx:{fontSize:17}}),label:"\uD3EC\uC778\uD2B8",sx:pt?Ln(1):void 0,children:(0,Ve.jsx)(Bi,{value:ie>0?String(ie):"",placeholder:I("create.notEstimated"),onCommit:oe=>e.setFormValue("story_points",Number(oe.replace(/[^0-9.]/g,""))||0)})})]}):null,H?(0,Ve.jsx)(Fc,{values:{repro:V,device:U,where:L,version:G},onChangeRepro:oe=>e.setFormValue("bug_repro",oe),onChangeDevice:oe=>e.setFormValue("bug_device",oe),onChangeWhere:oe=>e.setFormValue("bug_where",oe),onChangeVersion:oe=>e.setFormValue("bug_version",oe)}):null,!b&&!g&&!a?(s??[]).filter(oe=>!(Ke&&!oe.filled)).map(oe=>(0,Ve.jsx)(Ot,{icon:oe.icon,label:oe.label,onClick:oe.onClick,sx:D||!pt?void 0:Ln(pe),children:oe.value},oe.key)):null]}),leading:D||h?null:(0,Ve.jsx)(Cn.Box,{sx:{gridColumn:"1 / -1"},children:(0,Ve.jsx)(Ot,{icon:(0,Ve.jsx)(Nz.default,{sx:{fontSize:17}}),label:I("dialog.label"),onClick:oe=>qe(oe),children:(ke??[]).length>0?(0,Ve.jsx)(Yi,{labelKeys:ke??[],labelOptions:u}):(0,Ve.jsx)(Cn.Box,{component:"span",sx:{color:"#9a9a97"},children:I("menu.empty")})})})}),Fn?(0,Ve.jsxs)(Cn.ButtonBase,{onClick:ct,"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?(0,Ve.jsx)(Pz.default,{sx:{fontSize:17}}):(0,Ve.jsx)(Mz.default,{sx:{fontSize:17}}),Je?I("create.collapseFields"):I("create.expandFields")]}):null,(0,Ve.jsx)(Cn.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,Ve.jsx)(ko,{icon:(0,Ve.jsx)(Rz.default,{sx:{fontSize:18,display:"block"}}),title:I("common.content"),titleExtra:B||C?(0,Ve.jsxs)(Ve.Fragment,{children:[B,C?(0,Ve.jsx)(qc,{content:Y,templates:C,onApply:oe=>e.setFormValue("content",oe),onSave:R,onRemove:p}):null]}):void 0,children:(0,Ve.jsx)(jc,{syncKey:F,value:Y,onChange:oe=>e.setFormValue("content",oe)})}),H||g||Ke&&!te?null:(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(Cn.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,Ve.jsx)(ko,{icon:(0,Ve.jsx)(Dz.default,{sx:{fontSize:18,display:"block"}}),title:I("col.note"),children:(0,Ve.jsx)(qz.TextField,{form:e,name:"note",placeholder:I("create.notePlaceholder"),fullWidth:!0,size:"medium",sx:{mt:1}})})]}),D||g||Ke&&K.length===0?null:(0,Ve.jsx)(Cn.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),D||g||Ke&&K.length===0?null:(0,Ve.jsx)(Vc,{taskSeq:0,checklist:K,onAdd:(oe,Ge)=>Ku(e,Ge),onToggle:(oe,Ge,Pe)=>Xu(e,Ge,Pe),onRemove:(oe,Ge)=>Yu(e,Ge),onUpdate:(oe,Ge,Pe)=>Zu(e,Ge,Pe)}),b?null:(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(Cn.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,Ve.jsx)(Uc,{taskSeq:0,attachments:lt.map(oe=>({name:oe.name,size:oe.size})),onAdd:(oe,Ge)=>Qu(y,Ge,x),onRemove:(oe,Ge)=>Ju(y,Ge)})]})]}),(0,Ve.jsx)(Cn.Menu,{transitionDuration:0,anchorEl:ce,open:!!ce,onClose:()=>ye(null),children:[{seq:0,label:I("board.unassigned")},...le.map(oe=>({seq:oe.seq,label:Wo(oe)}))].map(oe=>(0,Ve.jsx)(Cn.MenuItem,{onClick:()=>{e.setFormValue("sprint_seq",oe.seq),ye(null)},sx:{fontSize:14,minWidth:170},children:oe.label},oe.seq))}),(0,Ve.jsx)(Cn.Menu,{transitionDuration:0,anchorEl:Re,open:!!Re,onClose:()=>Ie(null),children:[{value:"",label:I("common.none")},...Vs].map(oe=>(0,Ve.jsx)(Cn.MenuItem,{selected:Oe===oe.value,onClick:()=>{Ie(null),Gu(e,oe.value)},sx:{fontSize:14,minWidth:140},children:oe.label},oe.value||"none"))}),(0,Ve.jsx)(Hz.DatePicker,{anchorEl:kt,open:!!kt,onClose:()=>We(null),selectedDate:Ze?new Date(`${Ze}T00:00:00`):new Date,onDateChange:oe=>{Uu(e,oe),We(null)}}),(0,Ve.jsx)(Cn.Menu,{transitionDuration:0,anchorEl:ze,open:!!ze,onClose:()=>Le(null),children:[{key:"involved",label:I("create.visibilityPrivate"),tip:I("create.privateTip"),icon:(0,Ve.jsx)(ep.default,{sx:{fontSize:17,color:"#57564f"}}),selected:Be==="involved",onPick:()=>Gs(e,"involved")},{key:"all",label:I("create.visibilityPublic"),tip:I("create.publicTip"),icon:(0,Ve.jsx)(tp.default,{sx:{fontSize:17,color:"#2f80ed"}}),selected:Be==="all",onPick:()=>Gs(e,"all")},...[...j].sort((oe,Ge)=>oe.seq===M?-1:Ge.seq===M?1:0).map(oe=>({key:`group-${oe.seq}`,label:I("create.visibilityDeptName",{name:oe.name}),tip:I("create.deptTip",{name:oe.name}),icon:(0,Ve.jsx)(np.default,{sx:{fontSize:17,color:"#d9730d"}}),selected:Be==="group"&&ge===oe.seq,onPick:()=>Gs(e,"group",oe.seq)}))].map(oe=>(0,Ve.jsx)(Cn.Tooltip,{title:oe.tip,arrow:!0,disableInteractive:!0,placement:"right",children:(0,Ve.jsxs)(Cn.MenuItem,{selected:oe.selected,onClick:()=>{oe.onPick(),g&&oe.key==="all"&&(e.setFormValue("receiver_names",[]),e.setFormValue("receiver_account_seqs",[])),Le(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[oe.icon,oe.label]})},oe.key))}),(0,Ve.jsx)($c,{anchorEl:xe,selectedKeys:ke??[],labelOptions:u,onToggle:oe=>e.setFormValue("label_keys",cc(ke??[],oe)),onAddLabel:(oe,Ge)=>W?.(oe,Ge),onClose:()=>qe(null)})]})}_e();var un=require("react/jsx-runtime"),RU={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 rp({open:e,onClose:u,desktopPresentation:c="drawer",submitLabel:l,...n}){ue();let{form:a,presetTitle:r="",presetContent:t="",presetVisibility:o,presetVisibilityGroupSeq:d=0,presetDueDate:i="",presetTabKey:s="",presetManager:h=null,isNotice:f=!1,defaultBug:m=!1}=n,b=Yo(),g=(0,vs.useRef)(!1),[w,S]=(0,vs.useState)(0),O=a.useFormValue("title"),P=a.useFormValue("icon"),j=a.useFormValue("icon_color"),M=!!a.useFormValue("is_event"),N=!!a.useFormValue("is_bug"),z=Sn(),F=b.useValue("createSubmitting")??!1,C=f||M?tn(P||(f?tr:kr)):null,B=f?I("create.titleNotice"):M?I("create.titleEvent"):N?I("task.createBug"):I("task.createTask"),R=f?I("create.noticeTitlePlaceholder"):M?I("create.eventTitlePlaceholder"):N?I("create.bugTitlePlaceholder"):I("create.taskTitlePlaceholder");(0,vs.useEffect)(()=>{let T=g.current;g.current=e,!(!e||T)&&(Wu(a,b,{presetTitle:r,presetContent:t,presetVisibility:o,presetVisibilityGroupSeq:d,presetDueDate:i,presetTabKey:s,presetManager:h,isNotice:f,defaultBug:m}),S(_=>_+1))},[e]);let[p,y]=(0,vs.useState)(null),x=T=>C?M?(0,un.jsx)(Gn.Tooltip,{title:I("col.changeIcon"),arrow:!0,enterDelay:400,disableInteractive:!0,children:(0,un.jsx)(Gn.ButtonBase,{onClick:_=>y(_.currentTarget),sx:{display:"flex",p:.5,borderRadius:1,color:j||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:(0,un.jsx)(C,{sx:{fontSize:20}})})}):(0,un.jsx)(Gn.Box,{sx:[{display:"flex",color:j||"#1e3a8a"},T],children:(0,un.jsx)(C,{sx:{fontSize:20}})}):null,k=(0,un.jsxs)(Gn.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:2,pt:2,pb:1},children:[x({p:0}),(0,un.jsx)(Gn.Box,{component:"input",autoFocus:!0,spellCheck:!1,value:O,placeholder:R,onChange:T=>a.setFormValue("title",T.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 z||c==="dialog"?(0,un.jsx)(un.Fragment,{children:(0,un.jsx)(Uz.FormDialog,{open:e,onClose:u,backdropClick:!1,locale:Pt(),fontScale:z?{enabled:!0,default:1.1,min:.6}:{enabled:!0},title:B,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fullScreen:z,mobilePresentation:z?"slide":"dialog",maxWidth:"md",actions:{showCancelButton:!0,right:(0,un.jsx)(Gn.Button,{variant:"contained",disableElevation:!0,disabled:F,onClick:F?void 0:a.submit,children:F?I("create.saving"):l??I("create.saveButton")})},dialogActionSx:z?RU: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:(0,un.jsx)(Gn.Box,{sx:{width:"100%",minWidth:0,display:"flex",flexDirection:"column",gap:0},children:(0,un.jsx)(sm,{...n,contentSyncKey:`create-${w}`,leadingRow:k})})}]})}):(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)(Gn.Drawer,{anchor:"right",open:e,onClose:(T,_)=>{_!=="backdropClick"&&u()},"aria-label":I("create.newTaskAria"),sx:{zIndex:T=>T.zIndex.modal},slotProps:{paper:{sx:{width:720,maxWidth:"100vw"}}},children:(0,un.jsxs)(Gn.Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,un.jsxs)(Gn.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1.5,flexShrink:0},children:[x({px:.5}),(0,un.jsx)(Gn.Box,{component:"input",autoFocus:!0,spellCheck:!1,value:O,placeholder:R,onChange:T=>a.setFormValue("title",T.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}}}),(0,un.jsx)(Gn.IconButton,{"aria-label":I("common.close"),onClick:u,sx:{color:"#6b7280"},children:(0,un.jsx)(Vz.default,{})})]}),(0,un.jsx)(Gn.Divider,{sx:{borderColor:De.NOTION_LINE_COLOR}}),(0,un.jsx)(Gn.Box,{sx:{flex:1,minHeight:0},children:(0,un.jsx)(Gz.default,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:(0,un.jsx)(sm,{...n,contentSyncKey:`create-${w}`})})}),(0,un.jsx)(Gn.Divider,{sx:{borderColor:De.NOTION_LINE_COLOR}}),(0,un.jsxs)(Gn.Box,{sx:{display:"flex",justifyContent:"flex-end",gap:.5,px:2,py:1.5,flexShrink:0},children:[(0,un.jsx)(Gn.Button,{onClick:u,color:"inherit",disabled:F,children:I("common.cancel")}),(0,un.jsx)(Gn.Button,{onClick:a.submit,variant:"contained",disabled:F,children:F?I("create.creating"):l??I("common.register")})]})]})}),(0,un.jsx)(Ji,{anchorEl:p,value:P,color:j,onSelect:T=>{a.setFormValue("icon",T),y(null)},onSelectColor:T=>a.setFormValue("icon_color",T),onClose:()=>y(null)})]})}pn();var ca=require("react"),An=require("@mui/material"),mj=v(require("@mui/icons-material/MoreVert"),1),hj=v(require("@mui/icons-material/DeleteOutline"),1),fj=v(require("@mui/icons-material/ShareOutlined"),1),pj=v(require("@mui/icons-material/HistoryOutlined"),1),gj=v(require("@ehfuse/overlay-scrollbar"),1),bj=require("@ehfuse/mui-form-dialog");pn();var wo=require("react"),$e=require("@mui/material"),oF=v(require("@mui/icons-material/ArrowUpwardRounded"),1),iF=require("@ehfuse/mui-form-controls"),Qc=v(require("@mui/icons-material/Close"),1),aF=v(require("@mui/icons-material/EditOutlined"),1),sp=v(require("@mui/icons-material/ContentCopyOutlined"),1),lp=v(require("@mui/icons-material/Check"),1),sF=v(require("@mui/icons-material/Favorite"),1),lF=v(require("@mui/icons-material/FavoriteBorderOutlined"),1),cF=v(require("@mui/icons-material/CheckCircle"),1),uF=v(require("@mui/icons-material/CheckCircleOutlineOutlined"),1),ws=v(require("@mui/icons-material/AttachFileOutlined"),1),dF=v(require("@mui/icons-material/AddCircleOutline"),1),mF=v(require("@mui/icons-material/ImageOutlined"),1);var op=e=>{if(e===0)return"0 Bytes";let u=1024,c=["Bytes","KB","MB","GB","TB"],l=Math.floor(Math.log(e)/Math.log(u));return parseFloat((e/Math.pow(u,l)).toFixed(2))+" "+c[l]};var so=require("react"),sa=require("@mui/material");_e();var Pi=require("react/jsx-runtime"),$z=8,Kz=[{key:"\uC88B\uC544\uC694",get label(){return I("emoji.like")},insert:"\u{1F44D}",keywords:["like","\uC5C4\uC9C0","\uAD7F"]},{key:"\uD655\uC778",get label(){return I("emoji.check")},insert:"\u2705",keywords:["check","\uC644\uB8CC","\uCCB4\uD06C"]},{key:"\uAC10\uC0AC",get label(){return I("emoji.thanks")},insert:"\u{1F64F}",keywords:["thanks","\uACE0\uB9C8\uC6CC","\uBD80\uD0C1"]},{key:"\uCD95\uD558",get label(){return I("emoji.party")},insert:"\u{1F389}",keywords:["party","\uD30C\uD2F0","\uC9DD\uC9DD"]},{key:"\uBC15\uC218",get label(){return I("emoji.clap")},insert:"\u{1F44F}",keywords:["clap","\uC798\uD588\uC5B4"]},{key:"\uD558\uD2B8",get label(){return I("emoji.heart")},insert:"\u2764\uFE0F",keywords:["heart","\uC0AC\uB791"]},{key:"\uC6C3\uC74C",get label(){return I("emoji.laugh")},insert:"\u{1F604}",keywords:["smile","\uC6C3\uAE40","\u314B\u314B"]},{key:"\uBBF8\uC18C",get label(){return I("emoji.smile")},insert:"\u{1F642}",keywords:["smile","\uC88B\uC74C"]},{key:"\uB208\uBB3C",get label(){return I("emoji.tears")},insert:"\u{1F622}",keywords:["sad","\uC2AC\uD514","\u3160\u3160"]},{key:"\uB180\uB78C",get label(){return I("emoji.wow")},insert:"\u{1F62E}",keywords:["wow","\uD5C9"]},{key:"\uACE0\uBBFC",get label(){return I("emoji.think")},insert:"\u{1F914}",keywords:["think","\uC0DD\uAC01","\uC74C"]},{key:"\uC624\uCF00\uC774",get label(){return I("emoji.ok")},insert:"\u{1F44C}",keywords:["ok","\uC54C\uACA0\uC5B4"]},{key:"\uBD88",get label(){return I("emoji.fire")},insert:"\u{1F525}",keywords:["fire","\uAE09\uD568","\uB300\uBC15"]},{key:"\uC544\uC774\uB514\uC5B4",get label(){return I("emoji.idea")},insert:"\u{1F4A1}",keywords:["idea","\uC804\uAD6C"]},{key:"\uACBD\uACE0",get label(){return I("emoji.warning")},insert:"\u26A0\uFE0F",keywords:["warning","\uC8FC\uC758"]},{key:"\uC9C8\uBB38",get label(){return I("emoji.question")},insert:"\u2753",keywords:["question","\uBB3C\uC74C"]},{key:"\uC2DC\uACC4",get label(){return I("emoji.clock")},insert:"\u23F0",keywords:["time","\uC2DC\uAC04","\uC54C\uB78C"]},{key:"\uB2EC\uB825",get label(){return I("emoji.calendar")},insert:"\u{1F4C5}",keywords:["calendar","\uC77C\uC815","\uB0A0\uC9DC"]},{key:"\uBA54\uBAA8",get label(){return I("emoji.note")},insert:"\u{1F4DD}",keywords:["note","\uAE30\uB85D"]},{key:"\uCCA8\uBD80",get label(){return I("emoji.attach")},insert:"\u{1F4CE}",keywords:["attach","\uD074\uB9BD","\uD30C\uC77C"]},{key:"\uB9C1\uD06C",get label(){return I("emoji.link")},insert:"\u{1F517}",keywords:["link","\uC8FC\uC18C"]},{key:"\uB85C\uCF13",get label(){return I("emoji.rocket")},insert:"\u{1F680}",keywords:["rocket","\uCD9C\uBC1C","\uBC30\uD3EC"]},{key:"\uBCC4",get label(){return I("emoji.star")},insert:"\u2B50",keywords:["star","\uC911\uC694"]},{key:"\uC5D1\uC2A4",get label(){return I("emoji.x")},insert:"\u274C",keywords:["x","\uC548\uB428","\uCDE8\uC18C"]}];function bl(e,u,c){let l=e.slice(0,u),a=(c==="@"?/(^|[\s(])@([^\s@]{0,20})$/:/(^|[\s(])\/([^\s/]{0,20})$/).exec(l);return a?{start:u-a[2].length-1,query:a[2]}:null}function lm(e,u){let c=it(),l=e??c.mentionCandidates??[],n=u??c.slashCommands,a=n===!0?Kz:Array.isArray(n)?n:[];return{people:l,commands:a,enabled:l.length>0||a.length>0}}function cm(e,u,c){if(!c)return[];let l=c.query.toLowerCase();return c.trigger==="@"?e.filter(n=>n.name.toLowerCase().includes(l)).slice(0,$z).map((n,a)=>({id:`p${a}-${n.name}`,text:`@${n.name} `,label:n.name,subtitle:n.subtitle,icon:(0,Pi.jsx)(eo,{src:n.avatar??"",name:n.name,avatarSx:{width:24,height:24,fontSize:14},iconFontSize:16})})):u.filter(n=>[n.key,n.label,...n.keywords??[]].some(a=>a.toLowerCase().includes(l))).slice(0,$z).map(n=>({id:`c-${n.key}`,text:n.insert,label:`/${n.label}`,icon:(0,Pi.jsx)(sa.Box,{component:"span",sx:{width:24,textAlign:"center",fontSize:18,lineHeight:1},children:n.insert})}))}function um({open:e,anchor:u,items:c,active:l,onPick:n,onHover:a}){return(0,Pi.jsx)(sa.Popper,{open:e,anchorEl:u,placement:"top-start",sx:{zIndex:1500},children:(0,Pi.jsx)(sa.Paper,{elevation:4,sx:{minWidth:220,maxWidth:320,py:.5,borderRadius:1.5},children:c.map((r,t)=>(0,Pi.jsxs)(sa.Box,{role:"option","aria-selected":t===l,onMouseDown:o=>o.preventDefault(),onClick:()=>n(r),onMouseEnter:()=>a(t),sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:.75,cursor:"pointer",fontSize:14,bgcolor:t===l?"action.selected":"transparent"},children:[r.icon,(0,Pi.jsx)(sa.Box,{component:"span",sx:{fontWeight:500,whiteSpace:"nowrap"},children:r.label}),r.subtitle?(0,Pi.jsx)(sa.Box,{component:"span",sx:{color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r.subtitle}):null]},r.id))})})}function ip({value:e,setValue:u,candidates:c,slashCommands:l}){let{people:n,commands:a,enabled:r}=lm(c,l),t=(0,so.useRef)(null),[o,d]=(0,so.useState)(null),[i,s]=(0,so.useState)(null),[h,f]=(0,so.useState)(0),m=(0,so.useMemo)(()=>cm(n,a,i),[a,n,i]),b=!!(o&&i&&m.length>0),g=(0,so.useCallback)(()=>{let M=t.current;if(!r||!M)return;let N=M.selectionStart??M.value.length,z=n.length>0?bl(M.value,N,"@"):null,W=!z&&a.length>0?bl(M.value,N,"/"):null,F=z?{...z,trigger:"@"}:W?{...W,trigger:"/"}:null;s(F),f(0),d(F?M.closest(".MuiInputBase-root")??M:null)},[a.length,r,n.length]),w=(0,so.useRef)(null);(0,so.useEffect)(()=>{let M=t.current,N=w.current;if(N!==null&&M){w.current=null,M.setSelectionRange(N,N);return}document.activeElement===M&&g()},[e,g]);let S=(0,so.useCallback)(M=>{let N=t.current;if(!i||!N)return;let z=N.selectionStart??e.length,W=e.slice(0,i.start)+M.text+e.slice(z),F=i.start+M.text.length;w.current=W===e?null:F,u(W),s(null),d(null),requestAnimationFrame(()=>{w.current=null,N.focus(),N.setSelectionRange(F,F)})},[i,u,e]),O=(0,so.useCallback)(M=>!b||M.nativeEvent.isComposing?!1:M.key==="ArrowDown"||M.key==="ArrowUp"?(M.preventDefault(),f(N=>(N+(M.key==="ArrowDown"?1:m.length-1))%m.length),!0):M.key==="Enter"||M.key==="Tab"?(M.preventDefault(),S(m[Math.min(h,m.length-1)]),!0):M.key==="Escape"?(M.preventDefault(),M.stopPropagation(),s(null),d(null),!0):!1,[h,m,b,S]);return{inputRef:(0,so.useCallback)(M=>{t.current=M},[]),onKeyDown:O,onSelectionChange:g,popper:r?(0,Pi.jsx)(um,{open:b,anchor:o,items:m,active:h,onPick:S,onHover:f}):null}}pn();var ii=require("react"),Mi=require("@mui/material");_e();var la=require("react/jsx-runtime"),Xz=[{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}"]}],DU="'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif",Yz="taskbox.recentEmojis",Zz=24;function Qz(){try{let e=JSON.parse(window.localStorage.getItem(Yz)??"[]");return Array.isArray(e)?e.filter(u=>typeof u=="string").slice(0,Zz):[]}catch{return[]}}function NU(e){let u=[e,...Qz().filter(c=>c!==e)].slice(0,Zz);try{window.localStorage.setItem(Yz,JSON.stringify(u))}catch{}return u}function Jz({onPick:e}){let[u,c]=(0,ii.useState)(()=>Qz()),[l,n]=(0,ii.useState)(0),a=(0,ii.useRef)(null),r=(0,ii.useRef)(!1),t=u.length>0?[{key:"recent",labelKey:"section.emojiFrequent",items:u},...Xz]:Xz,o=Math.min(l,t.length-1),d=(0,ii.useCallback)(h=>{c(NU(h)),e(h)},[e]),i=(0,ii.useCallback)(h=>{n(h);let f=a.current;f&&(r.current=!0,f.scrollTo({left:f.clientWidth*h,behavior:"smooth"}),window.setTimeout(()=>{r.current=!1},350))},[]),s=(0,ii.useCallback)(()=>{let h=a.current;if(!h||r.current||h.clientWidth===0)return;let f=Math.round(h.scrollLeft/h.clientWidth);n(m=>f!==m&&f>=0?f:m)},[]);return(0,ii.useEffect)(()=>{let h=a.current;h&&(h.scrollLeft=h.clientWidth*o)},[]),(0,la.jsxs)(Mi.Box,{children:[(0,la.jsx)(Mi.Tabs,{value:o,onChange:(h,f)=>i(f),variant:"scrollable",scrollButtons:!1,sx:{minHeight:36,borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,"& .MuiTab-root":{minHeight:36,minWidth:0,px:1.5,fontSize:13}},children:t.map(h=>(0,la.jsx)(Mi.Tab,{label:I(h.labelKey)},h.key))}),(0,la.jsx)(Mi.Box,{ref:a,onScroll:s,sx:{display:"flex",height:352,overflowX:"auto",overflowY:"hidden",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},children:t.map(h=>(0,la.jsx)(Mi.Box,{sx:{flex:"0 0 100%",width:"100%",height:"100%",overflowY:"auto",scrollSnapAlign:"start",scrollSnapStop:"always",p:1},children:(0,la.jsx)(Mi.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(40px, 1fr))"},children:h.items.map((f,m)=>(0,la.jsx)(Mi.Box,{component:"button",type:"button",onClick:()=>d(f),"aria-label":f,sx:{border:0,bgcolor:"transparent",color:"#000",cursor:"pointer",fontFamily:DU,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}-${m}`))})},h.key))})]})}pn();var xo=require("react"),mm=require("@mui/material"),nF=require("@ehfuse/editor");_e();var ai=require("react");var tF=require("react/jsx-runtime");function eF(e,u){let{people:c,commands:l,enabled:n}=lm(e,u),[a,r]=(0,ai.useState)(null),[t,o]=(0,ai.useState)(null),d=(0,ai.useRef)(""),[i,s]=(0,ai.useState)(0),h=(0,ai.useMemo)(()=>cm(c,l,a),[l,c,a]),f=!!(n&&t&&a&&h.length>0),m=(0,ai.useCallback)(()=>{if(!n)return;let S=window.getSelection();if(!S||S.rangeCount===0||!S.isCollapsed)return void r(null);let O=S.anchorNode;if(!O||O.nodeType!==Node.TEXT_NODE||!O.parentElement?.closest(".ehfuse-editor-content"))return void r(null);let P=O.data,j=S.anchorOffset,M=c.length>0?bl(P,j,"@"):null,N=!M&&l.length>0?bl(P,j,"/"):null,z=M?{...M,trigger:"@"}:N?{...N,trigger:"/"}:null;if(!z){d.current="",r(null),o(null);return}r({node:O,start:z.start,end:j,query:z.query,trigger:z.trigger});let W=`${z.trigger}${z.query}`;W!==d.current&&s(0),d.current=W;let F=document.createRange();F.setStart(O,z.start),F.setEnd(O,Math.min(z.start+1,P.length));let C=F.getBoundingClientRect();o({getBoundingClientRect:()=>C})},[l.length,n,c.length]),b=(0,ai.useCallback)(S=>{if(!a)return;let{node:O,start:P,end:j}=a;if(!O.isConnected)return void r(null);let M=window.getSelection(),N=document.createRange();N.setStart(O,P),N.setEnd(O,Math.min(j,O.data.length)),M?.removeAllRanges(),M?.addRange(N),document.execCommand("insertText",!1,S.text),r(null),o(null)},[a]);return{handlers:{onKeyDownCapture:(0,ai.useCallback)(S=>{!f||S.nativeEvent.isComposing||(S.key==="ArrowDown"||S.key==="ArrowUp"?(S.preventDefault(),S.stopPropagation(),s(O=>(O+(S.key==="ArrowDown"?1:h.length-1))%h.length)):S.key==="Enter"||S.key==="Tab"?(S.preventDefault(),S.stopPropagation(),b(h[Math.min(i,h.length-1)])):S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),r(null),o(null)))},[i,h,f,b]),onKeyUp:m,onMouseUp:m,onInput:m},popper:n?(0,tF.jsx)(um,{open:f,anchor:t,items:h,active:i,onPick:b,onHover:s}):null,isOpen:f}}function ks(e){return/^\s*<(p|div|ul|ol|h[1-6]|blockquote|pre)[\s>]/i.test(e)}var LU=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"]),zU=new Set(["background-color","color","text-decoration"]);function Xc(e){if(typeof DOMParser>"u")return"";let c=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html").body.firstElementChild;if(!c)return"";let l=n=>{for(let a of Array.from(n.children)){if(!LU.has(a.tagName)){if(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE"].includes(a.tagName)){a.remove();continue}l(a),a.replaceWith(...Array.from(a.childNodes));continue}for(let r of Array.from(a.attributes)){let t=r.name.toLowerCase();if(a.tagName==="A"&&t==="href"){/^(https?:|mailto:|tel:)/i.test(r.value.trim())||a.removeAttribute(r.name);continue}if(t==="style"){let o=r.value.split(";").map(d=>d.trim()).filter(d=>zU.has(d.split(":")[0]?.trim().toLowerCase()??"")&&!/url\(|expression/i.test(d)).join("; ");o?a.setAttribute("style",o):a.removeAttribute("style");continue}a.removeAttribute(r.name)}l(a)}};return l(c),c.innerHTML}function yl(e){if(typeof DOMParser>"u")return e.replace(/<[^>]*>/g,"");let u=e.replace(/<br\s*\/?>/gi,`
|
|
74
74
|
`).replace(/<\/(p|div|li|h[1-6]|blockquote|pre)>/gi,`
|
|
75
75
|
`).replace(/<li[^>]*>/gi,"\u2022 ");return(new DOMParser().parseFromString(u,"text/html").body.textContent??"").replace(/\n{3,}/g,`
|
|
76
76
|
|
|
@@ -83,7 +83,7 @@ use chrome, FireFox or Internet Explorer 11`)}var r=e("safe-buffer"),t=e("random
|
|
|
83
83
|
`).trim():"";_e();function xF(e){let u=[I("share.title",{title:e.title})],c=Ao(e.start_date),l=Ao(e.due_date);(c||l)&&u.push(I("share.period",{value:c&&l?`${c} ~ ${l}`:c||l})),e.manager_name&&u.push(I("share.owner",{manager_name:e.manager_name}));let n=xr(e).name;n&&u.push(I("share.status",{statusName:n}));let a=vF(e.content);a&&u.push("",a);let r=String(e.note??"").trim();return r&&u.push("",I("share.note",{note:r})),u.join(`
|
|
84
84
|
`)}function kF(e){navigator.clipboard.writeText(e).then(()=>(0,fm.SuccessAlert)(I("share.copied"))).catch(()=>(0,fm.InfoAlert)(I("share.copyFailed")))}function Ma(e,u,c){let l=xF(e);if(c){c(l);return}if(u&&typeof navigator.share=="function"){navigator.share({text:l}).catch(n=>{n?.name!=="AbortError"&&kF(l)});return}kF(l)}_e();var Xe=require("react/jsx-runtime");function gp({task:e,myAccountSeq:u=0,onToggleCompleted:c,hideCompleted:l=!1,kindLabel:n,displayTitle:a,onChangeTitle:r,onChangeIcon:t,onChangeIconColor:o,onClose:d,appBarMode:i=!1,activityItems:s,activityLoading:h,onLoadActivity:f,onPrint:m,onDelete:b,canDelete:g,headerExtra:w,titleStart:S,menuExtra:O}){ue();let P=Sn(),j=xl({taskSeq:e.seq,items:s,loading:h,onLoad:f}),[M,N]=(0,Ra.useState)(null),[z,W]=(0,Ra.useState)(null),[F,C]=(0,Ra.useState)(null),[B,R]=(0,Ra.useState)(null),[p,y]=(0,Ra.useState)(null),x=()=>R(null),[k,T]=(0,Ra.useState)(null),[_,D]=(0,Ra.useState)(null),H=!!e.is_notice,V=!!e.is_event,U=H?tn(e.icon||tr):V?tn(e.icon||kr):null,L=H&&u>0&&(e.author_account_seq??0)===u,{onReturnTask:G,onReviewDone:E,editPolicy:A,shareText:q}=it(),$=!!G&&Ur(e,u),Q=$&&!!E,X=!fi(e,u),Y=ea(e,u,A),te=u>0&&(e.author_account_seq??0)===u,Z=!!b&&(g??!wa(e,u,A,!te)),K=!l&&!V&&(H?L:(e.author_account_seq??0)===u||(e.manager_account_seq??0)===u);return(0,Xe.jsxs)(Xe.Fragment,{children:[i?(0,Xe.jsxs)(ft.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1.5,flexShrink:0},children:[i&&d?(0,Xe.jsx)(ft.IconButton,{"aria-label":I("common.back"),onClick:d,sx:{color:"#37352f",ml:-1},children:(0,Xe.jsx)(TF.default,{})}):null,K&&!i?(0,Xe.jsx)(ft.Tooltip,{title:e.completed&&e.completed_by?I("col.completedBy",{completed_by:e.completed_by,value:po(e.completed_time)}):"",arrow:!0,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:(0,Xe.jsxs)(ft.Box,{sx:{display:"flex",flexShrink:0,mr:1},children:[(0,Xe.jsx)(go,{onClick:J=>D({anchorEl:J.currentTarget,nextCompleted:!e.completed}),children:e.completed?$?I("task.revert"):I("menu.uncomplete"):I("detail.markDone")}),Q?(0,Xe.jsx)(ft.Button,{variant:"contained",size:"small",disableElevation:!0,onClick:J=>T(J.currentTarget),sx:{ml:1,...Ci},children:I("col.reviewDone")}):null]})}):null,i?(0,Xe.jsx)(ft.Box,{sx:{flex:1,minWidth:0,fontSize:18,fontWeight:500,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n??(H?I("detail.kindNotice"):V?I("kind.event"):e.is_bug?I("kind.bug"):I("kind.task"))}):(0,Xe.jsx)(ft.Box,{sx:{flex:1}}),(0,Xe.jsxs)(ft.Box,{sx:{display:"flex",alignItems:"center",flexShrink:0,"& .MuiIconButton-root":i?void 0:{p:.75}},children:[w?w(e):null,f?(0,Xe.jsx)(ft.Tooltip,{title:I("activity.title"),arrow:!0,children:(0,Xe.jsx)(ft.IconButton,{"aria-label":I("activity.title"),onClick:j.openDialog,sx:{color:"#6b7280"},children:(0,Xe.jsx)(fp.default,{sx:{fontSize:20}})})}):null,(0,Xe.jsx)(ft.Tooltip,{title:P?I("detail.share"):I("menu.copyContent"),arrow:!0,children:(0,Xe.jsx)(ft.IconButton,{"aria-label":P?I("detail.share"):I("menu.copyContent"),onClick:()=>Ma(e,P,q),sx:{color:"#6b7280"},children:P?(0,Xe.jsx)(hp.default,{sx:{fontSize:20}}):(0,Xe.jsx)(mp.default,{sx:{fontSize:20}})})}),m?(0,Xe.jsx)(ft.Tooltip,{title:I("common.print"),arrow:!0,children:(0,Xe.jsx)(ft.IconButton,{"aria-label":I("common.print"),onClick:()=>m(e),sx:{color:"#6b7280"},children:(0,Xe.jsx)(pp.default,{sx:{fontSize:20}})})}):null,Z?(0,Xe.jsx)(ft.Tooltip,{title:I("common.delete"),arrow:!0,children:(0,Xe.jsx)(ft.IconButton,{"aria-label":I("common.delete"),onClick:J=>C(J.currentTarget),sx:{color:"#6b7280","&:hover":{color:"#e5484d"}},children:(0,Xe.jsx)(Dr,{sx:{fontSize:20}})})}):null,d&&!i?(0,Xe.jsx)(ft.IconButton,{"aria-label":I("common.close"),onClick:d,sx:{color:"#6b7280"},children:(0,Xe.jsx)(dp.default,{})}):null]})]}):(0,Xe.jsxs)(ft.Box,{sx:{display:"flex",alignItems:"flex-start",gap:1,px:2,py:1.5,flexShrink:0,"& .MuiIconButton-root":{p:.75}},children:[K?(0,Xe.jsx)(ft.Tooltip,{title:e.completed&&e.completed_by?I("col.completedBy",{completed_by:e.completed_by,value:po(e.completed_time)}):"",arrow:!0,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:(0,Xe.jsxs)(ft.Box,{sx:{display:"flex",flexShrink:0,mr:1,alignSelf:"center"},children:[(0,Xe.jsx)(go,{onClick:J=>D({anchorEl:J.currentTarget,nextCompleted:!e.completed}),children:e.completed?$?I("task.revert"):I("menu.uncomplete"):I("detail.markDone")}),Q?(0,Xe.jsx)(ft.Button,{variant:"contained",size:"small",disableElevation:!0,onClick:J=>T(J.currentTarget),sx:{ml:1,...Ci},children:I("col.reviewDone")}):null]})}):null,S?(0,Xe.jsx)(ft.Box,{sx:{display:"flex",flexShrink:0,alignSelf:"center",ml:-.5},children:S(e)}):null,(0,Xe.jsxs)(ft.Box,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"flex-start",gap:1,alignSelf:"center"},children:[U?V&&!X?(0,Xe.jsx)(ft.Tooltip,{title:I("col.changeIcon"),arrow:!0,enterDelay:400,disableInteractive:!0,children:(0,Xe.jsx)(ft.ButtonBase,{onClick:J=>W(J.currentTarget),sx:{display:"flex",p:.5,borderRadius:1,color:e.icon_color||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:(0,Xe.jsx)(U,{sx:{fontSize:20}})})}):(0,Xe.jsx)(ft.Box,{sx:{display:"flex",px:.5,pt:.25,color:e.icon_color||(H?"#e5484d":"#1e3a8a")},children:(0,Xe.jsx)(U,{sx:{fontSize:20}})}):null,M!==null?(0,Xe.jsx)(ft.Box,{component:"input",autoFocus:!0,spellCheck:!1,value:M,onChange:J=>N(J.target.value),onBlur:()=>{M.trim()&&M.trim()!==e.title&&r(e.seq,M.trim()),N(null)},onKeyDown:J=>{J.key==="Enter"&&J.target.blur(),J.key==="Escape"&&N(null)},sx:{flex:1,minWidth:0,border:"none",outline:"none",font:"inherit",fontSize:18,fontWeight:500,lineHeight:1.5,color:"#37352f",p:0,m:0}}):(0,Xe.jsx)(ft.Box,{onClick:Y||a?void 0:()=>N(e.title),sx:{flex:1,minWidth:0,fontSize:18,fontWeight:500,lineHeight:1.5,color:"#37352f",wordBreak:"keep-all",overflowWrap:"anywhere",cursor:Y||a?"default":"text"},children:a||e.title})]}),(0,Xe.jsxs)(ft.Box,{sx:{display:"flex",alignItems:"center",flexShrink:0,alignSelf:"center"},children:[w?w(e):null,(0,Xe.jsx)(ft.Tooltip,{title:I("common.more"),arrow:!0,disableInteractive:!0,children:(0,Xe.jsx)(ft.IconButton,{"aria-label":I("common.more"),onClick:J=>{y(J.currentTarget),R(J.currentTarget)},sx:{color:"#6b7280"},children:(0,Xe.jsx)(wF.default,{sx:{fontSize:20}})})}),d?(0,Xe.jsx)(ft.IconButton,{"aria-label":I("common.close"),onClick:d,sx:{color:"#6b7280"},children:(0,Xe.jsx)(dp.default,{})}):null]})]}),i?null:(0,Xe.jsxs)(ft.Menu,{anchorEl:B,open:!!B,onClose:x,keepMounted:!0,transitionDuration:0,children:[f?(0,Xe.jsxs)(ft.MenuItem,{onClick:()=>{x(),j.openDialog()},children:[(0,Xe.jsx)(ft.ListItemIcon,{children:(0,Xe.jsx)(fp.default,{sx:{fontSize:20}})}),(0,Xe.jsx)(ft.ListItemText,{children:I("activity.title")})]}):null,(0,Xe.jsxs)(ft.MenuItem,{onClick:()=>{x(),Ma(e,P,q)},children:[(0,Xe.jsx)(ft.ListItemIcon,{children:P?(0,Xe.jsx)(hp.default,{sx:{fontSize:20}}):(0,Xe.jsx)(mp.default,{sx:{fontSize:20}})}),(0,Xe.jsx)(ft.ListItemText,{children:P?I("detail.share"):I("menu.copyContent")})]}),m?(0,Xe.jsxs)(ft.MenuItem,{onClick:()=>{x(),m(e)},children:[(0,Xe.jsx)(ft.ListItemIcon,{children:(0,Xe.jsx)(pp.default,{sx:{fontSize:20}})}),(0,Xe.jsx)(ft.ListItemText,{children:I("common.print")})]}):null,O?O(e,{anchorEl:p,closeMenu:x}):null,Z?(0,Xe.jsx)(ft.Divider,{}):null,Z?(0,Xe.jsxs)(ft.MenuItem,{onClick:()=>{x(),C(p)},sx:{color:"#e5484d"},children:[(0,Xe.jsx)(ft.ListItemIcon,{sx:{color:"inherit"},children:(0,Xe.jsx)(Dr,{sx:{fontSize:20}})}),(0,Xe.jsx)(ft.ListItemText,{children:I("common.delete")})]}):null]}),(0,Xe.jsx)(Ta,{anchorEl:k,onCancel:()=>T(null),onConfirm:()=>{E?.(e),T(null)}}),(0,Xe.jsx)(Bo,{open:!!_,anchorEl:_?.anchorEl??null,nextCompleted:_?.nextCompleted??!1,returnMode:$,onCancel:()=>D(null),onConfirm:J=>{_&&(J&&G?G(e,J):c(e.seq,_.nextCompleted)),D(null)}}),(0,Xe.jsx)(Ji,{anchorEl:z,value:e.icon??"",color:e.icon_color??"",onSelect:J=>{t(e.seq,J),W(null)},onSelectColor:o?J=>o(e.seq,J):void 0,onClose:()=>W(null)}),(0,Xe.jsx)(SF.ConfirmActionPopper,{open:!!F,anchorEl:F,title:I("detail.trashConfirm"),confirmText:I("common.delete"),onCancel:()=>C(null),onConfirm:()=>{C(null),b?.(e)}}),(0,Xe.jsx)(Jc,{controller:j})]})}pn();var gr=require("react");var wl=require("react"),$U=5e3,KU=15e3,XU=25;function CF(e){let u=e.replace(/<[^>]*>/g," ").replace(/ /g," ").replace(/\s+/g," ").trim();return Math.min(KU,Math.max($U,Math.round(u.length/XU*1e3)))}var bp=!1;typeof window<"u"&&(window.addEventListener("blur",()=>{bp=!0}),window.addEventListener("focus",()=>{bp=!1}));function YU(){return typeof document>"u"?!1:document.visibilityState==="visible"&&!bp}function _F(e,u,c,l){let[n,a]=(0,wl.useState)(0),r=(0,wl.useRef)(l);return r.current=l,(0,wl.useEffect)(()=>{if(a(0),!u||c<=0)return;let t=0,o=Date.now(),d=!1,s=setInterval(()=>{let h=Date.now(),f=Math.min(h-o,1e3);o=h,!(d||!YU())&&(t+=f,a(Math.min(1,t/c)),t>=c&&(d=!0,r.current()))},250);return()=>clearInterval(s)},[e,u,c]),u?n:0}var ut=require("@mui/material"),KF=v(require("@mui/icons-material/DoneOutlined"),1),XF=v(require("@mui/icons-material/ExpandLess"),1),YF=v(require("@mui/icons-material/ExpandMore"),1),ZF=v(require("@mui/icons-material/ConfirmationNumberOutlined"),1),QF=v(require("@mui/icons-material/FactCheckOutlined"),1),Sp=v(require("@mui/icons-material/Check"),1),JF=v(require("@mui/icons-material/DirectionsRunOutlined"),1),ej=v(require("@mui/icons-material/SpeedOutlined"),1),Sm=v(require("@mui/icons-material/CheckCircle"),1),tj=v(require("@mui/icons-material/CheckCircleOutlineOutlined"),1),Cm=v(require("@mui/icons-material/CheckCircleOutlined"),1),Cp=v(require("@mui/icons-material/AccessTimeOutlined"),1),nj=v(require("@mui/icons-material/AutorenewOutlined"),1),rj=v(require("@mui/icons-material/LabelOutlined"),1),oj=v(require("@mui/icons-material/PersonOutlineOutlined"),1),ij=v(require("@mui/icons-material/SubjectOutlined"),1),aj=v(require("@mui/icons-material/StickyNote2Outlined"),1),sj=v(require("@mui/icons-material/PanToolAltOutlined"),1),_p=v(require("@mui/icons-material/LockOutlined"),1),Ip=v(require("@mui/icons-material/PublicOutlined"),1),Bp=v(require("@mui/icons-material/Group"),1),lj=v(require("@mui/icons-material/Repeat"),1),cj=v(require("@mui/icons-material/EventOutlined"),1);var IF=require("@mui/material"),BF=require("react/jsx-runtime");function pm({size:e=40}){return(0,BF.jsx)(IF.Box,{sx:{boxSizing:"border-box",width:e,height:e,borderRadius:"50%",border:"4px solid rgba(28, 64, 125, 0.14)",borderTopColor:"#1c407d",animation:"taskbox-content-loading-spin 0.75s linear infinite","@keyframes taskbox-content-loading-spin":{to:{transform:"rotate(360deg)"}}}})}var vm=require("react"),Un=require("@mui/material"),ym=v(require("@mui/icons-material/Check"),1),AF=require("@ehfuse/mui-confirm-action"),EF=require("@ehfuse/mui-form-dialog"),PF=v(require("@mui/icons-material/Translate"),1),vp=v(require("@mui/icons-material/ContentCopyOutlined"),1);_e();var Tl=require("react"),gm=require("@ehfuse/forma");_e();var yp=new Map,ZU={target:"",doneTargets:[],result:null,loading:!1,error:"",copied:!1,summaryCopied:!1};function bm(e){ue();let u=(0,Tl.useRef)(e);u.current=e;let{translateContent:c}=it(),l=(0,Tl.useRef)(c);l.current=c;let n=(0,Tl.useRef)(0),a={translate:(0,gm.useModal)({modalId:Dt("taskbox-content-translate"),onClose:()=>{n.current+=1}})},r=(0,gm.useFormaState)(ZU);(0,Tl.useEffect)(()=>{n.current+=1,r.setValue("target","")},[e.taskSeq]);let t=h=>(u.current.translatedTargets??[]).includes(h)||(r.getValue("doneTargets")??[]).includes(h)||yp.has(`${u.current.taskSeq}:${h}`),o=h=>{r.setValue("target",h);let f=++n.current,m=u.current.taskSeq,b=l.current;if(!b||!(m>0)||!h)return;let g=`${m}:${h}`,w=yp.get(g);if(w){r.setValues({result:w,error:""});return}r.setValues({loading:!0,error:"",result:null}),b({taskSeq:m,target:h}).then(S=>{if(f!==n.current)return;yp.set(g,S);let O=r.getValue("doneTargets")??[];O.includes(h)||r.setValue("doneTargets",[...O,h]),r.setValue("result",S)}).catch(S=>{f===n.current&&r.setValue("error",S instanceof Error?S.message:I("translate.failed"))}).finally(()=>{f===n.current&&r.setValue("loading",!1)})},d=()=>{r.setValue("target",""),a.translate.open()},i=()=>{let h=r.getValue("result");h?.summary&&navigator.clipboard.writeText(h.summary).then(()=>{r.setValue("summaryCopied",!0),window.setTimeout(()=>r.setValue("summaryCopied",!1),1500)})},s=()=>{let h=r.getValue("result");if(!h)return;let f=h.html?Ea(h.html):h.text;navigator.clipboard.writeText(`${h.title}
|
|
85
85
|
|
|
86
|
-
${f}`.trim()).then(()=>{r.setValue("copied",!0),window.setTimeout(()=>r.setValue("copied",!1),1500)})};return{modals:a,ui:r,taskSeq:e.taskSeq,isStored:t,selectTarget:o,openDialog:d,copySummary:i,copyResult:s}}var yn=require("react/jsx-runtime"),OF=[{code:"en",get label(){return I("lang.en")}},{code:"ja",get label(){return I("lang.ja")}},{code:"zh",get label(){return I("lang.zh")}},{code:"zh-TW",get label(){return I("lang.zhTW")}},{code:"vi",get label(){return I("lang.vi")}},{code:"th",get label(){return I("lang.th")}},{code:"ko",get label(){return I("lang.ko")}}];function kp({controller:e,title:u,html:c}){ue();let l=e.modals.translate,{ui:n}=e,a=String(n.useValue("target")??"");n.useValue("doneTargets");let r=n.useValue("result"),t=!!n.useValue("loading"),o=String(n.useValue("error")??""),d=!!n.useValue("copied"),i=!!n.useValue("summaryCopied"),[s,h]=(0,vm.useState)(null),f=(b,g)=>{if(b!==a){if(b===""||e.isStored(b)){e.selectTarget(b);return}h({code:b,anchor:g})}};(0,vm.useEffect)(()=>{l.isOpen&&h(null)},[l.isOpen,e.taskSeq]);let m=(0,yn.jsxs)(Un.Box,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[(0,yn.jsx)(Un.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.75},children:[{code:"",label:I("translate.original")},...OF].map(b=>(0,yn.jsx)(Un.Chip,{label:b.label,clickable:!0,icon:b.code&&e.isStored(b.code)?(0,yn.jsx)(ym.default,{sx:{fontSize:16}}):void 0,onClick:g=>f(b.code,g.currentTarget),color:a===b.code?"primary":"default",variant:a===b.code?"filled":"outlined",sx:{fontSize:14,height:30}},b.code||"__source__"))}),(0,yn.jsx)(AF.ConfirmActionPopper,{open:!!s,anchorEl:s?.anchor??null,title:I("translate.startConfirm",{value:OF.find(b=>b.code===s?.code)?.label??""}),confirmText:I("translate.start"),cancelText:I("common.cancel"),placement:"bottom-start",onCancel:()=>h(null),onConfirm:()=>{s&&e.selectTarget(s.code),h(null)}}),a?t?(0,yn.jsx)(Un.Box,{sx:{minHeight:200,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,yn.jsx)(pm,{})}):o?(0,yn.jsx)(Un.Box,{sx:{fontSize:15,color:"#c62828",py:2},children:o}):r?(0,yn.jsxs)(Un.Box,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[r.summary?(0,yn.jsxs)(Un.Box,{sx:{position:"relative",display:"flex",alignItems:"center",gap:2,px:1.5,pr:5,py:1.25,bgcolor:"#eef4ff",border:"1px solid #c7d7fe",borderRadius:1},children:[(0,yn.jsx)(Un.Tooltip,{title:I("translate.copySummary"),arrow:!0,children:(0,yn.jsx)(Un.IconButton,{size:"small","aria-label":I("translate.copySummary"),onClick:e.copySummary,sx:{position:"absolute",top:4,right:4,color:"#64748b"},children:i?(0,yn.jsx)(ym.default,{sx:{fontSize:18,color:"#2f9e5b"}}):(0,yn.jsx)(vp.default,{sx:{fontSize:18}})})}),(0,yn.jsx)(PF.default,{sx:{fontSize:30,color:"#2563eb",flexShrink:0,mx:1.5}}),(0,yn.jsxs)(Un.Box,{sx:{flex:1,minWidth:0},children:[(0,yn.jsx)(Un.Box,{sx:{fontSize:16,fontWeight:600,color:"#1e3a8a"},children:I("translate.aiNotice")}),(0,yn.jsx)(Un.Box,{sx:{fontSize:15,color:"#111",mt:.25,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:r.summary})]})]}):null,(0,yn.jsx)(Un.Box,{sx:{fontSize:18,fontWeight:700,color:"#111",wordBreak:"break-word"},children:r.title}),r.html?(0,yn.jsx)(Un.Box,{sx:{fontSize:16,lineHeight:1.6,color:"#37352f",wordBreak:"break-word","& > p:first-of-type":{mt:0},"& > p:last-of-type":{mb:0},"& a[href]":{color:"#2563eb",textDecoration:"underline"},"& img":{maxWidth:"100%"}},dangerouslySetInnerHTML:{__html:r.html}}):(0,yn.jsx)(Un.Box,{sx:{fontSize:16,lineHeight:1.6,color:"#37352f",whiteSpace:"pre-wrap"},children:r.text})]}):null:(0,yn.jsxs)(Un.Box,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[(0,yn.jsx)(Un.Box,{sx:{fontSize:18,fontWeight:700,color:"#111",wordBreak:"break-word"},children:u}),(0,yn.jsx)(Un.Box,{sx:{fontSize:16,lineHeight:1.6,color:"#37352f",wordBreak:"break-word","& > p:first-of-type":{mt:0},"& > p:last-of-type":{mb:0},"& a[href]":{color:"#2563eb",textDecoration:"underline"},"& img":{maxWidth:"100%"}},dangerouslySetInnerHTML:{__html:c||"<p></p>"}})]})]});return(0,yn.jsx)(EF.FormDialog,{open:l.isOpen,onClose:l.close,width:760,title:I("translate.title"),locale:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-content-translate",maxContentHeight:"80vh",sectionContentPaddingTop:0,sections:[{id:"translate",showTitle:!1,children:m}],actions:{showCancelButton:!1,left:a&&r?(0,yn.jsx)(Un.Button,{variant:"outlined",color:"inherit",startIcon:d?(0,yn.jsx)(ym.default,{sx:{fontSize:18,color:"#2f9e5b"}}):(0,yn.jsx)(vp.default,{sx:{fontSize:18}}),onClick:e.copyResult,sx:{minWidth:80,color:"#37352f",borderColor:"#d9d9d6"},children:I("common.copy")}):void 0,right:(0,yn.jsx)(Un.Button,{variant:"contained",onClick:l.close,sx:{minWidth:80},children:I("common.close")})}})}var uj=require("@ehfuse/mui-confirm-action");var dj=require("@ehfuse/mui-datetime-picker");var MF=require("react"),RF=require("@ehfuse/mui-form-controls");_e();var DF=require("react/jsx-runtime");function xp({value:e,onCommit:u,onDraftChange:c,readOnly:l=!1}){ue();let[n,a]=(0,MF.useState)(null);return(0,DF.jsx)(RF.TextField,{value:n??e,placeholder:l?"":I("create.notePlaceholder"),fullWidth:!0,size:"medium",slotProps:{input:{readOnly:l}},onChange:r=>{a(r.target.value),c?.(r.target.value)},onBlur:()=>{n!==null&&n.trim()!==e&&u(n),a(null)},onKeyDown:r=>{r.key==="Enter"&&r.target.blur(),r.key==="Escape"&&a(null)},sx:{mt:1}})}var Ri=require("@mui/material"),NF=v(require("@mui/icons-material/PieChartOutlineOutlined"),1),LF=v(require("@mui/icons-material/PersonOutlineOutlined"),1),zF=v(require("@mui/icons-material/PeopleAltOutlined"),1),km=require("@ehfuse/mui-form-controls");_e();var Or=require("react/jsx-runtime");function QU(e){return e.getFormValue("contributions")??{}}function JU({form:e,participants:u}){ue();let c=e.useFormValue("contributions")??{},l=Lu(c,u),n=l===100;return(0,Or.jsxs)(Ri.Box,{component:"span","data-testid":"task-contribution-total",sx:{fontSize:14,fontWeight:400,color:n?"#787774":"error.main",whiteSpace:"nowrap"},children:[I("section.total")," ",l,"%",n?"":I("section.mustBe100")]})}function FF({form:e,participants:u,readOnly:c,avatarSrcByName:l,onSave:n}){ue();let a=()=>{let t=QU(e);Lu(t,u)===100&&n(zu(t,u))},r=()=>{let t=Nu(u.length),o={};u.forEach((d,i)=>{o[String(d.account_seq)]=String(t[i])}),e.setFormValue("contributions",o),n(zu(o,u))};return(0,Or.jsx)(ko,{icon:(0,Or.jsx)(NF.default,{sx:{fontSize:18,display:"block"}}),title:I("section.contribution"),titleExtra:u.length>0?(0,Or.jsxs)(Ri.Box,{sx:{ml:"auto",display:"flex",alignItems:"center",gap:1,minWidth:0},children:[(0,Or.jsx)(JU,{form:e,participants:u}),!c&&u.length>1?(0,Or.jsx)(Ri.Button,{size:"small",onClick:r,sx:{fontSize:"0.875rem",flexShrink:0,whiteSpace:"nowrap"},children:I("section.splitEvenly")}):null]}):null,children:u.length===0?(0,Or.jsx)(Ri.Box,{sx:{fontSize:14,color:"#9a9a97",py:.5},children:I("section.contributionHint")}):(0,Or.jsx)(Xi,{name:"contributions",children:(0,Or.jsx)(km.PropertyGrid,{children:u.map(t=>(0,Or.jsx)(Ot,{icon:t.role==="manager"?(0,Or.jsx)(LF.default,{sx:{fontSize:17}}):(0,Or.jsx)(zF.default,{sx:{fontSize:17}}),label:t.role==="manager"?I("col.owner"):I("col.cc"),onClick:c?void 0:o=>o.querySelector("input")?.focus(),children:(0,Or.jsxs)(Ri.Box,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%",minWidth:0},children:[(0,Or.jsx)(to,{names:[t.name],size:20,avatarSrcByName:l}),(0,Or.jsx)(Ri.Box,{component:"span",sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name||I("workload.noName")}),(0,Or.jsxs)(Ri.Box,{sx:{display:"inline-flex",alignItems:"baseline",flexShrink:0},children:[(0,Or.jsx)(km.PropertyInput,{form:e,name:`contributions.${t.account_seq}`,appearance:Ba,inputMode:"numeric",maxLength:3,placeholder:"0",readOnly:c,parse:o=>{let d=Zl(o===""?"0":o);return d===null?null:String(d)},onCommit:()=>a(),sx:{flex:"0 0 auto",width:"3ch",textAlign:"right"}}),(0,Or.jsx)(Ri.Box,{component:"span",sx:{ml:.25},children:"%"})]})]})},t.account_seq))})})})}pn();var Sl=require("react"),Jn=require("@mui/material"),qF=v(require("@mui/icons-material/AccountTreeOutlined"),1),HF=v(require("@mui/icons-material/LinkOutlined"),1),WF=v(require("@mui/icons-material/Close"),1),VF=v(require("@mui/icons-material/RedoOutlined"),1);function Da(e){return e.relations??[]}function e$(e,u,c){return Da(e).some(l=>l.type===c&&l.task_seq===u.seq)||Da(u).some(l=>l.type===c&&l.task_seq===e.seq)}function jF(e){return`${e.created_time??""}|${String(e.seq).padStart(12,"0")}`}function xm(e,u){let c=new Map(u.map(m=>[m.seq,m]));c.set(e.seq,e);let l=new Map,n=(m,b)=>{l.has(m)||l.set(m,new Set),l.has(b)||l.set(b,new Set),l.get(m).add(b),l.get(b).add(m)};for(let m of c.values())for(let b of Da(m))b.type==="follow_up"&&c.has(b.task_seq)&&n(m.seq,b.task_seq);let a=new Set([e.seq]),r=[e.seq];for(;r.length>0;){let m=r.shift();for(let b of l.get(m)??[])a.has(b)||(a.add(b),r.push(b))}let t=[...a].map(m=>c.get(m)).filter(m=>!!m).sort((m,b)=>jF(m).localeCompare(jF(b))),o=new Set;for(let m of Da(e))m.type==="related"&&o.add(m.task_seq);for(let m of c.values())m.seq!==e.seq&&Da(m).some(b=>b.type==="related"&&b.task_seq===e.seq)&&o.add(m.seq);let d=[...o].map(m=>c.get(m)).filter(m=>m!==void 0&&m.seq!==e.seq),i=[...c.values()].filter(m=>m.seq!==e.seq&&Da(m).some(b=>b.type==="duplicate_of"&&b.task_seq===e.seq)),s=Da(e).find(m=>m.type==="duplicate_of")?.task_seq,h=s?c.get(s)??null:null,f=[...c.values()].filter(m=>m.seq!==e.seq&&(m.checklist??[]).some(b=>Number(b.task_seq??0)===e.seq));return{lineage:t,related:d,duplicates:i,duplicateOf:h,parents:f}}function wm(e,u){let c=xm(e,u);return(c.lineage.length>=2?c.lineage.length-1:0)+c.related.length+c.duplicates.length+(c.duplicateOf?1:0)+c.parents.length}function wp(e,u){return wm(e,u)>0}var GF=require("@ehfuse/mui-confirm-action");_e();var Ht=require("react/jsx-runtime");function Tm({item:e,caption:u,onOpen:c,onUnlink:l}){ue();let n=e.is_notice||e.is_event?tn(e.icon||(e.is_notice?tr:kr)):null;return(0,Ht.jsxs)(Jn.Box,{sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.5,borderRadius:1,"&:hover":{bgcolor:"#f7f7f5"},"&:hover .taskbox-relation-unlink":{opacity:1}},children:[u?(0,Ht.jsx)(Jn.Box,{component:"span",sx:{flexShrink:0,px:.6,py:.1,borderRadius:.75,fontSize:11.5,fontWeight:500,color:"#8a6d1d",bgcolor:"#faf1d7"},children:u}):null,n?(0,Ht.jsx)(n,{sx:{fontSize:16,flexShrink:0,color:e.icon_color||"#1e3a8a"}}):null,(0,Ht.jsxs)(Jn.Box,{component:"span",onClick:c,sx:{flex:1,minWidth:0,fontSize:14,color:e.completed?"#9a9a97":"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...c?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}},children:[e.ticket_no?`${e.ticket_no} `:"",e.title]}),e.manager_name?.trim()?(0,Ht.jsx)(Jn.Box,{component:"span",sx:Wc,children:e.manager_name.trim()}):null,(0,Ht.jsx)(Tn,{option:xr(e),small:!0}),l?(0,Ht.jsx)(Jn.IconButton,{className:"taskbox-relation-unlink",size:"small","aria-label":I("section.unlink"),onClick:l,sx:{opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:(0,Ht.jsx)(WF.default,{sx:{fontSize:15}})}):null]})}function Tp({task:e,tasks:u,readOnly:c=!1,onOpenTask:l,onLink:n,onUnlink:a,onCreateFollowUp:r}){ue();let t=ml({onSubmit:(b,g)=>n?.(e.seq,b,g)}),[o,d]=(0,Sl.useState)(null),i=(0,Sl.useMemo)(()=>xm(e,u),[e,u]),s=i.lineage.length>=2,h=(0,Sl.useMemo)(()=>wm(e,u),[e,u]),f=(0,Sl.useMemo)(()=>{let b=new Set;for(let g of i.lineage)b.add(g.seq);for(let g of i.related)b.add(g.seq);for(let g of i.duplicates)b.add(g.seq);for(let g of i.parents)b.add(g.seq);return i.duplicateOf&&b.add(i.duplicateOf.seq),[...b]},[i]),m=(b,g,w)=>{d({anchorEl:b,targetSeq:g,type:w})};return(0,Ht.jsxs)(ko,{icon:(0,Ht.jsx)(qF.default,{sx:{fontSize:19,display:"block"}}),title:(0,Ht.jsxs)(Ht.Fragment,{children:[I("section.relatedTasks"),h>0?(0,Ht.jsx)(Jn.Box,{component:"span",sx:{fontSize:12.5,color:"#9a9a97"},children:h}):null]}),titleExtra:c?null:(0,Ht.jsxs)(Jn.Box,{sx:{ml:"auto",display:"flex",alignItems:"center",gap:.5},children:[r?(0,Ht.jsx)(Jn.Button,{size:"small",color:"inherit",startIcon:(0,Ht.jsx)(VF.default,{sx:{fontSize:16}}),onClick:()=>r(e.seq),sx:{minWidth:0,px:1,fontSize:12.5,color:"#787774"},children:I("section.followUps")}):null,n?(0,Ht.jsx)(Jn.Button,{size:"small",color:"inherit",startIcon:(0,Ht.jsx)(HF.default,{sx:{fontSize:16}}),onClick:t.openDialog,sx:{minWidth:0,px:1,fontSize:12.5,color:"#787774"},children:I("link.confirm")}):null]}),children:[(0,Ht.jsxs)(Jn.Box,{sx:{display:"flex",flexDirection:"column",mt:.5,pl:3.25},children:[s?(0,Ht.jsx)(Jn.Box,{sx:{mb:i.related.length||i.duplicates.length||i.duplicateOf?1:0},children:i.lineage.map((b,g)=>{let w=b.seq===e.seq,S=g===i.lineage.length-1;return(0,Ht.jsxs)(Jn.Box,{sx:{display:"flex",gap:1},children:[(0,Ht.jsxs)(Jn.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",width:14,flexShrink:0,pt:1.1},children:[(0,Ht.jsx)(Jn.Box,{sx:{width:w?9:7,height:w?9:7,borderRadius:"50%",bgcolor:w?"#2f80ed":b.completed?"#9a9a97":"#c9c8c5",flexShrink:0}}),S?null:(0,Ht.jsx)(Jn.Box,{sx:{width:"2px",flex:1,bgcolor:De.NOTION_LINE_COLOR}})]}),(0,Ht.jsxs)(Jn.Box,{sx:{flex:1,minWidth:0,pb:S?0:.5},children:[(0,Ht.jsxs)(Jn.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[(0,Ht.jsxs)(Jn.Box,{component:"span",onClick:!w&&l?()=>l(b.seq):void 0,sx:{minWidth:0,fontSize:14,fontWeight:w?600:400,color:w?"#2f80ed":b.completed?"#9a9a97":"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...!w&&l?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}},children:[b.ticket_no?`${b.ticket_no} `:"",b.title]}),b.manager_name?.trim()?(0,Ht.jsx)(Jn.Box,{component:"span",sx:Wc,children:b.manager_name.trim()}):null,(0,Ht.jsx)(Tn,{option:xr(b),small:!0})]}),(0,Ht.jsx)(Jn.Box,{sx:{fontSize:12,color:"#9a9a97"},children:b.completed&&b.completed_time?I("section.completedAt",{completed_time:b.completed_time}):b.created_time??""})]})]},b.seq)})}):null,i.parents.map(b=>(0,Ht.jsx)(Tm,{item:b,caption:I("section.parentTask"),onOpen:l?()=>l(b.seq):void 0},`parent-${b.seq}`)),i.duplicateOf?(0,Ht.jsx)(Tm,{item:i.duplicateOf,caption:I("section.original"),onOpen:l?()=>l(i.duplicateOf.seq):void 0,onUnlink:!c&&a?b=>m(b.currentTarget,i.duplicateOf.seq,"duplicate_of"):void 0}):null,i.duplicates.map(b=>(0,Ht.jsx)(Tm,{item:b,caption:I("section.duplicate"),onOpen:l?()=>l(b.seq):void 0,onUnlink:!c&&a?g=>m(g.currentTarget,b.seq,"duplicate_of"):void 0},`dup-${b.seq}`)),i.related.map(b=>(0,Ht.jsx)(Tm,{item:b,onOpen:l?()=>l(b.seq):void 0,onUnlink:!c&&a?g=>m(g.currentTarget,b.seq,"related"):void 0},`rel-${b.seq}`)),h===0?(0,Ht.jsx)(Jn.Box,{sx:{px:1.25,py:.75,fontSize:13.5,color:"#9a9a97"},children:I("section.noLinks")}):null]}),n?(0,Ht.jsx)(Hc,{controller:t,task:e,tasks:u,excludeSeqs:f}):null,(0,Ht.jsx)(GF.ConfirmActionPopper,{open:!!o,anchorEl:o?.anchorEl??null,title:I("section.unlinkConfirm"),confirmText:I("task.unmark"),onCancel:()=>d(null),onConfirm:()=>{o&&a?.(e.seq,o.targetSeq,o.type),d(null)}})]})}_e();var se=require("react/jsx-runtime");function Na({label:e=I("menu.empty")}){return ue(),(0,se.jsx)(ut.Box,{component:"span",sx:{color:"#9a9a97"},children:e})}function UF({store:e}){return(0,se.jsx)(se.Fragment,{children:ju(e)})}function t$({store:e}){let u=ju(e);return u==null||u===!1?null:(0,se.jsx)(ut.Box,{sx:[ri(13),Ln(2)],children:u})}function $F({store:e,children:u}){return(0,se.jsx)(se.Fragment,{children:u(ju(e))})}function n$(e){let u=(0,gr.useRef)(e);u.current=e;let c=(0,gr.useRef)(new Map),l={};for(let[n,a]of Object.entries(e)){if(typeof a!="function"){l[n]=a;continue}let r=c.current.get(n);r||(r=(...t)=>u.current[n]?.(...t),c.current.set(n,r)),l[n]=r}return l}function Op(e,u){if(e===u)return!0;if(Array.isArray(e)&&Array.isArray(u))return e.length!==u.length?!1:e.every((c,l)=>c===u[l]||Op(c,u[l]));if(e&&u&&typeof e=="object"&&typeof u=="object"&&Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(u)===Object.prototype)try{return JSON.stringify(e)===JSON.stringify(u)}catch{return!1}return!1}var r$=new Set([...Qa,"reminder","is_read"]);function o$(e,u){if(e===u)return!0;let c=!!(e.is_bug||u.is_bug),l=e,n=u,a=new Set([...Object.keys(l),...Object.keys(n)]);for(let r of a)if(!(r$.has(r)&&!(c&&r==="status"))&&!Op(l[r],n[r]))return!1;return!0}function i$(e,u){let c=e,l=u,n=new Set([...Object.keys(c),...Object.keys(l)]);for(let a of n){let r=c[a],t=l[a];if(a==="task"){if(!o$(r,t))return!1;continue}if(typeof r=="function"||typeof t=="function"){if(typeof r!=typeof t)return!1;continue}if(!Op(r,t))return!1}return!0}function a$({form:e,task:u,locked:c,options:l,onSelect:n}){ue();let[a,r]=(0,gr.useState)(null);return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(Ot,{icon:(0,se.jsx)(nj.default,{sx:{fontSize:17}}),label:I("col.status"),onClick:c?void 0:t=>r(t),children:(0,se.jsx)(jo,{form:e,name:"status",children:t=>(0,se.jsx)(jo,{form:e,name:"resolution",children:o=>(0,se.jsx)(Tn,{option:xr({...u,status:t,resolution:o})})})})}),(0,se.jsx)(rs,{anchorEl:a,value:e.getFormValue("status"),options:l,onSelect:n,onClose:()=>r(null)})]})}function s$({form:e,locked:u,labelOptions:c,onChange:l,onAddLabel:n}){ue();let[a,r]=(0,gr.useState)(null);return(0,se.jsx)(jo,{form:e,name:"label_keys",children:t=>(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(Ot,{icon:(0,se.jsx)(rj.default,{sx:{fontSize:17}}),label:I("dialog.label"),onClick:u?void 0:o=>r(o),children:t.length>0?(0,se.jsx)(Yi,{labelKeys:t,labelOptions:c}):(0,se.jsx)(Na,{})}),(0,se.jsx)($c,{anchorEl:a,selectedKeys:t,labelOptions:c,onToggle:o=>l(cc(t,o)),onAddLabel:n,onClose:()=>r(null)})]})})}function Ap({leadingContent:e,contentTitleExtra:u,propertyExtra:c,relatedTasksPool:l,...n}){let a=Fu(n.task),r=Ql(e),t=Ql(u),o=Ql(c),d=Ql(l),i=(0,gr.useRef)({leading:r,titleExtra:t,propertyExtra:o,pool:d}),s=n$(n);return(0,se.jsx)(Bh.Provider,{value:a,children:(0,se.jsx)(l$,{...s,slots:i.current})})}var l$=(0,gr.memo)(function({slots:u,task:c,customTabs:l,statusOptions:n,avatarSrcByName:a,onChangeStatus:r,onChangeLabels:t,onAddLabelOption:o,onChangeProject:d,onAddProject:i,onChangeDate:s,onChangeReminder:h,onMemberEdit:f,onChangePriority:m,onChangeVisibility:b,onChangeRepeat:g,departments:w=[],onChangeEventTime:S,onChangeEventPlace:O,onChangeEventAddress:P,onChangeNote:j,onChangeNoteDraft:M,onChangeContent:N,contentTemplates:z,onSaveContentTemplate:W,onRemoveContentTemplate:F,contentLoading:C=!1,onAddChecklistItem:B,onToggleChecklistItem:R,onRemoveChecklistItem:p,onUpdateChecklistItem:y,onReorderChecklist:x,onConvertChecklistToTask:k,onOpenChecklistTask:T,onLinkChecklistTask:_,resolveChecklistTask:D,onOpenRelatedTask:H,onLinkRelatedTask:V,onUnlinkRelatedTask:U,onCreateFollowUpTask:L,onAddAttachments:G,onRemoveAttachment:E,onReorderAttachments:A,onPreview:q,onDownload:$,onUpdateComment:Q,onRemoveComment:X,onToggleCommentReaction:Y,currentUserName:te="",myAccountSeq:Z=0,headerless:K=!1,noticeAdmin:J=!1,hideProject:ee=!1,hideProperties:ie=!1,postMode:ae=!1,hideLabel:le=!1,showTitle:ce=!1,displayTitle:ye,onChangeTitle:ke,onToggleCompleted:xe,onChangeIcon:qe,onChangeIconColor:Be,employees:ge=[],onAckConfirm:ze,onRequestConfirm:Le,onChangeBugField:Oe,sprints:Ze=[],sprintProject:Re=!1,hideSprint:Ie=!1,onChangeSprint:kt,onChangeStoryPoints:We,onChangeResolution:st,onClaimTask:Xn,onVerifyBug:et,contributionEnabled:lt=!1,onChangeContributions:Nt}){ue();let{form:Je,getTask:Qe}=Oh(),[Fn,Ke]=(0,gr.useState)(null),[ct,pt]=(0,gr.useState)(!1),pe=(0,gr.useRef)(!1),[oe,Ge]=(0,gr.useState)(null),[Pe,re]=(0,gr.useState)(null),[de,be]=(0,gr.useState)(null),[Se,gt]=(0,gr.useState)(!1),Ae=ae?void 0:{[Ii]:Se?{maxHeight:120,opacity:1,overflow:"hidden",transition:"max-height 0.25s ease, opacity 0.2s ease"}:{minHeight:0,maxHeight:0,opacity:0,overflow:"hidden",pointerEvents:"none",transition:"max-height 0.25s ease, opacity 0.2s ease"}},[Ne,Lt]=(0,gr.useState)(null),[rt,Fe]=(0,gr.useState)(null),[Vt,Bt]=(0,gr.useState)(null),[Mt,Jt]=(0,gr.useState)(null),[xn,jn]=(0,gr.useState)(null),mt=!!c.is_notice,Ct=!!c.is_event,en=!!c.is_bug,ne=!!Xn&&bc(c,Z),{onReturnTask:me,onReviewDone:we,editPolicy:ve,translateContent:Me,contentTranslate:tt}=it(),nt=K&&!!we&&!!me&&Ur(c,Z),[Rt,bt]=(0,gr.useState)(null),ot=!!(Me&&tt),yt=bm({taskSeq:c.seq,translatedTargets:c.translated_targets??[]}),_n=!!Xn&&yc(c,Z),wn=!!et&&en&&!!c.completed&&Z>0&&(c.author_account_seq??0)===Z&&!(c.acks??[]).some(fe=>fe.account_seq===Z),_t=!fi(c,Z),At=ea(c,Z,ve),vr=!ie&&!ae&&!c.is_event&&(c.is_notice?Z>0&&(c.author_account_seq??0)===Z:(c.author_account_seq??0)===Z||(c.manager_account_seq??0)===Z),Pr=c.is_notice||c.is_event?tn(c.icon||(c.is_notice?tr:kr)):null,Mr=mt?!gc(c,Z):_t,Vr=ne||_n?(0,se.jsxs)(go,{onClick:fe=>jn(fe.currentTarget),children:[(0,se.jsx)(sj.default,{sx:{fontSize:16,mr:.5}}),I("col.claim")]}):null,Ko=mt?Kc(c,ge):"",lr=mt?Jf(c,ge,Z):null,Yn=mt?null:pi(c,Z),$t=CF(c.content??""),Yt=_F(c.seq,!!(Yn?.canConfirm&&ze),$t,()=>ze?.(c.seq)),ga=Math.max(1,Math.ceil((1-Yt)*$t/1e3)),cr=!!(Yn&&Yn.total>0||mt&&lr),Qr=(c.origin_license_seq??0)>0,Rr=!mt&&!Qr,Jr=ie||ae,_o=ae&&Ho(c)==="all"&&(c.receiver_names??[]).length===0,ki=(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(Ot,{icon:(0,se.jsx)(oj.default,{sx:{fontSize:17}}),label:I("col.author"),sx:[ri(9),Ae??null,...Ct?[]:[Ln(1)]],children:c.created_by?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(to,{names:[c.created_by],size:20,avatarSrcByName:a}),c.created_by]}):(0,se.jsx)(Na,{})}),(0,se.jsx)(Ot,{icon:(0,se.jsx)(Cp.default,{sx:{fontSize:17}}),label:I("col.createdTime"),sx:[ri(11),Ae??null,...Ct?[]:[Ln(_o?1:2)]],children:c.created_time?po(c.created_time):(0,se.jsx)(Na,{})})]});return(0,se.jsxs)(se.Fragment,{children:[ce?(0,se.jsxs)(ut.Box,{sx:{px:2,pt:2,pb:.5,display:"flex",alignItems:"flex-start",gap:1},children:[vr?(0,se.jsx)(ut.Checkbox,{checked:c.completed,icon:(0,se.jsx)(tj.default,{sx:{fontSize:22,color:"#9a9a97",opacity:.45}}),checkedIcon:(0,se.jsx)(Sm.default,{sx:{fontSize:22,color:"#2f80ed"}}),onChange:(fe,rn)=>{Pe||re({anchorEl:fe.currentTarget,nextCompleted:rn})},sx:{p:0,mt:.25}}):null,Pr?Ct&&!_t?(0,se.jsx)(ut.ButtonBase,{onClick:fe=>Ge(fe.currentTarget),sx:{display:"flex",p:.25,mt:.1,borderRadius:1,color:c.icon_color||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:(0,se.jsx)(Pr,{sx:{fontSize:20}})}):(0,se.jsx)(ut.Box,{sx:{display:"flex",p:0,mt:.25,color:c.icon_color||(mt?"#e5484d":"#1e3a8a")},children:(0,se.jsx)(Pr,{sx:{fontSize:20}})}):null,(0,se.jsx)(ut.Box,{sx:{flex:1,minWidth:0},children:Fn!==null?(0,se.jsx)(ut.Box,{component:"div",contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,ref:fe=>{if(!fe||fe.dataset.focused)return;fe.dataset.focused="1",fe.focus();let rn=document.createRange();rn.selectNodeContents(fe),rn.collapse(!1);let ur=window.getSelection();ur?.removeAllRanges(),ur?.addRange(rn)},onBlur:fe=>{let rn=(fe.currentTarget.textContent??"").replace(/\n/g," ").trim();!pe.current&&rn&&rn!==Qe().title&&ke(c.seq,rn),pe.current=!1,Ke(null)},onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),fe.target.blur()),fe.key==="Escape"&&(pe.current=!0,fe.target.blur())},onPaste:fe=>{fe.preventDefault();let rn=fe.clipboardData.getData("text/plain").replace(/\n/g," ");document.execCommand("insertText",!1,rn)},sx:{outline:"none",fontSize:19,fontWeight:600,color:c.completed?"#9a9a97":"#37352f",lineHeight:"26px",cursor:"text",userSelect:"text",wordBreak:"break-word"},children:Fn}):(0,se.jsx)(ut.Box,{onClick:At||ye?void 0:()=>Ke(String(Je.getFormValue("title")??"")),sx:{fontSize:19,fontWeight:600,color:c.completed?"#9a9a97":"#37352f",lineHeight:"26px",cursor:At||ye?"default":"text",userSelect:"text",wordBreak:"break-word"},children:ye||(0,se.jsx)(jo,{form:Je,name:"title",children:fe=>fe})})}),(0,se.jsx)(Bo,{open:!!Pe,anchorEl:Pe?.anchorEl??null,nextCompleted:Pe?.nextCompleted??!1,returnMode:!!me&&Ur(c,Z),onCancel:()=>re(null),onConfirm:fe=>{Pe&&(fe&&me?me(Qe(),fe):xe(c.seq,Pe.nextCompleted)),re(null)}})]}):null,(0,se.jsxs)(ut.Box,{sx:{py:1.5,display:"flex",flexDirection:"column",gap:0,[Ii]:{pb:0,"& > :last-child":{mb:0}}},children:[ie?null:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(zc,{form:Je,hideProject:ee,hideManager:ae,hideReceivers:_o,hideStartDate:ae,hideReminder:ae,hidePriority:ae,pinColumns:!0,projectColumn:!Ct&&!le?2:"full",values:{tabKey:c.tab_key??"",managerName:ae?c.manager_name||c.author_name||"":c.manager_name,receiverNames:c.receiver_names,startDate:c.start_date,dueDate:c.due_date,reminders:Fo(c),priority:c.priority,eventTime:c.event_time??"",eventPlace:c.event_place??"",eventAddress:c.event_address??""},customTabs:l,avatarSrcByName:kc(c,a),hideDueDate:ae||!Ct&&!!c.repeat_rule,notice:mt,event:Ct,readOnly:_t,coreLocked:At,targetSummary:Ko,onChangeProject:fe=>d(c.seq,fe),onAddProject:i,onChangeStartDate:fe=>s(c.seq,"start_date",fe),onChangeDueDate:fe=>s(c.seq,"due_date",fe),onChangeReminder:fe=>h(c.seq,fe),onChangePriority:fe=>m(c.seq,fe),onChangeEventTime:fe=>S?.(c.seq,fe),onChangeEventPlace:fe=>O?.(c.seq,fe),onChangeEventAddress:fe=>P?.(c.seq,fe),onMemberEdit:fe=>f(Qe(),fe,null),narrowCollapsedSx:Ae,reminderLocked:c.completed,managerAction:Vr,supportOrigin:(c.origin_license_seq??0)>0?{licenseName:c.origin_license_name??"",authorName:c.origin_author_name||c.author_name||c.created_by||"",contactPhone:c.origin_contact_phone??"",contactEmail:c.origin_contact_email??"",supportType:_d(c.support_type??"")}:void 0,leading:(0,se.jsxs)(se.Fragment,{children:[!ae&&(wn||Vr&&(mt||Ct))?(0,se.jsxs)(ut.Box,{sx:{gridColumn:"1 / -1",display:"flex",justifyContent:"flex-start",gap:2,px:2,py:1.5},children:[mt||Ct?Vr:null,wn?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(ut.Button,{variant:"contained",size:"large",onClick:()=>et?.(c.seq,!0),sx:{bgcolor:"#2f80ed"},children:I("detail.bugVerified")}),(0,se.jsx)(ut.Button,{variant:"outlined",size:"large",color:"error",onClick:()=>et?.(c.seq,!1),children:I("detail.bugReopen")})]}):null]}):null,en&&c.ticket_no?(0,se.jsx)(Ot,{icon:(0,se.jsx)(ZF.default,{sx:{fontSize:17}}),label:I("col.ticket"),sx:Ln(1),children:(0,se.jsx)(ut.Box,{component:"span",sx:{fontVariantNumeric:"tabular-nums"},children:c.ticket_no})}):null,Ct||ae?null:(0,se.jsx)(ut.Box,{sx:en&&c.ticket_no||Rr||cr?Ln(en&&c.ticket_no?2:1):{gridColumn:"1 / -1"},children:(0,se.jsx)(a$,{form:Je,task:c,locked:_t||!!c.completed,options:mt?Ks:en?ka:Xs,onSelect:fe=>r(c.seq,fe)})}),nt&&!ae?(0,se.jsxs)(Ot,{icon:(0,se.jsx)(QF.default,{sx:{fontSize:17}}),label:I("board.review"),sx:{gridColumn:"1 / -1"},children:[(0,se.jsx)(go,{onClick:fe=>re({anchorEl:fe.currentTarget,nextCompleted:!1}),children:I("task.revert")}),(0,se.jsx)(ut.Button,{size:"small",variant:"contained",disableElevation:!0,onClick:fe=>{fe.stopPropagation(),bt(fe.currentTarget)},sx:{ml:1,...Ci},children:I("col.reviewDone")}),(0,se.jsx)(Ta,{anchorEl:Rt,onCancel:()=>bt(null),onConfirm:()=>{we?.(Qe()),bt(null)}})]}):null,Rr?(()=>{let fe=Ho(c),rn=fe==="all"?(0,se.jsx)(Ip.default,{sx:{fontSize:17,color:"#2f80ed"}}):fe==="group"?(0,se.jsx)(Bp.default,{sx:{fontSize:17,color:"#d9730d"}}):(0,se.jsx)(_p.default,{sx:{fontSize:17}}),ur=fe==="all"?I("create.visibilityPublic"):fe==="group"?I("create.visibilityDept",{value:w.find(Gi=>Gi.seq===(c.visibility_group_seq??0))?.name??I("create.department")}):I("create.visibilityPrivate");return(0,se.jsx)(ut.Box,{sx:Ct?void 0:Ln(en||ae?1:2),children:(0,se.jsx)(Ot,{icon:rn,label:(0,se.jsx)(am,{}),onClick:At||!b?void 0:Gi=>Lt(Gi),children:ur})})})():null,!en&&!Qr&&!ae?(0,se.jsx)(ut.Box,{sx:Ct?void 0:Ln(1),children:(0,se.jsx)(Ot,{icon:(0,se.jsx)(lj.default,{sx:{fontSize:17,...c.repeat_rule?{color:"#2f80ed"}:{}}}),label:I("create.repeat"),onClick:At||!g?void 0:fe=>Fe(fe),children:c.repeat_rule?Jl(c.repeat_rule):(0,se.jsx)(Na,{label:I("common.none")})})}):null,!en&&!ae&&c.repeat_rule?(0,se.jsx)(ut.Box,{sx:Ct?void 0:Ln(2),children:(0,se.jsx)(Ot,{icon:(0,se.jsx)(cj.default,{sx:{fontSize:17}}),label:I("create.repeatUntil"),onClick:At||!g?void 0:fe=>Bt(fe),children:c.repeat_until?I("detail.repeatUntilValue",{repeat_until:c.repeat_until}):(0,se.jsx)(Na,{})})}):null,!ae&&Yn&&Yn.total>0?(0,se.jsx)(ut.Box,{sx:Ct?void 0:Ln(2),children:(0,se.jsx)(Ot,{icon:(0,se.jsx)(Cm.default,{sx:{fontSize:17}}),label:I("task.confirm"),children:Yn.canConfirm?(0,se.jsxs)(ut.Box,{sx:{display:"inline-flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[(0,se.jsx)(ut.Button,{size:"small",variant:"contained",onClick:()=>ze?.(c.seq),sx:{py:.1,px:1.25,minWidth:0,color:"#fff",bgcolor:"#2f80ed",backgroundImage:`linear-gradient(to right, #1a5fc4 ${Yt*100}%, transparent ${Yt*100}%)`,boxShadow:"none","&:hover":{bgcolor:"#1e6fd9",boxShadow:"none"}},children:I("task.confirm")}),(0,se.jsx)(ut.Box,{component:"span",sx:{fontSize:14,color:"text.secondary",whiteSpace:"nowrap"},children:I("detail.autoConfirmIn",{seconds:ga})})]}):(0,se.jsxs)(ut.Button,{size:"small",variant:"outlined",color:"inherit",startIcon:Yn.myTime?(0,se.jsx)(Sm.default,{sx:{fontSize:"16px !important",color:"#2f80ed"}}):null,onClick:fe=>be({anchorEl:fe.currentTarget,open:!0}),sx:{py:.1,px:1.25,minWidth:0,fontSize:13,color:"text.primary",borderColor:"#d5d8dc",bgcolor:"#fff",whiteSpace:"nowrap"},children:[Yn.count," / ",Yn.total]})})}):null,mt&&lr?(0,se.jsx)(ut.Box,{sx:Ln(2),children:(0,se.jsx)(Ot,{icon:(0,se.jsx)(Cm.default,{sx:{fontSize:17}}),label:I("task.confirm"),children:(0,se.jsx)(ut.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,minWidth:0},children:lr.canAck?(0,se.jsx)(ut.Button,{size:"small",variant:"contained",onClick:()=>ze?.(c.seq),sx:{py:.1,px:1.25,minWidth:0,color:"#fff",bgcolor:"#2f80ed",boxShadow:"none","&:hover":{bgcolor:"#1e6fd9",boxShadow:"none"}},children:I("task.confirm")}):(0,se.jsx)(ut.Button,{size:"small",variant:"outlined",color:"inherit",startIcon:lr.acked?(0,se.jsx)(Sm.default,{sx:{fontSize:"16px !important",color:"#2f80ed"}}):null,onClick:fe=>be({anchorEl:fe.currentTarget,open:!0}),sx:{py:.1,px:1.25,minWidth:0,fontSize:13,color:"text.primary",borderColor:"#d5d8dc",bgcolor:"#fff",whiteSpace:"nowrap"},children:lr.total>0&&lr.count>=lr.total?I("common.done"):(0,se.jsxs)(se.Fragment,{children:[lr.count,(0,se.jsx)(ut.Box,{component:"span",sx:{mx:.4},children:"/"}),lr.total]})})})})}):null,Re&&!Ie&&!Ct&&!mt&&!ae?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(Ot,{icon:(0,se.jsx)(JF.default,{sx:{fontSize:17}}),label:I("col.goal"),onClick:At?void 0:fe=>Jt(fe),sx:Ln(1),children:(0,se.jsx)(jo,{form:Je,name:"sprint_seq",children:fe=>fe>0?Ze.find(rn=>rn.seq===fe)?.name??I("detail.deletedSprint"):(0,se.jsx)(Na,{label:I("board.unassigned")})})}),(0,se.jsx)(Ot,{icon:(0,se.jsx)(ej.default,{sx:{fontSize:17}}),label:"\uD3EC\uC778\uD2B8",sx:Ln(2),children:(0,se.jsx)(Xi,{name:"story_points",children:(0,se.jsx)(jo,{form:Je,name:"story_points",children:fe=>(0,se.jsx)(Bi,{value:fe>0?String(fe):"",placeholder:I("create.notEstimated"),readOnly:At,onCommit:rn=>We?.(c.seq,Number(rn.replace(/[^0-9.]/g,""))||0)})})})})]}):null,Ct||le?null:(0,se.jsx)(ut.Box,{sx:[ae?Ln(2):ee?{gridColumn:"1 / -1"}:Ln(1),Ae??null],children:(0,se.jsx)(s$,{form:Je,locked:_t,labelOptions:n,onChange:fe=>t(c.seq,fe),onAddLabel:o})})]}),afterProject:Ct?null:(0,se.jsxs)(se.Fragment,{children:[ki,(0,se.jsx)(t$,{store:u.propertyExtra})]}),trailing:(0,se.jsxs)(se.Fragment,{children:[en?(0,se.jsx)(Fc,{form:Je,values:{repro:c.bug_repro??"",device:c.bug_device??"",where:c.bug_where??"",version:c.bug_version??"",resolution:c.resolution??""},readOnly:At,showResolution:!!c.completed,onChangeRepro:fe=>Oe?.(c.seq,"bug_repro",fe),onChangeDevice:fe=>Oe?.(c.seq,"bug_device",fe),onChangeWhere:fe=>Oe?.(c.seq,"bug_where",fe),onChangeVersion:fe=>Oe?.(c.seq,"bug_version",fe),onChangeResolution:fe=>st?.(c.seq,fe)}):null,Ct?ki:null,c.completed?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(Ot,{icon:(0,se.jsx)(Cm.default,{sx:{fontSize:17}}),label:I("detail.completedBy"),sx:[ri(10),Ae??null,...Ct?[]:[Ln(1)]],children:c.completed_by?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(to,{names:[c.completed_by],size:20,avatarSrcByName:a}),c.completed_by]}):(0,se.jsx)(Na,{})}),(0,se.jsx)(Ot,{icon:(0,se.jsx)(Cp.default,{sx:{fontSize:17}}),label:I("col.completedTime"),sx:[ri(12),Ae??null,...Ct?[]:[Ln(2)]],children:c.completed_time?po(c.completed_time):(0,se.jsx)(Na,{})})]}):null]})}),(0,se.jsxs)(ut.Box,{sx:{display:"none",[Ii]:{display:ae?"none":"block",mt:1.5,mb:0}},children:[(0,se.jsx)(ut.Divider,{sx:{borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)(ut.ButtonBase,{onClick:()=>gt(fe=>!fe),sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:.5,pt:1.25,pb:1.25,fontSize:13.5,bgcolor:"#f4f4f2",color:"#37352f","&:active":{opacity:.6}},children:Se?(0,se.jsxs)(se.Fragment,{children:[I("detail.collapse")," ",(0,se.jsx)(XF.default,{sx:{fontSize:18}})]}):(0,se.jsxs)(se.Fragment,{children:[I("detail.moreInfo")," ",(0,se.jsx)(YF.default,{sx:{fontSize:18}})]})})]})]}),(0,se.jsx)(UF,{store:u.leading}),(0,se.jsxs)(ut.Box,{children:[(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR,[Ii]:{mt:0,mb:1.25}}}),(0,se.jsx)(ko,{icon:(0,se.jsx)(ij.default,{sx:{fontSize:18,display:"block"}}),title:I("common.content"),titleExtra:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(UF,{store:u.titleExtra}),(0,se.jsx)(qc,{content:c.content??"",templates:z??[],onApply:fe=>N?.(c.seq,fe),onSave:W,onRemove:F,readOnly:At||!z}),ct&&!At?(0,se.jsx)(ut.Tooltip,{title:I("section.finishEditingTooltip"),arrow:!0,children:(0,se.jsx)(ut.IconButton,{size:"small","aria-label":I("section.finishEditing"),onMouseDown:fe=>fe.preventDefault(),onClick:()=>pt(!1),sx:{color:"#2f9e5b"},children:(0,se.jsx)(KF.default,{sx:{fontSize:19}})})}):null]}),children:(0,se.jsx)(ut.Box,{sx:{userSelect:"text"},children:C?(0,se.jsx)(ut.Box,{sx:{minHeight:180,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,se.jsx)(pm,{})}):(0,se.jsx)(jc,{syncKey:c.seq,value:c.content??"",readOnly:At,viewFirst:!0,editing:ct,onEditingChange:pt,onTranslate:ot?yt.openDialog:void 0,onChange:fe=>N(c.seq,fe)})})}),c.is_bug||Jr?null:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)(ko,{icon:(0,se.jsx)(aj.default,{sx:{fontSize:18,display:"block"}}),title:I("col.note"),children:(0,se.jsx)(ut.Box,{sx:{userSelect:"text"},children:(0,se.jsx)(Xi,{name:"note",children:(0,se.jsx)(jo,{form:Je,name:"note",children:fe=>(0,se.jsx)(xp,{value:fe,readOnly:Mr,onCommit:rn=>j(c.seq,rn),onDraftChange:M?rn=>M(c.seq,rn):void 0})})})})})]}),lt&&Nt&&!Ct&&!mt&&!Jr?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)(FF,{form:Je,participants:Du(c),readOnly:_t,avatarSrcByName:a,onSave:fe=>Nt(c.seq,fe)})]}):null,Ct||Jr?null:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)($F,{store:u.pool,children:fe=>(0,se.jsx)(Vc,{taskSeq:c.seq,checklist:c.checklist??[],removeLocked:Mr,onAdd:B,onToggle:R,confirmOnToggle:!0,onRemove:p,onUpdate:y,onReorder:x,onConvertToTask:k,onOpenLinkedTask:T,resolveLinkedTask:D,myAccountSeq:Z,linkCandidates:fe,linkBaseTask:c,onLinkExistingTask:_})})]}),(0,se.jsx)($F,{store:u.pool,children:fe=>fe&&!Jr&&!Ct&&!mt&&(!_t||wp(c,fe))?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)(Tp,{task:c,tasks:fe,readOnly:_t,onOpenTask:H,onLink:V,onUnlink:U,onCreateFollowUp:L})]}):null}),(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)(Uc,{taskSeq:c.seq,attachments:c.attachments??[],removeLocked:mt?Mr:At,onAdd:G,onRemove:E,onReorder:A,onPreview:q?(fe,rn)=>q({...fe,taskSeq:c.seq},rn?.map(ur=>({...ur,taskSeq:c.seq}))):void 0,onDownload:$?fe=>$({...fe,taskSeq:c.seq}):void 0})]}),(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)(cp,{taskSeq:c.seq,comments:c.comments??[],currentUserName:te,myAccountSeq:Z,avatarSrcByName:a,onUpdate:Q,onRemove:X,onToggleReaction:Y,onPreview:q?(fe,rn)=>q({...fe,taskSeq:c.seq},rn?.map(ur=>({...ur,taskSeq:c.seq}))):void 0,onDownload:$?fe=>$({...fe,taskSeq:c.seq}):void 0})]}),ot?(0,se.jsx)(jo,{form:Je,name:"title",children:fe=>(0,se.jsx)(kp,{controller:yt,title:fe,html:c.content??""})}):null,(0,se.jsx)(ut.Menu,{transitionDuration:0,anchorEl:rt,open:!!rt,onClose:()=>Fe(null),children:[{value:"",label:I("common.none")},...Vs].map(fe=>(0,se.jsx)(ut.MenuItem,{selected:(c.repeat_rule??"")===fe.value,onClick:()=>{Fe(null),ed(Qe(),fe.value,g)},sx:{fontSize:14,minWidth:140},children:fe.label},fe.value||"none"))}),(0,se.jsx)(dj.DatePicker,{anchorEl:Vt,open:!!Vt,onClose:()=>Bt(null),selectedDate:c.repeat_until?new Date(`${c.repeat_until}T00:00:00`):new Date,onDateChange:fe=>{Bt(null),td(Qe(),fe,g)}}),(0,se.jsx)(ut.Menu,{transitionDuration:0,anchorEl:Ne,open:!!Ne,onClose:()=>Lt(null),children:[{key:"involved",label:I("create.visibilityPrivate"),icon:(0,se.jsx)(_p.default,{sx:{fontSize:17,color:"#57564f"}}),selected:Ho(c)==="involved",onPick:()=>b?.(c.seq,"involved",0)},{key:"all",label:I("create.visibilityPublic"),icon:(0,se.jsx)(Ip.default,{sx:{fontSize:17,color:"#2f80ed"}}),selected:Ho(c)==="all",onPick:()=>b?.(c.seq,"all",0)},...w.map(fe=>({key:`group-${fe.seq}`,label:I("create.visibilityDeptName",{name:fe.name}),icon:(0,se.jsx)(Bp.default,{sx:{fontSize:17,color:"#d9730d"}}),selected:Ho(c)==="group"&&(c.visibility_group_seq??0)===fe.seq,onPick:()=>b?.(c.seq,"group",fe.seq)}))].map(fe=>(0,se.jsxs)(ut.MenuItem,{selected:fe.selected,onClick:()=>{fe.onPick(),Lt(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[fe.icon,fe.label,fe.selected?(0,se.jsx)(Sp.default,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},fe.key))}),(0,se.jsx)(ut.Menu,{transitionDuration:0,anchorEl:Mt,open:!!Mt,onClose:()=>Jt(null),children:[{seq:0,label:I("board.unassigned")},...Ze.filter(fe=>`custom-${fe.group_seq}`===String(Je.getFormValue("tab_key")??"")).map(fe=>({seq:fe.seq,label:Wo(fe)}))].map(fe=>(0,se.jsxs)(ut.MenuItem,{onClick:()=>{kt?.(c.seq,fe.seq),Jt(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[fe.label,Number(Je.getFormValue("sprint_seq")??0)===fe.seq?(0,se.jsx)(Sp.default,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},fe.seq))}),(0,se.jsx)(Bc,{anchorEl:de?.anchorEl??null,open:!!de?.open,acks:c.acks??[],total:lr?.total??Yn?.total??0,pendingNames:lr?.pendingNames??Yn?.pendingNames??[],avatarSrcByName:a,onRequestConfirm:Le&&(lr?lr.count<lr.total:Yn&&Yn.count<Yn.total)?()=>{Le(c.seq),be(fe=>fe?{...fe,open:!1}:null)}:void 0,onClose:()=>be(fe=>fe?{...fe,open:!1}:null)}),(0,se.jsx)(Ji,{anchorEl:oe,value:c.icon??"",color:c.icon_color??"",onSelect:fe=>{qe(c.seq,fe),Ge(null)},onSelectColor:Be?fe=>Be(c.seq,fe):void 0,onClose:()=>Ge(null)}),(0,se.jsx)(uj.ConfirmActionPopper,{open:!!xn,anchorEl:xn,title:ne?I("table.claimTakeOverConfirm"):I("table.claimConfirm"),confirmText:I("col.claim"),onCancel:()=>jn(null),onConfirm:()=>{Xn?.(c.seq),jn(null)}})]})},i$);var yj=require("@ehfuse/mui-confirm-action");_e();var Gt=require("react/jsx-runtime");function c$(){let e=new Date,u=c=>String(c).padStart(2,"0");return`${e.getFullYear()}-${u(e.getMonth()+1)}-${u(e.getDate())} ${u(e.getHours())}:${u(e.getMinutes())}`}function u$({open:e,task:u,onClose:c,onAddComment:l,onSaveFields:n,presentation:a="auto",myAccountSeq:r=0,onToggleCompleted:t,onChangeTitle:o,onChangeIcon:d,onChangeIconColor:i,activityItems:s,activityLoading:h,onLoadActivity:f,onPrint:m,headerExtra:b,titleStart:g,menuExtra:w,onDelete:S,canDelete:O,...P}){ue();let j=Sn(),{form:M,baseTask:N,task:z,hasPendingChanges:W,stagedBodyProps:F,changeTitle:C,changeIcon:B,changeIconColor:R}=nd({open:e,task:u,isMobile:j,bodyProps:P,onSaveFields:n,onChangeTitle:o,onChangeIcon:d,onChangeIconColor:i}),p=xl({taskSeq:z?.seq??0,items:s,loading:h,onLoad:f}),[y,x]=(0,ca.useState)(null),[k,T]=(0,ca.useState)(null),{editPolicy:_,shareText:D}=it(),H=!!S&&(O??(N?!wa(N,r,_,!(r>0&&(N.author_account_seq??0)===r)):!1)),V=(0,ca.useRef)(null);(0,ca.useEffect)(()=>{V.current?.scrollTo({top:0})},[u?.seq]);let U=()=>{let Q=V.current?.getScrollContainer();if(Q){V.current?.scrollTo({top:Q.scrollHeight,behavior:"smooth"});return}let X=document.querySelectorAll(".taskbox-comments");X[X.length-1]?.scrollIntoView({block:"end",behavior:"smooth"})},L=(0,ca.useRef)(!1),G=z?.comments?.length??0;if((0,ca.useEffect)(()=>{L.current&&(L.current=!1,requestAnimationFrame(U))},[G]),!N||!z)return null;let E=z,A=j||a==="dialog",q=(0,Gt.jsx)(Ap,{...F,headerless:A,task:E,myAccountSeq:r,onChangeTitle:C,onToggleCompleted:t,onChangeIcon:B,onChangeIconColor:R,showTitle:j||a==="dialog"}),$=(0,Gt.jsx)(up,{onSubmit:(Q,X)=>{L.current=!0,l(E.seq,Q,X),requestAnimationFrame(U)}},E.seq);return A?(0,Gt.jsxs)(Gt.Fragment,{children:[(0,Gt.jsx)(bj.FormDialog,{open:e,onClose:c,backdropClick:!W,locale:Pt(),collapsibleTitle:!0,fontScale:{enabled:!0,default:1.1,min:.6},title:P.postMode?I("detail.kindPost"):E.is_notice?I("tab.notice"):E.is_event?I("kind.event"):E.is_bug?I("kind.bug"):I("kind.task"),titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1},custom:[...g?[{raw:!0,icon:(0,Gt.jsx)(Gt.Fragment,{children:g(E)})}]:[],...b?[{raw:!0,icon:(0,Gt.jsx)(Gt.Fragment,{children:b(E)})}]:[],...j?[{raw:!0,icon:(0,Gt.jsx)(An.Button,{variant:"contained",size:"small",disableElevation:!0,disabled:!W,onClick:W?()=>{M.submit()}:void 0,sx:{ml:1.5,height:32,minWidth:64,px:1.75,py:0,borderRadius:1,fontSize:14,fontWeight:600,bgcolor:"#2f80ed","&:hover":{bgcolor:"#2f80ed"},"&.Mui-disabled":{bgcolor:"#f2f2f0",color:"#c9c8c5"}},children:I("create.saveButton")})}]:[],{raw:!0,icon:(0,Gt.jsx)(An.IconButton,{size:"small","aria-label":I("common.more"),onClick:Q=>x(Q.currentTarget),children:(0,Gt.jsx)(mj.default,{sx:{color:"#6b7280"}})})}]},fullScreen:j,maxWidth:j?void 0:"md",width:j?void 0:720,mobilePresentation:j?"slide":void 0,tabs:{visible:!1},contentTopPadding:0,contentPaddingX:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,contentBottomPadding:0,scrollPastLastSection:!1,overlayScrollbar:{enabled:!0,contentStyle:{minWidth:0}},actions:{visible:!0,showCancelButton:!1,left:$},sx:{DialogContent:{borderBottom:"none"}},dialogActionSx:{padding:"0 !important","@media (max-width:1023.95px)":{padding:"0 !important"},borderTop:"1px solid #37352f","& .left-actions":{flex:1,width:"100%",minWidth:0,"& > *":{flex:1,minWidth:0}},"& .right-actions":{display:"none"}},sections:[{id:"task-detail",title:"",showTitle:!1,children:(0,Gt.jsx)(An.Box,{sx:{userSelect:"none",width:"100%",minWidth:0,display:"flex",flexDirection:"column",gap:0},children:q})}]},N.seq),(0,Gt.jsxs)(An.Menu,{open:!!y,anchorEl:y,onClose:()=>x(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{zIndex:1500},children:[f?(0,Gt.jsxs)(An.MenuItem,{onClick:()=>{x(null),p.openDialog()},children:[(0,Gt.jsx)(An.ListItemIcon,{children:(0,Gt.jsx)(pj.default,{fontSize:"small"})}),(0,Gt.jsx)(An.ListItemText,{children:I("activity.title")})]}):null,(0,Gt.jsxs)(An.MenuItem,{onClick:()=>{x(null),Ma(E,!0,D)},children:[(0,Gt.jsx)(An.ListItemIcon,{children:(0,Gt.jsx)(fj.default,{fontSize:"small"})}),(0,Gt.jsx)(An.ListItemText,{children:I("detail.share")})]}),H?(0,Gt.jsxs)(An.MenuItem,{onClick:Q=>{let X=y??Q.currentTarget;x(null),T(X)},sx:{color:"#e5484d"},children:[(0,Gt.jsx)(An.ListItemIcon,{children:(0,Gt.jsx)(hj.default,{fontSize:"small",sx:{color:"#e5484d"}})}),(0,Gt.jsx)(An.ListItemText,{children:I("common.delete")})]}):null]}),(0,Gt.jsx)(yj.ConfirmActionPopper,{open:!!k,anchorEl:k,title:I("detail.trashConfirm"),confirmText:I("common.delete"),onCancel:()=>T(null),onConfirm:()=>{T(null),S?.(E)}}),(0,Gt.jsx)(Jc,{controller:p})]}):(0,Gt.jsx)(An.Drawer,{anchor:"right",open:e,onClose:c,"aria-label":I("detail.taskDetail"),disableAutoFocus:!0,disableEnforceFocus:!0,sx:{zIndex:Q=>Q.zIndex.modal},slotProps:{paper:{sx:{width:720,maxWidth:"100vw"}}},children:(0,Gt.jsxs)(An.Box,{sx:{display:"flex",flexDirection:"column",height:"100%",userSelect:"none"},children:[(0,Gt.jsx)(gp,{task:E,myAccountSeq:r,onToggleCompleted:t,hideCompleted:!!(P.hideProperties||P.postMode),kindLabel:P.postMode?I("detail.kindPost"):void 0,displayTitle:P.displayTitle,onChangeTitle:o,onChangeIcon:d,onChangeIconColor:i,onClose:c,activityItems:s,activityLoading:h,onLoadActivity:f,onPrint:m,onDelete:S,canDelete:O,headerExtra:b,titleStart:g,menuExtra:w}),(0,Gt.jsx)(An.Divider,{sx:{borderColor:De.NOTION_LINE_COLOR}}),(0,Gt.jsx)(An.Box,{sx:{flex:1,minHeight:0},children:(0,Gt.jsx)(gj.default,{ref:V,style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:q})}),(0,Gt.jsx)(An.Divider,{sx:{borderColor:"#37352f"}}),(0,Gt.jsx)(An.Box,{sx:{flexShrink:0},children:$})]})})}var ir=require("@mui/material"),Mp=require("@ehfuse/mui-form-dialog"),Bj=v(require("@mui/icons-material/Add"),1),Oj=v(require("@mui/icons-material/DirectionsRunOutlined"),1),Aj=v(require("@mui/icons-material/EditOutlined"),1),ua=require("@ehfuse/mui-form-controls");pn();var br=require("@mui/material"),xj=require("@ehfuse/mui-form-dialog"),wj=require("@ehfuse/mui-form-controls"),Tj=v(require("@ehfuse/overlay-scrollbar"),1);var vj=require("@ehfuse/forma");function kj({open:e,sprint:u,remainingTasks:c,sprints:l,onClose:n,onConfirm:a}){let r=l.filter(i=>i.seq!==u?.seq&&i.group_seq===(u?.group_seq??0)&&i.status!=="closed"),t=c.length>0,o=(0,vj.useGlobalForm)({formId:Dt("taskbox-sprint-close-form"),initialValues:{mode:"backlog",moveToSeq:"0"},onValidate:i=>!(t&&i.mode==="move"&&!(Number(i.moveToSeq)>0)),onSubmit:i=>(a({mode:t?i.mode:"keep",moveToSprintSeq:i.mode==="move"&&Number(i.moveToSeq)||0,taskSeqs:c.map(s=>s.seq)}),!0)}),d={form:$r({modalIdPrefix:"taskbox-sprint-close-dialog",open:e,onClose:n,onOpen:()=>o.setFormValues({mode:r.length>0?"move":"backlog",moveToSeq:String(r[0]?.seq??0)})})};return{form:o,modals:d,candidates:r,hasRemaining:t}}_e();var zn=require("react/jsx-runtime");function Ep({open:e,sprint:u,remainingTasks:c,sprints:l,onClose:n,onConfirm:a}){ue();let{form:r,modals:t,candidates:o,hasRemaining:d}=kj({open:e,sprint:u,remainingTasks:c,sprints:l,onClose:n,onConfirm:a}),i=r.useFormValue("mode")??"backlog",s=Number(r.useFormValue("moveToSeq"))||0;return(0,zn.jsx)(xj.FormDialog,{open:t.form.isOpen,onClose:t.form.close,maxWidth:"sm",title:I("sprint.closeTitle"),locale:Pt(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-close",tabs:{visible:!1},actions:{showCancelButton:!0,right:(0,zn.jsx)(br.Button,{variant:"contained",onClick:()=>{r.submit()},disabled:d&&i==="move"&&!(s>0),children:I("sprint.closeButton")})},sections:[{id:"sprint-close",title:"",showTitle:!1,children:(0,zn.jsxs)(br.Box,{sx:{display:"flex",flexDirection:"column",gap:2},children:[(0,zn.jsx)(br.Box,{sx:{fontSize:18,color:"#37352f"},children:qn("sprint.closeIntro",{name:(0,zn.jsx)(br.Box,{component:"span",sx:{fontWeight:600},children:u?.name??""})})}),d?(0,zn.jsxs)(zn.Fragment,{children:[(0,zn.jsx)(br.Box,{sx:{fontSize:15,color:"#6f6f6c"},children:I("sprint.remainingQuestion",{count:c.length})}),(0,zn.jsx)(br.Box,{sx:{border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,overflow:"hidden"},children:(0,zn.jsx)(Tj.default,{style:{maxHeight:220},thumb:{width:6},children:c.map(h=>(0,zn.jsxs)(br.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,borderBottom:"1px solid #f2f2f0","&:last-of-type":{borderBottom:"none"}},children:[(0,zn.jsx)(br.Box,{sx:{flex:1,minWidth:0,fontSize:16,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.title}),(0,zn.jsx)(Tn,{option:xr(h)})]},h.seq))})}),(0,zn.jsxs)(br.RadioGroup,{value:i,onChange:(h,f)=>r.setFormValue("mode",f),children:[o.length>0?(0,zn.jsx)(br.FormControlLabel,{value:"move",control:(0,zn.jsx)(br.Radio,{size:"small"}),label:I("sprint.carryOver"),sx:{"& .MuiFormControlLabel-label":{fontSize:16}}}):null,i==="move"&&o.length>0?(0,zn.jsx)(br.Box,{sx:{pl:4,pb:1},children:(0,zn.jsx)(wj.LabelSelect,{form:r,name:"moveToSeq",size:"small",label:"",fullWidth:!0,options:o.map(h=>({value:String(h.seq),label:h.name}))})}):null,(0,zn.jsx)(br.FormControlLabel,{value:"backlog",control:(0,zn.jsx)(br.Radio,{size:"small"}),label:I("sprint.moveToBacklog"),sx:{"& .MuiFormControlLabel-label":{fontSize:16}}}),(0,zn.jsx)(br.FormControlLabel,{value:"keep",control:(0,zn.jsx)(br.Radio,{size:"small"}),label:I("sprint.keepInGoal"),sx:{"& .MuiFormControlLabel-label":{fontSize:16}}})]})]}):(0,zn.jsx)(br.Box,{sx:{fontSize:15,color:"#6f6f6c"},children:I("sprint.noRemaining")})]})}]})}var _m="custom-";function Sj(e){return e.startsWith(_m)}function d$(e){return e>0?`${_m}${e}`:""}function si(e){if(!Sj(e))return 0;let u=Number(e.slice(_m.length));return Number.isInteger(u)&&u>0?u:0}var Cj=require("react"),Bm=require("@ehfuse/forma"),Pp=require("@ehfuse/alerts");_e();var Im={editingSeq:0,name:"",goal:"",start_date:"",end_date:""};function _j({open:e,customTabs:u,onClose:c,onCreate:l,onUpdate:n,onChangeStatus:a,tasks:r=[],onCloseSprint:t,onRemove:o}){ue();let d=u.filter(O=>O.useSprints&&!O.archived),[i,s]=(0,Cj.useState)(null),h=i?r.filter(O=>(O.sprint_seq??0)===i.seq&&!O.completed):[],f=(0,Bm.useGlobalForm)({formId:Dt("taskbox-sprint-form"),initialValues:{groupKey:"",...Im},onValidate:O=>si(O.groupKey)?String(O.name??"").trim()?!0:((0,Pp.ErrorAlert)(I("sprint.enterGoalName")),!1):((0,Pp.ErrorAlert)(I("sprint.selectProject")),!1),onSubmit:async O=>{let P={name:String(O.name).trim(),goal:String(O.goal??"").trim(),start_date:O.start_date??"",end_date:O.end_date??""};if(O.editingSeq>0)return n(O.editingSeq,P),m.form.close(),!0;let j=await l({group_seq:si(O.groupKey),...P});return j&&m.form.close(),j}}),m={manage:$r({modalIdPrefix:"taskbox-sprint-manage-dialog",open:e,onClose:c,onOpen:()=>f.setFormValues({groupKey:d.length===1?d[0].key:"",...Im})}),form:(0,Bm.useModal)({modalId:Dt("taskbox-sprint-form-dialog"),onClose:()=>f.setFormValues(Im)})};return{form:f,modals:m,sprintTabs:d,closingSprint:i,remainingTasks:h,openCreateForm:()=>{f.setFormValues(Im),m.form.open()},openEditForm:O=>{f.setFormValues({editingSeq:O.seq,groupKey:`custom-${O.group_seq}`,name:O.name,goal:O.goal,start_date:O.start_date,end_date:O.end_date}),m.form.open()},changeStatus:(O,P)=>{if(P==="closed"&&t){s(O);return}a(O.seq,P)},cancelCloseSprint:()=>s(null),confirmCloseSprint:O=>{i&&t?.(i.seq,O),s(null)},removeSprint:o}}_e();var Wt=require("react/jsx-runtime"),m$=[{value:"planning",get label(){return I("status.planning")}},{value:"active",get label(){return I("status.active")}},{value:"closed",get label(){return I("status.closed")}}];function Ij(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?e.slice(5).replace("-","."):"-"}function h$({open:e,customTabs:u,sprints:c,onClose:l,onCreate:n,onUpdate:a,onChangeStatus:r,tasks:t=[],onCloseSprint:o,onRemove:d}){ue();let i=_j({open:e,customTabs:u,onClose:l,onCreate:n,onUpdate:a,onChangeStatus:r,tasks:t,onCloseSprint:o,onRemove:d}),{form:s,modals:h,sprintTabs:f,closingSprint:m,remainingTasks:b}=i,g=Number(s.useFormValue("editingSeq"))||0,w=s.isSubmitting,S=new Map(u.map(P=>[si(P.key),P.label])),O=(0,Wt.jsx)(ir.Box,{children:f.length===0?(0,Wt.jsx)(ir.Box,{sx:{py:2,fontSize:14,color:"#787774"},children:I("sprint.noSprintProjects")}):(0,Wt.jsx)(Wt.Fragment,{children:(0,Wt.jsx)(ir.Box,{children:c.length===0?(0,Wt.jsxs)(ir.Box,{sx:{py:4,display:"flex",flexDirection:"column",alignItems:"center",gap:2,color:"#9a9a97"},children:[(0,Wt.jsx)(Oj.default,{sx:{fontSize:48,color:"#d9d9d6"}}),(0,Wt.jsx)(ir.Box,{sx:{fontSize:13.5},children:I("sprint.noGoals")})]}):c.map(P=>(0,Wt.jsxs)(ir.Box,{sx:{display:"flex",flexDirection:"column",gap:1,"&:not(:last-of-type)::after":{content:'""',display:"block",my:1.75,borderBottom:"1px solid #f0efed"}},children:[(0,Wt.jsxs)(ir.Box,{sx:{minWidth:0},children:[(0,Wt.jsxs)(ir.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[(0,Wt.jsx)(ir.Box,{component:"span",sx:{fontSize:18,fontWeight:600,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:P.name}),(0,Wt.jsx)(ir.Box,{component:"span",sx:{flexShrink:0,px:1,py:.25,borderRadius:.75,bgcolor:"#f1f5f9",color:"#64748b",fontSize:13,fontWeight:500},children:S.get(P.group_seq)??I("sprint.deletedProject")}),(0,Wt.jsxs)(ir.Box,{component:"span",sx:{flexShrink:0,fontSize:14,color:"#57564f"},children:[Ij(P.start_date)," ~"," ",Ij(P.end_date)]})]}),P.goal?(0,Wt.jsx)(ir.Box,{sx:{mt:.5,fontSize:14,color:"#787774",lineHeight:1.5},children:P.goal}):null]}),(0,Wt.jsxs)(ir.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,Wt.jsx)(ua.LabelSelect,{label:I("col.status"),showLabel:!1,size:"small",value:P.status,options:m$.map(j=>({value:j.value,label:j.label})),onChange:j=>i.changeStatus(P,String(j.target.value)),sx:{width:104,flexShrink:0}}),(0,Wt.jsx)(ir.IconButton,{"aria-label":I("board.editGoal"),onClick:()=>i.openEditForm(P),sx:{color:"#9a9a97","&:hover":{color:"#2563eb"}},children:(0,Wt.jsx)(Aj.default,{sx:{fontSize:18}})}),(0,Wt.jsx)(ir.IconButton,{"aria-label":I("board.deleteGoal"),onClick:()=>i.removeSprint(P.seq),sx:{color:"#9a9a97","&:hover":{color:"#e5484d"}},children:(0,Wt.jsx)(Dr,{style:{width:16,height:16}})})]})]},P.seq))})})});return(0,Wt.jsxs)(Wt.Fragment,{children:[(0,Wt.jsx)(Mp.FormDialog,{open:h.manage.isOpen,onClose:h.manage.close,maxWidth:"sm",title:I("sprint.manageTitle"),locale:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-manage",sections:[{id:"sprint-manage",showTitle:!1,children:O}],sectionContentPaddingTop:0,actions:{showCancelButton:!0,left:f.length>0?(0,Wt.jsx)(ir.Button,{startIcon:(0,Wt.jsx)(Bj.default,{}),onClick:i.openCreateForm,sx:{color:"#2563eb"},children:I("sprint.newGoal")}):void 0,right:(0,Wt.jsx)(ir.Button,{variant:"contained",onClick:h.manage.close,children:I("common.confirm")})}}),(0,Wt.jsx)(Ep,{open:m!==null,sprint:m,remainingTasks:b,sprints:c,onClose:i.cancelCloseSprint,onConfirm:i.confirmCloseSprint}),(0,Wt.jsx)(Mp.FormDialog,{open:h.form.isOpen,onClose:h.form.close,maxWidth:"sm",title:g>0?I("board.editGoal"):I("sprint.newGoal"),locale:Pt(),backdropClick:!1,tabs:{visible:!1},titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-form",sections:[{id:"sprint-form",title:"",showTitle:!1,children:(0,Wt.jsx)(ir.Box,{sx:{pt:1},children:(0,Wt.jsxs)(ir.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:2.5,mt:1},children:[(0,Wt.jsx)(ua.LabelSelect,{form:s,name:"groupKey",label:I("col.project"),size:"medium",options:f.map(P=>({value:P.key,label:P.label})),disabled:g>0}),(0,Wt.jsx)(ua.ClearTextField,{form:s,name:"name",label:I("sprint.goalName"),size:"medium",placeholder:I("sprint.goalNamePlaceholder")}),(0,Wt.jsx)(ua.DateTextField,{form:s,name:"start_date",size:"medium",label:I("calendar.startDate")}),(0,Wt.jsx)(ua.DateTextField,{form:s,name:"end_date",size:"medium",label:I("calendar.endDate")}),(0,Wt.jsx)(ua.ClearTextField,{form:s,name:"goal",label:I("googleEvent.description"),size:"medium",placeholder:I("sprint.optional"),sx:{gridColumn:"1 / -1"}})]})})}],actions:{showCancelButton:!0,right:(0,Wt.jsx)(ir.Button,{variant:"contained",onClick:()=>{s.submit()},disabled:w,children:g>0?I("common.edit"):I("sprint.createGoal")})}})]})}pn();var sn=require("@mui/material"),Dj=require("@ehfuse/mui-form-dialog"),Nj=v(require("@mui/icons-material/LinkOutlined"),1),Lj=v(require("@mui/icons-material/LinkOffOutlined"),1),zj=v(require("@mui/icons-material/SyncOutlined"),1),Fj=v(require("@mui/icons-material/ArrowForward"),1);var Pj=require("react");var Di=require("react"),Ej=require("@ehfuse/forma"),Om=[];function f$(){let e=Om;if(Om=[],e.length!==0){if(e.length===1){e[0].close();return}for(let u of e)window.dispatchEvent(new CustomEvent(`modal:close:${u.modalId}`));window.addEventListener("popstate",u=>u.stopImmediatePropagation(),{capture:!0,once:!0}),window.history.go(-e.length)}}function li({modalId:e,open:u,onClose:c,onOpen:l}){let n=(0,Di.useRef)(l);n.current=l;let a=(0,Di.useRef)(c);a.current=c;let r=(0,Di.useRef)(u);r.current=u;let t=(0,Di.useRef)(!1),o=(0,Ej.useModal)({modalId:e,onClose:()=>{t.current=!1,r.current&&a.current()}}),d=(0,Di.useRef)(o);d.current=o;let i=(0,Di.useCallback)(()=>{t.current||!d.current.isOpen||(t.current=!0,d.current.close())},[]);return(0,Di.useEffect)(()=>{if(u){n.current?.(),d.current.open();return}!d.current.isOpen||t.current||(t.current=!0,Om.push({modalId:d.current.modalId,close:()=>d.current.close()}),Om.length===1&&queueMicrotask(f$))},[u]),{...o,close:i}}function Mj(e){let u=(0,Pj.useRef)(e);u.current=e;let c={link:li({modalId:Dt("taskbox-calendar-link"),open:e.open,onClose:()=>u.current.onClose()})},{status:l}=e.googleApi,{calendarName:n}=it(),a=l.linked&&l.calendar_name||n||"\uC5C5\uBB34\uD568",r={connect:()=>u.current.googleApi.onConnect(),disconnect:()=>u.current.googleApi.onDisconnect(),toggleExport:t=>u.current.googleApi.onToggleExport(t),toggleImport:t=>u.current.googleApi.onToggleImport(t),resync:()=>u.current.googleApi.onResync?.()};return{modals:c,status:l,busy:!!e.googleApi.busy,canResync:!!e.googleApi.onResync,calendarName:a,actions:r}}_e();var Tt=require("react/jsx-runtime");function Rj({from:e,to:u}){return(0,Tt.jsxs)(sn.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[e,(0,Tt.jsx)(Fj.default,{sx:{fontSize:16,color:"#787774"}}),u]})}function p$({size:e=28}){return(0,Tt.jsxs)(sn.Box,{component:"svg",viewBox:"0 0 48 48","aria-hidden":!0,sx:{width:e,height:e,flexShrink:0,mx:1},children:[(0,Tt.jsx)("path",{fill:"#EA4335",d:"M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"}),(0,Tt.jsx)("path",{fill:"#4285F4",d:"M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"}),(0,Tt.jsx)("path",{fill:"#FBBC05",d:"M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"}),(0,Tt.jsx)("path",{fill:"#34A853",d:"M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"})]})}function g$(e){ue();let u=Mj(e),{status:c,busy:l,calendarName:n,actions:a}=u,r=u.modals.link,t=(0,Tt.jsxs)(sn.Box,{sx:{display:"flex",flexDirection:"column",gap:"24px"},children:[(0,Tt.jsxs)(sn.Box,{sx:{bgcolor:"#f2f6fa",borderRadius:1,px:1.5,py:1.25,fontSize:15,lineHeight:1.8,color:"#37352f",display:"flex",flexDirection:"column",gap:.25,"& > div":{display:"flex",gap:1},"& > div::before":{content:'"\u2022"',flexShrink:0}},children:[(0,Tt.jsx)(sn.Box,{children:(0,Tt.jsx)(sn.Box,{component:"span",children:qn("calendarLink.exportDesc",{exportWord:(0,Tt.jsx)("b",{children:I("calendarLink.export")}),calendar:(0,Tt.jsxs)("b",{children:['"',n,'"']})})})}),(0,Tt.jsx)(sn.Box,{children:(0,Tt.jsx)(sn.Box,{component:"span",children:qn("calendarLink.importDesc",{importWord:(0,Tt.jsx)("b",{children:I("calendarLink.import")})})})}),(0,Tt.jsx)(sn.Box,{children:(0,Tt.jsx)(sn.Box,{component:"span",children:I("calendarLink.editInTaskbox",{calendarName:n})})})]}),c.configured?(0,Tt.jsxs)(sn.Box,{sx:{border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,pl:2,pr:3,py:1.75,display:"flex",flexDirection:"column",gap:1.25},children:[(0,Tt.jsxs)(sn.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,Tt.jsx)(p$,{}),(0,Tt.jsxs)(sn.Box,{sx:{flex:1,minWidth:0},children:[(0,Tt.jsx)(sn.Box,{sx:{fontSize:18,color:"#111",fontWeight:700},children:I("calendarLink.connectGoogle")}),(0,Tt.jsx)(sn.Box,{sx:{fontSize:15,color:"#111",mt:.5,lineHeight:1.6},children:c.linked?(0,Tt.jsxs)(Tt.Fragment,{children:[(0,Tt.jsx)(sn.Box,{component:"span",sx:{display:"block",fontWeight:600},children:I("calendarLink.connectedTo",{email:c.google_email||I("calendarLink.googleAccount")})}),(0,Tt.jsx)(sn.Box,{component:"span",sx:{display:"block"},children:I("calendarLink.calendarCreated",{calendarName:n})})]}):I("calendarLink.connectHint",{calendarName:n})}),c.last_error?(0,Tt.jsx)(sn.Box,{sx:{fontSize:13,color:"#c62828",mt:.5},children:I("calendarLink.lastError",{error:c.last_error})}):null]}),c.linked?(0,Tt.jsx)(sn.Button,{size:"small",variant:"outlined",color:"inherit",disabled:l,startIcon:(0,Tt.jsx)(Lj.default,{sx:{fontSize:18}}),onClick:a.disconnect,sx:{flexShrink:0,whiteSpace:"nowrap",ml:2},children:I("calendarLink.disconnect")}):(0,Tt.jsx)(sn.Button,{size:"small",variant:"contained",disableElevation:!0,disabled:l,startIcon:(0,Tt.jsx)(Nj.default,{sx:{fontSize:18}}),onClick:a.connect,sx:{flexShrink:0,whiteSpace:"nowrap",bgcolor:"#2563eb",ml:2},children:I("calendarLink.connect")})]}),c.linked?(0,Tt.jsxs)(sn.Box,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap",pl:4.5},children:[(0,Tt.jsx)(sn.FormControlLabel,{control:(0,Tt.jsx)(sn.Switch,{size:"small",checked:c.export_enabled,disabled:l,onChange:(o,d)=>a.toggleExport(d)}),label:(0,Tt.jsx)(sn.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:qn("calendarLink.withDirection",{direction:(0,Tt.jsx)(Rj,{from:I("calendarLink.taskbox"),to:I("calendarLink.google")})},{label:I("calendarLink.export")})}),sx:{m:0,"& .MuiFormControlLabel-label":{fontSize:14,color:"#37352f"}}}),(0,Tt.jsx)(sn.FormControlLabel,{control:(0,Tt.jsx)(sn.Switch,{size:"small",checked:c.import_enabled,disabled:l,onChange:(o,d)=>a.toggleImport(d)}),label:(0,Tt.jsx)(sn.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:qn("calendarLink.withDirection",{direction:(0,Tt.jsx)(Rj,{from:I("calendarLink.google"),to:I("calendarLink.taskbox")})},{label:I("calendarLink.import")})}),sx:{m:0,"& .MuiFormControlLabel-label":{fontSize:14,color:"#37352f"}}}),u.canResync?(0,Tt.jsx)(sn.Button,{size:"small",color:"inherit",disabled:l||!c.export_enabled,startIcon:(0,Tt.jsx)(zj.default,{sx:{fontSize:18}}),onClick:a.resync,sx:{ml:"auto",whiteSpace:"nowrap"},children:I("calendarLink.reexportAll")}):null]}):null]}):(0,Tt.jsx)(sn.Box,{sx:{fontSize:14,color:"#8a6d1d",lineHeight:1.7},children:I("calendarLink.notConfigured")})]});return(0,Tt.jsx)(Dj.FormDialog,{open:r.isOpen,onClose:r.close,width:680,title:I("calendarLink.title"),locale:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-calendar-link",sectionContentPaddingTop:0,sections:[{id:"calendar-link",showTitle:!1,children:t}],actions:{showCancelButton:!1,right:(0,Tt.jsx)(sn.Button,{variant:"contained",onClick:r.close,sx:{minWidth:80},children:I("common.close")})}})}var Uj=require("@ehfuse/mui-form-controls"),eu=require("react"),$j=v(require("@mui/icons-material/OpenInNewOutlined"),1),zr=require("@mui/material"),Kj=require("@ehfuse/mui-form-dialog"),Em=require("@ehfuse/mui-form-controls"),Cl=require("@ehfuse/mui-datetime-picker"),Np=v(require("@mui/icons-material/CalendarMonthOutlined"),1),Lp=v(require("@mui/icons-material/AccessTimeOutlined"),1);var Ts=require("react"),qj=require("@ehfuse/forma"),Rp=require("@ehfuse/alerts");_e();var b$={title:"",allDay:!0,startDate:"",endDate:"",startTime:"09:00",endTime:"10:00",location:"",description:""};function jj(e,u){let[c,l]=e.split(":").map(Number),n=((c*60+l+u)%1440+1440)%1440,a=r=>String(r).padStart(2,"0");return`${a(Math.floor(n/60))}:${a(n%60)}`}function Hj(e){ue();let u=(0,Ts.useRef)(e);u.current=e;let c=(0,Ts.useRef)(null);e.event&&(c.current=e.event);let l=e.event??c.current,n=l?.editable===!1,a=(0,Ts.useRef)(n);a.current=n;let r=(0,Ts.useRef)(!!e.onDelete);e.open&&(r.current=!!e.onDelete);let t=(0,qj.useGlobalForm)({formId:Dt("taskbox-google-event-form"),initialValues:b$,onValidate:i=>u.current.busy||a.current?!1:i.title.trim()?i.startDate?!0:((0,Rp.ErrorAlert)(I("googleEvent.selectStartDate")),!1):((0,Rp.ErrorAlert)(I("googleEvent.enterTitle")),!1),onSubmit:i=>{let s=i.endDate&&i.endDate>=i.startDate?i.endDate:i.startDate;return u.current.onSave({title:i.title.trim(),start_date:i.startDate,end_date:s,time:i.allDay?"":i.startTime,end_time:i.allDay?"":i.endTime,location:i.location.trim(),description:i.description.trim()}),!0}}),o={event:li({modalId:Dt("taskbox-google-event"),open:e.open,onClose:()=>u.current.onClose()})};(0,Ts.useEffect)(()=>{let i=e.event;if(!e.open||!i)return;let s=!!i.time;t.setFormValues({title:i.title==="(\uC81C\uBAA9 \uC5C6\uC74C)"?"":i.title,allDay:!s,startDate:i.start_date,endDate:i.end_date||i.start_date,startTime:s?i.time:"09:00",endTime:s?i.end_time||jj(i.time,60):"10:00",location:i.location??"",description:i.description??""})},[e.open,e.event]);let d={changeStartDate:i=>{let s=String(t.getFormValue("endDate")??"");t.setFormValue("startDate",i),(!s||s<i)&&t.setFormValue("endDate",i)},changeEndDate:i=>t.setFormValue("endDate",i),changeStartTime:i=>{let s=t.getFormValues();t.setFormValue("startTime",i),s.startDate===s.endDate&&s.endTime<=i&&t.setFormValue("endTime",jj(i,60))},changeEndTime:i=>t.setFormValue("endTime",i),changeAllDay:i=>t.setFormValue("allDay",i),remove:()=>u.current.onDelete?.()};return{form:t,modals:o,event:l,readOnly:n,busy:!!e.busy,canDelete:r.current,actions:d}}_e();var dn=require("react/jsx-runtime");function Wj(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return e||I("googleEvent.pickDate");let[u,c,l]=e.split("-").map(Number),n=Ui(new Date(u,c-1,l).getDay());return`${u}.${String(c).padStart(2,"0")}.${String(l).padStart(2,"0")} (${n})`}function Dp(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?new Date(`${e}T00:00:00`):new Date}function Vj(e){let u=c=>String(c).padStart(2,"0");return`${e.getFullYear()}-${u(e.getMonth()+1)}-${u(e.getDate())}`}function Gj(e){let u=/^(\d{2}):(\d{2})$/.exec(e);return u?{hour:u[1],minute:u[2]}:{hour:"09",minute:"00"}}function y$(e){switch(e){case"fromGmail":return I("googleEvent.typeFromGmail");case"birthday":return I("googleEvent.typeBirthday");case"outOfOffice":return I("googleEvent.typeOutOfOffice");case"focusTime":return I("googleEvent.typeFocusTime");case"workingLocation":return I("googleEvent.typeWorkingLocation");default:return I("googleEvent.typeThis")}}function v$(e){let[u,c,l]=e.split("-").map(Number);window.open(`https://calendar.google.com/calendar/r/day/${u}/${c}/${l}`,"_blank")}function Am({icon:e,label:u,placeholder:c,disabled:l,onClick:n}){return(0,dn.jsxs)(zr.ButtonBase,{disabled:l,onClick:a=>n(a.currentTarget),sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.9,borderRadius:1,border:"1px solid #d9d9d6",bgcolor:l?"#f7f7f5":"#fff",color:u?"#37352f":"#9b9a97",fontSize:15,fontWeight:500,minWidth:0,whiteSpace:"nowrap","&:hover":{bgcolor:"#f7f7f5"},"&.Mui-disabled":{color:"#b9b8b4"}},children:[e,u||c]})}function k$(e){ue();let u=Sn(),c=Hj(e),l=(0,Uj.useTimePickerVariant)(void 0),{form:n,event:a,readOnly:r,busy:t,actions:o}=c,d=c.modals.event,i=!!n.useValue("allDay"),s=String(n.useValue("startDate")??""),h=String(n.useValue("endDate")??""),f=String(n.useValue("startTime")??""),m=String(n.useValue("endTime")??""),[b,g]=(0,eu.useState)(null),[w,S]=(0,eu.useState)(null),[O,P]=(0,eu.useState)(null),[j,M]=(0,eu.useState)(null),N=a?(0,dn.jsxs)(zr.Box,{sx:{display:"flex",flexDirection:"column",gap:2.25,pt:.5},children:[(0,dn.jsx)(zr.Box,{sx:{bgcolor:r?"#fff4e5":"#f2f6fa",borderRadius:1,px:1.5,py:1,fontSize:14.5,lineHeight:1.7,color:"#37352f"},children:r?I("googleEvent.readOnly",{value:y$(a.event_type)}):I(a.recurring?"googleEvent.editableRecurring":"googleEvent.editable",{calendar:a.calendar||I("calendar.googleCalendar")})}),(0,dn.jsx)(Em.ClearTextField,{label:I("common.title"),name:"title",form:n,disabled:r,onKeyDown:z=>{z.key==="Enter"&&(z.preventDefault(),n.submit())},fullWidth:!0,autoFocus:!u&&!r}),(0,dn.jsx)(zr.FormControlLabel,{control:(0,dn.jsx)(zr.Switch,{checked:i,disabled:r,onChange:(z,W)=>o.changeAllDay(W),size:"small"}),label:I("googleEvent.allDay"),sx:{ml:0,"& .MuiFormControlLabel-label":{fontSize:15,color:"#37352f"}}}),(0,dn.jsxs)(zr.Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[(0,dn.jsxs)(zr.Box,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[(0,dn.jsx)(zr.Box,{sx:{width:44,fontSize:14.5,color:"#57564f",flexShrink:0},children:I("googleEvent.start")}),(0,dn.jsx)(Am,{icon:(0,dn.jsx)(Np.default,{sx:{fontSize:18,color:"#787774"}}),label:Wj(s),placeholder:I("googleEvent.pickDate"),disabled:r,onClick:g}),i?null:(0,dn.jsx)(Am,{icon:(0,dn.jsx)(Lp.default,{sx:{fontSize:18,color:"#787774"}}),label:f,placeholder:I("googleEvent.time"),disabled:r,onClick:P})]}),(0,dn.jsxs)(zr.Box,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[(0,dn.jsx)(zr.Box,{sx:{width:44,fontSize:14.5,color:"#57564f",flexShrink:0},children:I("googleEvent.end")}),(0,dn.jsx)(Am,{icon:(0,dn.jsx)(Np.default,{sx:{fontSize:18,color:"#787774"}}),label:Wj(h),placeholder:I("googleEvent.pickDate"),disabled:r,onClick:S}),i?null:(0,dn.jsx)(Am,{icon:(0,dn.jsx)(Lp.default,{sx:{fontSize:18,color:"#787774"}}),label:m,placeholder:I("googleEvent.time"),disabled:r,onClick:M})]})]}),(0,dn.jsx)(Em.ClearTextField,{label:I("googleEvent.location"),name:"location",form:n,disabled:r,fullWidth:!0}),(0,dn.jsx)(Em.ClearTextField,{label:I("googleEvent.description"),name:"description",form:n,disabled:r,fullWidth:!0,multiline:!0,minRows:3,maxRows:8}),(0,dn.jsx)(Cl.DatePicker,{anchorEl:b,open:!!b,onClose:()=>g(null),selectedDate:Dp(s),onDateChange:z=>{o.changeStartDate(Vj(z)),g(null)},centered:u,locale:xi()}),(0,dn.jsx)(Cl.DatePicker,{anchorEl:w,open:!!w,onClose:()=>S(null),selectedDate:Dp(h||s),minDate:s?Dp(s):void 0,onDateChange:z=>{o.changeEndDate(Vj(z)),S(null)},centered:u,locale:xi()}),(0,dn.jsx)(Cl.TimePicker,{timeVariant:l,anchorEl:O,open:!!O,onClose:()=>P(null),value:Gj(f),format:"HH:mm",minuteStep:5,autoApply:!0,centered:u,locale:xi(),onChange:(z,W)=>{o.changeStartTime(`${z}:${W}`),P(null)}}),(0,dn.jsx)(Cl.TimePicker,{timeVariant:l,anchorEl:j,open:!!j,onClose:()=>M(null),value:Gj(m),format:"HH:mm",minuteStep:5,autoApply:!0,centered:u,locale:xi(),onChange:(z,W)=>{o.changeEndTime(`${z}:${W}`),M(null)}})]}):null;return(0,dn.jsx)(Kj.FormDialog,{open:d.isOpen,onClose:d.close,width:520,title:I("googleEvent.title"),locale:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!r&&c.canDelete,confirmConfig:{title:a?.recurring?I("googleEvent.deleteOccurrenceConfirm"):I("googleEvent.deleteConfirm"),confirmText:I("common.delete")}}},onDelete:o.remove,fontScale:{enabled:!0},fontScaleKey:"taskbox-google-event",sectionContentPaddingTop:0,sections:[{id:"google-event",showTitle:!1,children:N}],actions:{showCancelButton:!r,right:r?(0,dn.jsxs)(zr.Box,{sx:{display:"flex",gap:"1rem",alignItems:"center"},children:[(0,dn.jsx)(zr.Button,{variant:"outlined",startIcon:(0,dn.jsx)($j.default,{}),onClick:()=>a&&v$(a.start_date),children:I("googleEvent.openInGoogle")}),(0,dn.jsx)(zr.Button,{variant:"contained",onClick:d.close,sx:{minWidth:72},children:I("common.close")})]}):(0,dn.jsx)(zr.Button,{variant:"contained",onClick:()=>{n.submit()},disabled:t,children:I("common.save")})}})}var nu=require("react"),Ni=require("@mui/material"),Yj=require("@ehfuse/mui-form-dialog"),Zj=require("@ehfuse/mui-form-controls"),Qj=require("@ehfuse/tree-view");var tu=require("react"),Pm=require("@ehfuse/forma");function x$(e){let u=[],c=l=>{for(let n of l.employees??[])u.push(n);for(let n of l.groups??[])c(n)};for(let l of e)c(l);return u}function Xj(e){let u=(0,tu.useRef)(e);u.current=e;let c=(0,tu.useMemo)(()=>x$(e.groups),[e.groups]),l=(0,tu.useRef)(c);l.current=c;let n=(0,Pm.useFormaState)({openCount:0}),a=(0,Pm.useGlobalForm)({formId:Dt("taskbox-employee-select-form"),initialValues:{selectedSeqs:[]},onSubmit:o=>{let d=l.current.filter(i=>o.selectedSeqs.includes(i.seq));return u.current.onConfirm(u.current.multiple?d:d.slice(0,1)),u.current.onClose(),!0}}),r={select:li({modalId:Dt("taskbox-employee-select"),open:e.open,onClose:()=>u.current.onClose(),onOpen:()=>{a.setFormValues({selectedSeqs:u.current.selectedSeqs}),n.setValue("openCount",Number(n.getValue("openCount")??0)+1)}})};return{form:a,modals:r,ui:n,allEmployees:c,changeSelection:o=>a.setFormValue("selectedSeqs",o)}}_e();var lo=require("react/jsx-runtime");function Jj(e){return`${e.name}#${e.seq}`}function w$(e){return Number(e.slice(e.lastIndexOf("#")+1))||0}function T$(e,u){return u?[e.name,e.department,e.role_name,e.work_position].filter(Boolean).some(c=>String(c).toLowerCase().includes(u)):!0}function S$(e){let u=[[e.name,e.role_name].filter(Boolean).join(" "),e.department].filter(Boolean).join(" / ");return{id:`emp:${e.seq}`,label:Jj(e),renderLabel:(0,lo.jsx)(Ni.Box,{component:"span",sx:{display:"inline-flex",alignItems:"baseline",gap:.75},children:(0,lo.jsx)(Ni.Box,{component:"span",sx:{fontWeight:400,color:"text.primary"},children:u})})}}function eq(e,u){let c=(e.groups??[]).map(n=>eq(n,u)).filter(n=>n!==null),l=(e.employees??[]).filter(n=>T$(n,u)).map(S$);return c.length===0&&l.length===0?null:{id:`group:${e.key}`,label:e.name,children:[...c,...l]}}function C$({groups:e,allEmployees:u,initialSelectedSeqs:c,multiple:l,isMobile:n,onSelectionChange:a}){ue();let[r,t]=(0,nu.useState)(""),o=(0,nu.useMemo)(()=>e.map(i=>eq(i,r.trim().toLowerCase())).filter(i=>i!==null),[e,r]),d=(0,nu.useMemo)(()=>u.filter(i=>c.includes(i.seq)).map(Jj),[]);return(0,lo.jsxs)(lo.Fragment,{children:[(0,lo.jsx)(Ni.Box,{sx:{px:1.5,py:1,borderBottom:"1px solid #cccccc",flexShrink:0},children:(0,lo.jsx)(Zj.SearchTextField,{size:"small",fullWidth:!0,placeholder:I("dialog.searchNameDept"),onSearch:t,onClear:()=>t(""),sx:{"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiInputBase-root":{px:0}}})}),(0,lo.jsx)(Ni.Box,{sx:n?{display:"flex",flexDirection:"column"}:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:(0,lo.jsx)(Qj.TreeView,{items:o,checkbox:!0,multiSelect:l,selectionMode:"child",showSearch:!1,defaultExpanded:!0,initialSelections:d,onChange:i=>a(i.map(w$).filter(s=>s>0)),styles:{border:"none",borderRadius:"0"}})})]})}function _$({open:e,title:u=I("dialog.selectEmployee"),hint:c="",groups:l,multiple:n=!1,selectedSeqs:a,confirmText:r=I("common.confirm"),onConfirm:t,onClose:o}){ue();let d=Sn(),i=a??[],s=Xj({open:e,groups:l,multiple:n,selectedSeqs:i,onConfirm:t,onClose:o}),{form:h,allEmployees:f}=s,m=s.modals.select,b=h.useValue("selectedSeqs")??[],g=Number(s.ui.useValue("openCount")??0);return(0,lo.jsx)(Yj.FormDialog,{open:m.isOpen,onClose:m.close,title:n&&b.length>0?I("dialog.titleWithPeople",{title:u,count:b.length}):u,locale:Pt(),fullScreen:d,mobilePresentation:d?"slide":"dialog",draggable:!0,width:"600px",tabs:{visible:!1},titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},scrollPastLastSection:!1,sectionContentPaddingTop:0,fontScale:{enabled:!0},fontScaleKey:"taskbox-employee-select",sections:[{id:"employee-select",title:I("dialog.selectEmployee"),showTitle:!1,children:(0,lo.jsx)(Ni.Box,{sx:{...d?{}:{height:560},display:"flex",flexDirection:"column",border:"1px solid #cccccc",borderRadius:1,...d?{}:{overflow:"hidden"},userSelect:"none"},children:(0,lo.jsx)(C$,{groups:l,allEmployees:f,initialSelectedSeqs:i,multiple:n,isMobile:d,onSelectionChange:s.changeSelection},g)})}],dialogActionSx:{"@media (max-width:1023.95px)":{gap:"0.75rem !important","& .left-actions":{flex:1,minWidth:0},"& .right-actions":{flex:1}}},actions:{visible:!0,showCancelButton:!1,left:c?(0,lo.jsx)(Ni.Typography,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-line",lineHeight:1.35},children:c}):void 0,right:(0,lo.jsx)(Ni.Button,{variant:"contained",onClick:()=>{h.submit()},children:r})}})}var Wq=require("react"),Go=require("@mui/material"),Vq=require("@ehfuse/mui-form-dialog"),qm=require("@ehfuse/mui-form-controls"),Gq=v(require("@mui/icons-material/SpeedOutlined"),1);Xa();pn();var Xr=require("@mui/material"),iq=require("@ehfuse/mui-form-dialog"),Rm=require("@ehfuse/mui-form-controls"),aq=v(require("@ehfuse/overlay-scrollbar"),1);var Mm=require("react"),tq=require("@ehfuse/forma");Xa();function nq(e){return`byAccount.a${e}`}function ru(e){return Math.max(0,Math.floor(Number(e)||0))}function zp(e){return{basis:e.basis,default_capacity:e.default_capacity,byAccount:Object.fromEntries(Object.entries(e.by_account??{}).map(([u,c])=>[`a${u}`,c]))}}function rq({open:e,capacity:u,onClose:c,onSave:l}){let n=(0,tq.useGlobalForm)({formId:Dt("taskbox-workload-capacity-form"),initialValues:zp(u??Xo),onSubmit:async t=>{let o={};for(let[d,i]of Object.entries(t.byAccount??{})){let s=ru(i),h=Number(d.slice(1));h>0&&s>0&&(o[h]=s)}return await l({...u??Xo,basis:t.basis,default_capacity:ru(t.default_capacity),by_account:o}),!0}}),a={form:$r({modalIdPrefix:"taskbox-workload-capacity-dialog",open:e,onClose:c,onOpen:()=>n.setFormValues(zp(u??Xo))})},r=(0,Mm.useRef)(!0);return(0,Mm.useEffect)(()=>{if(r.current){r.current=!1;return}e&&n.setFormValues(zp(u??Xo))},[u]),{form:n,modals:a}}_e();var ar=require("react/jsx-runtime"),I$=[{value:"count",get label(){return I("workload.basisCount")}},{value:"points",get label(){return I("workload.basisPoints")}}];function oq({form:e,name:u,unit:c,size:l,clearWhenZero:n}){let a=ru(e.useFormValue(u));return(0,ar.jsx)(Rm.NumberField,{size:l,fullWidth:!0,min:0,max:999,thousandSeparator:!1,align:"right",suffix:c,clearWhenZero:n,value:a,onValueChange:r=>e.setFormValue(u,ru(r))})}function Fp({open:e,capacity:u,employees:c,onClose:l,onSave:n}){ue();let{form:a,modals:r}=rq({open:e,capacity:u,onClose:l,onSave:n}),t=a.useFormValue("basis")==="points"?"SP":I("chart.unitCount");return(0,ar.jsx)(iq.FormDialog,{open:r.form.isOpen,onClose:r.form.close,maxWidth:"sm",title:I("workload.title"),locale:Pt(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-workload-capacity",tabs:{visible:!1},actions:{showCancelButton:!0,right:(0,ar.jsx)(Xr.Button,{variant:"contained",onClick:()=>{a.submit()},children:I("common.save")})},sectionContentPaddingTop:0,sections:[{id:"capacity",title:"",showTitle:!1,children:(0,ar.jsxs)(Xr.Box,{sx:{display:"flex",flexDirection:"column",gap:2},children:[(0,ar.jsx)(Xr.Box,{sx:{fontSize:15,color:"#37352f"},children:I("workload.intro")}),(0,ar.jsxs)(Xr.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,ar.jsx)(Xr.Box,{sx:{width:104,flexShrink:0,fontSize:16,color:"#37352f"},children:I("workload.basis")}),(0,ar.jsx)(Rm.LabelSelect,{form:a,name:"basis",size:"medium",fullWidth:!0,label:"",options:I$})]}),(0,ar.jsxs)(Xr.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,ar.jsx)(Xr.Box,{sx:{width:104,flexShrink:0,fontSize:16,color:"#37352f"},children:I("workload.defaultCapacity")}),(0,ar.jsx)(oq,{form:a,name:"default_capacity",size:"medium",unit:t})]}),(0,ar.jsx)(Xr.Box,{sx:{pl:"119px",mt:-1.25,fontSize:13.5,color:"#37352f"},children:I("workload.defaultHint",{unit:t})}),(0,ar.jsx)(Xr.Box,{sx:{fontSize:16,fontWeight:700,color:"#37352f"},children:I("workload.perPerson")}),c.length===0?(0,ar.jsx)(Xr.Box,{sx:{fontSize:15,color:"#787774"},children:I("workload.noEmployees")}):(0,ar.jsx)(Xr.Box,{sx:{border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,overflow:"hidden"},children:(0,ar.jsx)(aq.default,{style:{maxHeight:260},thumb:{width:6},children:c.filter(o=>Number(o.account_seq)>0).map(o=>(0,ar.jsxs)(Xr.Box,{sx:{display:"flex",alignItems:"center",gap:1.5,px:2,py:1,borderBottom:"1px solid #f2f2f0","&:last-of-type":{borderBottom:"none"}},children:[(0,ar.jsxs)(Xr.Box,{sx:{flex:1,minWidth:0,fontSize:16,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[o.name,o.department?(0,ar.jsx)(Xr.Box,{component:"span",sx:{ml:1,fontSize:14,color:"#787774"},children:o.department}):null]}),(0,ar.jsx)(Xr.Box,{sx:{width:132,flexShrink:0},children:(0,ar.jsx)(oq,{form:a,name:nq(Number(o.account_seq)),size:"small",unit:t,clearWhenZero:!0})})]},o.account_seq))})})]})}]})}var zm=require("react"),Bq=require("@mui/material"),mu=require("react/jsx-runtime");function W$({height:e}){return(0,mu.jsx)(Bq.Box,{sx:typeof e=="number"?{height:e,minHeight:120}:{position:"absolute",inset:0}})}function hu(e,u){let c=(0,zm.lazy)(e);return function(n){return(0,mu.jsx)(zm.Suspense,{fallback:(0,mu.jsx)(W$,{height:n.height??u}),children:(0,mu.jsx)(c,{...n})})}}var Jp=hu(()=>Promise.resolve().then(()=>(mq(),dq)).then(e=>({default:e.SprintVelocityChart})),200),eg=hu(()=>Promise.resolve().then(()=>(gq(),pq)).then(e=>({default:e.SprintBurndownChart})),200),tg=hu(()=>Promise.resolve().then(()=>(xq(),kq)).then(e=>({default:e.CumulativeFlowChart})),220),ng=hu(()=>Promise.resolve().then(()=>(Sq(),Tq)).then(e=>({default:e.LeadTimeDistributionChart})),200),rg=hu(()=>Promise.resolve().then(()=>(Iq(),_q)).then(e=>({default:e.WorkloadChart})),200);da();La();var Fm=require("@mui/material"),Lq=require("@ehfuse/mui-form-dialog");pn();var Mq=require("react"),Pn=require("@mui/material"),Rq=v(require("@mui/icons-material/PersonOutlineOutlined"),1),Dq=v(require("@ehfuse/overlay-scrollbar"),1);Cs();_e();var En=require("react/jsx-runtime"),Oq=56,Aq=68,Eq=96;function V$(e){let u=String(e.due_date??"").slice(0,10);return u?u.slice(5).replace("-","/"):"-"}function Pq(e,u){let c=String(e.due_date??"").slice(0,10);return!!c&&c<u}function og({tasks:e,row:u,todayStr:c,employees:l,rows:n,height:a=200,hideSummary:r=!1,onChangeManager:t,onOpenTask:o}){ue();let[d,i]=(0,Mq.useState)(null),s=cu(e,u.accountSeq),h=f=>n.find(m=>m.accountSeq===f)?.total??0;return(0,En.jsxs)(Pn.Box,{sx:{display:"flex",flexDirection:"column",minHeight:0,height:a},children:[r?null:(0,En.jsxs)(Pn.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:.5,pb:.75,fontSize:14,color:"#37352f"},children:[(0,En.jsx)(Pn.Box,{component:"span",sx:{fontWeight:700},children:u.name}),(0,En.jsx)(Pn.Box,{component:"span",children:I("chart.openCount",{count:s.length})}),u.capacity>0?(0,En.jsx)(Pn.Box,{component:"span",sx:{color:u.load>u.capacity?"#e5484d":"#787774"},children:I("chart.capacityOf",{capacity:u.capacity,load:u.load})}):null]}),(0,En.jsxs)(Pn.Box,{sx:{flex:1,minHeight:0,display:"flex",flexDirection:"column",border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,overflow:"hidden"},children:[(0,En.jsxs)(Pn.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,flexShrink:0,bgcolor:"#fafaf9",borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,fontSize:13.5,fontWeight:600,color:"#37352f"},children:[(0,En.jsx)(Pn.Box,{sx:{width:Oq,flexShrink:0},children:I("board.due")}),(0,En.jsx)(Pn.Box,{sx:{flex:1,minWidth:0},children:I("template.task")}),(0,En.jsx)(Pn.Box,{sx:{width:Aq,flexShrink:0,textAlign:"center"},children:I("col.priority")}),t?(0,En.jsx)(Pn.Box,{sx:{width:Eq,flexShrink:0,textAlign:"center"},children:I("col.owner")}):null]}),(0,En.jsx)(Pn.Box,{sx:{flex:1,minHeight:0},children:(0,En.jsx)(Dq.default,{style:{height:"100%"},thumb:{width:6},children:s.length===0?(0,En.jsx)(Pn.Box,{sx:{p:2,fontSize:14,color:"#9a9a97"},children:I("chart.noOpenTasks")}):s.map(f=>(0,En.jsxs)(Pn.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1.5,borderBottom:"1px solid #f2f2f0"},children:[(0,En.jsx)(Pn.Box,{sx:{width:Oq,flexShrink:0,fontSize:13.5,color:Pq(f,c)?"#e5484d":"#787774",fontWeight:Pq(f,c)?700:400},children:V$(f)}),(0,En.jsx)(Pn.Box,{onClick:o?()=>o(f.seq):void 0,sx:{flex:1,minWidth:0,fontSize:14.5,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...o?{cursor:"pointer","&:hover":{textDecoration:"underline"}}:{}},children:f.title}),(0,En.jsx)(Pn.Box,{sx:{width:Aq,flexShrink:0,display:"flex",justifyContent:"center"},children:(0,En.jsx)(Gr,{priority:f.priority})}),t?(0,En.jsx)(Pn.Box,{sx:{width:Eq,flexShrink:0,display:"flex",justifyContent:"center"},children:(0,En.jsx)(Pn.Button,{size:"small",variant:"outlined",startIcon:(0,En.jsx)(Rq.default,{sx:{fontSize:17}}),onClick:m=>i({el:m.currentTarget,taskSeq:f.seq}),children:I("chart.move")})}):null]},f.seq))})})]}),(0,En.jsx)(Pn.Menu,{anchorEl:d?.el??null,open:!!d,onClose:()=>i(null),transitionDuration:0,children:l.filter(f=>Number(f.account_seq)>0&&Number(f.account_seq)!==u.accountSeq).map(f=>(0,En.jsxs)(Pn.MenuItem,{onClick:()=>{d&&t&&t(d.taskSeq,Number(f.account_seq),f.name),i(null)},sx:{fontSize:14,minWidth:200},children:[(0,En.jsx)(Pn.Box,{sx:{flex:1},children:f.name}),(0,En.jsx)(Pn.Box,{component:"span",sx:{ml:2,fontSize:13,color:"#787774"},children:I("chart.countValue",{count:h(Number(f.account_seq))})})]},f.account_seq))})]})}Cs();var Ol=require("react");function Nq({open:e,row:u,onClose:c,onOpenTask:l}){let[n,a]=(0,Ol.useState)(u);(0,Ol.useEffect)(()=>{u&&a(u)},[u]);let r=(0,Ol.useRef)(0),t={dialog:$r({modalIdPrefix:"taskbox-workload-person-dialog",open:e,onClose:()=>{c();let d=r.current;r.current=0,d>0&&l?.(d)}})};return{modals:t,shown:u??n,openTask:l?d=>{if(!t.dialog.isOpen){l(d);return}r.current=d,t.dialog.close()}:void 0}}_e();var fu=require("react/jsx-runtime");function ig({open:e,row:u,rows:c,tasks:l,todayStr:n,employees:a,onClose:r,onChangeManager:t,onOpenTask:o}){ue();let{modals:d,shown:i,openTask:s}=Nq({open:e,row:u,onClose:r,onOpenTask:o}),h=i?cu(l,i.accountSeq).length:0;return(0,fu.jsx)(Lq.FormDialog,{open:d.dialog.isOpen,onClose:d.dialog.close,maxWidth:"sm",title:i?I("workload.personTasksTitle",{name:i.name,count:h}):I("template.task"),locale:Pt(),titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-workload-person",tabs:{visible:!1},actions:{showCancelButton:!1,right:(0,fu.jsx)(Fm.Button,{variant:"contained",onClick:d.dialog.close,children:I("common.close")})},sections:[{id:"person-tasks",title:"",showTitle:!1,children:(0,fu.jsx)(Fm.Box,{sx:{minHeight:0},children:i?(0,fu.jsx)(og,{tasks:l,row:i,rows:c,todayStr:n,employees:a,height:"min(420px, 52vh)",hideSummary:!0,onChangeManager:t,onOpenTask:s}):null})}]})}pn();var Fq=require("react"),mo=require("@mui/material"),jq=require("@ehfuse/overlay-scrollbar");da();Cs();La();_e();var _r=require("react/jsx-runtime"),zq="#e5484d",G$="#2f80ed",U$="#9a9a97",ag=30,$$=96,jm=56;function sg({count:e,max:u,color:c,title:l}){let n=e>0&&u>0?.18+e/u*.72:0;return(0,_r.jsx)(mo.Tooltip,{title:l,arrow:!0,disableInteractive:!0,placement:"top",children:(0,_r.jsx)(mo.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",borderRight:`1px solid ${De.NOTION_LINE_COLOR}`,borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,bgcolor:n>0?`${c}${Math.round(n*255).toString(16).padStart(2,"0")}`:"transparent",color:n>.55?"#fff":"#37352f",fontSize:12.5,fontWeight:e>0?700:400,fontVariantNumeric:"tabular-nums"},children:e>0?e:""})})}function lg({tasks:e,todayStr:u,weeks:c=6,height:l=200}){ue();let n=(0,Fq.useMemo)(()=>Zp(e,{todayStr:u,weeks:c}),[e,u,c]);if(n.rows.length===0)return(0,_r.jsx)(mo.Box,{sx:Ar(l),children:(0,_r.jsx)(co,{text:I("chart.noAssignedOpen"),height:l})});let a=`${$$}px ${jm}px repeat(${n.weeks.length}, minmax(${jm}px, 1fr)) ${jm}px ${jm}px`,r={height:ag,display:"flex",alignItems:"center",justifyContent:"center",borderRight:`1px solid ${De.NOTION_LINE_COLOR}`,borderBottom:"1px solid #dcdad6",fontSize:12,fontWeight:700,color:"#37352f",bgcolor:"#f8f8f7",whiteSpace:"nowrap"};return(0,_r.jsx)(mo.Box,{sx:Ar(l),children:(0,_r.jsx)(jq.OverlayScrollbar,{style:{height:"100%"},thumb:{width:8},children:(0,_r.jsxs)(mo.Box,{sx:{display:"grid",gridTemplateColumns:a,minWidth:"fit-content",height:"100%",gridTemplateRows:`${ag}px repeat(${n.rows.length}, minmax(${ag}px, 1fr))`},children:[(0,_r.jsx)(mo.Box,{sx:{...r,justifyContent:"flex-start",pl:1},children:I("chart.assignee")}),(0,_r.jsx)(mo.Box,{sx:{...r,color:zq},children:I("chart.overdue")}),n.weeks.map(t=>(0,_r.jsx)(mo.Box,{sx:{...r,...t.isCurrent?{borderBottom:"2px solid #2f80ed"}:{}},children:t.label},t.start)),(0,_r.jsx)(mo.Box,{sx:r,children:I("chart.noDue")}),(0,_r.jsx)(mo.Box,{sx:r,children:I("chart.total")}),n.rows.map(t=>(0,_r.jsxs)(mo.Box,{sx:{display:"contents"},children:[(0,_r.jsx)(mo.Box,{sx:{display:"flex",alignItems:"center",pl:1,borderRight:`1px solid ${De.NOTION_LINE_COLOR}`,borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,fontSize:13,color:t.accountSeq>0?"#37352f":"#9a9a97",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name}),(0,_r.jsx)(sg,{count:t.overdue,max:n.maxCell,color:zq,title:I("chart.cellOverdue",{name:t.name,count:t.overdue})}),t.byWeek.map((o,d)=>(0,_r.jsx)(sg,{count:o,max:n.maxCell,color:G$,title:I("chart.cellWeek",{name:t.name,week:n.weeks[d].label,count:o})},n.weeks[d].start)),(0,_r.jsx)(sg,{count:t.noDue,max:n.maxCell,color:U$,title:I("chart.cellNoDue",{name:t.name,count:t.noDue})}),(0,_r.jsxs)(mo.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,fontSize:12.5,fontWeight:700,color:"#37352f",fontVariantNumeric:"tabular-nums"},children:[t.total,t.beyond>0?(0,_r.jsxs)(mo.Box,{component:"span",sx:{ml:.25,fontSize:10.5,color:"#9a9a97"},children:["(+",t.beyond,")"]}):null]})]},t.accountSeq))]})})})}var _s=require("react"),qq=require("@ehfuse/forma");Cs();function Hq({open:e,sprints:u,tasks:c,todayStr:l,initialSprintSeq:n,capacity:a,onSaveCapacity:r,onOpenTask:t,onClose:o}){let d=(0,qq.useGlobalForm)({formId:Dt("taskbox-sprint-charts-form"),initialValues:{sprintSeq:"",flowDays:"30",workloadMode:"distribution"}}),[i,s]=(0,_s.useState)(0),[h,f]=(0,_s.useState)(!1),m=(0,_s.useRef)(0),b={charts:$r({modalIdPrefix:"taskbox-sprint-charts-dialog",open:e,onClose:()=>{o();let P=m.current;m.current=0,P>0&&t?.(P)},onOpen:()=>{let P=u.find(M=>M.status==="active")??u[0],j=u.find(M=>M.seq===n)??P;d.setFormValue("sprintSeq",j?.seq?String(j.seq):"")}})},g=(0,_s.useMemo)(()=>lu(c,{todayStr:l,capacity:a}),[c,l,a]),w=g.find(P=>P.accountSeq===i)??null;return{form:d,modals:b,workloadRows:g,pickedAccountSeq:i,pickedRow:w,pickPerson:s,closePersonTasks:()=>s(0),capacityOpen:h,openCapacity:()=>f(!0),closeCapacity:()=>f(!1),saveCapacity:r?async P=>{await r(P),f(!1)}:void 0,openTask:t?P=>{if(!b.charts.isOpen){t(P);return}m.current=P,b.charts.close()}:void 0}}_e();var fn=require("react/jsx-runtime"),Uq="min(560px, 62vh)",K$=`calc(${Uq} - 4px)`,X$=[{value:"30",get label(){return I("chart.last30")}},{value:"60",get label(){return I("chart.last60")}},{value:"90",get label(){return I("chart.last90")}}];function Y$({open:e,sprints:u,tasks:c,todayStr:l,showSprintCharts:n,capacity:a=Xo,capacityEmployees:r=[],onSaveCapacity:t,onChangeTaskManager:o,onOpenTask:d,initialSprintSeq:i=0,onClose:s}){ue();let h=Hq({open:e,sprints:u,tasks:c,todayStr:l,initialSprintSeq:i,capacity:a,onSaveCapacity:t,onOpenTask:d,onClose:s}),{form:f,modals:m,workloadRows:b,pickedAccountSeq:g,pickedRow:w}=h,S=Number(f.useFormValue("sprintSeq"))||0,O=Number(f.useFormValue("flowDays"))||30,P=f.useFormValue("workloadMode")==="timeline"?"timeline":"distribution",j=(0,Wq.useMemo)(()=>u.find(B=>B.seq===S)??null,[u,S]),M={height:K$,boxSizing:"border-box",px:3,py:2.5,display:"flex",flexDirection:"column",minHeight:0,overflow:"hidden"},N=(0,fn.jsx)(qm.LabelSelect,{form:f,name:"sprintSeq",label:I("col.goal"),showLabel:!1,showEmptyOption:!1,options:u.map(B=>({value:String(B.seq),label:Wo(B)})),sx:{width:280,flexShrink:0}}),z=(0,fn.jsx)(qm.LabelSelect,{form:f,name:"workloadMode",label:I("chart.view"),showLabel:!1,showEmptyOption:!1,options:[{value:"distribution",label:I("chart.loadNow")},{value:"timeline",label:I("chart.weeklyDue")}],sx:{width:280,flexShrink:0}}),W=(0,fn.jsxs)(fn.Fragment,{children:[z,t?(0,fn.jsx)(Go.Button,{size:"small",variant:"outlined",startIcon:(0,fn.jsx)(Gq.default,{sx:{fontSize:18}}),onClick:h.openCapacity,sx:{flexShrink:0},children:I("chart.capacity")}):null]}),F=n??u.length>0,C=(0,fn.jsx)(qm.LabelSelect,{form:f,name:"flowDays",label:I("chart.period"),showLabel:!1,showEmptyOption:!1,options:X$,sx:{width:280,flexShrink:0}});return(0,fn.jsxs)(fn.Fragment,{children:[(0,fn.jsx)(Vq.FormDialog,{open:m.charts.isOpen,onClose:m.charts.close,maxWidth:"md",title:I("chart.title"),locale:Pt(),contentTopPadding:0,contentPaddingX:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,sectionTitleGap:0,fixedHeight:Uq,contentBottomPadding:0,scrollPastLastSection:!1,tabs:{visible:!0,switchContent:!0,fullWidth:!0},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-charts",sections:[...F?[{id:"velocity",tabTitle:I("chart.velocity"),showTitle:!1,children:(0,fn.jsx)(Go.Box,{sx:M,children:(0,fn.jsx)(Jp,{sprints:u,tasks:c,height:"100%"})})},{id:"burndown",tabTitle:I("chart.burndown"),showTitle:!1,children:(0,fn.jsx)(Go.Box,{sx:M,children:j?(0,fn.jsx)(eg,{sprint:j,tasks:c,todayStr:l,height:"100%",headerLeft:N}):(0,fn.jsxs)(Go.Box,{sx:Ar("100%"),children:[(0,fn.jsx)(Go.Box,{sx:uo,children:N}),(0,fn.jsx)(co,{text:I("chart.pickGoalForBurndown"),height:"100%"})]})})},{id:"cumulative-flow",tabTitle:I("chart.cfd"),showTitle:!1,children:(0,fn.jsx)(Go.Box,{sx:M,children:(0,fn.jsx)(tg,{tasks:c,todayStr:l,days:O,height:"100%",headerLeft:C})})}]:[],{id:"workload",tabTitle:I("chart.workload"),showTitle:!1,children:(0,fn.jsx)(Go.Box,{sx:M,children:P==="timeline"?(0,fn.jsxs)(Go.Box,{sx:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,fn.jsx)(Go.Box,{sx:uo,children:W}),(0,fn.jsx)(lg,{tasks:c,todayStr:l,height:"100%"})]}):(0,fn.jsx)(rg,{tasks:c,todayStr:l,height:"100%",capacity:a,headerLeft:W,selectedAccountSeq:g,onSelectPerson:o?h.pickPerson:void 0})})},{id:"lead-time",tabTitle:I("chart.leadTime"),showTitle:!1,children:(0,fn.jsx)(Go.Box,{sx:M,children:(0,fn.jsx)(ng,{tasks:c,todayStr:l,days:O,height:"100%",headerLeft:C})})}],actions:{showCancelButton:!1,right:(0,fn.jsx)(Go.Button,{variant:"contained",onClick:m.charts.close,children:I("common.close")})}}),(0,fn.jsx)(ig,{open:g>0,row:w,rows:b,tasks:c,todayStr:l,employees:r,onClose:h.closePersonTasks,onChangeManager:o,onOpenTask:h.openTask}),h.saveCapacity?(0,fn.jsx)(Fp,{open:h.capacityOpen,capacity:a,employees:r,onClose:h.closeCapacity,onSave:h.saveCapacity}):null]})}da();var $q=require("react"),Kq=require("@mui/material"),ma=require("@ehfuse/mui-virtual-data-table"),Hm=require("react/jsx-runtime");function Is(e,u){return(0,$q.useMemo)(()=>u??(e?(0,ma.headerMenuAnchor)(e):null),[e,u])}function pu(e,u){let c=u.filter(n=>!e.includes(n)),l=e.filter(n=>!u.includes(n));return c.length===1&&l.length===0?{kind:"toggle",value:c[0]}:l.length===1&&c.length===0?{kind:"toggle",value:l[0]}:u.length===0?{kind:"clear"}:null}function cg({checked:e,onClick:u,disabled:c,children:l}){return(0,Hm.jsx)(ma.HeaderMenuItem,{selected:e,disabled:c,onClick:u,icon:(0,Hm.jsx)(ma.HeaderMenuIcon,{d:e?ma.HEADER_MENU_ICON_PATHS.radioOn:ma.HEADER_MENU_ICON_PATHS.radioOff,color:e?"primary.main":"text.disabled"}),children:l})}function ug({color:e}){return(0,Hm.jsx)(Kq.Box,{component:"span",sx:{width:8,height:8,borderRadius:"50%",bgcolor:e,flexShrink:0}})}var Wm=require("@ehfuse/mui-virtual-data-table");_e();var dg=require("react/jsx-runtime");function Z$({anchorPosition:e,anchorEl:u,candidates:c,selectedNames:l,avatarSrcByName:n,onToggle:a,onClear:r,onClose:t}){ue();let o=Is(u,e),d=it().avatarSrcByName,i=n??d,s=Math.round(Wm.HEADER_MENU_FONT_SIZE*1.43);return(0,dg.jsx)(Wm.HeaderMenu,{open:!!o,anchorPosition:o,onClose:t,filter:{options:c.map(h=>({value:h.name,label:h.name,icon:(0,dg.jsx)(eo,{src:i?.get(h.name)??"",name:h.name,avatarSx:{width:s,height:s,fontSize:Math.round(s/2),borderRadius:"50%",flexShrink:0,...ta[0]},iconFontSize:Math.round(s*.6)})})),value:l,onChange:h=>{let f=pu(l,h);if(!f)return;let m=f.kind==="toggle"?c.find(b=>b.name===f.value):void 0;m?a(m):r()},clearLabel:I("menu.clearFilter"),emptyText:I("menu.noMembersInList")}})}var Xq=require("react"),Al=require("@mui/material"),Yq=v(require("@mui/icons-material/KeyboardArrowDown"),1),Zq=v(require("@mui/icons-material/Check"),1);var Fi=require("react/jsx-runtime");function Q$({value:e,onChange:u,options:c}){let[l,n]=(0,Xq.useState)(null),a=c??dd,r=dd.find(t=>t.value===e)?.label??"";return(0,Fi.jsxs)(Fi.Fragment,{children:[(0,Fi.jsxs)(Al.ButtonBase,{onClick:t=>n(t.currentTarget),sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:.5,borderRadius:1,fontSize:13.5,color:"#37352f","&:hover":{bgcolor:"#f2f2f0"}},children:[r,(0,Fi.jsx)(Yq.default,{sx:{fontSize:17,color:"#9a9a97"}})]}),(0,Fi.jsx)(Al.Menu,{transitionDuration:0,anchorEl:l,open:!!l,onClose:()=>n(null),children:a.map(t=>(0,Fi.jsxs)(Al.MenuItem,{selected:t.value===e,onClick:()=>{u(t.value),n(null)},sx:{fontSize:14,minWidth:140,justifyContent:"space-between",gap:1},children:[t.label,t.value===e?(0,Fi.jsx)(Zq.default,{sx:{fontSize:16,color:"#2f80ed"}}):null]},t.value))})]})}pn();var Bs=require("@mui/material"),mg=require("@ehfuse/mui-form-controls");nc();_e();var ha=require("react/jsx-runtime"),J$=[{get label(){return I("range.month1")},months:1},{get label(){return I("range.month3")},months:3},{get label(){return I("range.month6")},months:6},{get label(){return I("range.year1")},months:12},{get label(){return I("common.all")},months:0}];function hg({fromDate:e,toDate:u,onChange:c}){ue();let l=a=>{if(a<=0){c("","");return}c(di(tc(a)),di(new Date))},n=a=>a<=0?!e&&!u:!e||!u?!1:e===di(tc(a))&&u===di(new Date);return(0,ha.jsxs)(Bs.Box,{sx:{display:"flex",alignItems:"center",gap:1.5,flexWrap:"wrap"},children:[(0,ha.jsx)(Bs.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:J$.map(a=>{let r=n(a.months);return(0,ha.jsx)(Bs.ButtonBase,{onClick:()=>l(a.months),sx:{px:1.25,py:.85,borderRadius:1,fontSize:13,fontWeight:r?500:400,border:"1px solid",borderColor:r?"#2f80ed":De.NOTION_LINE_COLOR,color:r?"#2f80ed":"#37352f",bgcolor:r?"#eef6ff":"transparent","&:hover":{bgcolor:r?"#eef6ff":"#f7f7f5"}},children:a.label},a.label)})}),(0,ha.jsxs)(Bs.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,ha.jsx)(mg.DateTextField,{value:e,size:"small",placeholder:I("calendar.startDate"),onChange:a=>c(a.target.value,u),sx:{width:140,"& .MuiInputBase-input":{fontSize:13}}}),(0,ha.jsx)(Bs.Box,{component:"span",sx:{fontSize:13,color:"#9a9a97"},children:"~"}),(0,ha.jsx)(mg.DateTextField,{value:u,size:"small",placeholder:I("calendar.endDate"),onChange:a=>c(e,a.target.value),sx:{width:140,"& .MuiInputBase-input":{fontSize:13}}})]})]})}var Qq=require("@mui/material");var fg=require("react/jsx-runtime");function eK({anchorEl:e,fromDate:u,toDate:c,onChange:l,onClose:n}){return(0,fg.jsx)(Qq.Popover,{transitionDuration:0,anchorEl:e,open:!!e,onClose:n,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{p:1.5}}},children:(0,fg.jsx)(hg,{fromDate:u,toDate:c,onChange:l})})}var Fa=require("@mui/material"),eH=v(require("@mui/icons-material/Checklist"),1),tH=v(require("@mui/icons-material/Face"),1),nH=v(require("@mui/icons-material/Publish"),1),rH=v(require("@mui/icons-material/NotificationsOutlined"),1),oH=v(require("@mui/icons-material/BugReportOutlined"),1),iH=v(require("@mui/icons-material/SupportAgentOutlined"),1),aH=v(require("@mui/icons-material/DescriptionOutlined"),1),sH=v(require("@mui/icons-material/Inventory2Outlined"),1);_e();var Uo=require("react/jsx-runtime");function Jq(e,u){return u>0?`${e} (${u})`:e}var tK=[{id:"my",get label(){return I("tab.all")},icon:(0,Uo.jsx)(eH.default,{sx:{fontSize:18}})},{id:"mine",get label(){return I("tab.mine")},icon:(0,Uo.jsx)(tH.default,{sx:{fontSize:18}})},{id:"sent",get label(){return I("tab.sent")},icon:(0,Uo.jsx)(nH.default,{sx:{fontSize:18}})},{id:"support",get label(){return I("tab.support")},icon:(0,Uo.jsx)(iH.default,{sx:{fontSize:18}})},{id:"bug",get label(){return I("tab.bug")},icon:(0,Uo.jsx)(oH.default,{sx:{fontSize:18}})},{id:"notice",get label(){return I("tab.notice")},icon:(0,Uo.jsx)(rH.default,{sx:{fontSize:18}})},{id:"archive",get label(){return I("tab.archive")},icon:(0,Uo.jsx)(sH.default,{sx:{fontSize:18}}),hideCount:!0},{id:"report",get label(){return I("tab.report")},icon:(0,Uo.jsx)(aH.default,{sx:{fontSize:18}}),hideCount:!0}];function nK(e){return{minHeight:46,minWidth:75,bgcolor:e.bg,color:e.color,borderRadius:"8px 8px 0 0",padding:"10px 18px",textTransform:"none",fontSize:14,fontWeight:500,border:`1px solid ${e.borderColor}`,borderBottom:"none","&:hover":{bgcolor:e.hoverBg},"&.Mui-selected":{bgcolor:e.selectedBg,color:e.selectedColor,border:`1px solid ${e.selectedBg}`,borderBottom:"none","&:hover":{bgcolor:e.selectedBg}},...e.sx}}function rK({items:e,activeTab:u,counts:c,onChange:l,compact:n=!1}){ue();let a=xt(),r=nK(a.tabs),t=e;return n?(0,Uo.jsx)(Fa.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:1},children:t.map(o=>{let d=u===o.id;return(0,Uo.jsx)(Fa.ButtonBase,{onClick:()=>l(o.id),sx:{height:40,minWidth:0,px:.5,borderRadius:1,fontSize:Zn(13.5),fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",border:"1px solid",bgcolor:d?a.tabs.selectedBg:a.tabs.bg,color:d?a.tabs.selectedColor:a.tabs.color,borderColor:d?a.tabs.selectedBg:a.tabs.borderColor},children:Jq(o.label,o.hideCount?0:c[o.id]??0)},o.id)})}):(0,Uo.jsx)(Fa.Tabs,{value:u,onChange:(o,d)=>l(d),sx:{minHeight:46,"& .MuiTabs-indicator":{display:"none"},"& .MuiTabs-flexContainer":{gap:"12px",minHeight:46}},children:t.map(o=>(0,Uo.jsx)(Fa.Tab,{value:o.id,label:Jq(o.label,o.hideCount?0:c[o.id]??0),icon:o.icon,iconPosition:"start",sx:r},o.id))})}var ja=require("react"),Et=require("@mui/material"),lH=v(require("@mui/icons-material/OpenInNewOutlined"),1),cH=v(require("@mui/icons-material/RestoreFromTrashOutlined"),1),uH=v(require("@mui/icons-material/Check"),1),dH=v(require("@mui/icons-material/CheckCircleOutlined"),1),mH=v(require("@mui/icons-material/RadioButtonUnchecked"),1),hH=v(require("@mui/icons-material/SendOutlined"),1),fH=v(require("@mui/icons-material/EventOutlined"),1),pH=v(require("@mui/icons-material/PersonOutlineOutlined"),1),gH=v(require("@mui/icons-material/ViewKanbanOutlined"),1),bH=v(require("@mui/icons-material/ContentCopyOutlined"),1),yH=v(require("@mui/icons-material/PrintOutlined"),1),vH=v(require("@mui/icons-material/NextPlanOutlined"),1),kH=v(require("@mui/icons-material/ContentPasteOutlined"),1),xH=v(require("@mui/icons-material/ShareOutlined"),1),wH=v(require("@mui/icons-material/DirectionsRunOutlined"),1),pg=v(require("@mui/icons-material/ChevronRight"),1),TH=v(require("@mui/icons-material/ArchiveOutlined"),1),SH=v(require("@mui/icons-material/UnarchiveOutlined"),1),gg=require("@ehfuse/alerts");_e();var Ye=require("react/jsx-runtime");function oK({target:e,onClose:u,customTabs:c,sprints:l=[],myAccountSeq:n=0,onOpenDetail:a,onToggleCompleted:r,onRequestConfirm:t,onChangeDueDate:o,onChangeReminder:d,onMemberEdit:i,onMoveProject:s,onDuplicate:h,onPrint:f,onCreateFollowUp:m,onShare:b,onAssignSprint:g,onArchiveToggle:w,onDelete:S,onRestore:O,onPurge:P}){ue();let j=Sn(),M=wi(),[N,z]=(0,ja.useState)(null),[W,F]=(0,ja.useState)(null),[C,B]=(0,ja.useState)(null);(0,ja.useEffect)(()=>{e||(z(null),F(null),B(null))},[e]);let R=e?.task??null,p=!!R?.is_notice,y=!!R?.is_event,x=R?!fi(R,n):!1,{editPolicy:k,shareText:T}=it(),_=R?ea(R,n,k):!1,D=R?wa(R,n,k,x):!1,H=R?wa(R,n,k,!1):!1,V=!!R?.deleted,U=(()=>{if(!R||R.completed)return!0;let q=pi(R,n);return q.total===0||q.count>=q.total})(),L=(0,ja.useMemo)(()=>new Set(c.filter(q=>q.useSprints).map(q=>q.key)),[c]),G=async(q="one")=>{let $=R;if(u(),!$)return;await(0,gg.ConfirmDialog)({title:I("menu.deleteTask"),message:q==="series"?I("menu.deleteSeriesConfirm",{title:$.title}):I("menu.deleteTaskConfirm",{title:$.title})})&&S?.($.seq,q)},E=async()=>{let q=R;if(u(),!q)return;await(0,gg.ConfirmDialog)({title:I("menu.purge"),message:I("menu.purgeConfirm",{title:q.title})})&&P?.(q.seq)},A=()=>{R&&w(R.seq,!R.archived),u()};return(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(Et.Menu,{open:!!e,onClose:u,transitionDuration:0,anchorReference:j?"none":"anchorPosition",anchorPosition:!j&&e?{top:e.position.top,left:e.position.left}:void 0,slotProps:{paper:{sx:{minWidth:190,...j?{position:"fixed",top:"50%",left:"50%",translate:"-50% -50%",maxHeight:"70vh"}:{}}},list:j?{sx:{"& .MuiMenuItem-root":{py:1,minHeight:0}}}:void 0},children:[(0,Ye.jsxs)(Et.MenuItem,{onClick:()=>{R&&a(R),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(lH.default,{sx:{fontSize:19}})}),I("menu.openDetail")]}),V?(0,Ye.jsx)(Et.Divider,{}):null,V&&O?(0,Ye.jsxs)(Et.MenuItem,{disabled:H,onClick:()=>{R&&O(R.seq),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(cH.default,{sx:{fontSize:19}})}),I("menu.restore")]}):null,V&&P?(0,Ye.jsxs)(Et.MenuItem,{disabled:H,onClick:()=>{E()},sx:{fontSize:14,color:"#e5484d"},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(Dr,{sx:{fontSize:19,color:"#e5484d"}})}),I("menu.purge")]}):null,V?null:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(Et.MenuItem,{disabled:p?(R?.author_account_seq??0)!==n:(R?.author_account_seq??0)!==n&&(R?.manager_account_seq??0)!==n,onClick:()=>{R&&r(R.seq,!R.completed),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:R?.completed?(0,Ye.jsx)(mH.default,{sx:{fontSize:19}}):(0,Ye.jsx)(dH.default,{sx:{fontSize:19}})}),R?.completed?I("menu.uncomplete"):I("menu.complete")]}),!p&&t?(0,Ye.jsxs)(Et.MenuItem,{disabled:U,onClick:()=>{R&&t(R),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(hH.default,{sx:{fontSize:19}})}),I("menu.requestConfirm")]}):null,y?null:(0,Ye.jsx)(Et.Divider,{}),y?null:(0,Ye.jsxs)(Et.MenuItem,{disabled:_,onClick:q=>{R&&z({anchorEl:q.currentTarget,task:R})},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(fH.default,{sx:{fontSize:19}})}),I("menu.changeDue")]}),!p&&!y&&i?(0,Ye.jsxs)(Et.MenuItem,{disabled:k==="coreAuthorManager"?_:!1,onClick:()=>{R&&i(R,"manager"),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(pH.default,{sx:{fontSize:19}})}),I("menu.changeOwner")]}):null,y?null:(0,Ye.jsxs)(Et.MenuItem,{disabled:_,onClick:q=>{R&&F({anchorEl:q.currentTarget,task:R})},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(gH.default,{sx:{fontSize:19}})}),I("menu.moveProject"),(0,Ye.jsx)(pg.default,{sx:{fontSize:18,ml:"auto",color:"#9a9a97"}})]}),(0,Ye.jsx)(Et.Divider,{}),h?(0,Ye.jsxs)(Et.MenuItem,{disabled:x,onClick:()=>{R&&h(R.seq),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(bH.default,{sx:{fontSize:19}})}),I("menu.duplicate")]}):null,f?(0,Ye.jsxs)(Et.MenuItem,{onClick:()=>{R&&f(R),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(yH.default,{sx:{fontSize:19}})}),I("common.print")]}):null,m&&R&&!R.is_event&&!R.is_notice?(0,Ye.jsxs)(Et.MenuItem,{onClick:()=>{R&&m(R.seq),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(vH.default,{sx:{fontSize:19}})}),I("menu.createFollowUp")]}):null,(0,Ye.jsxs)(Et.MenuItem,{onClick:()=>{R&&(b?b(R):Ma(R,j,T)),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:j?(0,Ye.jsx)(xH.default,{sx:{fontSize:19}}):(0,Ye.jsx)(kH.default,{sx:{fontSize:19}})}),j?I("menu.share"):I("menu.copyContent")]}),R&&!R.is_notice&&!R.is_event&&L.has(String(R.tab_key??""))&&g?(0,Ye.jsxs)(Et.MenuItem,{onClick:q=>B(q.currentTarget),sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(wH.default,{sx:{fontSize:19}})}),I("menu.addToSprint"),(0,Ye.jsx)(pg.default,{sx:{fontSize:18,ml:"auto",color:"#9a9a97"}})]}):null,(0,Ye.jsxs)(Et.MenuItem,{onClick:A,disabled:x||!R?.archived&&!(R&&ac(R)),sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:R?.archived?(0,Ye.jsx)(SH.default,{sx:{fontSize:19}}):(0,Ye.jsx)(TH.default,{sx:{fontSize:19}})}),R?.archived?I("menu.unarchive"):I("menu.archive")]}),S?(0,Ye.jsx)(Et.Divider,{}):null,S?(0,Ye.jsxs)(Et.MenuItem,{disabled:D,onClick:()=>{G("one")},sx:{fontSize:14,color:"#e5484d"},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(Dr,{sx:{fontSize:19,color:"#e5484d"}})}),(R?.repeat_group_key??0)>0?I("menu.deleteThisOnly"):I("common.delete")]}):null,S&&(R?.repeat_group_key??0)>0?(0,Ye.jsxs)(Et.MenuItem,{disabled:D,onClick:()=>{G("series")},sx:{fontSize:14,color:"#e5484d"},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(Dr,{sx:{fontSize:19,color:"#e5484d"}})}),I("menu.deleteSeries")]}):null]})]}),(0,Ye.jsx)(qo,{anchorEl:N?.anchorEl??null,open:!!N,date:N?.task.due_date??"",reminders:Fo(N?.task),hideReminder:!!N?.task.completed,centered:j,onClose:()=>{z(null),u()},onDateChange:q=>{N&&o(N.task.seq,q)},onReminderChange:q=>{N&&d?.(N.task.seq,q)}}),(0,Ye.jsxs)(Et.Menu,{transitionDuration:0,anchorEl:W?.anchorEl??null,open:!!W,onClose:()=>{F(null),u()},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},...M,children:[(0,Ye.jsx)(Et.MenuItem,{selected:!W?.task.tab_key,onClick:()=>{W&&s(W.task.seq,""),F(null),u()},sx:{fontSize:14,minWidth:170},children:I("common.none")}),c.filter(q=>!q.archived).map(q=>(0,Ye.jsx)(Et.MenuItem,{selected:W?.task.tab_key===q.key,onClick:()=>{W&&s(W.task.seq,q.key),F(null),u()},sx:{fontSize:14,minWidth:170},children:q.label},q.key))]}),(0,Ye.jsx)(Et.Menu,{transitionDuration:0,anchorEl:C,open:!!C,onClose:()=>B(null),anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},children:[{seq:0,label:I("menu.backlogUnassigned")},...l.filter(q=>`custom-${q.group_seq}`===String(R?.tab_key??"")).map(q=>({seq:q.seq,label:Wo(q)}))].map(q=>(0,Ye.jsxs)(Et.MenuItem,{onClick:()=>{R&&g?.(R.seq,q.seq),B(null),u()},sx:{fontSize:14,minWidth:160,gap:1},children:[q.label,(R?.sprint_seq??0)===q.seq?(0,Ye.jsx)(uH.default,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},q.seq))})]})}var CH=require("@ehfuse/mui-virtual-data-table");_e();var bg=require("react/jsx-runtime");function iK({anchorPosition:e,anchorEl:u,labelOptions:c,selectedKeys:l,onChange:n,onToggle:a,onClear:r,clearLabel:t=I("menu.clearFilter"),onClose:o}){ue();let d=Is(u,e);return(0,bg.jsx)(CH.HeaderMenu,{open:!!d,anchorPosition:d,onClose:o,filter:{options:c.map(i=>({value:i.key,label:i.name,icon:(0,bg.jsx)(ug,{color:i.dot})})),value:l,onChange:i=>{if(n){n(i);return}let s=pu(l,i);s?.kind==="toggle"?a?.(s.value):s?.kind==="clear"&&r?.()},clearLabel:t}})}var _H=v(require("@mui/icons-material/SettingsOutlined"),1),El=require("@ehfuse/mui-virtual-data-table");_e();var gu=require("react/jsx-runtime");function aK(e){ue();let{anchorPosition:u,anchorEl:c,sprints:l,value:n,onSelect:a,onManage:r,onClose:t}=e,o=Is(c,u),d=[{seq:0,label:I("common.all")},{seq:-1,label:I("menu.unassignedTasks")},...l.map(i=>({seq:i.seq,label:Wo(i)}))];return(0,gu.jsx)(El.HeaderMenu,{open:!!o,anchorPosition:o,onClose:t,header:d.map(i=>(0,gu.jsx)(cg,{checked:n===i.seq,onClick:()=>{a(i.seq),t()},children:i.label},i.seq)),children:(0,gu.jsx)(El.HeaderMenuItem,{icon:(0,gu.jsx)(_H.default,{sx:{fontSize:El.HEADER_MENU_ICON_SIZE,color:"text.secondary"}}),onClick:()=>{t(),r()},children:I("menu.manageGoals")})})}_e();var sK={my:"tasks",mine:"tasks",sent:"tasks",notice:"notice",support:"support",bug:"bug",archive:"archive",done:"done",report:"report"};function BH(e){return sK[e]??"tasks"}var yg={get list(){return I("menu.list")},get card(){return I("menu.project")},get kanban(){return I("menu.status")},get sprint(){return I("menu.goal")},get calendar(){return I("menu.weekly")},get month(){return I("menu.monthly")},get agenda(){return I("menu.agenda")},get timeline(){return I("menu.timeline")}},IH=["list","calendar","month","card","kanban","sprint","timeline"],lK=["list","kanban"],cK=["list","card"];function uK(e){let u=BH(e);switch(u){case"notice":return{kind:u,viewOptions:[],showCreate:!0,createLabel:I("task.createNotice"),showGroupBy:!1,showSprintFilter:!1,showDateRange:!1,showHideCompleted:!0,forceFlatList:!0,columns:{notice:!0}};case"bug":return{kind:u,viewOptions:IH,showCreate:!0,createLabel:I("task.createBug"),showGroupBy:!0,showSprintFilter:!0,showDateRange:!1,showHideCompleted:!0,forceFlatList:!1,columns:{bug:!0}};case"support":return{kind:u,viewOptions:lK,showCreate:!1,createLabel:"",showGroupBy:!0,showSprintFilter:!1,showDateRange:!1,showHideCompleted:!0,forceFlatList:!1,columns:{support:!0,showProject:!1}};case"archive":return{kind:u,viewOptions:cK,showCreate:!1,createLabel:"",showGroupBy:!1,showSprintFilter:!1,showDateRange:!0,showHideCompleted:!1,forceFlatList:!0,columns:{showActions:!1}};case"done":return{kind:u,viewOptions:["list"],showCreate:!1,createLabel:"",showGroupBy:!1,showSprintFilter:!1,showDateRange:!0,showHideCompleted:!1,forceFlatList:!0,columns:{showActions:!1}};case"report":return{kind:u,viewOptions:[],showCreate:!1,createLabel:"",showGroupBy:!1,showSprintFilter:!1,showDateRange:!0,showHideCompleted:!1,forceFlatList:!0,columns:{}};default:return{kind:u,viewOptions:IH,showCreate:!0,createLabel:I("task.createTask"),showGroupBy:!0,showSprintFilter:!0,showDateRange:!1,showHideCompleted:!0,forceFlatList:!1,columns:e==="mine"?{showRequest:!1,confirmMode:"action"}:e==="sent"?{confirmMode:"time"}:{}}}}nc();Lm();var AH=require("react"),EH=require("@ehfuse/keyboard-state");_e();var OH=[{key:"g l",view:"list"},{key:"g b",view:"card"},{key:"g k",view:"kanban"},{key:"g s",view:"sprint"},{key:"g c",view:"calendar"},{key:"g m",view:"month"},{key:"g t",view:"timeline"}];function dK(e,u={}){let{enabled:c=!0,views:l}=u,{onCreateTask:n,onFocusSearch:a,onToggleHelp:r,onChangeView:t,onEscape:o}=e,d=l?l.join(","):"",i=(0,AH.useMemo)(()=>{let s=[];if(n&&s.push({key:"n",callback:n,options:{preventDefault:!0}}),a&&s.push({key:"/",callback:a,options:{preventDefault:!0}}),r&&s.push({key:"shift+?",callback:r,options:{preventDefault:!0}}),o&&s.push({key:"escape",callback:o,options:{allowInEditable:!0}}),t)for(let h of PH(d?d.split(","):void 0))s.push({key:h.key,callback:()=>t(h.view),options:{preventDefault:!0}});return s},[n,a,r,t,o,d]);(0,EH.useKeyboardState)(c?i:[])}function PH(e){if(!e)return OH;let u=new Set(e);return OH.filter(c=>u.has(c.view))}function Pl(e){return[{keys:"N",description:I("task.createNew")},{keys:"/",description:I("common.search")},...PH(e).map(u=>({keys:u.key.split(" ").map(c=>c.toUpperCase()).join(" \u2192 "),description:I("task.showView",{value:yg[u.view]})})),{keys:"?",description:I("task.help")},{keys:"Esc",description:I("common.close")}]}var mK=Pl();var qa=require("@mui/material"),VH=v(require("@mui/icons-material/ArrowRightAlt"),1),GH=require("@ehfuse/mui-form-dialog");var qH=require("react");_e();var MH={id:"concept",tabTitle:"manual.concept.tabTitle1",intro:"manual.concept.intro1",topics:[{title:"manual.concept.title1",lead:"manual.concept.lead1",steps:[{title:"manual.concept.title2",desc:"manual.concept.desc1"},{title:"manual.concept.title3",desc:"manual.concept.desc2"},{title:"manual.concept.title4",desc:"manual.concept.desc3"}]},{title:"manual.concept.title5",subtitle:"manual.concept.subtitle1",lead:"manual.concept.lead2",items:[{term:"manual.concept.term1",desc:"manual.concept.desc4"},{term:"manual.concept.term2",desc:"manual.concept.desc5"},{term:"manual.concept.term3",desc:"manual.concept.desc6"}]},{title:"manual.concept.title6",lead:"manual.concept.lead3",items:[{term:"manual.concept.term4",desc:"manual.concept.desc7"},{term:"manual.concept.term5",desc:"manual.concept.desc8"},{term:"manual.concept.term6",desc:"manual.concept.desc9"}]},{title:"manual.concept.title7",lead:"manual.concept.lead4",items:[{term:"manual.concept.term7",desc:"manual.concept.desc10"},{term:"manual.concept.term8",desc:"manual.concept.desc11"},{term:"manual.concept.term9",desc:"manual.concept.desc12"},{term:"manual.concept.term10",desc:"manual.concept.desc13"}]},{title:"manual.concept.title8",lead:"manual.concept.lead5",items:[{term:"manual.concept.term11",desc:"manual.concept.desc14"},{term:"manual.concept.term12",desc:"manual.concept.desc15"},{term:"manual.concept.term13",desc:"manual.concept.desc16"},{term:"manual.concept.term14",desc:"manual.concept.desc17"},{term:"manual.concept.term15",desc:"manual.concept.desc18"},{term:"manual.concept.term16",desc:"manual.concept.desc19"}]},{title:"manual.concept.title9",subtitle:"manual.concept.subtitle2",lead:"manual.concept.lead6",items:[{term:"manual.concept.term17",desc:"manual.concept.desc20"},{term:"manual.concept.term18",desc:"manual.concept.desc21"},{term:"manual.concept.term19",desc:"manual.concept.desc22"}]},{title:"manual.concept.title10",lead:"manual.concept.lead7",items:[{term:"manual.concept.term20",desc:"manual.concept.desc23"},{term:"manual.concept.term21",desc:"manual.concept.desc24"}]}]};var RH={id:"roles",tabTitle:"manual.roles.tabTitle1",intro:"manual.roles.intro1",topics:[{title:"manual.roles.title1",subtitle:"manual.roles.subtitle1",lead:"manual.roles.lead1",items:[{term:"manual.roles.term1",desc:"manual.roles.desc1"},{term:"manual.roles.term2",desc:"manual.roles.desc2"},{term:"manual.roles.term3",desc:"manual.roles.desc3"},{term:"manual.roles.term4",desc:"manual.roles.desc4"},{term:"manual.roles.term5",desc:"manual.roles.desc5"}]},{title:"manual.roles.title2",subtitle:"manual.roles.subtitle2",lead:"manual.roles.lead2",items:[{term:"manual.roles.term6",desc:"manual.roles.desc6"},{term:"manual.roles.term7",desc:"manual.roles.desc7"},{term:"manual.roles.term8",desc:"manual.roles.desc8"},{term:"manual.roles.term9",desc:"manual.roles.desc9"},{term:"manual.roles.term10",desc:"manual.roles.desc10"},{term:"manual.roles.term11",desc:"manual.roles.desc11"}]},{title:"manual.roles.title3",subtitle:"manual.roles.subtitle3",lead:"manual.roles.lead3",items:[{term:"manual.roles.term12",desc:"manual.roles.desc12"},{term:"manual.roles.term13",desc:"manual.roles.desc13"},{term:"manual.roles.term14",desc:"manual.roles.desc14"},{term:"manual.roles.term15",desc:"manual.roles.desc15"},{term:"manual.roles.term16",desc:"manual.roles.desc16"}]},{title:"manual.roles.title4",lead:"manual.roles.lead4",items:[{term:"manual.roles.term17",desc:"manual.roles.desc17"},{term:"manual.roles.term18",desc:"manual.roles.desc18"},{term:"manual.roles.term19",desc:"manual.roles.desc19"},{term:"manual.roles.term20",desc:"manual.roles.desc20"},{term:"manual.roles.term21",desc:"manual.roles.desc21"},{term:"manual.roles.term22",desc:"manual.roles.desc22"},{term:"manual.roles.term23",desc:"manual.roles.desc23"}]},{title:"manual.roles.title5",lead:"manual.roles.lead5",items:[{term:"manual.roles.term24",desc:"manual.roles.desc24"},{term:"manual.roles.term25",desc:"manual.roles.desc25"},{term:"manual.roles.term26",desc:"manual.roles.desc26"},{term:"manual.roles.term27",desc:"manual.roles.desc27"}]},{title:"manual.roles.title6",feature:"support",lead:"manual.roles.lead6",items:[{term:"manual.roles.term28",desc:"manual.roles.desc28"},{term:"manual.roles.term29",desc:"manual.roles.desc29"},{term:"manual.roles.term30",desc:"manual.roles.desc30"},{term:"manual.roles.term31",desc:"manual.roles.desc31"}]}]};var DH={id:"basics",tabTitle:"manual.basics.tabTitle1",intro:"manual.basics.intro1",topics:[{title:"manual.basics.title1",lines:["manual.basics.line1","manual.basics.line2","manual.basics.line3","manual.basics.line4","manual.basics.line5"]},{title:"manual.basics.title2",subtitle:"manual.basics.subtitle1",lead:"manual.basics.lead1",lines:["manual.basics.line6","manual.basics.text1","manual.basics.text2","manual.basics.text3","manual.basics.text4","manual.basics.text5"]},{title:"manual.basics.title3",lines:["manual.basics.line7","manual.basics.line8","manual.basics.line9"]},{title:"manual.basics.title4",lines:["manual.basics.line10","manual.basics.line11"]},{title:"manual.basics.title5",lines:["manual.basics.line12","manual.basics.line13"]},{title:"manual.basics.title6",subtitle:"manual.basics.subtitle2",lines:["manual.basics.line14","manual.basics.line15","manual.basics.line16","manual.basics.line17"]},{title:"manual.basics.title7",lines:["manual.basics.line18","manual.basics.line19","manual.basics.line20"]}]};var NH={id:"notify",tabTitle:"manual.notify.tabTitle1",intro:"manual.notify.intro1",topics:[{title:"manual.notify.title1",items:[{term:"manual.notify.term1",desc:"manual.notify.desc1"},{term:"manual.notify.term2",desc:"manual.notify.desc2"},{term:"manual.notify.term3",desc:"manual.notify.desc3"},{term:"manual.notify.term4",desc:"manual.notify.desc4"},{term:"manual.notify.term5",desc:"manual.notify.desc5"},{term:"manual.notify.term6",desc:"manual.notify.desc6"},{term:"manual.notify.term7",desc:"manual.notify.desc7"}]},{title:"manual.notify.title2",items:[{term:"manual.notify.term8",desc:"manual.notify.desc8"},{term:"manual.notify.term9",desc:"manual.notify.desc9"},{term:"manual.notify.term10",desc:"manual.notify.desc10"},{term:"manual.notify.term11",desc:"manual.notify.desc11"},{term:"manual.notify.term12",desc:"manual.notify.desc12"},{term:"manual.notify.term13",desc:"manual.notify.desc13"},{term:"manual.notify.term14",desc:"manual.notify.desc14"}]},{title:"manual.notify.title3",lead:"manual.notify.lead1",items:[{term:"manual.notify.term15",desc:"manual.notify.desc15"},{term:"manual.notify.term16",desc:"manual.notify.desc16"},{term:"manual.notify.term17",desc:"manual.notify.desc17"}]},{title:"manual.notify.title4",lead:"manual.notify.lead2",items:[{term:"manual.notify.term18",desc:"manual.notify.desc18"},{term:"manual.notify.term19",desc:"manual.notify.desc19"},{term:"manual.notify.term20",desc:"manual.notify.desc20"},{term:"manual.notify.term21",desc:"manual.notify.desc21"},{term:"manual.notify.term22",desc:"manual.notify.desc22"}]},{title:"manual.notify.title5",lead:"manual.notify.lead3",items:[{term:"manual.notify.term23",desc:"manual.notify.desc23"},{term:"manual.notify.term24",desc:"manual.notify.desc24"},{term:"manual.notify.term25",desc:"manual.notify.desc25"},{term:"manual.notify.term26",desc:"manual.notify.desc26"},{term:"manual.notify.term27",desc:"manual.notify.desc27"}]},{title:"manual.notify.title6",items:[{term:"manual.notify.term28",desc:"manual.notify.desc28"},{term:"manual.notify.term29",desc:"manual.notify.desc29"},{term:"manual.notify.term30",desc:"manual.notify.desc30"}]},{title:"manual.notify.title7",items:[{term:"manual.notify.term31",desc:"manual.notify.desc31"},{term:"manual.notify.term32",desc:"manual.notify.desc32"},{term:"manual.notify.term33",desc:"manual.notify.desc33"},{term:"manual.notify.term34",desc:"manual.notify.desc34"},{term:"manual.notify.term35",desc:"manual.notify.desc35"},{term:"manual.notify.term36",desc:"manual.notify.desc36"},{term:"manual.notify.term37",desc:"manual.notify.desc37"}]}]};var LH={id:"more",tabTitle:"manual.more.tabTitle1",intro:"manual.more.intro1",topics:[{title:"manual.more.title1",lead:"manual.more.lead1",lines:["manual.more.line1","manual.more.text1","manual.more.text2"]},{title:"manual.more.title2",lead:"manual.more.lead2",items:[{term:"manual.more.term1",desc:"manual.more.desc1"},{term:"manual.more.term2",desc:"manual.more.desc2"},{term:"manual.more.term3",desc:"manual.more.desc3"},{term:"manual.more.term4",desc:"manual.more.desc4"},{term:"manual.more.term5",desc:"manual.more.desc5"},{term:"manual.more.term6",desc:"manual.more.desc6"}]},{title:"manual.more.title3",lines:["manual.more.line2","manual.more.line3"]},{title:"manual.more.title4",feature:"timeline",lines:["manual.more.line4"]},{title:"manual.more.title5",feature:"charts",lines:["manual.more.line5"]},{title:"manual.more.title6",lines:["manual.more.line6","manual.more.line7","manual.more.line8"]},{title:"manual.more.title7",feature:"label",lines:["manual.more.line9"]},{title:"manual.more.title8",lines:["manual.more.line10","manual.more.line11","manual.more.line12","manual.more.line13"]},{title:"manual.more.title9",lines:["manual.more.line14","manual.more.line15"]},{title:"manual.more.title10",subtitle:"manual.more.subtitle1",lead:"manual.more.lead3",lines:["manual.more.line16","manual.more.line17","manual.more.line18","manual.more.line19"]},{title:"manual.more.title11",lines:["manual.more.line20","manual.more.line21","manual.more.line22"]},{title:"manual.more.title12",feature:"project",lines:["manual.more.line23","manual.more.line24"]},{title:"manual.more.title13",feature:"sprint",lines:["manual.more.line25","manual.more.line26"]},{title:"manual.more.title14",lines:["manual.more.line27","manual.more.line28","manual.more.line29"]},{title:"manual.more.title15",lines:["manual.more.line30"]},{title:"manual.more.title16",feature:"bug",lines:["manual.more.line31","manual.more.line32"]},{title:"manual.more.title17",feature:"support",lines:["manual.more.line33","manual.more.line34"]},{title:"manual.more.title18",feature:"report",lines:["manual.more.line35"]}]};var zH={id:"calendar",tabTitle:"manual.calendar.tabTitle1",intro:"manual.calendar.intro1",topics:[{title:"manual.calendar.title1",lead:"manual.calendar.lead1",items:[{term:"manual.calendar.term1",desc:"manual.calendar.desc1"},{term:"manual.calendar.term2",desc:"manual.calendar.desc2"}]},{title:"manual.calendar.title2",lines:["manual.calendar.line1","manual.calendar.line2","manual.calendar.line3","manual.calendar.line4"]},{title:"manual.calendar.title3",lines:["manual.calendar.line5","manual.calendar.line6","manual.calendar.line7","manual.calendar.line8"]}]};var FH={id:"shortcuts",tabTitle:"manual.shortcuts.tabTitle1",topics:[]};var bu=[MH,RH,DH,NH,LH,zH,FH];function jH(e=bu){let u=c=>c&&I(c);return e.map(c=>({...c,tabTitle:I(c.tabTitle),intro:u(c.intro),topics:c.topics.map(l=>({...l,title:I(l.title),subtitle:u(l.subtitle),lead:u(l.lead),steps:l.steps?.map(n=>({title:I(n.title),desc:I(n.desc)})),items:l.items?.map(n=>({term:I(n.term),desc:I(n.desc)})),lines:l.lines?.map(n=>I(n))}))}))}function HH({open:e,onClose:u}){return{modals:{dialog:$r({modalIdPrefix:"taskbox-shortcut-help-dialog",open:e,onClose:u})}}}function WH({open:e,onClose:u,features:c,initialTab:l}){let[n,a]=(0,qH.useState)(0);return{modals:{dialog:$r({modalIdPrefix:"taskbox-manual-dialog",open:e,onClose:u,onOpen:()=>{let o=bu.filter(d=>!d.feature||c[d.feature]!==!1).findIndex(d=>d.id===l);a(Math.max(0,o))}})},activeTabIndex:n,setActiveTabIndex:a}}_e();var ci=require("react/jsx-runtime");function hK({keys:e}){return(0,ci.jsx)(qa.Box,{sx:{display:"flex",alignItems:"center",gap:.5,justifyContent:"flex-end"},children:e.split(" \u2192 ").map((u,c)=>(0,ci.jsxs)(qa.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[c>0?(0,ci.jsx)(VH.default,{sx:{fontSize:18,color:"#9a9a97"}}):null,(0,ci.jsx)(qa.Box,{component:"span",sx:{minWidth:32,height:32,px:.75,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:13.5,fontWeight:700,color:"#37352f",bgcolor:"#f4f4f2",border:"1px solid #e0dfdb",borderRadius:1,fontVariantNumeric:"tabular-nums"},children:u})]},`${u}-${c}`))})}function fK({open:e,onClose:u,views:c}){ue();let{modals:l}=HH({open:e,onClose:u}),n=Pl(c);return(0,ci.jsx)(GH.FormDialog,{open:l.dialog.isOpen,onClose:l.dialog.close,maxWidth:"xs",title:I("shortcut.title"),locale:Pt(),titleIcons:{delete:{visible:!1}},tabs:{visible:!1},sectionContentPaddingTop:0,sections:[{id:"shortcuts",showTitle:!1,children:(0,ci.jsx)(qa.Box,{sx:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:2,rowGap:1.25,alignItems:"center",fontSize:14,color:"#37352f"},children:n.map(a=>(0,ci.jsxs)(qa.Box,{sx:{display:"contents"},children:[(0,ci.jsx)(hK,{keys:a.keys}),(0,ci.jsx)("span",{children:a.description})]},a.keys))})}],actions:{showCancelButton:!1,right:(0,ci.jsx)(qa.Button,{variant:"contained",onClick:l.dialog.close,children:I("common.close")})}})}var Gm=require("react"),Kn=require("@mui/material"),$H=v(require("@mui/icons-material/ArrowRightAlt"),1),KH=v(require("@mui/icons-material/ChevronRightRounded"),1),XH=v(require("@mui/icons-material/ArrowForward"),1),YH=require("@ehfuse/mui-form-dialog");_e();var qt=require("react/jsx-runtime");function Vm(e){return e.split(/(\*\*[^*]+\*\*|\s*(?:→|->)\s*)/g).filter(c=>c.length>0).map((c,l)=>c.startsWith("**")&&c.endsWith("**")?(0,qt.jsx)(Kn.Box,{component:"strong",sx:{fontWeight:700},children:c.slice(2,-2)},l):/^\s*(?:→|->)\s*$/.test(c)?(0,qt.jsx)(XH.default,{sx:{fontSize:"1em",verticalAlign:"-0.15em",mx:.5,color:"text.secondary"}},l):(0,qt.jsx)(Gm.Fragment,{children:c},l))}function pK({keys:e}){let u=xt();return(0,qt.jsx)(Kn.Box,{sx:{display:"flex",alignItems:"center",gap:.5,justifyContent:"flex-end"},children:e.split(" \u2192 ").map((c,l)=>(0,qt.jsxs)(Kn.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[l>0?(0,qt.jsx)($H.default,{sx:{fontSize:20,color:u.colors.textMuted}}):null,(0,qt.jsx)(Kn.Box,{component:"span",sx:{minWidth:36,height:36,px:1,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:15,fontWeight:600,color:u.colors.textPrimary,bgcolor:u.colors.surfaceSubtle,border:`1px solid ${u.colors.border}`,borderRadius:1,fontVariantNumeric:"tabular-nums"},children:c})]},`${c}-${l}`))})}function gK({steps:e}){let u=xt();return(0,qt.jsx)(Kn.Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, minmax(0, 1fr))"},gap:{xs:1,sm:2},mt:1.5},children:e.map((c,l)=>(0,qt.jsxs)(Kn.Box,{sx:{position:"relative",minWidth:0,px:1.75,py:2.5,borderRadius:2,bgcolor:u.colors.surfaceSubtle,border:`1px solid ${u.colors.border}`,"&::before":{content:'""',position:"absolute",top:-1,left:12,right:12,height:3,borderRadius:"0 0 3px 3px",bgcolor:u.colors.accent,opacity:.85},"&::after":l<e.length-1?{content:'""',display:{xs:"none",sm:"block"},position:"absolute",top:"50%",right:-12,width:8,height:8,mt:"-4px",borderTop:`2px solid ${u.colors.borderStrong}`,borderRight:`2px solid ${u.colors.borderStrong}`,transform:"rotate(45deg)"}:void 0},children:[(0,qt.jsxs)(Kn.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[(0,qt.jsx)(Kn.Box,{sx:{flexShrink:0,width:26,height:26,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:500,lineHeight:1,bgcolor:u.colors.accent,color:u.colors.accentContrast,fontVariantNumeric:"tabular-nums"},children:l+1}),(0,qt.jsx)(Kn.Box,{sx:{minWidth:0,fontSize:20,fontWeight:500,color:u.colors.textStrong,lineHeight:1.3,letterSpacing:"-0.01em"},children:c.title})]}),(0,qt.jsx)(Kn.Box,{sx:{mt:1.5,fontSize:15,lineHeight:1.5,color:u.colors.textPrimary,wordBreak:"keep-all"},children:c.desc})]},c.title))})}var ZH="70vh",bK=24,yK=44,UH=`calc((${ZH} - ${bK*2+yK}px) / var(--mfd-font-scale, 1))`,vK=148;function kK({items:e}){let u=xt();return(0,qt.jsx)(Kn.Box,{sx:{mt:1.5,display:"grid",gridTemplateColumns:{xs:"1fr",sm:`${vK}px minmax(0, 1fr)`},fontSize:15,lineHeight:1.6,color:u.colors.textPrimary,border:`1px solid ${u.colors.border}`,borderRadius:1.5,overflow:"hidden","& > *":{px:1.5,py:1.35,borderTop:`1px solid ${u.colors.border}`},"& > *:nth-of-type(even)":{borderLeft:{sm:`1px solid ${u.colors.border}`}},"& > *:nth-of-type(1)":{borderTop:0},"& > *:nth-of-type(2)":{borderTop:{xs:`1px solid ${u.colors.border}`,sm:0}}},children:e.map(c=>(0,qt.jsxs)(Gm.Fragment,{children:[(0,qt.jsx)(Kn.Box,{sx:{fontWeight:500,color:u.colors.textStrong,wordBreak:"keep-all",bgcolor:u.colors.surfaceSubtle,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center"},children:c.term}),(0,qt.jsx)(Kn.Box,{sx:{wordBreak:"keep-all"},children:Vm(c.desc)})]},c.term))})}function xK({topic:e}){ue();let u=xt();return(0,qt.jsxs)(Kn.Box,{component:"section",sx:{py:{xs:3,sm:4},borderBottom:`1px solid ${u.colors.border}`,"&:last-of-type":{pb:0,borderBottom:0}},children:[(0,qt.jsxs)(Kn.Box,{component:"h3",sx:{m:0,mb:1.75,fontSize:24,fontWeight:500,letterSpacing:"-0.01em",lineHeight:1.3,color:u.colors.textStrong,wordBreak:"keep-all",display:"flex",alignItems:"center",flexWrap:"wrap"},children:[e.title,e.subtitle?(0,qt.jsxs)(qt.Fragment,{children:[(0,qt.jsx)(KH.default,{sx:{fontSize:22,color:u.colors.textMuted,mx:1,flexShrink:0}}),(0,qt.jsx)(Kn.Box,{component:"span",sx:{fontSize:18,fontWeight:400,color:u.colors.textPrimary},children:e.subtitle})]}):null]}),e.lead?(0,qt.jsx)(Kn.Box,{sx:{fontSize:15.5,lineHeight:1.65,color:u.colors.textPrimary,wordBreak:"keep-all"},children:Vm(e.lead)}):null,e.steps?.length?(0,qt.jsx)(gK,{steps:e.steps}):null,e.items?.length?(0,qt.jsx)(kK,{items:e.items}):null,e.lines?.length?(0,qt.jsx)(Kn.Box,{component:"ul",sx:{m:0,mt:e.lead||e.steps||e.items?1.25:0,pl:2.5,display:"flex",flexDirection:"column",gap:.5,fontSize:15,lineHeight:1.6,color:u.colors.textPrimary,wordBreak:"keep-all"},children:e.lines.map((c,l)=>(0,qt.jsx)("li",{children:Vm(c)},l))}):null]})}function wK({open:e,onClose:u,views:c,features:l={},initialTab:n}){ue();let a=xt(),{modals:r,activeTabIndex:t,setActiveTabIndex:o}=WH({open:e,onClose:u,features:l,initialTab:n}),d=h=>!h||l[h]!==!1,i=Pl(c),s=jH(bu).filter(h=>d(h.feature)).map(h=>({id:h.id,tabTitle:h.tabTitle,showTitle:!1,children:h.id==="shortcuts"?(0,qt.jsx)(Kn.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:UH,maxHeight:UH,px:.5},children:(0,qt.jsx)(Kn.Box,{sx:{display:"grid",gridTemplateColumns:"auto auto",columnGap:2.5,rowGap:1.75,alignItems:"center",fontSize:17,fontWeight:500,color:a.colors.textPrimary},children:i.map(f=>(0,qt.jsxs)(Gm.Fragment,{children:[(0,qt.jsx)(pK,{keys:f.keys}),(0,qt.jsx)("span",{children:f.description})]},f.keys))})}):(0,qt.jsxs)(Kn.Box,{sx:{display:"flex",flexDirection:"column",px:.5},children:[h.intro?(0,qt.jsx)(Kn.Box,{sx:{p:2,borderRadius:2,bgcolor:a.colors.accentSoft,color:a.colors.textStrong,fontSize:15.5,lineHeight:1.65,wordBreak:"keep-all"},children:Vm(h.intro)}):null,h.topics.filter(f=>d(f.feature)).map(f=>(0,qt.jsx)(xK,{topic:f},f.title))]})}));return(0,qt.jsx)(YH.FormDialog,{open:r.dialog.isOpen,onClose:r.dialog.close,maxWidth:"md",title:I("manual.dialogTitle"),locale:Pt(),titleIcons:{delete:{visible:!1}},tabs:{visible:!0,switchContent:!0},activeTabValue:t,onTabChange:o,fixedHeight:"70vh",maxContentHeight:ZH,sectionContentPaddingTop:0,fontScale:{enabled:!0},fontScaleKey:"taskbox-manual",sections:s,actions:{showCancelButton:!1,right:(0,qt.jsx)(Kn.Button,{variant:"contained",onClick:r.dialog.close,sx:{minWidth:80},children:I("common.close")})}})}pn();var Os=require("react"),St=require("@mui/material"),xg=require("@ehfuse/mui-form-dialog"),Ym=v(require("@mui/icons-material/Add"),1),eW=v(require("@mui/icons-material/ArrowRightAlt"),1),tW=v(require("@mui/icons-material/BoltOutlined"),1),nW=v(require("@mui/icons-material/Close"),1),rW=v(require("@mui/icons-material/EditOutlined"),1),Er=require("@ehfuse/mui-form-controls");var yu=require("react"),Km=require("@ehfuse/forma"),vg=require("@ehfuse/alerts");_e();var Ml=[{value:"due_date",get label(){return I("col.due")}},{value:"start_date",get label(){return I("col.startTime")}},{value:"priority",get label(){return I("col.priority")}},{value:"manager_account_seq",get label(){return I("col.owner")}},{value:"receiver_account_seqs",get label(){return I("col.cc")}},{value:"label_keys",get label(){return I("dialog.label")}},{value:"group_seq",get label(){return I("col.project")}},{value:"sprint_seq",get label(){return I("col.goal")}},{value:"content",get label(){return I("common.content")}},{value:"note",get label(){return I("col.note")}}];function Um(){return{editSeq:0,name:"",trigger:"created",enabled:!0,sort_no:0,condition:{},action:{}}}function kg(e){return e.filter(u=>!u.archived).map(u=>({value:String(si(u.key)),label:u.label}))}function $m(e){return e.map(u=>({value:u.key,label:u.name}))}function QH(e){ue();let u=(0,yu.useRef)(e);u.current=e;let c=(0,Km.useGlobalForm)({formId:Dt("taskbox-rule-form"),initialValues:Um(),onValidate:M=>M.name.trim()?Object.keys(M.action??{}).length===0?((0,vg.ErrorAlert)({message:I("rule.addAction")}),!1):!0:((0,vg.ErrorAlert)({message:I("rule.enterName")}),!1),onSubmit:async M=>{let{editSeq:N,...z}=M,W=N>0?z.sort_no:u.current.rules.reduce((C,B)=>Math.max(C,B.sort_no),0)+1,F=N>0?await u.current.onUpdate(N,{...z,sort_no:W}):await u.current.onCreate({...z,sort_no:W});return F&&l.form.close(),F}}),l={list:li({modalId:Dt("taskbox-rule-manage"),open:e.open,onClose:()=>u.current.onClose()}),form:(0,Km.useModal)({modalId:Dt("taskbox-rule-edit"),onClose:()=>c.setFormValues(Um())})},n=(0,yu.useRef)(l.form);n.current=l.form,(0,yu.useEffect)(()=>{if(e.open)return;let M=window.setTimeout(()=>{n.current.isOpen&&n.current.close(),c.setFormValues(Um())},500);return()=>window.clearTimeout(M)},[e.open]);let a=()=>({...c.getFormValue("condition")??{}}),r=()=>({...c.getFormValue("action")??{}}),t=(M,N)=>{let z=a();N===""||N===void 0||N===null?delete z[M]:z[M]=N,c.setFormValue("condition",z)},o=(M,N)=>{let z=r();N===""||N===void 0||N===null?delete z[M]:z[M]=N,c.setFormValue("action",z)},d=()=>{c.setFormValues(Um()),l.form.open()},i=M=>{c.setFormValues({editSeq:M.seq,name:M.name,trigger:M.trigger,enabled:M.enabled,sort_no:M.sort_no,condition:{...M.condition,...M.trigger==="field_changed"&&M.condition.changed_field===void 0?{changed_field:Ml[0]?.value??""}:{}},action:{...M.action}}),l.form.open()},s=M=>{let N=a();M!=="status_changed"&&(delete N.from_status,delete N.to_status),M!=="overdue"&&delete N.overdue_days,M!=="field_changed"&&delete N.changed_field,M!=="commented"&&(delete N.comment_contains,delete N.comment_by_others),M==="field_changed"&&N.changed_field===void 0&&(N.changed_field=Ml[0]?.value??""),c.setFormValues({trigger:M,condition:N})},h=async M=>{let N=u.current.onPickAccount;if(!N)return;let z=a(),W=M==="manager_account"?z.manager_account_seq??0:z.receiver_account_seq??0,F=await N(W,M==="manager_account"?I("col.owner"):I("col.cc"));if(!F)return;let C=a();M==="manager_account"?(C.manager_account_seq=F.accountSeq,C.manager_name=F.name):(C.receiver_account_seq=F.accountSeq,C.receiver_name=F.name),c.setFormValue("condition",C)},f=M=>{let N=kg(u.current.customTabs),z=$m(u.current.statusOptions);M==="group_seq"?t("group_seq",Number(N[0]?.value)||0):M==="kind"?t("is_bug",!0):M==="priority"?t("priority","high"):M==="label_key"?t("label_key",z[0]?.value??""):M==="title_contains"?c.setFormValue("condition",{...a(),title_contains:""}):M==="manager_empty"?t("manager_empty",!0):M==="manager_account"||M==="receiver_account"?h(M):M==="from_status"?t("from_status",ho[0]?.key??""):M==="to_status"?t("to_status",ho[0]?.key??""):M==="changed_field"?t("changed_field",Ml[0]?.value??""):M==="comment_contains"?c.setFormValue("condition",{...a(),comment_contains:""}):M==="comment_by_others"?t("comment_by_others",!0):M==="overdue_days"&&t("overdue_days",1)},m=M=>{if(M==="kind"){t("is_bug",""),t("is_event","");return}if(M==="manager_account"){t("manager_account_seq",""),t("manager_name","");return}if(M==="receiver_account"){t("receiver_account_seq",""),t("receiver_name","");return}t(M,"")},b=M=>{t("is_bug",M?!0:""),t("is_event",M?"":!0)},g=async M=>{let N=u.current.onPickAccount;if(!N)return;let z=r(),W=M==="assign_manager"?z.assign_manager_account_seq??0:M==="add_receiver"?z.add_receiver_account_seq??0:z.notify_account_seq??0,F=await N(W,M==="assign_manager"?I("col.owner"):M==="add_receiver"?I("col.cc"):I("rule.notifyTarget"));if(!F)return;let C=r();M==="assign_manager"?(C.assign_manager_account_seq=F.accountSeq,C.assign_manager_name=F.name):M==="add_receiver"?(C.add_receiver_account_seq=F.accountSeq,C.add_receiver_name=F.name):(C.notify_account_seq=F.accountSeq,C.notify_name=F.name),c.setFormValue("action",C)};return{form:c,modals:l,actions:{openCreate:d,openEdit:i,changeTrigger:s,setCondition:t,setAction:o,addCondition:f,removeCondition:m,changeKind:b,pickConditionAccount:h,addAction:M=>{let N=$m(u.current.statusOptions);if(M==="set_status")o("set_status",ho[0]?.key??"");else if(M==="set_priority")o("set_priority","high");else if(M==="add_label_key")o("add_label_key",N[0]?.value??"");else if(M==="apply_content_template"){let z=u.current.contentTemplates[0];c.setFormValue("action",{...r(),apply_content_template_seq:z?.seq??0,apply_content_template_name:z?.name??""})}else g(M)},removeAction:M=>{M==="assign_manager"?(o("assign_manager_account_seq",""),o("assign_manager_name","")):M==="add_receiver"?(o("add_receiver_account_seq",""),o("add_receiver_name","")):M==="apply_content_template"?(o("apply_content_template_seq",""),o("apply_content_template_name","")):M==="notify"?(o("notify_account_seq",""),o("notify_name",""),o("notify_message","")):o(M,"")},pickAccountFor:g,selectContentTemplate:M=>{let N=u.current.contentTemplates.find(z=>String(z.seq)===String(M));c.setFormValue("action",{...r(),apply_content_template_seq:N?.seq??0,apply_content_template_name:N?.name??""})},toggleRule:(M,N)=>u.current.onToggle(M,N),removeRule:M=>u.current.onRemove(M)}}}_e();var He=require("react/jsx-runtime"),wg=[{value:"created",get label(){return I("rule.trigger.created")},get hint(){return I("rule.trigger.createdHint")}},{value:"status_changed",get label(){return I("rule.trigger.statusChanged")},get hint(){return I("rule.trigger.statusChangedHint")}},{value:"commented",get label(){return I("rule.trigger.commented")},get hint(){return I("rule.trigger.commentedHint")}},{value:"manager_assigned",get label(){return I("rule.trigger.managerAssigned")},get hint(){return I("rule.trigger.managerAssignedHint")}},{value:"attachment_added",get label(){return I("rule.trigger.attached")},get hint(){return I("rule.trigger.attachedHint")}},{value:"field_changed",get label(){return I("rule.trigger.fieldChanged")},get hint(){return I("rule.trigger.fieldChangedHint")}},{value:"overdue",get label(){return I("rule.trigger.overdue")},get hint(){return I("rule.trigger.overdueHint")}}],Zm=[{value:"high",get label(){return I("priority.high")}},{value:"medium",get label(){return I("priority.medium")}},{value:"low",get label(){return I("priority.low")}}];function Xm(e){return ho.find(u=>u.key===e)?.name??e}function TK(e,u,c){let{condition:l,action:n}=e,a=[];if(l.group_seq){let o=u.find(d=>si(d.key)===l.group_seq);a.push(I("rule.sum.project",{label:o?.label??`#${l.group_seq}`}))}l.is_bug===!0&&a.push(I("rule.sum.bugOnly")),l.is_event===!0&&a.push(I("rule.sum.eventOnly")),l.priority&&a.push(I("rule.sum.priority",{value:Zm.find(o=>o.value===l.priority)?.label})),l.label_key&&a.push(I("rule.sum.label",{value:c.find(o=>o.key===l.label_key)?.name??l.label_key})),l.title_contains&&a.push(I("rule.sum.titleContains",{title_contains:l.title_contains})),l.status&&a.push(I("rule.sum.status",{value:Xm(l.status)})),l.from_status&&a.push(I("rule.sum.fromStatus",{value:Xm(l.from_status)})),l.to_status&&a.push(I("rule.sum.toStatus",{value:Xm(l.to_status)})),l.manager_empty===!0&&a.push(I("rule.sum.noOwner")),l.manager_empty===!1&&a.push(I("rule.sum.hasOwner")),l.manager_account_seq&&a.push(I("rule.sum.owner",{manager_name:l.manager_name||I("rule.accountNo",{manager_account_seq:l.manager_account_seq})})),l.receiver_account_seq&&a.push(I("rule.sum.ccIncludes",{receiver_name:l.receiver_name||I("rule.accountNo2",{receiver_account_seq:l.receiver_account_seq})})),l.changed_field&&a.push(I("rule.sum.fieldChanged",{value:Ml.find(o=>o.value===l.changed_field)?.label??l.changed_field})),l.comment_contains&&a.push(I("rule.sum.commentContains",{comment_contains:l.comment_contains})),l.comment_by_others===!0&&a.push(I("rule.sum.commentByOthers")),typeof l.overdue_days=="number"&&a.push(I("rule.sum.overdueDays",{overdue_days:l.overdue_days}));let r=[];n.set_status&&r.push(I("rule.sum.status",{value:Xm(n.set_status)})),n.set_priority&&r.push(I("rule.sum.priority",{value:Zm.find(o=>o.value===n.set_priority)?.label})),n.assign_manager_account_seq&&r.push(I("rule.sum.setOwner",{assign_manager_name:n.assign_manager_name||I("rule.specified")})),n.add_receiver_account_seq&&r.push(I("rule.sum.addCc",{add_receiver_name:n.add_receiver_name||I("rule.specified")})),n.add_label_key&&r.push(I("rule.sum.addLabel",{value:c.find(o=>o.key===n.add_label_key)?.name??n.add_label_key})),n.apply_content_template_seq&&r.push(I("rule.sum.applyTemplate",{apply_content_template_name:n.apply_content_template_name||I("rule.specified")})),n.notify_account_seq&&r.push(I("rule.sum.notify"));let t=wg.find(o=>o.value===e.trigger)?.label??e.trigger;return{left:a.length>0?`${t} \xB7 ${a.join(", ")}`:t,right:r.join(", ")||I("rule.sum.noAction")}}var JH={fontSize:16,fontWeight:700,color:"#37352f"},SK={display:"flex",alignItems:"center",gap:1},CK={width:104,flexShrink:0,fontSize:16,color:"#37352f"};function _K({open:e,rules:u,customTabs:c,statusOptions:l,contentTemplates:n=[],onPickAccount:a,onClose:r,onCreate:t,onUpdate:o,onToggle:d,onRemove:i}){ue();let s=QH({open:e,rules:u,customTabs:c,statusOptions:l,contentTemplates:n,onPickAccount:a,onClose:r,onCreate:t,onUpdate:o,onToggle:d,onRemove:i}),{form:h,actions:f}=s,m=s.modals.list,b=s.modals.form,{setCondition:g,setAction:w,removeCondition:S,removeAction:O,pickConditionAccount:P,pickAccountFor:j,changeTrigger:M}=f,N=h.isSubmitting,z=(0,Os.useRef)(null),[W,F]=(0,Os.useState)(null),[C,B]=(0,Os.useState)(null);(0,Os.useEffect)(()=>{if(!b.isOpen)return;let A=window.setTimeout(()=>z.current?.focus(),120);return()=>window.clearTimeout(A)},[b.isOpen]);let R=Number(h.useValue("editSeq")??0)>0,p=h.useValue("trigger")??"created",y=$m(l),x=ho.map(A=>({value:A.key,label:A.name})),k=kg(c),T=h.useValue("condition")??{},_=h.useValue("action")??{},D=T.is_bug!==void 0||T.is_event!==void 0,H=[...T.group_seq===void 0&&k.length>0?[{key:"group_seq",label:I("rule.cond.project")}]:[],...D?[]:[{key:"kind",label:I("rule.cond.kind")}],...T.priority===void 0?[{key:"priority",label:I("rule.cond.priority")}]:[],...T.label_key===void 0&&y.length>0?[{key:"label_key",label:I("rule.cond.label")}]:[],...T.title_contains===void 0?[{key:"title_contains",label:I("rule.cond.titleContains")}]:[],...T.manager_empty===void 0?[{key:"manager_empty",label:I("rule.cond.ownerEmpty")}]:[],...a&&T.manager_account_seq===void 0?[{key:"manager_account",label:I("rule.cond.owner")}]:[],...a&&T.receiver_account_seq===void 0?[{key:"receiver_account",label:I("rule.cond.ccIncludes")}]:[],...p==="status_changed"&&T.from_status===void 0?[{key:"from_status",label:I("rule.cond.fromStatus")}]:[],...p==="status_changed"&&T.to_status===void 0?[{key:"to_status",label:I("rule.cond.toStatus")}]:[],...p==="field_changed"&&T.changed_field===void 0?[{key:"changed_field",label:I("rule.cond.fieldChanged")}]:[],...p==="commented"&&T.comment_contains===void 0?[{key:"comment_contains",label:I("rule.cond.commentContains")}]:[],...p==="commented"&&T.comment_by_others===void 0?[{key:"comment_by_others",label:I("rule.cond.commentByOthers")}]:[],...p==="overdue"&&T.overdue_days===void 0?[{key:"overdue_days",label:I("rule.cond.overdueDays")}]:[]],V=A=>{F(null),f.addCondition(A)},U=[..._.set_status===void 0?[{key:"set_status",label:I("rule.act.setStatus")}]:[],..._.set_priority===void 0?[{key:"set_priority",label:I("rule.act.setPriority")}]:[],..._.add_label_key===void 0&&y.length>0?[{key:"add_label_key",label:I("rule.act.addLabel")}]:[],...a&&_.assign_manager_account_seq===void 0?[{key:"assign_manager",label:I("rule.act.assignOwner")}]:[],...a&&_.add_receiver_account_seq===void 0?[{key:"add_receiver",label:I("rule.act.addCc")}]:[],...n.length>0&&_.apply_content_template_seq===void 0?[{key:"apply_content_template",label:I("rule.act.applyTemplate")}]:[],...a&&_.notify_account_seq===void 0?[{key:"notify",label:I("rule.act.notify")}]:[]],L=A=>{B(null),f.addAction(A)},G=(A,q,$,Q)=>(0,He.jsxs)(St.Box,{sx:SK,children:[(0,He.jsx)(St.Box,{sx:CK,children:A}),(0,He.jsxs)(St.Box,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:Q?"column":"row",alignItems:Q?"stretch":"center",gap:Q?.5:1},children:[q,Q?(0,He.jsx)(St.Box,{sx:{fontSize:13.5,color:"#37352f"},children:Q}):null]}),(0,He.jsx)(St.Tooltip,{title:I("rule.removeRow"),arrow:!0,disableInteractive:!0,children:(0,He.jsx)(St.IconButton,{size:"small","aria-label":I("rule.removeRowAria",{label:A}),onClick:$,children:(0,He.jsx)(nW.default,{sx:{fontSize:16}})})})]}),E=()=>(0,He.jsxs)(St.Box,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[(0,He.jsx)(Er.ClearTextField,{size:"medium",label:I("rule.ruleName"),inputRef:z,placeholder:I("rule.ruleNamePlaceholder"),name:"name",form:h}),(0,He.jsx)(St.Box,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap"},children:wg.map(A=>{let q=p===A.value;return(0,He.jsx)(St.Button,{disableElevation:!0,variant:q?"contained":"outlined",color:q?"primary":"inherit",onClick:()=>M(A.value),sx:{borderRadius:99,px:1.75,...q?{}:{color:"#57564f",borderColor:"#d9d9d6"}},children:A.label},A.value)})}),(0,He.jsx)(St.Box,{sx:{fontSize:13,color:"#787774",mt:-.5},children:wg.find(A=>A.value===p)?.hint}),(0,He.jsxs)(St.Box,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[(0,He.jsx)(St.Box,{sx:JH,children:I("rule.whenTitle")}),H.length>0?(0,He.jsx)(St.Button,{size:"small",startIcon:(0,He.jsx)(Ym.default,{sx:{fontSize:16}}),onClick:A=>F(A.currentTarget),sx:{color:"#2563eb",minWidth:0},children:I("rule.addCondition")}):null]}),T.group_seq!==void 0?G(I("col.project"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",value:String(T.group_seq),options:k,onChange:A=>g("group_seq",Number(A.target.value)||"")}),()=>S("group_seq")):null,D?G(I("col.kind"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",value:T.is_bug?"bug":"event",options:[{value:"bug",label:I("rule.sum.bugOnly")},{value:"event",label:I("rule.sum.eventOnly")}],onChange:A=>{let q=A.target.value==="bug";g("is_bug",q?!0:""),g("is_event",q?"":!0)}}),()=>S("kind")):null,T.priority!==void 0?G(I("col.priority"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"condition.priority",form:h,options:Zm}),()=>S("priority")):null,T.label_key!==void 0?G(I("dialog.label"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"condition.label_key",form:h,options:y}),()=>S("label_key")):null,T.title_contains!==void 0?G(I("common.title"),(0,He.jsx)(Er.ClearTextField,{size:"medium",fullWidth:!0,placeholder:I("rule.titleWordPlaceholder"),name:"condition.title_contains",form:h}),()=>S("title_contains")):null,T.manager_empty!==void 0?G(I("col.owner"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",value:T.manager_empty?"empty":"assigned",options:[{value:"empty",label:I("common.none")},{value:"assigned",label:I("rule.present")}],onChange:A=>g("manager_empty",A.target.value==="empty")}),()=>S("manager_empty")):null,T.manager_account_seq!==void 0?G(I("col.owner"),(0,He.jsx)(St.Button,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{P("manager_account")},children:T.manager_name||I("rule.accountNo",{manager_account_seq:T.manager_account_seq})}),()=>S("manager_account")):null,T.receiver_account_seq!==void 0?G(I("col.cc"),(0,He.jsx)(St.Button,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{P("receiver_account")},children:T.receiver_name||I("rule.accountNo2",{receiver_account_seq:T.receiver_account_seq})}),()=>S("receiver_account")):null,T.from_status!==void 0?G(I("rule.fromStatus"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"condition.from_status",form:h,options:x}),()=>S("from_status")):null,T.to_status!==void 0?G(I("rule.toStatus"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"condition.to_status",form:h,options:x}),()=>S("to_status")):null,T.changed_field!==void 0?G(I("rule.changedField"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"condition.changed_field",form:h,options:Ml}),()=>S("changed_field")):null,T.comment_contains!==void 0?G(I("rule.commentWord"),(0,He.jsx)(Er.ClearTextField,{size:"medium",fullWidth:!0,placeholder:I("rule.commentWordPlaceholder"),name:"condition.comment_contains",form:h}),()=>S("comment_contains")):null,T.comment_by_others!==void 0?G(I("rule.commentAuthor"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",value:T.comment_by_others?"others":"any",options:[{value:"others",label:I("rule.notOwner")},{value:"any",label:I("rule.anyone")}],onChange:A=>g("comment_by_others",A.target.value==="others")}),()=>S("comment_by_others")):null,T.overdue_days!==void 0?G(I("rule.elapsedDays"),(0,He.jsx)(Er.ClearTextField,{size:"medium",fullWidth:!0,type:"number",value:String(T.overdue_days),onChange:A=>g("overdue_days",Math.max(0,Number(A.target.value)||0)),label:I("rule.overdueDaysLabel")}),()=>S("overdue_days")):null,Object.keys(T).length===0?(0,He.jsx)(St.Box,{sx:{fontSize:13.5,color:"#9a9a97"},children:I("rule.noConditionHint")}):null,(0,He.jsxs)(St.Box,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[(0,He.jsx)(St.Box,{sx:JH,children:I("rule.doTitle")}),U.length>0?(0,He.jsx)(St.Button,{size:"small",startIcon:(0,He.jsx)(Ym.default,{sx:{fontSize:16}}),onClick:A=>B(A.currentTarget),sx:{color:"#2563eb",minWidth:0},children:I("rule.addActionButton")}):null]}),_.set_status!==void 0?G(I("col.status"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"action.set_status",form:h,options:x}),()=>O("set_status")):null,_.set_priority!==void 0?G(I("col.priority"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"action.set_priority",form:h,options:Zm}),()=>O("set_priority")):null,_.apply_content_template_seq!==void 0?G(I("rule.bodyTemplate"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",value:String(_.apply_content_template_seq),options:n.map(A=>({value:String(A.seq),label:A.name})),onChange:A=>f.selectContentTemplate(String(A.target.value))}),()=>O("apply_content_template"),I("rule.bodyTemplateHint")):null,_.add_label_key!==void 0?G(I("dialog.label"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"action.add_label_key",form:h,options:y}),()=>O("add_label_key")):null,_.assign_manager_account_seq!==void 0?G(I("col.owner"),(0,He.jsx)(St.Button,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{j("assign_manager")},children:_.assign_manager_name||I("rule.accountNo3",{assign_manager_account_seq:_.assign_manager_account_seq})}),()=>O("assign_manager")):null,_.add_receiver_account_seq!==void 0?G(I("col.cc"),(0,He.jsx)(St.Button,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{j("add_receiver")},children:_.add_receiver_name||I("rule.accountNo4",{add_receiver_account_seq:_.add_receiver_account_seq})}),()=>O("add_receiver")):null,_.notify_account_seq!==void 0?G(I("rule.notification"),(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(St.Button,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{j("notify")},sx:{flexShrink:0},children:_.notify_name||I("rule.accountNo5",{notify_account_seq:_.notify_account_seq})}),(0,He.jsx)(Er.ClearTextField,{size:"medium",fullWidth:!0,placeholder:I("rule.notifyMessagePlaceholder"),value:_.notify_message??"",onChange:A=>w("notify_message",A.target.value)})]}),()=>O("notify")):null,Object.keys(_).length===0?(0,He.jsx)(St.Box,{sx:{fontSize:13.5,color:"#9a9a97"},children:I("rule.pickActionHint")}):null,(0,He.jsx)(St.Menu,{transitionDuration:0,anchorEl:W,open:!!W,onClose:()=>F(null),children:H.map(A=>(0,He.jsx)(St.MenuItem,{dense:!0,onClick:()=>V(A.key),sx:{fontSize:14},children:A.label},A.key))}),(0,He.jsx)(St.Menu,{transitionDuration:0,anchorEl:C,open:!!C,onClose:()=>B(null),children:U.map(A=>(0,He.jsx)(St.MenuItem,{dense:!0,onClick:()=>L(A.key),sx:{fontSize:14},children:A.label},A.key))})]});return(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(xg.FormDialog,{open:m.isOpen,onClose:m.close,maxWidth:"sm",title:I("rule.title"),locale:Pt(),titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-rule-manage",tabs:{visible:!1},contentPaddingX:0,contentTopPadding:0,contentBottomPadding:0,sectionContentPaddingTop:0,sections:[{id:"rules",title:"",showTitle:!1,children:(0,He.jsxs)(St.Box,{sx:{display:"flex",flexDirection:"column",px:2.5,py:2},children:[u.length===0?(0,He.jsxs)(St.Box,{sx:{py:4,display:"flex",flexDirection:"column",alignItems:"center",gap:2,color:"#9a9a97"},children:[(0,He.jsx)(tW.default,{sx:{fontSize:48,color:"#d9d9d6"}}),(0,He.jsx)(St.Box,{sx:{fontSize:15},children:I("rule.noRules")})]}):null,u.map(A=>(0,He.jsxs)(St.Box,{sx:{display:"flex",alignItems:"center",gap:2,py:1,"&:not(:last-of-type)":{borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`},opacity:A.enabled?1:.5},children:[(0,He.jsx)(St.Tooltip,{title:A.enabled?I("rule.enabled"):I("rule.disabled"),arrow:!0,disableInteractive:!0,children:(0,He.jsx)(St.Switch,{size:"small",inputProps:{"aria-label":I("rule.enableAria",{name:A.name})},checked:A.enabled,onChange:(q,$)=>f.toggleRule(A.seq,$)})}),(0,He.jsxs)(St.Box,{sx:{flex:1,minWidth:0},children:[(0,He.jsx)(St.Box,{sx:{fontSize:16,fontWeight:600,color:"#37352f"},children:A.name}),(()=>{let q=TK(A,c,l);return(0,He.jsxs)(St.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5,fontSize:15,color:"#6f6f6c"},children:[(0,He.jsx)(St.Box,{component:"span",children:q.left}),(0,He.jsx)(eW.default,{sx:{fontSize:18,color:"#9a9a97",flexShrink:0}}),(0,He.jsx)(St.Box,{component:"span",children:q.right})]})})()]}),(0,He.jsx)(St.IconButton,{size:"small","aria-label":I("rule.editAria",{name:A.name}),onClick:()=>f.openEdit(A),children:(0,He.jsx)(rW.default,{sx:{fontSize:18}})}),(0,He.jsx)(St.IconButton,{size:"small","aria-label":I("rule.deleteAria",{name:A.name}),onClick:()=>f.removeRule(A.seq),children:(0,He.jsx)(Dr,{sx:{fontSize:18}})})]},A.seq))]})}],actions:{showCancelButton:!1,left:(0,He.jsx)(St.Button,{startIcon:(0,He.jsx)(Ym.default,{}),onClick:f.openCreate,sx:{color:"#2563eb"},children:I("rule.newRule")}),right:(0,He.jsx)(St.Button,{variant:"contained",onClick:m.close,children:I("common.close")})}}),(0,He.jsx)(xg.FormDialog,{open:b.isOpen,onClose:b.close,maxWidth:"sm",title:R?I("rule.editRule"):I("rule.newRule"),locale:Pt(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-rule-form",tabs:{visible:!1},sectionContentPaddingTop:0,sections:[{id:"rule-form",title:"",showTitle:!1,children:E()}],actions:{showCancelButton:!0,right:(0,He.jsx)(St.Button,{variant:"contained",onClick:()=>{h.submit()},disabled:N,children:R?I("common.edit"):I("rule.addRule")})}})]})}pn();var ui=require("react"),Qt=require("@mui/material");var dW=v(require("@mui/icons-material/Tune"),1),Sg=v(require("@mui/icons-material/Add"),1),mW=v(require("@mui/icons-material/EditOutlined"),1),hW=v(require("@mui/icons-material/ContentCopyOutlined"),1),fW=v(require("@mui/icons-material/DragIndicator"),1),pW=v(require("@mui/icons-material/PlaylistAddCheckOutlined"),1),ji=require("@dnd-kit/core"),Jm=require("@dnd-kit/modifiers"),Dl=require("@dnd-kit/sortable"),gW=require("@dnd-kit/utilities"),Cg=require("@ehfuse/mui-form-dialog"),Rl=require("@ehfuse/mui-form-controls"),bW=v(require("@ehfuse/overlay-scrollbar"),1);var vu=require("react"),Qm=require("@ehfuse/forma"),ku=require("@ehfuse/alerts");_e();var oW=0;function iW(){return oW+=1,`ti${oW}`}function Tg(){return{editSeq:0,name:"",description:"",group_seq:0,itemIds:[],items:{}}}function aW(){return{title:"",start_offset_days:0,due_offset_days:0,priority:"medium"}}function lW(e){ue();let u=(0,vu.useRef)(e);u.current=e;let c=(0,Qm.useGlobalForm)({formId:Dt("taskbox-template-form"),initialValues:Tg(),onValidate:d=>d.name.trim()?sW(d).length===0?((0,ku.ErrorAlert)({message:I("template.addItemRequired")}),!1):!0:((0,ku.ErrorAlert)({message:I("template.enterName")}),!1),onSubmit:async d=>{let i={name:d.name.trim(),description:d.description,group_seq:d.group_seq,items:sW(d)},s=d.editSeq>0?await u.current.onUpdate(d.editSeq,i):await u.current.onCreate(i);return s&&(l.form.close(),c.setFormValues(Tg())),s}}),l={list:li({modalId:Dt("taskbox-template-manage"),open:e.open,onClose:()=>u.current.onClose()}),form:(0,Qm.useModal)({modalId:Dt("taskbox-template-edit")})},n=(0,vu.useRef)(l.form);n.current=l.form,(0,vu.useEffect)(()=>{if(e.open)return;let d=window.setTimeout(()=>{n.current.isOpen&&n.current.close(),c.setFormValues(Tg())},500);return()=>window.clearTimeout(d)},[e.open]);let a=(d,i)=>{let s=i.items.map(()=>iW());c.setFormValues({editSeq:d,name:i.name,description:i.description??"",group_seq:i.group_seq??0,itemIds:s,items:Object.fromEntries(i.items.map((h,f)=>[s[f],{...h}]))}),l.form.open()},r=(d,i)=>({name:i,description:d.description??"",group_seq:d.group_seq??0,items:d.items.map(s=>({...s}))}),t=(d,i)=>{let s=c.getFormValue(`items.${d}`);c.setFormValue(`items.${d}`,{...s??aW(),...i})};return{form:c,modals:l,actions:{openCreate:()=>a(0,{name:"",description:"",group_seq:0,items:[]}),openEdit:d=>a(d.seq,r(d,d.name)),openDuplicate:d=>a(0,r(d,I("template.copyName",{name:d.name}))),closeForm:()=>l.form.close(),setItem:t,addItem:()=>{let d=iW();c.setFormValue(`items.${d}`,aW()),c.setFormValue("itemIds",[...c.getFormValue("itemIds")??[],d])},removeItem:d=>{let i=c.getFormValue("itemIds")??[];c.setFormValue("itemIds",i.filter(s=>s!==d))},moveItem:(d,i)=>{let s=[...c.getFormValue("itemIds")??[]],h=s.indexOf(d),f=s.indexOf(i);if(h<0||f<0||h===f)return;let[m]=s.splice(h,1);s.splice(f,0,m),c.setFormValue("itemIds",s)},pickItemManager:async d=>{let i=u.current.onPickAccount;if(!i)return;let s=c.getFormValue(`items.${d}`),h=await i(s?.manager_account_seq??0,I("col.owner"));h&&t(d,{manager_account_seq:h.accountSeq,manager_name:h.name})},clearItemManager:d=>t(d,{manager_account_seq:0,manager_name:""}),removeTemplate:async d=>{await(0,ku.ConfirmDialog)({title:I("template.deleteTemplate"),message:I("template.deleteConfirm",{name:d.name})})&&u.current.onRemove(d.seq)},runTemplate:d=>u.current.onRun?.(d)}}}function sW(e){return(e.itemIds??[]).map(u=>e.items?.[u]).filter(u=>!!u&&String(u.title??"").trim().length>0)}_e();var dt=require("react/jsx-runtime");var yW=()=>I("template.itemTitlePlaceholder"),vW=2;var kW=20,Nue=`${kW+vW*8}px`;function IK({id:e,children:u}){let{attributes:c,listeners:l,setNodeRef:n,transform:a,transition:r,isDragging:t}=(0,Dl.useSortable)({id:e});return(0,dt.jsx)(Qt.Box,{ref:n,sx:{transform:gW.CSS.Transform.toString(a),transition:r,...t?{opacity:.6,position:"relative",zIndex:1}:{}},children:u({handleProps:{...c,...l},dragging:t})})}function BK(e){return e.start_offset_days!==void 0||e.due_offset_days!==void 0||e.priority!==void 0&&e.priority!=="medium"||!!e.manager_account_seq||(e.label_keys?.length??0)>0||!!String(e.content??"").replace(/<[^>]*>/g,"").trim()||(e.checklist?.length??0)>0||!!String(e.note??"").trim()||!!e.visibility}function OK({id:e,index:u,isLast:c,form:l,actions:n,handleProps:a,onOpenProps:r}){ue();let t=l.useValue(`items.${e}`)??{},o=BK(t);return(0,dt.jsxs)(Qt.Box,{sx:{borderBottom:c?"none":"1px solid #f2f2f0",px:vW,py:1,display:"flex",alignItems:"center",gap:1},children:[(0,dt.jsx)(Qt.Box,{...a,"aria-label":I("template.reorderItem",{value:u+1}),sx:{display:"inline-flex",alignItems:"center",flexShrink:0,mr:1,color:"#c9c8c5",cursor:"grab","&:active":{cursor:"grabbing"},touchAction:"none",userSelect:"none"},children:(0,dt.jsx)(fW.default,{sx:{fontSize:kW}})}),(0,dt.jsx)(Rl.ClearTextField,{size:"medium",fullWidth:!0,placeholder:yW(),slotProps:{htmlInput:{"data-template-title":u}},name:`items.${e}.title`,form:l}),(0,dt.jsx)(Qt.Tooltip,{title:o?I("template.propsFilled"):I("template.props"),arrow:!0,disableInteractive:!0,children:(0,dt.jsx)(Qt.IconButton,{size:"medium","aria-label":I("template.itemProps",{value:u+1}),onClick:()=>r(e),sx:{flexShrink:0,color:o?"primary.main":"#9a9a97"},children:(0,dt.jsx)(dW.default,{sx:{fontSize:20}})})}),(0,dt.jsx)(Qt.Tooltip,{title:I("template.deleteItem"),arrow:!0,disableInteractive:!0,children:(0,dt.jsx)(Qt.IconButton,{size:"medium","aria-label":I("template.deleteItemAria",{value:u+1}),onClick:()=>n.removeItem(e),sx:{flexShrink:0},children:(0,dt.jsx)(Dr,{sx:{fontSize:18}})})})]})}function cW(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function uW(e,u){let c=l=>{let[n,a,r]=l.slice(0,10).split("-").map(Number);return Date.UTC(n,(a||1)-1,r||1)};return Math.round((c(u)-c(e))/864e5)}function AK({id:e,form:u,actions:c,customTabs:l,labels:n,onAddLabel:a,onPickAccount:r,onClose:t}){ue();let o=(0,ui.useRef)(e);o.current=e;let d=(0,ui.useRef)(t);d.current=t;let i=(0,ui.useRef)(cW()),s=Hs({formId:"taskbox-template-item-form",onSubmit:m=>{let b=o.current;if(!b)return!1;let g=i.current;return c.setItem(b,{title:String(m.title??"").trim(),content:m.content??"",start_offset_days:m.start_date?uW(g,m.start_date):void 0,due_offset_days:m.due_date?uW(g,m.due_date):void 0,priority:m.priority,label_keys:[...m.label_keys??[]],manager_account_seq:m.manager_account_seq||void 0,manager_name:m.manager_account_seq?m.manager_name:void 0,checklist:(m.checklist??[]).map(w=>w.label).filter(w=>w.trim().length>0),note:m.note??"",visibility:m.visibility,visibility_group_seq:m.visibility==="group"?m.visibility_group_seq:void 0}),d.current(),!0}}),h=u.useValue(e?`items.${e}`:"__none__")??{},f=m=>m===void 0?"":Dc(i.current,m);return(0,ui.useEffect)(()=>{e&&(i.current=cW(),s.setFormValues({start_date:f(h.start_offset_days),priority:h.priority??"medium",label_keys:[...h.label_keys??[]],note:h.note??"",...h.visibility?{visibility:h.visibility,visibility_group_seq:h.visibility_group_seq??0}:{},checklist:(h.checklist??[]).map(m=>({label:m,checked:!1}))}))},[e]),(0,dt.jsx)(rp,{open:!!e,onClose:t,form:s,statusOptions:n,customTabs:l,presetTitle:h.title??"",presetContent:h.content??"",presetDueDate:f(h.due_offset_days),presetManager:h.manager_account_seq?{name:h.manager_name??"",accountSeq:h.manager_account_seq}:null,hideTypeToggle:!0,hideProject:!0,hideMembers:!r,templateItem:!0,submitLabel:I("common.apply"),contentSyncKey:`template-${e??""}`,onAddLabelOption:a,onMemberEdit:m=>{m!=="manager"||!r||(async()=>{let b=Number(s.getFormValue("manager_account_seq"))||0,g=await r(b,I("col.owner"));g&&s.setFormValues({manager_account_seq:g.accountSeq,manager_name:g.name})})()}})}function EK({open:e,templates:u,customTabs:c,onPickAccount:l,onClose:n,onCreate:a,onUpdate:r,onRemove:t,onRun:o,labels:d=[],onAddLabel:i}){ue();let[s,h]=(0,ui.useState)(null),f=lW({open:e,templates:u,customTabs:c,onPickAccount:l,onClose:n,onCreate:a,onUpdate:r,onRemove:t,onRun:o}),{form:m,actions:b}=f,g=f.modals.list,w=f.modals.form,S=m.isSubmitting,O=Number(m.useValue("editSeq")??0),P=m.useValue("itemIds")??[],[j,M]=(0,ui.useState)(0),N=(0,ui.useRef)(null),z=(0,ui.useRef)(null),W=()=>{let k=z.current?.getScrollContainer()??null;if(k){k.scrollTop=k.scrollHeight;return}let T=N.current?.querySelectorAll("*")??[];for(let _ of Array.from(T))if(_.scrollHeight>_.clientHeight+1){_.scrollTop=_.scrollHeight;return}},F=()=>{let k=N.current;if(!k)return null;let T=k.querySelectorAll("input[data-template-title]"),_=T.length?T:k.querySelectorAll(`input[placeholder="${yW()}"]`);return _.length?_[_.length-1]:null};(0,ui.useEffect)(()=>{if(j===0)return;let k=0,T=0,_=()=>{W();let H=F();H&&document.activeElement!==H&&H.focus(),k+=1,!(H&&document.activeElement===H)&&k<8&&(T=window.setTimeout(_,50))},D=window.requestAnimationFrame(_);return()=>{window.cancelAnimationFrame(D),window.clearTimeout(T)}},[j]);let C=c.filter(k=>!k.archived).map(k=>({value:String(si(k.key)),label:k.label})),B=Number(m.useValue("group_seq")??0),R=(0,ji.useSensors)((0,ji.useSensor)(ji.PointerSensor,{activationConstraint:{distance:5}})),p=k=>{let T=String(k.active?.id??""),_=String(k.over?.id??"");!T||!_||T===_||b.moveItem(T,_)},y=(0,dt.jsx)(Qt.Box,{children:u.length===0?(0,dt.jsxs)(Qt.Box,{sx:{py:4,display:"flex",flexDirection:"column",alignItems:"center",gap:2,color:"#9a9a97"},children:[(0,dt.jsx)(pW.default,{sx:{fontSize:48,color:"#d9d9d6"}}),(0,dt.jsx)(Qt.Box,{sx:{fontSize:13.5},children:I("template.noTemplates")})]}):u.map(k=>(0,dt.jsxs)(Qt.Box,{sx:{display:"flex",alignItems:"center",gap:2.5,py:1.75,"&:not(:last-of-type)::after":{content:'""',display:"block",my:1.75,borderBottom:"1px solid #f0efed"}},children:[(0,dt.jsxs)(Qt.Box,{sx:{flex:1,minWidth:0},children:[(0,dt.jsx)(Qt.Box,{sx:{fontSize:18,fontWeight:600,color:"#37352f"},children:k.name}),(0,dt.jsxs)(Qt.Box,{sx:{fontSize:14,color:"#787774",mt:.25},children:[I("template.taskCount",{count:k.items.length}),k.description?` \xB7 ${k.description}`:""]})]}),o?(0,dt.jsx)(Qt.Button,{size:"medium",variant:"outlined",onClick:()=>b.runTemplate(k),sx:{flexShrink:0},children:I("template.run")}):null,(0,dt.jsx)(Qt.Tooltip,{title:I("common.edit"),arrow:!0,disableInteractive:!0,children:(0,dt.jsx)(Qt.IconButton,{size:"medium","aria-label":I("template.editAria",{name:k.name}),onClick:()=>b.openEdit(k),children:(0,dt.jsx)(mW.default,{sx:{fontSize:19}})})}),(0,dt.jsx)(Qt.Tooltip,{title:I("menu.duplicate"),arrow:!0,disableInteractive:!0,children:(0,dt.jsx)(Qt.IconButton,{size:"medium","aria-label":I("template.duplicateAria",{name:k.name}),onClick:()=>b.openDuplicate(k),children:(0,dt.jsx)(hW.default,{sx:{fontSize:18}})})}),(0,dt.jsx)(Qt.Tooltip,{title:I("common.delete"),arrow:!0,disableInteractive:!0,children:(0,dt.jsx)(Qt.IconButton,{size:"medium","aria-label":I("template.deleteAria",{name:k.name}),onClick:()=>{b.removeTemplate(k)},children:(0,dt.jsx)(Dr,{sx:{fontSize:18}})})})]},k.seq))}),x=(0,dt.jsxs)(Qt.Box,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,dt.jsx)(Rl.ClearTextField,{size:"medium",label:I("template.name"),placeholder:I("template.namePlaceholder"),fullWidth:!0,name:"name",form:m}),(0,dt.jsxs)(Qt.Box,{sx:{display:"grid",gridTemplateColumns:C.length>0?"1fr 1fr":"1fr",gap:2},children:[(0,dt.jsx)(Rl.ClearTextField,{size:"medium",label:I("googleEvent.description"),placeholder:I("template.descriptionPlaceholder"),fullWidth:!0,name:"description",form:m}),C.length>0?(0,dt.jsx)(Rl.LabelSelect,{size:"medium",fullWidth:!0,label:I("template.targetProject"),value:String(B),options:[{value:"0",label:os()},...C],onChange:k=>m.setFormValue("group_seq",Number(k.target.value)||0)}):null]}),(0,dt.jsxs)(Qt.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,dt.jsx)(Qt.Box,{sx:{fontSize:18,fontWeight:600,color:"#37352f"},children:I("template.items")}),(0,dt.jsx)(Qt.Box,{sx:{fontSize:14,color:"#37352f"},children:I("template.datesHint")})]}),P.length===0?(0,dt.jsx)(Qt.Box,{sx:{fontSize:14,color:"#9a9a97",py:2},children:I("template.noItemsHint")}):(0,dt.jsx)(Qt.Box,{ref:N,sx:{border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,overflow:"hidden"},children:(0,dt.jsx)(bW.default,{ref:z,style:{maxHeight:"min(560px, 52vh)"},thumb:{width:6},children:(0,dt.jsx)(ji.DndContext,{sensors:R,collisionDetection:ji.closestCenter,modifiers:[Jm.restrictToVerticalAxis,Jm.restrictToParentElement],onDragEnd:p,children:(0,dt.jsx)(Dl.SortableContext,{items:P,strategy:Dl.verticalListSortingStrategy,children:P.map((k,T)=>(0,dt.jsx)(IK,{id:k,children:({handleProps:_})=>(0,dt.jsx)(OK,{id:k,index:T,isLast:T===P.length-1,form:m,actions:b,handleProps:_,onOpenProps:h})},k))})})})})]});return(0,dt.jsxs)(dt.Fragment,{children:[(0,dt.jsx)(Cg.FormDialog,{open:g.isOpen,onClose:g.close,maxWidth:"md",title:I("template.title"),locale:Pt(),titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-template",tabs:{visible:!1},actions:{showCancelButton:!1,left:(0,dt.jsx)(Qt.Button,{startIcon:(0,dt.jsx)(Sg.default,{sx:{fontSize:18}}),onClick:b.openCreate,children:I("template.newTemplate")}),right:(0,dt.jsx)(Qt.Button,{variant:"contained",onClick:g.close,children:I("common.close")})},sectionContentPaddingTop:0,sections:[{id:"templates",title:"",showTitle:!1,children:y}]}),(0,dt.jsx)(Cg.FormDialog,{open:w.isOpen,onClose:w.close,maxWidth:"md",title:O>0?I("template.editTemplate"):I("template.newTemplate"),locale:Pt(),backdropClick:!1,fontScale:{enabled:!0},fontScaleKey:"taskbox-task-template-form",titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},tabs:{visible:!1},actions:{showCancelButton:!0,left:(0,dt.jsx)(Qt.Button,{startIcon:(0,dt.jsx)(Sg.default,{sx:{fontSize:18}}),onClick:()=>{b.addItem(),M(k=>k+1)},children:I("template.addItem")}),right:(0,dt.jsx)(Qt.Button,{variant:"contained",disabled:S,onClick:()=>{m.submit()},children:I("common.save")})},sectionContentPaddingTop:0,sections:[{id:"template-form",title:"",showTitle:!1,children:x}]}),(0,dt.jsx)(AK,{id:w.isOpen?s:null,form:m,actions:b,customTabs:c,labels:d,onAddLabel:i,onPickAccount:l,onClose:()=>h(null)})]})}pn();var Fr=require("@mui/material"),TW=require("@ehfuse/mui-form-dialog"),SW=require("@ehfuse/mui-form-controls"),CW=v(require("@ehfuse/overlay-scrollbar"),1);var eh=require("react"),xW=require("@ehfuse/forma");function wW(e){let u=(0,eh.useRef)(e);u.current=e;let c=(0,eh.useRef)(e.template);e.template&&(c.current=e.template);let l=e.template??c.current,n=(0,eh.useRef)(l);n.current=l;let a=(0,xW.useGlobalForm)({formId:Dt("taskbox-template-run-form"),initialValues:{baseDate:e.todayStr},onValidate:o=>u.current.running||!n.current?!1:Nc(n.current,o.baseDate).length>0,onSubmit:o=>n.current?(u.current.onRun(Nc(n.current,o.baseDate),o.baseDate),!0):!1}),r={run:li({modalId:Dt("taskbox-template-run"),open:e.open,onClose:()=>u.current.onClose(),onOpen:()=>a.setFormValues({baseDate:u.current.todayStr})})},t=o=>l?Nc(l,o):[];return{form:a,modals:r,template:l,running:!!e.running,planTasks:t}}_e();var yr=require("react/jsx-runtime");function PK(e){ue();let u=wW(e),{form:c,running:l}=u,n=u.modals.run,a=u.template,r=String(c.useValue("baseDate")??""),t=u.planTasks(r);return(0,yr.jsx)(TW.FormDialog,{open:n.isOpen,onClose:n.close,maxWidth:"md",title:a?I("template.runTitle",{name:a.name}):I("template.runTemplate"),locale:Pt(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-template-run",tabs:{visible:!1},sectionContentPaddingTop:0,actions:{showCancelButton:!0,right:(0,yr.jsx)(Fr.Button,{variant:"contained",disabled:l||t.length===0,onClick:()=>{c.submit()},children:l?I("template.creating"):I("template.createCount",{length:t.length})})},sections:[{id:"template-run",title:"",showTitle:!1,children:(0,yr.jsxs)(Fr.Box,{sx:{display:"flex",flexDirection:"column",gap:2},children:[(0,yr.jsxs)(Fr.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,yr.jsx)(Fr.Box,{sx:{width:72,flexShrink:0,fontSize:16,color:"#37352f"},children:I("template.baseDate")}),(0,yr.jsx)(SW.DateTextField,{size:"medium",fullWidth:!0,name:"baseDate",form:c})]}),(0,yr.jsx)(Fr.Box,{sx:{fontSize:14.5,color:"#37352f"},children:I("template.runHint")}),(0,yr.jsxs)(Fr.Box,{sx:{border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,overflow:"hidden"},children:[(0,yr.jsxs)(Fr.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,bgcolor:"#fafaf9",borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,fontSize:13.5,fontWeight:600,color:"#37352f"},children:[(0,yr.jsx)(Fr.Box,{sx:{flex:1,minWidth:0},children:I("template.task")}),(0,yr.jsx)(Fr.Box,{sx:{width:88,flexShrink:0,textAlign:"center"},children:I("board.start")}),(0,yr.jsx)(Fr.Box,{sx:{width:88,flexShrink:0,textAlign:"center"},children:I("board.due")}),(0,yr.jsx)(Fr.Box,{sx:{width:96,flexShrink:0,textAlign:"center"},children:I("col.owner")})]}),(0,yr.jsx)(CW.default,{style:{maxHeight:520},thumb:{width:6},children:t.length===0?(0,yr.jsx)(Fr.Box,{sx:{p:2,fontSize:14,color:"#9a9a97"},children:I("template.nothingToCreate")}):t.map((o,d)=>(0,yr.jsxs)(Fr.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1.25,borderBottom:d===t.length-1?"none":"1px solid #f2f2f0",fontSize:16,fontWeight:500,color:"#111111"},children:[(0,yr.jsx)(Fr.Box,{sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.title}),(0,yr.jsx)(Fr.Box,{sx:{width:88,flexShrink:0,textAlign:"center",fontSize:13.5,color:o.start_date?"#37352f":"#9a9a97"},children:Sd(o.start_date)||"-"}),(0,yr.jsx)(Fr.Box,{sx:{width:88,flexShrink:0,textAlign:"center",fontSize:13.5,color:o.due_date?"#37352f":"#9a9a97"},children:Sd(o.due_date)||"-"}),(0,yr.jsx)(Fr.Box,{sx:{width:96,flexShrink:0,textAlign:"center",fontSize:13.5,color:o.manager_name?"#37352f":"#9a9a97",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.manager_name||"-"})]},d))})]})]})}]})}Cs();_e();var MK={get urgent(){return I("print.urgent")},get high(){return I("priority.high")},get normal(){return I("priority.medium")},get low(){return I("priority.low")}};function RK(e){return e.length===0?"":e.length<=2?e.join(", "):I("print.namesAndMore",{value:e[0],value2:e.length-1})}function xu(e){let u=String(e??"").trim().slice(0,10);return/^\d{4}-\d{2}-\d{2}$/.test(u)?`${u.slice(2,4)}.${u.slice(5,7)}.${u.slice(8,10)}`:"-"}function As(e){let u=c=>String(c).padStart(2,"0");return`${e.getFullYear()}-${u(e.getMonth()+1)}-${u(e.getDate())} ${u(e.getHours())}:${u(e.getMinutes())}`}function th(e,u,c){let n=String(e.due_date??"").slice(11,16).trim()||String(e.estimated_time??"").trim(),a=xu(e.due_date),r=String(e.start_date??"").slice(11,16).trim(),t=xu(e.start_date),o=(e.receiver_names??[]).filter(Boolean).map(i=>String(i).trim()),d=(e.checklist??[]).length?`${(e.checklist??[]).filter(i=>i.checked).length}/${(e.checklist??[]).length}`:"";return{seq:Number(e.seq??0),title:String(e.title??"").trim(),statusName:xr(e).name,projectLabel:e.tab_key?u.get(String(e.tab_key))??"":"",managerName:String(e.manager_name??"").trim(),receiverNames:RK(o),receiverNamesFull:o.join(", "),startDate:t!=="-"&&r?`${t} ${r}`:t,dueDate:a!=="-"&&n?`${a} ${n}`:a,priorityName:MK[String(e.priority??"")]??"",checklist:d,checklistItems:(e.checklist??[]).map(i=>{let s=i.task_seq&&c?c(Number(i.task_seq)):null,h=xu(s?.due_date),f=String(s?.due_date??"").slice(11,16).trim();return{label:String(i.label??"").trim(),checked:!!i.checked,managerName:String(s?.manager_name??"").trim(),dueDate:h!=="-"?f?`${h} ${f}`:h:""}}),note:String(e.note??"").trim(),completed:!!e.completed}}function ln(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function DK(e,u){if(e===" ")return u*.3;let c=e.codePointAt(0)??0,l=c>=4352&&c<=4607||c>=12288&&c<=40959||c>=44032&&c<=55203||c>=63744&&c<=64255||c>=65280&&c<=65519;return u*(l?1:.55)}function wu(e,u){let c=0;for(let l of String(e??""))c+=DK(l,u);return c}function Es(e,u){let c=String(e??"").trim();if(!c)return["-"];let l=[],n="";for(let a of c){if(a===`
|
|
86
|
+
${f}`.trim()).then(()=>{r.setValue("copied",!0),window.setTimeout(()=>r.setValue("copied",!1),1500)})};return{modals:a,ui:r,taskSeq:e.taskSeq,isStored:t,selectTarget:o,openDialog:d,copySummary:i,copyResult:s}}var yn=require("react/jsx-runtime"),OF=[{code:"en",get label(){return I("lang.en")}},{code:"ja",get label(){return I("lang.ja")}},{code:"zh",get label(){return I("lang.zh")}},{code:"zh-TW",get label(){return I("lang.zhTW")}},{code:"vi",get label(){return I("lang.vi")}},{code:"th",get label(){return I("lang.th")}},{code:"ko",get label(){return I("lang.ko")}}];function kp({controller:e,title:u,html:c}){ue();let l=e.modals.translate,{ui:n}=e,a=String(n.useValue("target")??"");n.useValue("doneTargets");let r=n.useValue("result"),t=!!n.useValue("loading"),o=String(n.useValue("error")??""),d=!!n.useValue("copied"),i=!!n.useValue("summaryCopied"),[s,h]=(0,vm.useState)(null),f=(b,g)=>{if(b!==a){if(b===""||e.isStored(b)){e.selectTarget(b);return}h({code:b,anchor:g})}};(0,vm.useEffect)(()=>{l.isOpen&&h(null)},[l.isOpen,e.taskSeq]);let m=(0,yn.jsxs)(Un.Box,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[(0,yn.jsx)(Un.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.75},children:[{code:"",label:I("translate.original")},...OF].map(b=>(0,yn.jsx)(Un.Chip,{label:b.label,clickable:!0,icon:b.code&&e.isStored(b.code)?(0,yn.jsx)(ym.default,{sx:{fontSize:16}}):void 0,onClick:g=>f(b.code,g.currentTarget),color:a===b.code?"primary":"default",variant:a===b.code?"filled":"outlined",sx:{fontSize:14,height:30}},b.code||"__source__"))}),(0,yn.jsx)(AF.ConfirmActionPopper,{open:!!s,anchorEl:s?.anchor??null,title:I("translate.startConfirm",{value:OF.find(b=>b.code===s?.code)?.label??""}),confirmText:I("translate.start"),cancelText:I("common.cancel"),placement:"bottom-start",onCancel:()=>h(null),onConfirm:()=>{s&&e.selectTarget(s.code),h(null)}}),a?t?(0,yn.jsx)(Un.Box,{sx:{minHeight:200,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,yn.jsx)(pm,{})}):o?(0,yn.jsx)(Un.Box,{sx:{fontSize:15,color:"#c62828",py:2},children:o}):r?(0,yn.jsxs)(Un.Box,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[r.summary?(0,yn.jsxs)(Un.Box,{sx:{position:"relative",display:"flex",alignItems:"center",gap:2,px:1.5,pr:5,py:1.25,bgcolor:"#eef4ff",border:"1px solid #c7d7fe",borderRadius:1},children:[(0,yn.jsx)(Un.Tooltip,{title:I("translate.copySummary"),arrow:!0,children:(0,yn.jsx)(Un.IconButton,{size:"small","aria-label":I("translate.copySummary"),onClick:e.copySummary,sx:{position:"absolute",top:4,right:4,color:"#64748b"},children:i?(0,yn.jsx)(ym.default,{sx:{fontSize:18,color:"#2f9e5b"}}):(0,yn.jsx)(vp.default,{sx:{fontSize:18}})})}),(0,yn.jsx)(PF.default,{sx:{fontSize:30,color:"#2563eb",flexShrink:0,mx:1.5}}),(0,yn.jsxs)(Un.Box,{sx:{flex:1,minWidth:0},children:[(0,yn.jsx)(Un.Box,{sx:{fontSize:16,fontWeight:600,color:"#1e3a8a"},children:I("translate.aiNotice")}),(0,yn.jsx)(Un.Box,{sx:{fontSize:15,color:"#111",mt:.25,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:r.summary})]})]}):null,(0,yn.jsx)(Un.Box,{sx:{fontSize:18,fontWeight:700,color:"#111",wordBreak:"break-word"},children:r.title}),r.html?(0,yn.jsx)(Un.Box,{sx:{fontSize:16,lineHeight:1.6,color:"#37352f",wordBreak:"break-word","& > p:first-of-type":{mt:0},"& > p:last-of-type":{mb:0},"& a[href]":{color:"#2563eb",textDecoration:"underline"},"& img":{maxWidth:"100%"}},dangerouslySetInnerHTML:{__html:r.html}}):(0,yn.jsx)(Un.Box,{sx:{fontSize:16,lineHeight:1.6,color:"#37352f",whiteSpace:"pre-wrap"},children:r.text})]}):null:(0,yn.jsxs)(Un.Box,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[(0,yn.jsx)(Un.Box,{sx:{fontSize:18,fontWeight:700,color:"#111",wordBreak:"break-word"},children:u}),(0,yn.jsx)(Un.Box,{sx:{fontSize:16,lineHeight:1.6,color:"#37352f",wordBreak:"break-word","& > p:first-of-type":{mt:0},"& > p:last-of-type":{mb:0},"& a[href]":{color:"#2563eb",textDecoration:"underline"},"& img":{maxWidth:"100%"}},dangerouslySetInnerHTML:{__html:c||"<p></p>"}})]})]});return(0,yn.jsx)(EF.FormDialog,{open:l.isOpen,onClose:l.close,width:760,title:I("translate.title"),locale:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-content-translate",maxContentHeight:"80vh",sectionContentPaddingTop:0,sections:[{id:"translate",showTitle:!1,children:m}],actions:{showCancelButton:!1,left:a&&r?(0,yn.jsx)(Un.Button,{variant:"outlined",color:"inherit",startIcon:d?(0,yn.jsx)(ym.default,{sx:{fontSize:18,color:"#2f9e5b"}}):(0,yn.jsx)(vp.default,{sx:{fontSize:18}}),onClick:e.copyResult,sx:{minWidth:80,color:"#37352f",borderColor:"#d9d9d6"},children:I("common.copy")}):void 0,right:(0,yn.jsx)(Un.Button,{variant:"contained",onClick:l.close,sx:{minWidth:80},children:I("common.close")})}})}var uj=require("@ehfuse/mui-confirm-action");var dj=require("@ehfuse/mui-datetime-picker");var MF=require("react"),RF=require("@ehfuse/mui-form-controls");_e();var DF=require("react/jsx-runtime");function xp({value:e,onCommit:u,onDraftChange:c,readOnly:l=!1}){ue();let[n,a]=(0,MF.useState)(null);return(0,DF.jsx)(RF.TextField,{value:n??e,placeholder:l?"":I("create.notePlaceholder"),fullWidth:!0,size:"medium",slotProps:{input:{readOnly:l}},onChange:r=>{a(r.target.value),c?.(r.target.value)},onBlur:()=>{n!==null&&n.trim()!==e&&u(n),a(null)},onKeyDown:r=>{r.key==="Enter"&&r.target.blur(),r.key==="Escape"&&a(null)},sx:{mt:1}})}var Ri=require("@mui/material"),NF=v(require("@mui/icons-material/PieChartOutlineOutlined"),1),LF=v(require("@mui/icons-material/PersonOutlineOutlined"),1),zF=v(require("@mui/icons-material/PeopleAltOutlined"),1),km=require("@ehfuse/mui-form-controls");_e();var Or=require("react/jsx-runtime");function QU(e){return e.getFormValue("contributions")??{}}function JU({form:e,participants:u}){ue();let c=e.useFormValue("contributions")??{},l=Lu(c,u),n=l===100;return(0,Or.jsxs)(Ri.Box,{component:"span","data-testid":"task-contribution-total",sx:{fontSize:14,fontWeight:400,color:n?"#787774":"error.main",whiteSpace:"nowrap"},children:[I("section.total")," ",l,"%",n?"":I("section.mustBe100")]})}function FF({form:e,participants:u,readOnly:c,avatarSrcByName:l,onSave:n}){ue();let a=()=>{let t=QU(e);Lu(t,u)===100&&n(zu(t,u))},r=()=>{let t=Nu(u.length),o={};u.forEach((d,i)=>{o[String(d.account_seq)]=String(t[i])}),e.setFormValue("contributions",o),n(zu(o,u))};return(0,Or.jsx)(ko,{icon:(0,Or.jsx)(NF.default,{sx:{fontSize:18,display:"block"}}),title:I("section.contribution"),titleExtra:u.length>0?(0,Or.jsxs)(Ri.Box,{sx:{ml:"auto",display:"flex",alignItems:"center",gap:1,minWidth:0},children:[(0,Or.jsx)(JU,{form:e,participants:u}),!c&&u.length>1?(0,Or.jsx)(Ri.Button,{size:"small",onClick:r,sx:{fontSize:"0.875rem",flexShrink:0,whiteSpace:"nowrap"},children:I("section.splitEvenly")}):null]}):null,children:u.length===0?(0,Or.jsx)(Ri.Box,{sx:{fontSize:14,color:"#9a9a97",py:.5},children:I("section.contributionHint")}):(0,Or.jsx)(Xi,{name:"contributions",children:(0,Or.jsx)(km.PropertyGrid,{children:u.map(t=>(0,Or.jsx)(Ot,{icon:t.role==="manager"?(0,Or.jsx)(LF.default,{sx:{fontSize:17}}):(0,Or.jsx)(zF.default,{sx:{fontSize:17}}),label:t.role==="manager"?I("col.owner"):I("col.cc"),onClick:c?void 0:o=>o.querySelector("input")?.focus(),children:(0,Or.jsxs)(Ri.Box,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%",minWidth:0},children:[(0,Or.jsx)(to,{names:[t.name],size:20,avatarSrcByName:l}),(0,Or.jsx)(Ri.Box,{component:"span",sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name||I("workload.noName")}),(0,Or.jsxs)(Ri.Box,{sx:{display:"inline-flex",alignItems:"baseline",flexShrink:0},children:[(0,Or.jsx)(km.PropertyInput,{form:e,name:`contributions.${t.account_seq}`,appearance:Ba,inputMode:"numeric",maxLength:3,placeholder:"0",readOnly:c,parse:o=>{let d=Zl(o===""?"0":o);return d===null?null:String(d)},onCommit:()=>a(),sx:{flex:"0 0 auto",width:"3ch",textAlign:"right"}}),(0,Or.jsx)(Ri.Box,{component:"span",sx:{ml:.25},children:"%"})]})]})},t.account_seq))})})})}pn();var Sl=require("react"),Jn=require("@mui/material"),qF=v(require("@mui/icons-material/AccountTreeOutlined"),1),HF=v(require("@mui/icons-material/LinkOutlined"),1),WF=v(require("@mui/icons-material/Close"),1),VF=v(require("@mui/icons-material/RedoOutlined"),1);function Da(e){return e.relations??[]}function e$(e,u,c){return Da(e).some(l=>l.type===c&&l.task_seq===u.seq)||Da(u).some(l=>l.type===c&&l.task_seq===e.seq)}function jF(e){return`${e.created_time??""}|${String(e.seq).padStart(12,"0")}`}function xm(e,u){let c=new Map(u.map(m=>[m.seq,m]));c.set(e.seq,e);let l=new Map,n=(m,b)=>{l.has(m)||l.set(m,new Set),l.has(b)||l.set(b,new Set),l.get(m).add(b),l.get(b).add(m)};for(let m of c.values())for(let b of Da(m))b.type==="follow_up"&&c.has(b.task_seq)&&n(m.seq,b.task_seq);let a=new Set([e.seq]),r=[e.seq];for(;r.length>0;){let m=r.shift();for(let b of l.get(m)??[])a.has(b)||(a.add(b),r.push(b))}let t=[...a].map(m=>c.get(m)).filter(m=>!!m).sort((m,b)=>jF(m).localeCompare(jF(b))),o=new Set;for(let m of Da(e))m.type==="related"&&o.add(m.task_seq);for(let m of c.values())m.seq!==e.seq&&Da(m).some(b=>b.type==="related"&&b.task_seq===e.seq)&&o.add(m.seq);let d=[...o].map(m=>c.get(m)).filter(m=>m!==void 0&&m.seq!==e.seq),i=[...c.values()].filter(m=>m.seq!==e.seq&&Da(m).some(b=>b.type==="duplicate_of"&&b.task_seq===e.seq)),s=Da(e).find(m=>m.type==="duplicate_of")?.task_seq,h=s?c.get(s)??null:null,f=[...c.values()].filter(m=>m.seq!==e.seq&&(m.checklist??[]).some(b=>Number(b.task_seq??0)===e.seq));return{lineage:t,related:d,duplicates:i,duplicateOf:h,parents:f}}function wm(e,u){let c=xm(e,u);return(c.lineage.length>=2?c.lineage.length-1:0)+c.related.length+c.duplicates.length+(c.duplicateOf?1:0)+c.parents.length}function wp(e,u){return wm(e,u)>0}var GF=require("@ehfuse/mui-confirm-action");_e();var Ht=require("react/jsx-runtime");function Tm({item:e,caption:u,onOpen:c,onUnlink:l}){ue();let n=e.is_notice||e.is_event?tn(e.icon||(e.is_notice?tr:kr)):null;return(0,Ht.jsxs)(Jn.Box,{sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.5,borderRadius:1,"&:hover":{bgcolor:"#f7f7f5"},"&:hover .taskbox-relation-unlink":{opacity:1}},children:[u?(0,Ht.jsx)(Jn.Box,{component:"span",sx:{flexShrink:0,px:.6,py:.1,borderRadius:.75,fontSize:11.5,fontWeight:500,color:"#8a6d1d",bgcolor:"#faf1d7"},children:u}):null,n?(0,Ht.jsx)(n,{sx:{fontSize:16,flexShrink:0,color:e.icon_color||"#1e3a8a"}}):null,(0,Ht.jsxs)(Jn.Box,{component:"span",onClick:c,sx:{flex:1,minWidth:0,fontSize:14,color:e.completed?"#9a9a97":"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...c?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}},children:[e.ticket_no?`${e.ticket_no} `:"",e.title]}),e.manager_name?.trim()?(0,Ht.jsx)(Jn.Box,{component:"span",sx:Wc,children:e.manager_name.trim()}):null,(0,Ht.jsx)(Tn,{option:xr(e),small:!0}),l?(0,Ht.jsx)(Jn.IconButton,{className:"taskbox-relation-unlink",size:"small","aria-label":I("section.unlink"),onClick:l,sx:{opacity:0,transition:"opacity 0.15s",color:"#9a9a97"},children:(0,Ht.jsx)(WF.default,{sx:{fontSize:15}})}):null]})}function Tp({task:e,tasks:u,readOnly:c=!1,onOpenTask:l,onLink:n,onUnlink:a,onCreateFollowUp:r}){ue();let t=ml({multiSelect:b=>b!=="duplicate_of",onSubmit:(b,g)=>n?.(e.seq,b,g)}),[o,d]=(0,Sl.useState)(null),i=(0,Sl.useMemo)(()=>xm(e,u),[e,u]),s=i.lineage.length>=2,h=(0,Sl.useMemo)(()=>wm(e,u),[e,u]),f=(0,Sl.useMemo)(()=>{let b=new Set;for(let g of i.lineage)b.add(g.seq);for(let g of i.related)b.add(g.seq);for(let g of i.duplicates)b.add(g.seq);for(let g of i.parents)b.add(g.seq);return i.duplicateOf&&b.add(i.duplicateOf.seq),[...b]},[i]),m=(b,g,w)=>{d({anchorEl:b,targetSeq:g,type:w})};return(0,Ht.jsxs)(ko,{icon:(0,Ht.jsx)(qF.default,{sx:{fontSize:19,display:"block"}}),title:(0,Ht.jsxs)(Ht.Fragment,{children:[I("section.relatedTasks"),h>0?(0,Ht.jsx)(Jn.Box,{component:"span",sx:{fontSize:12.5,color:"#9a9a97"},children:h}):null]}),titleExtra:c?null:(0,Ht.jsxs)(Jn.Box,{sx:{ml:"auto",display:"flex",alignItems:"center",gap:.5},children:[r?(0,Ht.jsx)(Jn.Button,{size:"small",color:"inherit",startIcon:(0,Ht.jsx)(VF.default,{sx:{fontSize:16}}),onClick:()=>r(e.seq),sx:{minWidth:0,px:1,fontSize:12.5,color:"#787774"},children:I("section.followUps")}):null,n?(0,Ht.jsx)(Jn.Button,{size:"small",color:"inherit",startIcon:(0,Ht.jsx)(HF.default,{sx:{fontSize:16}}),onClick:t.openDialog,sx:{minWidth:0,px:1,fontSize:12.5,color:"#787774"},children:I("link.confirm")}):null]}),children:[(0,Ht.jsxs)(Jn.Box,{sx:{display:"flex",flexDirection:"column",mt:.5,pl:3.25},children:[s?(0,Ht.jsx)(Jn.Box,{sx:{mb:i.related.length||i.duplicates.length||i.duplicateOf?1:0},children:i.lineage.map((b,g)=>{let w=b.seq===e.seq,S=g===i.lineage.length-1;return(0,Ht.jsxs)(Jn.Box,{sx:{display:"flex",gap:1},children:[(0,Ht.jsxs)(Jn.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",width:14,flexShrink:0,pt:1.1},children:[(0,Ht.jsx)(Jn.Box,{sx:{width:w?9:7,height:w?9:7,borderRadius:"50%",bgcolor:w?"#2f80ed":b.completed?"#9a9a97":"#c9c8c5",flexShrink:0}}),S?null:(0,Ht.jsx)(Jn.Box,{sx:{width:"2px",flex:1,bgcolor:De.NOTION_LINE_COLOR}})]}),(0,Ht.jsxs)(Jn.Box,{sx:{flex:1,minWidth:0,pb:S?0:.5},children:[(0,Ht.jsxs)(Jn.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[(0,Ht.jsxs)(Jn.Box,{component:"span",onClick:!w&&l?()=>l(b.seq):void 0,sx:{minWidth:0,fontSize:14,fontWeight:w?600:400,color:w?"#2f80ed":b.completed?"#9a9a97":"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...!w&&l?{cursor:"pointer","&:hover":{color:"#2f80ed"}}:{}},children:[b.ticket_no?`${b.ticket_no} `:"",b.title]}),b.manager_name?.trim()?(0,Ht.jsx)(Jn.Box,{component:"span",sx:Wc,children:b.manager_name.trim()}):null,(0,Ht.jsx)(Tn,{option:xr(b),small:!0})]}),(0,Ht.jsx)(Jn.Box,{sx:{fontSize:12,color:"#9a9a97"},children:b.completed&&b.completed_time?I("section.completedAt",{completed_time:b.completed_time}):b.created_time??""})]})]},b.seq)})}):null,i.parents.map(b=>(0,Ht.jsx)(Tm,{item:b,caption:I("section.parentTask"),onOpen:l?()=>l(b.seq):void 0},`parent-${b.seq}`)),i.duplicateOf?(0,Ht.jsx)(Tm,{item:i.duplicateOf,caption:I("section.original"),onOpen:l?()=>l(i.duplicateOf.seq):void 0,onUnlink:!c&&a?b=>m(b.currentTarget,i.duplicateOf.seq,"duplicate_of"):void 0}):null,i.duplicates.map(b=>(0,Ht.jsx)(Tm,{item:b,caption:I("section.duplicate"),onOpen:l?()=>l(b.seq):void 0,onUnlink:!c&&a?g=>m(g.currentTarget,b.seq,"duplicate_of"):void 0},`dup-${b.seq}`)),i.related.map(b=>(0,Ht.jsx)(Tm,{item:b,onOpen:l?()=>l(b.seq):void 0,onUnlink:!c&&a?g=>m(g.currentTarget,b.seq,"related"):void 0},`rel-${b.seq}`)),h===0?(0,Ht.jsx)(Jn.Box,{sx:{px:1.25,py:.75,fontSize:13.5,color:"#9a9a97"},children:I("section.noLinks")}):null]}),n?(0,Ht.jsx)(Hc,{controller:t,task:e,tasks:u,excludeSeqs:f}):null,(0,Ht.jsx)(GF.ConfirmActionPopper,{open:!!o,anchorEl:o?.anchorEl??null,title:I("section.unlinkConfirm"),confirmText:I("task.unmark"),onCancel:()=>d(null),onConfirm:()=>{o&&a?.(e.seq,o.targetSeq,o.type),d(null)}})]})}_e();var se=require("react/jsx-runtime");function Na({label:e=I("menu.empty")}){return ue(),(0,se.jsx)(ut.Box,{component:"span",sx:{color:"#9a9a97"},children:e})}function UF({store:e}){return(0,se.jsx)(se.Fragment,{children:ju(e)})}function t$({store:e}){let u=ju(e);return u==null||u===!1?null:(0,se.jsx)(ut.Box,{sx:[ri(13),Ln(2)],children:u})}function $F({store:e,children:u}){return(0,se.jsx)(se.Fragment,{children:u(ju(e))})}function n$(e){let u=(0,gr.useRef)(e);u.current=e;let c=(0,gr.useRef)(new Map),l={};for(let[n,a]of Object.entries(e)){if(typeof a!="function"){l[n]=a;continue}let r=c.current.get(n);r||(r=(...t)=>u.current[n]?.(...t),c.current.set(n,r)),l[n]=r}return l}function Op(e,u){if(e===u)return!0;if(Array.isArray(e)&&Array.isArray(u))return e.length!==u.length?!1:e.every((c,l)=>c===u[l]||Op(c,u[l]));if(e&&u&&typeof e=="object"&&typeof u=="object"&&Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(u)===Object.prototype)try{return JSON.stringify(e)===JSON.stringify(u)}catch{return!1}return!1}var r$=new Set([...Qa,"reminder","is_read"]);function o$(e,u){if(e===u)return!0;let c=!!(e.is_bug||u.is_bug),l=e,n=u,a=new Set([...Object.keys(l),...Object.keys(n)]);for(let r of a)if(!(r$.has(r)&&!(c&&r==="status"))&&!Op(l[r],n[r]))return!1;return!0}function i$(e,u){let c=e,l=u,n=new Set([...Object.keys(c),...Object.keys(l)]);for(let a of n){let r=c[a],t=l[a];if(a==="task"){if(!o$(r,t))return!1;continue}if(typeof r=="function"||typeof t=="function"){if(typeof r!=typeof t)return!1;continue}if(!Op(r,t))return!1}return!0}function a$({form:e,task:u,locked:c,options:l,onSelect:n}){ue();let[a,r]=(0,gr.useState)(null);return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(Ot,{icon:(0,se.jsx)(nj.default,{sx:{fontSize:17}}),label:I("col.status"),onClick:c?void 0:t=>r(t),children:(0,se.jsx)(jo,{form:e,name:"status",children:t=>(0,se.jsx)(jo,{form:e,name:"resolution",children:o=>(0,se.jsx)(Tn,{option:xr({...u,status:t,resolution:o})})})})}),(0,se.jsx)(rs,{anchorEl:a,value:e.getFormValue("status"),options:l,onSelect:n,onClose:()=>r(null)})]})}function s$({form:e,locked:u,labelOptions:c,onChange:l,onAddLabel:n}){ue();let[a,r]=(0,gr.useState)(null);return(0,se.jsx)(jo,{form:e,name:"label_keys",children:t=>(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(Ot,{icon:(0,se.jsx)(rj.default,{sx:{fontSize:17}}),label:I("dialog.label"),onClick:u?void 0:o=>r(o),children:t.length>0?(0,se.jsx)(Yi,{labelKeys:t,labelOptions:c}):(0,se.jsx)(Na,{})}),(0,se.jsx)($c,{anchorEl:a,selectedKeys:t,labelOptions:c,onToggle:o=>l(cc(t,o)),onAddLabel:n,onClose:()=>r(null)})]})})}function Ap({leadingContent:e,contentTitleExtra:u,propertyExtra:c,relatedTasksPool:l,...n}){let a=Fu(n.task),r=Ql(e),t=Ql(u),o=Ql(c),d=Ql(l),i=(0,gr.useRef)({leading:r,titleExtra:t,propertyExtra:o,pool:d}),s=n$(n);return(0,se.jsx)(Bh.Provider,{value:a,children:(0,se.jsx)(l$,{...s,slots:i.current})})}var l$=(0,gr.memo)(function({slots:u,task:c,customTabs:l,statusOptions:n,avatarSrcByName:a,onChangeStatus:r,onChangeLabels:t,onAddLabelOption:o,onChangeProject:d,onAddProject:i,onChangeDate:s,onChangeReminder:h,onMemberEdit:f,onChangePriority:m,onChangeVisibility:b,onChangeRepeat:g,departments:w=[],onChangeEventTime:S,onChangeEventPlace:O,onChangeEventAddress:P,onChangeNote:j,onChangeNoteDraft:M,onChangeContent:N,contentTemplates:z,onSaveContentTemplate:W,onRemoveContentTemplate:F,contentLoading:C=!1,onAddChecklistItem:B,onToggleChecklistItem:R,onRemoveChecklistItem:p,onUpdateChecklistItem:y,onReorderChecklist:x,onConvertChecklistToTask:k,onOpenChecklistTask:T,onLinkChecklistTask:_,resolveChecklistTask:D,onOpenRelatedTask:H,onLinkRelatedTask:V,onUnlinkRelatedTask:U,onCreateFollowUpTask:L,onAddAttachments:G,onRemoveAttachment:E,onReorderAttachments:A,onPreview:q,onDownload:$,onUpdateComment:Q,onRemoveComment:X,onToggleCommentReaction:Y,currentUserName:te="",myAccountSeq:Z=0,headerless:K=!1,noticeAdmin:J=!1,hideProject:ee=!1,hideProperties:ie=!1,postMode:ae=!1,hideLabel:le=!1,showTitle:ce=!1,displayTitle:ye,onChangeTitle:ke,onToggleCompleted:xe,onChangeIcon:qe,onChangeIconColor:Be,employees:ge=[],onAckConfirm:ze,onRequestConfirm:Le,onChangeBugField:Oe,sprints:Ze=[],sprintProject:Re=!1,hideSprint:Ie=!1,onChangeSprint:kt,onChangeStoryPoints:We,onChangeResolution:st,onClaimTask:Xn,onVerifyBug:et,contributionEnabled:lt=!1,onChangeContributions:Nt}){ue();let{form:Je,getTask:Qe}=Oh(),[Fn,Ke]=(0,gr.useState)(null),[ct,pt]=(0,gr.useState)(!1),pe=(0,gr.useRef)(!1),[oe,Ge]=(0,gr.useState)(null),[Pe,re]=(0,gr.useState)(null),[de,be]=(0,gr.useState)(null),[Se,gt]=(0,gr.useState)(!1),Ae=ae?void 0:{[Ii]:Se?{maxHeight:120,opacity:1,overflow:"hidden",transition:"max-height 0.25s ease, opacity 0.2s ease"}:{minHeight:0,maxHeight:0,opacity:0,overflow:"hidden",pointerEvents:"none",transition:"max-height 0.25s ease, opacity 0.2s ease"}},[Ne,Lt]=(0,gr.useState)(null),[rt,Fe]=(0,gr.useState)(null),[Vt,Bt]=(0,gr.useState)(null),[Mt,Jt]=(0,gr.useState)(null),[xn,jn]=(0,gr.useState)(null),mt=!!c.is_notice,Ct=!!c.is_event,en=!!c.is_bug,ne=!!Xn&&bc(c,Z),{onReturnTask:me,onReviewDone:we,editPolicy:ve,translateContent:Me,contentTranslate:tt}=it(),nt=K&&!!we&&!!me&&Ur(c,Z),[Rt,bt]=(0,gr.useState)(null),ot=!!(Me&&tt),yt=bm({taskSeq:c.seq,translatedTargets:c.translated_targets??[]}),_n=!!Xn&&yc(c,Z),wn=!!et&&en&&!!c.completed&&Z>0&&(c.author_account_seq??0)===Z&&!(c.acks??[]).some(fe=>fe.account_seq===Z),_t=!fi(c,Z),At=ea(c,Z,ve),vr=!ie&&!ae&&!c.is_event&&(c.is_notice?Z>0&&(c.author_account_seq??0)===Z:(c.author_account_seq??0)===Z||(c.manager_account_seq??0)===Z),Pr=c.is_notice||c.is_event?tn(c.icon||(c.is_notice?tr:kr)):null,Mr=mt?!gc(c,Z):_t,Vr=ne||_n?(0,se.jsxs)(go,{onClick:fe=>jn(fe.currentTarget),children:[(0,se.jsx)(sj.default,{sx:{fontSize:16,mr:.5}}),I("col.claim")]}):null,Ko=mt?Kc(c,ge):"",lr=mt?Jf(c,ge,Z):null,Yn=mt?null:pi(c,Z),$t=CF(c.content??""),Yt=_F(c.seq,!!(Yn?.canConfirm&&ze),$t,()=>ze?.(c.seq)),ga=Math.max(1,Math.ceil((1-Yt)*$t/1e3)),cr=!!(Yn&&Yn.total>0||mt&&lr),Qr=(c.origin_license_seq??0)>0,Rr=!mt&&!Qr,Jr=ie||ae,_o=ae&&Ho(c)==="all"&&(c.receiver_names??[]).length===0,ki=(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(Ot,{icon:(0,se.jsx)(oj.default,{sx:{fontSize:17}}),label:I("col.author"),sx:[ri(9),Ae??null,...Ct?[]:[Ln(1)]],children:c.created_by?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(to,{names:[c.created_by],size:20,avatarSrcByName:a}),c.created_by]}):(0,se.jsx)(Na,{})}),(0,se.jsx)(Ot,{icon:(0,se.jsx)(Cp.default,{sx:{fontSize:17}}),label:I("col.createdTime"),sx:[ri(11),Ae??null,...Ct?[]:[Ln(_o?1:2)]],children:c.created_time?po(c.created_time):(0,se.jsx)(Na,{})})]});return(0,se.jsxs)(se.Fragment,{children:[ce?(0,se.jsxs)(ut.Box,{sx:{px:2,pt:2,pb:.5,display:"flex",alignItems:"flex-start",gap:1},children:[vr?(0,se.jsx)(ut.Checkbox,{checked:c.completed,icon:(0,se.jsx)(tj.default,{sx:{fontSize:22,color:"#9a9a97",opacity:.45}}),checkedIcon:(0,se.jsx)(Sm.default,{sx:{fontSize:22,color:"#2f80ed"}}),onChange:(fe,rn)=>{Pe||re({anchorEl:fe.currentTarget,nextCompleted:rn})},sx:{p:0,mt:.25}}):null,Pr?Ct&&!_t?(0,se.jsx)(ut.ButtonBase,{onClick:fe=>Ge(fe.currentTarget),sx:{display:"flex",p:.25,mt:.1,borderRadius:1,color:c.icon_color||"#1e3a8a","&:hover":{bgcolor:"#f2f2f0"}},children:(0,se.jsx)(Pr,{sx:{fontSize:20}})}):(0,se.jsx)(ut.Box,{sx:{display:"flex",p:0,mt:.25,color:c.icon_color||(mt?"#e5484d":"#1e3a8a")},children:(0,se.jsx)(Pr,{sx:{fontSize:20}})}):null,(0,se.jsx)(ut.Box,{sx:{flex:1,minWidth:0},children:Fn!==null?(0,se.jsx)(ut.Box,{component:"div",contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,ref:fe=>{if(!fe||fe.dataset.focused)return;fe.dataset.focused="1",fe.focus();let rn=document.createRange();rn.selectNodeContents(fe),rn.collapse(!1);let ur=window.getSelection();ur?.removeAllRanges(),ur?.addRange(rn)},onBlur:fe=>{let rn=(fe.currentTarget.textContent??"").replace(/\n/g," ").trim();!pe.current&&rn&&rn!==Qe().title&&ke(c.seq,rn),pe.current=!1,Ke(null)},onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),fe.target.blur()),fe.key==="Escape"&&(pe.current=!0,fe.target.blur())},onPaste:fe=>{fe.preventDefault();let rn=fe.clipboardData.getData("text/plain").replace(/\n/g," ");document.execCommand("insertText",!1,rn)},sx:{outline:"none",fontSize:19,fontWeight:600,color:c.completed?"#9a9a97":"#37352f",lineHeight:"26px",cursor:"text",userSelect:"text",wordBreak:"break-word"},children:Fn}):(0,se.jsx)(ut.Box,{onClick:At||ye?void 0:()=>Ke(String(Je.getFormValue("title")??"")),sx:{fontSize:19,fontWeight:600,color:c.completed?"#9a9a97":"#37352f",lineHeight:"26px",cursor:At||ye?"default":"text",userSelect:"text",wordBreak:"break-word"},children:ye||(0,se.jsx)(jo,{form:Je,name:"title",children:fe=>fe})})}),(0,se.jsx)(Bo,{open:!!Pe,anchorEl:Pe?.anchorEl??null,nextCompleted:Pe?.nextCompleted??!1,returnMode:!!me&&Ur(c,Z),onCancel:()=>re(null),onConfirm:fe=>{Pe&&(fe&&me?me(Qe(),fe):xe(c.seq,Pe.nextCompleted)),re(null)}})]}):null,(0,se.jsxs)(ut.Box,{sx:{py:1.5,display:"flex",flexDirection:"column",gap:0,[Ii]:{pb:0,"& > :last-child":{mb:0}}},children:[ie?null:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(zc,{form:Je,hideProject:ee,hideManager:ae,hideReceivers:_o,hideStartDate:ae,hideReminder:ae,hidePriority:ae,pinColumns:!0,projectColumn:!Ct&&!le?2:"full",values:{tabKey:c.tab_key??"",managerName:ae?c.manager_name||c.author_name||"":c.manager_name,receiverNames:c.receiver_names,startDate:c.start_date,dueDate:c.due_date,reminders:Fo(c),priority:c.priority,eventTime:c.event_time??"",eventPlace:c.event_place??"",eventAddress:c.event_address??""},customTabs:l,avatarSrcByName:kc(c,a),hideDueDate:ae||!Ct&&!!c.repeat_rule,notice:mt,event:Ct,readOnly:_t,coreLocked:At,targetSummary:Ko,onChangeProject:fe=>d(c.seq,fe),onAddProject:i,onChangeStartDate:fe=>s(c.seq,"start_date",fe),onChangeDueDate:fe=>s(c.seq,"due_date",fe),onChangeReminder:fe=>h(c.seq,fe),onChangePriority:fe=>m(c.seq,fe),onChangeEventTime:fe=>S?.(c.seq,fe),onChangeEventPlace:fe=>O?.(c.seq,fe),onChangeEventAddress:fe=>P?.(c.seq,fe),onMemberEdit:fe=>f(Qe(),fe,null),narrowCollapsedSx:Ae,reminderLocked:c.completed,managerAction:Vr,supportOrigin:(c.origin_license_seq??0)>0?{licenseName:c.origin_license_name??"",authorName:c.origin_author_name||c.author_name||c.created_by||"",contactPhone:c.origin_contact_phone??"",contactEmail:c.origin_contact_email??"",supportType:_d(c.support_type??"")}:void 0,leading:(0,se.jsxs)(se.Fragment,{children:[!ae&&(wn||Vr&&(mt||Ct))?(0,se.jsxs)(ut.Box,{sx:{gridColumn:"1 / -1",display:"flex",justifyContent:"flex-start",gap:2,px:2,py:1.5},children:[mt||Ct?Vr:null,wn?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(ut.Button,{variant:"contained",size:"large",onClick:()=>et?.(c.seq,!0),sx:{bgcolor:"#2f80ed"},children:I("detail.bugVerified")}),(0,se.jsx)(ut.Button,{variant:"outlined",size:"large",color:"error",onClick:()=>et?.(c.seq,!1),children:I("detail.bugReopen")})]}):null]}):null,en&&c.ticket_no?(0,se.jsx)(Ot,{icon:(0,se.jsx)(ZF.default,{sx:{fontSize:17}}),label:I("col.ticket"),sx:Ln(1),children:(0,se.jsx)(ut.Box,{component:"span",sx:{fontVariantNumeric:"tabular-nums"},children:c.ticket_no})}):null,Ct||ae?null:(0,se.jsx)(ut.Box,{sx:en&&c.ticket_no||Rr||cr?Ln(en&&c.ticket_no?2:1):{gridColumn:"1 / -1"},children:(0,se.jsx)(a$,{form:Je,task:c,locked:_t||!!c.completed,options:mt?Ks:en?ka:Xs,onSelect:fe=>r(c.seq,fe)})}),nt&&!ae?(0,se.jsxs)(Ot,{icon:(0,se.jsx)(QF.default,{sx:{fontSize:17}}),label:I("board.review"),sx:{gridColumn:"1 / -1"},children:[(0,se.jsx)(go,{onClick:fe=>re({anchorEl:fe.currentTarget,nextCompleted:!1}),children:I("task.revert")}),(0,se.jsx)(ut.Button,{size:"small",variant:"contained",disableElevation:!0,onClick:fe=>{fe.stopPropagation(),bt(fe.currentTarget)},sx:{ml:1,...Ci},children:I("col.reviewDone")}),(0,se.jsx)(Ta,{anchorEl:Rt,onCancel:()=>bt(null),onConfirm:()=>{we?.(Qe()),bt(null)}})]}):null,Rr?(()=>{let fe=Ho(c),rn=fe==="all"?(0,se.jsx)(Ip.default,{sx:{fontSize:17,color:"#2f80ed"}}):fe==="group"?(0,se.jsx)(Bp.default,{sx:{fontSize:17,color:"#d9730d"}}):(0,se.jsx)(_p.default,{sx:{fontSize:17}}),ur=fe==="all"?I("create.visibilityPublic"):fe==="group"?I("create.visibilityDept",{value:w.find(Gi=>Gi.seq===(c.visibility_group_seq??0))?.name??I("create.department")}):I("create.visibilityPrivate");return(0,se.jsx)(ut.Box,{sx:Ct?void 0:Ln(en||ae?1:2),children:(0,se.jsx)(Ot,{icon:rn,label:(0,se.jsx)(am,{}),onClick:At||!b?void 0:Gi=>Lt(Gi),children:ur})})})():null,!en&&!Qr&&!ae?(0,se.jsx)(ut.Box,{sx:Ct?void 0:Ln(1),children:(0,se.jsx)(Ot,{icon:(0,se.jsx)(lj.default,{sx:{fontSize:17,...c.repeat_rule?{color:"#2f80ed"}:{}}}),label:I("create.repeat"),onClick:At||!g?void 0:fe=>Fe(fe),children:c.repeat_rule?Jl(c.repeat_rule):(0,se.jsx)(Na,{label:I("common.none")})})}):null,!en&&!ae&&c.repeat_rule?(0,se.jsx)(ut.Box,{sx:Ct?void 0:Ln(2),children:(0,se.jsx)(Ot,{icon:(0,se.jsx)(cj.default,{sx:{fontSize:17}}),label:I("create.repeatUntil"),onClick:At||!g?void 0:fe=>Bt(fe),children:c.repeat_until?I("detail.repeatUntilValue",{repeat_until:c.repeat_until}):(0,se.jsx)(Na,{})})}):null,!ae&&Yn&&Yn.total>0?(0,se.jsx)(ut.Box,{sx:Ct?void 0:Ln(2),children:(0,se.jsx)(Ot,{icon:(0,se.jsx)(Cm.default,{sx:{fontSize:17}}),label:I("task.confirm"),children:Yn.canConfirm?(0,se.jsxs)(ut.Box,{sx:{display:"inline-flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[(0,se.jsx)(ut.Button,{size:"small",variant:"contained",onClick:()=>ze?.(c.seq),sx:{py:.1,px:1.25,minWidth:0,color:"#fff",bgcolor:"#2f80ed",backgroundImage:`linear-gradient(to right, #1a5fc4 ${Yt*100}%, transparent ${Yt*100}%)`,boxShadow:"none","&:hover":{bgcolor:"#1e6fd9",boxShadow:"none"}},children:I("task.confirm")}),(0,se.jsx)(ut.Box,{component:"span",sx:{fontSize:14,color:"text.secondary",whiteSpace:"nowrap"},children:I("detail.autoConfirmIn",{seconds:ga})})]}):(0,se.jsxs)(ut.Button,{size:"small",variant:"outlined",color:"inherit",startIcon:Yn.myTime?(0,se.jsx)(Sm.default,{sx:{fontSize:"16px !important",color:"#2f80ed"}}):null,onClick:fe=>be({anchorEl:fe.currentTarget,open:!0}),sx:{py:.1,px:1.25,minWidth:0,fontSize:13,color:"text.primary",borderColor:"#d5d8dc",bgcolor:"#fff",whiteSpace:"nowrap"},children:[Yn.count," / ",Yn.total]})})}):null,mt&&lr?(0,se.jsx)(ut.Box,{sx:Ln(2),children:(0,se.jsx)(Ot,{icon:(0,se.jsx)(Cm.default,{sx:{fontSize:17}}),label:I("task.confirm"),children:(0,se.jsx)(ut.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,minWidth:0},children:lr.canAck?(0,se.jsx)(ut.Button,{size:"small",variant:"contained",onClick:()=>ze?.(c.seq),sx:{py:.1,px:1.25,minWidth:0,color:"#fff",bgcolor:"#2f80ed",boxShadow:"none","&:hover":{bgcolor:"#1e6fd9",boxShadow:"none"}},children:I("task.confirm")}):(0,se.jsx)(ut.Button,{size:"small",variant:"outlined",color:"inherit",startIcon:lr.acked?(0,se.jsx)(Sm.default,{sx:{fontSize:"16px !important",color:"#2f80ed"}}):null,onClick:fe=>be({anchorEl:fe.currentTarget,open:!0}),sx:{py:.1,px:1.25,minWidth:0,fontSize:13,color:"text.primary",borderColor:"#d5d8dc",bgcolor:"#fff",whiteSpace:"nowrap"},children:lr.total>0&&lr.count>=lr.total?I("common.done"):(0,se.jsxs)(se.Fragment,{children:[lr.count,(0,se.jsx)(ut.Box,{component:"span",sx:{mx:.4},children:"/"}),lr.total]})})})})}):null,Re&&!Ie&&!Ct&&!mt&&!ae?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(Ot,{icon:(0,se.jsx)(JF.default,{sx:{fontSize:17}}),label:I("col.goal"),onClick:At?void 0:fe=>Jt(fe),sx:Ln(1),children:(0,se.jsx)(jo,{form:Je,name:"sprint_seq",children:fe=>fe>0?Ze.find(rn=>rn.seq===fe)?.name??I("detail.deletedSprint"):(0,se.jsx)(Na,{label:I("board.unassigned")})})}),(0,se.jsx)(Ot,{icon:(0,se.jsx)(ej.default,{sx:{fontSize:17}}),label:"\uD3EC\uC778\uD2B8",sx:Ln(2),children:(0,se.jsx)(Xi,{name:"story_points",children:(0,se.jsx)(jo,{form:Je,name:"story_points",children:fe=>(0,se.jsx)(Bi,{value:fe>0?String(fe):"",placeholder:I("create.notEstimated"),readOnly:At,onCommit:rn=>We?.(c.seq,Number(rn.replace(/[^0-9.]/g,""))||0)})})})})]}):null,Ct||le?null:(0,se.jsx)(ut.Box,{sx:[ae?Ln(2):ee?{gridColumn:"1 / -1"}:Ln(1),Ae??null],children:(0,se.jsx)(s$,{form:Je,locked:_t,labelOptions:n,onChange:fe=>t(c.seq,fe),onAddLabel:o})})]}),afterProject:Ct?null:(0,se.jsxs)(se.Fragment,{children:[ki,(0,se.jsx)(t$,{store:u.propertyExtra})]}),trailing:(0,se.jsxs)(se.Fragment,{children:[en?(0,se.jsx)(Fc,{form:Je,values:{repro:c.bug_repro??"",device:c.bug_device??"",where:c.bug_where??"",version:c.bug_version??"",resolution:c.resolution??""},readOnly:At,showResolution:!!c.completed,onChangeRepro:fe=>Oe?.(c.seq,"bug_repro",fe),onChangeDevice:fe=>Oe?.(c.seq,"bug_device",fe),onChangeWhere:fe=>Oe?.(c.seq,"bug_where",fe),onChangeVersion:fe=>Oe?.(c.seq,"bug_version",fe),onChangeResolution:fe=>st?.(c.seq,fe)}):null,Ct?ki:null,c.completed?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(Ot,{icon:(0,se.jsx)(Cm.default,{sx:{fontSize:17}}),label:I("detail.completedBy"),sx:[ri(10),Ae??null,...Ct?[]:[Ln(1)]],children:c.completed_by?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(to,{names:[c.completed_by],size:20,avatarSrcByName:a}),c.completed_by]}):(0,se.jsx)(Na,{})}),(0,se.jsx)(Ot,{icon:(0,se.jsx)(Cp.default,{sx:{fontSize:17}}),label:I("col.completedTime"),sx:[ri(12),Ae??null,...Ct?[]:[Ln(2)]],children:c.completed_time?po(c.completed_time):(0,se.jsx)(Na,{})})]}):null]})}),(0,se.jsxs)(ut.Box,{sx:{display:"none",[Ii]:{display:ae?"none":"block",mt:1.5,mb:0}},children:[(0,se.jsx)(ut.Divider,{sx:{borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)(ut.ButtonBase,{onClick:()=>gt(fe=>!fe),sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:.5,pt:1.25,pb:1.25,fontSize:13.5,bgcolor:"#f4f4f2",color:"#37352f","&:active":{opacity:.6}},children:Se?(0,se.jsxs)(se.Fragment,{children:[I("detail.collapse")," ",(0,se.jsx)(XF.default,{sx:{fontSize:18}})]}):(0,se.jsxs)(se.Fragment,{children:[I("detail.moreInfo")," ",(0,se.jsx)(YF.default,{sx:{fontSize:18}})]})})]})]}),(0,se.jsx)(UF,{store:u.leading}),(0,se.jsxs)(ut.Box,{children:[(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR,[Ii]:{mt:0,mb:1.25}}}),(0,se.jsx)(ko,{icon:(0,se.jsx)(ij.default,{sx:{fontSize:18,display:"block"}}),title:I("common.content"),titleExtra:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(UF,{store:u.titleExtra}),(0,se.jsx)(qc,{content:c.content??"",templates:z??[],onApply:fe=>N?.(c.seq,fe),onSave:W,onRemove:F,readOnly:At||!z}),ct&&!At?(0,se.jsx)(ut.Tooltip,{title:I("section.finishEditingTooltip"),arrow:!0,children:(0,se.jsx)(ut.IconButton,{size:"small","aria-label":I("section.finishEditing"),onMouseDown:fe=>fe.preventDefault(),onClick:()=>pt(!1),sx:{color:"#2f9e5b"},children:(0,se.jsx)(KF.default,{sx:{fontSize:19}})})}):null]}),children:(0,se.jsx)(ut.Box,{sx:{userSelect:"text"},children:C?(0,se.jsx)(ut.Box,{sx:{minHeight:180,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,se.jsx)(pm,{})}):(0,se.jsx)(jc,{syncKey:c.seq,value:c.content??"",readOnly:At,viewFirst:!0,editing:ct,onEditingChange:pt,onTranslate:ot?yt.openDialog:void 0,onChange:fe=>N(c.seq,fe)})})}),c.is_bug||Jr?null:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)(ko,{icon:(0,se.jsx)(aj.default,{sx:{fontSize:18,display:"block"}}),title:I("col.note"),children:(0,se.jsx)(ut.Box,{sx:{userSelect:"text"},children:(0,se.jsx)(Xi,{name:"note",children:(0,se.jsx)(jo,{form:Je,name:"note",children:fe=>(0,se.jsx)(xp,{value:fe,readOnly:Mr,onCommit:rn=>j(c.seq,rn),onDraftChange:M?rn=>M(c.seq,rn):void 0})})})})})]}),lt&&Nt&&!Ct&&!mt&&!Jr?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)(FF,{form:Je,participants:Du(c),readOnly:_t,avatarSrcByName:a,onSave:fe=>Nt(c.seq,fe)})]}):null,Ct||Jr?null:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)($F,{store:u.pool,children:fe=>(0,se.jsx)(Vc,{taskSeq:c.seq,checklist:c.checklist??[],removeLocked:Mr,onAdd:B,onToggle:R,confirmOnToggle:!0,onRemove:p,onUpdate:y,onReorder:x,onConvertToTask:k,onOpenLinkedTask:T,resolveLinkedTask:D,myAccountSeq:Z,linkCandidates:fe,linkBaseTask:c,onLinkExistingTask:_})})]}),(0,se.jsx)($F,{store:u.pool,children:fe=>fe&&!Jr&&!Ct&&!mt&&(!_t||wp(c,fe))?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)(Tp,{task:c,tasks:fe,readOnly:_t,onOpenTask:H,onLink:V,onUnlink:U,onCreateFollowUp:L})]}):null}),(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)(Uc,{taskSeq:c.seq,attachments:c.attachments??[],removeLocked:mt?Mr:At,onAdd:G,onRemove:E,onReorder:A,onPreview:q?(fe,rn)=>q({...fe,taskSeq:c.seq},rn?.map(ur=>({...ur,taskSeq:c.seq}))):void 0,onDownload:$?fe=>$({...fe,taskSeq:c.seq}):void 0})]}),(0,se.jsx)(ut.Divider,{sx:{my:1.5,borderColor:De.NOTION_LINE_COLOR}}),(0,se.jsx)(cp,{taskSeq:c.seq,comments:c.comments??[],currentUserName:te,myAccountSeq:Z,avatarSrcByName:a,onUpdate:Q,onRemove:X,onToggleReaction:Y,onPreview:q?(fe,rn)=>q({...fe,taskSeq:c.seq},rn?.map(ur=>({...ur,taskSeq:c.seq}))):void 0,onDownload:$?fe=>$({...fe,taskSeq:c.seq}):void 0})]}),ot?(0,se.jsx)(jo,{form:Je,name:"title",children:fe=>(0,se.jsx)(kp,{controller:yt,title:fe,html:c.content??""})}):null,(0,se.jsx)(ut.Menu,{transitionDuration:0,anchorEl:rt,open:!!rt,onClose:()=>Fe(null),children:[{value:"",label:I("common.none")},...Vs].map(fe=>(0,se.jsx)(ut.MenuItem,{selected:(c.repeat_rule??"")===fe.value,onClick:()=>{Fe(null),ed(Qe(),fe.value,g)},sx:{fontSize:14,minWidth:140},children:fe.label},fe.value||"none"))}),(0,se.jsx)(dj.DatePicker,{anchorEl:Vt,open:!!Vt,onClose:()=>Bt(null),selectedDate:c.repeat_until?new Date(`${c.repeat_until}T00:00:00`):new Date,onDateChange:fe=>{Bt(null),td(Qe(),fe,g)}}),(0,se.jsx)(ut.Menu,{transitionDuration:0,anchorEl:Ne,open:!!Ne,onClose:()=>Lt(null),children:[{key:"involved",label:I("create.visibilityPrivate"),icon:(0,se.jsx)(_p.default,{sx:{fontSize:17,color:"#57564f"}}),selected:Ho(c)==="involved",onPick:()=>b?.(c.seq,"involved",0)},{key:"all",label:I("create.visibilityPublic"),icon:(0,se.jsx)(Ip.default,{sx:{fontSize:17,color:"#2f80ed"}}),selected:Ho(c)==="all",onPick:()=>b?.(c.seq,"all",0)},...w.map(fe=>({key:`group-${fe.seq}`,label:I("create.visibilityDeptName",{name:fe.name}),icon:(0,se.jsx)(Bp.default,{sx:{fontSize:17,color:"#d9730d"}}),selected:Ho(c)==="group"&&(c.visibility_group_seq??0)===fe.seq,onPick:()=>b?.(c.seq,"group",fe.seq)}))].map(fe=>(0,se.jsxs)(ut.MenuItem,{selected:fe.selected,onClick:()=>{fe.onPick(),Lt(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[fe.icon,fe.label,fe.selected?(0,se.jsx)(Sp.default,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},fe.key))}),(0,se.jsx)(ut.Menu,{transitionDuration:0,anchorEl:Mt,open:!!Mt,onClose:()=>Jt(null),children:[{seq:0,label:I("board.unassigned")},...Ze.filter(fe=>`custom-${fe.group_seq}`===String(Je.getFormValue("tab_key")??"")).map(fe=>({seq:fe.seq,label:Wo(fe)}))].map(fe=>(0,se.jsxs)(ut.MenuItem,{onClick:()=>{kt?.(c.seq,fe.seq),Jt(null)},sx:{fontSize:14,minWidth:170,gap:1},children:[fe.label,Number(Je.getFormValue("sprint_seq")??0)===fe.seq?(0,se.jsx)(Sp.default,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},fe.seq))}),(0,se.jsx)(Bc,{anchorEl:de?.anchorEl??null,open:!!de?.open,acks:c.acks??[],total:lr?.total??Yn?.total??0,pendingNames:lr?.pendingNames??Yn?.pendingNames??[],avatarSrcByName:a,onRequestConfirm:Le&&(lr?lr.count<lr.total:Yn&&Yn.count<Yn.total)?()=>{Le(c.seq),be(fe=>fe?{...fe,open:!1}:null)}:void 0,onClose:()=>be(fe=>fe?{...fe,open:!1}:null)}),(0,se.jsx)(Ji,{anchorEl:oe,value:c.icon??"",color:c.icon_color??"",onSelect:fe=>{qe(c.seq,fe),Ge(null)},onSelectColor:Be?fe=>Be(c.seq,fe):void 0,onClose:()=>Ge(null)}),(0,se.jsx)(uj.ConfirmActionPopper,{open:!!xn,anchorEl:xn,title:ne?I("table.claimTakeOverConfirm"):I("table.claimConfirm"),confirmText:I("col.claim"),onCancel:()=>jn(null),onConfirm:()=>{Xn?.(c.seq),jn(null)}})]})},i$);var yj=require("@ehfuse/mui-confirm-action");_e();var Gt=require("react/jsx-runtime");function c$(){let e=new Date,u=c=>String(c).padStart(2,"0");return`${e.getFullYear()}-${u(e.getMonth()+1)}-${u(e.getDate())} ${u(e.getHours())}:${u(e.getMinutes())}`}function u$({open:e,task:u,onClose:c,onAddComment:l,onSaveFields:n,presentation:a="auto",myAccountSeq:r=0,onToggleCompleted:t,onChangeTitle:o,onChangeIcon:d,onChangeIconColor:i,activityItems:s,activityLoading:h,onLoadActivity:f,onPrint:m,headerExtra:b,titleStart:g,menuExtra:w,onDelete:S,canDelete:O,...P}){ue();let j=Sn(),{form:M,baseTask:N,task:z,hasPendingChanges:W,stagedBodyProps:F,changeTitle:C,changeIcon:B,changeIconColor:R}=nd({open:e,task:u,isMobile:j,bodyProps:P,onSaveFields:n,onChangeTitle:o,onChangeIcon:d,onChangeIconColor:i}),p=xl({taskSeq:z?.seq??0,items:s,loading:h,onLoad:f}),[y,x]=(0,ca.useState)(null),[k,T]=(0,ca.useState)(null),{editPolicy:_,shareText:D}=it(),H=!!S&&(O??(N?!wa(N,r,_,!(r>0&&(N.author_account_seq??0)===r)):!1)),V=(0,ca.useRef)(null);(0,ca.useEffect)(()=>{V.current?.scrollTo({top:0})},[u?.seq]);let U=()=>{let Q=V.current?.getScrollContainer();if(Q){V.current?.scrollTo({top:Q.scrollHeight,behavior:"smooth"});return}let X=document.querySelectorAll(".taskbox-comments");X[X.length-1]?.scrollIntoView({block:"end",behavior:"smooth"})},L=(0,ca.useRef)(!1),G=z?.comments?.length??0;if((0,ca.useEffect)(()=>{L.current&&(L.current=!1,requestAnimationFrame(U))},[G]),!N||!z)return null;let E=z,A=j||a==="dialog",q=(0,Gt.jsx)(Ap,{...F,headerless:A,task:E,myAccountSeq:r,onChangeTitle:C,onToggleCompleted:t,onChangeIcon:B,onChangeIconColor:R,showTitle:j||a==="dialog"}),$=(0,Gt.jsx)(up,{onSubmit:(Q,X)=>{L.current=!0,l(E.seq,Q,X),requestAnimationFrame(U)}},E.seq);return A?(0,Gt.jsxs)(Gt.Fragment,{children:[(0,Gt.jsx)(bj.FormDialog,{open:e,onClose:c,backdropClick:!W,locale:Pt(),collapsibleTitle:!0,fontScale:{enabled:!0,default:1.1,min:.6},title:P.postMode?I("detail.kindPost"):E.is_notice?I("tab.notice"):E.is_event?I("kind.event"):E.is_bug?I("kind.bug"):I("kind.task"),titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1},custom:[...g?[{raw:!0,icon:(0,Gt.jsx)(Gt.Fragment,{children:g(E)})}]:[],...b?[{raw:!0,icon:(0,Gt.jsx)(Gt.Fragment,{children:b(E)})}]:[],...j?[{raw:!0,icon:(0,Gt.jsx)(An.Button,{variant:"contained",size:"small",disableElevation:!0,disabled:!W,onClick:W?()=>{M.submit()}:void 0,sx:{ml:1.5,height:32,minWidth:64,px:1.75,py:0,borderRadius:1,fontSize:14,fontWeight:600,bgcolor:"#2f80ed","&:hover":{bgcolor:"#2f80ed"},"&.Mui-disabled":{bgcolor:"#f2f2f0",color:"#c9c8c5"}},children:I("create.saveButton")})}]:[],{raw:!0,icon:(0,Gt.jsx)(An.IconButton,{size:"small","aria-label":I("common.more"),onClick:Q=>x(Q.currentTarget),children:(0,Gt.jsx)(mj.default,{sx:{color:"#6b7280"}})})}]},fullScreen:j,maxWidth:j?void 0:"md",width:j?void 0:720,mobilePresentation:j?"slide":void 0,tabs:{visible:!1},contentTopPadding:0,contentPaddingX:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,contentBottomPadding:0,scrollPastLastSection:!1,overlayScrollbar:{enabled:!0,contentStyle:{minWidth:0}},actions:{visible:!0,showCancelButton:!1,left:$},sx:{DialogContent:{borderBottom:"none"}},dialogActionSx:{padding:"0 !important","@media (max-width:1023.95px)":{padding:"0 !important"},borderTop:"1px solid #37352f","& .left-actions":{flex:1,width:"100%",minWidth:0,"& > *":{flex:1,minWidth:0}},"& .right-actions":{display:"none"}},sections:[{id:"task-detail",title:"",showTitle:!1,children:(0,Gt.jsx)(An.Box,{sx:{userSelect:"none",width:"100%",minWidth:0,display:"flex",flexDirection:"column",gap:0},children:q})}]},N.seq),(0,Gt.jsxs)(An.Menu,{open:!!y,anchorEl:y,onClose:()=>x(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{zIndex:1500},children:[f?(0,Gt.jsxs)(An.MenuItem,{onClick:()=>{x(null),p.openDialog()},children:[(0,Gt.jsx)(An.ListItemIcon,{children:(0,Gt.jsx)(pj.default,{fontSize:"small"})}),(0,Gt.jsx)(An.ListItemText,{children:I("activity.title")})]}):null,(0,Gt.jsxs)(An.MenuItem,{onClick:()=>{x(null),Ma(E,!0,D)},children:[(0,Gt.jsx)(An.ListItemIcon,{children:(0,Gt.jsx)(fj.default,{fontSize:"small"})}),(0,Gt.jsx)(An.ListItemText,{children:I("detail.share")})]}),H?(0,Gt.jsxs)(An.MenuItem,{onClick:Q=>{let X=y??Q.currentTarget;x(null),T(X)},sx:{color:"#e5484d"},children:[(0,Gt.jsx)(An.ListItemIcon,{children:(0,Gt.jsx)(hj.default,{fontSize:"small",sx:{color:"#e5484d"}})}),(0,Gt.jsx)(An.ListItemText,{children:I("common.delete")})]}):null]}),(0,Gt.jsx)(yj.ConfirmActionPopper,{open:!!k,anchorEl:k,title:I("detail.trashConfirm"),confirmText:I("common.delete"),onCancel:()=>T(null),onConfirm:()=>{T(null),S?.(E)}}),(0,Gt.jsx)(Jc,{controller:p})]}):(0,Gt.jsx)(An.Drawer,{anchor:"right",open:e,onClose:c,"aria-label":I("detail.taskDetail"),disableAutoFocus:!0,disableEnforceFocus:!0,sx:{zIndex:Q=>Q.zIndex.modal},slotProps:{paper:{sx:{width:720,maxWidth:"100vw"}}},children:(0,Gt.jsxs)(An.Box,{sx:{display:"flex",flexDirection:"column",height:"100%",userSelect:"none"},children:[(0,Gt.jsx)(gp,{task:E,myAccountSeq:r,onToggleCompleted:t,hideCompleted:!!(P.hideProperties||P.postMode),kindLabel:P.postMode?I("detail.kindPost"):void 0,displayTitle:P.displayTitle,onChangeTitle:o,onChangeIcon:d,onChangeIconColor:i,onClose:c,activityItems:s,activityLoading:h,onLoadActivity:f,onPrint:m,onDelete:S,canDelete:O,headerExtra:b,titleStart:g,menuExtra:w}),(0,Gt.jsx)(An.Divider,{sx:{borderColor:De.NOTION_LINE_COLOR}}),(0,Gt.jsx)(An.Box,{sx:{flex:1,minHeight:0},children:(0,Gt.jsx)(gj.default,{ref:V,style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:q})}),(0,Gt.jsx)(An.Divider,{sx:{borderColor:"#37352f"}}),(0,Gt.jsx)(An.Box,{sx:{flexShrink:0},children:$})]})})}var ir=require("@mui/material"),Mp=require("@ehfuse/mui-form-dialog"),Bj=v(require("@mui/icons-material/Add"),1),Oj=v(require("@mui/icons-material/DirectionsRunOutlined"),1),Aj=v(require("@mui/icons-material/EditOutlined"),1),ua=require("@ehfuse/mui-form-controls");pn();var br=require("@mui/material"),xj=require("@ehfuse/mui-form-dialog"),wj=require("@ehfuse/mui-form-controls"),Tj=v(require("@ehfuse/overlay-scrollbar"),1);var vj=require("@ehfuse/forma");function kj({open:e,sprint:u,remainingTasks:c,sprints:l,onClose:n,onConfirm:a}){let r=l.filter(i=>i.seq!==u?.seq&&i.group_seq===(u?.group_seq??0)&&i.status!=="closed"),t=c.length>0,o=(0,vj.useGlobalForm)({formId:Dt("taskbox-sprint-close-form"),initialValues:{mode:"backlog",moveToSeq:"0"},onValidate:i=>!(t&&i.mode==="move"&&!(Number(i.moveToSeq)>0)),onSubmit:i=>(a({mode:t?i.mode:"keep",moveToSprintSeq:i.mode==="move"&&Number(i.moveToSeq)||0,taskSeqs:c.map(s=>s.seq)}),!0)}),d={form:$r({modalIdPrefix:"taskbox-sprint-close-dialog",open:e,onClose:n,onOpen:()=>o.setFormValues({mode:r.length>0?"move":"backlog",moveToSeq:String(r[0]?.seq??0)})})};return{form:o,modals:d,candidates:r,hasRemaining:t}}_e();var zn=require("react/jsx-runtime");function Ep({open:e,sprint:u,remainingTasks:c,sprints:l,onClose:n,onConfirm:a}){ue();let{form:r,modals:t,candidates:o,hasRemaining:d}=kj({open:e,sprint:u,remainingTasks:c,sprints:l,onClose:n,onConfirm:a}),i=r.useFormValue("mode")??"backlog",s=Number(r.useFormValue("moveToSeq"))||0;return(0,zn.jsx)(xj.FormDialog,{open:t.form.isOpen,onClose:t.form.close,maxWidth:"sm",title:I("sprint.closeTitle"),locale:Pt(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-close",tabs:{visible:!1},actions:{showCancelButton:!0,right:(0,zn.jsx)(br.Button,{variant:"contained",onClick:()=>{r.submit()},disabled:d&&i==="move"&&!(s>0),children:I("sprint.closeButton")})},sections:[{id:"sprint-close",title:"",showTitle:!1,children:(0,zn.jsxs)(br.Box,{sx:{display:"flex",flexDirection:"column",gap:2},children:[(0,zn.jsx)(br.Box,{sx:{fontSize:18,color:"#37352f"},children:qn("sprint.closeIntro",{name:(0,zn.jsx)(br.Box,{component:"span",sx:{fontWeight:600},children:u?.name??""})})}),d?(0,zn.jsxs)(zn.Fragment,{children:[(0,zn.jsx)(br.Box,{sx:{fontSize:15,color:"#6f6f6c"},children:I("sprint.remainingQuestion",{count:c.length})}),(0,zn.jsx)(br.Box,{sx:{border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,overflow:"hidden"},children:(0,zn.jsx)(Tj.default,{style:{maxHeight:220},thumb:{width:6},children:c.map(h=>(0,zn.jsxs)(br.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,borderBottom:"1px solid #f2f2f0","&:last-of-type":{borderBottom:"none"}},children:[(0,zn.jsx)(br.Box,{sx:{flex:1,minWidth:0,fontSize:16,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.title}),(0,zn.jsx)(Tn,{option:xr(h)})]},h.seq))})}),(0,zn.jsxs)(br.RadioGroup,{value:i,onChange:(h,f)=>r.setFormValue("mode",f),children:[o.length>0?(0,zn.jsx)(br.FormControlLabel,{value:"move",control:(0,zn.jsx)(br.Radio,{size:"small"}),label:I("sprint.carryOver"),sx:{"& .MuiFormControlLabel-label":{fontSize:16}}}):null,i==="move"&&o.length>0?(0,zn.jsx)(br.Box,{sx:{pl:4,pb:1},children:(0,zn.jsx)(wj.LabelSelect,{form:r,name:"moveToSeq",size:"small",label:"",fullWidth:!0,options:o.map(h=>({value:String(h.seq),label:h.name}))})}):null,(0,zn.jsx)(br.FormControlLabel,{value:"backlog",control:(0,zn.jsx)(br.Radio,{size:"small"}),label:I("sprint.moveToBacklog"),sx:{"& .MuiFormControlLabel-label":{fontSize:16}}}),(0,zn.jsx)(br.FormControlLabel,{value:"keep",control:(0,zn.jsx)(br.Radio,{size:"small"}),label:I("sprint.keepInGoal"),sx:{"& .MuiFormControlLabel-label":{fontSize:16}}})]})]}):(0,zn.jsx)(br.Box,{sx:{fontSize:15,color:"#6f6f6c"},children:I("sprint.noRemaining")})]})}]})}var _m="custom-";function Sj(e){return e.startsWith(_m)}function d$(e){return e>0?`${_m}${e}`:""}function si(e){if(!Sj(e))return 0;let u=Number(e.slice(_m.length));return Number.isInteger(u)&&u>0?u:0}var Cj=require("react"),Bm=require("@ehfuse/forma"),Pp=require("@ehfuse/alerts");_e();var Im={editingSeq:0,name:"",goal:"",start_date:"",end_date:""};function _j({open:e,customTabs:u,onClose:c,onCreate:l,onUpdate:n,onChangeStatus:a,tasks:r=[],onCloseSprint:t,onRemove:o}){ue();let d=u.filter(O=>O.useSprints&&!O.archived),[i,s]=(0,Cj.useState)(null),h=i?r.filter(O=>(O.sprint_seq??0)===i.seq&&!O.completed):[],f=(0,Bm.useGlobalForm)({formId:Dt("taskbox-sprint-form"),initialValues:{groupKey:"",...Im},onValidate:O=>si(O.groupKey)?String(O.name??"").trim()?!0:((0,Pp.ErrorAlert)(I("sprint.enterGoalName")),!1):((0,Pp.ErrorAlert)(I("sprint.selectProject")),!1),onSubmit:async O=>{let P={name:String(O.name).trim(),goal:String(O.goal??"").trim(),start_date:O.start_date??"",end_date:O.end_date??""};if(O.editingSeq>0)return n(O.editingSeq,P),m.form.close(),!0;let j=await l({group_seq:si(O.groupKey),...P});return j&&m.form.close(),j}}),m={manage:$r({modalIdPrefix:"taskbox-sprint-manage-dialog",open:e,onClose:c,onOpen:()=>f.setFormValues({groupKey:d.length===1?d[0].key:"",...Im})}),form:(0,Bm.useModal)({modalId:Dt("taskbox-sprint-form-dialog"),onClose:()=>f.setFormValues(Im)})};return{form:f,modals:m,sprintTabs:d,closingSprint:i,remainingTasks:h,openCreateForm:()=>{f.setFormValues(Im),m.form.open()},openEditForm:O=>{f.setFormValues({editingSeq:O.seq,groupKey:`custom-${O.group_seq}`,name:O.name,goal:O.goal,start_date:O.start_date,end_date:O.end_date}),m.form.open()},changeStatus:(O,P)=>{if(P==="closed"&&t){s(O);return}a(O.seq,P)},cancelCloseSprint:()=>s(null),confirmCloseSprint:O=>{i&&t?.(i.seq,O),s(null)},removeSprint:o}}_e();var Wt=require("react/jsx-runtime"),m$=[{value:"planning",get label(){return I("status.planning")}},{value:"active",get label(){return I("status.active")}},{value:"closed",get label(){return I("status.closed")}}];function Ij(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?e.slice(5).replace("-","."):"-"}function h$({open:e,customTabs:u,sprints:c,onClose:l,onCreate:n,onUpdate:a,onChangeStatus:r,tasks:t=[],onCloseSprint:o,onRemove:d}){ue();let i=_j({open:e,customTabs:u,onClose:l,onCreate:n,onUpdate:a,onChangeStatus:r,tasks:t,onCloseSprint:o,onRemove:d}),{form:s,modals:h,sprintTabs:f,closingSprint:m,remainingTasks:b}=i,g=Number(s.useFormValue("editingSeq"))||0,w=s.isSubmitting,S=new Map(u.map(P=>[si(P.key),P.label])),O=(0,Wt.jsx)(ir.Box,{children:f.length===0?(0,Wt.jsx)(ir.Box,{sx:{py:2,fontSize:14,color:"#787774"},children:I("sprint.noSprintProjects")}):(0,Wt.jsx)(Wt.Fragment,{children:(0,Wt.jsx)(ir.Box,{children:c.length===0?(0,Wt.jsxs)(ir.Box,{sx:{py:4,display:"flex",flexDirection:"column",alignItems:"center",gap:2,color:"#9a9a97"},children:[(0,Wt.jsx)(Oj.default,{sx:{fontSize:48,color:"#d9d9d6"}}),(0,Wt.jsx)(ir.Box,{sx:{fontSize:13.5},children:I("sprint.noGoals")})]}):c.map(P=>(0,Wt.jsxs)(ir.Box,{sx:{display:"flex",flexDirection:"column",gap:1,"&:not(:last-of-type)::after":{content:'""',display:"block",my:1.75,borderBottom:"1px solid #f0efed"}},children:[(0,Wt.jsxs)(ir.Box,{sx:{minWidth:0},children:[(0,Wt.jsxs)(ir.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[(0,Wt.jsx)(ir.Box,{component:"span",sx:{fontSize:18,fontWeight:600,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:P.name}),(0,Wt.jsx)(ir.Box,{component:"span",sx:{flexShrink:0,px:1,py:.25,borderRadius:.75,bgcolor:"#f1f5f9",color:"#64748b",fontSize:13,fontWeight:500},children:S.get(P.group_seq)??I("sprint.deletedProject")}),(0,Wt.jsxs)(ir.Box,{component:"span",sx:{flexShrink:0,fontSize:14,color:"#57564f"},children:[Ij(P.start_date)," ~"," ",Ij(P.end_date)]})]}),P.goal?(0,Wt.jsx)(ir.Box,{sx:{mt:.5,fontSize:14,color:"#787774",lineHeight:1.5},children:P.goal}):null]}),(0,Wt.jsxs)(ir.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,Wt.jsx)(ua.LabelSelect,{label:I("col.status"),showLabel:!1,size:"small",value:P.status,options:m$.map(j=>({value:j.value,label:j.label})),onChange:j=>i.changeStatus(P,String(j.target.value)),sx:{width:104,flexShrink:0}}),(0,Wt.jsx)(ir.IconButton,{"aria-label":I("board.editGoal"),onClick:()=>i.openEditForm(P),sx:{color:"#9a9a97","&:hover":{color:"#2563eb"}},children:(0,Wt.jsx)(Aj.default,{sx:{fontSize:18}})}),(0,Wt.jsx)(ir.IconButton,{"aria-label":I("board.deleteGoal"),onClick:()=>i.removeSprint(P.seq),sx:{color:"#9a9a97","&:hover":{color:"#e5484d"}},children:(0,Wt.jsx)(Dr,{style:{width:16,height:16}})})]})]},P.seq))})})});return(0,Wt.jsxs)(Wt.Fragment,{children:[(0,Wt.jsx)(Mp.FormDialog,{open:h.manage.isOpen,onClose:h.manage.close,maxWidth:"sm",title:I("sprint.manageTitle"),locale:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-manage",sections:[{id:"sprint-manage",showTitle:!1,children:O}],sectionContentPaddingTop:0,actions:{showCancelButton:!0,left:f.length>0?(0,Wt.jsx)(ir.Button,{startIcon:(0,Wt.jsx)(Bj.default,{}),onClick:i.openCreateForm,sx:{color:"#2563eb"},children:I("sprint.newGoal")}):void 0,right:(0,Wt.jsx)(ir.Button,{variant:"contained",onClick:h.manage.close,children:I("common.confirm")})}}),(0,Wt.jsx)(Ep,{open:m!==null,sprint:m,remainingTasks:b,sprints:c,onClose:i.cancelCloseSprint,onConfirm:i.confirmCloseSprint}),(0,Wt.jsx)(Mp.FormDialog,{open:h.form.isOpen,onClose:h.form.close,maxWidth:"sm",title:g>0?I("board.editGoal"):I("sprint.newGoal"),locale:Pt(),backdropClick:!1,tabs:{visible:!1},titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-form",sections:[{id:"sprint-form",title:"",showTitle:!1,children:(0,Wt.jsx)(ir.Box,{sx:{pt:1},children:(0,Wt.jsxs)(ir.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:2.5,mt:1},children:[(0,Wt.jsx)(ua.LabelSelect,{form:s,name:"groupKey",label:I("col.project"),size:"medium",options:f.map(P=>({value:P.key,label:P.label})),disabled:g>0}),(0,Wt.jsx)(ua.ClearTextField,{form:s,name:"name",label:I("sprint.goalName"),size:"medium",placeholder:I("sprint.goalNamePlaceholder")}),(0,Wt.jsx)(ua.DateTextField,{form:s,name:"start_date",size:"medium",label:I("calendar.startDate")}),(0,Wt.jsx)(ua.DateTextField,{form:s,name:"end_date",size:"medium",label:I("calendar.endDate")}),(0,Wt.jsx)(ua.ClearTextField,{form:s,name:"goal",label:I("googleEvent.description"),size:"medium",placeholder:I("sprint.optional"),sx:{gridColumn:"1 / -1"}})]})})}],actions:{showCancelButton:!0,right:(0,Wt.jsx)(ir.Button,{variant:"contained",onClick:()=>{s.submit()},disabled:w,children:g>0?I("common.edit"):I("sprint.createGoal")})}})]})}pn();var sn=require("@mui/material"),Dj=require("@ehfuse/mui-form-dialog"),Nj=v(require("@mui/icons-material/LinkOutlined"),1),Lj=v(require("@mui/icons-material/LinkOffOutlined"),1),zj=v(require("@mui/icons-material/SyncOutlined"),1),Fj=v(require("@mui/icons-material/ArrowForward"),1);var Pj=require("react");var Di=require("react"),Ej=require("@ehfuse/forma"),Om=[];function f$(){let e=Om;if(Om=[],e.length!==0){if(e.length===1){e[0].close();return}for(let u of e)window.dispatchEvent(new CustomEvent(`modal:close:${u.modalId}`));window.addEventListener("popstate",u=>u.stopImmediatePropagation(),{capture:!0,once:!0}),window.history.go(-e.length)}}function li({modalId:e,open:u,onClose:c,onOpen:l}){let n=(0,Di.useRef)(l);n.current=l;let a=(0,Di.useRef)(c);a.current=c;let r=(0,Di.useRef)(u);r.current=u;let t=(0,Di.useRef)(!1),o=(0,Ej.useModal)({modalId:e,onClose:()=>{t.current=!1,r.current&&a.current()}}),d=(0,Di.useRef)(o);d.current=o;let i=(0,Di.useCallback)(()=>{t.current||!d.current.isOpen||(t.current=!0,d.current.close())},[]);return(0,Di.useEffect)(()=>{if(u){n.current?.(),d.current.open();return}!d.current.isOpen||t.current||(t.current=!0,Om.push({modalId:d.current.modalId,close:()=>d.current.close()}),Om.length===1&&queueMicrotask(f$))},[u]),{...o,close:i}}function Mj(e){let u=(0,Pj.useRef)(e);u.current=e;let c={link:li({modalId:Dt("taskbox-calendar-link"),open:e.open,onClose:()=>u.current.onClose()})},{status:l}=e.googleApi,{calendarName:n}=it(),a=l.linked&&l.calendar_name||n||"\uC5C5\uBB34\uD568",r={connect:()=>u.current.googleApi.onConnect(),disconnect:()=>u.current.googleApi.onDisconnect(),toggleExport:t=>u.current.googleApi.onToggleExport(t),toggleImport:t=>u.current.googleApi.onToggleImport(t),resync:()=>u.current.googleApi.onResync?.()};return{modals:c,status:l,busy:!!e.googleApi.busy,canResync:!!e.googleApi.onResync,calendarName:a,actions:r}}_e();var Tt=require("react/jsx-runtime");function Rj({from:e,to:u}){return(0,Tt.jsxs)(sn.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[e,(0,Tt.jsx)(Fj.default,{sx:{fontSize:16,color:"#787774"}}),u]})}function p$({size:e=28}){return(0,Tt.jsxs)(sn.Box,{component:"svg",viewBox:"0 0 48 48","aria-hidden":!0,sx:{width:e,height:e,flexShrink:0,mx:1},children:[(0,Tt.jsx)("path",{fill:"#EA4335",d:"M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"}),(0,Tt.jsx)("path",{fill:"#4285F4",d:"M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"}),(0,Tt.jsx)("path",{fill:"#FBBC05",d:"M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"}),(0,Tt.jsx)("path",{fill:"#34A853",d:"M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"})]})}function g$(e){ue();let u=Mj(e),{status:c,busy:l,calendarName:n,actions:a}=u,r=u.modals.link,t=(0,Tt.jsxs)(sn.Box,{sx:{display:"flex",flexDirection:"column",gap:"24px"},children:[(0,Tt.jsxs)(sn.Box,{sx:{bgcolor:"#f2f6fa",borderRadius:1,px:1.5,py:1.25,fontSize:15,lineHeight:1.8,color:"#37352f",display:"flex",flexDirection:"column",gap:.25,"& > div":{display:"flex",gap:1},"& > div::before":{content:'"\u2022"',flexShrink:0}},children:[(0,Tt.jsx)(sn.Box,{children:(0,Tt.jsx)(sn.Box,{component:"span",children:qn("calendarLink.exportDesc",{exportWord:(0,Tt.jsx)("b",{children:I("calendarLink.export")}),calendar:(0,Tt.jsxs)("b",{children:['"',n,'"']})})})}),(0,Tt.jsx)(sn.Box,{children:(0,Tt.jsx)(sn.Box,{component:"span",children:qn("calendarLink.importDesc",{importWord:(0,Tt.jsx)("b",{children:I("calendarLink.import")})})})}),(0,Tt.jsx)(sn.Box,{children:(0,Tt.jsx)(sn.Box,{component:"span",children:I("calendarLink.editInTaskbox",{calendarName:n})})})]}),c.configured?(0,Tt.jsxs)(sn.Box,{sx:{border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,pl:2,pr:3,py:1.75,display:"flex",flexDirection:"column",gap:1.25},children:[(0,Tt.jsxs)(sn.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,Tt.jsx)(p$,{}),(0,Tt.jsxs)(sn.Box,{sx:{flex:1,minWidth:0},children:[(0,Tt.jsx)(sn.Box,{sx:{fontSize:18,color:"#111",fontWeight:700},children:I("calendarLink.connectGoogle")}),(0,Tt.jsx)(sn.Box,{sx:{fontSize:15,color:"#111",mt:.5,lineHeight:1.6},children:c.linked?(0,Tt.jsxs)(Tt.Fragment,{children:[(0,Tt.jsx)(sn.Box,{component:"span",sx:{display:"block",fontWeight:600},children:I("calendarLink.connectedTo",{email:c.google_email||I("calendarLink.googleAccount")})}),(0,Tt.jsx)(sn.Box,{component:"span",sx:{display:"block"},children:I("calendarLink.calendarCreated",{calendarName:n})})]}):I("calendarLink.connectHint",{calendarName:n})}),c.last_error?(0,Tt.jsx)(sn.Box,{sx:{fontSize:13,color:"#c62828",mt:.5},children:I("calendarLink.lastError",{error:c.last_error})}):null]}),c.linked?(0,Tt.jsx)(sn.Button,{size:"small",variant:"outlined",color:"inherit",disabled:l,startIcon:(0,Tt.jsx)(Lj.default,{sx:{fontSize:18}}),onClick:a.disconnect,sx:{flexShrink:0,whiteSpace:"nowrap",ml:2},children:I("calendarLink.disconnect")}):(0,Tt.jsx)(sn.Button,{size:"small",variant:"contained",disableElevation:!0,disabled:l,startIcon:(0,Tt.jsx)(Nj.default,{sx:{fontSize:18}}),onClick:a.connect,sx:{flexShrink:0,whiteSpace:"nowrap",bgcolor:"#2563eb",ml:2},children:I("calendarLink.connect")})]}),c.linked?(0,Tt.jsxs)(sn.Box,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap",pl:4.5},children:[(0,Tt.jsx)(sn.FormControlLabel,{control:(0,Tt.jsx)(sn.Switch,{size:"small",checked:c.export_enabled,disabled:l,onChange:(o,d)=>a.toggleExport(d)}),label:(0,Tt.jsx)(sn.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:qn("calendarLink.withDirection",{direction:(0,Tt.jsx)(Rj,{from:I("calendarLink.taskbox"),to:I("calendarLink.google")})},{label:I("calendarLink.export")})}),sx:{m:0,"& .MuiFormControlLabel-label":{fontSize:14,color:"#37352f"}}}),(0,Tt.jsx)(sn.FormControlLabel,{control:(0,Tt.jsx)(sn.Switch,{size:"small",checked:c.import_enabled,disabled:l,onChange:(o,d)=>a.toggleImport(d)}),label:(0,Tt.jsx)(sn.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:qn("calendarLink.withDirection",{direction:(0,Tt.jsx)(Rj,{from:I("calendarLink.google"),to:I("calendarLink.taskbox")})},{label:I("calendarLink.import")})}),sx:{m:0,"& .MuiFormControlLabel-label":{fontSize:14,color:"#37352f"}}}),u.canResync?(0,Tt.jsx)(sn.Button,{size:"small",color:"inherit",disabled:l||!c.export_enabled,startIcon:(0,Tt.jsx)(zj.default,{sx:{fontSize:18}}),onClick:a.resync,sx:{ml:"auto",whiteSpace:"nowrap"},children:I("calendarLink.reexportAll")}):null]}):null]}):(0,Tt.jsx)(sn.Box,{sx:{fontSize:14,color:"#8a6d1d",lineHeight:1.7},children:I("calendarLink.notConfigured")})]});return(0,Tt.jsx)(Dj.FormDialog,{open:r.isOpen,onClose:r.close,width:680,title:I("calendarLink.title"),locale:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-calendar-link",sectionContentPaddingTop:0,sections:[{id:"calendar-link",showTitle:!1,children:t}],actions:{showCancelButton:!1,right:(0,Tt.jsx)(sn.Button,{variant:"contained",onClick:r.close,sx:{minWidth:80},children:I("common.close")})}})}var Uj=require("@ehfuse/mui-form-controls"),eu=require("react"),$j=v(require("@mui/icons-material/OpenInNewOutlined"),1),zr=require("@mui/material"),Kj=require("@ehfuse/mui-form-dialog"),Em=require("@ehfuse/mui-form-controls"),Cl=require("@ehfuse/mui-datetime-picker"),Np=v(require("@mui/icons-material/CalendarMonthOutlined"),1),Lp=v(require("@mui/icons-material/AccessTimeOutlined"),1);var Ts=require("react"),qj=require("@ehfuse/forma"),Rp=require("@ehfuse/alerts");_e();var b$={title:"",allDay:!0,startDate:"",endDate:"",startTime:"09:00",endTime:"10:00",location:"",description:""};function jj(e,u){let[c,l]=e.split(":").map(Number),n=((c*60+l+u)%1440+1440)%1440,a=r=>String(r).padStart(2,"0");return`${a(Math.floor(n/60))}:${a(n%60)}`}function Hj(e){ue();let u=(0,Ts.useRef)(e);u.current=e;let c=(0,Ts.useRef)(null);e.event&&(c.current=e.event);let l=e.event??c.current,n=l?.editable===!1,a=(0,Ts.useRef)(n);a.current=n;let r=(0,Ts.useRef)(!!e.onDelete);e.open&&(r.current=!!e.onDelete);let t=(0,qj.useGlobalForm)({formId:Dt("taskbox-google-event-form"),initialValues:b$,onValidate:i=>u.current.busy||a.current?!1:i.title.trim()?i.startDate?!0:((0,Rp.ErrorAlert)(I("googleEvent.selectStartDate")),!1):((0,Rp.ErrorAlert)(I("googleEvent.enterTitle")),!1),onSubmit:i=>{let s=i.endDate&&i.endDate>=i.startDate?i.endDate:i.startDate;return u.current.onSave({title:i.title.trim(),start_date:i.startDate,end_date:s,time:i.allDay?"":i.startTime,end_time:i.allDay?"":i.endTime,location:i.location.trim(),description:i.description.trim()}),!0}}),o={event:li({modalId:Dt("taskbox-google-event"),open:e.open,onClose:()=>u.current.onClose()})};(0,Ts.useEffect)(()=>{let i=e.event;if(!e.open||!i)return;let s=!!i.time;t.setFormValues({title:i.title==="(\uC81C\uBAA9 \uC5C6\uC74C)"?"":i.title,allDay:!s,startDate:i.start_date,endDate:i.end_date||i.start_date,startTime:s?i.time:"09:00",endTime:s?i.end_time||jj(i.time,60):"10:00",location:i.location??"",description:i.description??""})},[e.open,e.event]);let d={changeStartDate:i=>{let s=String(t.getFormValue("endDate")??"");t.setFormValue("startDate",i),(!s||s<i)&&t.setFormValue("endDate",i)},changeEndDate:i=>t.setFormValue("endDate",i),changeStartTime:i=>{let s=t.getFormValues();t.setFormValue("startTime",i),s.startDate===s.endDate&&s.endTime<=i&&t.setFormValue("endTime",jj(i,60))},changeEndTime:i=>t.setFormValue("endTime",i),changeAllDay:i=>t.setFormValue("allDay",i),remove:()=>u.current.onDelete?.()};return{form:t,modals:o,event:l,readOnly:n,busy:!!e.busy,canDelete:r.current,actions:d}}_e();var dn=require("react/jsx-runtime");function Wj(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return e||I("googleEvent.pickDate");let[u,c,l]=e.split("-").map(Number),n=Ui(new Date(u,c-1,l).getDay());return`${u}.${String(c).padStart(2,"0")}.${String(l).padStart(2,"0")} (${n})`}function Dp(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?new Date(`${e}T00:00:00`):new Date}function Vj(e){let u=c=>String(c).padStart(2,"0");return`${e.getFullYear()}-${u(e.getMonth()+1)}-${u(e.getDate())}`}function Gj(e){let u=/^(\d{2}):(\d{2})$/.exec(e);return u?{hour:u[1],minute:u[2]}:{hour:"09",minute:"00"}}function y$(e){switch(e){case"fromGmail":return I("googleEvent.typeFromGmail");case"birthday":return I("googleEvent.typeBirthday");case"outOfOffice":return I("googleEvent.typeOutOfOffice");case"focusTime":return I("googleEvent.typeFocusTime");case"workingLocation":return I("googleEvent.typeWorkingLocation");default:return I("googleEvent.typeThis")}}function v$(e){let[u,c,l]=e.split("-").map(Number);window.open(`https://calendar.google.com/calendar/r/day/${u}/${c}/${l}`,"_blank")}function Am({icon:e,label:u,placeholder:c,disabled:l,onClick:n}){return(0,dn.jsxs)(zr.ButtonBase,{disabled:l,onClick:a=>n(a.currentTarget),sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.9,borderRadius:1,border:"1px solid #d9d9d6",bgcolor:l?"#f7f7f5":"#fff",color:u?"#37352f":"#9b9a97",fontSize:15,fontWeight:500,minWidth:0,whiteSpace:"nowrap","&:hover":{bgcolor:"#f7f7f5"},"&.Mui-disabled":{color:"#b9b8b4"}},children:[e,u||c]})}function k$(e){ue();let u=Sn(),c=Hj(e),l=(0,Uj.useTimePickerVariant)(void 0),{form:n,event:a,readOnly:r,busy:t,actions:o}=c,d=c.modals.event,i=!!n.useValue("allDay"),s=String(n.useValue("startDate")??""),h=String(n.useValue("endDate")??""),f=String(n.useValue("startTime")??""),m=String(n.useValue("endTime")??""),[b,g]=(0,eu.useState)(null),[w,S]=(0,eu.useState)(null),[O,P]=(0,eu.useState)(null),[j,M]=(0,eu.useState)(null),N=a?(0,dn.jsxs)(zr.Box,{sx:{display:"flex",flexDirection:"column",gap:2.25,pt:.5},children:[(0,dn.jsx)(zr.Box,{sx:{bgcolor:r?"#fff4e5":"#f2f6fa",borderRadius:1,px:1.5,py:1,fontSize:14.5,lineHeight:1.7,color:"#37352f"},children:r?I("googleEvent.readOnly",{value:y$(a.event_type)}):I(a.recurring?"googleEvent.editableRecurring":"googleEvent.editable",{calendar:a.calendar||I("calendar.googleCalendar")})}),(0,dn.jsx)(Em.ClearTextField,{label:I("common.title"),name:"title",form:n,disabled:r,onKeyDown:z=>{z.key==="Enter"&&(z.preventDefault(),n.submit())},fullWidth:!0,autoFocus:!u&&!r}),(0,dn.jsx)(zr.FormControlLabel,{control:(0,dn.jsx)(zr.Switch,{checked:i,disabled:r,onChange:(z,W)=>o.changeAllDay(W),size:"small"}),label:I("googleEvent.allDay"),sx:{ml:0,"& .MuiFormControlLabel-label":{fontSize:15,color:"#37352f"}}}),(0,dn.jsxs)(zr.Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[(0,dn.jsxs)(zr.Box,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[(0,dn.jsx)(zr.Box,{sx:{width:44,fontSize:14.5,color:"#57564f",flexShrink:0},children:I("googleEvent.start")}),(0,dn.jsx)(Am,{icon:(0,dn.jsx)(Np.default,{sx:{fontSize:18,color:"#787774"}}),label:Wj(s),placeholder:I("googleEvent.pickDate"),disabled:r,onClick:g}),i?null:(0,dn.jsx)(Am,{icon:(0,dn.jsx)(Lp.default,{sx:{fontSize:18,color:"#787774"}}),label:f,placeholder:I("googleEvent.time"),disabled:r,onClick:P})]}),(0,dn.jsxs)(zr.Box,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[(0,dn.jsx)(zr.Box,{sx:{width:44,fontSize:14.5,color:"#57564f",flexShrink:0},children:I("googleEvent.end")}),(0,dn.jsx)(Am,{icon:(0,dn.jsx)(Np.default,{sx:{fontSize:18,color:"#787774"}}),label:Wj(h),placeholder:I("googleEvent.pickDate"),disabled:r,onClick:S}),i?null:(0,dn.jsx)(Am,{icon:(0,dn.jsx)(Lp.default,{sx:{fontSize:18,color:"#787774"}}),label:m,placeholder:I("googleEvent.time"),disabled:r,onClick:M})]})]}),(0,dn.jsx)(Em.ClearTextField,{label:I("googleEvent.location"),name:"location",form:n,disabled:r,fullWidth:!0}),(0,dn.jsx)(Em.ClearTextField,{label:I("googleEvent.description"),name:"description",form:n,disabled:r,fullWidth:!0,multiline:!0,minRows:3,maxRows:8}),(0,dn.jsx)(Cl.DatePicker,{anchorEl:b,open:!!b,onClose:()=>g(null),selectedDate:Dp(s),onDateChange:z=>{o.changeStartDate(Vj(z)),g(null)},centered:u,locale:xi()}),(0,dn.jsx)(Cl.DatePicker,{anchorEl:w,open:!!w,onClose:()=>S(null),selectedDate:Dp(h||s),minDate:s?Dp(s):void 0,onDateChange:z=>{o.changeEndDate(Vj(z)),S(null)},centered:u,locale:xi()}),(0,dn.jsx)(Cl.TimePicker,{timeVariant:l,anchorEl:O,open:!!O,onClose:()=>P(null),value:Gj(f),format:"HH:mm",minuteStep:5,autoApply:!0,centered:u,locale:xi(),onChange:(z,W)=>{o.changeStartTime(`${z}:${W}`),P(null)}}),(0,dn.jsx)(Cl.TimePicker,{timeVariant:l,anchorEl:j,open:!!j,onClose:()=>M(null),value:Gj(m),format:"HH:mm",minuteStep:5,autoApply:!0,centered:u,locale:xi(),onChange:(z,W)=>{o.changeEndTime(`${z}:${W}`),M(null)}})]}):null;return(0,dn.jsx)(Kj.FormDialog,{open:d.isOpen,onClose:d.close,width:520,title:I("googleEvent.title"),locale:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!r&&c.canDelete,confirmConfig:{title:a?.recurring?I("googleEvent.deleteOccurrenceConfirm"):I("googleEvent.deleteConfirm"),confirmText:I("common.delete")}}},onDelete:o.remove,fontScale:{enabled:!0},fontScaleKey:"taskbox-google-event",sectionContentPaddingTop:0,sections:[{id:"google-event",showTitle:!1,children:N}],actions:{showCancelButton:!r,right:r?(0,dn.jsxs)(zr.Box,{sx:{display:"flex",gap:"1rem",alignItems:"center"},children:[(0,dn.jsx)(zr.Button,{variant:"outlined",startIcon:(0,dn.jsx)($j.default,{}),onClick:()=>a&&v$(a.start_date),children:I("googleEvent.openInGoogle")}),(0,dn.jsx)(zr.Button,{variant:"contained",onClick:d.close,sx:{minWidth:72},children:I("common.close")})]}):(0,dn.jsx)(zr.Button,{variant:"contained",onClick:()=>{n.submit()},disabled:t,children:I("common.save")})}})}var nu=require("react"),Ni=require("@mui/material"),Yj=require("@ehfuse/mui-form-dialog"),Zj=require("@ehfuse/mui-form-controls"),Qj=require("@ehfuse/tree-view");var tu=require("react"),Pm=require("@ehfuse/forma");function x$(e){let u=[],c=l=>{for(let n of l.employees??[])u.push(n);for(let n of l.groups??[])c(n)};for(let l of e)c(l);return u}function Xj(e){let u=(0,tu.useRef)(e);u.current=e;let c=(0,tu.useMemo)(()=>x$(e.groups),[e.groups]),l=(0,tu.useRef)(c);l.current=c;let n=(0,Pm.useFormaState)({openCount:0}),a=(0,Pm.useGlobalForm)({formId:Dt("taskbox-employee-select-form"),initialValues:{selectedSeqs:[]},onSubmit:o=>{let d=l.current.filter(i=>o.selectedSeqs.includes(i.seq));return u.current.onConfirm(u.current.multiple?d:d.slice(0,1)),u.current.onClose(),!0}}),r={select:li({modalId:Dt("taskbox-employee-select"),open:e.open,onClose:()=>u.current.onClose(),onOpen:()=>{a.setFormValues({selectedSeqs:u.current.selectedSeqs}),n.setValue("openCount",Number(n.getValue("openCount")??0)+1)}})};return{form:a,modals:r,ui:n,allEmployees:c,changeSelection:o=>a.setFormValue("selectedSeqs",o)}}_e();var lo=require("react/jsx-runtime");function Jj(e){return`${e.name}#${e.seq}`}function w$(e){return Number(e.slice(e.lastIndexOf("#")+1))||0}function T$(e,u){return u?[e.name,e.department,e.role_name,e.work_position].filter(Boolean).some(c=>String(c).toLowerCase().includes(u)):!0}function S$(e){let u=[[e.name,e.role_name].filter(Boolean).join(" "),e.department].filter(Boolean).join(" / ");return{id:`emp:${e.seq}`,label:Jj(e),renderLabel:(0,lo.jsx)(Ni.Box,{component:"span",sx:{display:"inline-flex",alignItems:"baseline",gap:.75},children:(0,lo.jsx)(Ni.Box,{component:"span",sx:{fontWeight:400,color:"text.primary"},children:u})})}}function eq(e,u){let c=(e.groups??[]).map(n=>eq(n,u)).filter(n=>n!==null),l=(e.employees??[]).filter(n=>T$(n,u)).map(S$);return c.length===0&&l.length===0?null:{id:`group:${e.key}`,label:e.name,children:[...c,...l]}}function C$({groups:e,allEmployees:u,initialSelectedSeqs:c,multiple:l,isMobile:n,onSelectionChange:a}){ue();let[r,t]=(0,nu.useState)(""),o=(0,nu.useMemo)(()=>e.map(i=>eq(i,r.trim().toLowerCase())).filter(i=>i!==null),[e,r]),d=(0,nu.useMemo)(()=>u.filter(i=>c.includes(i.seq)).map(Jj),[]);return(0,lo.jsxs)(lo.Fragment,{children:[(0,lo.jsx)(Ni.Box,{sx:{px:1.5,py:1,borderBottom:"1px solid #cccccc",flexShrink:0},children:(0,lo.jsx)(Zj.SearchTextField,{size:"small",fullWidth:!0,placeholder:I("dialog.searchNameDept"),onSearch:t,onClear:()=>t(""),sx:{"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiInputBase-root":{px:0}}})}),(0,lo.jsx)(Ni.Box,{sx:n?{display:"flex",flexDirection:"column"}:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:(0,lo.jsx)(Qj.TreeView,{items:o,checkbox:!0,multiSelect:l,selectionMode:"child",showSearch:!1,defaultExpanded:!0,initialSelections:d,onChange:i=>a(i.map(w$).filter(s=>s>0)),styles:{border:"none",borderRadius:"0"}})})]})}function _$({open:e,title:u=I("dialog.selectEmployee"),hint:c="",groups:l,multiple:n=!1,selectedSeqs:a,confirmText:r=I("common.confirm"),onConfirm:t,onClose:o}){ue();let d=Sn(),i=a??[],s=Xj({open:e,groups:l,multiple:n,selectedSeqs:i,onConfirm:t,onClose:o}),{form:h,allEmployees:f}=s,m=s.modals.select,b=h.useValue("selectedSeqs")??[],g=Number(s.ui.useValue("openCount")??0);return(0,lo.jsx)(Yj.FormDialog,{open:m.isOpen,onClose:m.close,title:n&&b.length>0?I("dialog.titleWithPeople",{title:u,count:b.length}):u,locale:Pt(),fullScreen:d,mobilePresentation:d?"slide":"dialog",draggable:!0,width:"600px",tabs:{visible:!1},titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},scrollPastLastSection:!1,sectionContentPaddingTop:0,fontScale:{enabled:!0},fontScaleKey:"taskbox-employee-select",sections:[{id:"employee-select",title:I("dialog.selectEmployee"),showTitle:!1,children:(0,lo.jsx)(Ni.Box,{sx:{...d?{}:{height:560},display:"flex",flexDirection:"column",border:"1px solid #cccccc",borderRadius:1,...d?{}:{overflow:"hidden"},userSelect:"none"},children:(0,lo.jsx)(C$,{groups:l,allEmployees:f,initialSelectedSeqs:i,multiple:n,isMobile:d,onSelectionChange:s.changeSelection},g)})}],dialogActionSx:{"@media (max-width:1023.95px)":{gap:"0.75rem !important","& .left-actions":{flex:1,minWidth:0},"& .right-actions":{flex:1}}},actions:{visible:!0,showCancelButton:!1,left:c?(0,lo.jsx)(Ni.Typography,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-line",lineHeight:1.35},children:c}):void 0,right:(0,lo.jsx)(Ni.Button,{variant:"contained",onClick:()=>{h.submit()},children:r})}})}var Wq=require("react"),Go=require("@mui/material"),Vq=require("@ehfuse/mui-form-dialog"),qm=require("@ehfuse/mui-form-controls"),Gq=v(require("@mui/icons-material/SpeedOutlined"),1);Xa();pn();var Xr=require("@mui/material"),iq=require("@ehfuse/mui-form-dialog"),Rm=require("@ehfuse/mui-form-controls"),aq=v(require("@ehfuse/overlay-scrollbar"),1);var Mm=require("react"),tq=require("@ehfuse/forma");Xa();function nq(e){return`byAccount.a${e}`}function ru(e){return Math.max(0,Math.floor(Number(e)||0))}function zp(e){return{basis:e.basis,default_capacity:e.default_capacity,byAccount:Object.fromEntries(Object.entries(e.by_account??{}).map(([u,c])=>[`a${u}`,c]))}}function rq({open:e,capacity:u,onClose:c,onSave:l}){let n=(0,tq.useGlobalForm)({formId:Dt("taskbox-workload-capacity-form"),initialValues:zp(u??Xo),onSubmit:async t=>{let o={};for(let[d,i]of Object.entries(t.byAccount??{})){let s=ru(i),h=Number(d.slice(1));h>0&&s>0&&(o[h]=s)}return await l({...u??Xo,basis:t.basis,default_capacity:ru(t.default_capacity),by_account:o}),!0}}),a={form:$r({modalIdPrefix:"taskbox-workload-capacity-dialog",open:e,onClose:c,onOpen:()=>n.setFormValues(zp(u??Xo))})},r=(0,Mm.useRef)(!0);return(0,Mm.useEffect)(()=>{if(r.current){r.current=!1;return}e&&n.setFormValues(zp(u??Xo))},[u]),{form:n,modals:a}}_e();var ar=require("react/jsx-runtime"),I$=[{value:"count",get label(){return I("workload.basisCount")}},{value:"points",get label(){return I("workload.basisPoints")}}];function oq({form:e,name:u,unit:c,size:l,clearWhenZero:n}){let a=ru(e.useFormValue(u));return(0,ar.jsx)(Rm.NumberField,{size:l,fullWidth:!0,min:0,max:999,thousandSeparator:!1,align:"right",suffix:c,clearWhenZero:n,value:a,onValueChange:r=>e.setFormValue(u,ru(r))})}function Fp({open:e,capacity:u,employees:c,onClose:l,onSave:n}){ue();let{form:a,modals:r}=rq({open:e,capacity:u,onClose:l,onSave:n}),t=a.useFormValue("basis")==="points"?"SP":I("chart.unitCount");return(0,ar.jsx)(iq.FormDialog,{open:r.form.isOpen,onClose:r.form.close,maxWidth:"sm",title:I("workload.title"),locale:Pt(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-workload-capacity",tabs:{visible:!1},actions:{showCancelButton:!0,right:(0,ar.jsx)(Xr.Button,{variant:"contained",onClick:()=>{a.submit()},children:I("common.save")})},sectionContentPaddingTop:0,sections:[{id:"capacity",title:"",showTitle:!1,children:(0,ar.jsxs)(Xr.Box,{sx:{display:"flex",flexDirection:"column",gap:2},children:[(0,ar.jsx)(Xr.Box,{sx:{fontSize:15,color:"#37352f"},children:I("workload.intro")}),(0,ar.jsxs)(Xr.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,ar.jsx)(Xr.Box,{sx:{width:104,flexShrink:0,fontSize:16,color:"#37352f"},children:I("workload.basis")}),(0,ar.jsx)(Rm.LabelSelect,{form:a,name:"basis",size:"medium",fullWidth:!0,label:"",options:I$})]}),(0,ar.jsxs)(Xr.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,ar.jsx)(Xr.Box,{sx:{width:104,flexShrink:0,fontSize:16,color:"#37352f"},children:I("workload.defaultCapacity")}),(0,ar.jsx)(oq,{form:a,name:"default_capacity",size:"medium",unit:t})]}),(0,ar.jsx)(Xr.Box,{sx:{pl:"119px",mt:-1.25,fontSize:13.5,color:"#37352f"},children:I("workload.defaultHint",{unit:t})}),(0,ar.jsx)(Xr.Box,{sx:{fontSize:16,fontWeight:700,color:"#37352f"},children:I("workload.perPerson")}),c.length===0?(0,ar.jsx)(Xr.Box,{sx:{fontSize:15,color:"#787774"},children:I("workload.noEmployees")}):(0,ar.jsx)(Xr.Box,{sx:{border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,overflow:"hidden"},children:(0,ar.jsx)(aq.default,{style:{maxHeight:260},thumb:{width:6},children:c.filter(o=>Number(o.account_seq)>0).map(o=>(0,ar.jsxs)(Xr.Box,{sx:{display:"flex",alignItems:"center",gap:1.5,px:2,py:1,borderBottom:"1px solid #f2f2f0","&:last-of-type":{borderBottom:"none"}},children:[(0,ar.jsxs)(Xr.Box,{sx:{flex:1,minWidth:0,fontSize:16,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[o.name,o.department?(0,ar.jsx)(Xr.Box,{component:"span",sx:{ml:1,fontSize:14,color:"#787774"},children:o.department}):null]}),(0,ar.jsx)(Xr.Box,{sx:{width:132,flexShrink:0},children:(0,ar.jsx)(oq,{form:a,name:nq(Number(o.account_seq)),size:"small",unit:t,clearWhenZero:!0})})]},o.account_seq))})})]})}]})}var zm=require("react"),Bq=require("@mui/material"),mu=require("react/jsx-runtime");function W$({height:e}){return(0,mu.jsx)(Bq.Box,{sx:typeof e=="number"?{height:e,minHeight:120}:{position:"absolute",inset:0}})}function hu(e,u){let c=(0,zm.lazy)(e);return function(n){return(0,mu.jsx)(zm.Suspense,{fallback:(0,mu.jsx)(W$,{height:n.height??u}),children:(0,mu.jsx)(c,{...n})})}}var Jp=hu(()=>Promise.resolve().then(()=>(mq(),dq)).then(e=>({default:e.SprintVelocityChart})),200),eg=hu(()=>Promise.resolve().then(()=>(gq(),pq)).then(e=>({default:e.SprintBurndownChart})),200),tg=hu(()=>Promise.resolve().then(()=>(xq(),kq)).then(e=>({default:e.CumulativeFlowChart})),220),ng=hu(()=>Promise.resolve().then(()=>(Sq(),Tq)).then(e=>({default:e.LeadTimeDistributionChart})),200),rg=hu(()=>Promise.resolve().then(()=>(Iq(),_q)).then(e=>({default:e.WorkloadChart})),200);da();La();var Fm=require("@mui/material"),Lq=require("@ehfuse/mui-form-dialog");pn();var Mq=require("react"),Pn=require("@mui/material"),Rq=v(require("@mui/icons-material/PersonOutlineOutlined"),1),Dq=v(require("@ehfuse/overlay-scrollbar"),1);Cs();_e();var En=require("react/jsx-runtime"),Oq=56,Aq=68,Eq=96;function V$(e){let u=String(e.due_date??"").slice(0,10);return u?u.slice(5).replace("-","/"):"-"}function Pq(e,u){let c=String(e.due_date??"").slice(0,10);return!!c&&c<u}function og({tasks:e,row:u,todayStr:c,employees:l,rows:n,height:a=200,hideSummary:r=!1,onChangeManager:t,onOpenTask:o}){ue();let[d,i]=(0,Mq.useState)(null),s=cu(e,u.accountSeq),h=f=>n.find(m=>m.accountSeq===f)?.total??0;return(0,En.jsxs)(Pn.Box,{sx:{display:"flex",flexDirection:"column",minHeight:0,height:a},children:[r?null:(0,En.jsxs)(Pn.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:.5,pb:.75,fontSize:14,color:"#37352f"},children:[(0,En.jsx)(Pn.Box,{component:"span",sx:{fontWeight:700},children:u.name}),(0,En.jsx)(Pn.Box,{component:"span",children:I("chart.openCount",{count:s.length})}),u.capacity>0?(0,En.jsx)(Pn.Box,{component:"span",sx:{color:u.load>u.capacity?"#e5484d":"#787774"},children:I("chart.capacityOf",{capacity:u.capacity,load:u.load})}):null]}),(0,En.jsxs)(Pn.Box,{sx:{flex:1,minHeight:0,display:"flex",flexDirection:"column",border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,overflow:"hidden"},children:[(0,En.jsxs)(Pn.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,flexShrink:0,bgcolor:"#fafaf9",borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,fontSize:13.5,fontWeight:600,color:"#37352f"},children:[(0,En.jsx)(Pn.Box,{sx:{width:Oq,flexShrink:0},children:I("board.due")}),(0,En.jsx)(Pn.Box,{sx:{flex:1,minWidth:0},children:I("template.task")}),(0,En.jsx)(Pn.Box,{sx:{width:Aq,flexShrink:0,textAlign:"center"},children:I("col.priority")}),t?(0,En.jsx)(Pn.Box,{sx:{width:Eq,flexShrink:0,textAlign:"center"},children:I("col.owner")}):null]}),(0,En.jsx)(Pn.Box,{sx:{flex:1,minHeight:0},children:(0,En.jsx)(Dq.default,{style:{height:"100%"},thumb:{width:6},children:s.length===0?(0,En.jsx)(Pn.Box,{sx:{p:2,fontSize:14,color:"#9a9a97"},children:I("chart.noOpenTasks")}):s.map(f=>(0,En.jsxs)(Pn.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1.5,borderBottom:"1px solid #f2f2f0"},children:[(0,En.jsx)(Pn.Box,{sx:{width:Oq,flexShrink:0,fontSize:13.5,color:Pq(f,c)?"#e5484d":"#787774",fontWeight:Pq(f,c)?700:400},children:V$(f)}),(0,En.jsx)(Pn.Box,{onClick:o?()=>o(f.seq):void 0,sx:{flex:1,minWidth:0,fontSize:14.5,color:"#37352f",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...o?{cursor:"pointer","&:hover":{textDecoration:"underline"}}:{}},children:f.title}),(0,En.jsx)(Pn.Box,{sx:{width:Aq,flexShrink:0,display:"flex",justifyContent:"center"},children:(0,En.jsx)(Gr,{priority:f.priority})}),t?(0,En.jsx)(Pn.Box,{sx:{width:Eq,flexShrink:0,display:"flex",justifyContent:"center"},children:(0,En.jsx)(Pn.Button,{size:"small",variant:"outlined",startIcon:(0,En.jsx)(Rq.default,{sx:{fontSize:17}}),onClick:m=>i({el:m.currentTarget,taskSeq:f.seq}),children:I("chart.move")})}):null]},f.seq))})})]}),(0,En.jsx)(Pn.Menu,{anchorEl:d?.el??null,open:!!d,onClose:()=>i(null),transitionDuration:0,children:l.filter(f=>Number(f.account_seq)>0&&Number(f.account_seq)!==u.accountSeq).map(f=>(0,En.jsxs)(Pn.MenuItem,{onClick:()=>{d&&t&&t(d.taskSeq,Number(f.account_seq),f.name),i(null)},sx:{fontSize:14,minWidth:200},children:[(0,En.jsx)(Pn.Box,{sx:{flex:1},children:f.name}),(0,En.jsx)(Pn.Box,{component:"span",sx:{ml:2,fontSize:13,color:"#787774"},children:I("chart.countValue",{count:h(Number(f.account_seq))})})]},f.account_seq))})]})}Cs();var Ol=require("react");function Nq({open:e,row:u,onClose:c,onOpenTask:l}){let[n,a]=(0,Ol.useState)(u);(0,Ol.useEffect)(()=>{u&&a(u)},[u]);let r=(0,Ol.useRef)(0),t={dialog:$r({modalIdPrefix:"taskbox-workload-person-dialog",open:e,onClose:()=>{c();let d=r.current;r.current=0,d>0&&l?.(d)}})};return{modals:t,shown:u??n,openTask:l?d=>{if(!t.dialog.isOpen){l(d);return}r.current=d,t.dialog.close()}:void 0}}_e();var fu=require("react/jsx-runtime");function ig({open:e,row:u,rows:c,tasks:l,todayStr:n,employees:a,onClose:r,onChangeManager:t,onOpenTask:o}){ue();let{modals:d,shown:i,openTask:s}=Nq({open:e,row:u,onClose:r,onOpenTask:o}),h=i?cu(l,i.accountSeq).length:0;return(0,fu.jsx)(Lq.FormDialog,{open:d.dialog.isOpen,onClose:d.dialog.close,maxWidth:"sm",title:i?I("workload.personTasksTitle",{name:i.name,count:h}):I("template.task"),locale:Pt(),titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-workload-person",tabs:{visible:!1},actions:{showCancelButton:!1,right:(0,fu.jsx)(Fm.Button,{variant:"contained",onClick:d.dialog.close,children:I("common.close")})},sections:[{id:"person-tasks",title:"",showTitle:!1,children:(0,fu.jsx)(Fm.Box,{sx:{minHeight:0},children:i?(0,fu.jsx)(og,{tasks:l,row:i,rows:c,todayStr:n,employees:a,height:"min(420px, 52vh)",hideSummary:!0,onChangeManager:t,onOpenTask:s}):null})}]})}pn();var Fq=require("react"),mo=require("@mui/material"),jq=require("@ehfuse/overlay-scrollbar");da();Cs();La();_e();var _r=require("react/jsx-runtime"),zq="#e5484d",G$="#2f80ed",U$="#9a9a97",ag=30,$$=96,jm=56;function sg({count:e,max:u,color:c,title:l}){let n=e>0&&u>0?.18+e/u*.72:0;return(0,_r.jsx)(mo.Tooltip,{title:l,arrow:!0,disableInteractive:!0,placement:"top",children:(0,_r.jsx)(mo.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",borderRight:`1px solid ${De.NOTION_LINE_COLOR}`,borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,bgcolor:n>0?`${c}${Math.round(n*255).toString(16).padStart(2,"0")}`:"transparent",color:n>.55?"#fff":"#37352f",fontSize:12.5,fontWeight:e>0?700:400,fontVariantNumeric:"tabular-nums"},children:e>0?e:""})})}function lg({tasks:e,todayStr:u,weeks:c=6,height:l=200}){ue();let n=(0,Fq.useMemo)(()=>Zp(e,{todayStr:u,weeks:c}),[e,u,c]);if(n.rows.length===0)return(0,_r.jsx)(mo.Box,{sx:Ar(l),children:(0,_r.jsx)(co,{text:I("chart.noAssignedOpen"),height:l})});let a=`${$$}px ${jm}px repeat(${n.weeks.length}, minmax(${jm}px, 1fr)) ${jm}px ${jm}px`,r={height:ag,display:"flex",alignItems:"center",justifyContent:"center",borderRight:`1px solid ${De.NOTION_LINE_COLOR}`,borderBottom:"1px solid #dcdad6",fontSize:12,fontWeight:700,color:"#37352f",bgcolor:"#f8f8f7",whiteSpace:"nowrap"};return(0,_r.jsx)(mo.Box,{sx:Ar(l),children:(0,_r.jsx)(jq.OverlayScrollbar,{style:{height:"100%"},thumb:{width:8},children:(0,_r.jsxs)(mo.Box,{sx:{display:"grid",gridTemplateColumns:a,minWidth:"fit-content",height:"100%",gridTemplateRows:`${ag}px repeat(${n.rows.length}, minmax(${ag}px, 1fr))`},children:[(0,_r.jsx)(mo.Box,{sx:{...r,justifyContent:"flex-start",pl:1},children:I("chart.assignee")}),(0,_r.jsx)(mo.Box,{sx:{...r,color:zq},children:I("chart.overdue")}),n.weeks.map(t=>(0,_r.jsx)(mo.Box,{sx:{...r,...t.isCurrent?{borderBottom:"2px solid #2f80ed"}:{}},children:t.label},t.start)),(0,_r.jsx)(mo.Box,{sx:r,children:I("chart.noDue")}),(0,_r.jsx)(mo.Box,{sx:r,children:I("chart.total")}),n.rows.map(t=>(0,_r.jsxs)(mo.Box,{sx:{display:"contents"},children:[(0,_r.jsx)(mo.Box,{sx:{display:"flex",alignItems:"center",pl:1,borderRight:`1px solid ${De.NOTION_LINE_COLOR}`,borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,fontSize:13,color:t.accountSeq>0?"#37352f":"#9a9a97",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name}),(0,_r.jsx)(sg,{count:t.overdue,max:n.maxCell,color:zq,title:I("chart.cellOverdue",{name:t.name,count:t.overdue})}),t.byWeek.map((o,d)=>(0,_r.jsx)(sg,{count:o,max:n.maxCell,color:G$,title:I("chart.cellWeek",{name:t.name,week:n.weeks[d].label,count:o})},n.weeks[d].start)),(0,_r.jsx)(sg,{count:t.noDue,max:n.maxCell,color:U$,title:I("chart.cellNoDue",{name:t.name,count:t.noDue})}),(0,_r.jsxs)(mo.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,fontSize:12.5,fontWeight:700,color:"#37352f",fontVariantNumeric:"tabular-nums"},children:[t.total,t.beyond>0?(0,_r.jsxs)(mo.Box,{component:"span",sx:{ml:.25,fontSize:10.5,color:"#9a9a97"},children:["(+",t.beyond,")"]}):null]})]},t.accountSeq))]})})})}var _s=require("react"),qq=require("@ehfuse/forma");Cs();function Hq({open:e,sprints:u,tasks:c,todayStr:l,initialSprintSeq:n,capacity:a,onSaveCapacity:r,onOpenTask:t,onClose:o}){let d=(0,qq.useGlobalForm)({formId:Dt("taskbox-sprint-charts-form"),initialValues:{sprintSeq:"",flowDays:"30",workloadMode:"distribution"}}),[i,s]=(0,_s.useState)(0),[h,f]=(0,_s.useState)(!1),m=(0,_s.useRef)(0),b={charts:$r({modalIdPrefix:"taskbox-sprint-charts-dialog",open:e,onClose:()=>{o();let P=m.current;m.current=0,P>0&&t?.(P)},onOpen:()=>{let P=u.find(M=>M.status==="active")??u[0],j=u.find(M=>M.seq===n)??P;d.setFormValue("sprintSeq",j?.seq?String(j.seq):"")}})},g=(0,_s.useMemo)(()=>lu(c,{todayStr:l,capacity:a}),[c,l,a]),w=g.find(P=>P.accountSeq===i)??null;return{form:d,modals:b,workloadRows:g,pickedAccountSeq:i,pickedRow:w,pickPerson:s,closePersonTasks:()=>s(0),capacityOpen:h,openCapacity:()=>f(!0),closeCapacity:()=>f(!1),saveCapacity:r?async P=>{await r(P),f(!1)}:void 0,openTask:t?P=>{if(!b.charts.isOpen){t(P);return}m.current=P,b.charts.close()}:void 0}}_e();var fn=require("react/jsx-runtime"),Uq="min(560px, 62vh)",K$=`calc(${Uq} - 4px)`,X$=[{value:"30",get label(){return I("chart.last30")}},{value:"60",get label(){return I("chart.last60")}},{value:"90",get label(){return I("chart.last90")}}];function Y$({open:e,sprints:u,tasks:c,todayStr:l,showSprintCharts:n,capacity:a=Xo,capacityEmployees:r=[],onSaveCapacity:t,onChangeTaskManager:o,onOpenTask:d,initialSprintSeq:i=0,onClose:s}){ue();let h=Hq({open:e,sprints:u,tasks:c,todayStr:l,initialSprintSeq:i,capacity:a,onSaveCapacity:t,onOpenTask:d,onClose:s}),{form:f,modals:m,workloadRows:b,pickedAccountSeq:g,pickedRow:w}=h,S=Number(f.useFormValue("sprintSeq"))||0,O=Number(f.useFormValue("flowDays"))||30,P=f.useFormValue("workloadMode")==="timeline"?"timeline":"distribution",j=(0,Wq.useMemo)(()=>u.find(B=>B.seq===S)??null,[u,S]),M={height:K$,boxSizing:"border-box",px:3,py:2.5,display:"flex",flexDirection:"column",minHeight:0,overflow:"hidden"},N=(0,fn.jsx)(qm.LabelSelect,{form:f,name:"sprintSeq",label:I("col.goal"),showLabel:!1,showEmptyOption:!1,options:u.map(B=>({value:String(B.seq),label:Wo(B)})),sx:{width:280,flexShrink:0}}),z=(0,fn.jsx)(qm.LabelSelect,{form:f,name:"workloadMode",label:I("chart.view"),showLabel:!1,showEmptyOption:!1,options:[{value:"distribution",label:I("chart.loadNow")},{value:"timeline",label:I("chart.weeklyDue")}],sx:{width:280,flexShrink:0}}),W=(0,fn.jsxs)(fn.Fragment,{children:[z,t?(0,fn.jsx)(Go.Button,{size:"small",variant:"outlined",startIcon:(0,fn.jsx)(Gq.default,{sx:{fontSize:18}}),onClick:h.openCapacity,sx:{flexShrink:0},children:I("chart.capacity")}):null]}),F=n??u.length>0,C=(0,fn.jsx)(qm.LabelSelect,{form:f,name:"flowDays",label:I("chart.period"),showLabel:!1,showEmptyOption:!1,options:X$,sx:{width:280,flexShrink:0}});return(0,fn.jsxs)(fn.Fragment,{children:[(0,fn.jsx)(Vq.FormDialog,{open:m.charts.isOpen,onClose:m.charts.close,maxWidth:"md",title:I("chart.title"),locale:Pt(),contentTopPadding:0,contentPaddingX:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,sectionTitleGap:0,fixedHeight:Uq,contentBottomPadding:0,scrollPastLastSection:!1,tabs:{visible:!0,switchContent:!0,fullWidth:!0},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-sprint-charts",sections:[...F?[{id:"velocity",tabTitle:I("chart.velocity"),showTitle:!1,children:(0,fn.jsx)(Go.Box,{sx:M,children:(0,fn.jsx)(Jp,{sprints:u,tasks:c,height:"100%"})})},{id:"burndown",tabTitle:I("chart.burndown"),showTitle:!1,children:(0,fn.jsx)(Go.Box,{sx:M,children:j?(0,fn.jsx)(eg,{sprint:j,tasks:c,todayStr:l,height:"100%",headerLeft:N}):(0,fn.jsxs)(Go.Box,{sx:Ar("100%"),children:[(0,fn.jsx)(Go.Box,{sx:uo,children:N}),(0,fn.jsx)(co,{text:I("chart.pickGoalForBurndown"),height:"100%"})]})})},{id:"cumulative-flow",tabTitle:I("chart.cfd"),showTitle:!1,children:(0,fn.jsx)(Go.Box,{sx:M,children:(0,fn.jsx)(tg,{tasks:c,todayStr:l,days:O,height:"100%",headerLeft:C})})}]:[],{id:"workload",tabTitle:I("chart.workload"),showTitle:!1,children:(0,fn.jsx)(Go.Box,{sx:M,children:P==="timeline"?(0,fn.jsxs)(Go.Box,{sx:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,fn.jsx)(Go.Box,{sx:uo,children:W}),(0,fn.jsx)(lg,{tasks:c,todayStr:l,height:"100%"})]}):(0,fn.jsx)(rg,{tasks:c,todayStr:l,height:"100%",capacity:a,headerLeft:W,selectedAccountSeq:g,onSelectPerson:o?h.pickPerson:void 0})})},{id:"lead-time",tabTitle:I("chart.leadTime"),showTitle:!1,children:(0,fn.jsx)(Go.Box,{sx:M,children:(0,fn.jsx)(ng,{tasks:c,todayStr:l,days:O,height:"100%",headerLeft:C})})}],actions:{showCancelButton:!1,right:(0,fn.jsx)(Go.Button,{variant:"contained",onClick:m.charts.close,children:I("common.close")})}}),(0,fn.jsx)(ig,{open:g>0,row:w,rows:b,tasks:c,todayStr:l,employees:r,onClose:h.closePersonTasks,onChangeManager:o,onOpenTask:h.openTask}),h.saveCapacity?(0,fn.jsx)(Fp,{open:h.capacityOpen,capacity:a,employees:r,onClose:h.closeCapacity,onSave:h.saveCapacity}):null]})}da();var $q=require("react"),Kq=require("@mui/material"),ma=require("@ehfuse/mui-virtual-data-table"),Hm=require("react/jsx-runtime");function Is(e,u){return(0,$q.useMemo)(()=>u??(e?(0,ma.headerMenuAnchor)(e):null),[e,u])}function pu(e,u){let c=u.filter(n=>!e.includes(n)),l=e.filter(n=>!u.includes(n));return c.length===1&&l.length===0?{kind:"toggle",value:c[0]}:l.length===1&&c.length===0?{kind:"toggle",value:l[0]}:u.length===0?{kind:"clear"}:null}function cg({checked:e,onClick:u,disabled:c,children:l}){return(0,Hm.jsx)(ma.HeaderMenuItem,{selected:e,disabled:c,onClick:u,icon:(0,Hm.jsx)(ma.HeaderMenuIcon,{d:e?ma.HEADER_MENU_ICON_PATHS.radioOn:ma.HEADER_MENU_ICON_PATHS.radioOff,color:e?"primary.main":"text.disabled"}),children:l})}function ug({color:e}){return(0,Hm.jsx)(Kq.Box,{component:"span",sx:{width:8,height:8,borderRadius:"50%",bgcolor:e,flexShrink:0}})}var Wm=require("@ehfuse/mui-virtual-data-table");_e();var dg=require("react/jsx-runtime");function Z$({anchorPosition:e,anchorEl:u,candidates:c,selectedNames:l,avatarSrcByName:n,onToggle:a,onClear:r,onClose:t}){ue();let o=Is(u,e),d=it().avatarSrcByName,i=n??d,s=Math.round(Wm.HEADER_MENU_FONT_SIZE*1.43);return(0,dg.jsx)(Wm.HeaderMenu,{open:!!o,anchorPosition:o,onClose:t,filter:{options:c.map(h=>({value:h.name,label:h.name,icon:(0,dg.jsx)(eo,{src:i?.get(h.name)??"",name:h.name,avatarSx:{width:s,height:s,fontSize:Math.round(s/2),borderRadius:"50%",flexShrink:0,...ta[0]},iconFontSize:Math.round(s*.6)})})),value:l,onChange:h=>{let f=pu(l,h);if(!f)return;let m=f.kind==="toggle"?c.find(b=>b.name===f.value):void 0;m?a(m):r()},clearLabel:I("menu.clearFilter"),emptyText:I("menu.noMembersInList")}})}var Xq=require("react"),Al=require("@mui/material"),Yq=v(require("@mui/icons-material/KeyboardArrowDown"),1),Zq=v(require("@mui/icons-material/Check"),1);var Fi=require("react/jsx-runtime");function Q$({value:e,onChange:u,options:c}){let[l,n]=(0,Xq.useState)(null),a=c??dd,r=dd.find(t=>t.value===e)?.label??"";return(0,Fi.jsxs)(Fi.Fragment,{children:[(0,Fi.jsxs)(Al.ButtonBase,{onClick:t=>n(t.currentTarget),sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:.5,borderRadius:1,fontSize:13.5,color:"#37352f","&:hover":{bgcolor:"#f2f2f0"}},children:[r,(0,Fi.jsx)(Yq.default,{sx:{fontSize:17,color:"#9a9a97"}})]}),(0,Fi.jsx)(Al.Menu,{transitionDuration:0,anchorEl:l,open:!!l,onClose:()=>n(null),children:a.map(t=>(0,Fi.jsxs)(Al.MenuItem,{selected:t.value===e,onClick:()=>{u(t.value),n(null)},sx:{fontSize:14,minWidth:140,justifyContent:"space-between",gap:1},children:[t.label,t.value===e?(0,Fi.jsx)(Zq.default,{sx:{fontSize:16,color:"#2f80ed"}}):null]},t.value))})]})}pn();var Bs=require("@mui/material"),mg=require("@ehfuse/mui-form-controls");nc();_e();var ha=require("react/jsx-runtime"),J$=[{get label(){return I("range.month1")},months:1},{get label(){return I("range.month3")},months:3},{get label(){return I("range.month6")},months:6},{get label(){return I("range.year1")},months:12},{get label(){return I("common.all")},months:0}];function hg({fromDate:e,toDate:u,onChange:c}){ue();let l=a=>{if(a<=0){c("","");return}c(di(tc(a)),di(new Date))},n=a=>a<=0?!e&&!u:!e||!u?!1:e===di(tc(a))&&u===di(new Date);return(0,ha.jsxs)(Bs.Box,{sx:{display:"flex",alignItems:"center",gap:1.5,flexWrap:"wrap"},children:[(0,ha.jsx)(Bs.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:J$.map(a=>{let r=n(a.months);return(0,ha.jsx)(Bs.ButtonBase,{onClick:()=>l(a.months),sx:{px:1.25,py:.85,borderRadius:1,fontSize:13,fontWeight:r?500:400,border:"1px solid",borderColor:r?"#2f80ed":De.NOTION_LINE_COLOR,color:r?"#2f80ed":"#37352f",bgcolor:r?"#eef6ff":"transparent","&:hover":{bgcolor:r?"#eef6ff":"#f7f7f5"}},children:a.label},a.label)})}),(0,ha.jsxs)(Bs.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,ha.jsx)(mg.DateTextField,{value:e,size:"small",placeholder:I("calendar.startDate"),onChange:a=>c(a.target.value,u),sx:{width:140,"& .MuiInputBase-input":{fontSize:13}}}),(0,ha.jsx)(Bs.Box,{component:"span",sx:{fontSize:13,color:"#9a9a97"},children:"~"}),(0,ha.jsx)(mg.DateTextField,{value:u,size:"small",placeholder:I("calendar.endDate"),onChange:a=>c(e,a.target.value),sx:{width:140,"& .MuiInputBase-input":{fontSize:13}}})]})]})}var Qq=require("@mui/material");var fg=require("react/jsx-runtime");function eK({anchorEl:e,fromDate:u,toDate:c,onChange:l,onClose:n}){return(0,fg.jsx)(Qq.Popover,{transitionDuration:0,anchorEl:e,open:!!e,onClose:n,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{p:1.5}}},children:(0,fg.jsx)(hg,{fromDate:u,toDate:c,onChange:l})})}var Fa=require("@mui/material"),eH=v(require("@mui/icons-material/Checklist"),1),tH=v(require("@mui/icons-material/Face"),1),nH=v(require("@mui/icons-material/Publish"),1),rH=v(require("@mui/icons-material/NotificationsOutlined"),1),oH=v(require("@mui/icons-material/BugReportOutlined"),1),iH=v(require("@mui/icons-material/SupportAgentOutlined"),1),aH=v(require("@mui/icons-material/DescriptionOutlined"),1),sH=v(require("@mui/icons-material/Inventory2Outlined"),1);_e();var Uo=require("react/jsx-runtime");function Jq(e,u){return u>0?`${e} (${u})`:e}var tK=[{id:"my",get label(){return I("tab.all")},icon:(0,Uo.jsx)(eH.default,{sx:{fontSize:18}})},{id:"mine",get label(){return I("tab.mine")},icon:(0,Uo.jsx)(tH.default,{sx:{fontSize:18}})},{id:"sent",get label(){return I("tab.sent")},icon:(0,Uo.jsx)(nH.default,{sx:{fontSize:18}})},{id:"support",get label(){return I("tab.support")},icon:(0,Uo.jsx)(iH.default,{sx:{fontSize:18}})},{id:"bug",get label(){return I("tab.bug")},icon:(0,Uo.jsx)(oH.default,{sx:{fontSize:18}})},{id:"notice",get label(){return I("tab.notice")},icon:(0,Uo.jsx)(rH.default,{sx:{fontSize:18}})},{id:"archive",get label(){return I("tab.archive")},icon:(0,Uo.jsx)(sH.default,{sx:{fontSize:18}}),hideCount:!0},{id:"report",get label(){return I("tab.report")},icon:(0,Uo.jsx)(aH.default,{sx:{fontSize:18}}),hideCount:!0}];function nK(e){return{minHeight:46,minWidth:75,bgcolor:e.bg,color:e.color,borderRadius:"8px 8px 0 0",padding:"10px 18px",textTransform:"none",fontSize:14,fontWeight:500,border:`1px solid ${e.borderColor}`,borderBottom:"none","&:hover":{bgcolor:e.hoverBg},"&.Mui-selected":{bgcolor:e.selectedBg,color:e.selectedColor,border:`1px solid ${e.selectedBg}`,borderBottom:"none","&:hover":{bgcolor:e.selectedBg}},...e.sx}}function rK({items:e,activeTab:u,counts:c,onChange:l,compact:n=!1}){ue();let a=xt(),r=nK(a.tabs),t=e;return n?(0,Uo.jsx)(Fa.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:1},children:t.map(o=>{let d=u===o.id;return(0,Uo.jsx)(Fa.ButtonBase,{onClick:()=>l(o.id),sx:{height:40,minWidth:0,px:.5,borderRadius:1,fontSize:Zn(13.5),fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",border:"1px solid",bgcolor:d?a.tabs.selectedBg:a.tabs.bg,color:d?a.tabs.selectedColor:a.tabs.color,borderColor:d?a.tabs.selectedBg:a.tabs.borderColor},children:Jq(o.label,o.hideCount?0:c[o.id]??0)},o.id)})}):(0,Uo.jsx)(Fa.Tabs,{value:u,onChange:(o,d)=>l(d),sx:{minHeight:46,"& .MuiTabs-indicator":{display:"none"},"& .MuiTabs-flexContainer":{gap:"12px",minHeight:46}},children:t.map(o=>(0,Uo.jsx)(Fa.Tab,{value:o.id,label:Jq(o.label,o.hideCount?0:c[o.id]??0),icon:o.icon,iconPosition:"start",sx:r},o.id))})}var ja=require("react"),Et=require("@mui/material"),lH=v(require("@mui/icons-material/OpenInNewOutlined"),1),cH=v(require("@mui/icons-material/RestoreFromTrashOutlined"),1),uH=v(require("@mui/icons-material/Check"),1),dH=v(require("@mui/icons-material/CheckCircleOutlined"),1),mH=v(require("@mui/icons-material/RadioButtonUnchecked"),1),hH=v(require("@mui/icons-material/SendOutlined"),1),fH=v(require("@mui/icons-material/EventOutlined"),1),pH=v(require("@mui/icons-material/PersonOutlineOutlined"),1),gH=v(require("@mui/icons-material/ViewKanbanOutlined"),1),bH=v(require("@mui/icons-material/ContentCopyOutlined"),1),yH=v(require("@mui/icons-material/PrintOutlined"),1),vH=v(require("@mui/icons-material/NextPlanOutlined"),1),kH=v(require("@mui/icons-material/ContentPasteOutlined"),1),xH=v(require("@mui/icons-material/ShareOutlined"),1),wH=v(require("@mui/icons-material/DirectionsRunOutlined"),1),pg=v(require("@mui/icons-material/ChevronRight"),1),TH=v(require("@mui/icons-material/ArchiveOutlined"),1),SH=v(require("@mui/icons-material/UnarchiveOutlined"),1),gg=require("@ehfuse/alerts");_e();var Ye=require("react/jsx-runtime");function oK({target:e,onClose:u,customTabs:c,sprints:l=[],myAccountSeq:n=0,onOpenDetail:a,onToggleCompleted:r,onRequestConfirm:t,onChangeDueDate:o,onChangeReminder:d,onMemberEdit:i,onMoveProject:s,onDuplicate:h,onPrint:f,onCreateFollowUp:m,onShare:b,onAssignSprint:g,onArchiveToggle:w,onDelete:S,onRestore:O,onPurge:P}){ue();let j=Sn(),M=wi(),[N,z]=(0,ja.useState)(null),[W,F]=(0,ja.useState)(null),[C,B]=(0,ja.useState)(null);(0,ja.useEffect)(()=>{e||(z(null),F(null),B(null))},[e]);let R=e?.task??null,p=!!R?.is_notice,y=!!R?.is_event,x=R?!fi(R,n):!1,{editPolicy:k,shareText:T}=it(),_=R?ea(R,n,k):!1,D=R?wa(R,n,k,x):!1,H=R?wa(R,n,k,!1):!1,V=!!R?.deleted,U=(()=>{if(!R||R.completed)return!0;let q=pi(R,n);return q.total===0||q.count>=q.total})(),L=(0,ja.useMemo)(()=>new Set(c.filter(q=>q.useSprints).map(q=>q.key)),[c]),G=async(q="one")=>{let $=R;if(u(),!$)return;await(0,gg.ConfirmDialog)({title:I("menu.deleteTask"),message:q==="series"?I("menu.deleteSeriesConfirm",{title:$.title}):I("menu.deleteTaskConfirm",{title:$.title})})&&S?.($.seq,q)},E=async()=>{let q=R;if(u(),!q)return;await(0,gg.ConfirmDialog)({title:I("menu.purge"),message:I("menu.purgeConfirm",{title:q.title})})&&P?.(q.seq)},A=()=>{R&&w(R.seq,!R.archived),u()};return(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(Et.Menu,{open:!!e,onClose:u,transitionDuration:0,anchorReference:j?"none":"anchorPosition",anchorPosition:!j&&e?{top:e.position.top,left:e.position.left}:void 0,slotProps:{paper:{sx:{minWidth:190,...j?{position:"fixed",top:"50%",left:"50%",translate:"-50% -50%",maxHeight:"70vh"}:{}}},list:j?{sx:{"& .MuiMenuItem-root":{py:1,minHeight:0}}}:void 0},children:[(0,Ye.jsxs)(Et.MenuItem,{onClick:()=>{R&&a(R),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(lH.default,{sx:{fontSize:19}})}),I("menu.openDetail")]}),V?(0,Ye.jsx)(Et.Divider,{}):null,V&&O?(0,Ye.jsxs)(Et.MenuItem,{disabled:H,onClick:()=>{R&&O(R.seq),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(cH.default,{sx:{fontSize:19}})}),I("menu.restore")]}):null,V&&P?(0,Ye.jsxs)(Et.MenuItem,{disabled:H,onClick:()=>{E()},sx:{fontSize:14,color:"#e5484d"},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(Dr,{sx:{fontSize:19,color:"#e5484d"}})}),I("menu.purge")]}):null,V?null:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(Et.MenuItem,{disabled:p?(R?.author_account_seq??0)!==n:(R?.author_account_seq??0)!==n&&(R?.manager_account_seq??0)!==n,onClick:()=>{R&&r(R.seq,!R.completed),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:R?.completed?(0,Ye.jsx)(mH.default,{sx:{fontSize:19}}):(0,Ye.jsx)(dH.default,{sx:{fontSize:19}})}),R?.completed?I("menu.uncomplete"):I("menu.complete")]}),!p&&t?(0,Ye.jsxs)(Et.MenuItem,{disabled:U,onClick:()=>{R&&t(R),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(hH.default,{sx:{fontSize:19}})}),I("menu.requestConfirm")]}):null,y?null:(0,Ye.jsx)(Et.Divider,{}),y?null:(0,Ye.jsxs)(Et.MenuItem,{disabled:_,onClick:q=>{R&&z({anchorEl:q.currentTarget,task:R})},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(fH.default,{sx:{fontSize:19}})}),I("menu.changeDue")]}),!p&&!y&&i?(0,Ye.jsxs)(Et.MenuItem,{disabled:k==="coreAuthorManager"?_:!1,onClick:()=>{R&&i(R,"manager"),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(pH.default,{sx:{fontSize:19}})}),I("menu.changeOwner")]}):null,y?null:(0,Ye.jsxs)(Et.MenuItem,{disabled:_,onClick:q=>{R&&F({anchorEl:q.currentTarget,task:R})},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(gH.default,{sx:{fontSize:19}})}),I("menu.moveProject"),(0,Ye.jsx)(pg.default,{sx:{fontSize:18,ml:"auto",color:"#9a9a97"}})]}),(0,Ye.jsx)(Et.Divider,{}),h?(0,Ye.jsxs)(Et.MenuItem,{disabled:x,onClick:()=>{R&&h(R.seq),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(bH.default,{sx:{fontSize:19}})}),I("menu.duplicate")]}):null,f?(0,Ye.jsxs)(Et.MenuItem,{onClick:()=>{R&&f(R),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(yH.default,{sx:{fontSize:19}})}),I("common.print")]}):null,m&&R&&!R.is_event&&!R.is_notice?(0,Ye.jsxs)(Et.MenuItem,{onClick:()=>{R&&m(R.seq),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(vH.default,{sx:{fontSize:19}})}),I("menu.createFollowUp")]}):null,(0,Ye.jsxs)(Et.MenuItem,{onClick:()=>{R&&(b?b(R):Ma(R,j,T)),u()},sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:j?(0,Ye.jsx)(xH.default,{sx:{fontSize:19}}):(0,Ye.jsx)(kH.default,{sx:{fontSize:19}})}),j?I("menu.share"):I("menu.copyContent")]}),R&&!R.is_notice&&!R.is_event&&L.has(String(R.tab_key??""))&&g?(0,Ye.jsxs)(Et.MenuItem,{onClick:q=>B(q.currentTarget),sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(wH.default,{sx:{fontSize:19}})}),I("menu.addToSprint"),(0,Ye.jsx)(pg.default,{sx:{fontSize:18,ml:"auto",color:"#9a9a97"}})]}):null,(0,Ye.jsxs)(Et.MenuItem,{onClick:A,disabled:x||!R?.archived&&!(R&&ac(R)),sx:{fontSize:14},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:R?.archived?(0,Ye.jsx)(SH.default,{sx:{fontSize:19}}):(0,Ye.jsx)(TH.default,{sx:{fontSize:19}})}),R?.archived?I("menu.unarchive"):I("menu.archive")]}),S?(0,Ye.jsx)(Et.Divider,{}):null,S?(0,Ye.jsxs)(Et.MenuItem,{disabled:D,onClick:()=>{G("one")},sx:{fontSize:14,color:"#e5484d"},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(Dr,{sx:{fontSize:19,color:"#e5484d"}})}),(R?.repeat_group_key??0)>0?I("menu.deleteThisOnly"):I("common.delete")]}):null,S&&(R?.repeat_group_key??0)>0?(0,Ye.jsxs)(Et.MenuItem,{disabled:D,onClick:()=>{G("series")},sx:{fontSize:14,color:"#e5484d"},children:[(0,Ye.jsx)(Et.ListItemIcon,{children:(0,Ye.jsx)(Dr,{sx:{fontSize:19,color:"#e5484d"}})}),I("menu.deleteSeries")]}):null]})]}),(0,Ye.jsx)(qo,{anchorEl:N?.anchorEl??null,open:!!N,date:N?.task.due_date??"",reminders:Fo(N?.task),hideReminder:!!N?.task.completed,centered:j,onClose:()=>{z(null),u()},onDateChange:q=>{N&&o(N.task.seq,q)},onReminderChange:q=>{N&&d?.(N.task.seq,q)}}),(0,Ye.jsxs)(Et.Menu,{transitionDuration:0,anchorEl:W?.anchorEl??null,open:!!W,onClose:()=>{F(null),u()},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},...M,children:[(0,Ye.jsx)(Et.MenuItem,{selected:!W?.task.tab_key,onClick:()=>{W&&s(W.task.seq,""),F(null),u()},sx:{fontSize:14,minWidth:170},children:I("common.none")}),c.filter(q=>!q.archived).map(q=>(0,Ye.jsx)(Et.MenuItem,{selected:W?.task.tab_key===q.key,onClick:()=>{W&&s(W.task.seq,q.key),F(null),u()},sx:{fontSize:14,minWidth:170},children:q.label},q.key))]}),(0,Ye.jsx)(Et.Menu,{transitionDuration:0,anchorEl:C,open:!!C,onClose:()=>B(null),anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},children:[{seq:0,label:I("menu.backlogUnassigned")},...l.filter(q=>`custom-${q.group_seq}`===String(R?.tab_key??"")).map(q=>({seq:q.seq,label:Wo(q)}))].map(q=>(0,Ye.jsxs)(Et.MenuItem,{onClick:()=>{R&&g?.(R.seq,q.seq),B(null),u()},sx:{fontSize:14,minWidth:160,gap:1},children:[q.label,(R?.sprint_seq??0)===q.seq?(0,Ye.jsx)(uH.default,{sx:{fontSize:16,color:"#2f80ed",ml:"auto"}}):null]},q.seq))})]})}var CH=require("@ehfuse/mui-virtual-data-table");_e();var bg=require("react/jsx-runtime");function iK({anchorPosition:e,anchorEl:u,labelOptions:c,selectedKeys:l,onChange:n,onToggle:a,onClear:r,clearLabel:t=I("menu.clearFilter"),onClose:o}){ue();let d=Is(u,e);return(0,bg.jsx)(CH.HeaderMenu,{open:!!d,anchorPosition:d,onClose:o,filter:{options:c.map(i=>({value:i.key,label:i.name,icon:(0,bg.jsx)(ug,{color:i.dot})})),value:l,onChange:i=>{if(n){n(i);return}let s=pu(l,i);s?.kind==="toggle"?a?.(s.value):s?.kind==="clear"&&r?.()},clearLabel:t}})}var _H=v(require("@mui/icons-material/SettingsOutlined"),1),El=require("@ehfuse/mui-virtual-data-table");_e();var gu=require("react/jsx-runtime");function aK(e){ue();let{anchorPosition:u,anchorEl:c,sprints:l,value:n,onSelect:a,onManage:r,onClose:t}=e,o=Is(c,u),d=[{seq:0,label:I("common.all")},{seq:-1,label:I("menu.unassignedTasks")},...l.map(i=>({seq:i.seq,label:Wo(i)}))];return(0,gu.jsx)(El.HeaderMenu,{open:!!o,anchorPosition:o,onClose:t,header:d.map(i=>(0,gu.jsx)(cg,{checked:n===i.seq,onClick:()=>{a(i.seq),t()},children:i.label},i.seq)),children:(0,gu.jsx)(El.HeaderMenuItem,{icon:(0,gu.jsx)(_H.default,{sx:{fontSize:El.HEADER_MENU_ICON_SIZE,color:"text.secondary"}}),onClick:()=>{t(),r()},children:I("menu.manageGoals")})})}_e();var sK={my:"tasks",mine:"tasks",sent:"tasks",notice:"notice",support:"support",bug:"bug",archive:"archive",done:"done",report:"report"};function BH(e){return sK[e]??"tasks"}var yg={get list(){return I("menu.list")},get card(){return I("menu.project")},get kanban(){return I("menu.status")},get sprint(){return I("menu.goal")},get calendar(){return I("menu.weekly")},get month(){return I("menu.monthly")},get agenda(){return I("menu.agenda")},get timeline(){return I("menu.timeline")}},IH=["list","calendar","month","card","kanban","sprint","timeline"],lK=["list","kanban"],cK=["list","card"];function uK(e){let u=BH(e);switch(u){case"notice":return{kind:u,viewOptions:[],showCreate:!0,createLabel:I("task.createNotice"),showGroupBy:!1,showSprintFilter:!1,showDateRange:!1,showHideCompleted:!0,forceFlatList:!0,columns:{notice:!0}};case"bug":return{kind:u,viewOptions:IH,showCreate:!0,createLabel:I("task.createBug"),showGroupBy:!0,showSprintFilter:!0,showDateRange:!1,showHideCompleted:!0,forceFlatList:!1,columns:{bug:!0}};case"support":return{kind:u,viewOptions:lK,showCreate:!1,createLabel:"",showGroupBy:!0,showSprintFilter:!1,showDateRange:!1,showHideCompleted:!0,forceFlatList:!1,columns:{support:!0,showProject:!1}};case"archive":return{kind:u,viewOptions:cK,showCreate:!1,createLabel:"",showGroupBy:!1,showSprintFilter:!1,showDateRange:!0,showHideCompleted:!1,forceFlatList:!0,columns:{showActions:!1}};case"done":return{kind:u,viewOptions:["list"],showCreate:!1,createLabel:"",showGroupBy:!1,showSprintFilter:!1,showDateRange:!0,showHideCompleted:!1,forceFlatList:!0,columns:{showActions:!1}};case"report":return{kind:u,viewOptions:[],showCreate:!1,createLabel:"",showGroupBy:!1,showSprintFilter:!1,showDateRange:!0,showHideCompleted:!1,forceFlatList:!0,columns:{}};default:return{kind:u,viewOptions:IH,showCreate:!0,createLabel:I("task.createTask"),showGroupBy:!0,showSprintFilter:!0,showDateRange:!1,showHideCompleted:!0,forceFlatList:!1,columns:e==="mine"?{showRequest:!1,confirmMode:"action"}:e==="sent"?{confirmMode:"time"}:{}}}}nc();Lm();var AH=require("react"),EH=require("@ehfuse/keyboard-state");_e();var OH=[{key:"g l",view:"list"},{key:"g b",view:"card"},{key:"g k",view:"kanban"},{key:"g s",view:"sprint"},{key:"g c",view:"calendar"},{key:"g m",view:"month"},{key:"g t",view:"timeline"}];function dK(e,u={}){let{enabled:c=!0,views:l}=u,{onCreateTask:n,onFocusSearch:a,onToggleHelp:r,onChangeView:t,onEscape:o}=e,d=l?l.join(","):"",i=(0,AH.useMemo)(()=>{let s=[];if(n&&s.push({key:"n",callback:n,options:{preventDefault:!0}}),a&&s.push({key:"/",callback:a,options:{preventDefault:!0}}),r&&s.push({key:"shift+?",callback:r,options:{preventDefault:!0}}),o&&s.push({key:"escape",callback:o,options:{allowInEditable:!0}}),t)for(let h of PH(d?d.split(","):void 0))s.push({key:h.key,callback:()=>t(h.view),options:{preventDefault:!0}});return s},[n,a,r,t,o,d]);(0,EH.useKeyboardState)(c?i:[])}function PH(e){if(!e)return OH;let u=new Set(e);return OH.filter(c=>u.has(c.view))}function Pl(e){return[{keys:"N",description:I("task.createNew")},{keys:"/",description:I("common.search")},...PH(e).map(u=>({keys:u.key.split(" ").map(c=>c.toUpperCase()).join(" \u2192 "),description:I("task.showView",{value:yg[u.view]})})),{keys:"?",description:I("task.help")},{keys:"Esc",description:I("common.close")}]}var mK=Pl();var qa=require("@mui/material"),VH=v(require("@mui/icons-material/ArrowRightAlt"),1),GH=require("@ehfuse/mui-form-dialog");var qH=require("react");_e();var MH={id:"concept",tabTitle:"manual.concept.tabTitle1",intro:"manual.concept.intro1",topics:[{title:"manual.concept.title1",lead:"manual.concept.lead1",steps:[{title:"manual.concept.title2",desc:"manual.concept.desc1"},{title:"manual.concept.title3",desc:"manual.concept.desc2"},{title:"manual.concept.title4",desc:"manual.concept.desc3"}]},{title:"manual.concept.title5",subtitle:"manual.concept.subtitle1",lead:"manual.concept.lead2",items:[{term:"manual.concept.term1",desc:"manual.concept.desc4"},{term:"manual.concept.term2",desc:"manual.concept.desc5"},{term:"manual.concept.term3",desc:"manual.concept.desc6"}]},{title:"manual.concept.title6",lead:"manual.concept.lead3",items:[{term:"manual.concept.term4",desc:"manual.concept.desc7"},{term:"manual.concept.term5",desc:"manual.concept.desc8"},{term:"manual.concept.term6",desc:"manual.concept.desc9"}]},{title:"manual.concept.title7",lead:"manual.concept.lead4",items:[{term:"manual.concept.term7",desc:"manual.concept.desc10"},{term:"manual.concept.term8",desc:"manual.concept.desc11"},{term:"manual.concept.term9",desc:"manual.concept.desc12"},{term:"manual.concept.term10",desc:"manual.concept.desc13"}]},{title:"manual.concept.title8",lead:"manual.concept.lead5",items:[{term:"manual.concept.term11",desc:"manual.concept.desc14"},{term:"manual.concept.term12",desc:"manual.concept.desc15"},{term:"manual.concept.term13",desc:"manual.concept.desc16"},{term:"manual.concept.term14",desc:"manual.concept.desc17"},{term:"manual.concept.term15",desc:"manual.concept.desc18"},{term:"manual.concept.term16",desc:"manual.concept.desc19"}]},{title:"manual.concept.title9",subtitle:"manual.concept.subtitle2",lead:"manual.concept.lead6",items:[{term:"manual.concept.term17",desc:"manual.concept.desc20"},{term:"manual.concept.term18",desc:"manual.concept.desc21"},{term:"manual.concept.term19",desc:"manual.concept.desc22"}]},{title:"manual.concept.title10",lead:"manual.concept.lead7",items:[{term:"manual.concept.term20",desc:"manual.concept.desc23"},{term:"manual.concept.term21",desc:"manual.concept.desc24"}]}]};var RH={id:"roles",tabTitle:"manual.roles.tabTitle1",intro:"manual.roles.intro1",topics:[{title:"manual.roles.title1",subtitle:"manual.roles.subtitle1",lead:"manual.roles.lead1",items:[{term:"manual.roles.term1",desc:"manual.roles.desc1"},{term:"manual.roles.term2",desc:"manual.roles.desc2"},{term:"manual.roles.term3",desc:"manual.roles.desc3"},{term:"manual.roles.term4",desc:"manual.roles.desc4"},{term:"manual.roles.term5",desc:"manual.roles.desc5"}]},{title:"manual.roles.title2",subtitle:"manual.roles.subtitle2",lead:"manual.roles.lead2",items:[{term:"manual.roles.term6",desc:"manual.roles.desc6"},{term:"manual.roles.term7",desc:"manual.roles.desc7"},{term:"manual.roles.term8",desc:"manual.roles.desc8"},{term:"manual.roles.term9",desc:"manual.roles.desc9"},{term:"manual.roles.term10",desc:"manual.roles.desc10"},{term:"manual.roles.term11",desc:"manual.roles.desc11"}]},{title:"manual.roles.title3",subtitle:"manual.roles.subtitle3",lead:"manual.roles.lead3",items:[{term:"manual.roles.term12",desc:"manual.roles.desc12"},{term:"manual.roles.term13",desc:"manual.roles.desc13"},{term:"manual.roles.term14",desc:"manual.roles.desc14"},{term:"manual.roles.term15",desc:"manual.roles.desc15"},{term:"manual.roles.term16",desc:"manual.roles.desc16"}]},{title:"manual.roles.title4",lead:"manual.roles.lead4",items:[{term:"manual.roles.term17",desc:"manual.roles.desc17"},{term:"manual.roles.term18",desc:"manual.roles.desc18"},{term:"manual.roles.term19",desc:"manual.roles.desc19"},{term:"manual.roles.term20",desc:"manual.roles.desc20"},{term:"manual.roles.term21",desc:"manual.roles.desc21"},{term:"manual.roles.term22",desc:"manual.roles.desc22"},{term:"manual.roles.term23",desc:"manual.roles.desc23"}]},{title:"manual.roles.title5",lead:"manual.roles.lead5",items:[{term:"manual.roles.term24",desc:"manual.roles.desc24"},{term:"manual.roles.term25",desc:"manual.roles.desc25"},{term:"manual.roles.term26",desc:"manual.roles.desc26"},{term:"manual.roles.term27",desc:"manual.roles.desc27"}]},{title:"manual.roles.title6",feature:"support",lead:"manual.roles.lead6",items:[{term:"manual.roles.term28",desc:"manual.roles.desc28"},{term:"manual.roles.term29",desc:"manual.roles.desc29"},{term:"manual.roles.term30",desc:"manual.roles.desc30"},{term:"manual.roles.term31",desc:"manual.roles.desc31"}]}]};var DH={id:"basics",tabTitle:"manual.basics.tabTitle1",intro:"manual.basics.intro1",topics:[{title:"manual.basics.title1",lines:["manual.basics.line1","manual.basics.line2","manual.basics.line3","manual.basics.line4","manual.basics.line5"]},{title:"manual.basics.title2",subtitle:"manual.basics.subtitle1",lead:"manual.basics.lead1",lines:["manual.basics.line6","manual.basics.text1","manual.basics.text2","manual.basics.text3","manual.basics.text4","manual.basics.text5"]},{title:"manual.basics.title3",lines:["manual.basics.line7","manual.basics.line8","manual.basics.line9"]},{title:"manual.basics.title4",lines:["manual.basics.line10","manual.basics.line11"]},{title:"manual.basics.title5",lines:["manual.basics.line12","manual.basics.line13"]},{title:"manual.basics.title6",subtitle:"manual.basics.subtitle2",lines:["manual.basics.line14","manual.basics.line15","manual.basics.line16","manual.basics.line17"]},{title:"manual.basics.title7",lines:["manual.basics.line18","manual.basics.line19","manual.basics.line20"]}]};var NH={id:"notify",tabTitle:"manual.notify.tabTitle1",intro:"manual.notify.intro1",topics:[{title:"manual.notify.title1",items:[{term:"manual.notify.term1",desc:"manual.notify.desc1"},{term:"manual.notify.term2",desc:"manual.notify.desc2"},{term:"manual.notify.term3",desc:"manual.notify.desc3"},{term:"manual.notify.term4",desc:"manual.notify.desc4"},{term:"manual.notify.term5",desc:"manual.notify.desc5"},{term:"manual.notify.term6",desc:"manual.notify.desc6"},{term:"manual.notify.term7",desc:"manual.notify.desc7"}]},{title:"manual.notify.title2",items:[{term:"manual.notify.term8",desc:"manual.notify.desc8"},{term:"manual.notify.term9",desc:"manual.notify.desc9"},{term:"manual.notify.term10",desc:"manual.notify.desc10"},{term:"manual.notify.term11",desc:"manual.notify.desc11"},{term:"manual.notify.term12",desc:"manual.notify.desc12"},{term:"manual.notify.term13",desc:"manual.notify.desc13"},{term:"manual.notify.term14",desc:"manual.notify.desc14"}]},{title:"manual.notify.title3",lead:"manual.notify.lead1",items:[{term:"manual.notify.term15",desc:"manual.notify.desc15"},{term:"manual.notify.term16",desc:"manual.notify.desc16"},{term:"manual.notify.term17",desc:"manual.notify.desc17"}]},{title:"manual.notify.title4",lead:"manual.notify.lead2",items:[{term:"manual.notify.term18",desc:"manual.notify.desc18"},{term:"manual.notify.term19",desc:"manual.notify.desc19"},{term:"manual.notify.term20",desc:"manual.notify.desc20"},{term:"manual.notify.term21",desc:"manual.notify.desc21"},{term:"manual.notify.term22",desc:"manual.notify.desc22"}]},{title:"manual.notify.title5",lead:"manual.notify.lead3",items:[{term:"manual.notify.term23",desc:"manual.notify.desc23"},{term:"manual.notify.term24",desc:"manual.notify.desc24"},{term:"manual.notify.term25",desc:"manual.notify.desc25"},{term:"manual.notify.term26",desc:"manual.notify.desc26"},{term:"manual.notify.term27",desc:"manual.notify.desc27"}]},{title:"manual.notify.title6",items:[{term:"manual.notify.term28",desc:"manual.notify.desc28"},{term:"manual.notify.term29",desc:"manual.notify.desc29"},{term:"manual.notify.term30",desc:"manual.notify.desc30"}]},{title:"manual.notify.title7",items:[{term:"manual.notify.term31",desc:"manual.notify.desc31"},{term:"manual.notify.term32",desc:"manual.notify.desc32"},{term:"manual.notify.term33",desc:"manual.notify.desc33"},{term:"manual.notify.term34",desc:"manual.notify.desc34"},{term:"manual.notify.term35",desc:"manual.notify.desc35"},{term:"manual.notify.term36",desc:"manual.notify.desc36"},{term:"manual.notify.term37",desc:"manual.notify.desc37"}]}]};var LH={id:"more",tabTitle:"manual.more.tabTitle1",intro:"manual.more.intro1",topics:[{title:"manual.more.title1",lead:"manual.more.lead1",lines:["manual.more.line1","manual.more.text1","manual.more.text2"]},{title:"manual.more.title2",lead:"manual.more.lead2",items:[{term:"manual.more.term1",desc:"manual.more.desc1"},{term:"manual.more.term2",desc:"manual.more.desc2"},{term:"manual.more.term3",desc:"manual.more.desc3"},{term:"manual.more.term4",desc:"manual.more.desc4"},{term:"manual.more.term5",desc:"manual.more.desc5"},{term:"manual.more.term6",desc:"manual.more.desc6"}]},{title:"manual.more.title3",lines:["manual.more.line2","manual.more.line3"]},{title:"manual.more.title4",feature:"timeline",lines:["manual.more.line4"]},{title:"manual.more.title5",feature:"charts",lines:["manual.more.line5"]},{title:"manual.more.title6",lines:["manual.more.line6","manual.more.line7","manual.more.line8"]},{title:"manual.more.title7",feature:"label",lines:["manual.more.line9"]},{title:"manual.more.title8",lines:["manual.more.line10","manual.more.line11","manual.more.line12","manual.more.line13"]},{title:"manual.more.title9",lines:["manual.more.line14","manual.more.line15"]},{title:"manual.more.title10",subtitle:"manual.more.subtitle1",lead:"manual.more.lead3",lines:["manual.more.line16","manual.more.line17","manual.more.line18","manual.more.line19"]},{title:"manual.more.title11",lines:["manual.more.line20","manual.more.line21","manual.more.line22"]},{title:"manual.more.title12",feature:"project",lines:["manual.more.line23","manual.more.line24"]},{title:"manual.more.title13",feature:"sprint",lines:["manual.more.line25","manual.more.line26"]},{title:"manual.more.title14",lines:["manual.more.line27","manual.more.line28","manual.more.line29"]},{title:"manual.more.title15",lines:["manual.more.line30"]},{title:"manual.more.title16",feature:"bug",lines:["manual.more.line31","manual.more.line32"]},{title:"manual.more.title17",feature:"support",lines:["manual.more.line33","manual.more.line34"]},{title:"manual.more.title18",feature:"report",lines:["manual.more.line35"]}]};var zH={id:"calendar",tabTitle:"manual.calendar.tabTitle1",intro:"manual.calendar.intro1",topics:[{title:"manual.calendar.title1",lead:"manual.calendar.lead1",items:[{term:"manual.calendar.term1",desc:"manual.calendar.desc1"},{term:"manual.calendar.term2",desc:"manual.calendar.desc2"}]},{title:"manual.calendar.title2",lines:["manual.calendar.line1","manual.calendar.line2","manual.calendar.line3","manual.calendar.line4"]},{title:"manual.calendar.title3",lines:["manual.calendar.line5","manual.calendar.line6","manual.calendar.line7","manual.calendar.line8"]}]};var FH={id:"shortcuts",tabTitle:"manual.shortcuts.tabTitle1",topics:[]};var bu=[MH,RH,DH,NH,LH,zH,FH];function jH(e=bu){let u=c=>c&&I(c);return e.map(c=>({...c,tabTitle:I(c.tabTitle),intro:u(c.intro),topics:c.topics.map(l=>({...l,title:I(l.title),subtitle:u(l.subtitle),lead:u(l.lead),steps:l.steps?.map(n=>({title:I(n.title),desc:I(n.desc)})),items:l.items?.map(n=>({term:I(n.term),desc:I(n.desc)})),lines:l.lines?.map(n=>I(n))}))}))}function HH({open:e,onClose:u}){return{modals:{dialog:$r({modalIdPrefix:"taskbox-shortcut-help-dialog",open:e,onClose:u})}}}function WH({open:e,onClose:u,features:c,initialTab:l}){let[n,a]=(0,qH.useState)(0);return{modals:{dialog:$r({modalIdPrefix:"taskbox-manual-dialog",open:e,onClose:u,onOpen:()=>{let o=bu.filter(d=>!d.feature||c[d.feature]!==!1).findIndex(d=>d.id===l);a(Math.max(0,o))}})},activeTabIndex:n,setActiveTabIndex:a}}_e();var ci=require("react/jsx-runtime");function hK({keys:e}){return(0,ci.jsx)(qa.Box,{sx:{display:"flex",alignItems:"center",gap:.5,justifyContent:"flex-end"},children:e.split(" \u2192 ").map((u,c)=>(0,ci.jsxs)(qa.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[c>0?(0,ci.jsx)(VH.default,{sx:{fontSize:18,color:"#9a9a97"}}):null,(0,ci.jsx)(qa.Box,{component:"span",sx:{minWidth:32,height:32,px:.75,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:13.5,fontWeight:700,color:"#37352f",bgcolor:"#f4f4f2",border:"1px solid #e0dfdb",borderRadius:1,fontVariantNumeric:"tabular-nums"},children:u})]},`${u}-${c}`))})}function fK({open:e,onClose:u,views:c}){ue();let{modals:l}=HH({open:e,onClose:u}),n=Pl(c);return(0,ci.jsx)(GH.FormDialog,{open:l.dialog.isOpen,onClose:l.dialog.close,maxWidth:"xs",title:I("shortcut.title"),locale:Pt(),titleIcons:{delete:{visible:!1}},tabs:{visible:!1},sectionContentPaddingTop:0,sections:[{id:"shortcuts",showTitle:!1,children:(0,ci.jsx)(qa.Box,{sx:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:2,rowGap:1.25,alignItems:"center",fontSize:14,color:"#37352f"},children:n.map(a=>(0,ci.jsxs)(qa.Box,{sx:{display:"contents"},children:[(0,ci.jsx)(hK,{keys:a.keys}),(0,ci.jsx)("span",{children:a.description})]},a.keys))})}],actions:{showCancelButton:!1,right:(0,ci.jsx)(qa.Button,{variant:"contained",onClick:l.dialog.close,children:I("common.close")})}})}var Gm=require("react"),Kn=require("@mui/material"),$H=v(require("@mui/icons-material/ArrowRightAlt"),1),KH=v(require("@mui/icons-material/ChevronRightRounded"),1),XH=v(require("@mui/icons-material/ArrowForward"),1),YH=require("@ehfuse/mui-form-dialog");_e();var qt=require("react/jsx-runtime");function Vm(e){return e.split(/(\*\*[^*]+\*\*|\s*(?:→|->)\s*)/g).filter(c=>c.length>0).map((c,l)=>c.startsWith("**")&&c.endsWith("**")?(0,qt.jsx)(Kn.Box,{component:"strong",sx:{fontWeight:700},children:c.slice(2,-2)},l):/^\s*(?:→|->)\s*$/.test(c)?(0,qt.jsx)(XH.default,{sx:{fontSize:"1em",verticalAlign:"-0.15em",mx:.5,color:"text.secondary"}},l):(0,qt.jsx)(Gm.Fragment,{children:c},l))}function pK({keys:e}){let u=xt();return(0,qt.jsx)(Kn.Box,{sx:{display:"flex",alignItems:"center",gap:.5,justifyContent:"flex-end"},children:e.split(" \u2192 ").map((c,l)=>(0,qt.jsxs)(Kn.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[l>0?(0,qt.jsx)($H.default,{sx:{fontSize:20,color:u.colors.textMuted}}):null,(0,qt.jsx)(Kn.Box,{component:"span",sx:{minWidth:36,height:36,px:1,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:15,fontWeight:600,color:u.colors.textPrimary,bgcolor:u.colors.surfaceSubtle,border:`1px solid ${u.colors.border}`,borderRadius:1,fontVariantNumeric:"tabular-nums"},children:c})]},`${c}-${l}`))})}function gK({steps:e}){let u=xt();return(0,qt.jsx)(Kn.Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, minmax(0, 1fr))"},gap:{xs:1,sm:2},mt:1.5},children:e.map((c,l)=>(0,qt.jsxs)(Kn.Box,{sx:{position:"relative",minWidth:0,px:1.75,py:2.5,borderRadius:2,bgcolor:u.colors.surfaceSubtle,border:`1px solid ${u.colors.border}`,"&::before":{content:'""',position:"absolute",top:-1,left:12,right:12,height:3,borderRadius:"0 0 3px 3px",bgcolor:u.colors.accent,opacity:.85},"&::after":l<e.length-1?{content:'""',display:{xs:"none",sm:"block"},position:"absolute",top:"50%",right:-12,width:8,height:8,mt:"-4px",borderTop:`2px solid ${u.colors.borderStrong}`,borderRight:`2px solid ${u.colors.borderStrong}`,transform:"rotate(45deg)"}:void 0},children:[(0,qt.jsxs)(Kn.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[(0,qt.jsx)(Kn.Box,{sx:{flexShrink:0,width:26,height:26,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:500,lineHeight:1,bgcolor:u.colors.accent,color:u.colors.accentContrast,fontVariantNumeric:"tabular-nums"},children:l+1}),(0,qt.jsx)(Kn.Box,{sx:{minWidth:0,fontSize:20,fontWeight:500,color:u.colors.textStrong,lineHeight:1.3,letterSpacing:"-0.01em"},children:c.title})]}),(0,qt.jsx)(Kn.Box,{sx:{mt:1.5,fontSize:15,lineHeight:1.5,color:u.colors.textPrimary,wordBreak:"keep-all"},children:c.desc})]},c.title))})}var ZH="70vh",bK=24,yK=44,UH=`calc((${ZH} - ${bK*2+yK}px) / var(--mfd-font-scale, 1))`,vK=148;function kK({items:e}){let u=xt();return(0,qt.jsx)(Kn.Box,{sx:{mt:1.5,display:"grid",gridTemplateColumns:{xs:"1fr",sm:`${vK}px minmax(0, 1fr)`},fontSize:15,lineHeight:1.6,color:u.colors.textPrimary,border:`1px solid ${u.colors.border}`,borderRadius:1.5,overflow:"hidden","& > *":{px:1.5,py:1.35,borderTop:`1px solid ${u.colors.border}`},"& > *:nth-of-type(even)":{borderLeft:{sm:`1px solid ${u.colors.border}`}},"& > *:nth-of-type(1)":{borderTop:0},"& > *:nth-of-type(2)":{borderTop:{xs:`1px solid ${u.colors.border}`,sm:0}}},children:e.map(c=>(0,qt.jsxs)(Gm.Fragment,{children:[(0,qt.jsx)(Kn.Box,{sx:{fontWeight:500,color:u.colors.textStrong,wordBreak:"keep-all",bgcolor:u.colors.surfaceSubtle,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center"},children:c.term}),(0,qt.jsx)(Kn.Box,{sx:{wordBreak:"keep-all"},children:Vm(c.desc)})]},c.term))})}function xK({topic:e}){ue();let u=xt();return(0,qt.jsxs)(Kn.Box,{component:"section",sx:{py:{xs:3,sm:4},borderBottom:`1px solid ${u.colors.border}`,"&:last-of-type":{pb:0,borderBottom:0}},children:[(0,qt.jsxs)(Kn.Box,{component:"h3",sx:{m:0,mb:1.75,fontSize:24,fontWeight:500,letterSpacing:"-0.01em",lineHeight:1.3,color:u.colors.textStrong,wordBreak:"keep-all",display:"flex",alignItems:"center",flexWrap:"wrap"},children:[e.title,e.subtitle?(0,qt.jsxs)(qt.Fragment,{children:[(0,qt.jsx)(KH.default,{sx:{fontSize:22,color:u.colors.textMuted,mx:1,flexShrink:0}}),(0,qt.jsx)(Kn.Box,{component:"span",sx:{fontSize:18,fontWeight:400,color:u.colors.textPrimary},children:e.subtitle})]}):null]}),e.lead?(0,qt.jsx)(Kn.Box,{sx:{fontSize:15.5,lineHeight:1.65,color:u.colors.textPrimary,wordBreak:"keep-all"},children:Vm(e.lead)}):null,e.steps?.length?(0,qt.jsx)(gK,{steps:e.steps}):null,e.items?.length?(0,qt.jsx)(kK,{items:e.items}):null,e.lines?.length?(0,qt.jsx)(Kn.Box,{component:"ul",sx:{m:0,mt:e.lead||e.steps||e.items?1.25:0,pl:2.5,display:"flex",flexDirection:"column",gap:.5,fontSize:15,lineHeight:1.6,color:u.colors.textPrimary,wordBreak:"keep-all"},children:e.lines.map((c,l)=>(0,qt.jsx)("li",{children:Vm(c)},l))}):null]})}function wK({open:e,onClose:u,views:c,features:l={},initialTab:n}){ue();let a=xt(),{modals:r,activeTabIndex:t,setActiveTabIndex:o}=WH({open:e,onClose:u,features:l,initialTab:n}),d=h=>!h||l[h]!==!1,i=Pl(c),s=jH(bu).filter(h=>d(h.feature)).map(h=>({id:h.id,tabTitle:h.tabTitle,showTitle:!1,children:h.id==="shortcuts"?(0,qt.jsx)(Kn.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:UH,maxHeight:UH,px:.5},children:(0,qt.jsx)(Kn.Box,{sx:{display:"grid",gridTemplateColumns:"auto auto",columnGap:2.5,rowGap:1.75,alignItems:"center",fontSize:17,fontWeight:500,color:a.colors.textPrimary},children:i.map(f=>(0,qt.jsxs)(Gm.Fragment,{children:[(0,qt.jsx)(pK,{keys:f.keys}),(0,qt.jsx)("span",{children:f.description})]},f.keys))})}):(0,qt.jsxs)(Kn.Box,{sx:{display:"flex",flexDirection:"column",px:.5},children:[h.intro?(0,qt.jsx)(Kn.Box,{sx:{p:2,borderRadius:2,bgcolor:a.colors.accentSoft,color:a.colors.textStrong,fontSize:15.5,lineHeight:1.65,wordBreak:"keep-all"},children:Vm(h.intro)}):null,h.topics.filter(f=>d(f.feature)).map(f=>(0,qt.jsx)(xK,{topic:f},f.title))]})}));return(0,qt.jsx)(YH.FormDialog,{open:r.dialog.isOpen,onClose:r.dialog.close,maxWidth:"md",title:I("manual.dialogTitle"),locale:Pt(),titleIcons:{delete:{visible:!1}},tabs:{visible:!0,switchContent:!0},activeTabValue:t,onTabChange:o,fixedHeight:"70vh",maxContentHeight:ZH,sectionContentPaddingTop:0,fontScale:{enabled:!0},fontScaleKey:"taskbox-manual",sections:s,actions:{showCancelButton:!1,right:(0,qt.jsx)(Kn.Button,{variant:"contained",onClick:r.dialog.close,sx:{minWidth:80},children:I("common.close")})}})}pn();var Os=require("react"),St=require("@mui/material"),xg=require("@ehfuse/mui-form-dialog"),Ym=v(require("@mui/icons-material/Add"),1),eW=v(require("@mui/icons-material/ArrowRightAlt"),1),tW=v(require("@mui/icons-material/BoltOutlined"),1),nW=v(require("@mui/icons-material/Close"),1),rW=v(require("@mui/icons-material/EditOutlined"),1),Er=require("@ehfuse/mui-form-controls");var yu=require("react"),Km=require("@ehfuse/forma"),vg=require("@ehfuse/alerts");_e();var Ml=[{value:"due_date",get label(){return I("col.due")}},{value:"start_date",get label(){return I("col.startTime")}},{value:"priority",get label(){return I("col.priority")}},{value:"manager_account_seq",get label(){return I("col.owner")}},{value:"receiver_account_seqs",get label(){return I("col.cc")}},{value:"label_keys",get label(){return I("dialog.label")}},{value:"group_seq",get label(){return I("col.project")}},{value:"sprint_seq",get label(){return I("col.goal")}},{value:"content",get label(){return I("common.content")}},{value:"note",get label(){return I("col.note")}}];function Um(){return{editSeq:0,name:"",trigger:"created",enabled:!0,sort_no:0,condition:{},action:{}}}function kg(e){return e.filter(u=>!u.archived).map(u=>({value:String(si(u.key)),label:u.label}))}function $m(e){return e.map(u=>({value:u.key,label:u.name}))}function QH(e){ue();let u=(0,yu.useRef)(e);u.current=e;let c=(0,Km.useGlobalForm)({formId:Dt("taskbox-rule-form"),initialValues:Um(),onValidate:M=>M.name.trim()?Object.keys(M.action??{}).length===0?((0,vg.ErrorAlert)({message:I("rule.addAction")}),!1):!0:((0,vg.ErrorAlert)({message:I("rule.enterName")}),!1),onSubmit:async M=>{let{editSeq:N,...z}=M,W=N>0?z.sort_no:u.current.rules.reduce((C,B)=>Math.max(C,B.sort_no),0)+1,F=N>0?await u.current.onUpdate(N,{...z,sort_no:W}):await u.current.onCreate({...z,sort_no:W});return F&&l.form.close(),F}}),l={list:li({modalId:Dt("taskbox-rule-manage"),open:e.open,onClose:()=>u.current.onClose()}),form:(0,Km.useModal)({modalId:Dt("taskbox-rule-edit"),onClose:()=>c.setFormValues(Um())})},n=(0,yu.useRef)(l.form);n.current=l.form,(0,yu.useEffect)(()=>{if(e.open)return;let M=window.setTimeout(()=>{n.current.isOpen&&n.current.close(),c.setFormValues(Um())},500);return()=>window.clearTimeout(M)},[e.open]);let a=()=>({...c.getFormValue("condition")??{}}),r=()=>({...c.getFormValue("action")??{}}),t=(M,N)=>{let z=a();N===""||N===void 0||N===null?delete z[M]:z[M]=N,c.setFormValue("condition",z)},o=(M,N)=>{let z=r();N===""||N===void 0||N===null?delete z[M]:z[M]=N,c.setFormValue("action",z)},d=()=>{c.setFormValues(Um()),l.form.open()},i=M=>{c.setFormValues({editSeq:M.seq,name:M.name,trigger:M.trigger,enabled:M.enabled,sort_no:M.sort_no,condition:{...M.condition,...M.trigger==="field_changed"&&M.condition.changed_field===void 0?{changed_field:Ml[0]?.value??""}:{}},action:{...M.action}}),l.form.open()},s=M=>{let N=a();M!=="status_changed"&&(delete N.from_status,delete N.to_status),M!=="overdue"&&delete N.overdue_days,M!=="field_changed"&&delete N.changed_field,M!=="commented"&&(delete N.comment_contains,delete N.comment_by_others),M==="field_changed"&&N.changed_field===void 0&&(N.changed_field=Ml[0]?.value??""),c.setFormValues({trigger:M,condition:N})},h=async M=>{let N=u.current.onPickAccount;if(!N)return;let z=a(),W=M==="manager_account"?z.manager_account_seq??0:z.receiver_account_seq??0,F=await N(W,M==="manager_account"?I("col.owner"):I("col.cc"));if(!F)return;let C=a();M==="manager_account"?(C.manager_account_seq=F.accountSeq,C.manager_name=F.name):(C.receiver_account_seq=F.accountSeq,C.receiver_name=F.name),c.setFormValue("condition",C)},f=M=>{let N=kg(u.current.customTabs),z=$m(u.current.statusOptions);M==="group_seq"?t("group_seq",Number(N[0]?.value)||0):M==="kind"?t("is_bug",!0):M==="priority"?t("priority","high"):M==="label_key"?t("label_key",z[0]?.value??""):M==="title_contains"?c.setFormValue("condition",{...a(),title_contains:""}):M==="manager_empty"?t("manager_empty",!0):M==="manager_account"||M==="receiver_account"?h(M):M==="from_status"?t("from_status",ho[0]?.key??""):M==="to_status"?t("to_status",ho[0]?.key??""):M==="changed_field"?t("changed_field",Ml[0]?.value??""):M==="comment_contains"?c.setFormValue("condition",{...a(),comment_contains:""}):M==="comment_by_others"?t("comment_by_others",!0):M==="overdue_days"&&t("overdue_days",1)},m=M=>{if(M==="kind"){t("is_bug",""),t("is_event","");return}if(M==="manager_account"){t("manager_account_seq",""),t("manager_name","");return}if(M==="receiver_account"){t("receiver_account_seq",""),t("receiver_name","");return}t(M,"")},b=M=>{t("is_bug",M?!0:""),t("is_event",M?"":!0)},g=async M=>{let N=u.current.onPickAccount;if(!N)return;let z=r(),W=M==="assign_manager"?z.assign_manager_account_seq??0:M==="add_receiver"?z.add_receiver_account_seq??0:z.notify_account_seq??0,F=await N(W,M==="assign_manager"?I("col.owner"):M==="add_receiver"?I("col.cc"):I("rule.notifyTarget"));if(!F)return;let C=r();M==="assign_manager"?(C.assign_manager_account_seq=F.accountSeq,C.assign_manager_name=F.name):M==="add_receiver"?(C.add_receiver_account_seq=F.accountSeq,C.add_receiver_name=F.name):(C.notify_account_seq=F.accountSeq,C.notify_name=F.name),c.setFormValue("action",C)};return{form:c,modals:l,actions:{openCreate:d,openEdit:i,changeTrigger:s,setCondition:t,setAction:o,addCondition:f,removeCondition:m,changeKind:b,pickConditionAccount:h,addAction:M=>{let N=$m(u.current.statusOptions);if(M==="set_status")o("set_status",ho[0]?.key??"");else if(M==="set_priority")o("set_priority","high");else if(M==="add_label_key")o("add_label_key",N[0]?.value??"");else if(M==="apply_content_template"){let z=u.current.contentTemplates[0];c.setFormValue("action",{...r(),apply_content_template_seq:z?.seq??0,apply_content_template_name:z?.name??""})}else g(M)},removeAction:M=>{M==="assign_manager"?(o("assign_manager_account_seq",""),o("assign_manager_name","")):M==="add_receiver"?(o("add_receiver_account_seq",""),o("add_receiver_name","")):M==="apply_content_template"?(o("apply_content_template_seq",""),o("apply_content_template_name","")):M==="notify"?(o("notify_account_seq",""),o("notify_name",""),o("notify_message","")):o(M,"")},pickAccountFor:g,selectContentTemplate:M=>{let N=u.current.contentTemplates.find(z=>String(z.seq)===String(M));c.setFormValue("action",{...r(),apply_content_template_seq:N?.seq??0,apply_content_template_name:N?.name??""})},toggleRule:(M,N)=>u.current.onToggle(M,N),removeRule:M=>u.current.onRemove(M)}}}_e();var He=require("react/jsx-runtime"),wg=[{value:"created",get label(){return I("rule.trigger.created")},get hint(){return I("rule.trigger.createdHint")}},{value:"status_changed",get label(){return I("rule.trigger.statusChanged")},get hint(){return I("rule.trigger.statusChangedHint")}},{value:"commented",get label(){return I("rule.trigger.commented")},get hint(){return I("rule.trigger.commentedHint")}},{value:"manager_assigned",get label(){return I("rule.trigger.managerAssigned")},get hint(){return I("rule.trigger.managerAssignedHint")}},{value:"attachment_added",get label(){return I("rule.trigger.attached")},get hint(){return I("rule.trigger.attachedHint")}},{value:"field_changed",get label(){return I("rule.trigger.fieldChanged")},get hint(){return I("rule.trigger.fieldChangedHint")}},{value:"overdue",get label(){return I("rule.trigger.overdue")},get hint(){return I("rule.trigger.overdueHint")}}],Zm=[{value:"high",get label(){return I("priority.high")}},{value:"medium",get label(){return I("priority.medium")}},{value:"low",get label(){return I("priority.low")}}];function Xm(e){return ho.find(u=>u.key===e)?.name??e}function TK(e,u,c){let{condition:l,action:n}=e,a=[];if(l.group_seq){let o=u.find(d=>si(d.key)===l.group_seq);a.push(I("rule.sum.project",{label:o?.label??`#${l.group_seq}`}))}l.is_bug===!0&&a.push(I("rule.sum.bugOnly")),l.is_event===!0&&a.push(I("rule.sum.eventOnly")),l.priority&&a.push(I("rule.sum.priority",{value:Zm.find(o=>o.value===l.priority)?.label})),l.label_key&&a.push(I("rule.sum.label",{value:c.find(o=>o.key===l.label_key)?.name??l.label_key})),l.title_contains&&a.push(I("rule.sum.titleContains",{title_contains:l.title_contains})),l.status&&a.push(I("rule.sum.status",{value:Xm(l.status)})),l.from_status&&a.push(I("rule.sum.fromStatus",{value:Xm(l.from_status)})),l.to_status&&a.push(I("rule.sum.toStatus",{value:Xm(l.to_status)})),l.manager_empty===!0&&a.push(I("rule.sum.noOwner")),l.manager_empty===!1&&a.push(I("rule.sum.hasOwner")),l.manager_account_seq&&a.push(I("rule.sum.owner",{manager_name:l.manager_name||I("rule.accountNo",{manager_account_seq:l.manager_account_seq})})),l.receiver_account_seq&&a.push(I("rule.sum.ccIncludes",{receiver_name:l.receiver_name||I("rule.accountNo2",{receiver_account_seq:l.receiver_account_seq})})),l.changed_field&&a.push(I("rule.sum.fieldChanged",{value:Ml.find(o=>o.value===l.changed_field)?.label??l.changed_field})),l.comment_contains&&a.push(I("rule.sum.commentContains",{comment_contains:l.comment_contains})),l.comment_by_others===!0&&a.push(I("rule.sum.commentByOthers")),typeof l.overdue_days=="number"&&a.push(I("rule.sum.overdueDays",{overdue_days:l.overdue_days}));let r=[];n.set_status&&r.push(I("rule.sum.status",{value:Xm(n.set_status)})),n.set_priority&&r.push(I("rule.sum.priority",{value:Zm.find(o=>o.value===n.set_priority)?.label})),n.assign_manager_account_seq&&r.push(I("rule.sum.setOwner",{assign_manager_name:n.assign_manager_name||I("rule.specified")})),n.add_receiver_account_seq&&r.push(I("rule.sum.addCc",{add_receiver_name:n.add_receiver_name||I("rule.specified")})),n.add_label_key&&r.push(I("rule.sum.addLabel",{value:c.find(o=>o.key===n.add_label_key)?.name??n.add_label_key})),n.apply_content_template_seq&&r.push(I("rule.sum.applyTemplate",{apply_content_template_name:n.apply_content_template_name||I("rule.specified")})),n.notify_account_seq&&r.push(I("rule.sum.notify"));let t=wg.find(o=>o.value===e.trigger)?.label??e.trigger;return{left:a.length>0?`${t} \xB7 ${a.join(", ")}`:t,right:r.join(", ")||I("rule.sum.noAction")}}var JH={fontSize:16,fontWeight:700,color:"#37352f"},SK={display:"flex",alignItems:"center",gap:1},CK={width:104,flexShrink:0,fontSize:16,color:"#37352f"};function _K({open:e,rules:u,customTabs:c,statusOptions:l,contentTemplates:n=[],onPickAccount:a,onClose:r,onCreate:t,onUpdate:o,onToggle:d,onRemove:i}){ue();let s=QH({open:e,rules:u,customTabs:c,statusOptions:l,contentTemplates:n,onPickAccount:a,onClose:r,onCreate:t,onUpdate:o,onToggle:d,onRemove:i}),{form:h,actions:f}=s,m=s.modals.list,b=s.modals.form,{setCondition:g,setAction:w,removeCondition:S,removeAction:O,pickConditionAccount:P,pickAccountFor:j,changeTrigger:M}=f,N=h.isSubmitting,z=(0,Os.useRef)(null),[W,F]=(0,Os.useState)(null),[C,B]=(0,Os.useState)(null);(0,Os.useEffect)(()=>{if(!b.isOpen)return;let A=window.setTimeout(()=>z.current?.focus(),120);return()=>window.clearTimeout(A)},[b.isOpen]);let R=Number(h.useValue("editSeq")??0)>0,p=h.useValue("trigger")??"created",y=$m(l),x=ho.map(A=>({value:A.key,label:A.name})),k=kg(c),T=h.useValue("condition")??{},_=h.useValue("action")??{},D=T.is_bug!==void 0||T.is_event!==void 0,H=[...T.group_seq===void 0&&k.length>0?[{key:"group_seq",label:I("rule.cond.project")}]:[],...D?[]:[{key:"kind",label:I("rule.cond.kind")}],...T.priority===void 0?[{key:"priority",label:I("rule.cond.priority")}]:[],...T.label_key===void 0&&y.length>0?[{key:"label_key",label:I("rule.cond.label")}]:[],...T.title_contains===void 0?[{key:"title_contains",label:I("rule.cond.titleContains")}]:[],...T.manager_empty===void 0?[{key:"manager_empty",label:I("rule.cond.ownerEmpty")}]:[],...a&&T.manager_account_seq===void 0?[{key:"manager_account",label:I("rule.cond.owner")}]:[],...a&&T.receiver_account_seq===void 0?[{key:"receiver_account",label:I("rule.cond.ccIncludes")}]:[],...p==="status_changed"&&T.from_status===void 0?[{key:"from_status",label:I("rule.cond.fromStatus")}]:[],...p==="status_changed"&&T.to_status===void 0?[{key:"to_status",label:I("rule.cond.toStatus")}]:[],...p==="field_changed"&&T.changed_field===void 0?[{key:"changed_field",label:I("rule.cond.fieldChanged")}]:[],...p==="commented"&&T.comment_contains===void 0?[{key:"comment_contains",label:I("rule.cond.commentContains")}]:[],...p==="commented"&&T.comment_by_others===void 0?[{key:"comment_by_others",label:I("rule.cond.commentByOthers")}]:[],...p==="overdue"&&T.overdue_days===void 0?[{key:"overdue_days",label:I("rule.cond.overdueDays")}]:[]],V=A=>{F(null),f.addCondition(A)},U=[..._.set_status===void 0?[{key:"set_status",label:I("rule.act.setStatus")}]:[],..._.set_priority===void 0?[{key:"set_priority",label:I("rule.act.setPriority")}]:[],..._.add_label_key===void 0&&y.length>0?[{key:"add_label_key",label:I("rule.act.addLabel")}]:[],...a&&_.assign_manager_account_seq===void 0?[{key:"assign_manager",label:I("rule.act.assignOwner")}]:[],...a&&_.add_receiver_account_seq===void 0?[{key:"add_receiver",label:I("rule.act.addCc")}]:[],...n.length>0&&_.apply_content_template_seq===void 0?[{key:"apply_content_template",label:I("rule.act.applyTemplate")}]:[],...a&&_.notify_account_seq===void 0?[{key:"notify",label:I("rule.act.notify")}]:[]],L=A=>{B(null),f.addAction(A)},G=(A,q,$,Q)=>(0,He.jsxs)(St.Box,{sx:SK,children:[(0,He.jsx)(St.Box,{sx:CK,children:A}),(0,He.jsxs)(St.Box,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:Q?"column":"row",alignItems:Q?"stretch":"center",gap:Q?.5:1},children:[q,Q?(0,He.jsx)(St.Box,{sx:{fontSize:13.5,color:"#37352f"},children:Q}):null]}),(0,He.jsx)(St.Tooltip,{title:I("rule.removeRow"),arrow:!0,disableInteractive:!0,children:(0,He.jsx)(St.IconButton,{size:"small","aria-label":I("rule.removeRowAria",{label:A}),onClick:$,children:(0,He.jsx)(nW.default,{sx:{fontSize:16}})})})]}),E=()=>(0,He.jsxs)(St.Box,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[(0,He.jsx)(Er.ClearTextField,{size:"medium",label:I("rule.ruleName"),inputRef:z,placeholder:I("rule.ruleNamePlaceholder"),name:"name",form:h}),(0,He.jsx)(St.Box,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap"},children:wg.map(A=>{let q=p===A.value;return(0,He.jsx)(St.Button,{disableElevation:!0,variant:q?"contained":"outlined",color:q?"primary":"inherit",onClick:()=>M(A.value),sx:{borderRadius:99,px:1.75,...q?{}:{color:"#57564f",borderColor:"#d9d9d6"}},children:A.label},A.value)})}),(0,He.jsx)(St.Box,{sx:{fontSize:13,color:"#787774",mt:-.5},children:wg.find(A=>A.value===p)?.hint}),(0,He.jsxs)(St.Box,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[(0,He.jsx)(St.Box,{sx:JH,children:I("rule.whenTitle")}),H.length>0?(0,He.jsx)(St.Button,{size:"small",startIcon:(0,He.jsx)(Ym.default,{sx:{fontSize:16}}),onClick:A=>F(A.currentTarget),sx:{color:"#2563eb",minWidth:0},children:I("rule.addCondition")}):null]}),T.group_seq!==void 0?G(I("col.project"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",value:String(T.group_seq),options:k,onChange:A=>g("group_seq",Number(A.target.value)||"")}),()=>S("group_seq")):null,D?G(I("col.kind"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",value:T.is_bug?"bug":"event",options:[{value:"bug",label:I("rule.sum.bugOnly")},{value:"event",label:I("rule.sum.eventOnly")}],onChange:A=>{let q=A.target.value==="bug";g("is_bug",q?!0:""),g("is_event",q?"":!0)}}),()=>S("kind")):null,T.priority!==void 0?G(I("col.priority"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"condition.priority",form:h,options:Zm}),()=>S("priority")):null,T.label_key!==void 0?G(I("dialog.label"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"condition.label_key",form:h,options:y}),()=>S("label_key")):null,T.title_contains!==void 0?G(I("common.title"),(0,He.jsx)(Er.ClearTextField,{size:"medium",fullWidth:!0,placeholder:I("rule.titleWordPlaceholder"),name:"condition.title_contains",form:h}),()=>S("title_contains")):null,T.manager_empty!==void 0?G(I("col.owner"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",value:T.manager_empty?"empty":"assigned",options:[{value:"empty",label:I("common.none")},{value:"assigned",label:I("rule.present")}],onChange:A=>g("manager_empty",A.target.value==="empty")}),()=>S("manager_empty")):null,T.manager_account_seq!==void 0?G(I("col.owner"),(0,He.jsx)(St.Button,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{P("manager_account")},children:T.manager_name||I("rule.accountNo",{manager_account_seq:T.manager_account_seq})}),()=>S("manager_account")):null,T.receiver_account_seq!==void 0?G(I("col.cc"),(0,He.jsx)(St.Button,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{P("receiver_account")},children:T.receiver_name||I("rule.accountNo2",{receiver_account_seq:T.receiver_account_seq})}),()=>S("receiver_account")):null,T.from_status!==void 0?G(I("rule.fromStatus"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"condition.from_status",form:h,options:x}),()=>S("from_status")):null,T.to_status!==void 0?G(I("rule.toStatus"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"condition.to_status",form:h,options:x}),()=>S("to_status")):null,T.changed_field!==void 0?G(I("rule.changedField"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"condition.changed_field",form:h,options:Ml}),()=>S("changed_field")):null,T.comment_contains!==void 0?G(I("rule.commentWord"),(0,He.jsx)(Er.ClearTextField,{size:"medium",fullWidth:!0,placeholder:I("rule.commentWordPlaceholder"),name:"condition.comment_contains",form:h}),()=>S("comment_contains")):null,T.comment_by_others!==void 0?G(I("rule.commentAuthor"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",value:T.comment_by_others?"others":"any",options:[{value:"others",label:I("rule.notOwner")},{value:"any",label:I("rule.anyone")}],onChange:A=>g("comment_by_others",A.target.value==="others")}),()=>S("comment_by_others")):null,T.overdue_days!==void 0?G(I("rule.elapsedDays"),(0,He.jsx)(Er.ClearTextField,{size:"medium",fullWidth:!0,type:"number",value:String(T.overdue_days),onChange:A=>g("overdue_days",Math.max(0,Number(A.target.value)||0)),label:I("rule.overdueDaysLabel")}),()=>S("overdue_days")):null,Object.keys(T).length===0?(0,He.jsx)(St.Box,{sx:{fontSize:13.5,color:"#9a9a97"},children:I("rule.noConditionHint")}):null,(0,He.jsxs)(St.Box,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[(0,He.jsx)(St.Box,{sx:JH,children:I("rule.doTitle")}),U.length>0?(0,He.jsx)(St.Button,{size:"small",startIcon:(0,He.jsx)(Ym.default,{sx:{fontSize:16}}),onClick:A=>B(A.currentTarget),sx:{color:"#2563eb",minWidth:0},children:I("rule.addActionButton")}):null]}),_.set_status!==void 0?G(I("col.status"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"action.set_status",form:h,options:x}),()=>O("set_status")):null,_.set_priority!==void 0?G(I("col.priority"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"action.set_priority",form:h,options:Zm}),()=>O("set_priority")):null,_.apply_content_template_seq!==void 0?G(I("rule.bodyTemplate"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",value:String(_.apply_content_template_seq),options:n.map(A=>({value:String(A.seq),label:A.name})),onChange:A=>f.selectContentTemplate(String(A.target.value))}),()=>O("apply_content_template"),I("rule.bodyTemplateHint")):null,_.add_label_key!==void 0?G(I("dialog.label"),(0,He.jsx)(Er.LabelSelect,{size:"medium",fullWidth:!0,label:"",name:"action.add_label_key",form:h,options:y}),()=>O("add_label_key")):null,_.assign_manager_account_seq!==void 0?G(I("col.owner"),(0,He.jsx)(St.Button,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{j("assign_manager")},children:_.assign_manager_name||I("rule.accountNo3",{assign_manager_account_seq:_.assign_manager_account_seq})}),()=>O("assign_manager")):null,_.add_receiver_account_seq!==void 0?G(I("col.cc"),(0,He.jsx)(St.Button,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{j("add_receiver")},children:_.add_receiver_name||I("rule.accountNo4",{add_receiver_account_seq:_.add_receiver_account_seq})}),()=>O("add_receiver")):null,_.notify_account_seq!==void 0?G(I("rule.notification"),(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(St.Button,{size:"medium",variant:"outlined",color:"inherit",onClick:()=>{j("notify")},sx:{flexShrink:0},children:_.notify_name||I("rule.accountNo5",{notify_account_seq:_.notify_account_seq})}),(0,He.jsx)(Er.ClearTextField,{size:"medium",fullWidth:!0,placeholder:I("rule.notifyMessagePlaceholder"),value:_.notify_message??"",onChange:A=>w("notify_message",A.target.value)})]}),()=>O("notify")):null,Object.keys(_).length===0?(0,He.jsx)(St.Box,{sx:{fontSize:13.5,color:"#9a9a97"},children:I("rule.pickActionHint")}):null,(0,He.jsx)(St.Menu,{transitionDuration:0,anchorEl:W,open:!!W,onClose:()=>F(null),children:H.map(A=>(0,He.jsx)(St.MenuItem,{dense:!0,onClick:()=>V(A.key),sx:{fontSize:14},children:A.label},A.key))}),(0,He.jsx)(St.Menu,{transitionDuration:0,anchorEl:C,open:!!C,onClose:()=>B(null),children:U.map(A=>(0,He.jsx)(St.MenuItem,{dense:!0,onClick:()=>L(A.key),sx:{fontSize:14},children:A.label},A.key))})]});return(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(xg.FormDialog,{open:m.isOpen,onClose:m.close,maxWidth:"sm",title:I("rule.title"),locale:Pt(),titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-rule-manage",tabs:{visible:!1},contentPaddingX:0,contentTopPadding:0,contentBottomPadding:0,sectionContentPaddingTop:0,sections:[{id:"rules",title:"",showTitle:!1,children:(0,He.jsxs)(St.Box,{sx:{display:"flex",flexDirection:"column",px:2.5,py:2},children:[u.length===0?(0,He.jsxs)(St.Box,{sx:{py:4,display:"flex",flexDirection:"column",alignItems:"center",gap:2,color:"#9a9a97"},children:[(0,He.jsx)(tW.default,{sx:{fontSize:48,color:"#d9d9d6"}}),(0,He.jsx)(St.Box,{sx:{fontSize:15},children:I("rule.noRules")})]}):null,u.map(A=>(0,He.jsxs)(St.Box,{sx:{display:"flex",alignItems:"center",gap:2,py:1,"&:not(:last-of-type)":{borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`},opacity:A.enabled?1:.5},children:[(0,He.jsx)(St.Tooltip,{title:A.enabled?I("rule.enabled"):I("rule.disabled"),arrow:!0,disableInteractive:!0,children:(0,He.jsx)(St.Switch,{size:"small",inputProps:{"aria-label":I("rule.enableAria",{name:A.name})},checked:A.enabled,onChange:(q,$)=>f.toggleRule(A.seq,$)})}),(0,He.jsxs)(St.Box,{sx:{flex:1,minWidth:0},children:[(0,He.jsx)(St.Box,{sx:{fontSize:16,fontWeight:600,color:"#37352f"},children:A.name}),(()=>{let q=TK(A,c,l);return(0,He.jsxs)(St.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5,fontSize:15,color:"#6f6f6c"},children:[(0,He.jsx)(St.Box,{component:"span",children:q.left}),(0,He.jsx)(eW.default,{sx:{fontSize:18,color:"#9a9a97",flexShrink:0}}),(0,He.jsx)(St.Box,{component:"span",children:q.right})]})})()]}),(0,He.jsx)(St.IconButton,{size:"small","aria-label":I("rule.editAria",{name:A.name}),onClick:()=>f.openEdit(A),children:(0,He.jsx)(rW.default,{sx:{fontSize:18}})}),(0,He.jsx)(St.IconButton,{size:"small","aria-label":I("rule.deleteAria",{name:A.name}),onClick:()=>f.removeRule(A.seq),children:(0,He.jsx)(Dr,{sx:{fontSize:18}})})]},A.seq))]})}],actions:{showCancelButton:!1,left:(0,He.jsx)(St.Button,{startIcon:(0,He.jsx)(Ym.default,{}),onClick:f.openCreate,sx:{color:"#2563eb"},children:I("rule.newRule")}),right:(0,He.jsx)(St.Button,{variant:"contained",onClick:m.close,children:I("common.close")})}}),(0,He.jsx)(xg.FormDialog,{open:b.isOpen,onClose:b.close,maxWidth:"sm",title:R?I("rule.editRule"):I("rule.newRule"),locale:Pt(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-rule-form",tabs:{visible:!1},sectionContentPaddingTop:0,sections:[{id:"rule-form",title:"",showTitle:!1,children:E()}],actions:{showCancelButton:!0,right:(0,He.jsx)(St.Button,{variant:"contained",onClick:()=>{h.submit()},disabled:N,children:R?I("common.edit"):I("rule.addRule")})}})]})}pn();var ui=require("react"),Qt=require("@mui/material");var dW=v(require("@mui/icons-material/Tune"),1),Sg=v(require("@mui/icons-material/Add"),1),mW=v(require("@mui/icons-material/EditOutlined"),1),hW=v(require("@mui/icons-material/ContentCopyOutlined"),1),fW=v(require("@mui/icons-material/DragIndicator"),1),pW=v(require("@mui/icons-material/PlaylistAddCheckOutlined"),1),ji=require("@dnd-kit/core"),Jm=require("@dnd-kit/modifiers"),Dl=require("@dnd-kit/sortable"),gW=require("@dnd-kit/utilities"),Cg=require("@ehfuse/mui-form-dialog"),Rl=require("@ehfuse/mui-form-controls"),bW=v(require("@ehfuse/overlay-scrollbar"),1);var vu=require("react"),Qm=require("@ehfuse/forma"),ku=require("@ehfuse/alerts");_e();var oW=0;function iW(){return oW+=1,`ti${oW}`}function Tg(){return{editSeq:0,name:"",description:"",group_seq:0,itemIds:[],items:{}}}function aW(){return{title:"",start_offset_days:0,due_offset_days:0,priority:"medium"}}function lW(e){ue();let u=(0,vu.useRef)(e);u.current=e;let c=(0,Qm.useGlobalForm)({formId:Dt("taskbox-template-form"),initialValues:Tg(),onValidate:d=>d.name.trim()?sW(d).length===0?((0,ku.ErrorAlert)({message:I("template.addItemRequired")}),!1):!0:((0,ku.ErrorAlert)({message:I("template.enterName")}),!1),onSubmit:async d=>{let i={name:d.name.trim(),description:d.description,group_seq:d.group_seq,items:sW(d)},s=d.editSeq>0?await u.current.onUpdate(d.editSeq,i):await u.current.onCreate(i);return s&&(l.form.close(),c.setFormValues(Tg())),s}}),l={list:li({modalId:Dt("taskbox-template-manage"),open:e.open,onClose:()=>u.current.onClose()}),form:(0,Qm.useModal)({modalId:Dt("taskbox-template-edit")})},n=(0,vu.useRef)(l.form);n.current=l.form,(0,vu.useEffect)(()=>{if(e.open)return;let d=window.setTimeout(()=>{n.current.isOpen&&n.current.close(),c.setFormValues(Tg())},500);return()=>window.clearTimeout(d)},[e.open]);let a=(d,i)=>{let s=i.items.map(()=>iW());c.setFormValues({editSeq:d,name:i.name,description:i.description??"",group_seq:i.group_seq??0,itemIds:s,items:Object.fromEntries(i.items.map((h,f)=>[s[f],{...h}]))}),l.form.open()},r=(d,i)=>({name:i,description:d.description??"",group_seq:d.group_seq??0,items:d.items.map(s=>({...s}))}),t=(d,i)=>{let s=c.getFormValue(`items.${d}`);c.setFormValue(`items.${d}`,{...s??aW(),...i})};return{form:c,modals:l,actions:{openCreate:()=>a(0,{name:"",description:"",group_seq:0,items:[]}),openEdit:d=>a(d.seq,r(d,d.name)),openDuplicate:d=>a(0,r(d,I("template.copyName",{name:d.name}))),closeForm:()=>l.form.close(),setItem:t,addItem:()=>{let d=iW();c.setFormValue(`items.${d}`,aW()),c.setFormValue("itemIds",[...c.getFormValue("itemIds")??[],d])},removeItem:d=>{let i=c.getFormValue("itemIds")??[];c.setFormValue("itemIds",i.filter(s=>s!==d))},moveItem:(d,i)=>{let s=[...c.getFormValue("itemIds")??[]],h=s.indexOf(d),f=s.indexOf(i);if(h<0||f<0||h===f)return;let[m]=s.splice(h,1);s.splice(f,0,m),c.setFormValue("itemIds",s)},pickItemManager:async d=>{let i=u.current.onPickAccount;if(!i)return;let s=c.getFormValue(`items.${d}`),h=await i(s?.manager_account_seq??0,I("col.owner"));h&&t(d,{manager_account_seq:h.accountSeq,manager_name:h.name})},clearItemManager:d=>t(d,{manager_account_seq:0,manager_name:""}),removeTemplate:async d=>{await(0,ku.ConfirmDialog)({title:I("template.deleteTemplate"),message:I("template.deleteConfirm",{name:d.name})})&&u.current.onRemove(d.seq)},runTemplate:d=>u.current.onRun?.(d)}}}function sW(e){return(e.itemIds??[]).map(u=>e.items?.[u]).filter(u=>!!u&&String(u.title??"").trim().length>0)}_e();var dt=require("react/jsx-runtime");var yW=()=>I("template.itemTitlePlaceholder"),vW=2;var kW=20,Nue=`${kW+vW*8}px`;function IK({id:e,children:u}){let{attributes:c,listeners:l,setNodeRef:n,transform:a,transition:r,isDragging:t}=(0,Dl.useSortable)({id:e});return(0,dt.jsx)(Qt.Box,{ref:n,sx:{transform:gW.CSS.Transform.toString(a),transition:r,...t?{opacity:.6,position:"relative",zIndex:1}:{}},children:u({handleProps:{...c,...l},dragging:t})})}function BK(e){return e.start_offset_days!==void 0||e.due_offset_days!==void 0||e.priority!==void 0&&e.priority!=="medium"||!!e.manager_account_seq||(e.label_keys?.length??0)>0||!!String(e.content??"").replace(/<[^>]*>/g,"").trim()||(e.checklist?.length??0)>0||!!String(e.note??"").trim()||!!e.visibility}function OK({id:e,index:u,isLast:c,form:l,actions:n,handleProps:a,onOpenProps:r}){ue();let t=l.useValue(`items.${e}`)??{},o=BK(t);return(0,dt.jsxs)(Qt.Box,{sx:{borderBottom:c?"none":"1px solid #f2f2f0",px:vW,py:1,display:"flex",alignItems:"center",gap:1},children:[(0,dt.jsx)(Qt.Box,{...a,"aria-label":I("template.reorderItem",{value:u+1}),sx:{display:"inline-flex",alignItems:"center",flexShrink:0,mr:1,color:"#c9c8c5",cursor:"grab","&:active":{cursor:"grabbing"},touchAction:"none",userSelect:"none"},children:(0,dt.jsx)(fW.default,{sx:{fontSize:kW}})}),(0,dt.jsx)(Rl.ClearTextField,{size:"medium",fullWidth:!0,placeholder:yW(),slotProps:{htmlInput:{"data-template-title":u}},name:`items.${e}.title`,form:l}),(0,dt.jsx)(Qt.Tooltip,{title:o?I("template.propsFilled"):I("template.props"),arrow:!0,disableInteractive:!0,children:(0,dt.jsx)(Qt.IconButton,{size:"medium","aria-label":I("template.itemProps",{value:u+1}),onClick:()=>r(e),sx:{flexShrink:0,color:o?"primary.main":"#9a9a97"},children:(0,dt.jsx)(dW.default,{sx:{fontSize:20}})})}),(0,dt.jsx)(Qt.Tooltip,{title:I("template.deleteItem"),arrow:!0,disableInteractive:!0,children:(0,dt.jsx)(Qt.IconButton,{size:"medium","aria-label":I("template.deleteItemAria",{value:u+1}),onClick:()=>n.removeItem(e),sx:{flexShrink:0},children:(0,dt.jsx)(Dr,{sx:{fontSize:18}})})})]})}function cW(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function uW(e,u){let c=l=>{let[n,a,r]=l.slice(0,10).split("-").map(Number);return Date.UTC(n,(a||1)-1,r||1)};return Math.round((c(u)-c(e))/864e5)}function AK({id:e,form:u,actions:c,customTabs:l,labels:n,onAddLabel:a,onPickAccount:r,onClose:t}){ue();let o=(0,ui.useRef)(e);o.current=e;let d=(0,ui.useRef)(t);d.current=t;let i=(0,ui.useRef)(cW()),s=Hs({formId:"taskbox-template-item-form",onSubmit:m=>{let b=o.current;if(!b)return!1;let g=i.current;return c.setItem(b,{title:String(m.title??"").trim(),content:m.content??"",start_offset_days:m.start_date?uW(g,m.start_date):void 0,due_offset_days:m.due_date?uW(g,m.due_date):void 0,priority:m.priority,label_keys:[...m.label_keys??[]],manager_account_seq:m.manager_account_seq||void 0,manager_name:m.manager_account_seq?m.manager_name:void 0,checklist:(m.checklist??[]).map(w=>w.label).filter(w=>w.trim().length>0),note:m.note??"",visibility:m.visibility,visibility_group_seq:m.visibility==="group"?m.visibility_group_seq:void 0}),d.current(),!0}}),h=u.useValue(e?`items.${e}`:"__none__")??{},f=m=>m===void 0?"":Dc(i.current,m);return(0,ui.useEffect)(()=>{e&&(i.current=cW(),s.setFormValues({start_date:f(h.start_offset_days),priority:h.priority??"medium",label_keys:[...h.label_keys??[]],note:h.note??"",...h.visibility?{visibility:h.visibility,visibility_group_seq:h.visibility_group_seq??0}:{},checklist:(h.checklist??[]).map(m=>({label:m,checked:!1}))}))},[e]),(0,dt.jsx)(rp,{open:!!e,onClose:t,form:s,statusOptions:n,customTabs:l,presetTitle:h.title??"",presetContent:h.content??"",presetDueDate:f(h.due_offset_days),presetManager:h.manager_account_seq?{name:h.manager_name??"",accountSeq:h.manager_account_seq}:null,hideTypeToggle:!0,hideProject:!0,hideMembers:!r,templateItem:!0,submitLabel:I("common.apply"),contentSyncKey:`template-${e??""}`,onAddLabelOption:a,onMemberEdit:m=>{m!=="manager"||!r||(async()=>{let b=Number(s.getFormValue("manager_account_seq"))||0,g=await r(b,I("col.owner"));g&&s.setFormValues({manager_account_seq:g.accountSeq,manager_name:g.name})})()}})}function EK({open:e,templates:u,customTabs:c,onPickAccount:l,onClose:n,onCreate:a,onUpdate:r,onRemove:t,onRun:o,labels:d=[],onAddLabel:i}){ue();let[s,h]=(0,ui.useState)(null),f=lW({open:e,templates:u,customTabs:c,onPickAccount:l,onClose:n,onCreate:a,onUpdate:r,onRemove:t,onRun:o}),{form:m,actions:b}=f,g=f.modals.list,w=f.modals.form,S=m.isSubmitting,O=Number(m.useValue("editSeq")??0),P=m.useValue("itemIds")??[],[j,M]=(0,ui.useState)(0),N=(0,ui.useRef)(null),z=(0,ui.useRef)(null),W=()=>{let k=z.current?.getScrollContainer()??null;if(k){k.scrollTop=k.scrollHeight;return}let T=N.current?.querySelectorAll("*")??[];for(let _ of Array.from(T))if(_.scrollHeight>_.clientHeight+1){_.scrollTop=_.scrollHeight;return}},F=()=>{let k=N.current;if(!k)return null;let T=k.querySelectorAll("input[data-template-title]"),_=T.length?T:k.querySelectorAll(`input[placeholder="${yW()}"]`);return _.length?_[_.length-1]:null};(0,ui.useEffect)(()=>{if(j===0)return;let k=0,T=0,_=()=>{W();let H=F();H&&document.activeElement!==H&&H.focus(),k+=1,!(H&&document.activeElement===H)&&k<8&&(T=window.setTimeout(_,50))},D=window.requestAnimationFrame(_);return()=>{window.cancelAnimationFrame(D),window.clearTimeout(T)}},[j]);let C=c.filter(k=>!k.archived).map(k=>({value:String(si(k.key)),label:k.label})),B=Number(m.useValue("group_seq")??0),R=(0,ji.useSensors)((0,ji.useSensor)(ji.PointerSensor,{activationConstraint:{distance:5}})),p=k=>{let T=String(k.active?.id??""),_=String(k.over?.id??"");!T||!_||T===_||b.moveItem(T,_)},y=(0,dt.jsx)(Qt.Box,{children:u.length===0?(0,dt.jsxs)(Qt.Box,{sx:{py:4,display:"flex",flexDirection:"column",alignItems:"center",gap:2,color:"#9a9a97"},children:[(0,dt.jsx)(pW.default,{sx:{fontSize:48,color:"#d9d9d6"}}),(0,dt.jsx)(Qt.Box,{sx:{fontSize:13.5},children:I("template.noTemplates")})]}):u.map(k=>(0,dt.jsxs)(Qt.Box,{sx:{display:"flex",alignItems:"center",gap:2.5,py:1.75,"&:not(:last-of-type)::after":{content:'""',display:"block",my:1.75,borderBottom:"1px solid #f0efed"}},children:[(0,dt.jsxs)(Qt.Box,{sx:{flex:1,minWidth:0},children:[(0,dt.jsx)(Qt.Box,{sx:{fontSize:18,fontWeight:600,color:"#37352f"},children:k.name}),(0,dt.jsxs)(Qt.Box,{sx:{fontSize:14,color:"#787774",mt:.25},children:[I("template.taskCount",{count:k.items.length}),k.description?` \xB7 ${k.description}`:""]})]}),o?(0,dt.jsx)(Qt.Button,{size:"medium",variant:"outlined",onClick:()=>b.runTemplate(k),sx:{flexShrink:0},children:I("template.run")}):null,(0,dt.jsx)(Qt.Tooltip,{title:I("common.edit"),arrow:!0,disableInteractive:!0,children:(0,dt.jsx)(Qt.IconButton,{size:"medium","aria-label":I("template.editAria",{name:k.name}),onClick:()=>b.openEdit(k),children:(0,dt.jsx)(mW.default,{sx:{fontSize:19}})})}),(0,dt.jsx)(Qt.Tooltip,{title:I("menu.duplicate"),arrow:!0,disableInteractive:!0,children:(0,dt.jsx)(Qt.IconButton,{size:"medium","aria-label":I("template.duplicateAria",{name:k.name}),onClick:()=>b.openDuplicate(k),children:(0,dt.jsx)(hW.default,{sx:{fontSize:18}})})}),(0,dt.jsx)(Qt.Tooltip,{title:I("common.delete"),arrow:!0,disableInteractive:!0,children:(0,dt.jsx)(Qt.IconButton,{size:"medium","aria-label":I("template.deleteAria",{name:k.name}),onClick:()=>{b.removeTemplate(k)},children:(0,dt.jsx)(Dr,{sx:{fontSize:18}})})})]},k.seq))}),x=(0,dt.jsxs)(Qt.Box,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,dt.jsx)(Rl.ClearTextField,{size:"medium",label:I("template.name"),placeholder:I("template.namePlaceholder"),fullWidth:!0,name:"name",form:m}),(0,dt.jsxs)(Qt.Box,{sx:{display:"grid",gridTemplateColumns:C.length>0?"1fr 1fr":"1fr",gap:2},children:[(0,dt.jsx)(Rl.ClearTextField,{size:"medium",label:I("googleEvent.description"),placeholder:I("template.descriptionPlaceholder"),fullWidth:!0,name:"description",form:m}),C.length>0?(0,dt.jsx)(Rl.LabelSelect,{size:"medium",fullWidth:!0,label:I("template.targetProject"),value:String(B),options:[{value:"0",label:os()},...C],onChange:k=>m.setFormValue("group_seq",Number(k.target.value)||0)}):null]}),(0,dt.jsxs)(Qt.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,dt.jsx)(Qt.Box,{sx:{fontSize:18,fontWeight:600,color:"#37352f"},children:I("template.items")}),(0,dt.jsx)(Qt.Box,{sx:{fontSize:14,color:"#37352f"},children:I("template.datesHint")})]}),P.length===0?(0,dt.jsx)(Qt.Box,{sx:{fontSize:14,color:"#9a9a97",py:2},children:I("template.noItemsHint")}):(0,dt.jsx)(Qt.Box,{ref:N,sx:{border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,overflow:"hidden"},children:(0,dt.jsx)(bW.default,{ref:z,style:{maxHeight:"min(560px, 52vh)"},thumb:{width:6},children:(0,dt.jsx)(ji.DndContext,{sensors:R,collisionDetection:ji.closestCenter,modifiers:[Jm.restrictToVerticalAxis,Jm.restrictToParentElement],onDragEnd:p,children:(0,dt.jsx)(Dl.SortableContext,{items:P,strategy:Dl.verticalListSortingStrategy,children:P.map((k,T)=>(0,dt.jsx)(IK,{id:k,children:({handleProps:_})=>(0,dt.jsx)(OK,{id:k,index:T,isLast:T===P.length-1,form:m,actions:b,handleProps:_,onOpenProps:h})},k))})})})})]});return(0,dt.jsxs)(dt.Fragment,{children:[(0,dt.jsx)(Cg.FormDialog,{open:g.isOpen,onClose:g.close,maxWidth:"md",title:I("template.title"),locale:Pt(),titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-template",tabs:{visible:!1},actions:{showCancelButton:!1,left:(0,dt.jsx)(Qt.Button,{startIcon:(0,dt.jsx)(Sg.default,{sx:{fontSize:18}}),onClick:b.openCreate,children:I("template.newTemplate")}),right:(0,dt.jsx)(Qt.Button,{variant:"contained",onClick:g.close,children:I("common.close")})},sectionContentPaddingTop:0,sections:[{id:"templates",title:"",showTitle:!1,children:y}]}),(0,dt.jsx)(Cg.FormDialog,{open:w.isOpen,onClose:w.close,maxWidth:"md",title:O>0?I("template.editTemplate"):I("template.newTemplate"),locale:Pt(),backdropClick:!1,fontScale:{enabled:!0},fontScaleKey:"taskbox-task-template-form",titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},tabs:{visible:!1},actions:{showCancelButton:!0,left:(0,dt.jsx)(Qt.Button,{startIcon:(0,dt.jsx)(Sg.default,{sx:{fontSize:18}}),onClick:()=>{b.addItem(),M(k=>k+1)},children:I("template.addItem")}),right:(0,dt.jsx)(Qt.Button,{variant:"contained",disabled:S,onClick:()=>{m.submit()},children:I("common.save")})},sectionContentPaddingTop:0,sections:[{id:"template-form",title:"",showTitle:!1,children:x}]}),(0,dt.jsx)(AK,{id:w.isOpen?s:null,form:m,actions:b,customTabs:c,labels:d,onAddLabel:i,onPickAccount:l,onClose:()=>h(null)})]})}pn();var Fr=require("@mui/material"),TW=require("@ehfuse/mui-form-dialog"),SW=require("@ehfuse/mui-form-controls"),CW=v(require("@ehfuse/overlay-scrollbar"),1);var eh=require("react"),xW=require("@ehfuse/forma");function wW(e){let u=(0,eh.useRef)(e);u.current=e;let c=(0,eh.useRef)(e.template);e.template&&(c.current=e.template);let l=e.template??c.current,n=(0,eh.useRef)(l);n.current=l;let a=(0,xW.useGlobalForm)({formId:Dt("taskbox-template-run-form"),initialValues:{baseDate:e.todayStr},onValidate:o=>u.current.running||!n.current?!1:Nc(n.current,o.baseDate).length>0,onSubmit:o=>n.current?(u.current.onRun(Nc(n.current,o.baseDate),o.baseDate),!0):!1}),r={run:li({modalId:Dt("taskbox-template-run"),open:e.open,onClose:()=>u.current.onClose(),onOpen:()=>a.setFormValues({baseDate:u.current.todayStr})})},t=o=>l?Nc(l,o):[];return{form:a,modals:r,template:l,running:!!e.running,planTasks:t}}_e();var yr=require("react/jsx-runtime");function PK(e){ue();let u=wW(e),{form:c,running:l}=u,n=u.modals.run,a=u.template,r=String(c.useValue("baseDate")??""),t=u.planTasks(r);return(0,yr.jsx)(TW.FormDialog,{open:n.isOpen,onClose:n.close,maxWidth:"md",title:a?I("template.runTitle",{name:a.name}):I("template.runTemplate"),locale:Pt(),backdropClick:!1,titleIcons:{delete:{visible:!1},print:{visible:!1},share:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-template-run",tabs:{visible:!1},sectionContentPaddingTop:0,actions:{showCancelButton:!0,right:(0,yr.jsx)(Fr.Button,{variant:"contained",disabled:l||t.length===0,onClick:()=>{c.submit()},children:l?I("template.creating"):I("template.createCount",{length:t.length})})},sections:[{id:"template-run",title:"",showTitle:!1,children:(0,yr.jsxs)(Fr.Box,{sx:{display:"flex",flexDirection:"column",gap:2},children:[(0,yr.jsxs)(Fr.Box,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,yr.jsx)(Fr.Box,{sx:{width:72,flexShrink:0,fontSize:16,color:"#37352f"},children:I("template.baseDate")}),(0,yr.jsx)(SW.DateTextField,{size:"medium",fullWidth:!0,name:"baseDate",form:c})]}),(0,yr.jsx)(Fr.Box,{sx:{fontSize:14.5,color:"#37352f"},children:I("template.runHint")}),(0,yr.jsxs)(Fr.Box,{sx:{border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,overflow:"hidden"},children:[(0,yr.jsxs)(Fr.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,bgcolor:"#fafaf9",borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,fontSize:13.5,fontWeight:600,color:"#37352f"},children:[(0,yr.jsx)(Fr.Box,{sx:{flex:1,minWidth:0},children:I("template.task")}),(0,yr.jsx)(Fr.Box,{sx:{width:88,flexShrink:0,textAlign:"center"},children:I("board.start")}),(0,yr.jsx)(Fr.Box,{sx:{width:88,flexShrink:0,textAlign:"center"},children:I("board.due")}),(0,yr.jsx)(Fr.Box,{sx:{width:96,flexShrink:0,textAlign:"center"},children:I("col.owner")})]}),(0,yr.jsx)(CW.default,{style:{maxHeight:520},thumb:{width:6},children:t.length===0?(0,yr.jsx)(Fr.Box,{sx:{p:2,fontSize:14,color:"#9a9a97"},children:I("template.nothingToCreate")}):t.map((o,d)=>(0,yr.jsxs)(Fr.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1.25,borderBottom:d===t.length-1?"none":"1px solid #f2f2f0",fontSize:16,fontWeight:500,color:"#111111"},children:[(0,yr.jsx)(Fr.Box,{sx:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.title}),(0,yr.jsx)(Fr.Box,{sx:{width:88,flexShrink:0,textAlign:"center",fontSize:13.5,color:o.start_date?"#37352f":"#9a9a97"},children:Sd(o.start_date)||"-"}),(0,yr.jsx)(Fr.Box,{sx:{width:88,flexShrink:0,textAlign:"center",fontSize:13.5,color:o.due_date?"#37352f":"#9a9a97"},children:Sd(o.due_date)||"-"}),(0,yr.jsx)(Fr.Box,{sx:{width:96,flexShrink:0,textAlign:"center",fontSize:13.5,color:o.manager_name?"#37352f":"#9a9a97",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.manager_name||"-"})]},d))})]})]})}]})}Cs();_e();var MK={get urgent(){return I("print.urgent")},get high(){return I("priority.high")},get normal(){return I("priority.medium")},get low(){return I("priority.low")}};function RK(e){return e.length===0?"":e.length<=2?e.join(", "):I("print.namesAndMore",{value:e[0],value2:e.length-1})}function xu(e){let u=String(e??"").trim().slice(0,10);return/^\d{4}-\d{2}-\d{2}$/.test(u)?`${u.slice(2,4)}.${u.slice(5,7)}.${u.slice(8,10)}`:"-"}function As(e){let u=c=>String(c).padStart(2,"0");return`${e.getFullYear()}-${u(e.getMonth()+1)}-${u(e.getDate())} ${u(e.getHours())}:${u(e.getMinutes())}`}function th(e,u,c){let n=String(e.due_date??"").slice(11,16).trim()||String(e.estimated_time??"").trim(),a=xu(e.due_date),r=String(e.start_date??"").slice(11,16).trim(),t=xu(e.start_date),o=(e.receiver_names??[]).filter(Boolean).map(i=>String(i).trim()),d=(e.checklist??[]).length?`${(e.checklist??[]).filter(i=>i.checked).length}/${(e.checklist??[]).length}`:"";return{seq:Number(e.seq??0),title:String(e.title??"").trim(),statusName:xr(e).name,projectLabel:e.tab_key?u.get(String(e.tab_key))??"":"",managerName:String(e.manager_name??"").trim(),receiverNames:RK(o),receiverNamesFull:o.join(", "),startDate:t!=="-"&&r?`${t} ${r}`:t,dueDate:a!=="-"&&n?`${a} ${n}`:a,priorityName:MK[String(e.priority??"")]??"",checklist:d,checklistItems:(e.checklist??[]).map(i=>{let s=i.task_seq&&c?c(Number(i.task_seq)):null,h=xu(s?.due_date),f=String(s?.due_date??"").slice(11,16).trim();return{label:String(i.label??"").trim(),checked:!!i.checked,managerName:String(s?.manager_name??"").trim(),dueDate:h!=="-"?f?`${h} ${f}`:h:""}}),note:String(e.note??"").trim(),completed:!!e.completed}}function ln(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function DK(e,u){if(e===" ")return u*.3;let c=e.codePointAt(0)??0,l=c>=4352&&c<=4607||c>=12288&&c<=40959||c>=44032&&c<=55203||c>=63744&&c<=64255||c>=65280&&c<=65519;return u*(l?1:.55)}function wu(e,u){let c=0;for(let l of String(e??""))c+=DK(l,u);return c}function Es(e,u){let c=String(e??"").trim();if(!c)return["-"];let l=[],n="";for(let a of c){if(a===`
|
|
87
87
|
`){n&&l.push(n),n="";continue}let r=`${n}${a}`;if(r.length>u&&n){l.push(n),n=a;continue}n=r}return n&&l.push(n),l.length>0?l:["-"]}function vi(e,u,c){let l=String(e??"").replace(/\s+/g," ").trim();if(!l)return"";if(wu(l,c)<=u)return l;let n=wu("\u2026",c),a="",r=0;for(let t of l){let o=wu(t,c);if(r+o+n>u)break;a+=t,r+=o}return`${a}\u2026`}_e();var Nl=595.28,Ll=841.89,zl=841.89,Fl=595.28,Zr=28,$o=96,zo=44,NK="'Malgun Gothic','\uB9D1\uC740 \uACE0\uB515','Apple SD Gothic Neo','Noto Sans KR',sans-serif",LK="'Batang','\uBC14\uD0D5','AppleMyungjo','Noto Serif KR',serif",Tu="#cbd5e1",zK=[`text { font-family: ${NK}; fill: #000000; }`,`.doc-title { font-family: ${LK}; font-size: 20px; font-weight: 700; }`,".doc-sub { font-size: 10.5px; fill: #333333; }",".doc-meta { font-size: 9.5px; fill: #333333; }",".th { font-size: 9.5px; font-weight: 700; fill: #000000; }",`.td { font-size: 9px; }
|
|
88
88
|
.ck{font-size:9px;fill:#475569;}
|
|
89
89
|
.ck.done{fill:#94a3b8;}`,".td.done { fill: #555555; }",".gt { font-size: 10px; font-weight: 700; fill: #000000; }",".label { font-size: 9px; fill: #333333; }",".value { font-size: 10px; }",".section { font-size: 11.5px; font-weight: 700; fill: #000000; }",".pageno { font-size: 9px; fill: #333333; }",`.head { fill: #eef2f7; stroke: ${Tu}; stroke-width: 0.5; }`,`.group { fill: #f8fafc; stroke: ${Tu}; stroke-width: 0.5; }`,`.frame { fill: none; stroke: ${Tu}; stroke-width: 0.5; }`,`.hline { stroke: ${Tu}; stroke-width: 0.5; }`,`.vline { stroke: ${Tu}; stroke-width: 0.5; }`,".bar { fill: #bfdbfe; stroke: #60a5fa; stroke-width: 0.6; }",".bar.done { fill: #e5e7eb; stroke: #cbd5e1; }",".bar.overdue { fill: #fecaca; stroke: #f87171; }"].join("");function qi(e,u,c){let l=c-Zr;return[`<text x="${Zr}" y="46" class="doc-title">${ln(e.documentTitle)}</text>`,`<text x="${Zr}" y="66" class="doc-sub">${ln(e.subtitle)}</text>`,`<text x="${l}" y="42" class="doc-meta" text-anchor="end">${ln(e.facilityName)}</text>`,`<text x="${l}" y="58" class="doc-meta" text-anchor="end">${ln(I("print.printedAt",{time:As(e.printedAt)}))}${e.printedBy?` \xB7 ${ln(e.printedBy)}`:""}</text>`,u?`<text x="${l}" y="74" class="doc-meta" text-anchor="end">${ln(u)}</text>`:""].join("")}function Hi(e){let{width:u,height:c,body:l,pageIndex:n,pageCount:a}=e;return[`<svg xmlns="http://www.w3.org/2000/svg" width="${u}" height="${c}" viewBox="0 0 ${u} ${c}">`,`<style>${zK}</style>`,`<rect x="0" y="0" width="${u}" height="${c}" fill="#ffffff" />`,l,`<text x="${u/2}" y="${c-22}" class="pageno" text-anchor="middle">${n+1} / ${a}</text>`,"</svg>"].join("")}_e();var Ig=zl,_W=Fl,Wi=Zr,Su=Ig-Zr,jl=22,Va=20,ql=22,fa=18,Ha=5,IW=$o,BW=zo,_g=_W-46,pa=[{key:"no",get label(){return I("print.no")},width:30,align:"middle"},{key:"title",get label(){return I("common.title")},width:300,align:"start"},{key:"status",get label(){return I("col.status")},width:60,align:"middle"},{key:"start",get label(){return I("board.start")},width:78,align:"middle"},{key:"due",get label(){return I("board.due")},width:78,align:"middle"},{key:"manager",get label(){return I("col.owner")},width:80,align:"middle"},{key:"priority",get label(){return I("col.priority")},width:60,align:"middle"},{key:"project",get label(){return I("col.project")},width:100,align:"middle"}],Wa=pa.reduce((e,u,c)=>(e.push(c===0?Wi:e[c-1]+pa[c-1].width),e),[]);function FK(e){let u=[],c=[],l=IW+jl,n=0,a=(r,t)=>{u.push(c),c=[],l=BW+jl,r&&(c.push({kind:"group",label:r,count:t,continued:!0}),l+=ql)};for(let r of e){r.label&&(l+ql+Va>_g&&a("",0),c.push({kind:"group",label:r.label,count:r.rows.length,continued:!1}),l+=ql);for(let t of r.rows){l+Va>_g&&a(r.label,r.rows.length),n+=1,c.push({kind:"row",completed:t.completed,values:pa.map(o=>{switch(o.key){case"no":return String(n);case"title":return t.title;case"status":return t.statusName;case"project":return t.projectLabel||I("props.defaultProject");case"manager":return t.managerName||"-";case"start":return t.startDate;case"due":return t.dueDate;default:return t.priorityName||"-"}})}),l+=Va;for(let o of t.checklistItems)o.label&&(l+fa>_g&&a(r.label,r.rows.length),c.push({kind:"check",label:o.label,checked:o.checked,managerName:o.managerName,dueDate:o.dueDate}),l+=fa)}}return u.push(c),u.filter((r,t)=>t===0||r.length>0)}function jK(e,u){let c=[],l=[],n=(r,t,o)=>{Wa.slice(1).forEach((d,i)=>{let s=i+1;o(s)||l.push(`<line x1="${d}" y1="${r}" x2="${d}" y2="${r+t}" class="vline" />`)})};c.push(`<rect x="${Wi}" y="${u}" width="${Su-Wi}" height="${jl}" class="head" />`),pa.forEach((r,t)=>{let o=Wa[t],d=r.align==="middle"?o+r.width/2:o+Ha;c.push(`<text x="${d}" y="${u+jl-7}" class="th" text-anchor="${r.align}">${ln(r.label)}</text>`)}),n(u,jl,()=>!1);let a=u+jl;for(let r of e){if(r.kind==="group"){c.push(`<rect x="${Wi}" y="${a}" width="${Su-Wi}" height="${ql}" class="group" />`,`<text x="${Wi+Ha}" y="${a+ql-7}" class="gt">${ln(`${r.continued?I("print.continued",{label:r.label}):r.label} (${r.count})`)}</text>`),a+=ql;continue}if(r.kind==="check"){let t=Wa[1]+Ha+10,o=Wa[4]-Wa[1],d=r.checked?"ck done":"ck";c.push(`<text x="${t}" y="${a+fa-5}" class="${d}">${ln(`${r.checked?"\u2713":"\u25CB"} ${vi(r.label,o-Ha*2-22,9)}`)}</text>`),r.dueDate&&c.push(`<text x="${Wa[4]+pa[4].width/2}" y="${a+fa-5}" class="${d}" text-anchor="middle">${ln(vi(r.dueDate,pa[4].width-Ha*2,9))}</text>`),r.managerName&&c.push(`<text x="${Wa[5]+pa[5].width/2}" y="${a+fa-5}" class="${d}" text-anchor="middle">${ln(vi(r.managerName,pa[5].width-Ha*2,9))}</text>`),c.push(`<line x1="${Wi}" y1="${a+fa}" x2="${Su}" y2="${a+fa}" class="hline" />`),n(a,fa,i=>i>=2&&i<=3),a+=fa;continue}pa.forEach((t,o)=>{let d=Wa[o],i=t.align==="middle"?d+t.width/2:d+Ha;c.push(`<text x="${i}" y="${a+Va-6}" class="${r.completed?"td done":"td"}" text-anchor="${t.align}">${ln(vi(r.values[o]??"",t.width-Ha*2,9))}</text>`)}),c.push(`<line x1="${Wi}" y1="${a+Va}" x2="${Su}" y2="${a+Va}" class="hline" />`),n(a,Va,()=>!1),a+=Va}return c.push(...l),c.push(`<rect x="${Wi}" y="${u}" width="${Su-Wi}" height="${a-u}" class="frame" />`),c.join("")}async function OW(e,u){let c=FK(u),l=u.reduce((n,a)=>n+a.rows.length,0);return c.map((n,a)=>{let r=a===0?IW:BW,t=[a===0?qi(e,I("print.totalCount",{totalCount:l}),Ig):"",jK(n,r)].join("");return Hi({width:Ig,height:_W,body:t,pageIndex:a,pageCount:c.length})})}_e();var Og=Nl,AW=Ll,Vi=Zr,nh=Og-Zr,qK=AW-46,EW=22,HK=68,WK=(nh-Vi)/2,VK=14,Bg=58;function Hl(e){switch(e.kind){case"title":return 34;case"props":return Math.ceil(e.pairs.length/2)*EW+10;case"section":return 26;default:return VK}}function GK(e){let u=[{kind:"title",text:e.title,ticket:e.ticketNo}];return u.push({kind:"props",pairs:e.properties}),u.push({kind:"section",text:I("common.content")}),(e.content.trim()?e.content.split(`
|