PageSourceSearch

https://xyc.ai/static/js/async/6092.ab71bc7c85.js

js xyc.ai collected 2026-10-05 14:39:55 UTC 17,647 bytes, 1 lines download raw bytes

1"use strict";(self.rspackChunknewapi_web=self.rspackChunknewapi_web||[]).push([[6092],{92964(e,s,a){a.d(s,{C:()=>d,z:()=>o});var t=a(72361),r=a(7649),i=a(70435),n=a(61409),l=a(81204);function o(e){let{className:s,...a}=e;return(0,t.jsx)(n.z,{"data-slot":"radio-group",className:(0,l.cn)("grid w-full gap-2",s),...a})}function d(e){let{className:s,...a}=e;return(0,t.jsx)(r.U,{"data-slot":"radio-group-item",className:(0,l.cn)("group/radio-group-item peer border-input focus-visible:border-ring focus-visible:ring-ring/25 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary relative flex aspect-square size-4 shrink-0 rounded-full border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",s),...a,children:(0,t.jsx)(i.T,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:(0,t.jsx)("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}},73879(e,s,a){a.r(s),a.d(s,{component:()=>J});var t=a(72361),r=a(68413),i=a(86832),n=a(96962),l=a(53540),o=a(55667),d=a(82799),c=a(6702),m=a(20598),u=a(81204),x=a(38610),h=a(31005),p=a(97077),g=a(18434),f=a(61631),y=a(46775),j=a(15648),b=a(20769);function N(e){let{t:s}=(0,c.Bd)(),a=e.icon??f.hcu;return(0,t.jsx)(b._A,{children:(0,t.jsxs)(j.Sv,{className:(0,u.cn)("min-h-[300px]",e.className),children:[(0,t.jsxs)(j.FT,{children:[(0,t.jsx)(j.Kr,{variant:"icon",children:(0,t.jsx)(a,{className:"text-destructive size-6"})}),(0,t.jsx)(j.cz,{children:e.title??s("Oops! Something went wrong")}),null!=e.description&&(0,t.jsx)(j.Ou,{children:e.description})]}),(0,t.jsxs)(j.HY,{children:[null!=e.onRetry&&(0,t.jsx)(y.$,{variant:"outline",size:"sm",onClick:e.onRetry,children:s("Retry")}),e.action]})]})})}let w={sm:"size-4",md:"size-6",lg:"size-8"};function v(e){let{t:s}=(0,c.Bd)(),a=w[e.size??"md"];return e.inline?(0,t.jsxs)("span",{className:(0,u.cn)("inline-flex items-center gap-2",e.className),children:[(0,t.jsx)(f.krw,{className:(0,u.cn)(a,"animate-spin")}),null!=e.message&&(0,t.jsx)("span",{className:"text-muted-foreground text-sm",children:e.message})]}):(0,t.jsxs)("div",{className:(0,u.cn)("flex min-h-[200px] flex-col items-center justify-center gap-3",e.className),children:[(0,t.jsx)("div",{className:"animate-spin",children:(0,t.jsx)(f.krw,{className:a})}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:e.message??s("Loading...")})]})}var k=a(43923),z=a(77405),C=a(54023),S=a(10032);function K(e){let{form:s,rootInitialized:a}=e,{t:r}=(0,c.Bd)();return a?(0,t.jsx)(z.Fc,{className:"border-sky-200 bg-sky-50 dark:border-sky-900/60 dark:bg-sky-950/40",children:(0,t.jsxs)(z.TN,{className:"flex items-start gap-2",children:[(0,t.jsx)(f.oxo,{
1className:"mt-0.5 size-4 text-sky-500"}),r("The administrator account is already initialized. You can keep your existing credentials and continue to the next step.")]})}):(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,t.jsx)(p.zB,{control:s.control,name:"username",render:e=>{let{field:a}=e;return(0,t.jsxs)(p.eI,{children:[(0,t.jsx)(p.lR,{children:r("Administrator username")}),(0,t.jsx)(p.MJ,{children:(0,t.jsx)(C.p,{...a,placeholder:r("Choose a username"),autoComplete:"username",onChange:e=>{s.clearErrors("username"),a.onChange(e)}})}),(0,t.jsx)(p.C5,{})]})}}),(0,t.jsx)(p.zB,{control:s.control,name:"password",render:e=>{let{field:a}=e;return(0,t.jsxs)(p.eI,{children:[(0,t.jsx)(p.lR,{children:r("Password")}),(0,t.jsx)(p.MJ,{children:(0,t.jsx)(S.y,{...a,placeholder:r("Set a secure password (min. 8 characters)"),autoComplete:"new-password",onChange:e=>{s.clearErrors("password"),a.onChange(e)}})}),(0,t.jsx)(p.C5,{})]})}}),(0,t.jsx)(p.zB,{control:s.control,name:"confirmPassword",render:e=>{let{field:a}=e;return(0,t.jsxs)(p.eI,{className:"sm:col-span-2",children:[(0,t.jsx)(p.lR,{children:r("Confirm password")}),(0,t.jsx)(p.MJ,{children:(0,t.jsx)(S.y,{...a,placeholder:r("Repeat the administrator password"),autoComplete:"new-password",onChange:e=>{s.clearErrors("confirmPassword"),a.onChange(e)}})}),(0,t.jsx)(p.C5,{})]})}})]})}var M=a(72690),P=a(3088);let R={external:"External operations mode",self:"Personal use mode",demo:"Demo site mode"},V={sqlite:"warning",mysql:"success",postgres:"success"};function E(e){let{status:s,values:a}=e,{t:r}=(0,c.Bd)(),i=R[a.usageMode],n=s?.database_type??"Unknown",l=V[n.toLowerCase()]??"neutral";return(0,t.jsxs)("div",{className:"flex flex-col items-center gap-6 text-center",children:[(0,t.jsx)("div",{className:"rounded-2xl bg-emerald-500/10 p-4 text-emerald-600 dark:bg-emerald-500/20 dark:text-emerald-300",children:(0,t.jsx)(f.Jly,{className:"size-8"})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h2",{className:"text-2xl font-semibold tracking-tight",children:r("Ready to initialize")}),(0,t.jsx)("p",{className:"text-muted-foreground max-w-lg text-sm sm:text-base",children:r("Double check the configuration below. Your system will be locked until initialization is complete.")})]}),(0,t.jsx)("div",{className:"bg-card w-full rounded-xl border p-6 text-left shadow-sm sm:p-8",children:(0,t.jsxs)("dl",{className:"grid gap-6",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("dt",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:r("Database")}),(0,t.jsxs)("dd",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-semibold",children:n}),(0,t.jsx)(P.Wh,{label:n,variant:l,copyable:!1})]})]}),(0,t.jsx)(M.w,{}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("dt",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:r("Administrator account")}),(0,t.jsx)("dd",{className:"text-sm font-semibold",children:s?.root_init?r("Existing account will be reused"):a.username||r("Not set yet")})]}),(0,t.jsx)(M.w,{}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("dt",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:r("Usage mode")}),(0,t.jsx)("dd",{className:"text-sm font-semibold",children:r(i)})]})]})})]})}let L={sqlite:{label:"SQLite",descriptionKey:"SQLite stores all data in a single file. Make sure that file is persisted 
1when running in containers.",variant:"warning"},mysql:{label:"MySQL",descriptionKey:"MySQL is a production-ready relational database. Keep your credentials secure.",variant:"success"},postgres:{label:"PostgreSQL",descriptionKey:"PostgreSQL offers advanced reliability and data integrity for production workloads.",variant:"success"}};function B(e){var s;let{status:a}=e,{t:r}=(0,c.Bd)(),i=(s=a?.database_type)?L[s.toLowerCase()]??{label:s,descriptionKey:"Custom database driver detected.",variant:"info"}:null,n="u">typeof window?window?.electron:void 0,l=!!n?.isElectron,o=n?.dataDir;return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"bg-card flex items-center justify-between rounded-lg border p-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-muted-foreground text-sm font-medium",children:r("Detected database")}),(0,t.jsx)("p",{className:"text-foreground text-base font-semibold",children:i?.label??r("Unknown")}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:r(i?.descriptionKey??"The setup wizard will use this database during initialization.")})]}),(0,t.jsx)(P.Wh,{label:i?.label??r("Unknown"),variant:i?.variant??"info",className:"cursor-default",copyable:!1,icon:f.WmV})]}),a?.database_type==="sqlite"&&(0,t.jsxs)(z.Fc,{className:"border-amber-200 bg-amber-50 dark:border-amber-900/60 dark:bg-amber-950/40",children:[(0,t.jsxs)(z.XL,{className:"flex items-center gap-2",children:[(0,t.jsx)(f.akk,{className:"size-4 text-amber-500"}),r("Persist your data file")]}),(0,t.jsxs)(z.TN,{children:[(0,t.jsx)("p",{children:r("When running in containers or ephemeral environments, ensure the SQLite file is mapped to persistent storage to avoid data loss on restart.")}),l&&o&&(0,t.jsxs)("p",{className:"mt-3 rounded-md bg-amber-100/70 px-3 py-2 font-mono text-xs text-amber-800 dark:bg-amber-900/30 dark:text-amber-200",children:[r("Data directory:")," ",o]}),l&&!o&&(0,t.jsx)("p",{className:"text-muted-foreground mt-3 text-xs",children:r("Data is stored locally on this device. Use system backups to keep a safe copy.")})]})]}),a?.database_type==="mysql"&&(0,t.jsxs)(z.Fc,{className:"border-emerald-200 bg-emerald-50 dark:border-emerald-900/60 dark:bg-emerald-950/40",children:[(0,t.jsxs)(z.XL,{className:"flex items-center gap-2",children:[(0,t.jsx)(f.gq4,{className:"size-4 text-emerald-500"}),r("MySQL detected")]}),(0,t.jsx)(z.TN,{children:r("MySQL is production ready. Ensure automated backups and a dedicated user with the minimal required privileges are configured.")})]}),a?.database_type==="postgres"&&(0,t.jsxs)(z.Fc,{className:"border-sky-200 bg-sky-50 dark:border-sky-900/60 dark:bg-sky-950/40",children:[(0,t.jsxs)(z.XL,{className:"flex items-center gap-2",children:[(0,t.jsx)(f.gq4,{className:"size-4 text-sky-500"}),r("PostgreSQL detected")]}),(0,t.jsx)(z.TN,{children:r("PostgreSQL offers strong reliability guarantees. Double check your maintenance window and retention policies before going live.")})]})]})}function D(e){let{currentStep:s,totalSteps:a,onBack:r,onNext:i,onSubmit:n,isSubmitting:l=!1}=e,{t:o}=(0,c.Bd)(),d=s===a-1;return(0,t.jsxs)("div",{className:"flex w-full flex-col gap-3 sm:flex-row sm:items-center",children:[(0,t.jsx)("div",{className:"flex justify-end gap-2 sm:justify-start",children:0!==s&&(0,t.jsx)(y.$,{type:"button",variant:"outline",onClick:r,children:o("Back")})}),(0,t.jsxs)("div",{className:"flex flex-1 justify-end gap-2",children:[!d&&(0,t.jsx)(y.$,{type:"button",onClick:i,children:o("Next")}),d&&(0,t.jsx)(y.$,{type:"button",onClick:n,disabled:l,children:l?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.krw,{className:"mr-2 size-4 animate-spin"}),o("Initializing…")]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.Jly,{className:"mr-2 size-4"}),o("Initialize system")]})})]})]})}var T=a(61309),F=a(92964);let q=[{value:"external",titleKey:"External operations",descriptionKey:"Serve multiple users or teams with billing and quota control.",icon:f.t6i},{value:"self",titleKey:"Personal use",descriptionKey:"Best for single-tenant deployments. Pricing and billing options stay hidden.",icon:f.ww0},{value:"demo",titleKey:"Demo site",descriptionKey:"Showcase core capabilities with demo credentials and limited access.",icon:f.Jm9}];function _(e){let{form:s}=e,{t:a}=(0,c.Bd)();return(0,t.jsx)(p.zB,{control:s.control,name:"usageMode",render:e=>{let{field:r}=e;return(0,t.jsxs)(p.eI,{children:[(0,t.jsx)(p.lR,{children:a("How will you use the platform?")}),(0,t.jsx)(p.MJ,{children:(0,t.jsx)(F.z,{value:r.value,onValueChange:e=>
1{s.clearErrors("usageMode"),r.onChange(e)},className:"grid gap-3 sm:grid-cols-3",children:q.map(e=>{let{value:s,titleKey:r,descriptionKey:i,icon:n}=e;return(0,t.jsx)(T.J,{htmlFor:`usage-mode-${s}`,className:(0,u.cn)("hover:border-primary/40 focus-within:border-primary/50 has-data-[checked]:border-primary has-data-[checked]:ring-primary/20 group bg-card border-muted flex cursor-pointer flex-col gap-3 rounded-xl border p-4 font-normal transition-all has-data-[checked]:ring-2"),children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(F.C,{id:`usage-mode-${s}`,value:s,className:"mt-1"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(T.J,{htmlFor:`usage-mode-${s}`,className:"text-base leading-none font-semibold",children:a(r)}),(0,t.jsx)("p",{className:"text-muted-foreground mt-2 text-sm",children:a(i)})]}),(0,t.jsx)(n,{className:"text-muted-foreground/70 group-hover:text-primary group-focus-within:text-primary group-has-data-[checked]:text-primary ml-auto size-5 shrink-0 transition"})]})},s)})})}),(0,t.jsx)(p.C5,{})]})}})}let Q=[{titleKey:"Database check",descriptionKey:"Verify your database connection"},{titleKey:"Administrator account",descriptionKey:"Create credentials for the root user"},{titleKey:"Usage mode",descriptionKey:"Choose how the platform will operate"},{titleKey:"Review & initialize",descriptionKey:"Confirm settings and finish setup"}],I={username:"",password:"",confirmPassword:"",usageMode:"external"},J=function(){let{t:e}=(0,c.Bd)(),s=(0,d.Z)(),a=(0,n.jE)(),{systemName:f,logo:y,loading:j}=(0,x.R)(),[b,w]=(0,r.useState)(0),[z,C]=(0,r.useState)(),S=(0,i.mN)({defaultValues:I,mode:"onBlur"}),M=S.watch(),{data:P,isLoading:R,isError:V,refetch:L}=(0,l.I)({queryKey:["setup-status"],queryFn:k.YA,retry:!1}),T=(0,o.n)({mutationKey:["setup-submit"],mutationFn:k.OF,onSuccess:async t=>{t.success?(m.oR.success(e("System initialized successfully! Redirecting…")),await a.invalidateQueries({queryKey:["setup-status"]}),setTimeout(()=>{s({to:"/"})},1200)):m.oR.error(t.message||e("Initialization failed, please try again."))},onError:()=>{m.oR.error(e("Failed to initialize system"))}});(0,r.useEffect)(()=>{if(!P)return;if(!P.success)return void m.oR.error(P.message||e("Failed to load setup status"));let a=P.data;if(a){if(a.status)return void s({to:"/"});C(a),w(0),a.SelfUseModeEnabled?S.setValue("usageMode","self",{shouldDirty:!1,shouldTouch:!1,shouldValidate:!1}):a.DemoSiteEnabled?S.setValue("usageMode","demo",{shouldDirty:!1,shouldTouch:!1,shouldValidate:!1}):S.setValue("usageMode","external",{shouldDirty:!1,shouldTouch:!1,shouldValidate:!1})}},[P,s,S]),(0,r.useEffect)(()=>{z&&z.root_init&&(S.setValue("username","",{shouldDirty:!1,shouldTouch:!1,shouldValidate:!1}),S.setValue("password","",{shouldDirty:!1,shouldTouch:!1,shouldValidate:!1}),S.setValue("confirmPassword","",{shouldDirty:!1,shouldTouch:!1,shouldValidate:!1}))},[z,S]);let F=(0,r.useMemo)(()=>0===b?(0,t.jsx)(B,{status:z}):1===b?(0,t.jsx)(K,{form:S,rootInitialized:!!z?.root_init}):2===b?(0,t.jsx)(_,{form:S}):(0,t.jsx)(E,{status:z,values:M}),[b,z,S,M]),q=()=>{if(z?.root_init)return!0;let s=S.getValues("username")?.trim(),a=S.getValues("password")?.trim(),t=S.getValues("confirmPassword")?.trim();return s?!a||a.length<8?(S.setError("password",{type:"manual",message:e("Password must be at least 8 characters long")}),m.oR.error(e("Password must be at least 8 characters long")),!1):a===t||(S.setError("confirmPassword",{type:"manual",message:e("Passwords do not match")}),m.oR.error(e("Passwords do not match")),!1):(S.setError("username",{type:"manual",message:e("Please enter an administrator username")}),m.oR.error(e("Please enter an administrator username")),!1)},J=()=>!!S.getValues("usageMode")||(S.setError("usageMode",{type:"manual",message:e("Select a usage mode to continue")}),m.oR.error(e("Select a usage mode to continue")),!1),U=async()=>{let e=q(),s=J();if(!e||!s)return;let a=(0,k.s_)(S.getValues(),!!z?.root_init);T.mutate(a)};return(0,t.jsx)("div",{className:"bg-muted/40 relative min-h-svh py-10",children:(0,t.jsxs)("div",{className:"container mx-auto flex max-w-5xl flex-col gap-8 px-4 sm:px-6",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,t.jsx)("div",{className:"relative h-12 w-12",children:j?(0,t.jsx)(g.E,{className:"absolute inset-0 rounded-full"}):(0,t.jsx)("img",{src:y,alt:e("System logo"),className:"h-12 w-12 rounded-full object-cover shadow-sm"})}),j?(0,t.jsx)(g.E,{className:"h-7 w-40"}):(0,t.jsxs)("h1",{className:"text-2xl font-semibold tracking-tight",children:[e("Initialize")," ",f]}),(0,t.jsx)("p",{className:"text-muted-foreground text-center text-sm sm:text-base",children:e("Follow the guided steps to prepare your workspace before the first login.")})]}),(0,t.jsxs)(h.Zp,{className:"shadow-lg",children:[(0,t.jsxs)(h.aR,{className:"space-y-2",children:[(0,t.jsx)(h.ZB,{className:"text-xl font-semibold",children:e("System setup wizard")}),(0,t.jsx)(h.BT,{children:e("Complete these steps to finish the initial installation.")})]}),(0,t.jsxs)(h.Wu,{className:"space-y-6",children:[(0,t.jsx)("ol",{className:"grid gap-3 sm:grid-cols-4",children:Q.map((s,a)=>{let r=b===a,i=b>a;return(0,t.jsx)("li",{className:(0,u.cn)("rounded-xl border p-3",r?"border-primary ring-primary/20 ring-2":i?"border-primary/40 bg-primary/5":"border-muted bg-card"),children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("span",{className:(0,u.cn)("flex size-6 items-center justify-center rounded-md border text-xs font-semibold",r||i?"border-primary bg-primary text-primary-foreground":"border-muted-foreground
1/40 text-muted-foreground"),children:a+1}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-sm font-semibold",children:e(s.titleKey)}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:e(s.descriptionKey)})]})]})},s.titleKey)})}),R?(0,t.jsx)(v,{message:e("Loading setup status…")}):V?(0,t.jsx)(N,{title:e("We could not load the setup status."),onRetry:()=>L()}):(0,t.jsx)(p.lV,{...S,children:(0,t.jsx)("form",{className:"space-y-6",onSubmit:e=>e.preventDefault(),children:F})})]}),!R&&!V&&(0,t.jsx)(h.wL,{className:"w-full justify-end border-t",children:(0,t.jsx)(D,{currentStep:b,totalSteps:Q.length,onBack:()=>{w(e=>Math.max(e-1,0))},onNext:()=>{1===b&&!q()||(2!==b||J())&&w(e=>Math.min(e+1,Q.length-1))},onSubmit:U,isSubmitting:T.isPending})})]})]})})}}}]);

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.