buddy-workbench 0.1.3 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "buddy-workbench",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -474,8 +474,8 @@ html body {
474
474
  ${n}-eye,
475
475
  ${n}-download,
476
476
  ${n}-delete
477
- `]:{zIndex:10,width:r,margin:`0 ${J(e.marginXXS)}`,fontSize:r,cursor:"pointer",transition:`all ${e.motionDurationSlow}`,color:a,"&:hover":{color:a},svg:{verticalAlign:"baseline"}}},[`${u}-thumbnail, ${u}-thumbnail img`]:{position:"static",display:"block",width:"100%",height:"100%",objectFit:"contain"},[`${u}-name`]:{display:"none",textAlign:"center"},[`${u}-file + ${u}-name`]:{position:"absolute",bottom:e.margin,display:"block",width:`calc(100% - ${J(l(e.paddingXS).mul(2).equal())})`},[`${u}-uploading`]:{[`&${u}`]:{backgroundColor:e.colorFillAlter},[`&::before, ${n}-eye, ${n}-download, ${n}-delete`]:{display:"none"}},[`${u}-progress`]:{bottom:e.marginXL,width:`calc(100% - ${J(l(e.paddingXS).mul(2).equal())})`,paddingInlineStart:0}}}),[`${t}-wrapper${t}-picture-circle-wrapper`]:{[`${t}${t}-select`]:{borderRadius:"50%"}}}},BQ=e=>{const{componentCls:t}=e;return{[`${t}-rtl`]:{direction:"rtl"}}},LQ=e=>{const{componentCls:t,colorTextDisabled:n}=e;return{[`${t}-wrapper`]:Object.assign(Object.assign({},an(e)),{[t]:{outline:0,"input[type='file']":{cursor:"pointer"}},[`${t}-select`]:{display:"inline-block"},[`${t}-hidden`]:{display:"none"},[`${t}-disabled`]:{color:n,cursor:"not-allowed"}})}},HQ=e=>({actionsColor:e.colorIcon,pictureCardSize:e.controlHeightLG*2.55}),FQ=Qt("Upload",e=>{const{fontSizeHeading3:t,fontHeight:n,lineWidth:r,pictureCardSize:a,calc:l}=e,c=Gt(e,{uploadThumbnailSize:l(t).mul(2).equal(),uploadProgressOffset:l(l(n).div(2)).add(r).equal(),uploadPicCardSize:a});return[LQ(c),PQ(c),DQ(c),AQ(c),zQ(c),_Q(c),BQ(c),qu(c)]},HQ);var kQ={icon:function(t,n){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M534 352V136H232v752h560V394H576a42 42 0 01-42-42z",fill:n}},{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0042 42h216v494z",fill:t}}]}},name:"file",theme:"twotone"},VQ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:kQ}))},KQ=s.forwardRef(VQ),WQ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z"}}]},name:"paper-clip",theme:"outlined"},qQ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:WQ}))},UQ=s.forwardRef(qQ),GQ={icon:function(t,n){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z",fill:t}},{tag:"path",attrs:{d:"M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z",fill:n}},{tag:"path",attrs:{d:"M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z",fill:n}},{tag:"path",attrs:{d:"M276 368a28 28 0 1056 0 28 28 0 10-56 0z",fill:n}},{tag:"path",attrs:{d:"M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z",fill:t}}]}},name:"picture",theme:"twotone"},XQ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:GQ}))},YQ=s.forwardRef(XQ);function Mf(e){return Object.assign(Object.assign({},e),{lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,name:e.name,size:e.size,type:e.type,uid:e.uid,percent:0,originFileObj:e})}function jf(e,t){const n=Ne(t),r=n.findIndex(({uid:a})=>a===e.uid);return r===-1?n.push(e):n[r]=e,n}function Rh(e,t){const n=e.uid!==void 0?"uid":"name";return t.filter(r=>r[n]===e[n])[0]}function QQ(e,t){const n=e.uid!==void 0?"uid":"name",r=t.filter(a=>a[n]!==e[n]);return r.length===t.length?null:r}const ZQ=(e="")=>{const t=e.split("/"),r=t[t.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(r)||[""])[0]},y3=e=>e.indexOf("image/")===0,JQ=e=>{if(e.type&&!e.thumbUrl)return y3(e.type);const t=e.thumbUrl||e.url||"",n=ZQ(t);return/^data:image\//.test(t)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(n)?!0:!(/^data:/.test(t)||n)},Ei=200;function eZ(e){return new Promise(t=>{if(!e.type||!y3(e.type)){t("");return}const n=document.createElement("canvas");n.width=Ei,n.height=Ei,n.style.cssText=`position: fixed; left: 0; top: 0; width: ${Ei}px; height: ${Ei}px; z-index: 9999; display: none;`,document.body.appendChild(n);const r=n.getContext("2d"),a=new Image;if(a.onload=()=>{const{width:l,height:c}=a;let u=Ei,f=Ei,m=0,v=0;l>c?(f=c*(Ei/l),v=-(f-u)/2):(u=l*(Ei/c),m=-(u-f)/2),r.drawImage(a,m,v,u,f);const g=n.toDataURL();document.body.removeChild(n),window.URL.revokeObjectURL(a.src),t(g)},a.crossOrigin="anonymous",e.type.startsWith("image/svg+xml")){const l=new FileReader;l.onload=()=>{l.result&&typeof l.result=="string"&&(a.src=l.result)},l.readAsDataURL(e)}else if(e.type.startsWith("image/gif")){const l=new FileReader;l.onload=()=>{l.result&&t(l.result)},l.readAsDataURL(e)}else a.src=window.URL.createObjectURL(e)})}var tZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"},nZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:tZ}))},C3=s.forwardRef(nZ);const rZ=s.forwardRef(({prefixCls:e,className:t,style:n,locale:r,listType:a,file:l,items:c,progress:u,iconRender:f,actionIconRender:m,itemRender:v,isImgUrl:g,showPreviewIcon:h,showRemoveIcon:b,showDownloadIcon:C,previewIcon:S,removeIcon:y,downloadIcon:x,extra:$,onPreview:w,onDownload:R,onClose:O},I)=>{var T,j;const{status:M}=l,[P,z]=s.useState(M);s.useEffect(()=>{M!=="removed"&&z(M)},[M]);const[D,L]=s.useState(!1);s.useEffect(()=>{const le=setTimeout(()=>{L(!0)},300);return()=>{clearTimeout(le)}},[]);const A=f(l);let F=s.createElement("div",{className:`${e}-icon`},A);if(a==="picture"||a==="picture-card"||a==="picture-circle")if(P==="uploading"||!l.thumbUrl&&!l.url){const le=ee(`${e}-list-item-thumbnail`,{[`${e}-list-item-file`]:P!=="uploading"});F=s.createElement("div",{className:le},A)}else{const le=g!=null&&g(l)?s.createElement("img",{src:l.thumbUrl||l.url,alt:l.name,className:`${e}-list-item-image`,crossOrigin:l.crossOrigin}):A,de=ee(`${e}-list-item-thumbnail`,{[`${e}-list-item-file`]:g&&!g(l)});F=s.createElement("a",{className:de,onClick:ue=>w(l,ue),href:l.url||l.thumbUrl,target:"_blank",rel:"noopener noreferrer"},le)}const _=ee(`${e}-list-item`,`${e}-list-item-${P}`),B=typeof l.linkProps=="string"?JSON.parse(l.linkProps):l.linkProps,W=(typeof b=="function"?b(l):b)?m((typeof y=="function"?y(l):y)||s.createElement(xl,null),()=>O(l),e,r.removeFile,!0):null,G=(typeof C=="function"?C(l):C)&&P==="done"?m((typeof x=="function"?x(l):x)||s.createElement(C3,null),()=>R(l),e,r.downloadFile):null,Y=a!=="picture-card"&&a!=="picture-circle"&&s.createElement("span",{key:"download-delete",className:ee(`${e}-list-item-actions`,{picture:a==="picture"})},G,W),H=typeof $=="function"?$(l):$,q=H&&s.createElement("span",{className:`${e}-list-item-extra`},H),V=ee(`${e}-list-item-name`),Z=l.url?s.createElement("a",Object.assign({key:"view",target:"_blank",rel:"noopener noreferrer",className:V,title:l.name},B,{href:l.url,onClick:le=>w(l,le)}),l.name,q):s.createElement("span",{key:"view",className:V,onClick:le=>w(l,le),title:l.name},l.name,q),U=(typeof h=="function"?h(l):h)&&(l.url||l.thumbUrl)?s.createElement("a",{href:l.url||l.thumbUrl,target:"_blank",rel:"noopener noreferrer",onClick:le=>w(l,le),title:r.previewFile},typeof S=="function"?S(l):S||s.createElement(O4,null)):null,Q=(a==="picture-card"||a==="picture-circle")&&P!=="uploading"&&s.createElement("span",{className:`${e}-list-item-actions`},U,P==="done"&&G,W),{getPrefixCls:ne}=s.useContext(xt),ae=ne(),ce=s.createElement("div",{className:_},F,Z,Y,Q,D&&s.createElement(Vr,{motionName:`${ae}-fade`,visible:P==="uploading",motionDeadline:2e3},({className:le})=>{const de="percent"in l?s.createElement(Zq,Object.assign({type:"line",percent:l.percent,"aria-label":l["aria-label"],"aria-labelledby":l["aria-labelledby"]},u)):null;return s.createElement("div",{className:ee(`${e}-list-item-progress`,le)},de)})),pe=l.response&&typeof l.response=="string"?l.response:((T=l.error)===null||T===void 0?void 0:T.statusText)||((j=l.error)===null||j===void 0?void 0:j.message)||r.uploadError,fe=P==="error"?s.createElement(Ar,{title:pe,getPopupContainer:le=>le.parentNode},ce):ce;return s.createElement("div",{className:ee(`${e}-list-item-container`,t),style:n,ref:I},v?v(fe,l,c,{download:R.bind(null,l),preview:w.bind(null,l),remove:O.bind(null,l)}):fe)}),aZ=(e,t)=>{const{listType:n="text",previewFile:r=eZ,onPreview:a,onDownload:l,onRemove:c,locale:u,iconRender:f,isImageUrl:m=JQ,prefixCls:v,items:g=[],showPreviewIcon:h=!0,showRemoveIcon:b=!0,showDownloadIcon:C=!1,removeIcon:S,previewIcon:y,downloadIcon:x,extra:$,progress:w={size:[-1,2],showInfo:!1},appendAction:R,appendActionVisible:O=!0,itemRender:I,disabled:T}=e,[,j]=xb(),[M,P]=s.useState(!1),z=["picture-card","picture-circle"].includes(n);s.useEffect(()=>{n.startsWith("picture")&&(g||[]).forEach(V=>{!(V.originFileObj instanceof File||V.originFileObj instanceof Blob)||V.thumbUrl!==void 0||(V.thumbUrl="",r==null||r(V.originFileObj).then(Z=>{V.thumbUrl=Z||"",j()}))})},[n,g,r]),s.useEffect(()=>{P(!0)},[]);const D=(V,Z)=>{if(a)return Z==null||Z.preventDefault(),a(V)},L=V=>{typeof l=="function"?l(V):V.url&&window.open(V.url)},A=V=>{c==null||c(V)},F=V=>{if(f)return f(V,n);const Z=V.status==="uploading";if(n.startsWith("picture")){const U=n==="picture"?s.createElement(fo,null):u.uploading,Q=m!=null&&m(V)?s.createElement(YQ,null):s.createElement(KQ,null);return Z?U:Q}return Z?s.createElement(fo,null):s.createElement(UQ,null)},_=(V,Z,U,Q,ne)=>{const ae={type:"text",size:"small",title:Q,onClick:ce=>{var pe,fe;Z(),s.isValidElement(V)&&((fe=(pe=V.props).onClick)===null||fe===void 0||fe.call(pe,ce))},className:`${U}-list-item-action`,disabled:ne?T:!1};return s.isValidElement(V)?s.createElement(en,Object.assign({},ae,{icon:cr(V,Object.assign(Object.assign({},V.props),{onClick:()=>{}}))})):s.createElement(en,Object.assign({},ae),s.createElement("span",null,V))};s.useImperativeHandle(t,()=>({handlePreview:D,handleDownload:L}));const{getPrefixCls:B}=s.useContext(xt),W=B("upload",v),G=B(),Y=ee(`${W}-list`,`${W}-list-${n}`),H=s.useMemo(()=>yn(Ls(G),["onAppearEnd","onEnterEnd","onLeaveEnd"]),[G]),q=Object.assign(Object.assign({},z?{}:H),{motionDeadline:2e3,motionName:`${W}-${z?"animate-inline":"animate"}`,keys:Ne(g.map(V=>({key:V.uid,file:V}))),motionAppear:M});return s.createElement("div",{className:Y},s.createElement(Cb,Object.assign({},q,{component:!1}),({key:V,file:Z,className:U,style:Q})=>s.createElement(rZ,{key:V,locale:u,prefixCls:W,className:U,style:Q,file:Z,items:g,progress:w,listType:n,isImgUrl:m,showPreviewIcon:h,showRemoveIcon:b,showDownloadIcon:C,removeIcon:S,previewIcon:y,downloadIcon:x,extra:$,iconRender:F,actionIconRender:_,itemRender:I,onPreview:D,onDownload:L,onClose:A})),R&&s.createElement(Vr,Object.assign({},q,{visible:O,forceRender:!0}),({className:V,style:Z})=>cr(R,U=>({className:ee(U.className,V),style:Object.assign(Object.assign(Object.assign({},Z),{pointerEvents:V?"none":void 0}),U.style)}))))},oZ=s.forwardRef(aZ);var iZ=function(e,t,n,r){function a(l){return l instanceof n?l:new n(function(c){c(l)})}return new(n||(n=Promise))(function(l,c){function u(v){try{m(r.next(v))}catch(g){c(g)}}function f(v){try{m(r.throw(v))}catch(g){c(g)}}function m(v){v.done?l(v.value):a(v.value).then(u,f)}m((r=r.apply(e,[])).next())})};const vu=`__LIST_IGNORE_${Date.now()}__`,lZ=(e,t)=>{const n=or("upload"),{fileList:r,defaultFileList:a,onRemove:l,showUploadList:c=!0,listType:u="text",onPreview:f,onDownload:m,onChange:v,onDrop:g,previewFile:h,disabled:b,locale:C,iconRender:S,isImageUrl:y,progress:x,prefixCls:$,className:w,type:R="select",children:O,style:I,itemRender:T,maxCount:j,data:M={},multiple:P=!1,hasControlInside:z=!0,action:D="",accept:L="",supportServerRender:A=!0,rootClassName:F}=e,_=s.useContext(Lr),B=b??_,W=e.customRequest||n.customRequest,[G,Y]=wn(a||[],{value:r,postState:Ce=>Ce??[]}),[H,q]=s.useState("drop"),V=s.useRef(null),Z=s.useRef(null);s.useMemo(()=>{const Ce=Date.now();(r||[]).forEach((ze,qe)=>{!ze.uid&&!Object.isFrozen(ze)&&(ze.uid=`__AUTO__${Ce}_${qe}__`)})},[r]);const U=(Ce,ze,qe)=>{let Ke=Ne(ze),ft=!1;j===1?Ke=Ke.slice(-1):j&&(ft=Ke.length>j,Ke=Ke.slice(0,j)),Ua.flushSync(()=>{Y(Ke)});const Ot={file:Ce,fileList:Ke};qe&&(Ot.event=qe),(!ft||Ce.status==="removed"||Ke.some(Fe=>Fe.uid===Ce.uid))&&Ua.flushSync(()=>{v==null||v(Ot)})},Q=(Ce,ze)=>iZ(void 0,void 0,void 0,function*(){const{beforeUpload:qe,transformFile:Ke}=e;let ft=Ce;if(qe){const Ot=yield qe(Ce,ze);if(Ot===!1)return!1;if(delete Ce[vu],Ot===vu)return Object.defineProperty(Ce,vu,{value:!0,configurable:!0}),!1;typeof Ot=="object"&&Ot&&(ft=Ot)}return Ke&&(ft=yield Ke(ft)),ft}),ne=Ce=>{const ze=Ce.filter(ft=>!ft.file[vu]);if(!ze.length)return;const qe=ze.map(ft=>Mf(ft.file));let Ke=Ne(G);qe.forEach(ft=>{Ke=jf(ft,Ke)}),qe.forEach((ft,Ot)=>{let Fe=ft;if(ze[Ot].parsedFile)ft.status="uploading";else{const{originFileObj:at}=ft;let mt;try{mt=new File([at],at.name,{type:at.type})}catch{mt=new Blob([at],{type:at.type}),mt.name=at.name,mt.lastModifiedDate=new Date,mt.lastModified=new Date().getTime()}mt.uid=ft.uid,Fe=mt}U(Fe,Ke)})},ae=(Ce,ze,qe)=>{try{typeof Ce=="string"&&(Ce=JSON.parse(Ce))}catch{}if(!Rh(ze,G))return;const Ke=Mf(ze);Ke.status="done",Ke.percent=100,Ke.response=Ce,Ke.xhr=qe;const ft=jf(Ke,G);U(Ke,ft)},ce=(Ce,ze)=>{if(!Rh(ze,G))return;const qe=Mf(ze);qe.status="uploading",qe.percent=Ce.percent;const Ke=jf(qe,G);U(qe,Ke,Ce)},pe=(Ce,ze,qe)=>{if(!Rh(qe,G))return;const Ke=Mf(qe);Ke.error=Ce,Ke.response=ze,Ke.status="error";const ft=jf(Ke,G);U(Ke,ft)},fe=Ce=>{let ze;Promise.resolve(typeof l=="function"?l(Ce):l).then(qe=>{var Ke;if(qe===!1)return;const ft=QQ(Ce,G);ft&&(ze=Object.assign(Object.assign({},Ce),{status:"removed"}),G==null||G.forEach(Ot=>{const Fe=ze.uid!==void 0?"uid":"name";Ot[Fe]===ze[Fe]&&!Object.isFrozen(Ot)&&(Ot.status="removed")}),(Ke=V.current)===null||Ke===void 0||Ke.abort(ze),U(ze,ft))})},le=Ce=>{q(Ce.type),Ce.type==="drop"&&(g==null||g(Ce))};s.useImperativeHandle(t,()=>({onBatchStart:ne,onSuccess:ae,onProgress:ce,onError:pe,fileList:G,upload:V.current,nativeElement:Z.current}));const{getPrefixCls:de,direction:ue,upload:ie}=s.useContext(xt),oe=de("upload",$),ve=Object.assign(Object.assign({onBatchStart:ne,onError:pe,onProgress:ce,onSuccess:ae},e),{customRequest:W,data:M,multiple:P,action:D,accept:L,supportServerRender:A,prefixCls:oe,disabled:B,beforeUpload:Q,onChange:void 0,hasControlInside:z});delete ve.className,delete ve.style,(!O||B)&&delete ve.id;const ye=`${oe}-wrapper`,[$e,Re,ge]=FQ(oe,ye),[Ie]=Ja("Upload",Xa.Upload),{showRemoveIcon:xe,showPreviewIcon:be,showDownloadIcon:_e,removeIcon:ke,previewIcon:nt,downloadIcon:Ge,extra:Ve}=typeof c=="boolean"?{}:c,Ze=typeof xe>"u"?!B:xe,Te=(Ce,ze)=>c?s.createElement(oZ,{prefixCls:oe,listType:u,items:G,previewFile:h,onPreview:f,onDownload:m,onRemove:fe,showRemoveIcon:Ze,showPreviewIcon:be,showDownloadIcon:_e,removeIcon:ke,previewIcon:nt,downloadIcon:Ge,iconRender:S,extra:Ve,locale:Object.assign(Object.assign({},Ie),C),isImageUrl:y,progress:x,appendAction:Ce,appendActionVisible:ze,itemRender:T,disabled:B}):Ce,Ee=ee(ye,w,F,Re,ge,ie==null?void 0:ie.className,{[`${oe}-rtl`]:ue==="rtl",[`${oe}-picture-card-wrapper`]:u==="picture-card",[`${oe}-picture-circle-wrapper`]:u==="picture-circle"}),Ae=Object.assign(Object.assign({},ie==null?void 0:ie.style),I);if(R==="drag"){const Ce=ee(Re,oe,`${oe}-drag`,{[`${oe}-drag-uploading`]:G.some(ze=>ze.status==="uploading"),[`${oe}-drag-hover`]:H==="dragover",[`${oe}-disabled`]:B,[`${oe}-rtl`]:ue==="rtl"});return $e(s.createElement("span",{className:Ee,ref:Z},s.createElement("div",{className:Ce,style:Ae,onDrop:le,onDragOver:le,onDragLeave:le},s.createElement(nb,Object.assign({},ve,{ref:V,className:`${oe}-btn`}),s.createElement("div",{className:`${oe}-drag-container`},O))),Te()))}const De=ee(oe,`${oe}-select`,{[`${oe}-disabled`]:B,[`${oe}-hidden`]:!O}),Ue=s.createElement("div",{className:De,style:Ae},s.createElement(nb,Object.assign({},ve,{ref:V})));return $e(u==="picture-card"||u==="picture-circle"?s.createElement("span",{className:Ee,ref:Z},Te(Ue,!!O)):s.createElement("span",{className:Ee,ref:Z},Ue,Te()))},S3=s.forwardRef(lZ);var sZ=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n};const cZ=s.forwardRef((e,t)=>{const{style:n,height:r,hasControlInside:a=!1,children:l}=e,c=sZ(e,["style","height","hasControlInside","children"]),u=Object.assign(Object.assign({},n),{height:r});return s.createElement(S3,Object.assign({ref:t,hasControlInside:a},c,{style:u,type:"drag"}),l)}),Py=S3;Py.Dragger=cZ;Py.LIST_IGNORE=vu;var uZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z"}}]},name:"arrow-right",theme:"outlined"},dZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:uZ}))},fZ=s.forwardRef(dZ),mZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},vZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:mZ}))},gZ=s.forwardRef(vZ),pZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M326 664H104c-8.8 0-16 7.2-16 16v48c0 8.8 7.2 16 16 16h174v176c0 8.8 7.2 16 16 16h48c8.8 0 16-7.2 16-16V696c0-17.7-14.3-32-32-32zm16-576h-48c-8.8 0-16 7.2-16 16v176H104c-8.8 0-16 7.2-16 16v48c0 8.8 7.2 16 16 16h222c17.7 0 32-14.3 32-32V104c0-8.8-7.2-16-16-16zm578 576H698c-17.7 0-32 14.3-32 32v224c0 8.8 7.2 16 16 16h48c8.8 0 16-7.2 16-16V744h174c8.8 0 16-7.2 16-16v-48c0-8.8-7.2-16-16-16zm0-384H746V104c0-8.8-7.2-16-16-16h-48c-8.8 0-16 7.2-16 16v224c0 17.7 14.3 32 32 32h222c8.8 0 16-7.2 16-16v-48c0-8.8-7.2-16-16-16z"}}]},name:"compress",theme:"outlined"},hZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:pZ}))},rb=s.forwardRef(hZ),bZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},yZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:bZ}))},CZ=s.forwardRef(yZ),SZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M688 312v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8zm-392 88c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm144 452H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm445.7 51.5l-93.3-93.3C814.7 780.7 828 743.9 828 704c0-97.2-78.8-176-176-176s-176 78.8-176 176 78.8 176 176 176c35.8 0 69-10.7 96.8-29l94.7 94.7c1.6 1.6 3.6 2.3 5.6 2.3s4.1-.8 5.6-2.3l31-31a7.9 7.9 0 000-11.2zM652 816c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"file-search",theme:"outlined"},xZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:SZ}))},x3=s.forwardRef(xZ),$Z={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"},wZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:$Z}))},EZ=s.forwardRef(wZ),OZ={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M885.2 446.3l-.2-.8-112.2-285.1c-5-16.1-19.9-27.2-36.8-27.2H281.2c-17 0-32.1 11.3-36.9 27.6L139.4 443l-.3.7-.2.8c-1.3 4.9-1.7 9.9-1 14.8-.1 1.6-.2 3.2-.2 4.8V830a60.9 60.9 0 0060.8 60.8h627.2c33.5 0 60.8-27.3 60.9-60.8V464.1c0-1.3 0-2.6-.1-3.7.4-4.9 0-9.6-1.3-14.1zm-295.8-43l-.3 15.7c-.8 44.9-31.8 75.1-77.1 75.1-22.1 0-41.1-7.1-54.8-20.6S436 441.2 435.6 419l-.3-15.7H229.5L309 210h399.2l81.7 193.3H589.4zm-375 76.8h157.3c24.3 57.1 76 90.8 140.4 90.8 33.7 0 65-9.4 90.3-27.2 22.2-15.6 39.5-37.4 50.7-63.6h156.5V814H214.4V480.1z"}}]},name:"inbox",theme:"outlined"},RZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:OZ}))},NZ=s.forwardRef(RZ),IZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"},TZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:IZ}))},MZ=s.forwardRef(TZ),jZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5L255.8 713.6l-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l110.3 111.2c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.1 304.1 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112m161.2 465.2C726.2 620.3 668.9 644 608 644s-118.2-23.7-161.2-66.8C403.7 534.2 380 476.9 380 416s23.7-118.2 66.8-161.2c43-43.1 100.3-66.8 161.2-66.8s118.2 23.7 161.2 66.8c43.1 43 66.8 100.3 66.8 161.2s-23.7 118.2-66.8 161.2"}}]},name:"key",theme:"outlined"},PZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:jZ}))},zZ=s.forwardRef(PZ),_Z={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"},DZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:_Z}))},AZ=s.forwardRef(DZ),BZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z"}}]},name:"play-circle",theme:"outlined"},LZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:BZ}))},xm=s.forwardRef(LZ),HZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 736c0-111.6-65.4-208-160-252.9V317.3c0-15.1-5.3-29.7-15.1-41.2L536.5 95.4C530.1 87.8 521 84 512 84s-18.1 3.8-24.5 11.4L335.1 276.1a63.97 63.97 0 00-15.1 41.2v165.8C225.4 528 160 624.4 160 736h156.5c-2.3 7.2-3.5 15-3.5 23.8 0 22.1 7.6 43.7 21.4 60.8a97.2 97.2 0 0043.1 30.6c23.1 54 75.6 88.8 134.5 88.8 29.1 0 57.3-8.6 81.4-24.8 23.6-15.8 41.9-37.9 53-64a97 97 0 0043.1-30.5 97.52 97.52 0 0021.4-60.8c0-8.4-1.1-16.4-3.1-23.8H864zM762.3 621.4c9.4 14.6 17 30.3 22.5 46.6H700V558.7a211.6 211.6 0 0162.3 62.7zM388 483.1V318.8l124-147 124 147V668H388V483.1zM239.2 668c5.5-16.3 13.1-32 22.5-46.6 16.3-25.2 37.5-46.5 62.3-62.7V668h-84.8zm388.9 116.2c-5.2 3-11.2 4.2-17.1 3.4l-19.5-2.4-2.8 19.4c-5.4 37.9-38.4 66.5-76.7 66.5-38.3 0-71.3-28.6-76.7-66.5l-2.8-19.5-19.5 2.5a27.7 27.7 0 01-17.1-3.5c-8.7-5-14.1-14.3-14.1-24.4 0-10.6 5.9-19.4 14.6-23.8h231.3c8.8 4.5 14.6 13.3 14.6 23.8-.1 10.2-5.5 19.6-14.2 24.5zM464 400a48 48 0 1096 0 48 48 0 10-96 0z"}}]},name:"rocket",theme:"outlined"},FZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:HZ}))},ab=s.forwardRef(FZ),kZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},VZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:kZ}))},KZ=s.forwardRef(VZ),WZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},qZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:WZ}))},ob=s.forwardRef(qZ),UZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 01144-53.5L537 318.9a32.05 32.05 0 000 45.3l124.5 124.5a32.05 32.05 0 0045.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z"}}]},name:"tool",theme:"outlined"},GZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:UZ}))},XZ=s.forwardRef(GZ),YZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},QZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:YZ}))},ZZ=s.forwardRef(QZ);async function Sn(e,t){const n=await fetch(e,t);if(!n.ok)throw new Error((await n.json().catch(()=>({}))).error||"Something went wrong. Please try again.");return n.status===204?null:n.json()}const Rr={list:()=>Sn("/api/launchers"),running:()=>Sn("/api/launchers/running"),create:e=>Sn("/api/launchers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),update:(e,t)=>Sn(`/api/launchers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),start:e=>Sn(`/api/launchers/${e}/start`,{method:"POST"}),run:(e,t)=>Sn(`/api/launchers/${e}/scripts/${t}/run`,{method:"POST"}),runInstall:e=>Sn(`/api/launchers/${e}/install/run`,{method:"POST"}),stop:async(e,t)=>{try{return await Sn(`/api/launchers/${e}/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scriptId:t})})}catch{return Sn(`/api/launchers/${e}/scripts/${encodeURIComponent(t)}/stop`,{method:"POST"})}},logs:(e,t)=>Sn(`/api/launchers/${e}/scripts/${t}/logs`),errorLogs:(e,t)=>Sn(`/api/launchers/${e}/scripts/${t}/logs/error`),packageScripts:e=>Sn(`/api/launchers/${e}/package-scripts`),runPackageScript:(e,t)=>Sn(`/api/launchers/${e}/package-scripts/${encodeURIComponent(t)}/run`,{method:"POST"}),packageScriptLogs:(e,t)=>Sn(`/api/launchers/${e}/package-scripts/${encodeURIComponent(t)}/logs`),packageScriptErrorLogs:(e,t)=>Sn(`/api/launchers/${e}/package-scripts/${encodeURIComponent(t)}/logs/error`)},JZ={list:()=>Sn("/api/plugins")},Nh={list:e=>Sn(`/api/clipboard${e?`?date=${encodeURIComponent(e)}`:""}`),remove:(e,t)=>Sn(`/api/clipboard/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:"DELETE"}),uploadImage:e=>Sn("/api/clipboard/image",{method:"POST",headers:{"Content-Type":e.type||"image/png"},body:e})},Wo={list:()=>Sn("/api/group-tasks"),catalog:()=>Sn("/api/group-tasks/catalog"),create:e=>Sn("/api/group-tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),update:(e,t)=>Sn(`/api/group-tasks/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),remove:e=>Sn(`/api/group-tasks/${e}`,{method:"DELETE"}),start:e=>Sn(`/api/group-tasks/${e}/start`,{method:"POST"}),stop:e=>Sn(`/api/group-tasks/${e}/stop`,{method:"POST"})},Ih={list:()=>Sn("/api/port-diagnostics"),get:e=>Sn(`/api/port-diagnostics/${encodeURIComponent(e)}`),kill:(e,t)=>Sn("/api/port-diagnostics/kill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({port:e,pid:t})})},gu={status:()=>Sn("/api/settings"),saveDomain:e=>Sn("/api/settings/domain",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:e})}),saveAccessToken:(e,t)=>Sn(`/api/settings/${encodeURIComponent(e)}-access-token`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t})})},Th={check:e=>Sn("/api/pr-review/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prLink:e})}),myPrs:()=>Sn("/api/pr-review/my-prs"),reviewPrs:()=>Sn("/api/pr-review/review-prs")},{Title:eJ,Text:b2,Paragraph:tJ}=ca,ou=()=>new Intl.DateTimeFormat("en-CA").format(new Date);function nJ({value:e}){const t=[],n=/\[[^\]]+\]\(https?:\/\/[^\s)]+\)|https?:\/\/[^\s]+/g;let r=0;for(const a of e.matchAll(n)){a.index>r&&t.push(e.slice(r,a.index));const l=a[0].match(/^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/);if(l)t.push(K.jsx("a",{href:l[2],target:"_blank",rel:"noreferrer",children:l[1]},a.index));else{const c=a[0].replace(/[),.;:!?]+$/,"");t.push(K.jsx("a",{href:c,target:"_blank",rel:"noreferrer",children:c},a.index)),t.push(a[0].slice(c.length))}r=a.index+a[0].length}return r<e.length&&t.push(e.slice(r)),t}const y2=e=>e.text||e.preview||"";function iu(e,t){const n=e.trim();return n?t==="account"?/^[AT]\d+.*$/i.test(n)&&n.length<=20||/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/i.test(n)||/\b(?:account|username|user\s*name|login|帐号|账号|用户名)\s*[:=]/i.test(n):t==="id"?/\b[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\b/i.test(n)||/\b\d{15,18}[0-9Xx]?\b/.test(n)||/\b(?:id|uid|uuid|身份证)\s*[:=]\s*[\w-]+/i.test(n):t==="url"?/https?:\/\/[^\s]+/i.test(n):t==="code"?/```[\s\S]*?```|\b(?:const|let|var|function|class|import|export|SELECT|INSERT|UPDATE|DELETE)\b|[{};][\s\S]*[{};]/.test(n):!0:!1}function rJ(){const{message:e}=Pl.useApp(),[t,n]=s.useState([]),[r,a]=s.useState(ou()),[l,c]=s.useState([]),[u,f]=s.useState("all"),[m,v]=s.useState(null),g=async w=>{try{const R=await Nh.list(w);n(R.dates),c(R.items)}catch(R){e.error(R.message)}},h=s.useRef(ou());s.useEffect(()=>{const w=()=>{const T=ou();if(T!==h.current){const j=h.current;if(h.current=T,r===j)return a(T),!0}return!1};w()||g(r);const O=()=>{w()||g(r)};window.addEventListener("visibilitychange",O),window.addEventListener("focus",O);let I=null;return r===ou()&&(I=setInterval(()=>{document.visibilityState==="visible"&&g(r)},3e3)),()=>{window.removeEventListener("visibilitychange",O),window.removeEventListener("focus",O),I&&clearInterval(I)}},[r]);const b=async w=>{try{await Nh.remove(r,w),await g(r),e.success("Clipboard entry deleted.")}catch(R){e.error(R.message)}},C=async w=>{if(w.imageFile)try{const O=await(await fetch(`${window.location.origin}/api/clipboard/image/${w.imageFile}`)).blob();await navigator.clipboard.write([new ClipboardItem({[O.type]:O})]),v(w.id),setTimeout(()=>{v(I=>I===w.id?null:I)},1e3)}catch(R){e.error("Failed to copy image: "+R.message)}else navigator.clipboard.writeText(w.text||w.preview),v(w.id),setTimeout(()=>{v(R=>R===w.id?null:R)},1e3)};s.useEffect(()=>{const w=R=>{const O=document.activeElement;if(!(O&&(O.tagName==="INPUT"||O.tagName==="TEXTAREA"||O.isContentEditable))){if(R.key==="ArrowLeft"){const I=[...new Set([...t,r])].sort(),T=I.indexOf(r);T<I.length-1&&T!==-1&&a(I[T+1])}else if(R.key==="ArrowRight"){const I=[...new Set([...t,r])].sort(),T=I.indexOf(r);T>0&&a(I[T-1])}}};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[t,r]),s.useEffect(()=>{const w=async R=>{var T;const O=document.activeElement;if(O&&(O.tagName==="INPUT"||O.tagName==="TEXTAREA"||O.isContentEditable))return;const I=(T=R.clipboardData)==null?void 0:T.items;if(I){for(const j of I)if(j.type.startsWith("image/")){const M=j.getAsFile();if(M){try{e.loading({content:"Saving image from paste…",key:"paste-upload",duration:0}),await Nh.uploadImage(M);const P=ou();a(P),await g(P),e.success({content:"Image pasted and saved to history!",key:"paste-upload"})}catch(P){e.error({content:"Failed to save pasted image: "+P.message,key:"paste-upload"})}break}}}};return window.addEventListener("paste",w),()=>window.removeEventListener("paste",w)},[r]);const S=t.reduce((w,R)=>{var j;const[O,I,T]=R.split("-");return w[O]||(w[O]={}),(j=w[O])[I]||(j[I]=[]),w[O][I].push(T),w},{}),y=Object.entries(S).sort(([w],[R])=>R.localeCompare(w)).map(([w,R])=>({value:w,label:w,children:Object.entries(R).sort(([O],[I])=>I.localeCompare(O)).map(([O,I])=>({value:O,label:O,children:I.sort().reverse().map(T=>({value:T,label:T}))}))})),x=s.useMemo(()=>u==="all"?l:u==="image"?l.filter(w=>!!w.imageFile):l.filter(w=>!w.imageFile&&iu(y2(w),u)),[u,l]),$=s.useMemo(()=>{const w={all:l.length,account:0,id:0,url:0,code:0,image:0};for(const R of l)if(R.imageFile)w.image++;else{const O=y2(R);iu(O,"account")&&w.account++,iu(O,"id")&&w.id++,iu(O,"url")&&w.url++,iu(O,"code")&&w.code++}return[{key:"all",label:`All (${w.all})`},{key:"account",label:`Account (${w.account})`},{key:"id",label:`ID (${w.id})`},{key:"url",label:`Url (${w.url})`},{key:"code",label:`Code (${w.code})`},{key:"image",label:`Img (${w.image})`}]},[l]);return K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"page-header",children:[K.jsxs("div",{children:[K.jsx(b2,{type:"secondary",children:"LOCAL CLIPBOARD"}),K.jsx(eJ,{level:2,children:"Clipboard history"}),K.jsx(tJ,{type:"secondary",children:"Saved locally and archived by date."})]}),K.jsx(ic,{className:"clipboard-picker",options:y,value:r.split("-"),onChange:w=>(w==null?void 0:w.length)===3&&a(w.join("-")),placeholder:"Select date"})]}),K.jsx(ac,{className:"clipboard-tabs",activeKey:u,onChange:f,items:$}),x.length?K.jsx("div",{className:"clipboard-list",children:x.map(w=>{const R=`${window.location.origin}/api/clipboard/${r}/${w.id}`,O=new Date(w.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1});return K.jsxs(_r,{size:"small",className:"clipboard-item",children:[K.jsxs("div",{children:[K.jsx(b2,{type:"secondary",children:O}),w.imageFile?K.jsx("div",{style:{marginTop:8},children:K.jsx("img",{src:`${window.location.origin}/api/clipboard/image/${w.imageFile}`,alt:"Clipboard entry",style:{maxWidth:"100%",maxHeight:300,borderRadius:6,cursor:"pointer",border:"1px solid #eef0f6"},onClick:()=>window.open(`${window.location.origin}/api/clipboard/image/${w.imageFile}`,"_blank")})}):K.jsxs(K.Fragment,{children:[K.jsx("pre",{children:K.jsx(nJ,{value:w.preview||w.text})}),w.contentFile&&K.jsxs("span",{className:"clipboard-original",children:[K.jsx("a",{href:R,target:"_blank",rel:"noreferrer",children:"View original content"}),K.jsx("a",{href:w.editorUrl,children:"Open in VS Code"})]})]})]}),K.jsxs("span",{className:"clipboard-actions",children:[K.jsx(Ar,{title:m===w.id?"Copied!":"Copy",children:K.jsx(en,{type:"text",icon:m===w.id?K.jsx(Zu,{style:{color:"#52c41a"}}):K.jsx(od,{}),onClick:()=>C(w)})}),K.jsx(Ar,{title:"Delete",children:K.jsx(en,{type:"text",danger:!0,icon:K.jsx(xl,{}),onClick:()=>b(w.id)})})]})]},w.id)})}):K.jsx(Nr,{description:`No ${u==="all"?"clipboard entries":`${u==="id"?"ID":u} entries`} for ${r}.`}),K.jsx(_l.BackTop,{visibilityHeight:240})]})}const{Text:Mh}=ca;function aJ({tasks:e,running:t,onCreate:n,onEdit:r,onStart:a,onStop:l,onRemove:c}){const u=[{title:"Name",dataIndex:"name",render:f=>K.jsx(Mh,{strong:!0,children:f})},{title:"Scripts",dataIndex:"items",width:110,render:f=>K.jsxs(Mh,{type:"secondary",children:[f.length," scripts"]})},{title:"Actions",width:236,render:(f,m)=>{const v=m.items.some(g=>t.has(`${g.launcherId}:${g.scriptId}`));return K.jsxs(Yn,{children:[K.jsx(en,{size:"small",danger:v,icon:v?K.jsx(ob,{}):K.jsx(xm,{}),onClick:()=>v?l(m):a(m),children:v?"Stop":"Start"}),K.jsx(en,{size:"small",onClick:()=>r(m),children:"Edit"}),K.jsx(en,{size:"small",danger:!0,icon:K.jsx(xl,{}),onClick:()=>c(m),children:"Delete"})]})}}];return K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"group-task-header",children:[K.jsx(Mh,{type:"secondary",children:"Start selected scripts across multiple services."}),K.jsx(en,{type:"primary",icon:K.jsx(ov,{}),onClick:n,children:"Add quick launch"})]}),e.length?K.jsx(Pa,{className:"group-task-table",rowKey:"id",dataSource:e,columns:u,pagination:!1,size:"small"}):K.jsx(Nr,{description:"No quick launches yet.",children:K.jsx(en,{type:"primary",onClick:n,children:"Add quick launch"})})]})}const{Text:Pf}=ca,C2=(e,t)=>`${e}:${t}`,oJ=()=>K.jsxs("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",style:{verticalAlign:"middle"},children:[K.jsx("path",{d:"M514.4 36C250.8 36 36 250.8 36 514.4s214.8 478.4 478.4 478.4 478.4-214.8 478.4-478.4S777.6 36 514.4 36L514.4 36zM514.4 932.8c-231.2 0-418.4-188-418.4-418.4 0-231.2 188-418.4 418.4-418.4 231.2 0 418.4 188 418.4 418.4C932.8 745.2 745.2 932.8 514.4 932.8L514.4 932.8z"}),K.jsx("path",{d:"M620 684l-218.8 0c-33.2 0-60-27.2-60-60l0-218.8c0-33.2 27.2-60 60-60L620 345.2c33.2 0 60 27.2 60 60L680 624C680 657.2 653.2 684 620 684z"})]});function iJ({form:e,editing:t,executor:n,running:r,packageScripts:a,onRun:l,onRunInstall:c,onRunPackage:u,onStop:f,onLogs:m,onPackageLogs:v}){return K.jsx(Pn.List,{name:"scripts",children:(g,{add:h,remove:b})=>{const C=["npm","pnpm","yarn"].includes(n)?{id:"install",name:"Install",command:`${n} install${n==="npm"?" --legacy-peer-deps":""}`}:null,S=[...g.map(x=>({...x,key:`custom-${x.key}`,kind:"custom"})),...C?[{key:"install",kind:"install",script:C}]:[],...(a||[]).map(x=>({key:`package-${x.id}`,kind:"package",script:x}))],y=[{title:"Source",width:100,render:(x,$)=>K.jsx(Dr,{color:$.kind==="package"?"blue":$.kind==="install"?"green":"default",children:$.kind==="package"?"Package":$.kind==="install"?"Executor":"Custom"})},{title:"Script name",width:200,render:(x,$)=>{const w=$.kind==="custom"?e.getFieldValue(["scripts",$.name]):$.script,R=(w==null?void 0:w.name)===e.getFieldValue("startCommand"),O=t&&(w==null?void 0:w.id)&&r.has(C2(t.id,w.id));return $.kind!=="custom"?K.jsxs(Yn,{size:4,children:[O&&K.jsx(zi,{status:"success"}),K.jsx(Pf,{strong:!0,children:$.script.name}),R&&K.jsx(ab,{className:"start-script-icon"})]}):K.jsxs(Yn,{size:4,align:"center",children:[O&&K.jsx(zi,{status:"success"}),K.jsx(Pn.Item,{noStyle:!0,name:[$.name,"name"],rules:[{required:!0,message:"Required"}],children:K.jsx(Ma,{placeholder:"serve",allowClear:!0,suffix:R?K.jsx(ab,{className:"start-script-icon"}):null})})]})}},{title:"Command",render:(x,$)=>$.kind==="package"?K.jsxs(Yn,{direction:"vertical",size:0,children:[K.jsxs(Pf,{code:!0,children:[n," run ",$.script.name]}),K.jsx(Pf,{type:"secondary",children:$.script.command})]}):$.kind==="install"?K.jsx(Pf,{code:!0,children:$.script.command}):K.jsx(Pn.Item,{noStyle:!0,name:[$.name,"command"],rules:[{required:!0,message:"Required"}],children:K.jsx(Ma,{placeholder:"npm run dev",allowClear:!0})})},{title:"Actions",width:132,render:(x,$)=>{const w=$.kind==="custom"?e.getFieldValue(["scripts",$.name]):$.script,R=t&&(w==null?void 0:w.id)&&r.has(C2(t.id,w.id));return K.jsxs(Yn,{size:2,children:[t&&K.jsx(Ar,{title:R?"Stop":"Start",children:K.jsx(en,{type:"text",danger:R,icon:R?K.jsx(oJ,{}):K.jsx(xm,{}),onClick:()=>R?f(w):$.kind==="package"?u(w):$.kind==="install"?c(w):l(w),disabled:!(w!=null&&w.id)})}),K.jsx(Ar,{title:"Logs",children:K.jsx(en,{type:"text",icon:K.jsx(hy,{}),onClick:()=>$.kind==="package"?v(w):m(w),disabled:!t||!(w!=null&&w.id)})}),$.kind==="custom"&&K.jsx(Ar,{title:"Remove",children:K.jsx(en,{type:"text",danger:!0,icon:K.jsx(xl,{}),onClick:()=>b($.name)})})]})}}];return K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"script-header",children:[K.jsx(Bk,{orientation:"left",children:"Scripts"}),K.jsx(en,{icon:K.jsx(ov,{}),onClick:()=>h({name:"",command:""}),children:"Add script"})]}),K.jsx(Pa,{size:"small",rowKey:"key",pagination:!1,loading:a===null,dataSource:S,columns:y})]})}})}const lJ=()=>({alias:"",folder:"",groupName:"",executor:"npm",startCommand:"",scripts:[]});function sJ({open:e,editing:t,groups:n,running:r,onCancel:a,onSave:l,onRun:c,onRunInstall:u,onRunPackage:f,onStop:m,onLogs:v}){const{message:g}=Pl.useApp(),[h]=Pn.useForm(),[b,C]=s.useState(null);s.useEffect(()=>{e&&(h.resetFields(),h.setFieldsValue(t?{...t,scripts:t.scripts}:lJ()),C(t?null:[]),t&&Rr.packageScripts(t.id).then(y=>C(y.scripts)).catch(()=>C([])))},[e,t,h]);const S=async()=>{try{const y=(h.getFieldValue("scripts")||[]).filter(w=>{var R,O;return((R=w==null?void 0:w.name)==null?void 0:R.trim())||((O=w==null?void 0:w.command)==null?void 0:O.trim())});h.setFieldValue("scripts",y);const x=await h.validateFields(["alias","folder","groupName","startCommand"]),$={...h.getFieldsValue(!0),...x,scripts:y};await l($)}catch(y){if(y!=null&&y.errorFields)return;g.error(y.message)}};return K.jsx(ba,{title:t?`Service details · ${t.alias}`:"Add service",open:e,onCancel:a,onOk:S,okText:t?"Save":"Save service",width:860,destroyOnClose:!0,children:K.jsxs(Pn,{form:h,layout:"vertical",children:[K.jsx(im,{className:"service-config",defaultActiveKey:t?[]:["configuration"],items:[{key:"configuration",label:"Service configuration",children:K.jsxs(vm,{gutter:[16,0],children:[K.jsx(oa,{xs:24,sm:12,children:K.jsx(Pn.Item,{label:"Name",name:"alias",rules:[{required:!0}],children:K.jsx(Ma,{allowClear:!0})})}),K.jsx(oa,{xs:24,sm:12,children:K.jsx(Pn.Item,{label:"Project folder",name:"folder",rules:[{required:!0}],children:K.jsx(Ma,{prefix:K.jsx(l3,{}),allowClear:!0})})}),K.jsx(oa,{xs:24,sm:8,children:K.jsx(Pn.Item,{label:"Group",name:"groupName",children:K.jsx(sm,{options:n.map(y=>({value:y})),placeholder:"Group name",allowClear:!0})})}),K.jsx(oa,{xs:24,sm:8,children:K.jsx(Pn.Item,{label:"Executor",name:"executor",rules:[{required:!0}],children:K.jsx(sm,{options:["npm","pnpm","yarn"].map(y=>({value:y})),placeholder:"npm",allowClear:!0})})}),K.jsx(oa,{xs:24,sm:8,children:K.jsx(Pn.Item,{noStyle:!0,shouldUpdate:(y,x)=>y.scripts!==x.scripts,children:()=>{const y=(h.getFieldValue("scripts")||[]).map(w=>w==null?void 0:w.name).filter(Boolean),x=(b||[]).map(w=>w.name),$=[...new Set([...y,...x])].map(w=>({label:w,value:w}));return K.jsx(Pn.Item,{label:"Start script name",name:"startCommand",children:K.jsx(Qa,{placeholder:"Select start script",allowClear:!0,options:$})})}})})]})}]}),K.jsx(Pn.Item,{noStyle:!0,shouldUpdate:(y,x)=>y.executor!==x.executor||y.startCommand!==x.startCommand||y.scripts!==x.scripts,children:()=>K.jsx(iJ,{form:h,editing:t,executor:h.getFieldValue("executor")||"npm",running:r,packageScripts:b,onRun:y=>c(t,y),onRunInstall:()=>u(t),onRunPackage:y=>f(t,y),onStop:y=>m(t,y.id),onLogs:y=>v(t,y),onPackageLogs:y=>v(t,y,!0)})})]})})}const{Text:cJ}=ca;function uJ({open:e,editingGroupTask:t,groupCatalog:n,onCancel:r,onSave:a}){const{message:l}=Pl.useApp(),[c]=Pn.useForm();s.useEffect(()=>{e&&(c.resetFields(),c.setFieldsValue({name:(t==null?void 0:t.name)||"",items:(t==null?void 0:t.items.map(m=>`${m.launcherId}|${m.scriptId}`))||[]}))},[e,t,c]);const u=s.useMemo(()=>Object.entries(n.reduce((m,v)=>{const g=v.groupName||"Ungrouped";return(m[g]||(m[g]=[])).push(v),m},{})).sort(([m],[v])=>m.localeCompare(v)).map(([m,v])=>({key:m,label:m,children:K.jsx("div",{className:"group-task-projects",children:v.map(g=>K.jsx(_r,{size:"small",title:g.alias,children:K.jsx(Yn,{direction:"vertical",children:g.scripts.map(h=>K.jsxs(Fi,{value:`${g.id}|${h.id}`,children:[h.name," ",K.jsxs(cJ,{type:"secondary",children:["(",h.source,")"]})]},h.id))})},g.id))})})),[n]),f=async()=>{try{const m=await c.validateFields(),v={name:m.name,items:m.items.map(g=>{const[h,b]=g.split("|");return{launcherId:h,scriptId:b}})};await a(v)}catch(m){m!=null&&m.errorFields||l.error(m.message)}};return K.jsx(ba,{title:t?`Edit quick launch · ${t.name}`:"Add quick launch",open:e,onCancel:r,onOk:f,okText:t?"Save changes":"Save quick launch",width:760,destroyOnClose:!0,children:K.jsxs(Pn,{form:c,layout:"vertical",children:[K.jsx(Pn.Item,{label:"Name",name:"name",rules:[{required:!0}],children:K.jsx(Ma,{placeholder:"Start local stack",allowClear:!0})}),K.jsx(Pn.Item,{label:"Scripts",name:"items",rules:[{required:!0,message:"Select at least one script."}],children:K.jsx(Fi.Group,{className:"group-task-selector",children:K.jsx(ac,{items:u})})})]})})}const S2={30:"ansi-black",31:"ansi-red",32:"ansi-green",33:"ansi-yellow",34:"ansi-blue",35:"ansi-magenta",36:"ansi-cyan",37:"ansi-white",90:"ansi-gray",91:"ansi-red",92:"ansi-green",93:"ansi-yellow",94:"ansi-blue",95:"ansi-magenta",96:"ansi-cyan",97:"ansi-white"};function ib({value:e}){let t="";const n=(a,l,c)=>!a.includes("http")&&!a.includes("/")?K.jsx("span",{className:l,children:a},c):a.split(/(https?:\/\/[^\s<>'"`]+|\/(?:[^\s:(),;!?]+\/)*[^\s:(),;!?]+(?::\d+(?::\d+)?)?)/g).map((u,f)=>{if(/^https?:\/\//.test(u)){const m=u.replace(/[),.;:!?]+$/,""),v=u.slice(m.length);return K.jsxs("span",{className:l,children:[K.jsx("a",{className:"log-link",href:m,target:"_blank",rel:"noreferrer",children:m}),v]},`${c}-${f}`)}if(u.startsWith("/")){const[,m,v=""]=u.match(/^(.*?)(:\d+(?::\d+)?)?$/)||[],g=`vscode://file${encodeURI(m)}${v}`;return K.jsx("span",{className:l,children:K.jsx("a",{className:"log-link",href:g,target:"_blank",rel:"noreferrer",children:u})},`${c}-${f}`)}return K.jsx("span",{className:l,children:u},`${c}-${f}`)}),r=(a,l)=>a.split(/(\u001b\[[0-9;]*m)/g).map((u,f)=>{const m=u.match(/^\u001b\[([0-9;]*)m$/);if(m){const g=m[1].split(";").map(Number);return t=g.includes(0)?"":S2[g.find(h=>S2[h])]||t,null}const v=t||(/\b(error|failed|fatal|exception)\b/i.test(u)?"log-error":/\b(warn|warning)\b/i.test(u)?"log-warning":/\b(success|ready|started|listening)\b/i.test(u)?"log-success":"");return n(u,v,`${l}-${f}`)});return K.jsx("div",{className:"log-output",role:"log",children:e.split(`
478
- `).map((a,l)=>K.jsx("div",{className:"log-line",children:K.jsx("code",{children:r(a,l)})},l))})}function dJ({open:e,logTarget:t,onCancel:n}){const[r,a]=s.useState("output"),[l,c]=s.useState("");return s.useEffect(()=>{e&&(a("output"),c("Loading…"))},[e,t]),s.useEffect(()=>{if(!e||!t)return;const u=async()=>{try{const m=t.package?r==="error"?await Rr.packageScriptErrorLogs(t.launcher.id,t.script.name):await Rr.packageScriptLogs(t.launcher.id,t.script.name):r==="error"?await Rr.errorLogs(t.launcher.id,t.script.id):await Rr.logs(t.launcher.id,t.script.id);c(m.log||(r==="error"?"No error logs yet.":"No logs yet."))}catch(m){c(m.message)}};u();const f=setInterval(u,1e3);return()=>clearInterval(f)},[e,t,r]),K.jsx(ba,{title:K.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingRight:32},children:[K.jsx("span",{children:t?`${t.script.name} · Logs`:"Logs"}),t&&K.jsx(en,{type:"text",size:"small",icon:K.jsx(EZ,{}),onClick:()=>{const u=t.package?`#/logs/${t.launcher.id}/pkg/${encodeURIComponent(t.script.name)}`:`#/logs/${t.launcher.id}/${encodeURIComponent(t.script.id)}`;window.open(u,"_blank")},title:"Open in new tab",style:{display:"inline-flex",alignItems:"center",justifyContent:"center"}})]}),open:e,onCancel:n,footer:null,width:1080,zIndex:1200,children:K.jsx(ac,{activeKey:r,onChange:a,items:[{key:"output",label:"Logs",children:K.jsx(ib,{value:l})},{key:"error",label:"Error logs",children:K.jsx(ib,{value:l})}]})})}const{Title:fJ,Text:lu,Paragraph:mJ}=ca;function vJ({launchers:e,running:t,refresh:n}){const{message:r}=Pl.useApp(),[a,l]=s.useState("all"),[c,u]=s.useState([]),[f,m]=s.useState([]),[v,g]=s.useState(!1),[h,b]=s.useState(!1),[C,S]=s.useState(null),[y,x]=s.useState(!1),[$,w]=s.useState(null),[R,O]=s.useState(!1),[I,T]=s.useState(null);s.useEffect(()=>{Wo.list().then(u).catch(U=>r.error(U.message))},[]);const j=s.useMemo(()=>[...new Set(e.map(U=>U.groupName).filter(Boolean))].sort((U,Q)=>U.localeCompare(Q)),[e]),M=a==="all"?e:e.filter(U=>U.groupName===a),P=(U=null)=>{w(U),x(!0)},z=async U=>{$?await Rr.update($.id,U):(await Rr.create(U),x(!1)),r.success("Saved"),await n()},D=async(U,Q)=>{try{await Rr.run(U.id,Q.id),await n()}catch(ne){r.error(ne.message)}},L=async U=>{try{await Rr.runInstall(U.id),await n()}catch(Q){r.error(Q.message)}},A=async(U,Q)=>{try{await Rr.runPackageScript(U.id,Q.name),await n()}catch(ne){r.error(ne.message)}},F=(U,Q,ne=!1)=>{T({launcher:U,script:Q,package:ne}),O(!0)},_=async U=>{try{await Rr.start(U.id),await n()}catch(Q){r.warning(Q.message)}},B=async(U,Q)=>{try{await Rr.stop(U.id,Q),await n()}catch(ne){await n(),r.error(ne.message)}},W=async(U,Q)=>{try{await Promise.all(Q.map(ne=>Rr.stop(U.id,ne))),await n()}catch(ne){await n(),r.error(ne.message)}},G=async(U=null)=>{if(S(U),b(!0),!f.length)try{m(await Wo.catalog())}catch(Q){r.error(Q.message)}},Y=async U=>{C?await Wo.update(C.id,U):await Wo.create(U),b(!1),u(await Wo.list())},H=async U=>{const Q=`group-task-${U.id}`;r.loading({content:`Starting ${U.name}…`,key:Q,duration:0});try{const ne=await Wo.start(U.id),ae=ne.results.filter(ce=>ce.error);ae.length?r.warning({content:`${ne.results.length-ae.length} started, ${ae.length} failed.`,key:Q}):r.success({content:`${ne.results.length} scripts started.`,key:Q}),await n()}catch(ne){r.error({content:ne.message,key:Q})}},q=async U=>{const Q=`group-task-${U.id}`;r.loading({content:`Stopping ${U.name}…`,key:Q,duration:0});try{const ae=(await Wo.stop(U.id)).results.filter(ce=>ce.ok).length;r.success({content:`${ae} scripts stopped.`,key:Q}),await n()}catch(ne){r.error({content:ne.message,key:Q})}},V=async U=>{try{await Wo.remove(U.id),u(await Wo.list())}catch(Q){r.error(Q.message)}},Z=[{title:"Service",dataIndex:"alias",render:(U,Q)=>K.jsxs(Yn,{direction:"vertical",size:0,children:[K.jsx(lu,{strong:!0,children:U}),K.jsx(lu,{type:"secondary",className:"launcher-folder",children:Q.folder})]})},{title:"Current branch",dataIndex:"branch",width:240,render:U=>U?K.jsx(lu,{code:!0,children:U}):K.jsx(lu,{type:"secondary",children:"—"})},{title:"Scripts",width:150,align:"center",render:(U,Q)=>{const ne=[...t].filter(ce=>ce.startsWith(`${Q.id}:`)).length,ae=Q.scripts.length+(Q.packageScriptCount||0);return K.jsx(zi,{status:ne?"success":"default",text:`${ne} / ${ae} running`})}},{title:"Action",width:108,align:"center",render:(U,Q)=>{const ne=[...t].filter(ce=>ce.startsWith(`${Q.id}:`)),ae=ne.length>0;return K.jsx(en,{size:"small",type:ae?"default":"primary",danger:ae,icon:ae?K.jsx(ob,{}):K.jsx(xm,{}),onClick:ce=>{ce.stopPropagation(),ae?W(Q,ne.map(pe=>pe.slice(`${Q.id}:`.length))):_(Q)},children:ae?"Stop":"Start"})}}];return K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"page-header",children:[K.jsxs("div",{children:[K.jsx(lu,{type:"secondary",children:"SERVICES"}),K.jsx(fJ,{level:2,children:"Launcher"}),K.jsx(mJ,{type:"secondary",children:"Manage and run local project scripts."})]}),K.jsxs(Yn,{children:[K.jsx(en,{onClick:()=>g(!0),children:"Quick Launch"}),K.jsx(en,{type:"primary",icon:K.jsx(ov,{}),onClick:()=>P(),children:"Add service"})]})]}),e.length?K.jsxs(K.Fragment,{children:[c.length>0&&K.jsx("div",{className:"quick-launch-bar",style:{marginBottom:20,padding:"12px 16px",background:"#fff",borderRadius:8,border:"1px solid #e4e8f1",boxShadow:"0 2px 8px rgba(31, 42, 68, 0.03)"},children:K.jsxs(Yn,{wrap:!0,size:"middle",children:[K.jsx("span",{style:{fontSize:11,color:"#727b94",fontWeight:750,textTransform:"uppercase",letterSpacing:"0.08em"},children:"Quick Launch:"}),c.map(U=>{const Q=U.items.some(ne=>t.has(`${ne.launcherId}:${ne.scriptId}`));return K.jsxs(en,{type:Q?"default":"primary",danger:Q,icon:Q?K.jsx(ob,{}):K.jsx(xm,{}),onClick:()=>Q?q(U):H(U),children:[Q?"Stop":"Start"," ",U.name]},U.id)})]})}),K.jsx(ac,{activeKey:a,onChange:l,className:"group-tabs",items:[{key:"all",label:`All (${e.length})`},...j.map(U=>({key:U,label:`${U} (${e.filter(Q=>Q.groupName===U).length})`}))]}),M.length?K.jsx(Pa,{className:"launcher-table",rowKey:"id",dataSource:M,columns:Z,pagination:!1,onRow:U=>({onClick:()=>P(U)})}):K.jsx(Nr,{description:"No services in this group."})]}):K.jsx(Nr,{description:"No services yet",children:K.jsx(en,{type:"primary",onClick:()=>P(),children:"Add service"})}),K.jsx(sJ,{open:y,editing:$,groups:j,running:t,onCancel:()=>x(!1),onSave:z,onRun:D,onRunInstall:L,onRunPackage:A,onStop:B,onLogs:F}),K.jsx(ba,{title:"Quick Launch",open:v,onCancel:()=>g(!1),footer:null,width:760,destroyOnClose:!0,children:K.jsx(aJ,{tasks:c,running:t,onCreate:()=>G(),onEdit:G,onStart:H,onStop:q,onRemove:V})}),K.jsx(uJ,{open:h,editingGroupTask:C,groupCatalog:f,onCancel:()=>b(!1),onSave:Y}),K.jsx(dJ,{open:R,logTarget:I,onCancel:()=>O(!1)})]})}const{Title:gJ,Text:Co,Paragraph:pJ}=ca;function hJ({refreshLaunchers:e}){const[t,n]=s.useState([]),[r,a]=s.useState(!1),[l,c]=s.useState(null),[u,f]=s.useState(!1),[m,v]=s.useState(!1),[g,h]=s.useState(null),b=async()=>{a(!0);try{n((await Ih.list()).ports)}catch(x){Ta.error(x.message)}finally{a(!1)}};s.useEffect(()=>{b()},[]);const C=async()=>{if(l){f(!0);try{const x=(await Ih.get(l)).process;h(x),v(!0)}catch(x){Ta.error(x.message)}finally{f(!1)}}},S=async({port:x,pid:$})=>{try{await Ih.kill(x,$),Ta.success(`Process on port ${x} was killed.`),await b(),e&&await e()}catch(w){Ta.error(w.message)}},y=[{title:"Port",dataIndex:"port",width:100,render:x=>K.jsx(Co,{code:!0,children:x})},{title:"Launcher",dataIndex:"launcher",render:(x,$)=>K.jsxs(Yn,{direction:"vertical",size:0,children:[K.jsx(Co,{strong:!0,children:x}),K.jsx(Co,{type:"secondary",children:$.script})]})},{title:"Process",dataIndex:"command",render:(x,$)=>K.jsxs(Yn,{direction:"vertical",size:0,children:[K.jsx(Co,{code:!0,children:$.currentCommand||x}),K.jsxs(Co,{type:"secondary",children:["PID ",$.currentPid||$.pid]})]})},{title:"Status",width:170,render:(x,$)=>$.ghost?K.jsx(Dr,{color:"error",children:"Ghost process"}):$.listening?K.jsx(Dr,{color:"success",children:"Script running"}):$.reused?K.jsx(Dr,{color:"warning",children:"Port reused"}):K.jsx(Dr,{children:"Port released"})},{title:"Action",width:100,render:(x,$)=>$.listening||$.reused?K.jsx(K0,{title:`Kill process on port ${$.port}?`,description:"The process currently listening on this port will be stopped.",okText:"Kill",okButtonProps:{danger:!0},onConfirm:()=>S({port:$.port,pid:$.currentPid}),children:K.jsx(en,{danger:!0,icon:K.jsx(xl,{}),children:"Kill"})}):K.jsx(en,{disabled:!0,icon:K.jsx(xl,{}),children:"Kill"})}];return K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"page-header",children:[K.jsxs("div",{children:[K.jsx(Co,{type:"secondary",children:"DIAGNOSTICS"}),K.jsx(gJ,{level:2,children:"Port Diagnostic"}),K.jsx(pJ,{type:"secondary",children:"Every port observed while a recent Launcher script was running. Ghost processes still listen after their script has stopped."})]}),K.jsx(en,{icon:K.jsx(tU,{}),onClick:b,loading:r,children:"Refresh"})]}),K.jsxs(_r,{className:"port-manual-query",size:"small",children:[K.jsxs(Yn,{wrap:!0,children:[K.jsx(Co,{strong:!0,children:"Query port"}),K.jsx(pm,{min:1,max:65535,controls:!1,value:l,onChange:c,onPressEnter:C,placeholder:"e.g. 3000"}),K.jsx(en,{type:"primary",onClick:C,loading:u,disabled:!l,children:"Query"})]}),m&&K.jsx("div",{className:"port-query-result",children:g?K.jsxs(Yn,{wrap:!0,children:[K.jsx(Dr,{color:"success",children:"Listening"}),K.jsxs(Co,{code:!0,children:["PID ",g.pid]}),K.jsx(Co,{code:!0,children:g.command}),K.jsx(K0,{title:`Kill process on port ${g.port}?`,description:"The process currently listening on this port will be stopped.",okText:"Kill",okButtonProps:{danger:!0},onConfirm:()=>S(g),children:K.jsx(en,{danger:!0,icon:K.jsx(xl,{}),children:"Kill"})})]}):K.jsxs(Co,{type:"secondary",children:["No process is listening on port ",l,"."]})})]}),K.jsx(Pa,{className:"port-diagnostic-table",rowKey:x=>`${x.startedAt}-${x.port}-${x.pid}`,loading:r,dataSource:t,columns:y,pagination:!1,locale:{emptyText:K.jsx(Nr,{description:"No ports have been observed from Launcher scripts yet."})}})]})}const{Title:x2,Paragraph:bJ,Text:su}=ca,jh=[{id:"bitbucket",label:"Bitbucket"},{id:"jira",label:"Jira"},{id:"confluence",label:"Confluence"}];function yJ(){const[e]=Pn.useForm(),[t,n]=s.useState({}),[r,a]=s.useState(!1),[l,c]=s.useState(!1);s.useEffect(()=>{gu.status().then(v=>{n(v),e.setFieldValue("domain",v.domain)}).catch(v=>Ta.error(v.message))},[e]);const u=v=>t[`${v}TokenConfigured`],f=async()=>{try{await e.validateFields(["domain"]),a(!0);const v=e.getFieldsValue();if(v.domain!=null){const g=await gu.saveDomain(v.domain);n(h=>({...h,...g})),e.setFieldValue("domain",g.domain)}for(const{id:g}of jh)if(v[g]){const h=await gu.saveAccessToken(g,v[g]);n(b=>({...b,...h})),e.resetFields([g])}a(!1),c(!0),setTimeout(()=>c(!1),1500)}catch(v){a(!1),v!=null&&v.errorFields||Ta.error(v.message)}},m=async v=>{try{const g=await gu.saveAccessToken(v,"");n(g),e.resetFields([v]),Ta.success(`${jh.find(h=>h.id===v).label} Access Token removed.`)}catch(g){Ta.error(g.message)}};return K.jsxs("div",{className:"settings-page",children:[K.jsx(su,{type:"secondary",children:"SETTINGS"}),K.jsxs("div",{className:"settings-page-header",children:[K.jsx(x2,{level:2,children:"Settings"}),K.jsx(en,{type:"primary",color:l?"green":"primary",variant:"solid",icon:l?K.jsx(Zu,{}):null,loading:!l&&r,onClick:f,children:l?"Saved":"Save"})]}),K.jsxs(_r,{className:"settings-card",children:[K.jsxs("div",{className:"settings-title",children:[K.jsx("div",{className:"settings-icon-wrap",children:K.jsx(zZ,{className:"settings-icon"})}),K.jsxs("div",{children:[K.jsx(x2,{level:4,children:"Access Tokens"}),K.jsx(bJ,{type:"secondary",children:"Tokens are stored locally and are never shown again."})]})]}),K.jsxs(Pn,{form:e,layout:"vertical",className:"token-settings-form",children:[K.jsxs("div",{className:"token-row",children:[K.jsxs("div",{className:"token-row-info",children:[K.jsx(su,{strong:!0,className:"token-row-name",children:"Domain"}),K.jsx(su,{type:"secondary",className:"token-row-hint",children:"Your Intranet Domain"})]}),K.jsx(Pn.Item,{name:"domain",rules:[{pattern:/^([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,message:"Enter a valid domain, e.g. abc.com"}],children:K.jsx(Ma,{placeholder:"abc.com",allowClear:!0})})]}),jh.map(({id:v,label:g})=>K.jsxs("div",{className:`token-row ${u(v)?"is-configured":""}`,children:[K.jsxs("div",{className:"token-row-info",children:[K.jsxs("div",{className:"token-row-name-line",children:[K.jsx(su,{strong:!0,className:"token-row-name",children:g}),u(v)&&K.jsx(Dr,{color:"success",closable:!0,onClose:h=>{h.preventDefault(),m(v)},className:"token-row-tag",children:"Configured"})]}),K.jsxs(su,{type:"secondary",className:"token-row-hint",children:[g," API access token"]})]}),K.jsx(Pn.Item,{name:v,children:K.jsx(Ma.Password,{placeholder:u(v)?"Enter new token to replace":"Paste access token",autoComplete:"off",allowClear:!0})})]},v))]})]})]})}const CJ="modulepreload",SJ=function(e){return"/"+e},$2={},xJ=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let c=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(m=>{if(m=SJ(m),m in $2)return;$2[m]=!0;const v=m.endsWith(".css"),g=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const h=document.createElement("link");if(h.rel=v?"stylesheet":CJ,v||(h.as="script"),h.crossOrigin="",h.href=m,f&&h.setAttribute("nonce",f),document.head.appendChild(h),v)return new Promise((b,C)=>{h.addEventListener("load",b),h.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return a.then(c=>{for(const u of c||[])u.status==="rejected"&&l(u.reason);return t().catch(l)})},{Title:w2,Text:pa,Paragraph:$J}=ca,{Dragger:wJ}=Py,E2=(e=0)=>{if(!e)return"0 B";const t=["B","KB","MB","GB"],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1);return`${(e/1024**n).toFixed(n?1:0)} ${t[n]}`},EJ=e=>({file:e,name:e.name||"clipboard-image.png",url:URL.createObjectURL(e),size:e.size});async function OJ(e,t,n){const r=URL.createObjectURL(e);try{const a=await new Promise((m,v)=>{const g=new Image;g.onload=()=>m(g),g.onerror=()=>v(new Error("Unable to read this image. Please choose a valid image file.")),g.src=r}),l=document.createElement("canvas"),c=Math.max(a.naturalWidth,a.naturalHeight);let u=1;t&&(u=t/c),n!=null&&n>0&&n<=100&&(u=u*(n/100)),l.width=Math.max(1,Math.round(a.naturalWidth*u)),l.height=Math.max(1,Math.round(a.naturalHeight*u));const f=l.getContext("2d",{willReadFrequently:!0});return f.drawImage(a,0,0,l.width,l.height),{imageData:f.getImageData(0,0,l.width,l.height),width:l.width,height:l.height}}finally{URL.revokeObjectURL(r)}}function RJ(){const[e,t]=s.useState(null),[n,r]=s.useState(null),[a,l]=s.useState(75),[c,u]=s.useState(!0),[f,m]=s.useState(!0),[v,g]=s.useState(!0),[h,b]=s.useState(2),[C,S]=s.useState(!1),[y,x]=s.useState(null),[$,w]=s.useState(100),[R,O]=s.useState(!1),[I,T]=s.useState(!1),[j,M]=Ta.useMessage(),P=s.useRef(null),z=s.useRef(null),D=Y=>{var H;(H=Y.current)!=null&&H.url&&URL.revokeObjectURL(Y.current.url)},L=Y=>{var q;if(!((q=Y==null?void 0:Y.type)!=null&&q.startsWith("image/")))return j.error("Please choose an image file."),!1;D(P),D(z);const H=EJ(Y);return P.current=H,z.current=null,t(H),r(null),B(Y),!1},A=Y=>{var H;return[...((H=Y.dataTransfer)==null?void 0:H.types)||[]].includes("Files")},F=Y=>{var q;Y.preventDefault(),T(!1);const H=[...((q=Y.dataTransfer)==null?void 0:q.files)||[]].find(V=>V.type.startsWith("image/"));H?L(H):j.error("Drop an image file to compress it.")};s.useEffect(()=>()=>{D(P),D(z)},[]),s.useEffect(()=>{const Y=H=>{var Z;const q=[...((Z=H.clipboardData)==null?void 0:Z.items)||[]].find(U=>U.type.startsWith("image/"));if(!q)return;H.preventDefault();const V=q.getAsFile();V&&(L(new File([V],`clipboard-${Date.now()}.${V.type.split("/")[1]||"png"}`,{type:V.type})),j.success("Image read from clipboard."))};return window.addEventListener("paste",Y),()=>window.removeEventListener("paste",Y)},[j]);const _=async()=>{var Y;try{if(!((Y=navigator.clipboard)!=null&&Y.read))throw new Error("Direct clipboard reading is unavailable. Paste an image with ⌘ / Ctrl + V instead.");const H=await navigator.clipboard.read();for(const q of H){const V=q.types.find(Z=>Z.startsWith("image/"));if(V){const Z=await q.getType(V);L(new File([Z],`clipboard-${Date.now()}.${V.split("/")[1]||"png"}`,{type:V})),j.success("Image read from clipboard.");return}}throw new Error("No image was found in the clipboard.")}catch(H){j.warning(H.message||"Unable to read an image from the clipboard.")}},B=async(Y=e==null?void 0:e.file)=>{if(Y){O(!0);try{const[{encode:H},{imageData:q,width:V,height:Z}]=await Promise.all([xJ(()=>import("./index-Dty-56mC.js"),[]),OJ(Y,y,$)]),U=await H(q,{quality:a,progressive:c,optimize_coding:f,auto_subsample:v,chroma_subsample:h,trellis_multipass:C});D(z);const Q=new Blob([U],{type:"image/jpeg"}),ne={url:URL.createObjectURL(Q),size:Q.size,width:V,height:Z};z.current=ne,r(ne),j.success("MozJPEG compression complete.")}catch(H){j.error(H.message||"Image compression failed.")}finally{O(!1)}}},W=()=>{if(!n)return;const Y=e.name.replace(/\.[^.]+$/,"")||"image",H=document.createElement("a");H.href=n.url,H.download=`${Y}-mozjpeg.jpg`,H.click()},G=n&&e?Math.round((1-n.size/e.size)*100):null;return K.jsxs(K.Fragment,{children:[M,K.jsxs("div",{className:`squoosh-page ${I?"is-file-dragging":""}`,onDragOver:Y=>{A(Y)&&(Y.preventDefault(),T(!0))},onDragLeave:Y=>{Y.currentTarget===Y.target&&T(!1)},onDrop:F,children:[K.jsxs("header",{className:"squoosh-header",children:[K.jsxs("div",{children:[K.jsx(pa,{children:"MOZJPEG WORKBENCH"}),K.jsx(w2,{level:2,children:"Image compression"})]}),K.jsxs(Yn,{children:[K.jsx(en,{icon:K.jsx(od,{}),onClick:_,children:"Read clipboard"}),K.jsx(en,{type:"primary",icon:K.jsx(rb,{}),onClick:()=>B(),disabled:!e,loading:R,children:"Compress"})]})]}),K.jsxs("main",{className:"squoosh-studio",children:[K.jsxs("section",{className:"squoosh-preview-area",children:[K.jsx(O2,{title:"Original",detail:e?`${E2(e.size)} · ${e.name}`:"Choose an image to begin",children:e?K.jsx(R2,{label:"Original image",image:e.url}):K.jsxs(wJ,{accept:"image/*",multiple:!1,showUploadList:!1,beforeUpload:L,className:"image-dropzone",children:[K.jsx("p",{className:"ant-upload-drag-icon",children:K.jsx(NZ,{})}),K.jsx("p",{className:"ant-upload-text",children:"Drop an image or click to choose"}),K.jsx("p",{className:"ant-upload-hint",children:"Or paste an image with ⌘ / Ctrl + V."})]})}),K.jsx(O2,{title:"MozJPEG output",detail:n?`${E2(n.size)} · ${n.width} × ${n.height}`:"Waiting for compression",action:n&&K.jsx(en,{type:"primary",size:"small",icon:K.jsx(C3,{}),onClick:W,children:"Download"}),children:R?K.jsx("div",{className:"image-loading",children:K.jsx(fv,{tip:"Compressing…"})}):n?K.jsxs(K.Fragment,{children:[K.jsx(R2,{label:"Compressed JPEG",image:n.url}),G!==null&&K.jsx("div",{className:`compression-saving ${G>0?"is-saving":""}`,children:G>0?`${G}% smaller`:"No size reduction at current settings."})]}):K.jsx(Nr,{image:Nr.PRESENTED_IMAGE_SIMPLE,description:"Compressed preview"})})]}),K.jsxs("aside",{className:"squoosh-settings",children:[K.jsxs("div",{className:"settings-heading",children:[K.jsx(pa,{children:"ENCODER"}),K.jsx(w2,{level:4,children:"MozJPEG"}),K.jsx($J,{children:"Fine-tune output size and image quality."})]}),K.jsxs("div",{className:"option-row",children:[K.jsxs("div",{children:[K.jsx(pa,{strong:!0,children:"Quality"}),K.jsx("br",{}),K.jsx(pa,{type:"secondary",children:"Higher values preserve more detail."})]}),K.jsx(Dr,{color:"blue",children:a})]}),K.jsx(AV,{min:1,max:100,value:a,onChange:l,tooltip:{formatter:Y=>`${Y}`}}),K.jsxs("div",{className:"option-select",children:[K.jsxs("div",{children:[K.jsx(pa,{strong:!0,children:"Long edge"}),K.jsx("br",{}),K.jsx(pa,{type:"secondary",children:"Scale the longest edge to this value. Never crops the image."})]}),K.jsx(pm,{min:1,max:16384,value:y,onChange:x,placeholder:"Original",addonAfter:"px"})]}),K.jsxs("div",{className:"option-select",children:[K.jsxs("div",{children:[K.jsx(pa,{strong:!0,children:"Scale"}),K.jsx("br",{}),K.jsx(pa,{type:"secondary",children:"Scale the image by percentage."})]}),K.jsx(pm,{min:1,max:100,value:$,onChange:w,placeholder:"100",addonAfter:"%",allowClear:!0})]}),K.jsx(zf,{label:"Progressive JPEG",description:"Display a low-detail preview while loading.",checked:c,onChange:u}),K.jsx(zf,{label:"Optimize coding",description:"Reduce size without changing image quality.",checked:f,onChange:m}),K.jsx(im,{ghost:!0,className:"advanced-options",items:[{key:"advanced",label:"Advanced settings",children:K.jsxs(K.Fragment,{children:[K.jsx(zf,{label:"Automatic chroma subsampling",description:"Pick sampling based on the image content.",checked:v,onChange:g}),K.jsxs("div",{className:"option-select",children:[K.jsxs("div",{children:[K.jsx(pa,{strong:!0,children:"Chroma subsampling"}),K.jsx("br",{}),K.jsx(pa,{type:"secondary",children:"Enabled when automatic mode is off."})]}),K.jsx(Qa,{disabled:v,value:h,onChange:b,options:[{value:0,label:"4:4:4 (colour detail)"},{value:1,label:"4:2:2 (balanced)"},{value:2,label:"4:2:0 (smaller file)"}]})]}),K.jsx(zf,{label:"Trellis multi-pass",description:"Further size reduction with a longer encode time.",checked:C,onChange:S})]})}]}),K.jsx(en,{type:"primary",size:"large",block:!0,icon:K.jsx(rb,{}),onClick:()=>B(),disabled:!e,loading:R,children:"Compress image"})]})]})]})]})}function O2({title:e,detail:t,action:n,children:r}){return K.jsxs("section",{className:"preview-pane",children:[K.jsxs("header",{children:[K.jsxs("div",{children:[K.jsx(pa,{children:e}),K.jsx("span",{children:t})]}),n]}),K.jsx("div",{className:"preview-canvas",children:r})]})}function zf({label:e,description:t,checked:n,onChange:r}){return K.jsxs("div",{className:"option-switch",children:[K.jsxs("div",{children:[K.jsx(pa,{strong:!0,children:e}),K.jsx("br",{}),K.jsx(pa,{type:"secondary",children:t})]}),K.jsx(H4,{checked:n,onChange:r})]})}function R2({label:e,image:t,metadata:n}){return K.jsxs("div",{className:"image-panel",children:[K.jsx("img",{src:t,alt:e}),n&&K.jsx("div",{className:"image-panel-meta",children:K.jsx(pa,{type:"secondary",children:n})})]})}const{Title:NJ,Text:Jr,Paragraph:IJ}=ca;function N2({prs:e,onSelectPr:t}){return e.length===0?K.jsx(Nr,{description:"No open pull requests found.",style:{padding:"24px 0"}}):K.jsx("div",{style:{display:"grid",gap:"12px"},children:e.map(n=>{var a,l,c,u,f,m,v,g,h;const r=n.reviewUrl||"";return K.jsx(_r,{size:"small",hoverable:!0,style:{borderColor:"#e3e6ef",transition:"all 0.2s"},onClick:()=>r&&t(r),children:K.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:"12px"},children:[K.jsxs("div",{style:{flex:1,minWidth:0},children:[K.jsxs(Yn,{size:8,wrap:!0,children:[K.jsxs(Jr,{strong:!0,style:{fontSize:"14px"},children:["#",n.id," ",n.title]}),n.draft&&K.jsx(Dr,{color:"gold",children:"Draft"})]}),K.jsxs("div",{style:{marginTop:"6px",fontSize:"12px",display:"flex",alignItems:"center",flexWrap:"wrap",gap:"6px",color:"#727b94"},children:[K.jsxs(Jr,{type:"secondary",style:{fontWeight:500},children:[(c=(l=(a=n.fromRef)==null?void 0:a.repository)==null?void 0:l.project)==null?void 0:c.key," / ",(f=(u=n.fromRef)==null?void 0:u.repository)==null?void 0:f.slug]}),K.jsx("span",{style:{color:"#d9d9d9"},children:"|"}),K.jsx(Dr,{size:"small",color:"cyan",style:{margin:0},children:(m=n.fromRef)==null?void 0:m.displayId}),K.jsx(fZ,{style:{fontSize:"10px",color:"#8c8c8c"}}),K.jsx(Dr,{size:"small",color:"blue",style:{margin:0},children:(v=n.toRef)==null?void 0:v.displayId}),K.jsx("span",{style:{color:"#d9d9d9"},children:"|"}),K.jsxs("span",{children:["Author: ",K.jsx("strong",{children:(h=(g=n.author)==null?void 0:g.user)==null?void 0:h.displayName})]}),K.jsx("span",{style:{color:"#d9d9d9"},children:"|"}),K.jsxs("span",{children:["Updated: ",new Date(n.updatedDate).toLocaleDateString()]})]})]}),K.jsxs(Yn,{size:8,children:[K.jsx(en,{size:"small",icon:K.jsx(AZ,{}),onClick:b=>{b.stopPropagation(),r&&window.open(r,"_blank")},children:"Open"}),K.jsx(en,{type:"primary",size:"small",onClick:b=>{b.stopPropagation(),r&&t(r)},children:"Review"})]})]})},n.id)})})}function TJ(){const[e]=Pn.useForm(),[t,n]=s.useState(!1),[r,a]=s.useState(!0),[l,c]=s.useState(null),[u,f]=s.useState(!1),[m,v]=s.useState([]),[g,h]=s.useState([]),[b,C]=s.useState(!1),[S,y]=s.useState("review"),x=async()=>{C(!0);try{const[O,I]=await Promise.all([Th.myPrs().catch(()=>({values:[]})),Th.reviewPrs().catch(()=>({values:[]}))]);v((O==null?void 0:O.values)||[]),h((I==null?void 0:I.values)||[])}catch{}C(!1)};s.useEffect(()=>{gu.status().then(O=>{a(O.bitbucketTokenConfigured),O.bitbucketTokenConfigured&&x()}).catch(()=>{})},[]);const $=async O=>{const I=typeof O=="string"?O:O.prLink;if(I){n(!0),c(null),e.setFieldsValue({prLink:I});try{const T=await Th.check(I.trim());c(T),Ta.success("PR Review completed successfully.")}catch(T){Ta.error(T.message)}finally{n(!1)}}},w=()=>{if(!l)return;const{pr:O,stats:I,files:T}=l;let j=`## 🔍 PR Review Report: ${O.title}
477
+ `]:{zIndex:10,width:r,margin:`0 ${J(e.marginXXS)}`,fontSize:r,cursor:"pointer",transition:`all ${e.motionDurationSlow}`,color:a,"&:hover":{color:a},svg:{verticalAlign:"baseline"}}},[`${u}-thumbnail, ${u}-thumbnail img`]:{position:"static",display:"block",width:"100%",height:"100%",objectFit:"contain"},[`${u}-name`]:{display:"none",textAlign:"center"},[`${u}-file + ${u}-name`]:{position:"absolute",bottom:e.margin,display:"block",width:`calc(100% - ${J(l(e.paddingXS).mul(2).equal())})`},[`${u}-uploading`]:{[`&${u}`]:{backgroundColor:e.colorFillAlter},[`&::before, ${n}-eye, ${n}-download, ${n}-delete`]:{display:"none"}},[`${u}-progress`]:{bottom:e.marginXL,width:`calc(100% - ${J(l(e.paddingXS).mul(2).equal())})`,paddingInlineStart:0}}}),[`${t}-wrapper${t}-picture-circle-wrapper`]:{[`${t}${t}-select`]:{borderRadius:"50%"}}}},BQ=e=>{const{componentCls:t}=e;return{[`${t}-rtl`]:{direction:"rtl"}}},LQ=e=>{const{componentCls:t,colorTextDisabled:n}=e;return{[`${t}-wrapper`]:Object.assign(Object.assign({},an(e)),{[t]:{outline:0,"input[type='file']":{cursor:"pointer"}},[`${t}-select`]:{display:"inline-block"},[`${t}-hidden`]:{display:"none"},[`${t}-disabled`]:{color:n,cursor:"not-allowed"}})}},HQ=e=>({actionsColor:e.colorIcon,pictureCardSize:e.controlHeightLG*2.55}),FQ=Qt("Upload",e=>{const{fontSizeHeading3:t,fontHeight:n,lineWidth:r,pictureCardSize:a,calc:l}=e,c=Gt(e,{uploadThumbnailSize:l(t).mul(2).equal(),uploadProgressOffset:l(l(n).div(2)).add(r).equal(),uploadPicCardSize:a});return[LQ(c),PQ(c),DQ(c),AQ(c),zQ(c),_Q(c),BQ(c),qu(c)]},HQ);var kQ={icon:function(t,n){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M534 352V136H232v752h560V394H576a42 42 0 01-42-42z",fill:n}},{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0042 42h216v494z",fill:t}}]}},name:"file",theme:"twotone"},VQ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:kQ}))},KQ=s.forwardRef(VQ),WQ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z"}}]},name:"paper-clip",theme:"outlined"},qQ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:WQ}))},UQ=s.forwardRef(qQ),GQ={icon:function(t,n){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z",fill:t}},{tag:"path",attrs:{d:"M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z",fill:n}},{tag:"path",attrs:{d:"M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z",fill:n}},{tag:"path",attrs:{d:"M276 368a28 28 0 1056 0 28 28 0 10-56 0z",fill:n}},{tag:"path",attrs:{d:"M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z",fill:t}}]}},name:"picture",theme:"twotone"},XQ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:GQ}))},YQ=s.forwardRef(XQ);function Mf(e){return Object.assign(Object.assign({},e),{lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,name:e.name,size:e.size,type:e.type,uid:e.uid,percent:0,originFileObj:e})}function jf(e,t){const n=Ne(t),r=n.findIndex(({uid:a})=>a===e.uid);return r===-1?n.push(e):n[r]=e,n}function Rh(e,t){const n=e.uid!==void 0?"uid":"name";return t.filter(r=>r[n]===e[n])[0]}function QQ(e,t){const n=e.uid!==void 0?"uid":"name",r=t.filter(a=>a[n]!==e[n]);return r.length===t.length?null:r}const ZQ=(e="")=>{const t=e.split("/"),r=t[t.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(r)||[""])[0]},y3=e=>e.indexOf("image/")===0,JQ=e=>{if(e.type&&!e.thumbUrl)return y3(e.type);const t=e.thumbUrl||e.url||"",n=ZQ(t);return/^data:image\//.test(t)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(n)?!0:!(/^data:/.test(t)||n)},Ei=200;function eZ(e){return new Promise(t=>{if(!e.type||!y3(e.type)){t("");return}const n=document.createElement("canvas");n.width=Ei,n.height=Ei,n.style.cssText=`position: fixed; left: 0; top: 0; width: ${Ei}px; height: ${Ei}px; z-index: 9999; display: none;`,document.body.appendChild(n);const r=n.getContext("2d"),a=new Image;if(a.onload=()=>{const{width:l,height:c}=a;let u=Ei,f=Ei,m=0,v=0;l>c?(f=c*(Ei/l),v=-(f-u)/2):(u=l*(Ei/c),m=-(u-f)/2),r.drawImage(a,m,v,u,f);const g=n.toDataURL();document.body.removeChild(n),window.URL.revokeObjectURL(a.src),t(g)},a.crossOrigin="anonymous",e.type.startsWith("image/svg+xml")){const l=new FileReader;l.onload=()=>{l.result&&typeof l.result=="string"&&(a.src=l.result)},l.readAsDataURL(e)}else if(e.type.startsWith("image/gif")){const l=new FileReader;l.onload=()=>{l.result&&t(l.result)},l.readAsDataURL(e)}else a.src=window.URL.createObjectURL(e)})}var tZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"},nZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:tZ}))},C3=s.forwardRef(nZ);const rZ=s.forwardRef(({prefixCls:e,className:t,style:n,locale:r,listType:a,file:l,items:c,progress:u,iconRender:f,actionIconRender:m,itemRender:v,isImgUrl:g,showPreviewIcon:h,showRemoveIcon:b,showDownloadIcon:C,previewIcon:S,removeIcon:y,downloadIcon:x,extra:$,onPreview:w,onDownload:R,onClose:O},I)=>{var T,j;const{status:M}=l,[P,z]=s.useState(M);s.useEffect(()=>{M!=="removed"&&z(M)},[M]);const[D,L]=s.useState(!1);s.useEffect(()=>{const le=setTimeout(()=>{L(!0)},300);return()=>{clearTimeout(le)}},[]);const A=f(l);let F=s.createElement("div",{className:`${e}-icon`},A);if(a==="picture"||a==="picture-card"||a==="picture-circle")if(P==="uploading"||!l.thumbUrl&&!l.url){const le=ee(`${e}-list-item-thumbnail`,{[`${e}-list-item-file`]:P!=="uploading"});F=s.createElement("div",{className:le},A)}else{const le=g!=null&&g(l)?s.createElement("img",{src:l.thumbUrl||l.url,alt:l.name,className:`${e}-list-item-image`,crossOrigin:l.crossOrigin}):A,de=ee(`${e}-list-item-thumbnail`,{[`${e}-list-item-file`]:g&&!g(l)});F=s.createElement("a",{className:de,onClick:ue=>w(l,ue),href:l.url||l.thumbUrl,target:"_blank",rel:"noopener noreferrer"},le)}const _=ee(`${e}-list-item`,`${e}-list-item-${P}`),B=typeof l.linkProps=="string"?JSON.parse(l.linkProps):l.linkProps,W=(typeof b=="function"?b(l):b)?m((typeof y=="function"?y(l):y)||s.createElement(xl,null),()=>O(l),e,r.removeFile,!0):null,G=(typeof C=="function"?C(l):C)&&P==="done"?m((typeof x=="function"?x(l):x)||s.createElement(C3,null),()=>R(l),e,r.downloadFile):null,Y=a!=="picture-card"&&a!=="picture-circle"&&s.createElement("span",{key:"download-delete",className:ee(`${e}-list-item-actions`,{picture:a==="picture"})},G,W),H=typeof $=="function"?$(l):$,q=H&&s.createElement("span",{className:`${e}-list-item-extra`},H),V=ee(`${e}-list-item-name`),Z=l.url?s.createElement("a",Object.assign({key:"view",target:"_blank",rel:"noopener noreferrer",className:V,title:l.name},B,{href:l.url,onClick:le=>w(l,le)}),l.name,q):s.createElement("span",{key:"view",className:V,onClick:le=>w(l,le),title:l.name},l.name,q),U=(typeof h=="function"?h(l):h)&&(l.url||l.thumbUrl)?s.createElement("a",{href:l.url||l.thumbUrl,target:"_blank",rel:"noopener noreferrer",onClick:le=>w(l,le),title:r.previewFile},typeof S=="function"?S(l):S||s.createElement(O4,null)):null,Q=(a==="picture-card"||a==="picture-circle")&&P!=="uploading"&&s.createElement("span",{className:`${e}-list-item-actions`},U,P==="done"&&G,W),{getPrefixCls:ne}=s.useContext(xt),ae=ne(),ce=s.createElement("div",{className:_},F,Z,Y,Q,D&&s.createElement(Vr,{motionName:`${ae}-fade`,visible:P==="uploading",motionDeadline:2e3},({className:le})=>{const de="percent"in l?s.createElement(Zq,Object.assign({type:"line",percent:l.percent,"aria-label":l["aria-label"],"aria-labelledby":l["aria-labelledby"]},u)):null;return s.createElement("div",{className:ee(`${e}-list-item-progress`,le)},de)})),pe=l.response&&typeof l.response=="string"?l.response:((T=l.error)===null||T===void 0?void 0:T.statusText)||((j=l.error)===null||j===void 0?void 0:j.message)||r.uploadError,fe=P==="error"?s.createElement(Ar,{title:pe,getPopupContainer:le=>le.parentNode},ce):ce;return s.createElement("div",{className:ee(`${e}-list-item-container`,t),style:n,ref:I},v?v(fe,l,c,{download:R.bind(null,l),preview:w.bind(null,l),remove:O.bind(null,l)}):fe)}),aZ=(e,t)=>{const{listType:n="text",previewFile:r=eZ,onPreview:a,onDownload:l,onRemove:c,locale:u,iconRender:f,isImageUrl:m=JQ,prefixCls:v,items:g=[],showPreviewIcon:h=!0,showRemoveIcon:b=!0,showDownloadIcon:C=!1,removeIcon:S,previewIcon:y,downloadIcon:x,extra:$,progress:w={size:[-1,2],showInfo:!1},appendAction:R,appendActionVisible:O=!0,itemRender:I,disabled:T}=e,[,j]=xb(),[M,P]=s.useState(!1),z=["picture-card","picture-circle"].includes(n);s.useEffect(()=>{n.startsWith("picture")&&(g||[]).forEach(V=>{!(V.originFileObj instanceof File||V.originFileObj instanceof Blob)||V.thumbUrl!==void 0||(V.thumbUrl="",r==null||r(V.originFileObj).then(Z=>{V.thumbUrl=Z||"",j()}))})},[n,g,r]),s.useEffect(()=>{P(!0)},[]);const D=(V,Z)=>{if(a)return Z==null||Z.preventDefault(),a(V)},L=V=>{typeof l=="function"?l(V):V.url&&window.open(V.url)},A=V=>{c==null||c(V)},F=V=>{if(f)return f(V,n);const Z=V.status==="uploading";if(n.startsWith("picture")){const U=n==="picture"?s.createElement(fo,null):u.uploading,Q=m!=null&&m(V)?s.createElement(YQ,null):s.createElement(KQ,null);return Z?U:Q}return Z?s.createElement(fo,null):s.createElement(UQ,null)},_=(V,Z,U,Q,ne)=>{const ae={type:"text",size:"small",title:Q,onClick:ce=>{var pe,fe;Z(),s.isValidElement(V)&&((fe=(pe=V.props).onClick)===null||fe===void 0||fe.call(pe,ce))},className:`${U}-list-item-action`,disabled:ne?T:!1};return s.isValidElement(V)?s.createElement(en,Object.assign({},ae,{icon:cr(V,Object.assign(Object.assign({},V.props),{onClick:()=>{}}))})):s.createElement(en,Object.assign({},ae),s.createElement("span",null,V))};s.useImperativeHandle(t,()=>({handlePreview:D,handleDownload:L}));const{getPrefixCls:B}=s.useContext(xt),W=B("upload",v),G=B(),Y=ee(`${W}-list`,`${W}-list-${n}`),H=s.useMemo(()=>yn(Ls(G),["onAppearEnd","onEnterEnd","onLeaveEnd"]),[G]),q=Object.assign(Object.assign({},z?{}:H),{motionDeadline:2e3,motionName:`${W}-${z?"animate-inline":"animate"}`,keys:Ne(g.map(V=>({key:V.uid,file:V}))),motionAppear:M});return s.createElement("div",{className:Y},s.createElement(Cb,Object.assign({},q,{component:!1}),({key:V,file:Z,className:U,style:Q})=>s.createElement(rZ,{key:V,locale:u,prefixCls:W,className:U,style:Q,file:Z,items:g,progress:w,listType:n,isImgUrl:m,showPreviewIcon:h,showRemoveIcon:b,showDownloadIcon:C,removeIcon:S,previewIcon:y,downloadIcon:x,extra:$,iconRender:F,actionIconRender:_,itemRender:I,onPreview:D,onDownload:L,onClose:A})),R&&s.createElement(Vr,Object.assign({},q,{visible:O,forceRender:!0}),({className:V,style:Z})=>cr(R,U=>({className:ee(U.className,V),style:Object.assign(Object.assign(Object.assign({},Z),{pointerEvents:V?"none":void 0}),U.style)}))))},oZ=s.forwardRef(aZ);var iZ=function(e,t,n,r){function a(l){return l instanceof n?l:new n(function(c){c(l)})}return new(n||(n=Promise))(function(l,c){function u(v){try{m(r.next(v))}catch(g){c(g)}}function f(v){try{m(r.throw(v))}catch(g){c(g)}}function m(v){v.done?l(v.value):a(v.value).then(u,f)}m((r=r.apply(e,[])).next())})};const vu=`__LIST_IGNORE_${Date.now()}__`,lZ=(e,t)=>{const n=or("upload"),{fileList:r,defaultFileList:a,onRemove:l,showUploadList:c=!0,listType:u="text",onPreview:f,onDownload:m,onChange:v,onDrop:g,previewFile:h,disabled:b,locale:C,iconRender:S,isImageUrl:y,progress:x,prefixCls:$,className:w,type:R="select",children:O,style:I,itemRender:T,maxCount:j,data:M={},multiple:P=!1,hasControlInside:z=!0,action:D="",accept:L="",supportServerRender:A=!0,rootClassName:F}=e,_=s.useContext(Lr),B=b??_,W=e.customRequest||n.customRequest,[G,Y]=wn(a||[],{value:r,postState:Ce=>Ce??[]}),[H,q]=s.useState("drop"),V=s.useRef(null),Z=s.useRef(null);s.useMemo(()=>{const Ce=Date.now();(r||[]).forEach((ze,qe)=>{!ze.uid&&!Object.isFrozen(ze)&&(ze.uid=`__AUTO__${Ce}_${qe}__`)})},[r]);const U=(Ce,ze,qe)=>{let Ke=Ne(ze),ft=!1;j===1?Ke=Ke.slice(-1):j&&(ft=Ke.length>j,Ke=Ke.slice(0,j)),Ua.flushSync(()=>{Y(Ke)});const Ot={file:Ce,fileList:Ke};qe&&(Ot.event=qe),(!ft||Ce.status==="removed"||Ke.some(Fe=>Fe.uid===Ce.uid))&&Ua.flushSync(()=>{v==null||v(Ot)})},Q=(Ce,ze)=>iZ(void 0,void 0,void 0,function*(){const{beforeUpload:qe,transformFile:Ke}=e;let ft=Ce;if(qe){const Ot=yield qe(Ce,ze);if(Ot===!1)return!1;if(delete Ce[vu],Ot===vu)return Object.defineProperty(Ce,vu,{value:!0,configurable:!0}),!1;typeof Ot=="object"&&Ot&&(ft=Ot)}return Ke&&(ft=yield Ke(ft)),ft}),ne=Ce=>{const ze=Ce.filter(ft=>!ft.file[vu]);if(!ze.length)return;const qe=ze.map(ft=>Mf(ft.file));let Ke=Ne(G);qe.forEach(ft=>{Ke=jf(ft,Ke)}),qe.forEach((ft,Ot)=>{let Fe=ft;if(ze[Ot].parsedFile)ft.status="uploading";else{const{originFileObj:at}=ft;let mt;try{mt=new File([at],at.name,{type:at.type})}catch{mt=new Blob([at],{type:at.type}),mt.name=at.name,mt.lastModifiedDate=new Date,mt.lastModified=new Date().getTime()}mt.uid=ft.uid,Fe=mt}U(Fe,Ke)})},ae=(Ce,ze,qe)=>{try{typeof Ce=="string"&&(Ce=JSON.parse(Ce))}catch{}if(!Rh(ze,G))return;const Ke=Mf(ze);Ke.status="done",Ke.percent=100,Ke.response=Ce,Ke.xhr=qe;const ft=jf(Ke,G);U(Ke,ft)},ce=(Ce,ze)=>{if(!Rh(ze,G))return;const qe=Mf(ze);qe.status="uploading",qe.percent=Ce.percent;const Ke=jf(qe,G);U(qe,Ke,Ce)},pe=(Ce,ze,qe)=>{if(!Rh(qe,G))return;const Ke=Mf(qe);Ke.error=Ce,Ke.response=ze,Ke.status="error";const ft=jf(Ke,G);U(Ke,ft)},fe=Ce=>{let ze;Promise.resolve(typeof l=="function"?l(Ce):l).then(qe=>{var Ke;if(qe===!1)return;const ft=QQ(Ce,G);ft&&(ze=Object.assign(Object.assign({},Ce),{status:"removed"}),G==null||G.forEach(Ot=>{const Fe=ze.uid!==void 0?"uid":"name";Ot[Fe]===ze[Fe]&&!Object.isFrozen(Ot)&&(Ot.status="removed")}),(Ke=V.current)===null||Ke===void 0||Ke.abort(ze),U(ze,ft))})},le=Ce=>{q(Ce.type),Ce.type==="drop"&&(g==null||g(Ce))};s.useImperativeHandle(t,()=>({onBatchStart:ne,onSuccess:ae,onProgress:ce,onError:pe,fileList:G,upload:V.current,nativeElement:Z.current}));const{getPrefixCls:de,direction:ue,upload:ie}=s.useContext(xt),oe=de("upload",$),ve=Object.assign(Object.assign({onBatchStart:ne,onError:pe,onProgress:ce,onSuccess:ae},e),{customRequest:W,data:M,multiple:P,action:D,accept:L,supportServerRender:A,prefixCls:oe,disabled:B,beforeUpload:Q,onChange:void 0,hasControlInside:z});delete ve.className,delete ve.style,(!O||B)&&delete ve.id;const ye=`${oe}-wrapper`,[$e,Re,ge]=FQ(oe,ye),[Ie]=Ja("Upload",Xa.Upload),{showRemoveIcon:xe,showPreviewIcon:be,showDownloadIcon:_e,removeIcon:ke,previewIcon:nt,downloadIcon:Ge,extra:Ve}=typeof c=="boolean"?{}:c,Ze=typeof xe>"u"?!B:xe,Te=(Ce,ze)=>c?s.createElement(oZ,{prefixCls:oe,listType:u,items:G,previewFile:h,onPreview:f,onDownload:m,onRemove:fe,showRemoveIcon:Ze,showPreviewIcon:be,showDownloadIcon:_e,removeIcon:ke,previewIcon:nt,downloadIcon:Ge,iconRender:S,extra:Ve,locale:Object.assign(Object.assign({},Ie),C),isImageUrl:y,progress:x,appendAction:Ce,appendActionVisible:ze,itemRender:T,disabled:B}):Ce,Ee=ee(ye,w,F,Re,ge,ie==null?void 0:ie.className,{[`${oe}-rtl`]:ue==="rtl",[`${oe}-picture-card-wrapper`]:u==="picture-card",[`${oe}-picture-circle-wrapper`]:u==="picture-circle"}),Ae=Object.assign(Object.assign({},ie==null?void 0:ie.style),I);if(R==="drag"){const Ce=ee(Re,oe,`${oe}-drag`,{[`${oe}-drag-uploading`]:G.some(ze=>ze.status==="uploading"),[`${oe}-drag-hover`]:H==="dragover",[`${oe}-disabled`]:B,[`${oe}-rtl`]:ue==="rtl"});return $e(s.createElement("span",{className:Ee,ref:Z},s.createElement("div",{className:Ce,style:Ae,onDrop:le,onDragOver:le,onDragLeave:le},s.createElement(nb,Object.assign({},ve,{ref:V,className:`${oe}-btn`}),s.createElement("div",{className:`${oe}-drag-container`},O))),Te()))}const De=ee(oe,`${oe}-select`,{[`${oe}-disabled`]:B,[`${oe}-hidden`]:!O}),Ue=s.createElement("div",{className:De,style:Ae},s.createElement(nb,Object.assign({},ve,{ref:V})));return $e(u==="picture-card"||u==="picture-circle"?s.createElement("span",{className:Ee,ref:Z},Te(Ue,!!O)):s.createElement("span",{className:Ee,ref:Z},Ue,Te()))},S3=s.forwardRef(lZ);var sZ=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n};const cZ=s.forwardRef((e,t)=>{const{style:n,height:r,hasControlInside:a=!1,children:l}=e,c=sZ(e,["style","height","hasControlInside","children"]),u=Object.assign(Object.assign({},n),{height:r});return s.createElement(S3,Object.assign({ref:t,hasControlInside:a},c,{style:u,type:"drag"}),l)}),Py=S3;Py.Dragger=cZ;Py.LIST_IGNORE=vu;var uZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z"}}]},name:"arrow-right",theme:"outlined"},dZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:uZ}))},fZ=s.forwardRef(dZ),mZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},vZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:mZ}))},gZ=s.forwardRef(vZ),pZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M326 664H104c-8.8 0-16 7.2-16 16v48c0 8.8 7.2 16 16 16h174v176c0 8.8 7.2 16 16 16h48c8.8 0 16-7.2 16-16V696c0-17.7-14.3-32-32-32zm16-576h-48c-8.8 0-16 7.2-16 16v176H104c-8.8 0-16 7.2-16 16v48c0 8.8 7.2 16 16 16h222c17.7 0 32-14.3 32-32V104c0-8.8-7.2-16-16-16zm578 576H698c-17.7 0-32 14.3-32 32v224c0 8.8 7.2 16 16 16h48c8.8 0 16-7.2 16-16V744h174c8.8 0 16-7.2 16-16v-48c0-8.8-7.2-16-16-16zm0-384H746V104c0-8.8-7.2-16-16-16h-48c-8.8 0-16 7.2-16 16v224c0 17.7 14.3 32 32 32h222c8.8 0 16-7.2 16-16v-48c0-8.8-7.2-16-16-16z"}}]},name:"compress",theme:"outlined"},hZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:pZ}))},rb=s.forwardRef(hZ),bZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},yZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:bZ}))},CZ=s.forwardRef(yZ),SZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M688 312v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8zm-392 88c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm144 452H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm445.7 51.5l-93.3-93.3C814.7 780.7 828 743.9 828 704c0-97.2-78.8-176-176-176s-176 78.8-176 176 78.8 176 176 176c35.8 0 69-10.7 96.8-29l94.7 94.7c1.6 1.6 3.6 2.3 5.6 2.3s4.1-.8 5.6-2.3l31-31a7.9 7.9 0 000-11.2zM652 816c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"file-search",theme:"outlined"},xZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:SZ}))},x3=s.forwardRef(xZ),$Z={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"},wZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:$Z}))},EZ=s.forwardRef(wZ),OZ={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M885.2 446.3l-.2-.8-112.2-285.1c-5-16.1-19.9-27.2-36.8-27.2H281.2c-17 0-32.1 11.3-36.9 27.6L139.4 443l-.3.7-.2.8c-1.3 4.9-1.7 9.9-1 14.8-.1 1.6-.2 3.2-.2 4.8V830a60.9 60.9 0 0060.8 60.8h627.2c33.5 0 60.8-27.3 60.9-60.8V464.1c0-1.3 0-2.6-.1-3.7.4-4.9 0-9.6-1.3-14.1zm-295.8-43l-.3 15.7c-.8 44.9-31.8 75.1-77.1 75.1-22.1 0-41.1-7.1-54.8-20.6S436 441.2 435.6 419l-.3-15.7H229.5L309 210h399.2l81.7 193.3H589.4zm-375 76.8h157.3c24.3 57.1 76 90.8 140.4 90.8 33.7 0 65-9.4 90.3-27.2 22.2-15.6 39.5-37.4 50.7-63.6h156.5V814H214.4V480.1z"}}]},name:"inbox",theme:"outlined"},RZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:OZ}))},NZ=s.forwardRef(RZ),IZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"},TZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:IZ}))},MZ=s.forwardRef(TZ),jZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5L255.8 713.6l-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.19 8.19 0 00-11.4 0l-39.8 39.8a8.19 8.19 0 000 11.4l110.3 111.2c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.1 304.1 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112m161.2 465.2C726.2 620.3 668.9 644 608 644s-118.2-23.7-161.2-66.8C403.7 534.2 380 476.9 380 416s23.7-118.2 66.8-161.2c43-43.1 100.3-66.8 161.2-66.8s118.2 23.7 161.2 66.8c43.1 43 66.8 100.3 66.8 161.2s-23.7 118.2-66.8 161.2"}}]},name:"key",theme:"outlined"},PZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:jZ}))},zZ=s.forwardRef(PZ),_Z={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"},DZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:_Z}))},AZ=s.forwardRef(DZ),BZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z"}}]},name:"play-circle",theme:"outlined"},LZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:BZ}))},xm=s.forwardRef(LZ),HZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 736c0-111.6-65.4-208-160-252.9V317.3c0-15.1-5.3-29.7-15.1-41.2L536.5 95.4C530.1 87.8 521 84 512 84s-18.1 3.8-24.5 11.4L335.1 276.1a63.97 63.97 0 00-15.1 41.2v165.8C225.4 528 160 624.4 160 736h156.5c-2.3 7.2-3.5 15-3.5 23.8 0 22.1 7.6 43.7 21.4 60.8a97.2 97.2 0 0043.1 30.6c23.1 54 75.6 88.8 134.5 88.8 29.1 0 57.3-8.6 81.4-24.8 23.6-15.8 41.9-37.9 53-64a97 97 0 0043.1-30.5 97.52 97.52 0 0021.4-60.8c0-8.4-1.1-16.4-3.1-23.8H864zM762.3 621.4c9.4 14.6 17 30.3 22.5 46.6H700V558.7a211.6 211.6 0 0162.3 62.7zM388 483.1V318.8l124-147 124 147V668H388V483.1zM239.2 668c5.5-16.3 13.1-32 22.5-46.6 16.3-25.2 37.5-46.5 62.3-62.7V668h-84.8zm388.9 116.2c-5.2 3-11.2 4.2-17.1 3.4l-19.5-2.4-2.8 19.4c-5.4 37.9-38.4 66.5-76.7 66.5-38.3 0-71.3-28.6-76.7-66.5l-2.8-19.5-19.5 2.5a27.7 27.7 0 01-17.1-3.5c-8.7-5-14.1-14.3-14.1-24.4 0-10.6 5.9-19.4 14.6-23.8h231.3c8.8 4.5 14.6 13.3 14.6 23.8-.1 10.2-5.5 19.6-14.2 24.5zM464 400a48 48 0 1096 0 48 48 0 10-96 0z"}}]},name:"rocket",theme:"outlined"},FZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:HZ}))},ab=s.forwardRef(FZ),kZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},VZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:kZ}))},KZ=s.forwardRef(VZ),WZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},qZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:WZ}))},ob=s.forwardRef(qZ),UZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 01144-53.5L537 318.9a32.05 32.05 0 000 45.3l124.5 124.5a32.05 32.05 0 0045.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z"}}]},name:"tool",theme:"outlined"},GZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:UZ}))},XZ=s.forwardRef(GZ),YZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},QZ=function(t,n){return s.createElement(Bt,we({},t,{ref:n,icon:YZ}))},ZZ=s.forwardRef(QZ);async function Sn(e,t){const n=await fetch(e,t);if(!n.ok)throw new Error((await n.json().catch(()=>({}))).error||"Something went wrong. Please try again.");return n.status===204?null:n.json()}const Rr={list:()=>Sn("/api/launchers"),running:()=>Sn("/api/launchers/running"),create:e=>Sn("/api/launchers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),update:(e,t)=>Sn(`/api/launchers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),start:e=>Sn(`/api/launchers/${e}/start`,{method:"POST"}),run:(e,t)=>Sn(`/api/launchers/${e}/scripts/${t}/run`,{method:"POST"}),runInstall:e=>Sn(`/api/launchers/${e}/install/run`,{method:"POST"}),stop:async(e,t)=>{try{return await Sn(`/api/launchers/${e}/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scriptId:t})})}catch{return Sn(`/api/launchers/${e}/scripts/${encodeURIComponent(t)}/stop`,{method:"POST"})}},logs:(e,t)=>Sn(`/api/launchers/${e}/scripts/${t}/logs`),errorLogs:(e,t)=>Sn(`/api/launchers/${e}/scripts/${t}/logs/error`),packageScripts:e=>Sn(`/api/launchers/${e}/package-scripts`),runPackageScript:(e,t)=>Sn(`/api/launchers/${e}/package-scripts/${encodeURIComponent(t)}/run`,{method:"POST"}),packageScriptLogs:(e,t)=>Sn(`/api/launchers/${e}/package-scripts/${encodeURIComponent(t)}/logs`),packageScriptErrorLogs:(e,t)=>Sn(`/api/launchers/${e}/package-scripts/${encodeURIComponent(t)}/logs/error`)},JZ={list:()=>Sn("/api/plugins")},Nh={list:e=>Sn(`/api/clipboard${e?`?date=${encodeURIComponent(e)}`:""}`),remove:(e,t)=>Sn(`/api/clipboard/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:"DELETE"}),uploadImage:e=>Sn("/api/clipboard/image",{method:"POST",headers:{"Content-Type":e.type||"image/png"},body:e})},Wo={list:()=>Sn("/api/group-tasks"),catalog:()=>Sn("/api/group-tasks/catalog"),create:e=>Sn("/api/group-tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),update:(e,t)=>Sn(`/api/group-tasks/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),remove:e=>Sn(`/api/group-tasks/${e}`,{method:"DELETE"}),start:e=>Sn(`/api/group-tasks/${e}/start`,{method:"POST"}),stop:e=>Sn(`/api/group-tasks/${e}/stop`,{method:"POST"})},Ih={list:()=>Sn("/api/port-diagnostics"),get:e=>Sn(`/api/port-diagnostics/${encodeURIComponent(e)}`),kill:(e,t)=>Sn("/api/port-diagnostics/kill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({port:e,pid:t})})},gu={status:()=>Sn("/api/settings"),saveDomain:e=>Sn("/api/settings/domain",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:e})}),saveAccessToken:(e,t)=>Sn(`/api/settings/${encodeURIComponent(e)}-access-token`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t})})},Th={check:e=>Sn("/api/pr-review/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prLink:e})}),myPrs:()=>Sn("/api/pr-review/my-prs"),reviewPrs:()=>Sn("/api/pr-review/review-prs")},{Title:eJ,Text:b2,Paragraph:tJ}=ca,ou=()=>new Intl.DateTimeFormat("en-CA").format(new Date);function nJ({value:e}){const t=[],n=/\[[^\]]+\]\(https?:\/\/[^\s)]+\)|https?:\/\/[^\s]+/g;let r=0;for(const a of e.matchAll(n)){a.index>r&&t.push(e.slice(r,a.index));const l=a[0].match(/^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/);if(l)t.push(K.jsx("a",{href:l[2],target:"_blank",rel:"noreferrer",children:l[1]},a.index));else{const c=a[0].replace(/[),.;:!?]+$/,"");t.push(K.jsx("a",{href:c,target:"_blank",rel:"noreferrer",children:c},a.index)),t.push(a[0].slice(c.length))}r=a.index+a[0].length}return r<e.length&&t.push(e.slice(r)),t}const y2=e=>e.text||e.preview||"";function iu(e,t){const n=e.trim();return n?t==="account"?/^[AT]\d+.*$/i.test(n)&&n.length<=20||/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/i.test(n)||/\b(?:account|username|user\s*name|login|帐号|账号|用户名)\s*[:=]/i.test(n):t==="id"?/\b[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\b/i.test(n)||/\b\d{15,18}[0-9Xx]?\b/.test(n)||/\b(?:id|uid|uuid|身份证)\s*[:=]\s*[\w-]+/i.test(n):t==="url"?/https?:\/\/[^\s]+/i.test(n):t==="code"?/```[\s\S]*?```|\b(?:const|let|var|function|class|import|export|SELECT|INSERT|UPDATE|DELETE)\b|[{};][\s\S]*[{};]/.test(n):!0:!1}function rJ(){const{message:e}=Pl.useApp(),[t,n]=s.useState([]),[r,a]=s.useState(ou()),[l,c]=s.useState([]),[u,f]=s.useState("all"),[m,v]=s.useState(null),g=async w=>{try{const R=await Nh.list(w);n(R.dates),c(R.items)}catch(R){e.error(R.message)}},h=s.useRef(ou());s.useEffect(()=>{const w=()=>{const T=ou();if(T!==h.current){const j=h.current;if(h.current=T,r===j)return a(T),!0}return!1};w()||g(r);const O=()=>{w()||g(r)};window.addEventListener("visibilitychange",O),window.addEventListener("focus",O);let I=null;return r===ou()&&(I=setInterval(()=>{document.visibilityState==="visible"&&g(r)},3e3)),()=>{window.removeEventListener("visibilitychange",O),window.removeEventListener("focus",O),I&&clearInterval(I)}},[r]);const b=async w=>{try{await Nh.remove(r,w),await g(r),e.success("Clipboard entry deleted.")}catch(R){e.error(R.message)}},C=async w=>{if(w.imageFile)try{const O=await(await fetch(`${window.location.origin}/api/clipboard/image/${w.imageFile}`)).blob();await navigator.clipboard.write([new ClipboardItem({[O.type]:O})]),v(w.id),setTimeout(()=>{v(I=>I===w.id?null:I)},1e3)}catch(R){e.error("Failed to copy image: "+R.message)}else navigator.clipboard.writeText(w.text||w.preview),v(w.id),setTimeout(()=>{v(R=>R===w.id?null:R)},1e3)};s.useEffect(()=>{const w=R=>{const O=document.activeElement;if(!(O&&(O.tagName==="INPUT"||O.tagName==="TEXTAREA"||O.isContentEditable))){if(R.key==="ArrowLeft"){const I=[...new Set([...t,r])].sort(),T=I.indexOf(r);T<I.length-1&&T!==-1&&a(I[T+1])}else if(R.key==="ArrowRight"){const I=[...new Set([...t,r])].sort(),T=I.indexOf(r);T>0&&a(I[T-1])}}};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[t,r]),s.useEffect(()=>{const w=async R=>{var T;const O=document.activeElement;if(O&&(O.tagName==="INPUT"||O.tagName==="TEXTAREA"||O.isContentEditable))return;const I=(T=R.clipboardData)==null?void 0:T.items;if(I){for(const j of I)if(j.type.startsWith("image/")){const M=j.getAsFile();if(M){try{e.loading({content:"Saving image from paste…",key:"paste-upload",duration:0}),await Nh.uploadImage(M);const P=ou();a(P),await g(P),e.success({content:"Image pasted and saved to history!",key:"paste-upload"})}catch(P){e.error({content:"Failed to save pasted image: "+P.message,key:"paste-upload"})}break}}}};return window.addEventListener("paste",w),()=>window.removeEventListener("paste",w)},[r]);const S=t.reduce((w,R)=>{var j;const[O,I,T]=R.split("-");return w[O]||(w[O]={}),(j=w[O])[I]||(j[I]=[]),w[O][I].push(T),w},{}),y=Object.entries(S).sort(([w],[R])=>R.localeCompare(w)).map(([w,R])=>({value:w,label:w,children:Object.entries(R).sort(([O],[I])=>I.localeCompare(O)).map(([O,I])=>({value:O,label:O,children:I.sort().reverse().map(T=>({value:T,label:T}))}))})),x=s.useMemo(()=>u==="all"?l:u==="image"?l.filter(w=>!!w.imageFile):l.filter(w=>!w.imageFile&&iu(y2(w),u)),[u,l]),$=s.useMemo(()=>{const w={all:l.length,account:0,id:0,url:0,code:0,image:0};for(const R of l)if(R.imageFile)w.image++;else{const O=y2(R);iu(O,"account")&&w.account++,iu(O,"id")&&w.id++,iu(O,"url")&&w.url++,iu(O,"code")&&w.code++}return[{key:"all",label:`All (${w.all})`},{key:"account",label:`Account (${w.account})`},{key:"id",label:`ID (${w.id})`},{key:"url",label:`Url (${w.url})`},{key:"code",label:`Code (${w.code})`},{key:"image",label:`Img (${w.image})`}]},[l]);return K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"page-header",children:[K.jsxs("div",{children:[K.jsx(b2,{type:"secondary",children:"LOCAL CLIPBOARD"}),K.jsx(eJ,{level:2,children:"Clipboard history"}),K.jsx(tJ,{type:"secondary",children:"Saved locally and archived by date."})]}),K.jsx(ic,{className:"clipboard-picker",options:y,value:r.split("-"),onChange:w=>(w==null?void 0:w.length)===3&&a(w.join("-")),placeholder:"Select date"})]}),K.jsx(ac,{className:"clipboard-tabs",activeKey:u,onChange:f,items:$}),x.length?K.jsx("div",{className:"clipboard-list",children:x.map(w=>{const R=`${window.location.origin}/api/clipboard/${r}/${w.id}`,O=new Date(w.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1});return K.jsxs(_r,{size:"small",className:"clipboard-item",children:[K.jsxs("div",{children:[K.jsx(b2,{type:"secondary",children:O}),w.imageFile?K.jsx("div",{style:{marginTop:8},children:K.jsx("img",{src:`${window.location.origin}/api/clipboard/image/${w.imageFile}`,alt:"Clipboard entry",style:{maxWidth:"100%",maxHeight:300,borderRadius:6,cursor:"pointer",border:"1px solid #eef0f6"},onClick:()=>window.open(`${window.location.origin}/api/clipboard/image/${w.imageFile}`,"_blank")})}):K.jsxs(K.Fragment,{children:[K.jsx("pre",{children:K.jsx(nJ,{value:w.preview||w.text})}),w.contentFile&&K.jsxs("span",{className:"clipboard-original",children:[K.jsx("a",{href:R,target:"_blank",rel:"noreferrer",children:"View original content"}),K.jsx("a",{href:w.editorUrl,children:"Open in VS Code"})]})]})]}),K.jsxs("span",{className:"clipboard-actions",children:[K.jsx(Ar,{title:m===w.id?"Copied!":"Copy",children:K.jsx(en,{type:"text",icon:m===w.id?K.jsx(Zu,{style:{color:"#52c41a"}}):K.jsx(od,{}),onClick:()=>C(w)})}),K.jsx(Ar,{title:"Delete",children:K.jsx(en,{type:"text",danger:!0,icon:K.jsx(xl,{}),onClick:()=>b(w.id)})})]})]},w.id)})}):K.jsx(Nr,{description:`No ${u==="all"?"clipboard entries":`${u==="id"?"ID":u} entries`} for ${r}.`}),K.jsx(_l.BackTop,{visibilityHeight:240})]})}const{Text:Mh}=ca;function aJ({tasks:e,running:t,onCreate:n,onEdit:r,onStart:a,onStop:l,onRemove:c}){const u=[{title:"Name",dataIndex:"name",render:f=>K.jsx(Mh,{strong:!0,children:f})},{title:"Scripts",dataIndex:"items",width:110,render:f=>K.jsxs(Mh,{type:"secondary",children:[f.length," scripts"]})},{title:"Actions",width:236,render:(f,m)=>{const v=m.items.every(g=>t.has(`${g.launcherId}:${g.scriptId}`));return K.jsxs(Yn,{children:[K.jsx(en,{size:"small",danger:v,icon:v?K.jsx(ob,{}):K.jsx(xm,{}),onClick:()=>v?l(m):a(m),children:v?"Stop":"Start"}),K.jsx(en,{size:"small",onClick:()=>r(m),children:"Edit"}),K.jsx(en,{size:"small",danger:!0,icon:K.jsx(xl,{}),onClick:()=>c(m),children:"Delete"})]})}}];return K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"group-task-header",children:[K.jsx(Mh,{type:"secondary",children:"Start selected scripts across multiple services."}),K.jsx(en,{type:"primary",icon:K.jsx(ov,{}),onClick:n,children:"Add quick launch"})]}),e.length?K.jsx(Pa,{className:"group-task-table",rowKey:"id",dataSource:e,columns:u,pagination:!1,size:"small"}):K.jsx(Nr,{description:"No quick launches yet.",children:K.jsx(en,{type:"primary",onClick:n,children:"Add quick launch"})})]})}const{Text:Pf}=ca,C2=(e,t)=>`${e}:${t}`,oJ=()=>K.jsxs("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",style:{verticalAlign:"middle"},children:[K.jsx("path",{d:"M514.4 36C250.8 36 36 250.8 36 514.4s214.8 478.4 478.4 478.4 478.4-214.8 478.4-478.4S777.6 36 514.4 36L514.4 36zM514.4 932.8c-231.2 0-418.4-188-418.4-418.4 0-231.2 188-418.4 418.4-418.4 231.2 0 418.4 188 418.4 418.4C932.8 745.2 745.2 932.8 514.4 932.8L514.4 932.8z"}),K.jsx("path",{d:"M620 684l-218.8 0c-33.2 0-60-27.2-60-60l0-218.8c0-33.2 27.2-60 60-60L620 345.2c33.2 0 60 27.2 60 60L680 624C680 657.2 653.2 684 620 684z"})]});function iJ({form:e,editing:t,executor:n,running:r,packageScripts:a,onRun:l,onRunInstall:c,onRunPackage:u,onStop:f,onLogs:m,onPackageLogs:v}){return K.jsx(Pn.List,{name:"scripts",children:(g,{add:h,remove:b})=>{const C=["npm","pnpm","yarn"].includes(n)?{id:"install",name:"Install",command:`${n} install${n==="npm"?" --legacy-peer-deps":""}`}:null,S=[...g.map(x=>({...x,key:`custom-${x.key}`,kind:"custom"})),...C?[{key:"install",kind:"install",script:C}]:[],...(a||[]).map(x=>({key:`package-${x.id}`,kind:"package",script:x}))],y=[{title:"Source",width:100,render:(x,$)=>K.jsx(Dr,{color:$.kind==="package"?"blue":$.kind==="install"?"green":"default",children:$.kind==="package"?"Package":$.kind==="install"?"Executor":"Custom"})},{title:"Script name",width:200,render:(x,$)=>{const w=$.kind==="custom"?e.getFieldValue(["scripts",$.name]):$.script,R=(w==null?void 0:w.name)===e.getFieldValue("startCommand"),O=t&&(w==null?void 0:w.id)&&r.has(C2(t.id,w.id));return $.kind!=="custom"?K.jsxs(Yn,{size:4,children:[O&&K.jsx(zi,{status:"success"}),K.jsx(Pf,{strong:!0,children:$.script.name}),R&&K.jsx(ab,{className:"start-script-icon"})]}):K.jsxs(Yn,{size:4,align:"center",children:[O&&K.jsx(zi,{status:"success"}),K.jsx(Pn.Item,{noStyle:!0,name:[$.name,"name"],rules:[{required:!0,message:"Required"}],children:K.jsx(Ma,{placeholder:"serve",allowClear:!0,suffix:R?K.jsx(ab,{className:"start-script-icon"}):null})})]})}},{title:"Command",render:(x,$)=>$.kind==="package"?K.jsxs(Yn,{direction:"vertical",size:0,children:[K.jsxs(Pf,{code:!0,children:[n," run ",$.script.name]}),K.jsx(Pf,{type:"secondary",children:$.script.command})]}):$.kind==="install"?K.jsx(Pf,{code:!0,children:$.script.command}):K.jsx(Pn.Item,{noStyle:!0,name:[$.name,"command"],rules:[{required:!0,message:"Required"}],children:K.jsx(Ma,{placeholder:"npm run dev",allowClear:!0})})},{title:"Actions",width:132,render:(x,$)=>{const w=$.kind==="custom"?e.getFieldValue(["scripts",$.name]):$.script,R=t&&(w==null?void 0:w.id)&&r.has(C2(t.id,w.id));return K.jsxs(Yn,{size:2,children:[t&&K.jsx(Ar,{title:R?"Stop":"Start",children:K.jsx(en,{type:"text",danger:R,icon:R?K.jsx(oJ,{}):K.jsx(xm,{}),onClick:()=>R?f(w):$.kind==="package"?u(w):$.kind==="install"?c(w):l(w),disabled:!(w!=null&&w.id)})}),K.jsx(Ar,{title:"Logs",children:K.jsx(en,{type:"text",icon:K.jsx(hy,{}),onClick:()=>$.kind==="package"?v(w):m(w),disabled:!t||!(w!=null&&w.id)})}),$.kind==="custom"&&K.jsx(Ar,{title:"Remove",children:K.jsx(en,{type:"text",danger:!0,icon:K.jsx(xl,{}),onClick:()=>b($.name)})})]})}}];return K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"script-header",children:[K.jsx(Bk,{orientation:"left",children:"Scripts"}),K.jsx(en,{icon:K.jsx(ov,{}),onClick:()=>h({name:"",command:""}),children:"Add script"})]}),K.jsx(Pa,{size:"small",rowKey:"key",pagination:!1,loading:a===null,dataSource:S,columns:y})]})}})}const lJ=()=>({alias:"",folder:"",groupName:"",executor:"npm",startCommand:"",scripts:[]});function sJ({open:e,editing:t,groups:n,running:r,onCancel:a,onSave:l,onRun:c,onRunInstall:u,onRunPackage:f,onStop:m,onLogs:v}){const{message:g}=Pl.useApp(),[h]=Pn.useForm(),[b,C]=s.useState(null);s.useEffect(()=>{e&&(h.resetFields(),h.setFieldsValue(t?{...t,scripts:t.scripts}:lJ()),C(t?null:[]),t&&Rr.packageScripts(t.id).then(y=>C(y.scripts)).catch(()=>C([])))},[e,t,h]);const S=async()=>{try{const y=(h.getFieldValue("scripts")||[]).filter(w=>{var R,O;return((R=w==null?void 0:w.name)==null?void 0:R.trim())||((O=w==null?void 0:w.command)==null?void 0:O.trim())});h.setFieldValue("scripts",y);const x=await h.validateFields(["alias","folder","groupName","startCommand"]),$={...h.getFieldsValue(!0),...x,scripts:y};await l($)}catch(y){if(y!=null&&y.errorFields)return;g.error(y.message)}};return K.jsx(ba,{title:t?`Service details · ${t.alias}`:"Add service",open:e,onCancel:a,onOk:S,okText:t?"Save":"Save service",width:860,destroyOnClose:!0,children:K.jsxs(Pn,{form:h,layout:"vertical",children:[K.jsx(im,{className:"service-config",defaultActiveKey:t?[]:["configuration"],items:[{key:"configuration",label:"Service configuration",children:K.jsxs(vm,{gutter:[16,0],children:[K.jsx(oa,{xs:24,sm:12,children:K.jsx(Pn.Item,{label:"Name",name:"alias",rules:[{required:!0}],children:K.jsx(Ma,{allowClear:!0})})}),K.jsx(oa,{xs:24,sm:12,children:K.jsx(Pn.Item,{label:"Project folder",name:"folder",rules:[{required:!0}],children:K.jsx(Ma,{prefix:K.jsx(l3,{}),allowClear:!0})})}),K.jsx(oa,{xs:24,sm:8,children:K.jsx(Pn.Item,{label:"Group",name:"groupName",children:K.jsx(sm,{options:n.map(y=>({value:y})),placeholder:"Group name",allowClear:!0})})}),K.jsx(oa,{xs:24,sm:8,children:K.jsx(Pn.Item,{label:"Executor",name:"executor",rules:[{required:!0}],children:K.jsx(sm,{options:["npm","pnpm","yarn"].map(y=>({value:y})),placeholder:"npm",allowClear:!0})})}),K.jsx(oa,{xs:24,sm:8,children:K.jsx(Pn.Item,{noStyle:!0,shouldUpdate:(y,x)=>y.scripts!==x.scripts,children:()=>{const y=(h.getFieldValue("scripts")||[]).map(w=>w==null?void 0:w.name).filter(Boolean),x=(b||[]).map(w=>w.name),$=[...new Set([...y,...x])].map(w=>({label:w,value:w}));return K.jsx(Pn.Item,{label:"Start script name",name:"startCommand",children:K.jsx(Qa,{placeholder:"Select start script",allowClear:!0,options:$})})}})})]})}]}),K.jsx(Pn.Item,{noStyle:!0,shouldUpdate:(y,x)=>y.executor!==x.executor||y.startCommand!==x.startCommand||y.scripts!==x.scripts,children:()=>K.jsx(iJ,{form:h,editing:t,executor:h.getFieldValue("executor")||"npm",running:r,packageScripts:b,onRun:y=>c(t,y),onRunInstall:()=>u(t),onRunPackage:y=>f(t,y),onStop:y=>m(t,y.id),onLogs:y=>v(t,y),onPackageLogs:y=>v(t,y,!0)})})]})})}const{Text:cJ}=ca;function uJ({open:e,editingGroupTask:t,groupCatalog:n,onCancel:r,onSave:a}){const{message:l}=Pl.useApp(),[c]=Pn.useForm();s.useEffect(()=>{e&&(c.resetFields(),c.setFieldsValue({name:(t==null?void 0:t.name)||"",items:(t==null?void 0:t.items.map(m=>`${m.launcherId}|${m.scriptId}`))||[]}))},[e,t,c]);const u=s.useMemo(()=>Object.entries(n.reduce((m,v)=>{const g=v.groupName||"Ungrouped";return(m[g]||(m[g]=[])).push(v),m},{})).sort(([m],[v])=>m.localeCompare(v)).map(([m,v])=>({key:m,label:m,children:K.jsx("div",{className:"group-task-projects",children:v.map(g=>K.jsx(_r,{size:"small",title:g.alias,children:K.jsx(Yn,{direction:"vertical",children:g.scripts.map(h=>K.jsxs(Fi,{value:`${g.id}|${h.id}`,children:[h.name," ",K.jsxs(cJ,{type:"secondary",children:["(",h.source,")"]})]},h.id))})},g.id))})})),[n]),f=async()=>{try{const m=await c.validateFields(),v={name:m.name,items:m.items.map(g=>{const[h,b]=g.split("|");return{launcherId:h,scriptId:b}})};await a(v)}catch(m){m!=null&&m.errorFields||l.error(m.message)}};return K.jsx(ba,{title:t?`Edit quick launch · ${t.name}`:"Add quick launch",open:e,onCancel:r,onOk:f,okText:t?"Save changes":"Save quick launch",width:760,destroyOnClose:!0,children:K.jsxs(Pn,{form:c,layout:"vertical",children:[K.jsx(Pn.Item,{label:"Name",name:"name",rules:[{required:!0}],children:K.jsx(Ma,{placeholder:"Start local stack",allowClear:!0})}),K.jsx(Pn.Item,{label:"Scripts",name:"items",rules:[{required:!0,message:"Select at least one script."}],children:K.jsx(Fi.Group,{className:"group-task-selector",children:K.jsx(ac,{items:u})})})]})})}const S2={30:"ansi-black",31:"ansi-red",32:"ansi-green",33:"ansi-yellow",34:"ansi-blue",35:"ansi-magenta",36:"ansi-cyan",37:"ansi-white",90:"ansi-gray",91:"ansi-red",92:"ansi-green",93:"ansi-yellow",94:"ansi-blue",95:"ansi-magenta",96:"ansi-cyan",97:"ansi-white"};function ib({value:e}){let t="";const n=(a,l,c)=>!a.includes("http")&&!a.includes("/")?K.jsx("span",{className:l,children:a},c):a.split(/(https?:\/\/[^\s<>'"`]+|\/(?:[^\s:(),;!?]+\/)*[^\s:(),;!?]+(?::\d+(?::\d+)?)?)/g).map((u,f)=>{if(/^https?:\/\//.test(u)){const m=u.replace(/[),.;:!?]+$/,""),v=u.slice(m.length);return K.jsxs("span",{className:l,children:[K.jsx("a",{className:"log-link",href:m,target:"_blank",rel:"noreferrer",children:m}),v]},`${c}-${f}`)}if(u.startsWith("/")){const[,m,v=""]=u.match(/^(.*?)(:\d+(?::\d+)?)?$/)||[],g=`vscode://file${encodeURI(m)}${v}`;return K.jsx("span",{className:l,children:K.jsx("a",{className:"log-link",href:g,target:"_blank",rel:"noreferrer",children:u})},`${c}-${f}`)}return K.jsx("span",{className:l,children:u},`${c}-${f}`)}),r=(a,l)=>a.split(/(\u001b\[[0-9;]*m)/g).map((u,f)=>{const m=u.match(/^\u001b\[([0-9;]*)m$/);if(m){const g=m[1].split(";").map(Number);return t=g.includes(0)?"":S2[g.find(h=>S2[h])]||t,null}const v=t||(/\b(error|failed|fatal|exception)\b/i.test(u)?"log-error":/\b(warn|warning)\b/i.test(u)?"log-warning":/\b(success|ready|started|listening)\b/i.test(u)?"log-success":"");return n(u,v,`${l}-${f}`)});return K.jsx("div",{className:"log-output",role:"log",children:e.split(`
478
+ `).map((a,l)=>K.jsx("div",{className:"log-line",children:K.jsx("code",{children:r(a,l)})},l))})}function dJ({open:e,logTarget:t,onCancel:n}){const[r,a]=s.useState("output"),[l,c]=s.useState("");return s.useEffect(()=>{e&&(a("output"),c("Loading…"))},[e,t]),s.useEffect(()=>{if(!e||!t)return;const u=async()=>{try{const m=t.package?r==="error"?await Rr.packageScriptErrorLogs(t.launcher.id,t.script.name):await Rr.packageScriptLogs(t.launcher.id,t.script.name):r==="error"?await Rr.errorLogs(t.launcher.id,t.script.id):await Rr.logs(t.launcher.id,t.script.id);c(m.log||(r==="error"?"No error logs yet.":"No logs yet."))}catch(m){c(m.message)}};u();const f=setInterval(u,1e3);return()=>clearInterval(f)},[e,t,r]),K.jsx(ba,{title:K.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingRight:32},children:[K.jsx("span",{children:t?`${t.script.name} · Logs`:"Logs"}),t&&K.jsx(en,{type:"text",size:"small",icon:K.jsx(EZ,{}),onClick:()=>{const u=t.package?`#/logs/${t.launcher.id}/pkg/${encodeURIComponent(t.script.name)}`:`#/logs/${t.launcher.id}/${encodeURIComponent(t.script.id)}`;window.open(u,"_blank")},title:"Open in new tab",style:{display:"inline-flex",alignItems:"center",justifyContent:"center"}})]}),open:e,onCancel:n,footer:null,width:1080,zIndex:1200,children:K.jsx(ac,{activeKey:r,onChange:a,items:[{key:"output",label:"Logs",children:K.jsx(ib,{value:l})},{key:"error",label:"Error logs",children:K.jsx(ib,{value:l})}]})})}const{Title:fJ,Text:lu,Paragraph:mJ}=ca;function vJ({launchers:e,running:t,refresh:n}){const{message:r}=Pl.useApp(),[a,l]=s.useState("all"),[c,u]=s.useState([]),[f,m]=s.useState([]),[v,g]=s.useState(!1),[h,b]=s.useState(!1),[C,S]=s.useState(null),[y,x]=s.useState(!1),[$,w]=s.useState(null),[R,O]=s.useState(!1),[I,T]=s.useState(null);s.useEffect(()=>{Wo.list().then(u).catch(U=>r.error(U.message))},[]);const j=s.useMemo(()=>[...new Set(e.map(U=>U.groupName).filter(Boolean))].sort((U,Q)=>U.localeCompare(Q)),[e]),M=a==="all"?e:e.filter(U=>U.groupName===a),P=(U=null)=>{w(U),x(!0)},z=async U=>{$?await Rr.update($.id,U):(await Rr.create(U),x(!1)),r.success("Saved"),await n()},D=async(U,Q)=>{try{await Rr.run(U.id,Q.id),await n()}catch(ne){r.error(ne.message)}},L=async U=>{try{await Rr.runInstall(U.id),await n()}catch(Q){r.error(Q.message)}},A=async(U,Q)=>{try{await Rr.runPackageScript(U.id,Q.name),await n()}catch(ne){r.error(ne.message)}},F=(U,Q,ne=!1)=>{T({launcher:U,script:Q,package:ne}),O(!0)},_=async U=>{try{await Rr.start(U.id),await n()}catch(Q){r.warning(Q.message)}},B=async(U,Q)=>{try{await Rr.stop(U.id,Q),await n()}catch(ne){await n(),r.error(ne.message)}},W=async(U,Q)=>{try{await Promise.all(Q.map(ne=>Rr.stop(U.id,ne))),await n()}catch(ne){await n(),r.error(ne.message)}},G=async(U=null)=>{if(S(U),b(!0),!f.length)try{m(await Wo.catalog())}catch(Q){r.error(Q.message)}},Y=async U=>{C?await Wo.update(C.id,U):await Wo.create(U),b(!1),u(await Wo.list())},H=async U=>{const Q=`group-task-${U.id}`;r.loading({content:`Starting ${U.name}…`,key:Q,duration:0});try{const ne=await Wo.start(U.id),ae=ne.results.filter(ce=>ce.error);ae.length?r.warning({content:`${ne.results.length-ae.length} started, ${ae.length} failed.`,key:Q}):r.success({content:`${ne.results.length} scripts started.`,key:Q}),await n()}catch(ne){r.error({content:ne.message,key:Q})}},q=async U=>{const Q=`group-task-${U.id}`;r.loading({content:`Stopping ${U.name}…`,key:Q,duration:0});try{const ae=(await Wo.stop(U.id)).results.filter(ce=>ce.ok).length;r.success({content:`${ae} scripts stopped.`,key:Q}),await n()}catch(ne){r.error({content:ne.message,key:Q})}},V=async U=>{try{await Wo.remove(U.id),u(await Wo.list())}catch(Q){r.error(Q.message)}},Z=[{title:"Service",dataIndex:"alias",render:(U,Q)=>K.jsxs(Yn,{direction:"vertical",size:0,children:[K.jsx(lu,{strong:!0,children:U}),K.jsx(lu,{type:"secondary",className:"launcher-folder",children:Q.folder})]})},{title:"Current branch",dataIndex:"branch",width:240,render:U=>U?K.jsx(lu,{code:!0,children:U}):K.jsx(lu,{type:"secondary",children:"—"})},{title:"Scripts",width:150,align:"center",render:(U,Q)=>{const ne=[...t].filter(ce=>ce.startsWith(`${Q.id}:`)).length,ae=Q.scripts.length+(Q.packageScriptCount||0);return K.jsx(zi,{status:ne?"success":"default",text:`${ne} / ${ae} running`})}},{title:"Action",width:108,align:"center",render:(U,Q)=>{const ne=[...t].filter(ce=>ce.startsWith(`${Q.id}:`)),ae=ne.length>0;return K.jsx(en,{size:"small",type:ae?"default":"primary",danger:ae,icon:ae?K.jsx(ob,{}):K.jsx(xm,{}),onClick:ce=>{ce.stopPropagation(),ae?W(Q,ne.map(pe=>pe.slice(`${Q.id}:`.length))):_(Q)},children:ae?"Stop":"Start"})}}];return K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"page-header",children:[K.jsxs("div",{children:[K.jsx(lu,{type:"secondary",children:"SERVICES"}),K.jsx(fJ,{level:2,children:"Launcher"}),K.jsx(mJ,{type:"secondary",children:"Manage and run local project scripts."})]}),K.jsxs(Yn,{children:[K.jsx(en,{onClick:()=>g(!0),children:"Quick Launch"}),K.jsx(en,{type:"primary",icon:K.jsx(ov,{}),onClick:()=>P(),children:"Add service"})]})]}),e.length?K.jsxs(K.Fragment,{children:[c.length>0&&K.jsx("div",{className:"quick-launch-bar",style:{marginBottom:20,padding:"12px 16px",background:"#fff",borderRadius:8,border:"1px solid #e4e8f1",boxShadow:"0 2px 8px rgba(31, 42, 68, 0.03)"},children:K.jsxs(Yn,{wrap:!0,size:"middle",children:[K.jsx("span",{style:{fontSize:11,color:"#727b94",fontWeight:750,textTransform:"uppercase",letterSpacing:"0.08em"},children:"Quick Launch:"}),c.map(U=>{const Q=U.items.every(ne=>t.has(`${ne.launcherId}:${ne.scriptId}`));return K.jsxs(en,{type:Q?"default":"primary",danger:Q,icon:Q?K.jsx(ob,{}):K.jsx(xm,{}),onClick:()=>Q?q(U):H(U),children:[Q?"Stop":"Start"," ",U.name]},U.id)})]})}),K.jsx(ac,{activeKey:a,onChange:l,className:"group-tabs",items:[{key:"all",label:`All (${e.length})`},...j.map(U=>({key:U,label:`${U} (${e.filter(Q=>Q.groupName===U).length})`}))]}),M.length?K.jsx(Pa,{className:"launcher-table",rowKey:"id",dataSource:M,columns:Z,pagination:!1,onRow:U=>({onClick:()=>P(U)})}):K.jsx(Nr,{description:"No services in this group."})]}):K.jsx(Nr,{description:"No services yet",children:K.jsx(en,{type:"primary",onClick:()=>P(),children:"Add service"})}),K.jsx(sJ,{open:y,editing:$,groups:j,running:t,onCancel:()=>x(!1),onSave:z,onRun:D,onRunInstall:L,onRunPackage:A,onStop:B,onLogs:F}),K.jsx(ba,{title:"Quick Launch",open:v,onCancel:()=>g(!1),footer:null,width:760,destroyOnClose:!0,children:K.jsx(aJ,{tasks:c,running:t,onCreate:()=>G(),onEdit:G,onStart:H,onStop:q,onRemove:V})}),K.jsx(uJ,{open:h,editingGroupTask:C,groupCatalog:f,onCancel:()=>b(!1),onSave:Y}),K.jsx(dJ,{open:R,logTarget:I,onCancel:()=>O(!1)})]})}const{Title:gJ,Text:Co,Paragraph:pJ}=ca;function hJ({refreshLaunchers:e}){const[t,n]=s.useState([]),[r,a]=s.useState(!1),[l,c]=s.useState(null),[u,f]=s.useState(!1),[m,v]=s.useState(!1),[g,h]=s.useState(null),b=async()=>{a(!0);try{n((await Ih.list()).ports)}catch(x){Ta.error(x.message)}finally{a(!1)}};s.useEffect(()=>{b()},[]);const C=async()=>{if(l){f(!0);try{const x=(await Ih.get(l)).process;h(x),v(!0)}catch(x){Ta.error(x.message)}finally{f(!1)}}},S=async({port:x,pid:$})=>{try{await Ih.kill(x,$),Ta.success(`Process on port ${x} was killed.`),await b(),e&&await e()}catch(w){Ta.error(w.message)}},y=[{title:"Port",dataIndex:"port",width:100,render:x=>K.jsx(Co,{code:!0,children:x})},{title:"Launcher",dataIndex:"launcher",render:(x,$)=>K.jsxs(Yn,{direction:"vertical",size:0,children:[K.jsx(Co,{strong:!0,children:x}),K.jsx(Co,{type:"secondary",children:$.script})]})},{title:"Process",dataIndex:"command",render:(x,$)=>K.jsxs(Yn,{direction:"vertical",size:0,children:[K.jsx(Co,{code:!0,children:$.currentCommand||x}),K.jsxs(Co,{type:"secondary",children:["PID ",$.currentPid||$.pid]})]})},{title:"Status",width:170,render:(x,$)=>$.ghost?K.jsx(Dr,{color:"error",children:"Ghost process"}):$.listening?K.jsx(Dr,{color:"success",children:"Script running"}):$.reused?K.jsx(Dr,{color:"warning",children:"Port reused"}):K.jsx(Dr,{children:"Port released"})},{title:"Action",width:100,render:(x,$)=>$.listening||$.reused?K.jsx(K0,{title:`Kill process on port ${$.port}?`,description:"The process currently listening on this port will be stopped.",okText:"Kill",okButtonProps:{danger:!0},onConfirm:()=>S({port:$.port,pid:$.currentPid}),children:K.jsx(en,{danger:!0,icon:K.jsx(xl,{}),children:"Kill"})}):K.jsx(en,{disabled:!0,icon:K.jsx(xl,{}),children:"Kill"})}];return K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"page-header",children:[K.jsxs("div",{children:[K.jsx(Co,{type:"secondary",children:"DIAGNOSTICS"}),K.jsx(gJ,{level:2,children:"Port Diagnostic"}),K.jsx(pJ,{type:"secondary",children:"Every port observed while a recent Launcher script was running. Ghost processes still listen after their script has stopped."})]}),K.jsx(en,{icon:K.jsx(tU,{}),onClick:b,loading:r,children:"Refresh"})]}),K.jsxs(_r,{className:"port-manual-query",size:"small",children:[K.jsxs(Yn,{wrap:!0,children:[K.jsx(Co,{strong:!0,children:"Query port"}),K.jsx(pm,{min:1,max:65535,controls:!1,value:l,onChange:c,onPressEnter:C,placeholder:"e.g. 3000"}),K.jsx(en,{type:"primary",onClick:C,loading:u,disabled:!l,children:"Query"})]}),m&&K.jsx("div",{className:"port-query-result",children:g?K.jsxs(Yn,{wrap:!0,children:[K.jsx(Dr,{color:"success",children:"Listening"}),K.jsxs(Co,{code:!0,children:["PID ",g.pid]}),K.jsx(Co,{code:!0,children:g.command}),K.jsx(K0,{title:`Kill process on port ${g.port}?`,description:"The process currently listening on this port will be stopped.",okText:"Kill",okButtonProps:{danger:!0},onConfirm:()=>S(g),children:K.jsx(en,{danger:!0,icon:K.jsx(xl,{}),children:"Kill"})})]}):K.jsxs(Co,{type:"secondary",children:["No process is listening on port ",l,"."]})})]}),K.jsx(Pa,{className:"port-diagnostic-table",rowKey:x=>`${x.startedAt}-${x.port}-${x.pid}`,loading:r,dataSource:t,columns:y,pagination:!1,locale:{emptyText:K.jsx(Nr,{description:"No ports have been observed from Launcher scripts yet."})}})]})}const{Title:x2,Paragraph:bJ,Text:su}=ca,jh=[{id:"bitbucket",label:"Bitbucket"},{id:"jira",label:"Jira"},{id:"confluence",label:"Confluence"}];function yJ(){const[e]=Pn.useForm(),[t,n]=s.useState({}),[r,a]=s.useState(!1),[l,c]=s.useState(!1);s.useEffect(()=>{gu.status().then(v=>{n(v),e.setFieldValue("domain",v.domain)}).catch(v=>Ta.error(v.message))},[e]);const u=v=>t[`${v}TokenConfigured`],f=async()=>{try{await e.validateFields(["domain"]),a(!0);const v=e.getFieldsValue();if(v.domain!=null){const g=await gu.saveDomain(v.domain);n(h=>({...h,...g})),e.setFieldValue("domain",g.domain)}for(const{id:g}of jh)if(v[g]){const h=await gu.saveAccessToken(g,v[g]);n(b=>({...b,...h})),e.resetFields([g])}a(!1),c(!0),setTimeout(()=>c(!1),1500)}catch(v){a(!1),v!=null&&v.errorFields||Ta.error(v.message)}},m=async v=>{try{const g=await gu.saveAccessToken(v,"");n(g),e.resetFields([v]),Ta.success(`${jh.find(h=>h.id===v).label} Access Token removed.`)}catch(g){Ta.error(g.message)}};return K.jsxs("div",{className:"settings-page",children:[K.jsx(su,{type:"secondary",children:"SETTINGS"}),K.jsxs("div",{className:"settings-page-header",children:[K.jsx(x2,{level:2,children:"Settings"}),K.jsx(en,{type:"primary",color:l?"green":"primary",variant:"solid",icon:l?K.jsx(Zu,{}):null,loading:!l&&r,onClick:f,children:l?"Saved":"Save"})]}),K.jsxs(_r,{className:"settings-card",children:[K.jsxs("div",{className:"settings-title",children:[K.jsx("div",{className:"settings-icon-wrap",children:K.jsx(zZ,{className:"settings-icon"})}),K.jsxs("div",{children:[K.jsx(x2,{level:4,children:"Access Tokens"}),K.jsx(bJ,{type:"secondary",children:"Tokens are stored locally and are never shown again."})]})]}),K.jsxs(Pn,{form:e,layout:"vertical",className:"token-settings-form",children:[K.jsxs("div",{className:"token-row",children:[K.jsxs("div",{className:"token-row-info",children:[K.jsx(su,{strong:!0,className:"token-row-name",children:"Domain"}),K.jsx(su,{type:"secondary",className:"token-row-hint",children:"Your Intranet Domain"})]}),K.jsx(Pn.Item,{name:"domain",rules:[{pattern:/^([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,message:"Enter a valid domain, e.g. abc.com"}],children:K.jsx(Ma,{placeholder:"abc.com",allowClear:!0})})]}),jh.map(({id:v,label:g})=>K.jsxs("div",{className:`token-row ${u(v)?"is-configured":""}`,children:[K.jsxs("div",{className:"token-row-info",children:[K.jsxs("div",{className:"token-row-name-line",children:[K.jsx(su,{strong:!0,className:"token-row-name",children:g}),u(v)&&K.jsx(Dr,{color:"success",closable:!0,onClose:h=>{h.preventDefault(),m(v)},className:"token-row-tag",children:"Configured"})]}),K.jsxs(su,{type:"secondary",className:"token-row-hint",children:[g," API access token"]})]}),K.jsx(Pn.Item,{name:v,children:K.jsx(Ma.Password,{placeholder:u(v)?"Enter new token to replace":"Paste access token",autoComplete:"off",allowClear:!0})})]},v))]})]})]})}const CJ="modulepreload",SJ=function(e){return"/"+e},$2={},xJ=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let c=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(m=>{if(m=SJ(m),m in $2)return;$2[m]=!0;const v=m.endsWith(".css"),g=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const h=document.createElement("link");if(h.rel=v?"stylesheet":CJ,v||(h.as="script"),h.crossOrigin="",h.href=m,f&&h.setAttribute("nonce",f),document.head.appendChild(h),v)return new Promise((b,C)=>{h.addEventListener("load",b),h.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return a.then(c=>{for(const u of c||[])u.status==="rejected"&&l(u.reason);return t().catch(l)})},{Title:w2,Text:pa,Paragraph:$J}=ca,{Dragger:wJ}=Py,E2=(e=0)=>{if(!e)return"0 B";const t=["B","KB","MB","GB"],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1);return`${(e/1024**n).toFixed(n?1:0)} ${t[n]}`},EJ=e=>({file:e,name:e.name||"clipboard-image.png",url:URL.createObjectURL(e),size:e.size});async function OJ(e,t,n){const r=URL.createObjectURL(e);try{const a=await new Promise((m,v)=>{const g=new Image;g.onload=()=>m(g),g.onerror=()=>v(new Error("Unable to read this image. Please choose a valid image file.")),g.src=r}),l=document.createElement("canvas"),c=Math.max(a.naturalWidth,a.naturalHeight);let u=1;t&&(u=t/c),n!=null&&n>0&&n<=100&&(u=u*(n/100)),l.width=Math.max(1,Math.round(a.naturalWidth*u)),l.height=Math.max(1,Math.round(a.naturalHeight*u));const f=l.getContext("2d",{willReadFrequently:!0});return f.drawImage(a,0,0,l.width,l.height),{imageData:f.getImageData(0,0,l.width,l.height),width:l.width,height:l.height}}finally{URL.revokeObjectURL(r)}}function RJ(){const[e,t]=s.useState(null),[n,r]=s.useState(null),[a,l]=s.useState(75),[c,u]=s.useState(!0),[f,m]=s.useState(!0),[v,g]=s.useState(!0),[h,b]=s.useState(2),[C,S]=s.useState(!1),[y,x]=s.useState(null),[$,w]=s.useState(100),[R,O]=s.useState(!1),[I,T]=s.useState(!1),[j,M]=Ta.useMessage(),P=s.useRef(null),z=s.useRef(null),D=Y=>{var H;(H=Y.current)!=null&&H.url&&URL.revokeObjectURL(Y.current.url)},L=Y=>{var q;if(!((q=Y==null?void 0:Y.type)!=null&&q.startsWith("image/")))return j.error("Please choose an image file."),!1;D(P),D(z);const H=EJ(Y);return P.current=H,z.current=null,t(H),r(null),B(Y),!1},A=Y=>{var H;return[...((H=Y.dataTransfer)==null?void 0:H.types)||[]].includes("Files")},F=Y=>{var q;Y.preventDefault(),T(!1);const H=[...((q=Y.dataTransfer)==null?void 0:q.files)||[]].find(V=>V.type.startsWith("image/"));H?L(H):j.error("Drop an image file to compress it.")};s.useEffect(()=>()=>{D(P),D(z)},[]),s.useEffect(()=>{const Y=H=>{var Z;const q=[...((Z=H.clipboardData)==null?void 0:Z.items)||[]].find(U=>U.type.startsWith("image/"));if(!q)return;H.preventDefault();const V=q.getAsFile();V&&(L(new File([V],`clipboard-${Date.now()}.${V.type.split("/")[1]||"png"}`,{type:V.type})),j.success("Image read from clipboard."))};return window.addEventListener("paste",Y),()=>window.removeEventListener("paste",Y)},[j]);const _=async()=>{var Y;try{if(!((Y=navigator.clipboard)!=null&&Y.read))throw new Error("Direct clipboard reading is unavailable. Paste an image with ⌘ / Ctrl + V instead.");const H=await navigator.clipboard.read();for(const q of H){const V=q.types.find(Z=>Z.startsWith("image/"));if(V){const Z=await q.getType(V);L(new File([Z],`clipboard-${Date.now()}.${V.split("/")[1]||"png"}`,{type:V})),j.success("Image read from clipboard.");return}}throw new Error("No image was found in the clipboard.")}catch(H){j.warning(H.message||"Unable to read an image from the clipboard.")}},B=async(Y=e==null?void 0:e.file)=>{if(Y){O(!0);try{const[{encode:H},{imageData:q,width:V,height:Z}]=await Promise.all([xJ(()=>import("./index-Dty-56mC.js"),[]),OJ(Y,y,$)]),U=await H(q,{quality:a,progressive:c,optimize_coding:f,auto_subsample:v,chroma_subsample:h,trellis_multipass:C});D(z);const Q=new Blob([U],{type:"image/jpeg"}),ne={url:URL.createObjectURL(Q),size:Q.size,width:V,height:Z};z.current=ne,r(ne),j.success("MozJPEG compression complete.")}catch(H){j.error(H.message||"Image compression failed.")}finally{O(!1)}}},W=()=>{if(!n)return;const Y=e.name.replace(/\.[^.]+$/,"")||"image",H=document.createElement("a");H.href=n.url,H.download=`${Y}-mozjpeg.jpg`,H.click()},G=n&&e?Math.round((1-n.size/e.size)*100):null;return K.jsxs(K.Fragment,{children:[M,K.jsxs("div",{className:`squoosh-page ${I?"is-file-dragging":""}`,onDragOver:Y=>{A(Y)&&(Y.preventDefault(),T(!0))},onDragLeave:Y=>{Y.currentTarget===Y.target&&T(!1)},onDrop:F,children:[K.jsxs("header",{className:"squoosh-header",children:[K.jsxs("div",{children:[K.jsx(pa,{children:"MOZJPEG WORKBENCH"}),K.jsx(w2,{level:2,children:"Image compression"})]}),K.jsxs(Yn,{children:[K.jsx(en,{icon:K.jsx(od,{}),onClick:_,children:"Read clipboard"}),K.jsx(en,{type:"primary",icon:K.jsx(rb,{}),onClick:()=>B(),disabled:!e,loading:R,children:"Compress"})]})]}),K.jsxs("main",{className:"squoosh-studio",children:[K.jsxs("section",{className:"squoosh-preview-area",children:[K.jsx(O2,{title:"Original",detail:e?`${E2(e.size)} · ${e.name}`:"Choose an image to begin",children:e?K.jsx(R2,{label:"Original image",image:e.url}):K.jsxs(wJ,{accept:"image/*",multiple:!1,showUploadList:!1,beforeUpload:L,className:"image-dropzone",children:[K.jsx("p",{className:"ant-upload-drag-icon",children:K.jsx(NZ,{})}),K.jsx("p",{className:"ant-upload-text",children:"Drop an image or click to choose"}),K.jsx("p",{className:"ant-upload-hint",children:"Or paste an image with ⌘ / Ctrl + V."})]})}),K.jsx(O2,{title:"MozJPEG output",detail:n?`${E2(n.size)} · ${n.width} × ${n.height}`:"Waiting for compression",action:n&&K.jsx(en,{type:"primary",size:"small",icon:K.jsx(C3,{}),onClick:W,children:"Download"}),children:R?K.jsx("div",{className:"image-loading",children:K.jsx(fv,{tip:"Compressing…"})}):n?K.jsxs(K.Fragment,{children:[K.jsx(R2,{label:"Compressed JPEG",image:n.url}),G!==null&&K.jsx("div",{className:`compression-saving ${G>0?"is-saving":""}`,children:G>0?`${G}% smaller`:"No size reduction at current settings."})]}):K.jsx(Nr,{image:Nr.PRESENTED_IMAGE_SIMPLE,description:"Compressed preview"})})]}),K.jsxs("aside",{className:"squoosh-settings",children:[K.jsxs("div",{className:"settings-heading",children:[K.jsx(pa,{children:"ENCODER"}),K.jsx(w2,{level:4,children:"MozJPEG"}),K.jsx($J,{children:"Fine-tune output size and image quality."})]}),K.jsxs("div",{className:"option-row",children:[K.jsxs("div",{children:[K.jsx(pa,{strong:!0,children:"Quality"}),K.jsx("br",{}),K.jsx(pa,{type:"secondary",children:"Higher values preserve more detail."})]}),K.jsx(Dr,{color:"blue",children:a})]}),K.jsx(AV,{min:1,max:100,value:a,onChange:l,tooltip:{formatter:Y=>`${Y}`}}),K.jsxs("div",{className:"option-select",children:[K.jsxs("div",{children:[K.jsx(pa,{strong:!0,children:"Long edge"}),K.jsx("br",{}),K.jsx(pa,{type:"secondary",children:"Scale the longest edge to this value. Never crops the image."})]}),K.jsx(pm,{min:1,max:16384,value:y,onChange:x,placeholder:"Original",addonAfter:"px"})]}),K.jsxs("div",{className:"option-select",children:[K.jsxs("div",{children:[K.jsx(pa,{strong:!0,children:"Scale"}),K.jsx("br",{}),K.jsx(pa,{type:"secondary",children:"Scale the image by percentage."})]}),K.jsx(pm,{min:1,max:100,value:$,onChange:w,placeholder:"100",addonAfter:"%",allowClear:!0})]}),K.jsx(zf,{label:"Progressive JPEG",description:"Display a low-detail preview while loading.",checked:c,onChange:u}),K.jsx(zf,{label:"Optimize coding",description:"Reduce size without changing image quality.",checked:f,onChange:m}),K.jsx(im,{ghost:!0,className:"advanced-options",items:[{key:"advanced",label:"Advanced settings",children:K.jsxs(K.Fragment,{children:[K.jsx(zf,{label:"Automatic chroma subsampling",description:"Pick sampling based on the image content.",checked:v,onChange:g}),K.jsxs("div",{className:"option-select",children:[K.jsxs("div",{children:[K.jsx(pa,{strong:!0,children:"Chroma subsampling"}),K.jsx("br",{}),K.jsx(pa,{type:"secondary",children:"Enabled when automatic mode is off."})]}),K.jsx(Qa,{disabled:v,value:h,onChange:b,options:[{value:0,label:"4:4:4 (colour detail)"},{value:1,label:"4:2:2 (balanced)"},{value:2,label:"4:2:0 (smaller file)"}]})]}),K.jsx(zf,{label:"Trellis multi-pass",description:"Further size reduction with a longer encode time.",checked:C,onChange:S})]})}]}),K.jsx(en,{type:"primary",size:"large",block:!0,icon:K.jsx(rb,{}),onClick:()=>B(),disabled:!e,loading:R,children:"Compress image"})]})]})]})]})}function O2({title:e,detail:t,action:n,children:r}){return K.jsxs("section",{className:"preview-pane",children:[K.jsxs("header",{children:[K.jsxs("div",{children:[K.jsx(pa,{children:e}),K.jsx("span",{children:t})]}),n]}),K.jsx("div",{className:"preview-canvas",children:r})]})}function zf({label:e,description:t,checked:n,onChange:r}){return K.jsxs("div",{className:"option-switch",children:[K.jsxs("div",{children:[K.jsx(pa,{strong:!0,children:e}),K.jsx("br",{}),K.jsx(pa,{type:"secondary",children:t})]}),K.jsx(H4,{checked:n,onChange:r})]})}function R2({label:e,image:t,metadata:n}){return K.jsxs("div",{className:"image-panel",children:[K.jsx("img",{src:t,alt:e}),n&&K.jsx("div",{className:"image-panel-meta",children:K.jsx(pa,{type:"secondary",children:n})})]})}const{Title:NJ,Text:Jr,Paragraph:IJ}=ca;function N2({prs:e,onSelectPr:t}){return e.length===0?K.jsx(Nr,{description:"No open pull requests found.",style:{padding:"24px 0"}}):K.jsx("div",{style:{display:"grid",gap:"12px"},children:e.map(n=>{var a,l,c,u,f,m,v,g,h;const r=n.reviewUrl||"";return K.jsx(_r,{size:"small",hoverable:!0,style:{borderColor:"#e3e6ef",transition:"all 0.2s"},onClick:()=>r&&t(r),children:K.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:"12px"},children:[K.jsxs("div",{style:{flex:1,minWidth:0},children:[K.jsxs(Yn,{size:8,wrap:!0,children:[K.jsxs(Jr,{strong:!0,style:{fontSize:"14px"},children:["#",n.id," ",n.title]}),n.draft&&K.jsx(Dr,{color:"gold",children:"Draft"})]}),K.jsxs("div",{style:{marginTop:"6px",fontSize:"12px",display:"flex",alignItems:"center",flexWrap:"wrap",gap:"6px",color:"#727b94"},children:[K.jsxs(Jr,{type:"secondary",style:{fontWeight:500},children:[(c=(l=(a=n.fromRef)==null?void 0:a.repository)==null?void 0:l.project)==null?void 0:c.key," / ",(f=(u=n.fromRef)==null?void 0:u.repository)==null?void 0:f.slug]}),K.jsx("span",{style:{color:"#d9d9d9"},children:"|"}),K.jsx(Dr,{size:"small",color:"cyan",style:{margin:0},children:(m=n.fromRef)==null?void 0:m.displayId}),K.jsx(fZ,{style:{fontSize:"10px",color:"#8c8c8c"}}),K.jsx(Dr,{size:"small",color:"blue",style:{margin:0},children:(v=n.toRef)==null?void 0:v.displayId}),K.jsx("span",{style:{color:"#d9d9d9"},children:"|"}),K.jsxs("span",{children:["Author: ",K.jsx("strong",{children:(h=(g=n.author)==null?void 0:g.user)==null?void 0:h.displayName})]}),K.jsx("span",{style:{color:"#d9d9d9"},children:"|"}),K.jsxs("span",{children:["Updated: ",new Date(n.updatedDate).toLocaleDateString()]})]})]}),K.jsxs(Yn,{size:8,children:[K.jsx(en,{size:"small",icon:K.jsx(AZ,{}),onClick:b=>{b.stopPropagation(),r&&window.open(r,"_blank")},children:"Open"}),K.jsx(en,{type:"primary",size:"small",onClick:b=>{b.stopPropagation(),r&&t(r)},children:"Review"})]})]})},n.id)})})}function TJ(){const[e]=Pn.useForm(),[t,n]=s.useState(!1),[r,a]=s.useState(!0),[l,c]=s.useState(null),[u,f]=s.useState(!1),[m,v]=s.useState([]),[g,h]=s.useState([]),[b,C]=s.useState(!1),[S,y]=s.useState("review"),x=async()=>{C(!0);try{const[O,I]=await Promise.all([Th.myPrs().catch(()=>({values:[]})),Th.reviewPrs().catch(()=>({values:[]}))]);v((O==null?void 0:O.values)||[]),h((I==null?void 0:I.values)||[])}catch{}C(!1)};s.useEffect(()=>{gu.status().then(O=>{a(O.bitbucketTokenConfigured),O.bitbucketTokenConfigured&&x()}).catch(()=>{})},[]);const $=async O=>{const I=typeof O=="string"?O:O.prLink;if(I){n(!0),c(null),e.setFieldsValue({prLink:I});try{const T=await Th.check(I.trim());c(T),Ta.success("PR Review completed successfully.")}catch(T){Ta.error(T.message)}finally{n(!1)}}},w=()=>{if(!l)return;const{pr:O,stats:I,files:T}=l;let j=`## 🔍 PR Review Report: ${O.title}
479
479
  `;if(j+=`* **Author:** ${O.author}
480
480
  `,j+=`* **Branch:** \`${O.sourceBranch}\` ➔ \`${O.targetBranch}\`
481
481
 
@@ -493,4 +493,4 @@ html body {
493
493
  ${P.code.trim()}
494
494
  \`\`\`
495
495
  `}j+=`
496
- `}}navigator.clipboard.writeText(j),f(!0),Ta.success("Markdown report copied to clipboard."),setTimeout(()=>f(!1),2e3)},R=O=>O==="critical"?K.jsx(Dr,{color:"error",icon:K.jsx(CZ,{}),children:"Critical"}):O==="warning"?K.jsx(Dr,{color:"warning",icon:K.jsx(ZZ,{}),children:"Warning"}):K.jsx(Dr,{color:"processing",icon:K.jsx(MZ,{}),children:"Suggestion"});return K.jsxs(K.Fragment,{children:[K.jsx("div",{className:"page-header",children:K.jsxs("div",{children:[K.jsx(Jr,{type:"secondary",children:"CODE QUALITY"}),K.jsx(NJ,{level:2,children:"PR Review"}),K.jsx(IJ,{type:"secondary",children:"Analyze pull requests on Bitbucket for quality issues, leaks, and debug flags."})]})}),!r&&K.jsx(XO,{className:"service-config",message:"Bitbucket Token Required",description:K.jsxs("span",{children:["Please configure your ",K.jsx("strong",{children:"Bitbucket Access Token"})," in the ",K.jsx("a",{href:"#/settings",children:"Settings"})," page to review internal PRs."]}),type:"warning",showIcon:!0,closable:!1}),K.jsx(_r,{className:"service-config",children:K.jsx(Pn,{form:e,layout:"vertical",onFinish:$,children:K.jsx(Pn.Item,{name:"prLink",label:"Pull Request URL",rules:[{required:!0,message:"Please enter a Bitbucket Pull Request link."},{type:"url",message:"Please enter a valid URL."}],children:K.jsx(Ma,{placeholder:"https://bitbucket.xxx.com/projects/PROJ/repos/repo/pull-requests/123",disabled:t,allowClear:!0,addonAfter:K.jsx(en,{type:"link",size:"small",onClick:()=>e.submit(),disabled:t,style:{padding:0,height:"auto"},children:"Review"})})})})}),t&&K.jsx(_r,{style:{textAlign:"center",padding:"40px 0"},children:K.jsxs(Yn,{direction:"vertical",size:"middle",children:[K.jsx(fo,{style:{fontSize:32,color:"#6d5ce7"},spin:!0}),K.jsx(Jr,{type:"secondary",children:"Fetching diffs and reviewing code changes..."})]})}),!l&&!t&&r&&K.jsx(_r,{tabList:[{key:"review",tab:`Waiting for my Review (${g.length})`},{key:"mine",tab:`Authored by Me (${m.length})`}],activeTabKey:S,onTabChange:y,loading:b,style:{borderColor:"#e3e6ef",marginTop:16},children:S==="review"?K.jsx(N2,{prs:g,onSelectPr:$}):K.jsx(N2,{prs:m,onSelectPr:$})}),l&&K.jsxs(Yn,{direction:"vertical",size:"large",style:{width:"100%",paddingBottom:24},children:[K.jsx("div",{children:K.jsx(en,{onClick:()=>c(null),children:"← Back to PR list"})}),K.jsx(_r,{title:K.jsxs(Yn,{children:[K.jsx(x3,{}),K.jsx("span",{children:l.pr.title})]}),extra:K.jsx(en,{icon:K.jsx(od,{}),onClick:w,children:u?"Copied":"Copy Report"}),children:K.jsxs(vm,{gutter:[16,16],children:[K.jsxs(oa,{xs:24,sm:12,md:6,children:[K.jsx(Jr,{type:"secondary",block:!0,children:"Author"}),K.jsx(Jr,{strong:!0,children:l.pr.author})]}),K.jsxs(oa,{xs:24,sm:12,md:6,children:[K.jsx(Jr,{type:"secondary",block:!0,children:"Repository"}),K.jsx(Jr,{strong:!0,children:l.pr.repositorySlug})]}),K.jsxs(oa,{xs:24,sm:12,md:6,children:[K.jsx(Jr,{type:"secondary",block:!0,children:"Source Branch"}),K.jsx(Dr,{color:"cyan",children:l.pr.sourceBranch})]}),K.jsxs(oa,{xs:24,sm:12,md:6,children:[K.jsx(Jr,{type:"secondary",block:!0,children:"Target Branch"}),K.jsx(Dr,{color:"blue",children:l.pr.targetBranch})]})]})}),K.jsxs(vm,{gutter:[16,16],children:[K.jsx(oa,{xs:12,md:6,children:K.jsx(_r,{size:"small",style:{textAlign:"center"},children:K.jsx(yl,{title:"Total Changed",value:l.stats.totalFilesChanged})})}),K.jsx(oa,{xs:12,md:6,children:K.jsx(_r,{size:"small",style:{textAlign:"center"},children:K.jsx(yl,{title:"Filtered (Ignored)",value:l.stats.filteredCount,valueStyle:{color:"#8c8c8c"}})})}),K.jsx(oa,{xs:12,md:6,children:K.jsx(_r,{size:"small",style:{textAlign:"center"},children:K.jsx(yl,{title:"Reviewed Files",value:l.stats.reviewedCount,valueStyle:{color:"#6d5ce7"}})})}),K.jsx(oa,{xs:12,md:6,children:K.jsx(_r,{size:"small",style:{textAlign:"center"},children:K.jsx(yl,{title:"Total Issues",value:l.stats.totalIssues,valueStyle:{color:l.stats.totalIssues>0?"#ff4d4f":"#52c41a"}})})})]}),K.jsx(_r,{title:"Review Findings",children:l.files.length===0?K.jsx(Nr,{image:Nr.PRESENTED_IMAGE_SIMPLE,description:K.jsxs(Yn,{direction:"vertical",size:"small",children:[K.jsxs(Jr,{strong:!0,style:{color:"#52c41a",fontSize:"16px"},children:[K.jsx(gZ,{})," LGTM! No issues found."]}),K.jsxs(Jr,{type:"secondary",children:["Review completed on ",l.stats.reviewedCount," files (filtered out ",l.stats.filteredCount," build/test configs)."]})]})}):K.jsx(im,{defaultActiveKey:l.files.map(O=>O.filePath),expandIconPosition:"end",children:l.files.map(O=>{const I=O.issues.filter(P=>P.severity==="critical").length,T=O.issues.filter(P=>P.severity==="warning").length,j=O.issues.filter(P=>P.severity==="info").length,M=K.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"92%",flexWrap:"wrap",gap:"8px"},children:[K.jsx(Jr,{strong:!0,children:O.filePath}),K.jsxs(Yn,{children:[I>0&&K.jsx(zi,{count:I,style:{backgroundColor:"#ff4d4f"},title:"Critical Issues"}),T>0&&K.jsx(zi,{count:T,style:{backgroundColor:"#faad14"},title:"Warnings"}),j>0&&K.jsx(zi,{count:j,style:{backgroundColor:"#1890ff"},title:"Suggestions"})]})]});return K.jsx(im.Panel,{header:M,children:K.jsx(Pa,{dataSource:O.issues.map((P,z)=>({...P,key:z})),pagination:!1,size:"small",columns:[{title:"Severity",dataIndex:"severity",width:120,render:P=>R(P)},{title:"Line",dataIndex:"line",width:80,render:P=>K.jsxs(Jr,{code:!0,children:["L",P]})},{title:"Issue Description",dataIndex:"message",render:(P,z)=>K.jsxs(Yn,{direction:"vertical",size:2,style:{width:"100%"},children:[K.jsx(Jr,{strong:!0,children:z.rule}),K.jsx(Jr,{type:"secondary",children:P}),K.jsx("pre",{style:{margin:"4px 0 0",padding:"6px 10px",background:"#f5f5f5",borderRadius:"4px",fontSize:"12px",overflowX:"auto"},children:K.jsx("code",{children:z.code})})]})}]})},O.filePath)})})}),l.filteredOut.length>0&&K.jsx(_r,{title:`Ignored Files (${l.filteredOut.length})`,size:"small",children:K.jsx("div",{style:{maxHeight:200,overflowY:"auto"},children:K.jsx(Yn,{size:[4,8],wrap:!0,children:l.filteredOut.map(O=>K.jsx(Dr,{style:{color:"#8c8c8c"},children:O},O))})})})]})]})}const{Title:MJ}=ca,jJ=()=>{const n=(window.location.hash||"").slice(2).split("/");if(n[0]==="logs"){const r=n[1]||"",a=n[2]==="pkg",l=a?n[3]:n[2];return{launcherId:r,isPackage:a,scriptIdOrName:l}}return{launcherId:null,isPackage:!1,scriptIdOrName:null}};function PJ(){const{launcherId:e,isPackage:t,scriptIdOrName:n}=jJ(),[r,a]=s.useState("output"),[l,c]=s.useState(""),[u,f]=s.useState(!0),m=s.useRef(null);s.useEffect(()=>(document.title=`${n||"Logs"} · DevBuddy`,()=>{document.title="DevBuddy · Workbench"}),[n]),s.useEffect(()=>{if(!e||!n)return;const g=async()=>{try{const b=t?r==="error"?await Rr.packageScriptErrorLogs(e,n):await Rr.packageScriptLogs(e,n):r==="error"?await Rr.errorLogs(e,n):await Rr.logs(e,n);c(b.log||(r==="error"?"No error logs yet.":"No logs yet."))}catch(b){c(b.message)}finally{f(!1)}};g();const h=setInterval(g,1e3);return()=>clearInterval(h)},[e,t,n,r]),s.useEffect(()=>{if(m.current){const g=m.current.querySelector(".log-output");g&&(g.scrollTop=g.scrollHeight)}},[l]);const v=()=>{window.close()};return!e||!n?K.jsx("div",{className:"standalone-log-container",style:{display:"grid",placeItems:"center",height:"100vh",background:"#111827",color:"#ef4444"},children:K.jsx("div",{children:"Invalid log target specified in URL."})}):K.jsxs("div",{className:"standalone-log-container",ref:m,children:[K.jsxs("header",{className:"standalone-log-header",children:[K.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[K.jsxs(MJ,{level:4,style:{margin:0,color:"#f3f4f6",fontSize:16},children:[e," ",K.jsx("span",{style:{color:"#9ca3af",fontWeight:"normal"},children:"/"})," ",n]}),u&&K.jsx(fv,{size:"small"})]}),K.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[K.jsxs(_i.Group,{value:r,onChange:g=>a(g.target.value),size:"small",buttonStyle:"solid",children:[K.jsx(_i.Button,{value:"output",children:"Output"}),K.jsx(_i.Button,{value:"error",children:"Errors"})]}),K.jsx(en,{type:"text",icon:K.jsx(go,{}),onClick:v,style:{color:"#9ca3af"},title:"Close Tab"})]})]}),K.jsx("div",{className:"standalone-log-body",children:K.jsx(ib,{value:l,className:"standalone-log-output"})})]})}const{Content:zJ,Sider:_J}=ki,{Title:DJ,Text:AJ}=ca,BJ=()=>{const t=(window.location.hash||"#/launcher").slice(2);return t.startsWith("plugin:")?{page:"plugin",pluginId:t.slice(7)}:t.startsWith("logs/")?{page:"logs",pluginId:null}:["launcher","clipboard","ports","image-compress","pr-review","settings"].includes(t)?{page:t,pluginId:null}:{page:"launcher",pluginId:null}};function LJ(){const{message:e}=Pl.useApp(),t=BJ(),[n,r]=s.useState([]),[a,l]=s.useState(new Set),[c,u]=s.useState([]),[f,m]=s.useState(t.page),[v,g]=s.useState(t.pluginId?{id:t.pluginId,name:"Plugin"}:null),[h,b]=s.useState(""),C=async()=>{try{const[$,w]=await Promise.all([Rr.list(),Rr.running()]);r($),l(new Set(w))}catch($){e.error($.message)}},S=async $=>{if($){b("Loading plugin…");try{b($.view?await(await fetch($.view)).text():"This plugin does not provide a view yet.")}catch{b("Failed to load the plugin view.")}}};s.useEffect(()=>{Promise.all([C(),JZ.list().then(u)]).catch($=>e.error($.message))},[]),s.useEffect(()=>{const $=()=>{const R=(window.location.hash||"#/launcher").slice(2);if(R.startsWith("plugin:")){const O=R.slice(7),I=c.find(T=>T.id===O);I?(m("plugin"),g(I),S(I)):c.length>0&&(window.location.hash="#/launcher")}else R.startsWith("logs/")?(g(null),m("logs")):["launcher","clipboard","ports","image-compress","pr-review","settings"].includes(R)?(g(null),m(R)):window.location.hash="#/launcher"};return window.addEventListener("hashchange",$),c.length>0||window.location.hash?$():window.location.hash="#/launcher",()=>window.removeEventListener("hashchange",$)},[c]),s.useEffect(()=>{if(f!=="launcher"&&f!=="ports")return;const $=setInterval(C,2e3);return()=>clearInterval($)},[f]);const y=s.useMemo(()=>[{key:"launcher",icon:K.jsx(ab,{}),label:"Launcher"},{key:"ports",icon:K.jsx(XZ,{}),label:"Port Diagnostic"},{key:"image-compress",icon:K.jsx(rb,{}),label:"Image compression"},{key:"clipboard",icon:K.jsx(od,{}),label:"Clipboard history"},{key:"pr-review",icon:K.jsx(x3,{}),label:"PR Review"}],[c]),x=({key:$})=>{window.location.hash=`#/${$}`};return f==="logs"?K.jsx(PJ,{}):K.jsxs(ki,{className:"workbench",children:[K.jsxs(_J,{className:"sidebar",width:240,children:[K.jsxs("div",{className:"brand",children:[K.jsx("span",{children:"✦"})," DevBuddy ",K.jsx("span",{style:{fontSize:"11px",fontWeight:"400",color:"#727b94",marginLeft:"6px",letterSpacing:"normal",verticalAlign:"middle"},children:"v0.1.3"})]}),K.jsx(Hi,{theme:"dark",mode:"inline",selectedKeys:[v?`plugin:${v.id}`:f],items:y,onClick:x}),K.jsxs("div",{className:"sidebar-bottom",children:[K.jsx(Hi,{theme:"dark",mode:"inline",selectedKeys:v?[]:[f],items:[{key:"settings",icon:K.jsx(KZ,{}),label:"Settings"}],onClick:x}),K.jsx("div",{className:"sidebar-footer",children:"Local Workbench"})]})]}),K.jsx(ki,{children:K.jsx(zJ,{className:"page",children:v?K.jsxs(K.Fragment,{children:[K.jsx(AJ,{type:"secondary",children:"PLUGIN"}),K.jsx(DJ,{level:2,children:v.name}),K.jsx(_r,{children:K.jsx("div",{dangerouslySetInnerHTML:{__html:h}})})]}):f==="image-compress"?K.jsx(RJ,{}):f==="clipboard"?K.jsx(rJ,{}):f==="ports"?K.jsx(hJ,{refreshLaunchers:C}):f==="pr-review"?K.jsx(TJ,{}):f==="settings"?K.jsx(yJ,{}):K.jsx(vJ,{launchers:n,running:a,refresh:C})})})]})}function HJ(){return K.jsx(Pl,{children:K.jsx(LJ,{})})}PM.createRoot(document.getElementById("app")).render(K.jsx(se.StrictMode,{children:K.jsx(HJ,{})}));
496
+ `}}navigator.clipboard.writeText(j),f(!0),Ta.success("Markdown report copied to clipboard."),setTimeout(()=>f(!1),2e3)},R=O=>O==="critical"?K.jsx(Dr,{color:"error",icon:K.jsx(CZ,{}),children:"Critical"}):O==="warning"?K.jsx(Dr,{color:"warning",icon:K.jsx(ZZ,{}),children:"Warning"}):K.jsx(Dr,{color:"processing",icon:K.jsx(MZ,{}),children:"Suggestion"});return K.jsxs(K.Fragment,{children:[K.jsx("div",{className:"page-header",children:K.jsxs("div",{children:[K.jsx(Jr,{type:"secondary",children:"CODE QUALITY"}),K.jsx(NJ,{level:2,children:"PR Review"}),K.jsx(IJ,{type:"secondary",children:"Analyze pull requests on Bitbucket for quality issues, leaks, and debug flags."})]})}),!r&&K.jsx(XO,{className:"service-config",message:"Bitbucket Token Required",description:K.jsxs("span",{children:["Please configure your ",K.jsx("strong",{children:"Bitbucket Access Token"})," in the ",K.jsx("a",{href:"#/settings",children:"Settings"})," page to review internal PRs."]}),type:"warning",showIcon:!0,closable:!1}),K.jsx(_r,{className:"service-config",children:K.jsx(Pn,{form:e,layout:"vertical",onFinish:$,children:K.jsx(Pn.Item,{name:"prLink",label:"Pull Request URL",rules:[{required:!0,message:"Please enter a Bitbucket Pull Request link."},{type:"url",message:"Please enter a valid URL."}],children:K.jsx(Ma,{placeholder:"https://bitbucket.xxx.com/projects/PROJ/repos/repo/pull-requests/123",disabled:t,allowClear:!0,addonAfter:K.jsx(en,{type:"link",size:"small",onClick:()=>e.submit(),disabled:t,style:{padding:0,height:"auto"},children:"Review"})})})})}),t&&K.jsx(_r,{style:{textAlign:"center",padding:"40px 0"},children:K.jsxs(Yn,{direction:"vertical",size:"middle",children:[K.jsx(fo,{style:{fontSize:32,color:"#6d5ce7"},spin:!0}),K.jsx(Jr,{type:"secondary",children:"Fetching diffs and reviewing code changes..."})]})}),!l&&!t&&r&&K.jsx(_r,{tabList:[{key:"review",tab:`Waiting for my Review (${g.length})`},{key:"mine",tab:`Authored by Me (${m.length})`}],activeTabKey:S,onTabChange:y,loading:b,style:{borderColor:"#e3e6ef",marginTop:16},children:S==="review"?K.jsx(N2,{prs:g,onSelectPr:$}):K.jsx(N2,{prs:m,onSelectPr:$})}),l&&K.jsxs(Yn,{direction:"vertical",size:"large",style:{width:"100%",paddingBottom:24},children:[K.jsx("div",{children:K.jsx(en,{onClick:()=>c(null),children:"← Back to PR list"})}),K.jsx(_r,{title:K.jsxs(Yn,{children:[K.jsx(x3,{}),K.jsx("span",{children:l.pr.title})]}),extra:K.jsx(en,{icon:K.jsx(od,{}),onClick:w,children:u?"Copied":"Copy Report"}),children:K.jsxs(vm,{gutter:[16,16],children:[K.jsxs(oa,{xs:24,sm:12,md:6,children:[K.jsx(Jr,{type:"secondary",block:!0,children:"Author"}),K.jsx(Jr,{strong:!0,children:l.pr.author})]}),K.jsxs(oa,{xs:24,sm:12,md:6,children:[K.jsx(Jr,{type:"secondary",block:!0,children:"Repository"}),K.jsx(Jr,{strong:!0,children:l.pr.repositorySlug})]}),K.jsxs(oa,{xs:24,sm:12,md:6,children:[K.jsx(Jr,{type:"secondary",block:!0,children:"Source Branch"}),K.jsx(Dr,{color:"cyan",children:l.pr.sourceBranch})]}),K.jsxs(oa,{xs:24,sm:12,md:6,children:[K.jsx(Jr,{type:"secondary",block:!0,children:"Target Branch"}),K.jsx(Dr,{color:"blue",children:l.pr.targetBranch})]})]})}),K.jsxs(vm,{gutter:[16,16],children:[K.jsx(oa,{xs:12,md:6,children:K.jsx(_r,{size:"small",style:{textAlign:"center"},children:K.jsx(yl,{title:"Total Changed",value:l.stats.totalFilesChanged})})}),K.jsx(oa,{xs:12,md:6,children:K.jsx(_r,{size:"small",style:{textAlign:"center"},children:K.jsx(yl,{title:"Filtered (Ignored)",value:l.stats.filteredCount,valueStyle:{color:"#8c8c8c"}})})}),K.jsx(oa,{xs:12,md:6,children:K.jsx(_r,{size:"small",style:{textAlign:"center"},children:K.jsx(yl,{title:"Reviewed Files",value:l.stats.reviewedCount,valueStyle:{color:"#6d5ce7"}})})}),K.jsx(oa,{xs:12,md:6,children:K.jsx(_r,{size:"small",style:{textAlign:"center"},children:K.jsx(yl,{title:"Total Issues",value:l.stats.totalIssues,valueStyle:{color:l.stats.totalIssues>0?"#ff4d4f":"#52c41a"}})})})]}),K.jsx(_r,{title:"Review Findings",children:l.files.length===0?K.jsx(Nr,{image:Nr.PRESENTED_IMAGE_SIMPLE,description:K.jsxs(Yn,{direction:"vertical",size:"small",children:[K.jsxs(Jr,{strong:!0,style:{color:"#52c41a",fontSize:"16px"},children:[K.jsx(gZ,{})," LGTM! No issues found."]}),K.jsxs(Jr,{type:"secondary",children:["Review completed on ",l.stats.reviewedCount," files (filtered out ",l.stats.filteredCount," build/test configs)."]})]})}):K.jsx(im,{defaultActiveKey:l.files.map(O=>O.filePath),expandIconPosition:"end",children:l.files.map(O=>{const I=O.issues.filter(P=>P.severity==="critical").length,T=O.issues.filter(P=>P.severity==="warning").length,j=O.issues.filter(P=>P.severity==="info").length,M=K.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"92%",flexWrap:"wrap",gap:"8px"},children:[K.jsx(Jr,{strong:!0,children:O.filePath}),K.jsxs(Yn,{children:[I>0&&K.jsx(zi,{count:I,style:{backgroundColor:"#ff4d4f"},title:"Critical Issues"}),T>0&&K.jsx(zi,{count:T,style:{backgroundColor:"#faad14"},title:"Warnings"}),j>0&&K.jsx(zi,{count:j,style:{backgroundColor:"#1890ff"},title:"Suggestions"})]})]});return K.jsx(im.Panel,{header:M,children:K.jsx(Pa,{dataSource:O.issues.map((P,z)=>({...P,key:z})),pagination:!1,size:"small",columns:[{title:"Severity",dataIndex:"severity",width:120,render:P=>R(P)},{title:"Line",dataIndex:"line",width:80,render:P=>K.jsxs(Jr,{code:!0,children:["L",P]})},{title:"Issue Description",dataIndex:"message",render:(P,z)=>K.jsxs(Yn,{direction:"vertical",size:2,style:{width:"100%"},children:[K.jsx(Jr,{strong:!0,children:z.rule}),K.jsx(Jr,{type:"secondary",children:P}),K.jsx("pre",{style:{margin:"4px 0 0",padding:"6px 10px",background:"#f5f5f5",borderRadius:"4px",fontSize:"12px",overflowX:"auto"},children:K.jsx("code",{children:z.code})})]})}]})},O.filePath)})})}),l.filteredOut.length>0&&K.jsx(_r,{title:`Ignored Files (${l.filteredOut.length})`,size:"small",children:K.jsx("div",{style:{maxHeight:200,overflowY:"auto"},children:K.jsx(Yn,{size:[4,8],wrap:!0,children:l.filteredOut.map(O=>K.jsx(Dr,{style:{color:"#8c8c8c"},children:O},O))})})})]})]})}const{Title:MJ}=ca,jJ=()=>{const n=(window.location.hash||"").slice(2).split("/");if(n[0]==="logs"){const r=n[1]||"",a=n[2]==="pkg",l=a?n[3]:n[2];return{launcherId:r,isPackage:a,scriptIdOrName:l}}return{launcherId:null,isPackage:!1,scriptIdOrName:null}};function PJ(){const{launcherId:e,isPackage:t,scriptIdOrName:n}=jJ(),[r,a]=s.useState("output"),[l,c]=s.useState(""),[u,f]=s.useState(!0),m=s.useRef(null);s.useEffect(()=>(document.title=`${n||"Logs"} · DevBuddy`,()=>{document.title="DevBuddy · Workbench"}),[n]),s.useEffect(()=>{if(!e||!n)return;const g=async()=>{try{const b=t?r==="error"?await Rr.packageScriptErrorLogs(e,n):await Rr.packageScriptLogs(e,n):r==="error"?await Rr.errorLogs(e,n):await Rr.logs(e,n);c(b.log||(r==="error"?"No error logs yet.":"No logs yet."))}catch(b){c(b.message)}finally{f(!1)}};g();const h=setInterval(g,1e3);return()=>clearInterval(h)},[e,t,n,r]),s.useEffect(()=>{if(m.current){const g=m.current.querySelector(".log-output");g&&(g.scrollTop=g.scrollHeight)}},[l]);const v=()=>{window.close()};return!e||!n?K.jsx("div",{className:"standalone-log-container",style:{display:"grid",placeItems:"center",height:"100vh",background:"#111827",color:"#ef4444"},children:K.jsx("div",{children:"Invalid log target specified in URL."})}):K.jsxs("div",{className:"standalone-log-container",ref:m,children:[K.jsxs("header",{className:"standalone-log-header",children:[K.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[K.jsxs(MJ,{level:4,style:{margin:0,color:"#f3f4f6",fontSize:16},children:[e," ",K.jsx("span",{style:{color:"#9ca3af",fontWeight:"normal"},children:"/"})," ",n]}),u&&K.jsx(fv,{size:"small"})]}),K.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[K.jsxs(_i.Group,{value:r,onChange:g=>a(g.target.value),size:"small",buttonStyle:"solid",children:[K.jsx(_i.Button,{value:"output",children:"Output"}),K.jsx(_i.Button,{value:"error",children:"Errors"})]}),K.jsx(en,{type:"text",icon:K.jsx(go,{}),onClick:v,style:{color:"#9ca3af"},title:"Close Tab"})]})]}),K.jsx("div",{className:"standalone-log-body",children:K.jsx(ib,{value:l,className:"standalone-log-output"})})]})}const{Content:zJ,Sider:_J}=ki,{Title:DJ,Text:AJ}=ca,BJ=()=>{const t=(window.location.hash||"#/launcher").slice(2);return t.startsWith("plugin:")?{page:"plugin",pluginId:t.slice(7)}:t.startsWith("logs/")?{page:"logs",pluginId:null}:["launcher","clipboard","ports","image-compress","pr-review","settings"].includes(t)?{page:t,pluginId:null}:{page:"launcher",pluginId:null}};function LJ(){const{message:e}=Pl.useApp(),t=BJ(),[n,r]=s.useState([]),[a,l]=s.useState(new Set),[c,u]=s.useState([]),[f,m]=s.useState(t.page),[v,g]=s.useState(t.pluginId?{id:t.pluginId,name:"Plugin"}:null),[h,b]=s.useState(""),C=async()=>{try{const[$,w]=await Promise.all([Rr.list(),Rr.running()]);r($),l(new Set(w))}catch($){e.error($.message)}},S=async $=>{if($){b("Loading plugin…");try{b($.view?await(await fetch($.view)).text():"This plugin does not provide a view yet.")}catch{b("Failed to load the plugin view.")}}};s.useEffect(()=>{Promise.all([C(),JZ.list().then(u)]).catch($=>e.error($.message))},[]),s.useEffect(()=>{const $=()=>{const R=(window.location.hash||"#/launcher").slice(2);if(R.startsWith("plugin:")){const O=R.slice(7),I=c.find(T=>T.id===O);I?(m("plugin"),g(I),S(I)):c.length>0&&(window.location.hash="#/launcher")}else R.startsWith("logs/")?(g(null),m("logs")):["launcher","clipboard","ports","image-compress","pr-review","settings"].includes(R)?(g(null),m(R)):window.location.hash="#/launcher"};return window.addEventListener("hashchange",$),c.length>0||window.location.hash?$():window.location.hash="#/launcher",()=>window.removeEventListener("hashchange",$)},[c]),s.useEffect(()=>{if(f!=="launcher"&&f!=="ports")return;const $=setInterval(C,2e3);return()=>clearInterval($)},[f]);const y=s.useMemo(()=>[{key:"launcher",icon:K.jsx(ab,{}),label:"Launcher"},{key:"ports",icon:K.jsx(XZ,{}),label:"Port Diagnostic"},{key:"image-compress",icon:K.jsx(rb,{}),label:"Image compression"},{key:"clipboard",icon:K.jsx(od,{}),label:"Clipboard history"},{key:"pr-review",icon:K.jsx(x3,{}),label:"PR Review"}],[c]),x=({key:$})=>{window.location.hash=`#/${$}`};return f==="logs"?K.jsx(PJ,{}):K.jsxs(ki,{className:"workbench",children:[K.jsxs(_J,{className:"sidebar",width:240,children:[K.jsxs("div",{className:"brand",children:[K.jsx("span",{children:"✦"})," DevBuddy ",K.jsx("span",{style:{fontSize:"11px",fontWeight:"400",color:"#727b94",marginLeft:"6px",letterSpacing:"normal",verticalAlign:"middle"},children:"v0.1.4"})]}),K.jsx(Hi,{theme:"dark",mode:"inline",selectedKeys:[v?`plugin:${v.id}`:f],items:y,onClick:x}),K.jsxs("div",{className:"sidebar-bottom",children:[K.jsx(Hi,{theme:"dark",mode:"inline",selectedKeys:v?[]:[f],items:[{key:"settings",icon:K.jsx(KZ,{}),label:"Settings"}],onClick:x}),K.jsx("div",{className:"sidebar-footer",children:"Local Workbench"})]})]}),K.jsx(ki,{children:K.jsx(zJ,{className:"page",children:v?K.jsxs(K.Fragment,{children:[K.jsx(AJ,{type:"secondary",children:"PLUGIN"}),K.jsx(DJ,{level:2,children:v.name}),K.jsx(_r,{children:K.jsx("div",{dangerouslySetInnerHTML:{__html:h}})})]}):f==="image-compress"?K.jsx(RJ,{}):f==="clipboard"?K.jsx(rJ,{}):f==="ports"?K.jsx(hJ,{refreshLaunchers:C}):f==="pr-review"?K.jsx(TJ,{}):f==="settings"?K.jsx(yJ,{}):K.jsx(vJ,{launchers:n,running:a,refresh:C})})})]})}function HJ(){return K.jsx(Pl,{children:K.jsx(LJ,{})})}PM.createRoot(document.getElementById("app")).render(K.jsx(se.StrictMode,{children:K.jsx(HJ,{})}));
@@ -9,7 +9,7 @@
9
9
  <link rel="apple-touch-icon" href="/devbuddy-180.png" />
10
10
  <link rel="manifest" href="/manifest.webmanifest" />
11
11
  <title>DevBuddy · Workbench</title>
12
- <script type="module" crossorigin src="/assets/index-BFypDx9r.js"></script>
12
+ <script type="module" crossorigin src="/assets/index-C8lzzaPq.js"></script>
13
13
  <link rel="stylesheet" crossorigin href="/assets/index-d11DtBlK.css">
14
14
  </head>
15
15
  <body>