var S=Object.defineProperty;var y=(a,t)=>S(a,"name",{value:t,configurable:!0});import{defineComponent as x,ref as m,onMounted as U,nextTick as V,openBlock as h,createElementBlock as C,normalizeClass as $,withDirectives as E,createElementVNode as o,vShow as N,unref as i,renderSlot as B,computed as d,createBlock as b,withCtx as _,toDisplayString as f,createVNode as n,withKeys as T,createTextVNode as M,createCommentVNode as R}from"vue";import z from"primevue/button";import D from"primevue/divider";import I from"primevue/inputtext";import K from"primevue/message";import j from"primevue/select";import{h as A}from"./vendor-vue-DcSPwzWW.js";import{a6 as J,b5 as O,bU as P,b9 as W}from"./index-D-xsHxvj.js";import"./vendor-other-CIK4VdqL.js";import"@primevue/themes";import"@primevue/themes/aura";import"primevue/config";import"primevue/confirmationservice";import"primevue/toastservice";import"primevue/tooltip";import"vue-i18n";import"primevue/skeleton";import"primevue/multiselect";import"primevue/iconfield";import"primevue/inputicon";import"primevue/checkbox";import"primevue/scrollpanel";import"primevue/usetoast";import"primevue/card";import"primevue/listbox";import"primevue/progressbar";import"primevue/floatlabel";import"@primevue/forms";import"@primevue/forms/resolvers/zod";import"primevue/password";import"primevue/progressspinner";import"primevue/tag";import"primevue/inputnumber";import"primevue/tabpanels";import"primevue/tabs";import"primevue/badge";import"primevue/chip";import"primevue/tabpanel";import"primevue/toggleswitch";import"primevue/colorpicker";import"primevue/radiobutton";import"primevue/knob";import"primevue/slider";import"primevue/panel";import"primevue/tabmenu";import"primevue/popover";import"primevue/tab";import"primevue/tablist";import"primevue";import"primevue/autocomplete";import"primevue/dropdown";import"./vendor-xterm-DV1MVhAx.js";import"./vendor-three-zdhtZbSm.js";import"primevue/galleria";import"primevue/contextmenu";import"primevue/tree";import"primevue/toolbar";import"primevue/selectbutton";import"primevue/dialog";import"primevue/confirmpopup";import"primevue/useconfirm";import"primevue/confirmdialog";import"./vendor-tiptap-CviL3hnV.js";import"primevue/blockui";const q={class:"flex w-full grow items-center justify-center overflow-auto"},F=x({__name:"BaseViewTemplate",props:{dark:{type:Boolean,default:!1}},setup(a){const t={color:"rgba(0, 0, 0, 0)",symbolColor:"#d4d4d4"},p={color:"rgba(0, 0, 0, 0)",symbolColor:"#171717"},l=m(null);return U(async()=>{J()&&(await V(),O().changeTheme({...a.dark?t:p,height:l.value?.getBoundingClientRect().height??0}))}),(r,u)=>(h(),C("div",{class:$(["flex h-svh w-screen flex-col font-sans",[r.dark?"dark-theme bg-neutral-900 text-neutral-300":"bg-neutral-300 text-neutral-900"]])},[E(o("div",{ref_key:"topMenuRef",ref:l,class:"app-drag h-(--comfy-topbar-height) w-full"},null,512),[[N,i(P)()]]),o("div",q,[B(r.$slots,"default")])],2))}}),G={id:"comfy-user-selection",class:"relative min-w-84 rounded-lg bg-(--comfy-menu-bg) p-5 px-10 shadow-lg"},H={class:"flex w-full flex-col items-center"},L={class:"flex w-full flex-col gap-2"},Q={for:"new-user-input"},X={class:"flex w-full flex-col gap-2"},Y={for:"existing-user-select"},Z={class:"mt-5"},ut=x({__name:"UserSelectView",setup(a){const t=W(),p=A(),l=m(null),r=m(""),u=m(""),v=d(()=>r.value.trim()!==""),k=d(()=>t.users.find(e=>e.username===r.value)?`User "${r.value}" already exists`:""),w=d(()=>k.value||u.value),g=y(async()=>{try{const e=v.value?await t.createUser(r.value):l.value;if(!e)throw new Error("No user selected");await t.login(e),await p.push("/")}catch(e){u.value=e instanceof Error?e.message:JSON.stringify(e)}},"login");return U(async()=>{t.initialized||await t.initialize()}),(e,s)=>(h(),b(F,{dark:""},{default:_(()=>[o("main",G,[s[2]||(s[2]=o("h1",{class:"my-2.5 mb-7 font-normal"},"ComfyUI",-1)),o("div",H,[o("div",L,[o("label",Q,f(e.$t("userSelect.newUser"))+":",1),n(i(I),{id:"new-user-input",modelValue:r.value,"onUpdate:modelValue":s[0]||(s[0]=c=>r.value=c),placeholder:e.$t("userSelect.enterUsername"),onKeyup:T(g,["enter"])},null,8,["modelValue","placeholder"])]),n(i(D)),o("div",X,[o("label",Y,f(e.$t("userSelect.existingUser"))+":",1),n(i(j),{modelValue:l.value,"onUpdate:modelValue":s[1]||(s[1]=c=>l.value=c),class:"w-full","input-id":"existing-user-select",options:i(t).users,"option-label":"username",placeholder:e.$t("userSelect.selectUser"),disabled:v.value},null,8,["modelValue","options","placeholder","disabled"]),w.value?(h(),b(i(K),{key:0,severity:"error"},{default:_(()=>[M(f(w.value),1)]),_:1})):R("",!0)]),o("footer",Z,[n(i(z),{label:e.$t("userSelect.next"),onClick:g},null,8,["label"])])])])]),_:1}))}});export{ut as default};
//# sourceMappingURL=UserSelectView-QGu01kL7.js.map
