@ehfuse/taskbox 0.11.37 → 0.11.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -76,7 +76,7 @@ use chrome, FireFox or Internet Explorer 11`)}var r=e("safe-buffer"),t=e("random
|
|
|
76
76
|
|
|
77
77
|
`).trim()}function xs(e){return ks(e)?gl(e):e}function bl(e){let u=EU(Gc(e)).trim(),c=gl(u);return c.trim()?/<(?!\/?(p|br|span)(\s|>|\/))[a-z]/i.test(u)||/<span[^>]*style=/i.test(u)?u:c:""}var AU=new Set(["P","DIV","UL","OL","H1","H2","H3","H4","BLOCKQUOTE","PRE"]);function EU(e){if(typeof DOMParser>"u")return e;let u=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html"),c=u.body.firstElementChild;if(!c)return e;let l=null;for(let n of Array.from(c.childNodes)){if(n.nodeType===Node.ELEMENT_NODE&&AU.has(n.tagName)){l=null;continue}l||(l=u.createElement("p"),c.insertBefore(l,n)),l.appendChild(n)}for(let n of Array.from(c.querySelectorAll(":scope > p")))!n.textContent?.replace(/\u00a0/g," ").trim()&&!n.querySelector("br, img")&&n.remove();return c.innerHTML}function sm(e){let u=l=>l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return e.split(`
|
|
78
78
|
`).map(l=>`<p>${l?u(l):"<br>"}</p>`).join("")}var yl=require("react/jsx-runtime"),PU={left:[["heading"],["bold","italic","strike","underline"],["link","bgcolor","code"],["bulletList","numberList"]],right:[]},np="<p><br></p>",Uc=(0,ko.forwardRef)(function({defaultHtml:u="",placeholder:c,alwaysExpanded:l=!1,autoFocus:n=!1,minHeight:a=44,maxHeight:r=280,onChange:t,onSubmit:o,onFiles:d,footer:i,variant:s="bare",mentionCandidates:h,slashCommands:f},m){let b=(0,ko.useRef)(null),g=(0,ko.useRef)(null),w=(0,ko.useRef)(null),[S,O]=(0,ko.useState)(!1),[P,j]=(0,ko.useState)(()=>!!gl(u).trim()),M=Qz(h,f),N=l||S||P;(0,ko.useImperativeHandle)(m,()=>({getComment:()=>bl(b.current?.getHtml()??""),clear:()=>{b.current?.setHtml(np),j(!1)},focus:()=>b.current?.focus(),insertText:W=>{let F=g.current?.querySelector(".ehfuse-editor-content");if(!F)return;F.focus();let C=window.getSelection(),B=w.current;if(!B||!F.contains(B.startContainer)){B=document.createRange();let R=F.lastElementChild??F;B.selectNodeContents(R),B.collapse(!1)}C?.removeAllRanges(),C?.addRange(B),document.execCommand("insertText",!1,W)}})),(0,ko.useLayoutEffect)(()=>{if(!n)return;let W=requestAnimationFrame(()=>b.current?.focus());return()=>cancelAnimationFrame(W)},[n]);let z=W=>{let F=Array.from(W??[]);return F.length===0||!d?!1:(d(F),!0)};return(0,yl.jsxs)(lm.Box,{...M.handlers,onKeyDownCapture:W=>{M.handlers.onKeyDownCapture(W),!W.defaultPrevented&&W.key==="Enter"&&(W.ctrlKey||W.metaKey)&&!W.nativeEvent.isComposing&&(W.preventDefault(),W.stopPropagation(),o?.())},onFocusCapture:()=>O(!0),ref:g,onBlurCapture:W=>{let F=window.getSelection();F&&F.rangeCount>0&&W.currentTarget.contains(F.anchorNode)&&(w.current=F.getRangeAt(0).cloneRange()),!W.currentTarget.contains(W.relatedTarget)&&(O(!1),bl(b.current?.getHtml()??"")||(b.current?.setHtml(np),w.current=null))},onPasteCapture:W=>{z(W.clipboardData?.files)&&(W.preventDefault(),W.stopPropagation())},onDropCapture:W=>{z(W.dataTransfer?.files)&&(W.preventDefault(),W.stopPropagation())},sx:{position:"relative",bgcolor:"#ffffff",...s==="boxed"?{border:"1px solid",borderColor:S?"primary.main":De.NOTION_LINE_COLOR,boxShadow:S?W=>`0 0 0 1px ${W.palette.primary.main}`:"none",borderRadius:"8px",transition:"border-color 120ms"}:{},"& .ehfuse-editor, & .ehfuse-editor-wrapper, & .ehfuse-editor-container":{border:"none !important",boxShadow:"none !important",borderRadius:0},"& .ehfuse-toolbar":{display:N?void 0:"none !important",background:"transparent",borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`},"& .ehfuse-editor-content":{maxHeight:r,overflowY:"auto",fontSize:15,lineHeight:1.6},"& .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":s==="boxed"?{top:"10px",left:"12px"}:{top:"12px",left:"16px"}},children:[(0,yl.jsx)(eF.EhfuseEditor,{ref:b,defaultValue:u||np,autoHeight:!0,autoHeightTailLines:0,showToolbar:!0,toolbarOptions:PU,locale:ya(),minHeight:N?Math.max(a,64):a,placeholder:c,contentStyle:{padding:s==="boxed"?"10px 12px":"12px 16px"},onChange:W=>{let F=bl(W);j(!!F),t?.(F)}}),M.popper,i?(0,yl.jsx)(lm.Box,{sx:{display:"flex",alignItems:"center",px:1,pb:.75},children:i}):null]})});function cm({html:e}){let{openExternalUrl:u,mentionCandidates:c}=it(),l=(0,ko.useRef)(null),n=Gc(e),a=(c??[]).map(r=>r.name).filter(r=>r.trim().length>=2);return(0,ko.useLayoutEffect)(()=>{let r=l.current;if(!r)return;r.innerHTML=n;let t=[...new Set(a)].sort((h,f)=>f.length-h.length);if(t.length===0||!n.includes("@"))return;let o=h=>h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=new RegExp(`(^|[^A-Za-z0-9._%+-])(@(?:${t.map(o).join("|")}))`,"g"),i=document.createTreeWalker(r,NodeFilter.SHOW_TEXT),s=[];for(;i.nextNode();){let h=i.currentNode;h.data.includes("@")&&!h.parentElement?.closest("a, code")&&s.push(h)}for(let h of s){let f=h.data,m=document.createDocumentFragment(),b=0;for(let g of f.matchAll(d)){let w=(g.index??0)+g[1].length;w>b&&m.append(f.slice(b,w));let S=document.createElement("span");S.className="taskbox-mention",S.textContent=g[2],m.append(S),b=w+g[2].length}b!==0&&(b<f.length&&m.append(f.slice(b)),h.replaceWith(m))}},[n,a.join("|")]),(0,yl.jsx)(lm.Box,{ref:l,onClickCapture:r=>{let t=r.target?.closest?.("a[href]");t&&(r.preventDefault(),r.stopPropagation(),u?u(t.href):window.open(t.href,"_blank","noopener,noreferrer"))},sx:{fontSize:15,lineHeight:1.6,wordBreak:"break-word","& p":{m:0},"& ul, & ol":{pl:"1.5em",my:.25},"& li > p":{m:0},"& h1, & h2, & h3, & h4":{fontSize:"1.05em",fontWeight:700,m:0},"& blockquote":{m:0,pl:1.5,borderLeft:`3px solid ${De.NOTION_LINE_COLOR}`,color:"text.secondary"},"& code":{fontFamily:"monospace",fontSize:"0.9em",bgcolor:"#f1f5f9",px:.5,borderRadius:.5},"& pre":{m:0,p:1,bgcolor:"#f1f5f9",borderRadius:1,overflowX:"auto"},"& a[href]":{color:"#2563eb",textDecoration:"none",cursor:"pointer","&:hover":{textDecoration:"underline"}},"& .taskbox-mention":{color:"#2563eb",fontWeight:600}}})}var dF=require("@ehfuse/mui-confirm-action");_e();var Te=require("react/jsx-runtime"),MU=5;function tF({kind:e,reactions:u,myAccountSeq:c,onToggle:l}){ue();let n=u??[],a=c>0&&n.some(d=>d.account_seq===c),r=e==="like"?I("section.reactLike"):I("section.reactAck"),t=n.length===0?r:(0,Te.jsx)(Xe.Box,{sx:{whiteSpace:"pre-line",fontSize:12},children:n.map(d=>`${d.name} \xB7 ${d.time}`).join(`
|
|
79
|
-
`)}),o=e==="like"?"#e5484d":"#2f80ed";return(0,Te.jsx)(Xe.Tooltip,{title:t,arrow:!0,enterDelay:300,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:(0,Te.jsxs)(Xe.Box,{sx:{display:"inline-flex",alignItems:"center"},children:[(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.commentReaction",{label:r}),onClick:l,sx:{color:a?o:"#c9c8c5",p:.5,"&:hover":{color:a?o:"#787774"}},children:e==="like"?a?(0,Te.jsx)(iF.default,{sx:{fontSize:16}}):(0,Te.jsx)(aF.default,{sx:{fontSize:16}}):a?(0,Te.jsx)(sF.default,{sx:{fontSize:16}}):(0,Te.jsx)(lF.default,{sx:{fontSize:16}})}),n.length>0?(0,Te.jsx)(Xe.Box,{component:"span",sx:{fontSize:12,color:a?o:"#9a9a97",ml:-.25},children:n.length}):null]})})}function ip({taskSeq:e,comments:u,currentUserName:c="",myAccountSeq:l=0,avatarSrcByName:n,onUpdate:a,onRemove:r,onToggleReaction:t,onPreview:o,onDownload:d}){ue();let[i,s]=(0,xo.useState)(null),h=(0,xo.useRef)(null),[f,m]=(0,xo.useState)(null),b=Cn(),[g,w]=(0,xo.useState)(null),S=(x,k)=>{navigator.clipboard.writeText(k).then(()=>{w(x),setTimeout(()=>w(T=>T===x?null:T),1500)})},[O,P]=(0,xo.useState)(!1),j=Math.max(0,u.length-MU),M=j>0&&!O,N=i?Math.min(i.index,j):j,z=u.map((x,k)=>({comment:x,index:k})).slice(M?N:0),W=zs(),F=(x,k)=>{if(o){o(x,k&&k.length>1?k:void 0);return}window.open(W(x.uuid??""),"_blank","noopener,noreferrer")},C=x=>{if(d){d(x);return}window.open(W(x.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},B=it(),R=B.slots?.avatar,p=B.commentInput?.richEditor===!0,y=Vd();return(0,Te.jsxs)(Xe.Box,{className:"taskbox-comments",sx:{px:2,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[y.showIcon?(0,Te.jsx)(ta,{sx:{fontSize:18,display:"block",color:y.color}}):null,(0,Te.jsxs)(Xe.Box,{sx:{fontSize:Wd,fontWeight:y.fontWeight,color:y.color},children:[I("section.comments"),u.length>0?` (${u.length})`:""]}),j>0&&(!M||N>0)?(0,Te.jsx)(Xe.Box,{role:"button",tabIndex:0,onClick:()=>P(x=>!x),onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),P(k=>!k))},sx:{ml:"auto",flexShrink:0,cursor:"pointer",fontSize:14.5,color:"#5b87d6","&:hover":{textDecoration:"underline"}},children:M?I("section.showOlder",{keepFrom:N}):I("section.hideOlder")}):null]}),u.length===0?(0,Te.jsx)(Xe.Box,{sx:{mt:1,fontSize:14.5,color:"#9a9a97"},children:I("section.noComments")}):null,(0,Te.jsx)(Xe.Box,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:z.map(({comment:x,index:k})=>{let T=!!c&&x.author===c,_=(0,Te.jsx)(Xe.Box,{component:"span",sx:{fontSize:14.5,fontWeight:700,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.author}),D=x.external?(0,Te.jsx)(Xe.Box,{component:"span",sx:{flexShrink:0,px:.6,fontSize:11.5,fontWeight:500,lineHeight:"18px",color:"#d9730d",bgcolor:"#fdf0e6",borderRadius:"4px",whiteSpace:"nowrap"},children:I("section.merchant")}):null;return(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",gap:1.5,alignItems:"flex-start","&:hover .taskbox-comment-actions":{opacity:1,pointerEvents:"auto"},"&:not(:last-child)":{borderBottom:"1px dashed #e0dfdc",pb:1}},children:[(()=>{let H=n?.get(x.author)??"";return R?(0,Te.jsx)(Xe.Box,{sx:{display:"inline-flex",flexShrink:0},children:(0,Te.jsx)(R,{name:x.author,src:H||void 0,size:44})}):(0,Te.jsx)(Xe.Box,{sx:{display:"inline-flex",flexShrink:0},children:(0,Te.jsx)(Jr,{src:H,name:x.author,avatarSx:{width:44,height:44,fontSize:20,borderRadius:"50%",...ea[0]},iconFontSize:24})})})(),(0,Te.jsxs)(Xe.Box,{sx:{flex:1,minWidth:0},children:[b?(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0},children:[_,D]}):null,(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0,position:"relative"},children:[b?null:_,b?null:D,(0,Te.jsx)(Xe.Box,{component:"span",sx:{fontSize:12.5,color:"#9a9a97",flexShrink:0,whiteSpace:"nowrap"},children:x.time}),T?(0,Te.jsx)(Xe.Box,{sx:{ml:"auto"}}):(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",alignItems:"center",gap:.25,ml:"auto",flexShrink:0},children:[(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.copyComment"),onClick:()=>S(k,xs(x.text)),sx:{color:g===k?"#2f9e5b":"#9a9a97",p:.5,"&:hover":{color:"#37352f"}},children:g===k?(0,Te.jsx)(op.default,{sx:{fontSize:15}}):(0,Te.jsx)(rp.default,{sx:{fontSize:15}})}),(0,Te.jsx)(tF,{kind:"like",reactions:x.likes,myAccountSeq:l,onToggle:()=>t?.(e,k,"like")}),(0,Te.jsx)(tF,{kind:"ack",reactions:x.acks,myAccountSeq:l,onToggle:()=>t?.(e,k,"ack")})]}),T?(0,Te.jsxs)(Xe.Box,{className:"taskbox-comment-actions",sx:{display:"flex",alignItems:"center",gap:.25,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",pointerEvents:b?"auto":"none",backgroundColor:"var(--taskbox-comment-bg, #fff)",opacity:b?1:0,transition:"opacity 0.15s"},children:[(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.copyComment"),onClick:()=>S(k,xs(x.text)),sx:{color:g===k?"#2f9e5b":"#9a9a97","&:hover":{color:"#37352f"}},children:g===k?(0,Te.jsx)(op.default,{sx:{fontSize:15}}):(0,Te.jsx)(rp.default,{sx:{fontSize:15}})}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.editComment"),onClick:()=>s({index:k,text:x.text,attachments:[...x.attachments??[]],files:[]}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(oF.default,{sx:{fontSize:15}})}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.deleteComment"),onClick:H=>m({anchorEl:H.currentTarget,index:k}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(Kc.default,{sx:{fontSize:15}})})]}):null]}),i?.index===k?(0,Te.jsxs)(Xe.Box,{sx:{mt:.5},children:[p||ks(x.text)?(0,Te.jsx)(Uc,{defaultHtml:ks(x.text)?x.text:sm(x.text),alwaysExpanded:!0,autoFocus:!0,variant:"boxed",minHeight:56,onChange:H=>s(V=>V&&{...V,text:H})}):(0,Te.jsx)(Xe.Box,{component:"textarea",autoFocus:!0,spellCheck:!1,value:i.text,onChange:H=>s({...i,text:H.target.value}),sx:{width:"100%",minHeight:56,border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,outline:"none",font:"inherit",fontSize:14,p:1,resize:"vertical",boxSizing:"border-box"}}),(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:.75,mt:.75},children:[i.attachments.map((H,V)=>{let U=()=>s({...i,attachments:i.attachments.filter((L,G)=>G!==V)});return $c(H.name)&&H.uuid?(0,Te.jsxs)(Xe.Box,{sx:{position:"relative"},children:[(0,Te.jsx)(Xe.Box,{component:"img",src:W(H.uuid,{thumb:"md"}),alt:H.name,title:H.name,loading:"lazy",sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:`1px solid ${De.NOTION_LINE_COLOR}`,display:"block"}}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.removeAttachment"),onClick:U,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${De.NOTION_LINE_COLOR}`,"&:hover":{bgcolor:"#f1f5f9"}},children:(0,Te.jsx)(Kc.default,{sx:{fontSize:14}})})]},`kept-${H.uuid}-${V}`):(0,Te.jsx)(Xe.Chip,{size:"small",icon:(0,Te.jsx)(ws.default,{sx:{fontSize:14}}),label:H.name,onDelete:U,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`kept-${H.uuid??H.name}-${V}`)}),i.files.map((H,V)=>{let U=()=>s({...i,files:i.files.filter((L,G)=>G!==V)});return $c(H.name)?(0,Te.jsxs)(Xe.Box,{sx:{position:"relative"},children:[(0,Te.jsx)(Xe.Box,{component:"img",src:URL.createObjectURL(H),alt:H.name,title:I("section.newFile",{name:H.name}),onLoad:L=>URL.revokeObjectURL(L.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"2px solid #2f80ed",display:"block"}}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.removeAttachment"),onClick:U,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${De.NOTION_LINE_COLOR}`,"&:hover":{bgcolor:"#f1f5f9"}},children:(0,Te.jsx)(Kc.default,{sx:{fontSize:14}})})]},`new-${H.name}-${V}`):(0,Te.jsx)(Xe.Chip,{size:"small",icon:(0,Te.jsx)(ws.default,{sx:{fontSize:14}}),label:I("section.newFile",{name:H.name}),onDelete:U,sx:{fontSize:14,height:26,bgcolor:"#eef4ff"}},`new-${H.name}-${V}`)}),(0,Te.jsx)(Xe.Tooltip,{title:I("section.addAttachment"),arrow:!0,children:(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.addAttachment"),onClick:()=>h.current?.click(),sx:{ml:"auto",color:"#2f80ed"},children:(0,Te.jsx)(cF.default,{sx:{fontSize:20}})})})]}),(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:.75,mt:.5},children:[(0,Te.jsx)(Xe.Button,{size:"small",color:"inherit",onClick:()=>s(null),children:I("common.cancel")}),(0,Te.jsx)(Xe.Button,{size:"small",variant:"contained",disabled:!i.text.trim()&&i.attachments.length===0&&i.files.length===0,onClick:()=>{a(e,k,i.text,{attachments:i.attachments,files:i.files}),s(null)},children:I("common.save")})]}),(0,Te.jsx)(Xe.Box,{component:"input",type:"file",multiple:!0,ref:h,sx:{display:"none"},onChange:H=>{let V=Array.from(H.target.files??[]);V.length>0&&s({...i,files:[...i.files,...V].slice(0,10)}),H.target.value=""}})]}):(0,Te.jsxs)(Xe.Box,{children:[x.text?ks(x.text)?(0,Te.jsx)(cm,{html:x.text}):(0,Te.jsx)(Xe.Box,{sx:{fontSize:15,whiteSpace:"pre-wrap"},children:(0,Te.jsx)(Ff,{text:x.text})}):null,(x.attachments??[]).length>0?(0,Te.jsx)(Xe.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.75,mt:.75},children:(x.attachments??[]).map((H,V)=>{let U=!!H.uuid,L=$c(H.name),G=(x.attachments??[]).filter(A=>!!A.uuid&&$c(A.name));if(L&&U)return(0,Te.jsx)(Xe.Box,{component:"img",src:W(H.uuid??"",{thumb:"md"}),alt:H.name,title:I("section.viewLarge",{name:H.name}),loading:"lazy",onClick:()=>F(H,G),sx:{width:96,height:96,objectFit:"cover",borderRadius:1,border:`1px solid ${De.NOTION_LINE_COLOR}`,cursor:"pointer",bgcolor:"#f8fafc"}},`${H.name}-${V}`);let E=Zd(H.name);return(0,Te.jsx)(Xe.Chip,{size:"small",icon:(0,Te.jsx)(ws.default,{sx:{fontSize:14}}),label:`${H.name} (${ep(H.size)})`,clickable:U,onClick:U?()=>E?F(H):C(H):void 0,title:U?I("section.fileAction",{name:H.name,value:E?I("section.preview"):I("section.download")}):H.name,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${H.name}-${V}`)})}):null]})]})]},`${x.time}-${k}`)})}),(0,Te.jsx)(dF.ConfirmActionPopper,{open:!!f,anchorEl:f?.anchorEl??null,title:I("section.deleteCommentConfirm"),confirmText:I("common.delete"),onCancel:()=>m(null),onConfirm:()=>{f&&(r(e,f.index),s(null)),m(null)}})]})}function $c(e){return/\.(png|jpe?g|gif|webp|bmp|svg|heic|heif)$/i.test(String(e??"").trim())}function RU(e){let{commentInput:u,mentionCandidates:c}=it(),n=((e?.mentionCandidates??c)?.length??0)>0,a=e?.placeholder??u?.placeholder,r=e?.placeholderShort??u?.placeholderShort,t=a??I(n?"section.commentPlaceholder":"section.commentPlaceholderPlain"),o=r??a??I(n?"section.commentPlaceholderShort":"section.commentPlaceholderPlain");return{wide:t,short:o}}function DU(){return(0,Te.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[(0,Te.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),(0,Te.jsx)("path",{d:"M8.5 14.5c.9 1.2 2.1 1.8 3.5 1.8s2.6-.6 3.5-1.8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,Te.jsx)("circle",{cx:"9",cy:"10",r:"1",fill:"currentColor"}),(0,Te.jsx)("circle",{cx:"15",cy:"10",r:"1",fill:"currentColor"})]})}function ap({onSubmit:e,rows:u=2,placeholder:c,placeholderShort:l,richEditor:n,mentionCandidates:a,slashCommands:r,attachments:t=!0,emojiPicker:o,disabled:d=!1}){ue();let[i,s]=(0,xo.useState)(""),h=tp({value:i,setValue:s,candidates:a,slashCommands:r}),[f,m]=(0,xo.useState)([]),[b,g]=(0,xo.useState)(!1),w=(0,xo.useRef)(null),S=(0,xo.useRef)(null),O=Cn(),P=O||u===1,j=it(),M=RU({placeholder:c,placeholderShort:l,mentionCandidates:a}),N=!O&&(n??j.commentInput?.richEditor)===!0,z=_=>{if(!t)return;let D=Array.from(_??[]);D.length!==0&&m(H=>[...H,...D].slice(0,10))},W=(0,xo.useRef)(null),[F,C]=(0,xo.useState)(""),B=()=>{if(d)return;let _=N?(W.current?.getComment()??"").trim():i.trim();!_&&f.length===0||(e(_,f.length>0?f:void 0),s(""),W.current?.clear(),C(""),m([]))},R=o??j.slots?.emojiPicker,[p,y]=(0,xo.useState)(null),x=_=>{N?W.current?.insertText(_):s(D=>`${D}${_}`),y(null)},k=_=>(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.postComment"),disabled:_||d,onClick:B,sx:{width:34,height:34,flexShrink:0,bgcolor:"primary.main",color:"#ffffff",transition:"background-color 160ms ease","&:hover":{bgcolor:"primary.dark"},"&.Mui-disabled":{bgcolor:"#e2e8f0",color:"#94a3b8"}},children:(0,Te.jsx)(nF.default,{sx:{fontSize:22}})}),T=(0,Te.jsxs)(Te.Fragment,{children:[t?(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.attachFile"),onClick:()=>w.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(ws.default,{sx:{fontSize:20}})}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.attachImage"),onClick:()=>S.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(uF.default,{sx:{fontSize:20}})})]}):null,(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.emoji"),onMouseDown:_=>_.preventDefault(),onClick:_=>y(_.currentTarget),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(DU,{})}),(0,Te.jsx)(Xe.Popover,{open:!!p,anchorEl:p,onClose:()=>y(null),anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},disableRestoreFocus:!0,slotProps:{paper:{sx:{width:340,maxWidth:"calc(100vw - 32px)",overflow:"hidden"}}},children:R?(0,Te.jsx)(R,{onPick:x}):(0,Te.jsx)(Zz,{onPick:x})})]});return(0,Te.jsxs)(Xe.Box,{children:[f.length>0?(0,Te.jsx)(Xe.Box,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1.5,px:2,pt:2},children:f.map((_,D)=>$c(_.name)?(0,Te.jsxs)(Xe.Box,{sx:{position:"relative"},children:[(0,Te.jsx)(Xe.Box,{component:"img",src:URL.createObjectURL(_),alt:_.name,title:_.name,onLoad:H=>URL.revokeObjectURL(H.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:`1px solid ${De.NOTION_LINE_COLOR}`,display:"block"}}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.removeAttachment"),onClick:()=>m(H=>H.filter((V,U)=>U!==D)),sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${De.NOTION_LINE_COLOR}`,"&:hover":{bgcolor:"#f1f5f9"}},children:(0,Te.jsx)(Kc.default,{sx:{fontSize:14}})})]},`${_.name}-${D}`):(0,Te.jsx)(Xe.Chip,{size:"small",icon:(0,Te.jsx)(ws.default,{sx:{fontSize:14}}),label:`${_.name} (${ep(_.size)})`,onDelete:()=>m(H=>H.filter((V,U)=>U!==D)),sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${_.name}-${D}`))}):null,(0,Te.jsxs)(Xe.Box,{sx:{position:"relative",display:"flex"},onDragOver:_=>{!t||!Array.from(_.dataTransfer?.types??[]).includes("Files")||(_.preventDefault(),g(!0))},onDragLeave:_=>{_.currentTarget.contains(_.relatedTarget)||g(!1)},onDrop:_=>{!t||!Array.from(_.dataTransfer?.types??[]).includes("Files")||(_.preventDefault(),g(!1),z(_.dataTransfer?.files??null))},children:[b?(0,Te.jsxs)(Xe.Box,{sx:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",gap:.75,borderRadius:1,border:"2px dashed #2f80ed",bgcolor:"rgba(47,128,237,0.08)",color:"#2f80ed",fontSize:14,fontWeight:600,pointerEvents:"none"},children:[(0,Te.jsx)(ws.default,{sx:{fontSize:18}}),I("section.dropToAttach")]}):null,N?(0,Te.jsx)(Xe.Box,{sx:{flex:1,minWidth:0},children:(0,Te.jsx)(Uc,{ref:W,placeholder:M.wide,mentionCandidates:a,slashCommands:r,alwaysExpanded:f.length>0,onChange:C,onSubmit:B,onFiles:_=>{t&&m(D=>[...D,..._].slice(0,10))},footer:(0,Te.jsxs)(Te.Fragment,{children:[T,(0,Te.jsx)(Xe.Box,{sx:{flex:1}}),k(!F&&f.length===0)]})})}):(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(rF.TextField,{value:i,placeholder:P?M.short:M.wide,onChange:_=>s(_.target.value),inputRef:h.inputRef,onSelect:h.onSelectionChange,onKeyDown:_=>{h.onKeyDown(_)},onPaste:_=>{let D=Array.from(_.clipboardData?.files??[]);!t||D.length===0||(_.preventDefault(),z(_.clipboardData.files))},fullWidth:!0,multiline:!0,minRows:P?1:u,maxRows:3,sx:{"& .MuiInputBase-root":{pl:2,pr:P?15:6.5,pb:P?void 0:5,borderRadius:0},"& .MuiOutlinedInput-notchedOutline":{border:"none"}}}),h.popper,P?(0,Te.jsxs)(Xe.Box,{sx:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:.25},children:[T,k(!i.trim()&&f.length===0)]}):(0,Te.jsxs)(Xe.Box,{sx:{position:"absolute",left:0,right:0,bottom:0,display:"flex",alignItems:"center",px:1,pb:.75},children:[T,(0,Te.jsx)(Xe.Box,{sx:{flex:1}}),k(!i.trim()&&f.length===0)]})]})]}),(0,Te.jsx)(Xe.Box,{component:"input",ref:w,type:"file",multiple:!0,onChange:_=>{z(_.target.files),_.target.value=""},sx:{display:"none"}}),(0,Te.jsx)(Xe.Box,{component:"input",ref:S,type:"file",accept:"image/*",multiple:!0,onChange:_=>{z(_.target.files),_.target.value=""},sx:{display:"none"}})]})}var Ra=require("react"),pt=require("@mui/material"),kF=v(require("@mui/icons-material/MoreVert"),1),sp=v(require("@mui/icons-material/Close"),1),xF=v(require("@mui/icons-material/ArrowBack"),1),lp=v(require("@mui/icons-material/ContentCopyOutlined"),1),cp=v(require("@mui/icons-material/ShareOutlined"),1),up=v(require("@mui/icons-material/HistoryOutlined"),1),dp=v(require("@mui/icons-material/Print"),1);var wF=require("@ehfuse/mui-confirm-action");gn();var Do=require("@mui/material"),pF=require("@ehfuse/mui-form-dialog"),gF=require("@ehfuse/overlay-scrollbar");_e();var mF=require("react"),hF=require("@ehfuse/forma");function vl({taskSeq:e,items:u,loading:c,onLoad:l}){let n={activity:(0,hF.useModal)({modalId:Lt("taskbox-task-activity")})},a=n.activity.isOpen;return(0,mF.useEffect)(()=>{a&&e>0&&!u&&l?.(e)},[a,e,u,l]),{modals:n,items:u,loading:c,openDialog:()=>n.activity.open()}}var wo=require("react/jsx-runtime"),NU={get created(){return I("activity.created")},get completed(){return I("activity.completed")},get uncompleted(){return I("activity.uncompleted")},get returned(){return I("activity.returned")},get confirm_requested(){return I("activity.confirmRequested")},get acked(){return I("activity.acked")},get claimed(){return I("activity.claimed")},get bug_verified(){return I("activity.bugVerified")},get bug_reopened(){return I("activity.bugReopened")}};function fF(e){return String(e??"").trim()||I("common.none")}function LU(e){if(e.kind!=="field")return NU[String(e.kind)]??I("activity.changed");let u=String(e.field_label??e.field??"").trim()||I("activity.field"),c=String(e.old_value??"").trim(),l=String(e.new_value??"").trim();return!c&&l?I("activity.fieldSet",{label:u,after:l}):c&&!l?I("activity.fieldCleared",{label:u}):I("activity.fieldChanged",{label:u,value:fF(c),value2:fF(l)})}function Xc({controller:e}){ue();let u=Cn(),{items:c,loading:l}=e,n=e.modals.activity,a=(0,wo.jsx)(Do.Box,{sx:{height:u?"100%":420,minHeight:0},children:(0,wo.jsx)(gF.OverlayScrollbar,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:(0,wo.jsxs)(Do.Box,{sx:{px:2,pt:2,display:"flex",flexDirection:"column",gap:1,"&::after":{content:'""',flexShrink:0,height:16}},children:[l&&!c?(0,wo.jsxs)(Do.Box,{sx:{display:"flex",alignItems:"center",gap:1,color:"#9a9a97",fontSize:14.5},children:[(0,wo.jsx)(Do.CircularProgress,{size:14,thickness:5,sx:{color:"#9a9a97"}}),I("common.loading")]}):null,c&&c.length===0?(0,wo.jsx)(Do.Box,{sx:{fontSize:14.5,color:"#9a9a97"},children:I("activity.empty")}):null,(c??[]).map(r=>(0,wo.jsxs)(Do.Box,{sx:{display:"flex",flexDirection:u?"column":"row",gap:u?.25:1,alignItems:u?"stretch":"baseline",minWidth:0,flexShrink:0,...u?{pb:1,borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,"&:last-of-type":{borderBottom:"none",pb:0}}:{}},children:[(0,wo.jsx)(Do.Box,{sx:{flexShrink:0,...u?{}:{width:"10.5em"},whiteSpace:"nowrap",fontSize:13.5,color:"#9a9a97",lineHeight:1.5},children:fo(r.acted_time)}),(0,wo.jsxs)(Do.Box,{sx:{minWidth:0,fontSize:14.5,color:"#37352f",lineHeight:1.5},children:[(0,wo.jsx)(Do.Box,{component:"span",sx:{fontWeight:500},children:String(r.actor_name??"").trim()||I("dialog.noName")}),(0,wo.jsx)(Do.Box,{component:"span",sx:{ml:.5},children:LU(r)})]})]},r.seq))]})})});return(0,wo.jsx)(pF.FormDialog,{open:n.isOpen,onClose:n.close,maxWidth:"sm",fullScreen:u,mobilePresentation:u?"slide":"dialog",contentPaddingX:0,contentTopPadding:0,contentBottomPadding:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,sx:u?{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:c&&c.length>0?I("activity.titleWithCount",{count:c.length}):I("activity.title"),locale:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-activity",sections:[{id:"task-activity",showTitle:!1,children:a}],scrollPastLastSection:!1,actions:{showCancelButton:!1,right:(0,wo.jsx)(Do.Button,{variant:"contained",onClick:n.close,children:I("common.close")})}})}var um=require("@ehfuse/alerts");var bF=e=>e?e.replace(/<(script|style)[\s\S]*?<\/\1>/gi,"").replace(/<br\s*\/?>/gi,`
|
|
79
|
+
`)}),o=e==="like"?"#e5484d":"#2f80ed";return(0,Te.jsx)(Xe.Tooltip,{title:t,arrow:!0,enterDelay:300,disableInteractive:!0,slotProps:{transition:{timeout:0}},children:(0,Te.jsxs)(Xe.Box,{sx:{display:"inline-flex",alignItems:"center"},children:[(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.commentReaction",{label:r}),onClick:l,sx:{color:a?o:"#c9c8c5",p:.5,"&:hover":{color:a?o:"#787774"}},children:e==="like"?a?(0,Te.jsx)(iF.default,{sx:{fontSize:16}}):(0,Te.jsx)(aF.default,{sx:{fontSize:16}}):a?(0,Te.jsx)(sF.default,{sx:{fontSize:16}}):(0,Te.jsx)(lF.default,{sx:{fontSize:16}})}),n.length>0?(0,Te.jsx)(Xe.Box,{component:"span",sx:{fontSize:12,color:a?o:"#9a9a97",ml:-.25},children:n.length}):null]})})}function ip({taskSeq:e,comments:u,currentUserName:c="",myAccountSeq:l=0,avatarSrcByName:n,onUpdate:a,onRemove:r,onToggleReaction:t,onPreview:o,onDownload:d}){ue();let[i,s]=(0,xo.useState)(null),h=(0,xo.useRef)(null),[f,m]=(0,xo.useState)(null),b=Cn(),[g,w]=(0,xo.useState)(null),S=(x,k)=>{navigator.clipboard.writeText(k).then(()=>{w(x),setTimeout(()=>w(T=>T===x?null:T),1500)})},[O,P]=(0,xo.useState)(!1),j=Math.max(0,u.length-MU),M=j>0&&!O,N=i?Math.min(i.index,j):j,z=u.map((x,k)=>({comment:x,index:k})).slice(M?N:0),W=zs(),F=(x,k)=>{if(o){o(x,k&&k.length>1?k:void 0);return}window.open(W(x.uuid??""),"_blank","noopener,noreferrer")},C=x=>{if(d){d(x);return}window.open(W(x.uuid??"",{download:!0}),"_blank","noopener,noreferrer")},B=it(),R=B.slots?.avatar,p=B.commentInput?.richEditor===!0,y=Vd();return(0,Te.jsxs)(Xe.Box,{className:"taskbox-comments",sx:{px:2,pb:2,display:"flex",flexDirection:"column",gap:.25},children:[(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[y.showIcon?(0,Te.jsx)(ta,{sx:{fontSize:18,display:"block",color:y.color}}):null,(0,Te.jsxs)(Xe.Box,{sx:{fontSize:Wd,fontWeight:y.fontWeight,color:y.color},children:[I("section.comments"),u.length>0?` (${u.length})`:""]}),j>0&&(!M||N>0)?(0,Te.jsx)(Xe.Box,{role:"button",tabIndex:0,onClick:()=>P(x=>!x),onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),P(k=>!k))},sx:{ml:"auto",flexShrink:0,cursor:"pointer",fontSize:14.5,color:"#5b87d6","&:hover":{textDecoration:"underline"}},children:M?I("section.showOlder",{keepFrom:N}):I("section.hideOlder")}):null]}),u.length===0?(0,Te.jsx)(Xe.Box,{sx:{mt:1,fontSize:14.5,color:"#9a9a97"},children:I("section.noComments")}):null,(0,Te.jsx)(Xe.Box,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:z.map(({comment:x,index:k})=>{let T=!!c&&x.author===c,_=(0,Te.jsx)(Xe.Box,{component:"span",sx:{fontSize:14.5,fontWeight:700,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.author}),D=x.external?(0,Te.jsx)(Xe.Box,{component:"span",sx:{flexShrink:0,px:.6,fontSize:11.5,fontWeight:500,lineHeight:"18px",color:"#d9730d",bgcolor:"#fdf0e6",borderRadius:"4px",whiteSpace:"nowrap"},children:I("section.merchant")}):null;return(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",gap:1.5,alignItems:"flex-start","&:hover .taskbox-comment-actions":{opacity:1,pointerEvents:"auto"},"&:not(:last-child)":{borderBottom:"1px dashed #e0dfdc",pb:1}},children:[(()=>{let H=n?.get(x.author)??"";return R?(0,Te.jsx)(Xe.Box,{sx:{display:"inline-flex",flexShrink:0},children:(0,Te.jsx)(R,{name:x.author,src:H||void 0,size:44})}):(0,Te.jsx)(Xe.Box,{sx:{display:"inline-flex",flexShrink:0},children:(0,Te.jsx)(Jr,{src:H,name:x.author,avatarSx:{width:44,height:44,fontSize:20,borderRadius:"50%",...ea[0]},iconFontSize:24})})})(),(0,Te.jsxs)(Xe.Box,{sx:{flex:1,minWidth:0},children:[b?(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0},children:[_,D]}):null,(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0,position:"relative"},children:[b?null:_,b?null:D,(0,Te.jsx)(Xe.Box,{component:"span",sx:{fontSize:12.5,color:"#9a9a97",flexShrink:0,whiteSpace:"nowrap"},children:x.time}),T?(0,Te.jsx)(Xe.Box,{sx:{ml:"auto"}}):(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",alignItems:"center",gap:.25,ml:"auto",flexShrink:0},children:[(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.copyComment"),onClick:()=>S(k,xs(x.text)),sx:{color:g===k?"#2f9e5b":"#9a9a97",p:.5,"&:hover":{color:"#37352f"}},children:g===k?(0,Te.jsx)(op.default,{sx:{fontSize:15}}):(0,Te.jsx)(rp.default,{sx:{fontSize:15}})}),(0,Te.jsx)(tF,{kind:"like",reactions:x.likes,myAccountSeq:l,onToggle:()=>t?.(e,k,"like")}),(0,Te.jsx)(tF,{kind:"ack",reactions:x.acks,myAccountSeq:l,onToggle:()=>t?.(e,k,"ack")})]}),T?(0,Te.jsxs)(Xe.Box,{className:"taskbox-comment-actions",sx:{display:"flex",alignItems:"center",gap:.25,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",pointerEvents:b?"auto":"none",backgroundColor:"var(--taskbox-comment-bg, #fff)",opacity:b?1:0,transition:"opacity 0.15s"},children:[(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.copyComment"),onClick:()=>S(k,xs(x.text)),sx:{color:g===k?"#2f9e5b":"#9a9a97","&:hover":{color:"#37352f"}},children:g===k?(0,Te.jsx)(op.default,{sx:{fontSize:15}}):(0,Te.jsx)(rp.default,{sx:{fontSize:15}})}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.editComment"),onClick:()=>s({index:k,text:x.text,attachments:[...x.attachments??[]],files:[]}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(oF.default,{sx:{fontSize:15}})}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.deleteComment"),onClick:H=>m({anchorEl:H.currentTarget,index:k}),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(Kc.default,{sx:{fontSize:15}})})]}):null]}),i?.index===k?(0,Te.jsxs)(Xe.Box,{sx:{mt:.5},children:[p||ks(x.text)?(0,Te.jsx)(Uc,{defaultHtml:ks(x.text)?x.text:sm(x.text),alwaysExpanded:!0,autoFocus:!0,variant:"boxed",minHeight:56,onChange:H=>s(V=>V&&{...V,text:H})}):(0,Te.jsx)(Xe.Box,{component:"textarea",autoFocus:!0,spellCheck:!1,value:i.text,onChange:H=>s({...i,text:H.target.value}),sx:{width:"100%",minHeight:56,border:`1px solid ${De.NOTION_LINE_COLOR}`,borderRadius:1,outline:"none",font:"inherit",fontSize:14,p:1,resize:"vertical",boxSizing:"border-box"}}),(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:.75,mt:.75},children:[i.attachments.map((H,V)=>{let U=()=>s({...i,attachments:i.attachments.filter((L,G)=>G!==V)});return $c(H.name)&&H.uuid?(0,Te.jsxs)(Xe.Box,{sx:{position:"relative"},children:[(0,Te.jsx)(Xe.Box,{component:"img",src:W(H.uuid,{thumb:"md"}),alt:H.name,title:H.name,loading:"lazy",sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:`1px solid ${De.NOTION_LINE_COLOR}`,display:"block"}}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.removeAttachment"),onClick:U,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${De.NOTION_LINE_COLOR}`,"&:hover":{bgcolor:"#f1f5f9"}},children:(0,Te.jsx)(Kc.default,{sx:{fontSize:14}})})]},`kept-${H.uuid}-${V}`):(0,Te.jsx)(Xe.Chip,{size:"small",icon:(0,Te.jsx)(ws.default,{sx:{fontSize:14}}),label:H.name,onDelete:U,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`kept-${H.uuid??H.name}-${V}`)}),i.files.map((H,V)=>{let U=()=>s({...i,files:i.files.filter((L,G)=>G!==V)});return $c(H.name)?(0,Te.jsxs)(Xe.Box,{sx:{position:"relative"},children:[(0,Te.jsx)(Xe.Box,{component:"img",src:URL.createObjectURL(H),alt:H.name,title:I("section.newFile",{name:H.name}),onLoad:L=>URL.revokeObjectURL(L.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:"2px solid #2f80ed",display:"block"}}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.removeAttachment"),onClick:U,sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${De.NOTION_LINE_COLOR}`,"&:hover":{bgcolor:"#f1f5f9"}},children:(0,Te.jsx)(Kc.default,{sx:{fontSize:14}})})]},`new-${H.name}-${V}`):(0,Te.jsx)(Xe.Chip,{size:"small",icon:(0,Te.jsx)(ws.default,{sx:{fontSize:14}}),label:I("section.newFile",{name:H.name}),onDelete:U,sx:{fontSize:14,height:26,bgcolor:"#eef4ff"}},`new-${H.name}-${V}`)}),(0,Te.jsx)(Xe.Tooltip,{title:I("section.addAttachment"),arrow:!0,children:(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.addAttachment"),onClick:()=>h.current?.click(),sx:{ml:"auto",color:"#2f80ed"},children:(0,Te.jsx)(cF.default,{sx:{fontSize:20}})})})]}),(0,Te.jsxs)(Xe.Box,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:.75,mt:.5},children:[(0,Te.jsx)(Xe.Button,{size:"small",color:"inherit",onClick:()=>s(null),children:I("common.cancel")}),(0,Te.jsx)(Xe.Button,{size:"small",variant:"contained",disabled:!i.text.trim()&&i.attachments.length===0&&i.files.length===0,onClick:()=>{a(e,k,i.text,{attachments:i.attachments,files:i.files}),s(null)},children:I("common.save")})]}),(0,Te.jsx)(Xe.Box,{component:"input",type:"file",multiple:!0,ref:h,sx:{display:"none"},onChange:H=>{let V=Array.from(H.target.files??[]);V.length>0&&s({...i,files:[...i.files,...V].slice(0,10)}),H.target.value=""}})]}):(0,Te.jsxs)(Xe.Box,{children:[x.text?ks(x.text)?(0,Te.jsx)(cm,{html:x.text}):(0,Te.jsx)(Xe.Box,{sx:{fontSize:15,whiteSpace:"pre-wrap"},children:(0,Te.jsx)(Ff,{text:x.text})}):null,(x.attachments??[]).length>0?(0,Te.jsx)(Xe.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.75,mt:.75},children:(x.attachments??[]).map((H,V)=>{let U=!!H.uuid,L=$c(H.name),G=(x.attachments??[]).filter(A=>!!A.uuid&&$c(A.name));if(L&&U)return(0,Te.jsx)(Xe.Box,{component:"img",src:W(H.uuid??"",{thumb:"md"}),alt:H.name,title:I("section.viewLarge",{name:H.name}),loading:"lazy",onClick:()=>F(H,G),sx:{width:96,height:96,objectFit:"cover",borderRadius:1,border:`1px solid ${De.NOTION_LINE_COLOR}`,cursor:"pointer",bgcolor:"#f8fafc"}},`${H.name}-${V}`);let E=Zd(H.name);return(0,Te.jsx)(Xe.Chip,{size:"small",icon:(0,Te.jsx)(ws.default,{sx:{fontSize:14}}),label:`${H.name} (${ep(H.size)})`,clickable:U,onClick:U?()=>E?F(H):C(H):void 0,title:U?I("section.fileAction",{name:H.name,value:E?I("section.preview"):I("section.download")}):H.name,sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${H.name}-${V}`)})}):null]})]})]},`${x.time}-${k}`)})}),(0,Te.jsx)(dF.ConfirmActionPopper,{open:!!f,anchorEl:f?.anchorEl??null,title:I("section.deleteCommentConfirm"),confirmText:I("common.delete"),onCancel:()=>m(null),onConfirm:()=>{f&&(r(e,f.index),s(null)),m(null)}})]})}function $c(e){return/\.(png|jpe?g|gif|webp|bmp|svg|heic|heif)$/i.test(String(e??"").trim())}function RU(e){let{commentInput:u,mentionCandidates:c}=it(),n=((e?.mentionCandidates??c)?.length??0)>0,a=e?.placeholder??u?.placeholder,r=e?.placeholderShort??u?.placeholderShort,t=a??I(n?"section.commentPlaceholder":"section.commentPlaceholderPlain"),o=r??a??I(n?"section.commentPlaceholderShort":"section.commentPlaceholderPlain");return{wide:t,short:o}}function DU(){return(0,Te.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[(0,Te.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),(0,Te.jsx)("path",{d:"M8.5 14.5c.9 1.2 2.1 1.8 3.5 1.8s2.6-.6 3.5-1.8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,Te.jsx)("circle",{cx:"9",cy:"10",r:"1",fill:"currentColor"}),(0,Te.jsx)("circle",{cx:"15",cy:"10",r:"1",fill:"currentColor"})]})}function ap({onSubmit:e,rows:u=2,placeholder:c,placeholderShort:l,richEditor:n,mentionCandidates:a,slashCommands:r,attachments:t=!0,emojiPicker:o,disabled:d=!1}){ue();let[i,s]=(0,xo.useState)(""),h=tp({value:i,setValue:s,candidates:a,slashCommands:r}),[f,m]=(0,xo.useState)([]),[b,g]=(0,xo.useState)(!1),w=(0,xo.useRef)(null),S=(0,xo.useRef)(null),O=Cn(),P=O||u===1,j=it(),M=RU({placeholder:c,placeholderShort:l,mentionCandidates:a}),N=!O&&(n??j.commentInput?.richEditor)===!0,z=_=>{if(!t)return;let D=Array.from(_??[]);D.length!==0&&m(H=>[...H,...D].slice(0,10))},W=(0,xo.useRef)(null),[F,C]=(0,xo.useState)(""),B=()=>{if(d)return;let _=N?(W.current?.getComment()??"").trim():i.trim();!_&&f.length===0||(e(_,f.length>0?f:void 0),s(""),W.current?.clear(),C(""),m([]))},R=o??j.slots?.emojiPicker,[p,y]=(0,xo.useState)(null),x=_=>{N?W.current?.insertText(_):s(D=>`${D}${_}`),y(null)},k=_=>(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.postComment"),disabled:_||d,onClick:B,sx:{width:34,height:34,flexShrink:0,bgcolor:"primary.main",color:"#ffffff",transition:"background-color 160ms ease","&:hover":{bgcolor:"primary.dark"},"&.Mui-disabled":{bgcolor:"#e2e8f0",color:"#94a3b8"}},children:(0,Te.jsx)(nF.default,{sx:{fontSize:22}})}),T=(0,Te.jsxs)(Te.Fragment,{children:[t?(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.attachFile"),onClick:()=>w.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(ws.default,{sx:{fontSize:20}})}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.attachImage"),onClick:()=>S.current?.click(),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(uF.default,{sx:{fontSize:20}})})]}):null,(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.emoji"),onMouseDown:_=>_.preventDefault(),onClick:_=>y(_.currentTarget),sx:{color:"#9a9a97","&:hover":{color:"#37352f"}},children:(0,Te.jsx)(DU,{})}),(0,Te.jsx)(Xe.Popover,{open:!!p,anchorEl:p,onClose:()=>y(null),anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},disableRestoreFocus:!0,slotProps:{paper:{sx:{width:340,maxWidth:"calc(100vw - 32px)",overflow:"hidden"}}},children:R?(0,Te.jsx)(R,{onPick:x}):(0,Te.jsx)(Zz,{onPick:x})})]});return(0,Te.jsxs)(Xe.Box,{children:[f.length>0?(0,Te.jsx)(Xe.Box,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1.5,px:2,pt:2},children:f.map((_,D)=>$c(_.name)?(0,Te.jsxs)(Xe.Box,{sx:{position:"relative"},children:[(0,Te.jsx)(Xe.Box,{component:"img",src:URL.createObjectURL(_),alt:_.name,title:_.name,onLoad:H=>URL.revokeObjectURL(H.target.src),sx:{width:72,height:72,objectFit:"cover",borderRadius:1,border:`1px solid ${De.NOTION_LINE_COLOR}`,display:"block"}}),(0,Te.jsx)(Xe.IconButton,{size:"small","aria-label":I("section.removeAttachment"),onClick:()=>m(H=>H.filter((V,U)=>U!==D)),sx:{position:"absolute",top:-6,right:-6,p:.25,bgcolor:"#ffffff",border:`1px solid ${De.NOTION_LINE_COLOR}`,"&:hover":{bgcolor:"#f1f5f9"}},children:(0,Te.jsx)(Kc.default,{sx:{fontSize:14}})})]},`${_.name}-${D}`):(0,Te.jsx)(Xe.Chip,{size:"small",icon:(0,Te.jsx)(ws.default,{sx:{fontSize:14}}),label:`${_.name} (${ep(_.size)})`,onDelete:()=>m(H=>H.filter((V,U)=>U!==D)),sx:{fontSize:14,height:26,bgcolor:"#f1f5f9"}},`${_.name}-${D}`))}):null,(0,Te.jsxs)(Xe.Box,{sx:{position:"relative",display:"flex"},onDragOver:_=>{!t||!Array.from(_.dataTransfer?.types??[]).includes("Files")||(_.preventDefault(),g(!0))},onDragLeave:_=>{_.currentTarget.contains(_.relatedTarget)||g(!1)},onDrop:_=>{!t||!Array.from(_.dataTransfer?.types??[]).includes("Files")||(_.preventDefault(),g(!1),z(_.dataTransfer?.files??null))},children:[b?(0,Te.jsxs)(Xe.Box,{sx:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",gap:.75,borderRadius:1,border:"2px dashed #2f80ed",bgcolor:"rgba(47,128,237,0.08)",color:"#2f80ed",fontSize:14,fontWeight:600,pointerEvents:"none"},children:[(0,Te.jsx)(ws.default,{sx:{fontSize:18}}),I("section.dropToAttach")]}):null,N?(0,Te.jsx)(Xe.Box,{sx:{flex:1,minWidth:0},children:(0,Te.jsx)(Uc,{ref:W,placeholder:M.wide,mentionCandidates:a,slashCommands:r,alwaysExpanded:f.length>0,onChange:C,onSubmit:B,onFiles:_=>{t&&m(D=>[...D,..._].slice(0,10))},footer:(0,Te.jsxs)(Te.Fragment,{children:[T,(0,Te.jsx)(Xe.Box,{sx:{flex:1}}),k(!F&&f.length===0)]})})}):(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(rF.TextField,{value:i,placeholder:P?M.short:M.wide,onChange:_=>s(_.target.value),inputRef:h.inputRef,onSelect:h.onSelectionChange,onKeyDown:_=>{h.onKeyDown(_)},onPaste:_=>{let D=Array.from(_.clipboardData?.files??[]);!t||D.length===0||(_.preventDefault(),z(_.clipboardData.files))},fullWidth:!0,multiline:!0,minRows:P?1:u,maxRows:3,sx:{"& .MuiInputBase-root":{pl:2,pr:P?15:6.5,pb:P?void 0:5,borderRadius:0},"& .MuiOutlinedInput-notchedOutline":{border:"none"}}}),h.popper,P?(0,Te.jsxs)(Xe.Box,{sx:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:.25},children:[T,k(!i.trim()&&f.length===0)]}):(0,Te.jsxs)(Xe.Box,{sx:{position:"absolute",left:0,right:0,bottom:0,display:"flex",alignItems:"center",px:1,pb:.75},children:[T,(0,Te.jsx)(Xe.Box,{sx:{flex:1}}),k(!i.trim()&&f.length===0)]})]})]}),(0,Te.jsx)(Xe.Box,{component:"input",ref:w,type:"file",multiple:!0,onChange:_=>{z(_.target.files),_.target.value=""},sx:{display:"none"}}),(0,Te.jsx)(Xe.Box,{component:"input",ref:S,type:"file",accept:"image/*",multiple:!0,onChange:_=>{z(_.target.files),_.target.value=""},sx:{display:"none"}})]})}var Ra=require("react"),pt=require("@mui/material"),kF=v(require("@mui/icons-material/MoreHoriz"),1),sp=v(require("@mui/icons-material/Close"),1),xF=v(require("@mui/icons-material/ArrowBack"),1),lp=v(require("@mui/icons-material/ContentCopyOutlined"),1),cp=v(require("@mui/icons-material/ShareOutlined"),1),up=v(require("@mui/icons-material/HistoryOutlined"),1),dp=v(require("@mui/icons-material/Print"),1);var wF=require("@ehfuse/mui-confirm-action");gn();var Do=require("@mui/material"),pF=require("@ehfuse/mui-form-dialog"),gF=require("@ehfuse/overlay-scrollbar");_e();var mF=require("react"),hF=require("@ehfuse/forma");function vl({taskSeq:e,items:u,loading:c,onLoad:l}){let n={activity:(0,hF.useModal)({modalId:Lt("taskbox-task-activity")})},a=n.activity.isOpen;return(0,mF.useEffect)(()=>{a&&e>0&&!u&&l?.(e)},[a,e,u,l]),{modals:n,items:u,loading:c,openDialog:()=>n.activity.open()}}var wo=require("react/jsx-runtime"),NU={get created(){return I("activity.created")},get completed(){return I("activity.completed")},get uncompleted(){return I("activity.uncompleted")},get returned(){return I("activity.returned")},get confirm_requested(){return I("activity.confirmRequested")},get acked(){return I("activity.acked")},get claimed(){return I("activity.claimed")},get bug_verified(){return I("activity.bugVerified")},get bug_reopened(){return I("activity.bugReopened")}};function fF(e){return String(e??"").trim()||I("common.none")}function LU(e){if(e.kind!=="field")return NU[String(e.kind)]??I("activity.changed");let u=String(e.field_label??e.field??"").trim()||I("activity.field"),c=String(e.old_value??"").trim(),l=String(e.new_value??"").trim();return!c&&l?I("activity.fieldSet",{label:u,after:l}):c&&!l?I("activity.fieldCleared",{label:u}):I("activity.fieldChanged",{label:u,value:fF(c),value2:fF(l)})}function Xc({controller:e}){ue();let u=Cn(),{items:c,loading:l}=e,n=e.modals.activity,a=(0,wo.jsx)(Do.Box,{sx:{height:u?"100%":420,minHeight:0},children:(0,wo.jsx)(gF.OverlayScrollbar,{style:{height:"100%"},contentStyle:{minWidth:0},thumb:{width:6},children:(0,wo.jsxs)(Do.Box,{sx:{px:2,pt:2,display:"flex",flexDirection:"column",gap:1,"&::after":{content:'""',flexShrink:0,height:16}},children:[l&&!c?(0,wo.jsxs)(Do.Box,{sx:{display:"flex",alignItems:"center",gap:1,color:"#9a9a97",fontSize:14.5},children:[(0,wo.jsx)(Do.CircularProgress,{size:14,thickness:5,sx:{color:"#9a9a97"}}),I("common.loading")]}):null,c&&c.length===0?(0,wo.jsx)(Do.Box,{sx:{fontSize:14.5,color:"#9a9a97"},children:I("activity.empty")}):null,(c??[]).map(r=>(0,wo.jsxs)(Do.Box,{sx:{display:"flex",flexDirection:u?"column":"row",gap:u?.25:1,alignItems:u?"stretch":"baseline",minWidth:0,flexShrink:0,...u?{pb:1,borderBottom:`1px solid ${De.NOTION_LINE_COLOR}`,"&:last-of-type":{borderBottom:"none",pb:0}}:{}},children:[(0,wo.jsx)(Do.Box,{sx:{flexShrink:0,...u?{}:{width:"10.5em"},whiteSpace:"nowrap",fontSize:13.5,color:"#9a9a97",lineHeight:1.5},children:fo(r.acted_time)}),(0,wo.jsxs)(Do.Box,{sx:{minWidth:0,fontSize:14.5,color:"#37352f",lineHeight:1.5},children:[(0,wo.jsx)(Do.Box,{component:"span",sx:{fontWeight:500},children:String(r.actor_name??"").trim()||I("dialog.noName")}),(0,wo.jsx)(Do.Box,{component:"span",sx:{ml:.5},children:LU(r)})]})]},r.seq))]})})});return(0,wo.jsx)(pF.FormDialog,{open:n.isOpen,onClose:n.close,maxWidth:"sm",fullScreen:u,mobilePresentation:u?"slide":"dialog",contentPaddingX:0,contentTopPadding:0,contentBottomPadding:0,sectionsPaddingTop:0,sectionContentPaddingTop:0,sx:u?{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:c&&c.length>0?I("activity.titleWithCount",{count:c.length}):I("activity.title"),locale:Pt(),tabs:{visible:!1},titleIcons:{delete:{visible:!1}},fontScale:{enabled:!0},fontScaleKey:"taskbox-task-activity",sections:[{id:"task-activity",showTitle:!1,children:a}],scrollPastLastSection:!1,actions:{showCancelButton:!1,right:(0,wo.jsx)(Do.Button,{variant:"contained",onClick:n.close,children:I("common.close")})}})}var um=require("@ehfuse/alerts");var bF=e=>e?e.replace(/<(script|style)[\s\S]*?<\/\1>/gi,"").replace(/<br\s*\/?>/gi,`
|
|
80
80
|
`).replace(/<\/(p|div|li|h[1-6]|tr)>/gi,`
|
|
81
81
|
`).replace(/<[^>]+>/g,"").replace(/ /gi," ").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&/gi,"&").replace(/\n{3,}/g,`
|
|
82
82
|
|