4 lines
33 KiB
JavaScript
4 lines
33 KiB
JavaScript
import{c8 as dt,l as ce,ba as et,c as i,A as ae,J as X,v as ee,x as I,k as ne,t as vt,c9 as We,ca as ft,bX as $e,ad as ie,af as te,cb as pt,r as K,cc as tt,C as je,a9 as R,cd as mt,ce as gt,R as $,a8 as ht,cf as Ee,I as ue,cg as yt,E as pe,ch as _t,ci as wt,c7 as bt,cj as kt,ck as Ot,n as Be,o as nt,av as Et,W as Se,ah as Lt,B as G,cl as xt,cm as $t,d as lt,cn as St,co as Pt,L as He,cp as Ue,N as _,O as x,Z as v,U as j,Q as C,X as de,Y as y,cq as Ct,T as Y,S as w,a2 as _e,aa as Ve,a1 as It,a0 as ve,cr as we,$ as Mt,ag as Ft,cs as Dt,M as Tt,bH as At,ct as zt,cu as Nt,aI as Wt,aJ as jt,V as at}from"./index-11413b17.js";import{u as ge,e as Le,g as B,f as qe,h as me,r as Bt,t as be,i as Ht,s as ke,j as fe,_ as Ut}from"./FileItem-431a5775.js";import{M as st,c as Vt,m as ot,l as xe,b as qt,d as Xt}from"./functionalCallableComp-2ff9816d.js";import{C as Yt,g as Gt,_ as Kt,a as Jt}from"./shortcut-ecd99e57.js";/* empty css */import{D as Qt}from"./index-7ad2febc.js";var Zt="Expected a function";function Rt(e,t,l){var a=!0,o=!0;if(typeof e!="function")throw new TypeError(Zt);return dt(l)&&(a="leading"in l?!!l.leading:a,o="trailing"in l?!!l.trailing:o),ce(e,t,{leading:a,maxWait:t,trailing:o})}const le=(...e)=>{document.addEventListener(...e),et(()=>document.removeEventListener(...e))};var en={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 tn=en;function Xe(e){for(var t=1;t<arguments.length;t++){var l=arguments[t]!=null?Object(arguments[t]):{},a=Object.keys(l);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(l).filter(function(o){return Object.getOwnPropertyDescriptor(l,o).enumerable}))),a.forEach(function(o){nn(e,o,l[o])})}return e}function nn(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var Pe=function(t,l){var a=Xe({},t,l.attrs);return i(ae,Xe({},a,{icon:tn}),null)};Pe.displayName="ArrowsAltOutlined";Pe.inheritAttrs=!1;const ln=Pe;var an={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 sn=an;function Ye(e){for(var t=1;t<arguments.length;t++){var l=arguments[t]!=null?Object(arguments[t]):{},a=Object.keys(l);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(l).filter(function(o){return Object.getOwnPropertyDescriptor(l,o).enumerable}))),a.forEach(function(o){on(e,o,l[o])})}return e}function on(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var Ce=function(t,l){var a=Ye({},t,l.attrs);return i(ae,Ye({},a,{icon:sn}),null)};Ce.displayName="DragOutlined";Ce.inheritAttrs=!1;const rn=Ce;var cn={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 un=cn;function Ge(e){for(var t=1;t<arguments.length;t++){var l=arguments[t]!=null?Object(arguments[t]):{},a=Object.keys(l);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(l).filter(function(o){return Object.getOwnPropertyDescriptor(l,o).enumerable}))),a.forEach(function(o){dn(e,o,l[o])})}return e}function dn(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var Ie=function(t,l){var a=Ge({},t,l.attrs);return i(ae,Ge({},a,{icon:un}),null)};Ie.displayName="FullscreenExitOutlined";Ie.inheritAttrs=!1;const vn=Ie;var fn={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 pn=fn;function Ke(e){for(var t=1;t<arguments.length;t++){var l=arguments[t]!=null?Object(arguments[t]):{},a=Object.keys(l);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(l).filter(function(o){return Object.getOwnPropertyDescriptor(l,o).enumerable}))),a.forEach(function(o){mn(e,o,l[o])})}return e}function mn(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var Me=function(t,l){var a=Ke({},t,l.attrs);return i(ae,Ke({},a,{icon:pn}),null)};Me.displayName="FullscreenOutlined";Me.inheritAttrs=!1;const gn=Me;var hn={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 yn=hn;function Je(e){for(var t=1;t<arguments.length;t++){var l=arguments[t]!=null?Object(arguments[t]):{},a=Object.keys(l);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(l).filter(function(o){return Object.getOwnPropertyDescriptor(l,o).enumerable}))),a.forEach(function(o){_n(e,o,l[o])})}return e}function _n(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var Fe=function(t,l){var a=Je({},t,l.attrs);return i(ae,Je({},a,{icon:yn}),null)};Fe.displayName="LeftCircleOutlined";Fe.inheritAttrs=!1;const yl=Fe;var wn={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 bn=wn;function Qe(e){for(var t=1;t<arguments.length;t++){var l=arguments[t]!=null?Object(arguments[t]):{},a=Object.keys(l);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(l).filter(function(o){return Object.getOwnPropertyDescriptor(l,o).enumerable}))),a.forEach(function(o){kn(e,o,l[o])})}return e}function kn(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var De=function(t,l){var a=Qe({},t,l.attrs);return i(ae,Qe({},a,{icon:bn}),null)};De.displayName="RightCircleOutlined";De.inheritAttrs=!1;const _l=De,On="/infinite_image_browsing/fe-static/assets/fullscreen-7f54b926.svg",he=()=>{const e=Array.from(document.querySelectorAll(".ant-image-preview-wrap")).find(t=>t.style.display!=="none");e?(console.log("closeImageFullscreenPreview success"),En(e)):console.log("closeImageFullscreenPreview not found")};function En(e){if(!(e instanceof HTMLElement))throw new Error("The provided value is not an HTMLElement.");const t=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0,target:e});e.dispatchEvent(t)}const Ln=(e,t)=>{const l=t.querySelector(`.idx-${e} .ant-image-img`);l?l.click():console.log("openImageFullscreenPreview error: not found",e,t)};function wl(){const{previewIdx:e,eventEmitter:t,canLoadNext:l,previewing:a,sortedFiles:o,scroller:m,props:L}=ge().toRefs(),{state:P}=ge();let F=null;const W=(g,c)=>{var f;a.value=g,F!=null&&!g&&c&&((f=m.value)==null||f.scrollToItem(F),F=null)},N=()=>{L.value.mode==="walk"&&!b("next")&&l&&(ee.info(I("loadingNextFolder")),t.value.emit("loadNextDir",!0))};le("keydown",g=>{var c;if(a.value){let f=e.value;if(["ArrowDown","ArrowRight"].includes(g.key))for(f++;o.value[f]&&!X(o.value[f].name);)f++;else if(["ArrowUp","ArrowLeft"].includes(g.key))for(f--;o.value[f]&&!X(o.value[f].name);)f--;if(X((c=o.value[f])==null?void 0:c.name)??""){e.value=f;const k=m.value;k&&!(f>=k.$_startIndex&&f<=k.$_endIndex)&&(F=f)}N()}});const D=g=>{var f;let c=e.value;if(g==="next")for(c++;o.value[c]&&!X(o.value[c].name);)c++;else if(g==="prev")for(c--;o.value[c]&&!X(o.value[c].name);)c--;if(X((f=o.value[c])==null?void 0:f.name)??""){e.value=c;const k=m.value;k&&!(c>=k.$_startIndex&&c<=k.$_endIndex)&&(F=c)}N()},b=g=>{var f;let c=e.value;if(g==="next")for(c++;o.value[c]&&!X(o.value[c].name);)c++;else if(g==="prev")for(c--;o.value[c]&&!X(o.value[c].name);)c--;return X((f=o.value[c])==null?void 0:f.name)??""};return Le("removeFiles",async()=>{a.value&&!P.sortedFiles[e.value]&&he()}),{previewIdx:e,onPreviewVisibleChange:W,previewing:a,previewImgMove:D,canPreview:b}}function Oe(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!pt(e)}function bl(){const{currLocation:e,sortedFiles:t,currPage:l,multiSelectedIdxs:a,eventEmitter:o,walker:m}=ge().toRefs(),L=()=>{a.value=[]};return le("click",()=>{B.keepMultiSelect||L()}),le("blur",()=>{B.keepMultiSelect||L()}),ne(l,L),{onFileDragStart:(N,D)=>{const b=vt(t.value[D]);qe.fileDragging=!0,console.log("onFileDragStart set drag file ",N,D,b);const g=[b];let c=b.type==="dir";if(a.value.includes(D)){const k=a.value.map(A=>t.value[A]);g.push(...k),c=k.some(A=>A.type==="dir")}const f={includeDir:c,loc:e.value||"search-result",path:We(g,"fullpath").map(k=>k.fullpath),nodes:We(g,"fullpath"),__id:"FileTransferData"};N.dataTransfer.setData("text/plain",JSON.stringify(f))},onDrop:async N=>{if(m.value)return;const D=ft(N);if(!D)return;const b=e.value;if(D.loc===b)return;const g=$e(),c=async()=>g.pushAction(async()=>{await Vt(D.path,b),o.value.emit("refresh"),ie.destroyAll()}),f=()=>g.pushAction(async()=>{await ot(D.path,b),me.emit("removeFiles",{paths:D.path,loc:D.loc}),o.value.emit("refresh"),ie.destroyAll()});ie.confirm({title:I("confirm")+"?",width:"60vw",content:()=>{let k,A,O;return i("div",null,[i("div",null,[`${I("moveSelectedFilesTo")} ${b}`,i("ol",{style:{maxHeight:"50vh",overflow:"auto"}},[D.path.map(E=>i("li",null,[E.split(/[/\\]/).pop()]))])]),i(st,null,null),i("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end"},class:"actions"},[i(te,{onClick:ie.destroyAll},Oe(k=I("cancel"))?k:{default:()=>[k]}),i(te,{type:"primary",loading:!g.isIdle,onClick:c},Oe(A=I("copy"))?A:{default:()=>[A]}),i(te,{type:"primary",loading:!g.isIdle,onClick:f},Oe(O=I("move"))?O:{default:()=>[O]})])])},maskClosable:!0,wrapClassName:"hidden-antd-btns-modal"})},multiSelectedIdxs:a,onFileDragEnd:()=>{qe.fileDragging=!1}}}function kl({openNext:e}){const t=K(!1),l=K(""),{sortedFiles:a,previewIdx:o,multiSelectedIdxs:m,stack:L,currLocation:P,spinning:F,previewing:W,stackViewEl:N,eventEmitter:D,props:b,deletedFiles:g}=ge().toRefs(),c=je;Le("removeFiles",({paths:E,loc:s})=>{c(s)!==c(P.value)||!xe(L.value)||(E.forEach(u=>g.value.add(u)),E.filter(X).forEach(u=>g.value.add(u.replace(/\.\w+$/,".txt"))))}),Le("addFiles",({files:E,loc:s})=>{if(c(s)!==c(P.value))return;const p=xe(L.value);p&&p.files.unshift(...E)});const f=$e(),k=async(E,s,p)=>{o.value=p,B.fullscreenPreviewInitialUrl=R(s);const u=m.value.indexOf(p);if(E.shiftKey){if(u!==-1)m.value.splice(u,1);else{m.value.push(p),m.value.sort((z,H)=>z-H);const T=m.value[0],U=m.value[m.value.length-1];m.value=Bt(T,U+1)}E.stopPropagation()}else E.ctrlKey||E.metaKey?(u!==-1?m.value.splice(u,1):m.value.push(p),E.stopPropagation()):await e(s)},A=async(E,s,p)=>{var J,Z,oe;const u=R(s),T=P.value,U={IIB_container_id:parent.IIB_container_id},z=()=>{let d=[];return m.value.includes(p)?d=m.value.map(n=>a.value[n]):d.push(s),d},H=async d=>{if(!F.value)try{F.value=!0,await kt(s.fullpath),fe.postMessage({...U,event:"click_hidden_button",btnEleId:"iib_hidden_img_update_trigger"}),await Ot(),fe.postMessage({...U,event:"click_hidden_button",btnEleId:`iib_hidden_tab_${d}`})}catch(n){console.error(n),ee.error("发送图像失败,请携带console的错误消息找开发者")}finally{F.value=!1}},q=`${E.key}`;if(q.startsWith("toggle-tag-")){const d=+q.split("toggle-tag-")[1],{is_remove:n}=await mt({tag_id:d,img_path:s.fullpath}),r=(Z=(J=B.conf)==null?void 0:J.all_custom_tags.find(S=>S.id===d))==null?void 0:Z.name;await be.refreshTags([s.fullpath]),ee.success(I(n?"removedTagFromImage":"addedTagToImage",{tag:r}));return}else if(q.startsWith("batch-add-tag-")||q.startsWith("batch-remove-tag-")){const d=+q.split("-tag-")[1],n=q.includes("add")?"add":"remove",r=z().map(S=>S.fullpath);await gt({tag_id:d,img_paths:r,action:n}),await be.refreshTags(r),ee.success(I(n==="add"?"addCompleted":"removeCompleted"));return}switch(E.key){case"previewInNewWindow":return window.open(u);case"saveSelectedAsJson":return bt(z());case"openWithDefaultApp":return wt(s.fullpath);case"download":{const d=z();_t(d.map(n=>R(n,!0)));break}case"copyPreviewUrl":return pe(parent.document.location.origin+u);case"rename":{let d=await qt(s.fullpath);d=je(d);const n=be.tagMap;n.set(d,n.get(s.fullpath)??[]),n.delete(s.fullpath),s.fullpath=d,s.name=d.split(/[\\/]/).pop()??"";return}case"send2txt2img":return H("txt2img");case"send2img2img":return H("img2img");case"send2inpaint":return H("inpaint");case"send2extras":return H("extras");case"send2savedDir":{const d=B.quickMovePaths.find(S=>S.key==="outdir_save");if(!d)return ee.error(I("unknownSavedDir"));const n=yt(d.dir,(oe=B.conf)==null?void 0:oe.sd_cwd),r=z();await ot(r.map(S=>S.fullpath),n,!0),me.emit("removeFiles",{paths:r.map(S=>S.fullpath),loc:P.value}),me.emit("addFiles",{files:r,loc:n});break}case"send2controlnet-img2img":case"send2controlnet-txt2img":{const d=E.key.split("-")[1];fe.postMessage({...U,event:"send_to_control_net",type:d,url:R(s)});break}case"send2outpaint":{l.value=await f.pushAction(()=>Ee(s.fullpath)).res;const[d,n]=(l.value||"").split(`
|
||
`);fe.postMessage({...U,event:"send_to_outpaint",url:R(s),prompt:d,negPrompt:n.slice(17)});break}case"openWithWalkMode":{ke.set(T,L.value);const d=B.tabList[b.value.tabIdx],n={type:"local",key:ue(),path:s.fullpath,name:I("local"),stackKey:T,mode:"walk"};d.panes.push(n),d.key=n.key;break}case"openInNewTab":{ke.set(T,L.value);const d=B.tabList[b.value.tabIdx],n={type:"local",key:ue(),path:s.fullpath,name:I("local"),stackKey:T};d.panes.push(n),d.key=n.key;break}case"openOnTheRight":{ke.set(T,L.value);let d=B.tabList[b.value.tabIdx+1];d||(d={panes:[],key:"",id:ue()},B.tabList[b.value.tabIdx+1]=d);const n={type:"local",key:ue(),path:s.fullpath,name:I("local"),stackKey:T};d.panes.push(n),d.key=n.key;break}case"send2BatchDownload":{Ht.addFiles(z());break}case"viewGenInfo":{t.value=!0,l.value=await f.pushAction(()=>Ee(s.fullpath)).res;break}case"openWithLocalFileBrowser":{await ht(s.fullpath);break}case"deleteFiles":{const d=z(),n=async()=>{const r=d.map(S=>S.fullpath);if(await Xt(r),ee.success(I("deleteSuccess")),W.value){const S=R(s)===B.fullscreenPreviewInitialUrl,V=o.value===a.value.length-1;if((S||V)&&(he(),await Be(100),S&&a.value.length>1)){const M=o.value;Be(0).then(()=>Ln(M,N.value))}}me.emit("removeFiles",{paths:r,loc:P.value})};if(d.length===1&&B.ignoredConfirmActions.deleteOneOnly)return n();await new Promise(r=>{ie.confirm({title:I("confirmDelete"),maskClosable:!0,width:"60vw",content:()=>i("div",null,[i("ol",{style:{maxHeight:"50vh",overflow:"auto"}},[d.map(S=>i("li",null,[S.fullpath.split(/[/\\]/).pop()]))]),i(st,null,null),i(Yt,{checked:B.ignoredConfirmActions.deleteOneOnly,"onUpdate:checked":S=>B.ignoredConfirmActions.deleteOneOnly=S},{default:()=>[I("deleteOneOnlySkipConfirm"),$(" ("),I("resetOnGlobalSettingsPage"),$(")")]})]),async onOk(){await n(),r()}})});break}}return{}},{isOutside:O}=tt(N);return le("keydown",E=>{var p,u,T;const s=Gt(E);if(W.value){s==="Esc"&&he();const U=(p=Object.entries(B.shortcut).find(z=>z[1]===s&&z[1]))==null?void 0:p[0];if(U){E.stopPropagation(),E.preventDefault();const z=o.value,H=a.value[z];switch(U){case"delete":return A({key:"deleteFiles"},H,z);case"download":return A({key:"download"},H,z);default:{const q=(u=/^toggle_tag_(.*)$/.exec(U))==null?void 0:u[1],J=(T=B.conf)==null?void 0:T.all_custom_tags.find(Z=>Z.name===q);return J?A({key:`toggle-tag-${J.id}`},H,z):void 0}}}}else!O.value&&["Ctrl + KeyA","Cmd + KeyA"].includes(s)&&(E.preventDefault(),E.stopPropagation(),D.value.emit("selectAll"))}),{onFileItemClick:k,onContextMenuClick:A,showGenInfo:t,imageGenInfo:l,q:f}}function xn(e,t,l,a){let o=0,m=0,L=typeof(a==null?void 0:a.width)=="number"?a.width:0,P=typeof(a==null?void 0:a.height)=="number"?a.height:0,F=typeof(a==null?void 0:a.left)=="number"?a.left:0,W=typeof(a==null?void 0:a.top)=="number"?a.top:0,N=!1;const D=s=>{s.stopPropagation(),s.preventDefault(),!(!e.value||!t.value)&&(o=s instanceof MouseEvent?s.clientX:s.touches[0].clientX,m=s instanceof MouseEvent?s.clientY:s.touches[0].clientY,L=e.value.offsetWidth,P=e.value.offsetHeight,t.value.offsetLeft,t.value.offsetTop,document.documentElement.addEventListener("mousemove",b),document.documentElement.addEventListener("touchmove",b),document.documentElement.addEventListener("mouseup",g),document.documentElement.addEventListener("touchend",g))},b=s=>{if(!e.value||!t.value)return;let p=L+((s instanceof MouseEvent?s.clientX:s.touches[0].clientX)-o),u=P+((s instanceof MouseEvent?s.clientY:s.touches[0].clientY)-m);e.value.offsetLeft+p>window.innerWidth&&(p=window.innerWidth-e.value.offsetLeft),e.value.offsetTop+u>window.innerHeight&&(u=window.innerHeight-e.value.offsetTop),e.value.style.width=`${p}px`,e.value.style.height=`${u}px`,a!=null&&a.onResize&&a.onResize(p,u)},g=()=>{document.documentElement.removeEventListener("mousemove",b),document.documentElement.removeEventListener("touchmove",b),document.documentElement.removeEventListener("mouseup",g),document.documentElement.removeEventListener("touchend",g)},c=s=>{s.stopPropagation(),s.preventDefault(),!(!e.value||!l.value)&&(N=!0,F=e.value.offsetLeft,W=e.value.offsetTop,o=s instanceof MouseEvent?s.clientX:s.touches[0].clientX,m=s instanceof MouseEvent?s.clientY:s.touches[0].clientY,document.documentElement.addEventListener("mousemove",f),document.documentElement.addEventListener("touchmove",f),document.documentElement.addEventListener("mouseup",k),document.documentElement.addEventListener("touchend",k))},f=s=>{if(!e.value||!l.value||!N)return;const p=F+((s instanceof MouseEvent?s.clientX:s.touches[0].clientX)-o),u=W+((s instanceof MouseEvent?s.clientY:s.touches[0].clientY)-m);p<0?e.value.style.left="0px":p+e.value.offsetWidth>window.innerWidth?e.value.style.left=`${window.innerWidth-e.value.offsetWidth}px`:e.value.style.left=`${p}px`,u<0?e.value.style.top="0px":u+e.value.offsetHeight>window.innerHeight?e.value.style.top=`${window.innerHeight-e.value.offsetHeight}px`:e.value.style.top=`${u}px`,a!=null&&a.onDrag&&a.onDrag(p,u)},k=()=>{N=!1,document.documentElement.removeEventListener("mousemove",f),document.documentElement.removeEventListener("touchmove",f),document.documentElement.removeEventListener("mouseup",k),document.documentElement.removeEventListener("touchend",k)},A=()=>{if(!e.value||!t.value)return;let s=e.value.offsetLeft,p=e.value.offsetTop,u=e.value.offsetWidth,T=e.value.offsetHeight;s+u>window.innerWidth&&(s=window.innerWidth-u,s<0&&(s=0,u=window.innerWidth)),p+T>window.innerHeight&&(p=window.innerHeight-T,p<0&&(p=0,T=window.innerHeight)),e.value.style.left=`${s}px`,e.value.style.top=`${p}px`,e.value.style.width=`${u}px`,e.value.style.height=`${T}px`},O=()=>{!e.value||!a||(typeof a.width=="number"&&(e.value.style.width=`${a.width}px`),typeof a.height=="number"&&(e.value.style.height=`${a.height}px`),typeof a.left=="number"&&(e.value.style.left=`${a.left}px`),typeof a.top=="number"&&(e.value.style.top=`${a.top}px`),A(),window.addEventListener("resize",A))},E=()=>{document.documentElement.removeEventListener("mousemove",b),document.documentElement.removeEventListener("touchmove",b),document.documentElement.removeEventListener("mouseup",g),document.documentElement.removeEventListener("touchend",g),document.documentElement.removeEventListener("mousemove",f),document.documentElement.removeEventListener("touchmove",f),document.documentElement.removeEventListener("mouseup",k),document.documentElement.removeEventListener("touchend",k),window.removeEventListener("resize",A)};return nt(O),et(E),ne(()=>a==null?void 0:a.disbaled,async s=>{await Et(),s!==void 0&&(s?E():O())}),ne(()=>[e.value,t.value,l.value],([s,p,u])=>{s&&p&&(p.addEventListener("mousedown",D),p.addEventListener("touchstart",D)),s&&u&&(u.addEventListener("mousedown",c),u.addEventListener("touchstart",c))}),{handleResizeMouseDown:D,handleDragMouseDown:c}}let Ze=null;const $n=()=>{var P,F;const e=Se(),t=Lt(Ze??((F=(P=e.conf)==null?void 0:P.app_fe_setting)==null?void 0:F.fullscreen_layout)??{enable:!1,panelWidth:384,alwaysOn:!0}),l="--iib-lr-layout-info-panel-width",a=G(()=>t.alwaysOn&&t.enable?t.panelWidth:0);ne(t,()=>{Re(t,l,a),Sn(t),Ze=t},{deep:!0}),nt(()=>Re(t,l,a));const{enable:o,panelWidth:m,alwaysOn:L}=xt(t);return{state:t,isLeftRightLayout:o,panelwidtrhStyleVarName:l,lrLayoutInfoPanelWidth:m,lrMenuAlwaysOn:L}},Sn=ce(e=>$t("fullscreen_layout",e),300),Re=ce((e,t,l)=>{e.enable?(document.body.classList.add("fullscreen-lr-layout"),document.documentElement.style.setProperty(t,`${e.panelWidth}px`),document.documentElement.style.setProperty("--iib-lr-layout-container-offset",`${l.value}px`)):(document.documentElement.style.removeProperty(t),document.documentElement.style.removeProperty("--iib-lr-layout-container-offset"),document.body.classList.remove("fullscreen-lr-layout"))},300),se=e=>(Wt("data-v-810a0fc5"),e=e(),jt(),e),Pn={key:0},Cn={class:"container"},In={class:"action-bar"},Mn=["title"],Fn=["title"],Dn=["title"],Tn=["src"],An={key:0,class:"icon",style:{cursor:"pointer"}},zn={key:2,"flex-placeholder":""},Nn={key:3,class:"action-bar"},Wn={key:0,class:"gen-info"},jn={class:"info-tags"},Bn={class:"name"},Hn={class:"value"},Un={key:0,class:"tags-container"},Vn=["onClick"],qn={class:"lr-layout-control"},Xn={class:"ctrl-item"},Yn={class:"ctrl-item"},Gn={class:"ctrl-item"},Kn=se(()=>C("br",null,null,-1)),Jn=se(()=>C("h3",null,"Prompt",-1)),Qn=["innerHTML"],Zn=se(()=>C("br",null,null,-1)),Rn=se(()=>C("h3",null,"Negative Prompt",-1)),el=["innerHTML"],tl=se(()=>C("br",null,null,-1)),nl=se(()=>C("h3",null,"Params",-1)),ll={style:{"font-weight":"600","text-transform":"capitalize"}},al=["onDblclick"],sl=["onDblclick"],ol=["title"],rl=lt({__name:"fullScreenContextMenu",props:{file:{},idx:{}},emits:["contextMenuClick"],setup(e,{emit:t}){const l=e;St(n=>({"4315b672":v(p)?0:"46px","410a5a36":v(s)+"px","9c59682e":`calc(100vw - ${v(s)}px)`}));const a=Se(),o=Pt(),m=K(),L=G(()=>o.tagMap.get(l.file.fullpath)??[]),P=K(""),F=$e(),W=K(""),N=G(()=>W.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")),D=G(()=>N.value.split(`
|
||
`)),b=G(()=>He(N.value)),g=G(()=>{let n=He(N.value);return delete n.prompt,delete n.negativePrompt,n});ne(()=>{var n;return(n=l==null?void 0:l.file)==null?void 0:n.fullpath},async n=>{n&&(F.tasks.forEach(r=>r.cancel()),F.pushAction(()=>Ee(n)).res.then(r=>{W.value=r}))},{immediate:!0});const c=Ue("iib@fullScreenContextMenu.prompt-tab","structedData"),f=K(),k=K(),A={left:100,top:100,width:512,height:384,expanded:!0},O=Ue("fullScreenContextMenu.vue-drag",A);O.value&&(O.value.left<0||O.value.top<0)&&(O.value={...A});const{isLeftRightLayout:E,lrLayoutInfoPanelWidth:s,lrMenuAlwaysOn:p}=$n(),u=E;xn(m,f,k,{disbaled:u,...O.value,onDrag:ce(function(n,r){O.value={...O.value,left:n,top:r}},300),onResize:ce(function(n,r){O.value={...O.value,width:n,height:r}},300)});const T=K(!1),{isOutside:U}=tt(G(()=>!u.value||p.value?null:T.value?m.value:xe(document.querySelectorAll(".iib-tab-edge-trigger"))));ne(U,Rt(n=>{T.value=!n},300));function z(n){return n.parentNode}function H(n){if(!n)return"";let r="";const S=n.split(/[\n,]+/).map(M=>M.trim()).filter(M=>M);let V=!1;for(let M=0;M<S.length;M++){const re=S[M];V||(V=re.includes("(")),r+=`<span class="${V?"has-parentheses":""}">${re}</span>`,M<S.length-1&&(r+=","),V&&(V=!re.includes(")"))}return r}le("load",n=>{const r=n.target;r.className==="ant-image-preview-img"&&(P.value=`${r.naturalWidth} x ${r.naturalHeight}`)},{capture:!0});const q=G(()=>{const n=[{name:I("fileName"),val:l.file.name},{name:I("fileSize"),val:l.file.size}];return P.value&&n.push({name:I("resolution"),val:P.value}),n}),J=()=>{const n="Negative prompt:",r=W.value.includes(n)?W.value.split(n)[0]:D.value[0]??"";pe(we(r.trim()))},Z=()=>document.body.requestFullscreen(),oe=n=>{pe(typeof n=="object"?JSON.stringify(n,null,4):n)},d=n=>{n.key.startsWith("Arrow")?(n.stopPropagation(),n.preventDefault(),document.dispatchEvent(new KeyboardEvent("keydown",n))):n.key==="Escape"&&document.fullscreenElement&&document.exitFullscreen()};return le("dblclick",n=>{var r;((r=n.target)==null?void 0:r.className)==="ant-image-preview-img"&&he()}),(n,r)=>{var Ne;const S=Qt,V=te,M=Ft,re=Dt,Te=Tt,rt=te,Ae=Kt,it=Jt,ct=At,ze=zt,ut=Nt;return _(),x("div",{ref_key:"el",ref:m,class:Ve(["full-screen-menu",{"unset-size":!v(O).expanded,lr:v(u),"always-on":v(p),"mouse-in":T.value}]),onWheelCapture:r[9]||(r[9]=Mt(()=>{},["stop"])),onKeydownCapture:d},[v(u)?(_(),x("div",Pn)):j("",!0),C("div",Cn,[C("div",In,[v(u)?j("",!0):(_(),x("div",{key:0,ref_key:"dragHandle",ref:k,class:"icon",style:{cursor:"grab"},title:v(I)("dragToMovePanel")},[i(v(rn))],8,Mn)),v(u)?j("",!0):(_(),x("div",{key:1,class:"icon",style:{cursor:"pointer"},onClick:r[0]||(r[0]=h=>v(O).expanded=!v(O).expanded),title:v(I)("clickToToggleMaximizeMinimize")},[v(O).expanded?(_(),de(v(vn),{key:0})):(_(),de(v(gn),{key:1}))],8,Fn)),C("div",{style:{display:"flex","flex-direction":"column","align-items":"center",cursor:"grab"},class:"icon",title:v(I)("fullscreenview"),onClick:Z},[C("img",{src:v(On),style:{width:"21px",height:"21px","padding-bottom":"2px"},alt:""},null,8,Tn)],8,Dn),i(S,{"get-popup-container":z},{overlay:y(()=>[i(Ut,{file:n.file,idx:n.idx,"selected-tag":L.value,onContextMenuClick:r[1]||(r[1]=(h,Q,ye)=>t("contextMenuClick",h,Q,ye))},null,8,["file","idx","selected-tag"])]),default:y(()=>[v(O).expanded?j("",!0):(_(),x("div",An,[i(v(Ct))]))]),_:1}),v(O).expanded?(_(),x("div",zn)):j("",!0),v(O).expanded?(_(),x("div",Nn,[i(S,{trigger:["hover"],"get-popup-container":z},{overlay:y(()=>[i(Te,{onClick:r[2]||(r[2]=h=>t("contextMenuClick",h,n.file,n.idx))},{default:y(()=>{var h;return[((h=v(a).conf)==null?void 0:h.launch_mode)!=="server"?(_(),x(Y,{key:0},[i(M,{key:"send2txt2img"},{default:y(()=>[$(w(n.$t("sendToTxt2img")),1)]),_:1}),i(M,{key:"send2img2img"},{default:y(()=>[$(w(n.$t("sendToImg2img")),1)]),_:1}),i(M,{key:"send2inpaint"},{default:y(()=>[$(w(n.$t("sendToInpaint")),1)]),_:1}),i(M,{key:"send2extras"},{default:y(()=>[$(w(n.$t("sendToExtraFeatures")),1)]),_:1}),i(re,{key:"sendToThirdPartyExtension",title:n.$t("sendToThirdPartyExtension")},{default:y(()=>[i(M,{key:"send2controlnet-txt2img"},{default:y(()=>[$("ControlNet - "+w(n.$t("t2i")),1)]),_:1}),i(M,{key:"send2controlnet-img2img"},{default:y(()=>[$("ControlNet - "+w(n.$t("i2i")),1)]),_:1}),i(M,{key:"send2outpaint"},{default:y(()=>[$("openOutpaint")]),_:1})]),_:1},8,["title"])],64)):j("",!0),i(M,{key:"send2BatchDownload"},{default:y(()=>[$(w(n.$t("sendToBatchDownload")),1)]),_:1}),i(M,{key:"send2savedDir"},{default:y(()=>[$(w(n.$t("send2savedDir")),1)]),_:1}),i(M,{key:"deleteFiles"},{default:y(()=>[$(w(n.$t("deleteSelected")),1)]),_:1}),i(M,{key:"previewInNewWindow"},{default:y(()=>[$(w(n.$t("previewInNewWindow")),1)]),_:1}),i(M,{key:"copyPreviewUrl"},{default:y(()=>[$(w(n.$t("copySourceFilePreviewLink")),1)]),_:1})]}),_:1})]),default:y(()=>[i(V,null,{default:y(()=>[$(w(v(I)("openContextMenu")),1)]),_:1})]),_:1}),i(rt,{onClick:r[3]||(r[3]=h=>t("contextMenuClick",{key:"download"},l.file,l.idx))},{default:y(()=>[$(w(n.$t("download")),1)]),_:1}),W.value?(_(),de(V,{key:0,onClick:r[4]||(r[4]=h=>v(pe)(W.value))},{default:y(()=>[$(w(n.$t("copyPrompt")),1)]),_:1})):j("",!0),W.value?(_(),de(V,{key:1,onClick:J},{default:y(()=>[$(w(n.$t("copyPositivePrompt")),1)]),_:1})):j("",!0)])):j("",!0)]),v(O).expanded?(_(),x("div",Wn,[C("div",jn,[(_(!0),x(Y,null,_e(q.value,h=>(_(),x("span",{class:"info-tag",key:h.name},[C("span",Bn,w(h.name),1),C("span",Hn,w(h.val),1)]))),128))]),(Ne=v(a).conf)!=null&&Ne.all_custom_tags?(_(),x("div",Un,[(_(!0),x(Y,null,_e(v(a).conf.all_custom_tags,h=>(_(),x("div",{class:Ve(["tag",{selected:L.value.some(Q=>Q.id===h.id)}]),onClick:Q=>t("contextMenuClick",{key:`toggle-tag-${h.id}`},n.file,n.idx),key:h.id,style:It({"--tag-color":v(o).getColor(h.name)})},w(h.name),15,Vn))),128))])):j("",!0),C("div",qn,[C("div",Xn,[$(w(n.$t("experimentalLRLayout"))+": ",1),i(Ae,{checked:v(u),"onUpdate:checked":r[5]||(r[5]=h=>ve(u)?u.value=h:null),size:"small"},null,8,["checked"])]),v(u)?(_(),x(Y,{key:0},[C("div",Yn,[$(w(n.$t("width"))+": ",1),i(it,{value:v(s),"onUpdate:value":r[6]||(r[6]=h=>ve(s)?s.value=h:null),style:{width:"64px"},step:16,min:128,max:1024},null,8,["value"])]),i(ct,{title:n.$t("alwaysOnTooltipInfo")},{default:y(()=>[C("div",Gn,[$(w(n.$t("alwaysOn"))+": ",1),i(Ae,{checked:v(p),"onUpdate:checked":r[7]||(r[7]=h=>ve(p)?p.value=h:null),size:"small"},null,8,["checked"])])]),_:1},8,["title"])],64)):j("",!0)]),i(ut,{activeKey:v(c),"onUpdate:activeKey":r[8]||(r[8]=h=>ve(c)?c.value=h:null)},{default:y(()=>[i(ze,{key:"structedData",tab:n.$t("structuredData")},{default:y(()=>[C("div",null,[b.value.prompt?(_(),x(Y,{key:0},[Kn,Jn,C("code",{innerHTML:H(b.value.prompt??"")},null,8,Qn)],64)):j("",!0),b.value.negativePrompt?(_(),x(Y,{key:1},[Zn,Rn,C("code",{innerHTML:H(b.value.negativePrompt??"")},null,8,el)],64)):j("",!0)]),Object.keys(g.value).length?(_(),x(Y,{key:0},[tl,nl,C("table",null,[(_(!0),x(Y,null,_e(g.value,(h,Q)=>(_(),x("tr",{key:Q,class:"gen-info-frag"},[C("td",ll,w(Q),1),typeof h=="object"?(_(),x("td",{key:0,style:{cursor:"pointer"},onDblclick:ye=>oe(h)},[C("code",null,w(h),1)],40,al)):(_(),x("td",{key:1,style:{cursor:"pointer"},onDblclick:ye=>oe(v(we)(h))},w(v(we)(h)),41,sl))]))),128))])],64)):j("",!0)]),_:1},8,["tab"]),i(ze,{key:"sourceText",tab:n.$t("sourceText")},{default:y(()=>[C("code",null,w(W.value),1)]),_:1},8,["tab"])]),_:1},8,["activeKey"])])):j("",!0)]),v(O).expanded&&!v(u)?(_(),x("div",{key:1,class:"mouse-sensor",ref_key:"resizeHandle",ref:f,title:v(I)("dragToResizePanel")},[i(v(ln))],8,ol)):j("",!0)],34)}}});const Ol=at(rl,[["__scopeId","data-v-810a0fc5"]]),il={key:0,class:"float-panel"},cl={key:0,class:"select-actions"},ul={key:1},dl=lt({__name:"MultiSelectKeep",props:{show:{type:Boolean}},emits:["selectAll","reverseSelect","clearAllSelected"],setup(e,{emit:t}){const l=Se(),a=()=>{t("clearAllSelected"),l.keepMultiSelect=!1},o=()=>{l.keepMultiSelect=!0};return(m,L)=>{const P=te;return m.show?(_(),x("div",il,[v(l).keepMultiSelect?(_(),x("div",cl,[i(P,{size:"small",onClick:L[0]||(L[0]=F=>t("selectAll"))},{default:y(()=>[$(w(m.$t("select-all")),1)]),_:1}),i(P,{size:"small",onClick:L[1]||(L[1]=F=>t("reverseSelect"))},{default:y(()=>[$(w(m.$t("rerverse-select")),1)]),_:1}),i(P,{size:"small",onClick:L[2]||(L[2]=F=>t("clearAllSelected"))},{default:y(()=>[$(w(m.$t("clear-all-selected")),1)]),_:1}),i(P,{size:"small",onClick:a},{default:y(()=>[$(w(m.$t("exit")),1)]),_:1})])):(_(),x("div",ul,[i(P,{size:"small",type:"primary",onClick:o},{default:y(()=>[$(w(m.$t("keep-multi-selected")),1)]),_:1})]))])):j("",!0)}}});const El=at(dl,[["__scopeId","data-v-b04c3508"]]);export{yl as L,El as M,_l as R,bl as a,kl as b,wl as c,Ol as f,le as u};
|