sd-webui-infinite-image-bro.../vue/dist/assets/globalSetting-af89ef30.js

2 lines
15 KiB
JavaScript

import{d as G,r as K,$ as E,v as pe,aD as Z,o as _,k as v,c as a,y as s,z as e,ae as t,x as R,p as x,l as r,n as P,Y as U,at as he,t as u,av as J,m as w,H as M,S as V,aE as j,aF as me,ag as D,W as z,R as _e,V as ee,q as te,as as ge,aG as ve,aH as fe,aI as ke,aJ as be,aK as ye,K as we,C as Ce,Q as Se,B as Q,N as Te,aL as Pe,aM as $e,aN as xe,aO as Ue,aA as Ae,U as Ie}from"./index-12313f08.js";import{_ as ae,F as Re}from"./index-f8c92eef.js";import"./index-f5c4ffd0.js";import"./index-ae7078f3.js";/* empty css */import{_ as W,g as Me,C as Y,a as Fe}from"./shortcut-bbb69994.js";import{_ as oe}from"./index-bad120e8.js";import"./index-0dfd825f.js";/* empty css */import"./isArrayLikeObject-98f227d7.js";import"./index-9624126c.js";const X="/infinite_image_browsing/fe-static/assets/sample-55dcafc6.webp",Le=["width","height","src"],Ne=G({__name:"ImageSetting",setup(H){function l(A,g){return new Promise(k=>{const b=new Image;b.onload=()=>{const m=document.createElement("canvas");m.width=b.width*g,m.height=b.height*g,m.getContext("2d").drawImage(b,0,0,m.width,m.height),k(m.toDataURL())},b.src=A})}const c=K(),T=E("");return pe(()=>[c.enableThumbnail,c.gridThumbnailResolution],Z(async()=>{c.enableThumbnail&&(T.value=await l(X,c.gridThumbnailResolution/1024))},300),{immediate:!0,deep:!0}),(A,g)=>{const k=ae,b=oe;return _(),v(P,null,[a(k,{label:e(t)("defaultGridCellWidth")},{default:s(()=>[a(W,{min:64,max:1024,step:16,modelValue:e(c).defaultGridCellWidth,"onUpdate:modelValue":g[0]||(g[0]=m=>e(c).defaultGridCellWidth=m)},null,8,["modelValue"])]),_:1},8,["label"]),a(k,{label:e(t)("useThumbnailPreview")},{default:s(()=>[a(b,{checked:e(c).enableThumbnail,"onUpdate:checked":g[1]||(g[1]=m=>e(c).enableThumbnail=m)},null,8,["checked"])]),_:1},8,["label"]),e(c).enableThumbnail?(_(),R(k,{key:0,label:e(t)("thumbnailResolution")},{default:s(()=>[a(W,{modelValue:e(c).gridThumbnailResolution,"onUpdate:modelValue":g[2]||(g[2]=m=>e(c).gridThumbnailResolution=m),min:256,max:1024,step:64},null,8,["modelValue"])]),_:1},8,["label"])):x("",!0),a(k,{label:e(t)("livePreview")},{default:s(()=>[r("div",null,[r("img",{width:e(c).defaultGridCellWidth,height:e(c).defaultGridCellWidth,src:e(c).enableThumbnail?T.value:e(X)},null,8,Le)])]),_:1},8,["label"]),a(k,{label:e(t)("defaultShowChangeIndicators")},{default:s(()=>[a(b,{checked:e(c).defaultChangeIndchecked,"onUpdate:checked":g[3]||(g[3]=m=>e(c).defaultChangeIndchecked=m)},null,8,["checked"])]),_:1},8,["label"]),e(c).defaultChangeIndchecked?(_(),R(k,{key:1,label:e(t)("defaultSeedAsChange")},{default:s(()=>[a(b,{checked:e(c).defaultSeedChangeChecked,"onUpdate:checked":g[4]||(g[4]=m=>e(c).defaultSeedChangeChecked=m)},null,8,["checked"])]),_:1},8,["label"])):x("",!0),a(k,{label:e(t)("previewMaskBackgroundOpacity")},{default:s(()=>[a(W,{min:0,max:1,step:.05,modelValue:e(c).previewBgOpacity,"onUpdate:modelValue":g[5]||(g[5]=m=>e(c).previewBgOpacity=m)},null,8,["modelValue"])]),_:1},8,["label"])],64)}}}),Ve={class:"auto-tag-settings"},We={class:"header"},Ee={class:"description"},Be={class:"actions"},Oe={class:"rules-list"},De={class:"rule-header"},ze={class:"filters-list"},Ge={key:0,class:"empty-tip"},Ke=G({__name:"AutoTagSettings",setup(H){const l=E([]),c=K(),T=U(()=>{var p,C;return((C=(p=c.conf)==null?void 0:p.all_custom_tags)==null?void 0:C.filter(f=>f.type==="custom"))||[]}),A={value:p=>p.name,text:p=>p.display_name?`${p.display_name} : ${p.name}`:p.name};he(()=>{var C,f;const p=(f=(C=c.conf)==null?void 0:C.app_fe_setting)==null?void 0:f.auto_tag_rules;p&&(l.value=p)});const g=()=>{l.value.push({tag:"",filters:[]})},k=p=>{l.value.splice(p,1)},b=p=>{p.filters.push({field:"pos_prompt",operator:"contains",value:""})},m=(p,C)=>{p.filters.splice(C,1)},F=async()=>{try{await me("auto_tag_rules",l.value),D.success(t("autoTag.saveSuccess")),c.conf&&c.conf.app_fe_setting&&(c.conf.app_fe_setting.auto_tag_rules=l.value)}catch(p){D.error(t("autoTag.saveFail")+": "+p)}},B=U(()=>[{label:t("autoTag.fields.posPrompt"),value:"pos_prompt"},{label:t("autoTag.fields.negPrompt"),value:"neg_prompt"},{label:t("autoTag.fields.model"),value:"Model"},{label:t("autoTag.fields.sampler"),value:"Sampler"},{label:t("autoTag.fields.size"),value:"Size"},{label:t("autoTag.fields.cfgScale"),value:"CFG scale"},{label:t("autoTag.fields.steps"),value:"Steps"},{label:t("autoTag.fields.seed"),value:"Seed"}]),L=U(()=>[{label:t("autoTag.operators.contains"),value:"contains"},{label:t("autoTag.operators.equals"),value:"equals"},{label:t("autoTag.operators.regex"),value:"regex"}]);return(p,C)=>{const f=z,I=_e,O=ee;return _(),v("div",Ve,[r("div",We,[r("div",Ee,u(e(t)("autoTag.description")),1),r("div",Be,[a(f,{type:"primary",onClick:g},{icon:s(()=>[a(e(J))]),default:s(()=>[w(" "+u(e(t)("autoTag.addRule")),1)]),_:1}),a(f,{type:"primary",onClick:F,style:{"margin-left":"16px"}},{default:s(()=>[w(u(e(t)("autoTag.saveConfig")),1)]),_:1})])]),r("div",Oe,[(_(!0),v(P,null,M(l.value,(n,o)=>(_(),v("div",{key:o,class:"rule-card"},[r("div",De,[a(e(V),{conv:A,style:{width:"240px"},options:T.value,value:n.tag,"onUpdate:value":d=>n.tag=d,disabled:!T.value.length,placeholder:e(t)("autoTag.inputTagName")},null,8,["options","value","onUpdate:value","disabled","placeholder"]),a(f,{type:"text",danger:"",onClick:d=>k(o)},{icon:s(()=>[a(e(j))]),_:2},1032,["onClick"])]),r("div",ze,[(_(!0),v(P,null,M(n.filters,(d,S)=>(_(),v("div",{key:S,class:"filter-row"},[a(I,{value:d.field,"onUpdate:value":h=>d.field=h,style:{width:"240px"},options:B.value},null,8,["value","onUpdate:value","options"]),a(I,{value:d.operator,"onUpdate:value":h=>d.operator=h,style:{width:"160px"},options:L.value},null,8,["value","onUpdate:value","options"]),a(O,{value:d.value,"onUpdate:value":h=>d.value=h,placeholder:e(t)("autoTag.value"),style:{flex:"1"}},null,8,["value","onUpdate:value","placeholder"]),a(f,{type:"text",danger:"",onClick:h=>m(n,S)},{icon:s(()=>[a(e(j))]),_:2},1032,["onClick"])]))),128)),a(f,{type:"dashed",block:"",onClick:d=>b(n),style:{"margin-top":"8px"}},{icon:s(()=>[a(e(J))]),default:s(()=>[w(" "+u(e(t)("autoTag.addFilter")),1)]),_:2},1032,["onClick"])])]))),128))]),l.value.length===0?(_(),v("div",Ge,u(e(t)("autoTag.noRules")),1)):x("",!0)])}}});const He=te(Ke,[["__scopeId","data-v-a56a2d27"]]),qe={class:"panel"},Je={class:"lang-select-wrap"},je={style:{"margin-top":"64px"}},Qe={style:{"margin-top":"64px"}},Ye={style:{"margin-left":"8px",color:"#666"}},Xe={style:{"margin-top":"0"}},Ze={style:{"padding-left":"8px",color:"#666"}},et={class:"shortcut-preset-desc"},tt={class:"shortcut-preset-section-title"},at={class:"shortcut-preset-grid shortcut-preset-grid-header"},ot={class:"mono"},lt={class:"shortcut-title-row"},nt={class:"col"},st=G({__name:"globalSetting",setup(H){const l=K(),c=ge(),T=E(!1),A=async()=>{window.location.reload()},g=[{value:"en",text:"English"},{value:"zhHans",text:"简体中文"},{value:"zhHant",text:"繁體中文"},{value:"de",text:"Deutsch"}],k=Z(n=>{const o=l.shortcut[n];["ctrl","shift"].includes(o.toLowerCase())&&(l.shortcut[n]="")},700),b=ve(()=>{D.warn(t("notAllowSingleCtrlOrShiftAsShortcut"))},3e3),m=(n,o)=>{const d=Me(n);["ctrl","shift"].includes(d.toLowerCase())&&(b(),k(o)),d&&(l.shortcut[o]=d)},F=async()=>{await Pe("shutdown_api_server_command"),await $e.removeFile(xe),await Ue()},B=U(()=>[{value:"empty",text:t("emptyStartPage")},{value:"last-workspace-state",text:t("restoreLastWorkspaceState")},...c.snapshots.map(o=>({value:`workspace_snapshot_${o.id}`,text:t("restoreWorkspaceSnapshot",[o.name])}))]),L=U(()=>{const n=l.shortcut,o={};return Object.values(n).forEach(d=>{var S;o[S=d+""]??(o[S]=0),o[d+""]++}),o}),p=U(()=>{var o;const n=[{key:"download",label:t("download")},{key:"delete",label:t("deleteSelected")}];return(o=l.conf)==null||o.all_custom_tags.forEach(d=>{n.push({key:`toggle_tag_${d.name}`,label:t("toggleTagSelection",{tag:d.name})})}),l.quickMovePaths.forEach(d=>{n.push({key:`copy_to_${d.dir}`,label:t("copyTo")+" "+d.zh})}),l.quickMovePaths.forEach(d=>{n.push({key:`move_to_${d.dir}`,label:t("moveTo")+" "+d.zh})}),n}),C=n=>n&&n in L.value&&L.value[n]>1,f=fe(ke+"disable_maximize",!1),I=E(!1),O=U(()=>[{title:t("shortcutPresetSectionBrowse"),items:[{keys:"PageUp / PageDown",location:t("shortcutPresetLocationFileList"),action:t("shortcutPresetActionPageJump")},{keys:"Home / End",location:t("shortcutPresetLocationFileList"),action:t("shortcutPresetActionHomeEnd")},{keys:"Backspace",location:t("shortcutPresetLocationFileList"),action:t("shortcutPresetActionBackspaceUp")},{keys:"Ctrl + A / Cmd + A",location:t("shortcutPresetLocationFileList"),action:t("shortcutPresetActionSelectAll")}]},{title:t("shortcutPresetSectionFullscreen"),items:[{keys:"ArrowLeft / ArrowRight / ArrowUp / ArrowDown",location:t("shortcutPresetLocationFullscreen"),action:t("shortcutPresetActionFullscreenNavigate")},{keys:"Esc",location:t("shortcutPresetLocationFullscreen"),action:t("shortcutPresetActionFullscreenExit")}]},{title:t("shortcutPresetSectionTiktok"),items:[{keys:"ArrowUp / ArrowDown",location:t("shortcutPresetLocationTiktok"),action:t("shortcutPresetActionTiktokNavigate")},{keys:"Esc",location:t("shortcutPresetLocationTiktok"),action:t("shortcutPresetActionTiktokExit")}]}]);return(n,o)=>{var q;const d=Ae,S=z,h=ae,$=oe,le=z,ne=W,N=Y,se=Fe,ie=Y,ue=Ie,re=ee,ce=Re;return _(),v("div",qe,[(q=e(l).conf)!=null&&q.is_readonly?(_(),R(d,{key:0,message:n.$t("readonlyModeSettingPageDesc"),type:"warning"},null,8,["message"])):x("",!0),x("",!0),a(ce,null,{default:s(()=>[a(h,{label:n.$t("lang")},{default:s(()=>[r("div",Je,[a(e(V),{options:g,value:e(l).lang,"onUpdate:value":o[0]||(o[0]=i=>e(l).lang=i),onChange:o[1]||(o[1]=i=>T.value=!0)},null,8,["value"])]),T.value?(_(),R(S,{key:0,type:"primary",onClick:A,ghost:""},{default:s(()=>[w(u(e(t)("langChangeReload")),1)]),_:1})):x("",!0)]),_:1},8,["label"]),r("h2",je,u(e(t)("ImageBrowsingSettings")),1),a(Ne),r("h2",Qe,u(e(t)("autoTag.name")),1),a(He),r("h2",null,"TikTok "+u(e(t)("view")),1),a(h,{label:n.$t("showTiktokNavigator")},{default:s(()=>[a($,{checked:e(l).showTiktokNavigator,"onUpdate:checked":o[2]||(o[2]=i=>e(l).showTiktokNavigator=i)},null,8,["checked"]),r("span",Ye,u(e(t)("showTiktokNavigatorDesc")),1)]),_:1},8,["label"]),r("h2",null,u(e(t)("imgSearch")),1),a(h,{label:n.$t("rebuildImageIndex")},{default:s(()=>[a(le,{onClick:e(be)},{default:s(()=>[w(u(n.$t("start")),1)]),_:1},8,["onClick"])]),_:1},8,["label"]),r("h2",null,u(e(t)("autoRefresh")),1),a(h,{label:n.$t("autoRefreshWalkMode")},{default:s(()=>[a($,{checked:e(l).autoRefreshWalkMode,"onUpdate:checked":o[3]||(o[3]=i=>e(l).autoRefreshWalkMode=i)},null,8,["checked"])]),_:1},8,["label"]),a(h,{label:n.$t("autoRefreshNormalFixedMode")},{default:s(()=>[a($,{checked:e(l).autoRefreshNormalFixedMode,"onUpdate:checked":o[4]||(o[4]=i=>e(l).autoRefreshNormalFixedMode=i)},null,8,["checked"])]),_:1},8,["label"]),a(h,{label:e(t)("autoRefreshWalkModePosLimit")},{default:s(()=>[a(ne,{min:0,max:1024,step:16,modelValue:e(l).autoRefreshWalkModePosLimit,"onUpdate:modelValue":o[5]||(o[5]=i=>e(l).autoRefreshWalkModePosLimit=i)},null,8,["modelValue"])]),_:1},8,["label"]),r("h2",Xe,u(e(t)("other")),1),a(h,{label:n.$t("fileTypeFilter")},{default:s(()=>[a(se,{value:e(l).fileTypeFilter,"onUpdate:value":o[6]||(o[6]=i=>e(l).fileTypeFilter=i)},{default:s(()=>[a(N,{value:"all"},{default:s(()=>[w(u(n.$t("allFiles")),1)]),_:1}),a(N,{value:"image"},{default:s(()=>[w(u(n.$t("image")),1)]),_:1}),a(N,{value:"video"},{default:s(()=>[w(u(n.$t("video")),1)]),_:1}),a(N,{value:"audio"},{default:s(()=>[w(u(n.$t("audio")),1)]),_:1})]),_:1},8,["value"])]),_:1},8,["label"]),a(h,{label:n.$t("showCommaInGenInfoPanel")},{default:s(()=>[a($,{checked:e(l).showCommaInInfoPanel,"onUpdate:checked":o[7]||(o[7]=i=>e(l).showCommaInInfoPanel=i)},null,8,["checked"])]),_:1},8,["label"]),a(h,{label:n.$t("showRandomImageInStartup")},{default:s(()=>[a($,{checked:e(l).showRandomImageInStartup,"onUpdate:checked":o[8]||(o[8]=i=>e(l).showRandomImageInStartup=i)},null,8,["checked"])]),_:1},8,["label"]),a(h,{label:n.$t("defaultSortingMethod")},{default:s(()=>[a(e(V),{value:e(l).defaultSortingMethod,"onUpdate:value":o[9]||(o[9]=i=>e(l).defaultSortingMethod=i),conv:e(ye),options:e(we)},null,8,["value","conv","options"])]),_:1},8,["label"]),a(h,{label:n.$t("longPressOpenContextMenu")},{default:s(()=>[a($,{checked:e(l).longPressOpenContextMenu,"onUpdate:checked":o[10]||(o[10]=i=>e(l).longPressOpenContextMenu=i)},null,8,["checked"])]),_:1},8,["label"]),a(h,{label:n.$t("openOnAppStart")},{default:s(()=>[a(e(V),{value:e(l).defaultInitinalPage,"onUpdate:value":o[11]||(o[11]=i=>e(l).defaultInitinalPage=i),options:B.value},null,8,["value","options"])]),_:1},8,["label"]),(_(!0),v(P,null,M(e(l).ignoredConfirmActions,(i,y)=>(_(),R(h,{label:n.$t(y+"SkipConfirm"),key:y},{default:s(()=>[a(ie,{checked:e(l).ignoredConfirmActions[y],"onUpdate:checked":de=>e(l).ignoredConfirmActions[y]=de},null,8,["checked","onUpdate:checked"])]),_:2},1032,["label"]))),128)),a(h,{label:n.$t("disableMaximize")},{default:s(()=>[a($,{checked:e(f),"onUpdate:checked":o[12]||(o[12]=i=>Ce(f)?f.value=i:null)},null,8,["checked"]),r("sub",Ze,u(n.$t("takeEffectAfterReloadPage")),1)]),_:1},8,["label"]),a(ue,{visible:I.value,"onUpdate:visible":o[13]||(o[13]=i=>I.value=i),title:e(t)("shortcutPresetTitle"),width:"800px",footer:null},{default:s(()=>[r("div",et,u(e(t)("shortcutPresetDesc")),1),(_(!0),v(P,null,M(O.value,i=>(_(),v("div",{class:"shortcut-preset-section",key:i.title},[r("div",tt,u(i.title),1),r("div",at,[r("div",null,u(e(t)("shortcutPresetHeaderKey")),1),r("div",null,u(e(t)("shortcutPresetHeaderWhere")),1),r("div",null,u(e(t)("shortcutPresetHeaderAction")),1)]),(_(!0),v(P,null,M(i.items,y=>(_(),v("div",{class:"shortcut-preset-grid",key:y.keys+y.action},[r("div",ot,u(y.keys),1),r("div",null,u(y.location),1),r("div",null,u(y.action),1)]))),128))]))),128))]),_:1},8,["visible","title"]),r("div",lt,[r("h2",null,u(e(t)("shortcutKey")),1)]),a(S,{type:"link",onClick:o[14]||(o[14]=i=>I.value=!0)},{default:s(()=>[w(u(e(t)("shortcutPresetButton")),1)]),_:1}),(_(!0),v(P,null,M(p.value,i=>(_(),R(h,{label:i.label,key:i.key},{default:s(()=>[r("div",{class:Se(["col",{conflict:C(e(l).shortcut[i.key]+"")}]),onKeydown:o[15]||(o[15]=Q(()=>{},["stop","prevent"]))},[a(re,{value:e(l).shortcut[i.key],onKeydown:Q(y=>m(y,i.key),["stop","prevent"]),placeholder:n.$t("shortcutKeyDescription")},null,8,["value","onKeydown","placeholder"]),a(S,{onClick:y=>e(l).shortcut[i.key]="",class:"clear-btn"},{default:s(()=>[w(u(n.$t("clear")),1)]),_:2},1032,["onClick"])],34)]),_:2},1032,["label"]))),128)),e(Te)?(_(),v(P,{key:0},[r("h2",null,u(e(t)("clientSpecificSettings")),1),a(h,null,{default:s(()=>[r("div",nt,[a(S,{onClick:F,class:"clear-btn"},{default:s(()=>[w(u(n.$t("initiateSoftwareStartupConfig")),1)]),_:1})])]),_:1})],64)):x("",!0)]),_:1})])}}});const ft=te(st,[["__scopeId","data-v-b9c6618b"]]);export{ft as default};