2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
import{d as G,r as K,$ as E,v as pe,aD as Z,o as g,k as v,c as a,y as s,z as e,ae as t,x as R,p as U,l as r,n as $,Y as x,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 ge,V as ee,q as te,as as _e,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 Ue,aO as xe,aA as Ie,U as Ae}from"./index-2865012e.js";import{_ as ae,F as Re}from"./index-117a691b.js";import"./index-6db1bae6.js";import"./index-50dada2e.js";/* empty css */import{_ as W,g as Me,C as Y,a as Fe}from"./shortcut-7cf3ed76.js";import{_ as oe}from"./index-85cde8a2.js";import"./index-de079109.js";/* empty css */import"./isArrayLikeObject-0a84f6f1.js";import"./index-dfe4c7be.js";const X="/infinite_image_browsing/fe-static/assets/sample-55dcafc6.webp",Le=["width","height","src"],Ne=G({__name:"ImageSetting",setup(H){function l(I,_){return new Promise(k=>{const b=new Image;b.onload=()=>{const m=document.createElement("canvas");m.width=b.width*_,m.height=b.height*_,m.getContext("2d").drawImage(b,0,0,m.width,m.height),k(m.toDataURL())},b.src=I})}const d=K(),T=E("");return pe(()=>[d.enableThumbnail,d.gridThumbnailResolution],Z(async()=>{d.enableThumbnail&&(T.value=await l(X,d.gridThumbnailResolution/1024))},300),{immediate:!0,deep:!0}),(I,_)=>{const k=ae,b=oe;return g(),v($,null,[a(k,{label:e(t)("defaultGridCellWidth")},{default:s(()=>[a(W,{min:64,max:1024,step:16,modelValue:e(d).defaultGridCellWidth,"onUpdate:modelValue":_[0]||(_[0]=m=>e(d).defaultGridCellWidth=m)},null,8,["modelValue"])]),_:1},8,["label"]),a(k,{label:e(t)("useThumbnailPreview")},{default:s(()=>[a(b,{checked:e(d).enableThumbnail,"onUpdate:checked":_[1]||(_[1]=m=>e(d).enableThumbnail=m)},null,8,["checked"])]),_:1},8,["label"]),e(d).enableThumbnail?(g(),R(k,{key:0,label:e(t)("thumbnailResolution")},{default:s(()=>[a(W,{modelValue:e(d).gridThumbnailResolution,"onUpdate:modelValue":_[2]||(_[2]=m=>e(d).gridThumbnailResolution=m),min:256,max:1024,step:64},null,8,["modelValue"])]),_:1},8,["label"])):U("",!0),a(k,{label:e(t)("livePreview")},{default:s(()=>[r("div",null,[r("img",{width:e(d).defaultGridCellWidth,height:e(d).defaultGridCellWidth,src:e(d).enableThumbnail?T.value:e(X)},null,8,Le)])]),_:1},8,["label"]),a(k,{label:e(t)("defaultShowChangeIndicators")},{default:s(()=>[a(b,{checked:e(d).defaultChangeIndchecked,"onUpdate:checked":_[3]||(_[3]=m=>e(d).defaultChangeIndchecked=m)},null,8,["checked"])]),_:1},8,["label"]),e(d).defaultChangeIndchecked?(g(),R(k,{key:1,label:e(t)("defaultSeedAsChange")},{default:s(()=>[a(b,{checked:e(d).defaultSeedChangeChecked,"onUpdate:checked":_[4]||(_[4]=m=>e(d).defaultSeedChangeChecked=m)},null,8,["checked"])]),_:1},8,["label"])):U("",!0),a(k,{label:e(t)("previewMaskBackgroundOpacity")},{default:s(()=>[a(W,{min:0,max:1,step:.05,modelValue:e(d).previewBgOpacity,"onUpdate:modelValue":_[5]||(_[5]=m=>e(d).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([]),d=K(),T=x(()=>{var h,C;return((C=(h=d.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=d.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:""})},m=(h,C)=>{h.filters.splice(C,1)},F=async()=>{try{await me("auto_tag_rules",l.value),D.success(t("autoTag.saveSuccess")),d.conf&&d.conf.app_fe_setting&&(d.conf.app_fe_setting.auto_tag_rules=l.value)}catch(h){D.error(t("autoTag.saveFail")+": "+h)}},B=x(()=>[{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=x(()=>[{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=ge,O=ee;return g(),v("div",Ve,[r("div",We,[r("div",Ee,u(e(t)("autoTag.description")),1),r("div",Be,[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})])]),r("div",Oe,[(g(!0),v($,null,M(l.value,(n,o)=>(g(),v("div",{key:o,class:"rule-card"},[r("div",De,[a(e(V),{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"])]),r("div",ze,[(g(!0),v($,null,M(n.filters,(c,S)=>(g(),v("div",{key:S,class:"filter-row"},[a(A,{value:c.field,"onUpdate:value":p=>c.field=p,style:{width:"240px"},options:B.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(O,{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=>m(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?(g(),v("div",Ge,u(e(t)("autoTag.noRules")),1)):U("",!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-left":"8px",color:"#666"}},Ze={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(),d=_e(),T=E(!1),I=async()=>{window.location.reload()},_=[{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 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(Ue),await xe()},B=x(()=>[{value:"empty",text:t("emptyStartPage")},{value:"last-workspace-state",text:t("restoreLastWorkspaceState")},...d.snapshots.map(o=>({value:`workspace_snapshot_${o.id}`,text:t("restoreWorkspaceSnapshot",[o.name])}))]),L=x(()=>{const n=l.shortcut,o={};return Object.values(n).forEach(c=>{var S;o[S=c+""]??(o[S]=0),o[c+""]++}),o}),h=x(()=>{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=E(!1),O=x(()=>[{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=ae,P=oe,le=z,ne=W,N=Y,se=Fe,ie=Y,ue=Ae,re=ee,de=Re;return g(),v("div",qe,[(q=e(l).conf)!=null&&q.is_readonly?(g(),R(c,{key:0,message:n.$t("readonlyModeSettingPageDesc"),type:"warning"},null,8,["message"])):U("",!0),U("",!0),a(de,null,{default:s(()=>[a(p,{label:n.$t("lang")},{default:s(()=>[r("div",Je,[a(e(V),{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?(g(),R(S,{key:0,type:"primary",onClick:I,ghost:""},{default:s(()=>[w(u(e(t)("langChangeReload")),1)]),_:1})):U("",!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(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"]),r("span",Ye,u(e(t)("showTiktokNavigatorDesc")),1)]),_:1},8,["label"]),r("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"]),r("span",Xe,u(e(t)("autoUpdateIndexDesc")),1)]),_:1},8,["label"]),r("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"]),r("h2",Ze,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(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(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(V),{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(V),{value:e(l).defaultInitinalPage,"onUpdate:value":o[12]||(o[12]=i=>e(l).defaultInitinalPage=i),options:B.value},null,8,["value","options"])]),_:1},8,["label"]),(g(!0),v($,null,M(e(l).ignoredConfirmActions,(i,y)=>(g(),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"]),r("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(()=>[r("div",tt,u(e(t)("shortcutPresetDesc")),1),(g(!0),v($,null,M(O.value,i=>(g(),v("div",{class:"shortcut-preset-section",key:i.title},[r("div",at,u(i.title),1),r("div",ot,[r("div",null,u(e(t)("shortcutPresetHeaderKey")),1),r("div",null,u(e(t)("shortcutPresetHeaderWhere")),1),r("div",null,u(e(t)("shortcutPresetHeaderAction")),1)]),(g(!0),v($,null,M(i.items,y=>(g(),v("div",{class:"shortcut-preset-grid",key:y.keys+y.action},[r("div",lt,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",nt,[r("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}),(g(!0),v($,null,M(h.value,i=>(g(),R(p,{label:i.label,key:i.key},{default:s(()=>[r("div",{class:Se(["col",{conflict:C(e(l).shortcut[i.key]+"")}]),onKeydown:o[16]||(o[16]=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)?(g(),v($,{key:0},[r("h2",null,u(e(t)("clientSpecificSettings")),1),a(p,null,{default:s(()=>[r("div",st,[a(S,{onClick:F,class:"clear-btn"},{default:s(()=>[w(u(n.$t("initiateSoftwareStartupConfig")),1)]),_:1})])]),_:1})],64)):U("",!0)]),_:1})])}}});const kt=te(it,[["__scopeId","data-v-edfb98d3"]]);export{kt as default};
|