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

2 lines
15 KiB
JavaScript

import{d as G,p as K,r as N,s as pe,av as Y,o as m,j as v,c as a,x as s,y as e,T as t,v as R,m as x,k as d,F as $,a1 as ee,a2 as te,af as U,ak as he,t as u,am as j,l as w,G as M,S as B,aw as J,ax as ge,R as O,$ as z,X as me,Z as ae,n as oe,aj as _e,ay as ve,az as fe,aA as ke,aB as be,aC as ye,K as we,B as Ce,Q as Se,z as Q,N as Te,aD as Pe,aE as $e,aF as xe,aG as Ue,as as Ie,V as Ae,a3 as Re}from"./index-0cf80cdf.js";import{_ as E,g as Me,C as X,a as Fe}from"./shortcut-76a3e0c5.js";/* empty css *//* empty css */const Z="/infinite_image_browsing/fe-static/assets/sample-55dcafc6.webp",Le=["width","height","src"],Ve=G({__name:"ImageSetting",setup(H){function l(I,_){return new Promise(k=>{const b=new Image;b.onload=()=>{const g=document.createElement("canvas");g.width=b.width*_,g.height=b.height*_,g.getContext("2d").drawImage(b,0,0,g.width,g.height),k(g.toDataURL())},b.src=I})}const r=K(),T=N("");return pe(()=>[r.enableThumbnail,r.gridThumbnailResolution],Y(async()=>{r.enableThumbnail&&(T.value=await l(Z,r.gridThumbnailResolution/1024))},300),{immediate:!0,deep:!0}),(I,_)=>{const k=ee,b=te;return m(),v($,null,[a(k,{label:e(t)("defaultGridCellWidth")},{default:s(()=>[a(E,{min:64,max:1024,step:16,modelValue:e(r).defaultGridCellWidth,"onUpdate:modelValue":_[0]||(_[0]=g=>e(r).defaultGridCellWidth=g)},null,8,["modelValue"])]),_:1},8,["label"]),a(k,{label:e(t)("useThumbnailPreview")},{default:s(()=>[a(b,{checked:e(r).enableThumbnail,"onUpdate:checked":_[1]||(_[1]=g=>e(r).enableThumbnail=g)},null,8,["checked"])]),_:1},8,["label"]),e(r).enableThumbnail?(m(),R(k,{key:0,label:e(t)("thumbnailResolution")},{default:s(()=>[a(E,{modelValue:e(r).gridThumbnailResolution,"onUpdate:modelValue":_[2]||(_[2]=g=>e(r).gridThumbnailResolution=g),min:256,max:1024,step:64},null,8,["modelValue"])]),_:1},8,["label"])):x("",!0),a(k,{label:e(t)("livePreview")},{default:s(()=>[d("div",null,[d("img",{width:e(r).defaultGridCellWidth,height:e(r).defaultGridCellWidth,src:e(r).enableThumbnail?T.value:e(Z)},null,8,Le)])]),_:1},8,["label"]),a(k,{label:e(t)("defaultShowChangeIndicators")},{default:s(()=>[a(b,{checked:e(r).defaultChangeIndchecked,"onUpdate:checked":_[3]||(_[3]=g=>e(r).defaultChangeIndchecked=g)},null,8,["checked"])]),_:1},8,["label"]),e(r).defaultChangeIndchecked?(m(),R(k,{key:1,label:e(t)("defaultSeedAsChange")},{default:s(()=>[a(b,{checked:e(r).defaultSeedChangeChecked,"onUpdate:checked":_[4]||(_[4]=g=>e(r).defaultSeedChangeChecked=g)},null,8,["checked"])]),_:1},8,["label"])):x("",!0),a(k,{label:e(t)("previewMaskBackgroundOpacity")},{default:s(()=>[a(E,{min:0,max:1,step:.05,modelValue:e(r).previewBgOpacity,"onUpdate:modelValue":_[5]||(_[5]=g=>e(r).previewBgOpacity=g)},null,8,["modelValue"])]),_:1},8,["label"])],64)}}}),Be={class:"auto-tag-settings"},Ee={class:"header"},Ne={class:"description"},We={class:"actions"},De={class:"rules-list"},Oe={class:"rule-header"},ze={class:"filters-list"},Ge={key:0,class:"empty-tip"},Ke=G({__name:"AutoTagSettings",setup(H){const l=N([]),r=K(),T=U(()=>{var h,C;return((C=(h=r.conf)==null?void 0:h.all_custom_tags)==null?void 0:C.filter(f=>f.type==="custom"))||[]}),I={value:h=>h.name,text:h=>h.display_name?`${h.display_name} : ${h.name}`:h.name};he(()=>{var C,f;const h=(f=(C=r.conf)==null?void 0:C.app_fe_setting)==null?void 0:f.auto_tag_rules;h&&(l.value=h)});const _=()=>{l.value.push({tag:"",filters:[]})},k=h=>{l.value.splice(h,1)},b=h=>{h.filters.push({field:"pos_prompt",operator:"contains",value:""})},g=(h,C)=>{h.filters.splice(C,1)},F=async()=>{try{await ge("auto_tag_rules",l.value),O.success(t("autoTag.saveSuccess")),r.conf&&r.conf.app_fe_setting&&(r.conf.app_fe_setting.auto_tag_rules=l.value)}catch(h){O.error(t("autoTag.saveFail")+": "+h)}},W=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(h,C)=>{const f=z,A=me,D=ae;return m(),v("div",Be,[d("div",Ee,[d("div",Ne,u(e(t)("autoTag.description")),1),d("div",We,[a(f,{type:"primary",onClick:_},{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})])]),d("div",De,[(m(!0),v($,null,M(l.value,(n,o)=>(m(),v("div",{key:o,class:"rule-card"},[d("div",Oe,[a(e(B),{conv:I,style:{width:"240px"},options:T.value,value:n.tag,"onUpdate:value":c=>n.tag=c,disabled:!T.value.length,placeholder:e(t)("autoTag.inputTagName")},null,8,["options","value","onUpdate:value","disabled","placeholder"]),a(f,{type:"text",danger:"",onClick:c=>k(o)},{icon:s(()=>[a(e(J))]),_:2},1032,["onClick"])]),d("div",ze,[(m(!0),v($,null,M(n.filters,(c,S)=>(m(),v("div",{key:S,class:"filter-row"},[a(A,{value:c.field,"onUpdate:value":p=>c.field=p,style:{width:"240px"},options:W.value},null,8,["value","onUpdate:value","options"]),a(A,{value:c.operator,"onUpdate:value":p=>c.operator=p,style:{width:"160px"},options:L.value},null,8,["value","onUpdate:value","options"]),a(D,{value:c.value,"onUpdate:value":p=>c.value=p,placeholder:e(t)("autoTag.value"),style:{flex:"1"}},null,8,["value","onUpdate:value","placeholder"]),a(f,{type:"text",danger:"",onClick:p=>g(n,S)},{icon:s(()=>[a(e(J))]),_:2},1032,["onClick"])]))),128)),a(f,{type:"dashed",block:"",onClick:c=>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?(m(),v("div",Ge,u(e(t)("autoTag.noRules")),1)):x("",!0)])}}});const He=oe(Ke,[["__scopeId","data-v-5bd94ce6"]]),qe={class:"panel"},je={class:"lang-select-wrap"},Je={style:{"margin-top":"64px"}},Qe={style:{"margin-top":"64px"}},Xe={style:{"margin-left":"8px",color:"#666"}},Ze={style:{"margin-left":"8px",color:"#666"}},Ye={style:{"margin-top":"0"}},et={style:{"padding-left":"8px",color:"#666"}},tt={class:"shortcut-preset-desc"},at={class:"shortcut-preset-section-title"},ot={class:"shortcut-preset-grid shortcut-preset-grid-header"},lt={class:"mono"},nt={class:"shortcut-title-row"},st={class:"col"},it=G({__name:"globalSetting",setup(H){const l=K(),r=_e(),T=N(!1),I=async()=>{window.location.reload()},_=[{value:"en",text:"English"},{value:"zhHans",text:"简体中文"},{value:"zhHant",text:"繁體中文"},{value:"de",text:"Deutsch"}],k=Y(n=>{const o=l.shortcut[n];["ctrl","shift"].includes(o.toLowerCase())&&(l.shortcut[n]="")},700),b=ve(()=>{O.warn(t("notAllowSingleCtrlOrShiftAsShortcut"))},3e3),g=(n,o)=>{const c=Me(n);["ctrl","shift"].includes(c.toLowerCase())&&(b(),k(o)),c&&(l.shortcut[o]=c)},F=async()=>{await Pe("shutdown_api_server_command"),await $e.removeFile(xe),await Ue()},W=U(()=>[{value:"empty",text:t("emptyStartPage")},{value:"last-workspace-state",text:t("restoreLastWorkspaceState")},...r.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(c=>{var S;o[S=c+""]??(o[S]=0),o[c+""]++}),o}),h=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(c=>{n.push({key:`toggle_tag_${c.name}`,label:t("toggleTagSelection",{tag:c.name})})}),l.quickMovePaths.forEach(c=>{n.push({key:`copy_to_${c.dir}`,label:t("copyTo")+" "+c.zh})}),l.quickMovePaths.forEach(c=>{n.push({key:`move_to_${c.dir}`,label:t("moveTo")+" "+c.zh})}),n}),C=n=>n&&n in L.value&&L.value[n]>1,f=fe(ke+"disable_maximize",!1),A=N(!1),D=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 c=Ie,S=z,p=ee,P=te,le=z,ne=E,V=X,se=Fe,ie=X,ue=Ae,de=ae,re=Re;return m(),v("div",qe,[(q=e(l).conf)!=null&&q.is_readonly?(m(),R(c,{key:0,message:n.$t("readonlyModeSettingPageDesc"),type:"warning"},null,8,["message"])):x("",!0),x("",!0),a(re,null,{default:s(()=>[a(p,{label:n.$t("lang")},{default:s(()=>[d("div",je,[a(e(B),{options:_,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?(m(),R(S,{key:0,type:"primary",onClick:I,ghost:""},{default:s(()=>[w(u(e(t)("langChangeReload")),1)]),_:1})):x("",!0)]),_:1},8,["label"]),d("h2",Je,u(e(t)("ImageBrowsingSettings")),1),a(Ve),d("h2",Qe,u(e(t)("autoTag.name")),1),a(He),d("h2",null,"TikTok "+u(e(t)("view")),1),a(p,{label:n.$t("showTiktokNavigator")},{default:s(()=>[a(P,{checked:e(l).showTiktokNavigator,"onUpdate:checked":o[2]||(o[2]=i=>e(l).showTiktokNavigator=i)},null,8,["checked"]),d("span",Xe,u(e(t)("showTiktokNavigatorDesc")),1)]),_:1},8,["label"]),d("h2",null,u(e(t)("imgSearch")),1),a(p,{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"]),a(p,{label:n.$t("autoUpdateIndex")},{default:s(()=>[a(P,{checked:e(l).autoUpdateIndex,"onUpdate:checked":o[3]||(o[3]=i=>e(l).autoUpdateIndex=i)},null,8,["checked"]),d("span",Ze,u(e(t)("autoUpdateIndexDesc")),1)]),_:1},8,["label"]),d("h2",null,u(e(t)("autoRefresh")),1),a(p,{label:n.$t("autoRefreshWalkMode")},{default:s(()=>[a(P,{checked:e(l).autoRefreshWalkMode,"onUpdate:checked":o[4]||(o[4]=i=>e(l).autoRefreshWalkMode=i)},null,8,["checked"])]),_:1},8,["label"]),a(p,{label:n.$t("autoRefreshNormalFixedMode")},{default:s(()=>[a(P,{checked:e(l).autoRefreshNormalFixedMode,"onUpdate:checked":o[5]||(o[5]=i=>e(l).autoRefreshNormalFixedMode=i)},null,8,["checked"])]),_:1},8,["label"]),a(p,{label:e(t)("autoRefreshWalkModePosLimit")},{default:s(()=>[a(ne,{min:0,max:1024,step:16,modelValue:e(l).autoRefreshWalkModePosLimit,"onUpdate:modelValue":o[6]||(o[6]=i=>e(l).autoRefreshWalkModePosLimit=i)},null,8,["modelValue"])]),_:1},8,["label"]),d("h2",Ye,u(e(t)("other")),1),a(p,{label:n.$t("fileTypeFilter")},{default:s(()=>[a(se,{value:e(l).fileTypeFilter,"onUpdate:value":o[7]||(o[7]=i=>e(l).fileTypeFilter=i)},{default:s(()=>[a(V,{value:"all"},{default:s(()=>[w(u(n.$t("allFiles")),1)]),_:1}),a(V,{value:"image"},{default:s(()=>[w(u(n.$t("image")),1)]),_:1}),a(V,{value:"video"},{default:s(()=>[w(u(n.$t("video")),1)]),_:1}),a(V,{value:"audio"},{default:s(()=>[w(u(n.$t("audio")),1)]),_:1})]),_:1},8,["value"])]),_:1},8,["label"]),a(p,{label:n.$t("showCommaInGenInfoPanel")},{default:s(()=>[a(P,{checked:e(l).showCommaInInfoPanel,"onUpdate:checked":o[8]||(o[8]=i=>e(l).showCommaInInfoPanel=i)},null,8,["checked"])]),_:1},8,["label"]),a(p,{label:n.$t("showRandomImageInStartup")},{default:s(()=>[a(P,{checked:e(l).showRandomImageInStartup,"onUpdate:checked":o[9]||(o[9]=i=>e(l).showRandomImageInStartup=i)},null,8,["checked"])]),_:1},8,["label"]),a(p,{label:n.$t("defaultSortingMethod")},{default:s(()=>[a(e(B),{value:e(l).defaultSortingMethod,"onUpdate:value":o[10]||(o[10]=i=>e(l).defaultSortingMethod=i),conv:e(ye),options:e(we)},null,8,["value","conv","options"])]),_:1},8,["label"]),a(p,{label:n.$t("longPressOpenContextMenu")},{default:s(()=>[a(P,{checked:e(l).longPressOpenContextMenu,"onUpdate:checked":o[11]||(o[11]=i=>e(l).longPressOpenContextMenu=i)},null,8,["checked"])]),_:1},8,["label"]),a(p,{label:n.$t("openOnAppStart")},{default:s(()=>[a(e(B),{value:e(l).defaultInitinalPage,"onUpdate:value":o[12]||(o[12]=i=>e(l).defaultInitinalPage=i),options:W.value},null,8,["value","options"])]),_:1},8,["label"]),(m(!0),v($,null,M(e(l).ignoredConfirmActions,(i,y)=>(m(),R(p,{label:n.$t(y+"SkipConfirm"),key:y},{default:s(()=>[a(ie,{checked:e(l).ignoredConfirmActions[y],"onUpdate:checked":ce=>e(l).ignoredConfirmActions[y]=ce},null,8,["checked","onUpdate:checked"])]),_:2},1032,["label"]))),128)),a(p,{label:n.$t("disableMaximize")},{default:s(()=>[a(P,{checked:e(f),"onUpdate:checked":o[13]||(o[13]=i=>Ce(f)?f.value=i:null)},null,8,["checked"]),d("sub",et,u(n.$t("takeEffectAfterReloadPage")),1)]),_:1},8,["label"]),a(ue,{visible:A.value,"onUpdate:visible":o[14]||(o[14]=i=>A.value=i),title:e(t)("shortcutPresetTitle"),width:"800px",footer:null},{default:s(()=>[d("div",tt,u(e(t)("shortcutPresetDesc")),1),(m(!0),v($,null,M(D.value,i=>(m(),v("div",{class:"shortcut-preset-section",key:i.title},[d("div",at,u(i.title),1),d("div",ot,[d("div",null,u(e(t)("shortcutPresetHeaderKey")),1),d("div",null,u(e(t)("shortcutPresetHeaderWhere")),1),d("div",null,u(e(t)("shortcutPresetHeaderAction")),1)]),(m(!0),v($,null,M(i.items,y=>(m(),v("div",{class:"shortcut-preset-grid",key:y.keys+y.action},[d("div",lt,u(y.keys),1),d("div",null,u(y.location),1),d("div",null,u(y.action),1)]))),128))]))),128))]),_:1},8,["visible","title"]),d("div",nt,[d("h2",null,u(e(t)("shortcutKey")),1)]),a(S,{type:"link",onClick:o[15]||(o[15]=i=>A.value=!0)},{default:s(()=>[w(u(e(t)("shortcutPresetButton")),1)]),_:1}),(m(!0),v($,null,M(h.value,i=>(m(),R(p,{label:i.label,key:i.key},{default:s(()=>[d("div",{class:Se(["col",{conflict:C(e(l).shortcut[i.key]+"")}]),onKeydown:o[16]||(o[16]=Q(()=>{},["stop","prevent"]))},[a(de,{value:e(l).shortcut[i.key],onKeydown:Q(y=>g(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)?(m(),v($,{key:0},[d("h2",null,u(e(t)("clientSpecificSettings")),1),a(p,null,{default:s(()=>[d("div",st,[a(S,{onClick:F,class:"clear-btn"},{default:s(()=>[w(u(n.$t("initiateSoftwareStartupConfig")),1)]),_:1})])]),_:1})],64)):x("",!0)]),_:1})])}}});const pt=oe(it,[["__scopeId","data-v-836d1aa8"]]);export{pt as default};