4 lines
29 KiB
JavaScript
4 lines
29 KiB
JavaScript
import{aF as je,c as i,A as ee,t as X,v as E,C as Ye,I as Y,k as he,q as Xe,c9 as Ee,ca as Ge,bY as ye,ac as ae,ae as R,cb as Ke,r as Q,cc as Je,B as $e,a8 as G,cd as Qe,ce as Ze,Q as S,a7 as Re,cf as pe,H as se,cg as et,E as me,ch as tt,ci as nt,c8 as at,cj as lt,ck as st,o as ot,d as We,V as Be,cl as rt,z as Z,K as Se,cm as xe,l as Ce,L as O,N as x,O as I,Y as y,W as oe,X as h,cn as it,T as U,S as J,R as k,a1 as ce,a9 as Me,a0 as ut,$ as ct,Z as dt,af as vt,co as ft,M as pt,cp as mt,cq as gt,aw as ht,ax as yt,U as He}from"./index-ea35fc22.js";import{u as ue,e as ge,g as B,f as Pe,h as ie,r as _t,t as de,i as wt,s as ve,j as re,_ as bt}from"./FileItem-2d52fcd1.js";import{M as Ve,c as kt,m as Ue,l as Ie,b as Ot,d as Lt}from"./functionalCallableComp-fd82f4ba.js";import{C as Et,g as $t}from"./shortcut-7906f123.js";import{D as St}from"./index-00968932.js";/* empty css */const le=(...e)=>{document.addEventListener(...e),je(()=>document.removeEventListener(...e))};var xt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 000 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0013.5-4.7L863.9 169a7.9 7.9 0 00-8.9-8.9zM416.6 562.3a8.03 8.03 0 00-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 00-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z"}}]},name:"arrows-alt",theme:"outlined"};const Ct=xt;function Fe(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(a).filter(function(s){return Object.getOwnPropertyDescriptor(a,s).enumerable}))),n.forEach(function(s){Mt(e,s,a[s])})}return e}function Mt(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var _e=function(t,a){var n=Fe({},t,a.attrs);return i(ee,Fe({},n,{icon:Ct}),null)};_e.displayName="ArrowsAltOutlined";_e.inheritAttrs=!1;const Pt=_e;var It={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.3 506.3L781.7 405.6a7.23 7.23 0 00-11.7 5.7V476H548V254h64.8c6 0 9.4-7 5.7-11.7L517.7 114.7a7.14 7.14 0 00-11.3 0L405.6 242.3a7.23 7.23 0 005.7 11.7H476v222H254v-64.8c0-6-7-9.4-11.7-5.7L114.7 506.3a7.14 7.14 0 000 11.3l127.5 100.8c4.7 3.7 11.7.4 11.7-5.7V548h222v222h-64.8c-6 0-9.4 7-5.7 11.7l100.8 127.5c2.9 3.7 8.5 3.7 11.3 0l100.8-127.5c3.7-4.7.4-11.7-5.7-11.7H548V548h222v64.8c0 6 7 9.4 11.7 5.7l127.5-100.8a7.3 7.3 0 00.1-11.4z"}}]},name:"drag",theme:"outlined"};const Ft=It;function De(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(a).filter(function(s){return Object.getOwnPropertyDescriptor(a,s).enumerable}))),n.forEach(function(s){Dt(e,s,a[s])})}return e}function Dt(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var we=function(t,a){var n=De({},t,a.attrs);return i(ee,De({},n,{icon:Ft}),null)};we.displayName="DragOutlined";we.inheritAttrs=!1;const At=we;var Tt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M391 240.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L200 146.3a8.03 8.03 0 00-11.3 0l-42.4 42.3a8.03 8.03 0 000 11.3L280 333.6l-43.9 43.9a8.01 8.01 0 004.7 13.6L401 410c5.1.6 9.5-3.7 8.9-8.9L391 240.9zm10.1 373.2L240.8 633c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L146.3 824a8.03 8.03 0 000 11.3l42.4 42.3c3.1 3.1 8.2 3.1 11.3 0L333.7 744l43.7 43.7A8.01 8.01 0 00391 783l18.9-160.1c.6-5.1-3.7-9.4-8.8-8.8zm221.8-204.2L783.2 391c6.6-.8 9.4-8.9 4.7-13.6L744 333.6 877.7 200c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.3a8.03 8.03 0 00-11.3 0L690.3 279.9l-43.7-43.7a8.01 8.01 0 00-13.6 4.7L614.1 401c-.6 5.2 3.7 9.5 8.8 8.9zM744 690.4l43.9-43.9a8.01 8.01 0 00-4.7-13.6L623 614c-5.1-.6-9.5 3.7-8.9 8.9L633 783.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L824 877.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L744 690.4z"}}]},name:"fullscreen-exit",theme:"outlined"};const zt=Tt;function Ae(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(a).filter(function(s){return Object.getOwnPropertyDescriptor(a,s).enumerable}))),n.forEach(function(s){Nt(e,s,a[s])})}return e}function Nt(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var be=function(t,a){var n=Ae({},t,a.attrs);return i(ee,Ae({},n,{icon:zt}),null)};be.displayName="FullscreenExitOutlined";be.inheritAttrs=!1;const jt=be;var Wt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M290 236.4l43.9-43.9a8.01 8.01 0 00-4.7-13.6L169 160c-5.1-.6-9.5 3.7-8.9 8.9L179 329.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L370 423.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L290 236.4zm352.7 187.3c3.1 3.1 8.2 3.1 11.3 0l133.7-133.6 43.7 43.7a8.01 8.01 0 0013.6-4.7L863.9 169c.6-5.1-3.7-9.5-8.9-8.9L694.8 179c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L600.3 370a8.03 8.03 0 000 11.3l42.4 42.4zM845 694.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L654 600.3a8.03 8.03 0 00-11.3 0l-42.4 42.3a8.03 8.03 0 000 11.3L734 787.6l-43.9 43.9a8.01 8.01 0 004.7 13.6L855 864c5.1.6 9.5-3.7 8.9-8.9L845 694.9zm-463.7-94.6a8.03 8.03 0 00-11.3 0L236.3 733.9l-43.7-43.7a8.01 8.01 0 00-13.6 4.7L160.1 855c-.6 5.1 3.7 9.5 8.9 8.9L329.2 845c6.6-.8 9.4-8.9 4.7-13.6L290 787.6 423.7 654c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.4z"}}]},name:"fullscreen",theme:"outlined"};const Bt=Wt;function Te(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(a).filter(function(s){return Object.getOwnPropertyDescriptor(a,s).enumerable}))),n.forEach(function(s){Ht(e,s,a[s])})}return e}function Ht(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var ke=function(t,a){var n=Te({},t,a.attrs);return i(ee,Te({},n,{icon:Bt}),null)};ke.displayName="FullscreenOutlined";ke.inheritAttrs=!1;const Vt=ke;var Ut={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M603.3 327.5l-246 178a7.95 7.95 0 000 12.9l246 178c5.3 3.8 12.7 0 12.7-6.5V643c0-10.2-4.9-19.9-13.2-25.9L457.4 512l145.4-105.2c8.3-6 13.2-15.6 13.2-25.9V334c0-6.5-7.4-10.3-12.7-6.5z"}},{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:"left-circle",theme:"outlined"};const qt=Ut;function ze(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(a).filter(function(s){return Object.getOwnPropertyDescriptor(a,s).enumerable}))),n.forEach(function(s){Yt(e,s,a[s])})}return e}function Yt(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var Oe=function(t,a){var n=ze({},t,a.attrs);return i(ee,ze({},n,{icon:qt}),null)};Oe.displayName="LeftCircleOutlined";Oe.inheritAttrs=!1;const Dn=Oe;var Xt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M666.7 505.5l-246-178A8 8 0 00408 334v46.9c0 10.2 4.9 19.9 13.2 25.9L566.6 512 421.2 617.2c-8.3 6-13.2 15.6-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.5l246-178c4.4-3.2 4.4-9.8 0-13z"}},{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:"right-circle",theme:"outlined"};const Gt=Xt;function Ne(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(a).filter(function(s){return Object.getOwnPropertyDescriptor(a,s).enumerable}))),n.forEach(function(s){Kt(e,s,a[s])})}return e}function Kt(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var Le=function(t,a){var n=Ne({},t,a.attrs);return i(ee,Ne({},n,{icon:Gt}),null)};Le.displayName="RightCircleOutlined";Le.inheritAttrs=!1;const An=Le;function Tn(){const{previewIdx:e,eventEmitter:t,canLoadNext:a,previewing:n,sortedFiles:s,scroller:g,props:$}=ue().toRefs(),{state:C}=ue();let F=null;const j=(p,d)=>{var f;n.value=p,F!=null&&!p&&d&&((f=g.value)==null||f.scrollToItem(F),F=null)},N=()=>{$.value.mode==="walk"&&!_("next")&&a&&(X.info(E("loadingNextFolder")),t.value.emit("loadNextDir",!0))};le("keydown",p=>{var d;if(n.value){let f=e.value;if(["ArrowDown","ArrowRight"].includes(p.key))for(f++;s.value[f]&&!Y(s.value[f].name);)f++;else if(["ArrowUp","ArrowLeft"].includes(p.key))for(f--;s.value[f]&&!Y(s.value[f].name);)f--;if(Y((d=s.value[f])==null?void 0:d.name)??""){e.value=f;const w=g.value;w&&!(f>=w.$_startIndex&&f<=w.$_endIndex)&&(F=f)}N()}});const M=p=>{var f;let d=e.value;if(p==="next")for(d++;s.value[d]&&!Y(s.value[d].name);)d++;else if(p==="prev")for(d--;s.value[d]&&!Y(s.value[d].name);)d--;if(Y((f=s.value[d])==null?void 0:f.name)??""){e.value=d;const w=g.value;w&&!(d>=w.$_startIndex&&d<=w.$_endIndex)&&(F=d)}N()},_=p=>{var f;let d=e.value;if(p==="next")for(d++;s.value[d]&&!Y(s.value[d].name);)d++;else if(p==="prev")for(d--;s.value[d]&&!Y(s.value[d].name);)d--;return Y((f=s.value[d])==null?void 0:f.name)??""};return ge("removeFiles",async()=>{var p;n.value&&!C.sortedFiles[e.value]&&(X.info(E("manualExitFullScreen"),5),await Ye(500),(p=document.querySelector(".ant-image-preview-operations-operation .anticon-close"))==null||p.click(),e.value=-1)}),{previewIdx:e,onPreviewVisibleChange:j,previewing:n,previewImgMove:M,canPreview:_}}function fe(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!Ke(e)}function zn(){const{currLocation:e,sortedFiles:t,currPage:a,multiSelectedIdxs:n,eventEmitter:s,walker:g}=ue().toRefs(),$=()=>{n.value=[]};return le("click",()=>{B.keepMultiSelect||$()}),le("blur",()=>{B.keepMultiSelect||$()}),he(a,$),{onFileDragStart:(N,M)=>{const _=Xe(t.value[M]);Pe.fileDragging=!0,console.log("onFileDragStart set drag file ",N,M,_);const p=[_];let d=_.type==="dir";if(n.value.includes(M)){const w=n.value.map(D=>t.value[D]);p.push(...w),d=w.some(D=>D.type==="dir")}const f={includeDir:d,loc:e.value||"search-result",path:Ee(p,"fullpath").map(w=>w.fullpath),nodes:Ee(p,"fullpath"),__id:"FileTransferData"};N.dataTransfer.setData("text/plain",JSON.stringify(f))},onDrop:async N=>{if(g.value)return;const M=Ge(N);if(!M)return;const _=e.value;if(M.loc===_)return;const p=ye(),d=async()=>p.pushAction(async()=>{await kt(M.path,_),s.value.emit("refresh"),ae.destroyAll()}),f=()=>p.pushAction(async()=>{await Ue(M.path,_),ie.emit("removeFiles",{paths:M.path,loc:M.loc}),s.value.emit("refresh"),ae.destroyAll()});ae.confirm({title:E("confirm")+"?",width:"60vw",content:()=>{let w,D,u;return i("div",null,[i("div",null,[`${E("moveSelectedFilesTo")} ${_}`,i("ol",{style:{maxHeight:"50vh",overflow:"auto"}},[M.path.map(o=>i("li",null,[o.split(/[/\\]/).pop()]))])]),i(Ve,null,null),i("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end"},class:"actions"},[i(R,{onClick:ae.destroyAll},fe(w=E("cancel"))?w:{default:()=>[w]}),i(R,{type:"primary",loading:!p.isIdle,onClick:d},fe(D=E("copy"))?D:{default:()=>[D]}),i(R,{type:"primary",loading:!p.isIdle,onClick:f},fe(u=E("move"))?u:{default:()=>[u]})])])},maskClosable:!0,wrapClassName:"hidden-antd-btns-modal"})},multiSelectedIdxs:n,onFileDragEnd:()=>{Pe.fileDragging=!1}}}function Nn({openNext:e}){const t=Q(!1),a=Q(""),{sortedFiles:n,previewIdx:s,multiSelectedIdxs:g,stack:$,currLocation:C,spinning:F,previewing:j,stackViewEl:N,eventEmitter:M,props:_,deletedFiles:p}=ue().toRefs(),d=$e;ge("removeFiles",({paths:o,loc:r})=>{d(r)!==d(C.value)||!Ie($.value)||(o.forEach(W=>p.value.add(W)),o.filter(Y).forEach(W=>p.value.add(W.replace(/\.\w+$/,".txt"))))}),ge("addFiles",({files:o,loc:r})=>{if(d(r)!==d(C.value))return;const P=Ie($.value);P&&P.files.unshift(...o)});const f=ye(),w=async(o,r,P)=>{s.value=P,B.fullscreenPreviewInitialUrl=G(r);const W=g.value.indexOf(P);if(o.shiftKey){if(W!==-1)g.value.splice(W,1);else{g.value.push(P),g.value.sort((c,A)=>c-A);const V=g.value[0],l=g.value[g.value.length-1];g.value=_t(V,l+1)}o.stopPropagation()}else o.ctrlKey||o.metaKey?(W!==-1?g.value.splice(W,1):g.value.push(P),o.stopPropagation()):await e(r)},D=async(o,r,P)=>{var b,q,ne;const W=G(r),V=C.value,l={IIB_container_id:parent.IIB_container_id},c=()=>{let v=[];return g.value.includes(P)?v=g.value.map(m=>n.value[m]):v.push(r),v},A=async v=>{if(!F.value)try{F.value=!0,await lt(r.fullpath),re.postMessage({...l,event:"click_hidden_button",btnEleId:"iib_hidden_img_update_trigger"}),await st(),re.postMessage({...l,event:"click_hidden_button",btnEleId:`iib_hidden_tab_${v}`})}catch(m){console.error(m),X.error("发送图像失败,请携带console的错误消息找开发者")}finally{F.value=!1}},T=`${o.key}`;if(T.startsWith("toggle-tag-")){const v=+T.split("toggle-tag-")[1],{is_remove:m}=await Qe({tag_id:v,img_path:r.fullpath}),H=(q=(b=B.conf)==null?void 0:b.all_custom_tags.find(z=>z.id===v))==null?void 0:q.name;await de.refreshTags([r.fullpath]),X.success(E(m?"removedTagFromImage":"addedTagToImage",{tag:H}));return}else if(T.startsWith("batch-add-tag-")||T.startsWith("batch-remove-tag-")){const v=+T.split("-tag-")[1],m=T.includes("add")?"add":"remove",H=c().map(z=>z.fullpath);await Ze({tag_id:v,img_paths:H,action:m}),await de.refreshTags(H),X.success(E(m==="add"?"addCompleted":"removeCompleted"));return}switch(o.key){case"previewInNewWindow":return window.open(W);case"saveSelectedAsJson":return at(c());case"openWithDefaultApp":return nt(r.fullpath);case"download":{const v=c();tt(v.map(m=>G(m,!0)));break}case"copyPreviewUrl":return me(parent.document.location.origin+W);case"rename":{let v=await Ot(r.fullpath);v=$e(v);const m=de.tagMap;m.set(v,m.get(r.fullpath)??[]),m.delete(r.fullpath),r.fullpath=v,r.name=v.split(/[\\/]/).pop()??"";return}case"send2txt2img":return A("txt2img");case"send2img2img":return A("img2img");case"send2inpaint":return A("inpaint");case"send2extras":return A("extras");case"send2savedDir":{const v=B.quickMovePaths.find(z=>z.key==="outdir_save");if(!v)return X.error(E("unknownSavedDir"));const m=et(v.dir,(ne=B.conf)==null?void 0:ne.sd_cwd),H=c();await Ue(H.map(z=>z.fullpath),m,!0),ie.emit("removeFiles",{paths:H.map(z=>z.fullpath),loc:C.value}),ie.emit("addFiles",{files:H,loc:m});break}case"send2controlnet-img2img":case"send2controlnet-txt2img":{const v=o.key.split("-")[1];re.postMessage({...l,event:"send_to_control_net",type:v,url:G(r)});break}case"send2outpaint":{a.value=await f.pushAction(()=>pe(r.fullpath)).res;const[v,m]=(a.value||"").split(`
|
||
`);re.postMessage({...l,event:"send_to_outpaint",url:G(r),prompt:v,negPrompt:m.slice(17)});break}case"openWithWalkMode":{ve.set(V,$.value);const v=B.tabList[_.value.tabIdx],m={type:"local",key:se(),path:r.fullpath,name:E("local"),stackKey:V,mode:"walk"};v.panes.push(m),v.key=m.key;break}case"openInNewTab":{ve.set(V,$.value);const v=B.tabList[_.value.tabIdx],m={type:"local",key:se(),path:r.fullpath,name:E("local"),stackKey:V};v.panes.push(m),v.key=m.key;break}case"openOnTheRight":{ve.set(V,$.value);let v=B.tabList[_.value.tabIdx+1];v||(v={panes:[],key:"",id:se()},B.tabList[_.value.tabIdx+1]=v);const m={type:"local",key:se(),path:r.fullpath,name:E("local"),stackKey:V};v.panes.push(m),v.key=m.key;break}case"send2BatchDownload":{wt.addFiles(c());break}case"viewGenInfo":{t.value=!0,a.value=await f.pushAction(()=>pe(r.fullpath)).res;break}case"openWithLocalFileBrowser":{await Re(r.fullpath);break}case"deleteFiles":{const v=c(),m=async()=>{const H=v.map(z=>z.fullpath);await Lt(H),X.success(E("deleteSuccess")),ie.emit("removeFiles",{paths:H,loc:C.value})};if(v.length===1&&B.ignoredConfirmActions.deleteOneOnly)return m();await new Promise(H=>{ae.confirm({title:E("confirmDelete"),maskClosable:!0,width:"60vw",content:()=>i("div",null,[i("ol",{style:{maxHeight:"50vh",overflow:"auto"}},[v.map(z=>i("li",null,[z.fullpath.split(/[/\\]/).pop()]))]),i(Ve,null,null),i(Et,{checked:B.ignoredConfirmActions.deleteOneOnly,"onUpdate:checked":z=>B.ignoredConfirmActions.deleteOneOnly=z},{default:()=>[E("deleteOneOnlySkipConfirm"),S(" ("),E("resetOnGlobalSettingsPage"),S(")")]})]),async onOk(){await m(),H()}})});break}}return{}},{isOutside:u}=Je(N);return le("keydown",o=>{var P,W,V;const r=$t(o);if(j.value){const l=(P=Object.entries(B.shortcut).find(c=>c[1]===r&&c[1]))==null?void 0:P[0];if(l){o.stopPropagation(),o.preventDefault();const c=s.value,A=n.value[c];switch(l){case"delete":return G(A)===B.fullscreenPreviewInitialUrl?X.warn(E("fullscreenRestriction")):D({key:"deleteFiles"},A,c);case"download":return D({key:"download"},A,c);default:{const T=(W=/^toggle_tag_(.*)$/.exec(l))==null?void 0:W[1],b=(V=B.conf)==null?void 0:V.all_custom_tags.find(q=>q.name===T);return b?D({key:`toggle-tag-${b.id}`},A,c):void 0}}}}else!u.value&&["Ctrl + KeyA","Cmd + KeyA"].includes(r)&&(o.preventDefault(),o.stopPropagation(),M.value.emit("selectAll"))}),{onFileItemClick:w,onContextMenuClick:D,showGenInfo:t,imageGenInfo:a,q:f}}function Jt(e,t,a,n){let s=0,g=0,$=typeof(n==null?void 0:n.width)=="number"?n.width:0,C=typeof(n==null?void 0:n.height)=="number"?n.height:0,F=typeof(n==null?void 0:n.left)=="number"?n.left:0,j=typeof(n==null?void 0:n.top)=="number"?n.top:0,N=!1;const M=u=>{u.stopPropagation(),u.preventDefault(),!(!e.value||!t.value)&&(s=u instanceof MouseEvent?u.clientX:u.touches[0].clientX,g=u instanceof MouseEvent?u.clientY:u.touches[0].clientY,$=e.value.offsetWidth,C=e.value.offsetHeight,t.value.offsetLeft,t.value.offsetTop,document.documentElement.addEventListener("mousemove",_),document.documentElement.addEventListener("touchmove",_),document.documentElement.addEventListener("mouseup",p),document.documentElement.addEventListener("touchend",p))},_=u=>{if(!e.value||!t.value)return;let o=$+((u instanceof MouseEvent?u.clientX:u.touches[0].clientX)-s),r=C+((u instanceof MouseEvent?u.clientY:u.touches[0].clientY)-g);e.value.offsetLeft+o>window.innerWidth&&(o=window.innerWidth-e.value.offsetLeft),e.value.offsetTop+r>window.innerHeight&&(r=window.innerHeight-e.value.offsetTop),e.value.style.width=`${o}px`,e.value.style.height=`${r}px`,n!=null&&n.onResize&&n.onResize(o,r)},p=()=>{document.documentElement.removeEventListener("mousemove",_),document.documentElement.removeEventListener("touchmove",_),document.documentElement.removeEventListener("mouseup",p),document.documentElement.removeEventListener("touchend",p)},d=u=>{u.stopPropagation(),u.preventDefault(),!(!e.value||!a.value)&&(N=!0,F=e.value.offsetLeft,j=e.value.offsetTop,s=u instanceof MouseEvent?u.clientX:u.touches[0].clientX,g=u instanceof MouseEvent?u.clientY:u.touches[0].clientY,document.documentElement.addEventListener("mousemove",f),document.documentElement.addEventListener("touchmove",f),document.documentElement.addEventListener("mouseup",w),document.documentElement.addEventListener("touchend",w))},f=u=>{if(!e.value||!a.value||!N)return;const o=F+((u instanceof MouseEvent?u.clientX:u.touches[0].clientX)-s),r=j+((u instanceof MouseEvent?u.clientY:u.touches[0].clientY)-g);o<0?e.value.style.left="0px":o+e.value.offsetWidth>window.innerWidth?e.value.style.left=`${window.innerWidth-e.value.offsetWidth}px`:e.value.style.left=`${o}px`,r<0?e.value.style.top="0px":r+e.value.offsetHeight>window.innerHeight?e.value.style.top=`${window.innerHeight-e.value.offsetHeight}px`:e.value.style.top=`${r}px`,n!=null&&n.onDrag&&n.onDrag(o,r)},w=()=>{N=!1,document.documentElement.removeEventListener("mousemove",f),document.documentElement.removeEventListener("touchmove",f),document.documentElement.removeEventListener("mouseup",w),document.documentElement.removeEventListener("touchend",w)},D=()=>{if(!e.value||!t.value)return;let u=e.value.offsetLeft,o=e.value.offsetTop,r=e.value.offsetWidth,P=e.value.offsetHeight;u+r>window.innerWidth&&(u=window.innerWidth-r,u<0&&(u=0,r=window.innerWidth)),o+P>window.innerHeight&&(o=window.innerHeight-P,o<0&&(o=0,P=window.innerHeight)),e.value.style.left=`${u}px`,e.value.style.top=`${o}px`,e.value.style.width=`${r}px`,e.value.style.height=`${P}px`};return ot(()=>{!e.value||!n||(typeof n.width=="number"&&(e.value.style.width=`${n.width}px`),typeof n.height=="number"&&(e.value.style.height=`${n.height}px`),typeof n.left=="number"&&(e.value.style.left=`${n.left}px`),typeof n.top=="number"&&(e.value.style.top=`${n.top}px`),D(),window.addEventListener("resize",D))}),je(()=>{document.documentElement.removeEventListener("mousemove",_),document.documentElement.removeEventListener("touchmove",_),document.documentElement.removeEventListener("mouseup",p),document.documentElement.removeEventListener("touchend",p),document.documentElement.removeEventListener("mousemove",f),document.documentElement.removeEventListener("touchmove",f),document.documentElement.removeEventListener("mouseup",w),document.documentElement.removeEventListener("touchend",w),window.removeEventListener("resize",D)}),he(()=>[e.value,t.value,a.value],([u,o,r])=>{u&&o&&(o.addEventListener("mousedown",M),o.addEventListener("touchstart",M)),u&&r&&(r.addEventListener("mousedown",d),r.addEventListener("touchstart",d))}),{handleResizeMouseDown:M,handleDragMouseDown:d}}const te=e=>(ht("data-v-f572c9ca"),e=e(),yt(),e),Qt={class:"container"},Zt={class:"action-bar"},Rt=["title"],en=["title"],tn={key:0,class:"icon",style:{cursor:"pointer"}},nn={key:0,"flex-placeholder":""},an={key:1,class:"action-bar"},ln={key:0,class:"gen-info"},sn={class:"info-tags"},on={class:"name"},rn={class:"value"},un={key:0,class:"tags-container"},cn=["onClick"],dn=te(()=>I("br",null,null,-1)),vn=te(()=>I("h3",null,"Prompt",-1)),fn=["innerHTML"],pn=te(()=>I("br",null,null,-1)),mn=te(()=>I("h3",null,"Negative Prompt",-1)),gn=["innerHTML"],hn=te(()=>I("br",null,null,-1)),yn=te(()=>I("h3",null,"Params",-1)),_n={style:{"font-weight":"600","text-transform":"capitalize"}},wn={key:0},bn={key:1},kn=["title"],On=We({__name:"fullScreenContextMenu",props:{file:{},idx:{}},emits:["contextMenuClick"],setup(e,{emit:t}){const a=e,n=Be(),s=rt(),g=Q(),$=Z(()=>s.tagMap.get(a.file.fullpath)??[]),C=Q(""),F=ye(),j=Q(""),N=Z(()=>j.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")),M=Z(()=>N.value.split(`
|
||
`)),_=Z(()=>Se(N.value)),p=Z(()=>{let l=Se(N.value);return delete l.prompt,delete l.negativePrompt,l});function d(l){return`${l}`.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}he(()=>{var l;return(l=a==null?void 0:a.file)==null?void 0:l.fullpath},async l=>{l&&(F.tasks.forEach(c=>c.cancel()),F.pushAction(()=>pe(l)).res.then(c=>{j.value=c}))},{immediate:!0});const f=xe("iib@fullScreenContextMenu.prompt-tab","structedData"),w=Q(),D=Q(),u={left:100,top:100,width:512,height:384,expanded:!0},o=xe("fullScreenContextMenu.vue-drag",u);o.value&&(o.value.left<0||o.value.top<0)&&(o.value={...u}),Jt(g,w,D,{...o.value,onDrag:Ce(function(l,c){o.value={...o.value,left:l,top:c}},300),onResize:Ce(function(l,c){o.value={...o.value,width:l,height:c}},300)});function r(l){return l.parentNode}function P(l){if(!l)return"";let c="";const A=l.split(/[\n,]+/).map(b=>b.trim()).filter(b=>b);let T=!1;for(let b=0;b<A.length;b++){const q=A[b];T||(T=q.includes("(")),c+=`<span class="${T?"has-parentheses":""}">${q}</span>`,b<A.length-1&&(c+=","),T&&(T=!q.includes(")"))}return c}le("load",l=>{const c=l.target;c.className==="ant-image-preview-img"&&(C.value=`${c.naturalWidth} x ${c.naturalHeight}`)},{capture:!0});const W=Z(()=>{const l=[{name:E("fileName"),val:a.file.name},{name:E("fileSize"),val:a.file.size}];return C.value&&l.push({name:E("resolution"),val:C.value}),l}),V=()=>{const l="Negative prompt:",c=j.value.includes(l)?j.value.split(l)[0]:M.value[0]??"";me(d(c.trim()))};return(l,c)=>{var z;const A=St,T=R,b=vt,q=ft,ne=pt,v=R,m=mt,H=gt;return O(),x("div",{ref_key:"el",ref:g,class:Me(["full-screen-menu",{"unset-size":!y(o).expanded}]),onWheelCapture:c[6]||(c[6]=dt(()=>{},["stop"]))},[I("div",Qt,[I("div",Zt,[I("div",{ref_key:"dragHandle",ref:D,class:"icon",style:{cursor:"grab"},title:y(E)("dragToMovePanel")},[i(y(At))],8,Rt),I("div",{class:"icon",style:{cursor:"pointer"},onClick:c[0]||(c[0]=L=>y(o).expanded=!y(o).expanded),title:y(E)("clickToToggleMaximizeMinimize")},[y(o).expanded?(O(),oe(y(jt),{key:0})):(O(),oe(y(Vt),{key:1}))],8,en),i(A,{"get-popup-container":r},{overlay:h(()=>[i(bt,{file:l.file,idx:l.idx,"selected-tag":$.value,"disable-delete":y(G)(l.file)===y(n).fullscreenPreviewInitialUrl,onContextMenuClick:c[1]||(c[1]=(L,K,qe)=>t("contextMenuClick",L,K,qe))},null,8,["file","idx","selected-tag","disable-delete"])]),default:h(()=>[y(o).expanded?U("",!0):(O(),x("div",tn,[i(y(it))]))]),_:1}),y(o).expanded?(O(),x("div",nn)):U("",!0),y(o).expanded?(O(),x("div",an,[i(A,{trigger:["hover"],"get-popup-container":r},{overlay:h(()=>[i(ne,{onClick:c[2]||(c[2]=L=>t("contextMenuClick",L,l.file,l.idx))},{default:h(()=>{var L;return[((L=y(n).conf)==null?void 0:L.launch_mode)!=="server"?(O(),x(J,{key:0},[i(b,{key:"send2txt2img"},{default:h(()=>[S(k(l.$t("sendToTxt2img")),1)]),_:1}),i(b,{key:"send2img2img"},{default:h(()=>[S(k(l.$t("sendToImg2img")),1)]),_:1}),i(b,{key:"send2inpaint"},{default:h(()=>[S(k(l.$t("sendToInpaint")),1)]),_:1}),i(b,{key:"send2extras"},{default:h(()=>[S(k(l.$t("sendToExtraFeatures")),1)]),_:1}),i(q,{key:"sendToThirdPartyExtension",title:l.$t("sendToThirdPartyExtension")},{default:h(()=>[i(b,{key:"send2controlnet-txt2img"},{default:h(()=>[S("ControlNet - "+k(l.$t("t2i")),1)]),_:1}),i(b,{key:"send2controlnet-img2img"},{default:h(()=>[S("ControlNet - "+k(l.$t("i2i")),1)]),_:1}),i(b,{key:"send2outpaint"},{default:h(()=>[S("openOutpaint")]),_:1})]),_:1},8,["title"])],64)):U("",!0),i(b,{key:"send2BatchDownload"},{default:h(()=>[S(k(l.$t("sendToBatchDownload")),1)]),_:1}),i(b,{key:"send2savedDir"},{default:h(()=>[S(k(l.$t("send2savedDir")),1)]),_:1}),i(b,{key:"deleteFiles",disabled:y(G)(l.file)===y(n).fullscreenPreviewInitialUrl},{default:h(()=>[S(k(l.$t("deleteSelected")),1)]),_:1},8,["disabled"]),i(b,{key:"previewInNewWindow"},{default:h(()=>[S(k(l.$t("previewInNewWindow")),1)]),_:1}),i(b,{key:"copyPreviewUrl"},{default:h(()=>[S(k(l.$t("copySourceFilePreviewLink")),1)]),_:1})]}),_:1})]),default:h(()=>[i(T,null,{default:h(()=>[S(k(y(E)("openContextMenu")),1)]),_:1})]),_:1}),i(v,{onClick:c[3]||(c[3]=L=>t("contextMenuClick",{key:"download"},a.file,a.idx))},{default:h(()=>[S(k(l.$t("download")),1)]),_:1}),j.value?(O(),oe(T,{key:0,onClick:c[4]||(c[4]=L=>y(me)(j.value))},{default:h(()=>[S(k(l.$t("copyPrompt")),1)]),_:1})):U("",!0),j.value?(O(),oe(T,{key:1,onClick:V},{default:h(()=>[S(k(l.$t("copyPositivePrompt")),1)]),_:1})):U("",!0)])):U("",!0)]),y(o).expanded?(O(),x("div",ln,[I("div",sn,[(O(!0),x(J,null,ce(W.value,L=>(O(),x("span",{class:"info-tag",key:L.name},[I("span",on,k(L.name),1),I("span",rn,k(L.val),1)]))),128))]),(z=y(n).conf)!=null&&z.all_custom_tags?(O(),x("div",un,[(O(!0),x(J,null,ce(y(n).conf.all_custom_tags,L=>(O(),x("div",{class:Me(["tag",{selected:$.value.some(K=>K.id===L.id)}]),onClick:K=>t("contextMenuClick",{key:`toggle-tag-${L.id}`},l.file,l.idx),key:L.id,style:ut({"--tag-color":y(s).getColor(L.name)})},k(L.name),15,cn))),128))])):U("",!0),i(H,{activeKey:y(f),"onUpdate:activeKey":c[5]||(c[5]=L=>ct(f)?f.value=L:null)},{default:h(()=>[i(m,{key:"structedData",tab:l.$t("structuredData")},{default:h(()=>[I("div",null,[_.value.prompt?(O(),x(J,{key:0},[dn,vn,I("code",{innerHTML:P(_.value.prompt??"")},null,8,fn)],64)):U("",!0),_.value.negativePrompt?(O(),x(J,{key:1},[pn,mn,I("code",{innerHTML:P(_.value.negativePrompt??"")},null,8,gn)],64)):U("",!0)]),Object.keys(p.value).length?(O(),x(J,{key:0},[hn,yn,I("table",null,[(O(!0),x(J,null,ce(p.value,(L,K)=>(O(),x("tr",{key:K,class:"gen-info-frag"},[I("td",_n,k(K),1),typeof L=="object"?(O(),x("td",wn,[I("code",null,k(L),1)])):(O(),x("td",bn,k(d(L)),1))]))),128))])],64)):U("",!0)]),_:1},8,["tab"]),i(m,{key:"sourceText",tab:l.$t("sourceText")},{default:h(()=>[I("code",null,k(j.value),1)]),_:1},8,["tab"])]),_:1},8,["activeKey"])])):U("",!0)]),y(o).expanded?(O(),x("div",{key:0,class:"mouse-sensor",ref_key:"resizeHandle",ref:w,title:y(E)("dragToResizePanel")},[i(y(Pt))],8,kn)):U("",!0)],34)}}});const jn=He(On,[["__scopeId","data-v-f572c9ca"]]),Ln={key:0,class:"float-panel"},En={key:0,class:"select-actions"},$n={key:1},Sn=We({__name:"MultiSelectKeep",props:{show:{type:Boolean}},emits:["selectAll","reverseSelect","clearAllSelected"],setup(e,{emit:t}){const a=Be(),n=()=>{t("clearAllSelected"),a.keepMultiSelect=!1},s=()=>{a.keepMultiSelect=!0};return(g,$)=>{const C=R;return g.show?(O(),x("div",Ln,[y(a).keepMultiSelect?(O(),x("div",En,[i(C,{size:"small",onClick:$[0]||($[0]=F=>t("selectAll"))},{default:h(()=>[S(k(g.$t("select-all")),1)]),_:1}),i(C,{size:"small",onClick:$[1]||($[1]=F=>t("reverseSelect"))},{default:h(()=>[S(k(g.$t("rerverse-select")),1)]),_:1}),i(C,{size:"small",onClick:$[2]||($[2]=F=>t("clearAllSelected"))},{default:h(()=>[S(k(g.$t("clear-all-selected")),1)]),_:1}),i(C,{size:"small",onClick:n},{default:h(()=>[S(k(g.$t("exit")),1)]),_:1})])):(O(),x("div",$n,[i(C,{size:"small",type:"primary",onClick:s},{default:h(()=>[S(k(g.$t("keep-multi-selected")),1)]),_:1})]))])):U("",!0)}}});const Wn=He(Sn,[["__scopeId","data-v-b04c3508"]]);export{Dn as L,Wn as M,An as R,zn as a,Nn as b,Tn as c,jn as f,le as u};
|