1import{u as j,j as e,E as U,m as C,r as t,a8 as v,G as N,S as f,s as x,z as S,B as M,aA as k,p as E}from"../index.js";function A(){const{t:d}=j();return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(U,{}),e.jsxs("div",{style:{height:C?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:[e.jsx("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:pt-6",children:e.jsx("p",{className:"text-lg leading-6 font-bold text-theme-text-primary md-6 border-white light:border-theme-sidebar-border border-b-2 border-opacity-10 py-4",children:d("security.title")})}),e.jsx(F,{}),e.jsx(I,{})]})]})}function F(){const[d,i]=t.useState(!1),[h,c]=t.useState(!1),[n,b]=t.useState(!1),[l,p]=t.useState(!1),[w,u]=t.useState(!0),{t:s}=j(),m=async a=>{if(a.preventDefault(),i(!0),c(!1),n){const r=new FormData(a.target),o={username:r.get("username"),password:r.get("password")},{success:g,error:y}=await f.setupMultiUser(o);if(g){x("Multi-User mode enabled successfully.","success"),i(!1),setTimeout(()=>{window.localStorage.removeItem(S),window.localStorage.removeItem(M),window.localStorage.removeItem(k),window.location=E.settings.users()},2e3);return}x(`Failed to enable Multi-User mode: ${y}`,"error"),i(!1);return}};return t.useEffect(()=>{async function a(){u(!0);const r=await f.isMultiUserMode();p(r),u(!1)}a()},[]),w?e.jsx("div",{className:"h-1/2 transition-all duration-500 relative md:ml-[2px] md:mr-[8px] md:my-[16px] md:rounded-[26px] p-[18px] h-full overflow-y-scroll",children:e.jsx("div",{className:"w-full h-full flex justify-center items-center",children:e.jsx(v,{})})}):e.jsx("form",{onSubmit:m,onChange:()=>c(!0),className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px]",children:e.jsxs("div",{className:"w-full flex flex-col gap-y-1 w-full flex flex-col gap-y-1 pb-6 border-white light:border-theme-sidebar-border border-b-2 border-opacity-10",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1",children:[e.jsx("div",{className:"items-center flex gap-x-4",children:e.jsx("p",{className:"text-base font-bold text-white mt-6",children:s("security.multiuser.title")})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-white text-opacity-60",children:s("security.multiuser.description")})]}),h&&e.jsx("div",{className:"flex justify-end",children:e.jsx(N,{onClick:()=>m(),className:"mt-3 mr-0 -mb-20 z-10",children:s(d?"common.saving":"common.save")})}),e.jsx("div",{className:"relative w-full max-h-full",children:e.jsxs("div",{className:"relative rounded-lg",children:[e.jsx("div",{className:"flex items-start justify-between px-6 py-4"}),e.jsx("div",{className:"space-y-6 flex h-full w-full",children:e.jsxs("div",{className:"w-full flex flex-col gap-y-4",children:[e.jsxs("div",{className:"",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:s(l?"security.multiuser.enable.is-enable":"security.multiuser.enable.enable")}),e.jsxs("label",{className:"relative inline-flex cursor-pointer items-center",children:[e.jsx("input",{type:"checkbox",onClick:()=>b(!n),defaultChecked:n,className:"peer sr-only pointer-events-none"}),e.jsx("div",{hidden:l,className:"peer-disabled:opacity-50 pointer-events-none peer h-6 w-11 rounded-full bg-[#CFCFD0] after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:shadow-xl after:border-none after:bg-white after:box-shadow-md after:transition-all after:content-[''] peer-checked:bg-[#32D583] peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-transparent"})]})]}),n&&e.jsxs("div",{className:"w-full flex flex-col gap-y-2 my-5",children:[e.jsxs("div",{className:"w-80",children:[e.jsx("label",{htmlFor:"username",className:"text-white text-sm font-semibold block mb-3",children:s("security.multiuser.enable.username")}),e.jsx("input",{name:"username",type:"text",className:"border-none bg-theme-settings-input-bg text-white text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5 placeholder:text-theme-settings-input-placeholder focus:ring-blue-500",placeholder:"Your admin username",minLength:2,required:!0,autoComplete:"off",disabled:l,defaultValue:l?"********":""})]}),e.jsxs("div",{className:"mt-4 w-80",children:[e.jsx("label",{htmlFor:"password",className:"text-white text-sm font-semibold block mb-3",children:s("security.multiuser.enable.password")}),e.jsx("input",{name:"password",type:"text",className:"border-none bg-theme-settings-input-bg text-white text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5 placeholder:text-theme-settings-input-placeholder focus:ring-blue-500",placeholder:"Your admin password",minLength:8,required:!0,autoComplete:"off",defaultValue:l?"********":""})]})]})]})}),e.jsx("div",{className:"flex items-center justify-between space-x-14",children:e.jsx("p",{className:"text-white text-opacity-80 text-xs rounded-lg w-96",children:s("security.multiuser.enable.description")})})]})})]})})}const T=new RegExp(/^[a-zA-Z0-9_\-!@$%^&*();]+$/);function I(){const[d,i]=t.useState(!1),[h,c]=t.useState(!1),[n,b]=t.useState(!1),[l,p]=t.useState(!1),[w,u]=t.useState(!0),{t:s}=j(),m=async a=>{if(a.preventDefault(),n)return!1;const r=new FormData(a.target);if(!T.test(r.get("password"))){x("Your password has restricted characters in it. Allowed symbols are _,-,!,@,$,%,^,&,*,
1(,),;","error"),i(!1);return}i(!0),c(!1);const o={usePassword:l,newPassword:r.get("password")},{success:g,error:y}=await f.updateSystemPassword(o);if(g){x("Your page will refresh in a few seconds.","success"),i(!1),setTimeout(()=>{window.localStorage.removeItem(S),window.localStorage.removeItem(M),window.localStorage.removeItem(k),window.location.reload()},3e3);return}else x(`Failed to update password: ${y}`,"error"),i(!1)};return t.useEffect(()=>{async function a(){u(!0);const r=await f.isMultiUserMode(),o=await f.keys();b(r),p(o==null?void 0:o.RequiresAuth),u(!1)}a()},[]),w?e.jsx("div",{className:"h-1/2 transition-all duration-500 relative md:ml-[2px] md:mr-[8px] md:my-[16px] md:rounded-[26px] p-[18px] h-full overflow-y-scroll",children:e.jsx("div",{className:"w-full h-full flex justify-center items-center",children:e.jsx(v,{})})}):n?null:e.jsx("form",{onSubmit:m,onChange:()=>c(!0),className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px]",children:e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white light:border-theme-sidebar-border border-b-2 border-opacity-10",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1",children:[e.jsx("div",{className:"items-center flex gap-x-4",children:e.jsx("p",{className:"text-base font-bold text-white mt-6",children:s("security.password.title")})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-white text-opacity-60",children:s("security.password.description")})]}),h&&e.jsx("div",{className:"flex justify-end",children:e.jsx(N,{onClick:()=>m(),className:"mt-3 mr-0 -mb-20 z-10",children:s(d?"common.saving":"common.save")})}),e.jsx("div",{className:"relative w-full max-h-full",children:e.jsxs("div",{className:"relative rounded-lg",children:[e.jsx("div",{className:"flex items-start justify-between px-6 py-4"}),e.jsx("div",{className:"space-y-6 flex h-full w-full",children:e.jsxs("div",{className:"w-full flex flex-col gap-y-4",children:[e.jsxs("div",{className:"",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-3",children:s("security.password.title")}),e.jsxs("label",{className:"relative inline-flex cursor-pointer items-center",children:[e.jsx("input",{type:"checkbox",onClick:()=>p(!l),defaultChecked:l,className:"peer sr-only pointer-events-none"}),e.jsx("div",{className:"peer-disabled:opacity-50 pointer-events-none peer h-6 w-11 rounded-full bg-[#CFCFD0] after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:shadow-xl after:border-none after:bg-white after:box-shadow-md after:transition-all after:content-[''] peer-checked:bg-[#32D583] peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-transparent"})]})]}),l&&e.jsx("div",{className:"w-full flex flex-col gap-y-2 my-5",children:e.jsxs("div",{className:"mt-4 w-80",children:[e.jsx("label",{htmlFor:"password",className:"text-white text-sm font-semibold block mb-3",children:s("security.password.password-label")}),e.jsx("input",{name:"password",type:"text",className:"border-none bg-theme-settings-input-bg text-white text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5 placeholder:text-theme-settings-input-placeholder",placeholder:"Your Instance Password",minLength:8,required:!0,autoComplete:"off",defaultValue:l?"********":""})]})})]})}),e.jsx("div",{className:"flex items-center justify-between space-x-14",children:e.jsx("p",{className:"text-white text-opacity-80 light:text-theme-text text-xs rounded-lg w-96",children:s("security.password.description")})})]})})]})})}export{A as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.