Quantumbraid's picture
download
raw
124 kB
exports.id=4723,exports.ids=[4723],exports.modules={499:(a,b,c)=>{"use strict";c.d(b,{A:()=>f});var d=c(21124),e=c(49377);let f=()=>{let{theme:a}=(0,e.D)();return(0,d.jsx)("img",{src:"dark"===a?"/ostris_logo.png":"/ostris_logo_black.png",alt:"Ostris AI Toolkit",className:"w-auto h-7 mr-3 inline"})}},866:(a,b,c)=>{"use strict";c.d(b,{CaptionDatasetModal:()=>e});var d=c(97954);(0,d.registerClientReference)(function(){throw Error("Attempted to call captionDatasetModalState() from the server but captionDatasetModalState is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/CaptionDatasetModal.tsx","captionDatasetModalState"),(0,d.registerClientReference)(function(){throw Error("Attempted to call openCaptionDatasetModal() from the server but openCaptionDatasetModal is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/CaptionDatasetModal.tsx","openCaptionDatasetModal");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call CaptionDatasetModal() from the server but CaptionDatasetModal is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/CaptionDatasetModal.tsx","CaptionDatasetModal")},4508:(a,b,c)=>{"use strict";c.d(b,{P:()=>h,default:()=>i});var d=c(21124),e=c(44806),f=c(12999);c(38301);let g=(0,e.VB)(null),h=a=>{g.set({...a})};function i(){let[a,b]=g.use(),c=!!a,e=()=>{b(null)};return(0,d.jsxs)(f.lG,{open:c,onClose:e,className:"relative z-10",children:[(0,d.jsx)(f.Xi,{transition:!0,className:"fixed inset-0 bg-gray-900/75 transition-opacity data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in"}),(0,d.jsx)("div",{className:"fixed inset-0 z-10 w-screen overflow-y-auto",children:(0,d.jsx)("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:(0,d.jsxs)(f.Lj,{transition:!0,className:"relative transform overflow-hidden rounded-lg bg-gray-800 text-left shadow-xl transition-all data-closed:translate-y-4 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:my-8 sm:w-full sm:max-w-[50rem] data-closed:sm:translate-y-0 data-closed:sm:scale-95",children:[(0,d.jsx)("div",{className:"bg-gray-800 px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,d.jsx)("div",{className:"sm:flex sm:items-start",children:(0,d.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left flex-1",children:[(0,d.jsx)(f.L3,{as:"h3",className:"text-base font-semibold ",children:a?.title||"Confirm Action"}),(0,d.jsx)("div",{className:"mt-2 text-sm text-gray-200",children:a?.description})]})})}),(0,d.jsx)("div",{className:"bg-gray-700 px-4 py-3 sm:flex sm:flex-row-reverse sm:px-6",children:(0,d.jsx)("button",{type:"button","data-autofocus":!0,onClick:e,className:"mt-3 inline-flex w-full justify-center rounded-md bg-gray-800 px-3 py-2 text-sm font-semibold text-gray-200 hover:bg-gray-800 sm:mt-0 sm:w-auto ring-0",children:"Close"})})]})})})]})}},7518:(a,b,c)=>{"use strict";c.d(b,{default:()=>e});var d=c(97954);(0,d.registerClientReference)(function(){throw Error("Attempted to call promptBoxEditorState() from the server but promptBoxEditorState is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/PromptBoxEditorModal.tsx","promptBoxEditorState"),(0,d.registerClientReference)(function(){throw Error("Attempted to call openPromptBoxEditor() from the server but openPromptBoxEditor is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/PromptBoxEditorModal.tsx","openPromptBoxEditor");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call the default export of \"/app/ai-toolkit/ui/src/components/PromptBoxEditorModal.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/PromptBoxEditorModal.tsx","default")},8474:(a,b,c)=>{"use strict";c.d(b,{default:()=>g});var d=c(21124),e=c(38301),f=c(74776);function g({authRequired:a,children:b}){let[c,g]=(0,e.useState)(""),[h,i]=f.F.use(),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(""),[n,o]=(0,e.useState)(!1),p=(0,e.useRef)(null),q=async()=>{let b=localStorage.getItem("AI_TOOLKIT_AUTH")||"";if(a&&!j&&""!==b){k(!0),m("");try{(await f.u.get("/api/auth")).data.isAuthenticated?i(!0):(i(!1),m("Invalid token. Please try again."))}catch(a){i(!1),console.log(a),m("Invalid token. Please try again.")}k(!1)}},r=async a=>{if(a.preventDefault(),m(""),!c.trim())return void m("Please enter your token");n&&(localStorage.setItem("AI_TOOLKIT_AUTH",c),q())};return!a||h?(0,d.jsx)(d.Fragment,{children:b}):(0,d.jsxs)("div",{className:"flex min-h-screen bg-gray-900 text-gray-100 absolute top-0 left-0 right-0 bottom-0 scroll-auto",children:[(0,d.jsxs)("div",{className:"hidden lg:flex lg:w-1/2 bg-gray-800 flex-col justify-center items-center p-12",children:[(0,d.jsx)("div",{className:"mb-4",children:(0,d.jsx)("div",{className:"flex items-center justify-center",children:(0,d.jsx)("img",{src:"/ostris_logo.png",alt:"Ostris AI Toolkit",className:"w-auto h-24 inline"})})}),(0,d.jsx)("h1",{className:"text-4xl mb-6",children:"AI Toolkit"})]}),(0,d.jsx)("div",{className:"w-full lg:w-1/2 flex flex-col justify-center items-center p-8 sm:p-12",children:(0,d.jsxs)("div",{className:"w-full max-w-md",children:[(0,d.jsx)("div",{className:"lg:hidden flex justify-center mb-4",children:(0,d.jsx)("div",{className:"flex items-center justify-center",children:(0,d.jsx)("img",{src:"/ostris_logo.png",alt:"Ostris AI Toolkit",className:"w-auto h-24 inline"})})}),(0,d.jsx)("h2",{className:"text-3xl text-center mb-2 lg:hidden",children:"AI Toolkit"}),(0,d.jsxs)("form",{onSubmit:r,className:"space-y-6",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"token",className:"block text-sm font-medium text-gray-400 mb-2",children:"Password"}),(0,d.jsx)("input",{id:"token",name:"token",type:"password",autoComplete:"off",required:!0,value:c,ref:p,onChange:a=>g(a.target.value),className:"w-full px-4 py-3 rounded-lg bg-gray-800 border border-gray-700 focus:border-blue-500 focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50 text-gray-100 transition duration-200",placeholder:"Enter your password"}),(0,d.jsx)("div",{className:"text-gray-500 text-xs mt-2",children:'The password is set with the environment variable AI_TOOLKIT_AUTH, the default is the super secure secret word "password"'})]}),l&&(0,d.jsx)("div",{className:"p-3 bg-red-900/50 border border-red-800 rounded-lg text-red-200 text-sm",children:l}),(0,d.jsx)("button",{type:"submit",disabled:j,className:"w-full py-3 px-4 bg-blue-600 hover:bg-blue-700 rounded-lg text-white font-medium focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50 transition duration-200 flex items-center justify-center",children:j?(0,d.jsxs)("svg",{className:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,d.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):"Check Password"})]})]})})]})}},11810:(a,b,c)=>{"use strict";c.d(b,{c:()=>d});let d=()=>"darwin"===process.platform},12816:(a,b,c)=>{"use strict";c.d(b,{default:()=>e});var d=c(97954);(0,d.registerClientReference)(function(){throw Error("Attempted to call confirmstate() from the server but confirmstate is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/ConfirmModal.tsx","confirmstate"),(0,d.registerClientReference)(function(){throw Error("Attempted to call openConfirm() from the server but openConfirm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/ConfirmModal.tsx","openConfirm");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call the default export of \"/app/ai-toolkit/ui/src/components/ConfirmModal.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/ConfirmModal.tsx","default")},13802:(a,b,c)=>{"use strict";c.d(b,{X:()=>n,default:()=>o});var d=c(21124),e=c(38301),f=c(44806),g=c(12999),h=c(66726),i=c(58449),j=c(95725),k=c(68813),l=c.n(k);let m=(0,f.VB)(null),n=a=>{m.set(a)};function o(){let[a,b]=m.use(),[c,f]=(0,e.useState)(!1),[k,n]=(0,e.useState)(""),o=(0,e.useRef)(null);(0,j.v)(()=>{setTimeout(()=>{o.current&&o.current.focus()},100)},[a]);let p=()=>{a?.onCancel&&a.onCancel(),f(!1)},q=()=>{a?.onConfirm&&a.onConfirm(k),f(!1)},r=h.BS8,s=a?.type||"danger";return"info"===s&&(r=h.ELu),(0,d.jsxs)(g.lG,{open:c,onClose:p,className:"relative z-10",children:[(0,d.jsx)(g.Xi,{transition:!0,className:"fixed inset-0 bg-gray-900/75 transition-opacity data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in"}),(0,d.jsx)("div",{className:"fixed inset-0 z-10 w-screen overflow-y-auto",children:(0,d.jsx)("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:(0,d.jsxs)(g.Lj,{transition:!0,className:"relative transform overflow-hidden rounded-lg bg-gray-800 text-left shadow-xl transition-all data-closed:translate-y-4 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:my-8 sm:w-full sm:max-w-lg data-closed:sm:translate-y-0 data-closed:sm:scale-95",children:[(0,d.jsx)("div",{className:"bg-gray-800 px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,d.jsxs)("div",{className:"sm:flex sm:items-start",children:[(0,d.jsx)("div",{className:`mx-auto flex size-12 shrink-0 items-center justify-center rounded-full ${(()=>{switch(s){case"danger":default:return"bg-red-500";case"warning":return"bg-yellow-500";case"info":return"bg-blue-500"}})()} sm:mx-0 sm:size-10`,children:(0,d.jsx)(r,{"aria-hidden":"true",className:`size-6 ${(()=>{switch(s){case"danger":default:return"text-red-950";case"warning":return"text-yellow-950";case"info":return"text-blue-950"}})()}`})}),(0,d.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left flex-1",children:[(0,d.jsx)(g.L3,{as:"h3",className:`text-base font-semibold ${(()=>{switch(s){case"danger":default:return"text-red-500";case"warning":return"text-yellow-500";case"info":return"text-blue-500"}})()}`,children:a?.title}),(0,d.jsxs)("div",{className:"mt-2",children:[(0,d.jsx)("p",{className:"text-sm text-gray-200",children:a?.message}),(0,d.jsx)("div",{className:l()("mt-4 w-full",{hidden:!a?.inputTitle}),children:(0,d.jsx)("form",{onSubmit:a=>{a.preventDefault(),q()},children:(0,d.jsx)(i.ks,{value:k,ref:o,onChange:n,placeholder:a?.inputTitle})})})]})]})]})}),(0,d.jsxs)("div",{className:"bg-gray-700 px-4 py-3 sm:flex sm:flex-row-reverse sm:px-6",children:[(0,d.jsx)("button",{type:"button",onClick:q,className:`inline-flex w-full justify-center rounded-md ${(()=>{switch(s){case"danger":default:return"bg-red-700 hover:bg-red-500";case"warning":return"bg-yellow-700 hover:bg-yellow-500";case"info":return"bg-blue-700 hover:bg-blue-500"}})()} px-3 py-2 text-sm font-semibold text-white shadow-xs sm:ml-3 sm:w-auto`,children:a?.confirmText||"Confirm"}),(0,d.jsx)("button",{type:"button","data-autofocus":!0,onClick:p,className:"mt-3 inline-flex w-full justify-center rounded-md bg-gray-800 px-3 py-2 text-sm font-semibold text-gray-200 hover:bg-gray-800 sm:mt-0 sm:w-auto ring-0",children:"Cancel"})]})]})})})]})}},15542:(a,b,c)=>{"use strict";c.d(b,{A:()=>f});var d=c(38301);c(74776);let e={connected:!1,lastUpdated:null,cpu:null,gpu:null,history:[]};function f(){let[a,b]=(0,d.useState)(e);return a}Math.random().toString(36).slice(2),Date.now().toString(36)},20141:(a,b,c)=>{Promise.resolve().then(c.bind(c,61216)),Promise.resolve().then(c.bind(c,866)),Promise.resolve().then(c.bind(c,12816)),Promise.resolve().then(c.bind(c,98934)),Promise.resolve().then(c.bind(c,59653)),Promise.resolve().then(c.bind(c,7518)),Promise.resolve().then(c.bind(c,87907)),Promise.resolve().then(c.bind(c,45291)),Promise.resolve().then(c.bind(c,67714))},26531:(a,b,c)=>{"use strict";c.d(b,{default:()=>F,_:()=>E});var d=c(21124),e=c(38301),f=c(3991),g=c.n(f),h=c(42378),i=c(98123),j=c(2980),k=c(55175),l=c(59865),m=c(91641),n=c(51886),o=c(90447),p=c(7698),q=c(44806),r=c(88077),s=c(78226),t=c(49377);let u=()=>{let{theme:a,toggleTheme:b}=(0,t.D)();return(0,d.jsx)("button",{onClick:b,className:`flex items-center justify-center p-1 rounded-lg transition-colors ${"dark"===a?"bg-[rgb(215,215,215)] hover:bg-[rgb(195,195,195)] text-[rgb(82,82,82)]":"bg-[rgb(23,23,23)] hover:bg-[rgb(38,38,38)] text-[rgb(163,163,163)]"}`,title:"dark"===a?"Switch to light mode":"Switch to dark mode",children:"dark"===a?(0,d.jsx)(r.A,{className:"w-5 h-5"}):(0,d.jsx)(s.A,{className:"w-5 h-5"})})};var v=c(499),w=c(56063),x=c(31750),y=c(50398);function z(){let{jobs:a}=(0,x.A)({onlyActive:!0,reloadInterval:5e3});return a&&0!==a.length?(0,d.jsx)("div",{className:"px-3 pb-2",children:(0,d.jsx)("div",{className:"w-[196px]",children:(0,d.jsx)("ul",{className:"max-h-48 overflow-y-auto space-y-2",children:a.map(a=>{let b;try{b=(0,y.Yk)(a)}catch{b=void 0}let c=b?Math.min(100,a.step/b*100):0,e="running"===a.status||"stopping"===a.status,f=a.name,h=`/jobs/${a.id}`;if("inference"===a.job_type&&(f="Inference Engine",h=`/generate?job=${a.id}`),"caption"===a.job_type){let b=(a.job_ref??"").split(/[/\\]/);f=b[b.length-1]||a.name,h=`/datasets/${f}`}let i="text-gray-400";return"running"===a.status&&(i="text-blue-400"),"queued"===a.status&&(i="text-yellow-400"),"stopping"===a.status&&(i="text-orange-400"),(0,d.jsx)("li",{className:"min-w-0",children:(0,d.jsxs)(g(),{href:h,className:"block px-3 py-2 bg-gray-800 hover:bg-gray-950 rounded-lg transition-colors min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[e&&(0,d.jsx)(w.AhV,{className:"animate-spin text-blue-400 flex-shrink-0"}),(0,d.jsx)("span",{className:"text-xs text-gray-100 truncate min-w-0 flex-1",children:f})]}),b?(0,d.jsxs)("div",{className:"mt-1.5",children:[(0,d.jsx)("div",{className:"bg-gray-700 rounded-full h-1",children:(0,d.jsx)("div",{className:"bg-blue-500 h-1 rounded-full transition-all",style:{width:`${c}%`}})}),(0,d.jsxs)("div",{className:"flex justify-between gap-2 mt-0.5 min-w-0",children:[(0,d.jsx)("span",{className:`text-[10px] truncate min-w-0 ${i}`,children:a.info||a.status}),(0,d.jsxs)("span",{className:"text-[10px] text-gray-400 flex-shrink-0",children:[a.step," / ",b]})]})]}):(0,d.jsx)("div",{className:`text-[10px] mt-0.5 truncate ${i}`,children:a.info||a.status})]})},a.id)})})})}):null}var A=c(34118),B=c(74776),C=c(38979);function D(){let[a,b]=(0,e.useState)(null);if((0,C.A)(async()=>{try{let a=await B.u.get("/api/ostris_cloud");b(a.data)}catch{}},6e4),!a||!a.enabled||!a.appUrl)return null;let c=a.balance?.usd,f="number"==typeof c?c.toLocaleString(void 0,{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}):null;return(0,d.jsx)("a",{href:`${a.appUrl}/billing`,target:"_blank",rel:"noreferrer",className:"block px-4 py-2 hover:bg-gray-800 transition-colors",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(A.A,{className:"w-4 h-4 text-blue-400"}),(0,d.jsxs)("span",{className:"text-[11px] uppercase tracking-wide text-gray-400",children:[(0,d.jsx)("span",{className:"font-extrabold",children:"Ostris"})," ",(0,d.jsx)("span",{className:"font-thin",children:"Cloud"})]})]}),f?(0,d.jsx)("span",{className:"text-xs font-medium text-gray-100 tabular-nums",children:f}):(0,d.jsx)("span",{className:"inline-block h-3 w-10 rounded bg-gray-700 animate-pulse","aria-label":"Loading balance"})]})})}let E=(0,q.VB)(!1),F=()=>{let[a,b]=E.use(),c=(0,h.usePathname)();(0,e.useEffect)(()=>{b(!1)},[c]),(0,e.useEffect)(()=>(a?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[a]);let f=[{name:"Dashboard",href:"/dashboard",icon:i.A},{name:"Generate",href:"/generate",icon:j.A,badge:"alpha"},{name:"New Job",href:"/jobs/new",icon:k.A},{name:"Queue",href:"/jobs",icon:l.A},{name:"Datasets",href:"/datasets",icon:m.A},{name:"Settings",href:"/settings",icon:n.A}],q="flex flex-col items-center justify-center p-1 hover:bg-gray-800 rounded-lg transition-colors",r="w-5 h-5 text-gray-400 hover:text-white",s=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"px-4 py-3 flex items-center justify-between",children:[(0,d.jsxs)("h1",{className:"text-l",children:[(0,d.jsx)(v.A,{}),(0,d.jsx)("span",{className:"font-bold uppercase",children:"Ostris"}),(0,d.jsx)("span",{className:"ml-2 uppercase text-gray-300",children:"AI-Toolkit"})]}),(0,d.jsx)("button",{onClick:()=>b(!1),className:"md:hidden text-gray-400 hover:text-white p-1","aria-label":"Close menu",children:(0,d.jsx)(o.A,{className:"w-5 h-5"})})]}),(0,d.jsx)(D,{}),(0,d.jsx)("nav",{className:"flex-1",children:(0,d.jsx)("ul",{className:"px-2 py-4 space-y-2",children:f.map(a=>(0,d.jsx)("li",{children:(0,d.jsxs)(g(),{href:a.href,className:"flex items-center px-4 py-2 text-gray-300 hover:bg-gray-800 rounded-lg transition-colors",children:[(0,d.jsx)(a.icon,{className:"w-5 h-5 mr-3"}),a.name,"badge"in a&&a.badge&&(0,d.jsx)("span",{className:"ml-2 px-1.5 py-0.5 text-[10px] leading-none uppercase tracking-wide rounded bg-blue-600/20 text-blue-400 border border-blue-500/40",children:a.badge})]})},a.name))})}),(0,d.jsx)(z,{}),(0,d.jsxs)("a",{href:"https://ostris.com/support",target:"_blank",rel:"noreferrer",className:"group flex items-center space-x-2 px-4 py-3 text-gray-400 hover:text-gray-200 transition-colors",children:[(0,d.jsx)("svg",{height:"20",width:"20",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{overflow:"visible"},children:(0,d.jsx)("path",{className:"animate-heartbeat",d:"m7 3c-1.5355 0-3.0784 0.5-4.25 1.7-2.3431 2.4-2.2788 6.1 0 8.5l9.25 9.8 9.25-9.8c2.279-2.4 2.343-6.1 0-8.5-2.343-2.3-6.157-2.3-8.5 0l-0.75 0.8-0.75-0.8c-1.172-1.2-2.7145-1.7-4.25-1.7z",fill:"#c0392b"})}),(0,d.jsx)("span",{className:"uppercase text-sm font-medium tracking-wide",children:"Support AI-Toolkit"})]}),(0,d.jsx)("div",{className:"px-1 py-1 border-t border-gray-800",children:(0,d.jsxs)("div",{className:"grid grid-cols-4 gap-4",children:[(0,d.jsx)("a",{href:"https://discord.gg/VXmU2f5WEU",target:"_blank",rel:"noreferrer",className:q,children:(0,d.jsx)(p.O4U,{className:r})}),(0,d.jsx)("a",{href:"https://www.youtube.com/@ostrisai",target:"_blank",rel:"noreferrer",className:q,children:(0,d.jsx)(p.Vk6,{className:r})}),(0,d.jsx)("a",{href:"https://x.com/ostrisai",target:"_blank",rel:"noreferrer",className:q,children:(0,d.jsx)(p.TCj,{className:r})}),(0,d.jsx)(u,{})]})}),(0,d.jsxs)("div",{className:"text-center text-[10px] text-gray-400 py-1 bg-gray-800",children:["Ostris AI-Toolkit v","0.13.8"]})]});return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"hidden md:flex flex-col w-59 bg-gray-900 text-gray-100",children:s}),(0,d.jsx)("div",{className:`md:hidden fixed inset-0 bg-black/60 z-40 transition-opacity duration-300 ease-in-out ${a?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}`,onClick:()=>b(!1),"aria-hidden":"true"}),(0,d.jsx)("div",{className:`md:hidden fixed top-0 left-0 bottom-0 w-64 max-w-[85vw] bg-gray-900 text-gray-100 z-50 flex flex-col shadow-xl transform transition-transform duration-300 ease-in-out ${a?"translate-x-0":"-translate-x-full"}`,children:s})]})}},31750:(a,b,c)=>{"use strict";c.d(b,{A:()=>g});var d=c(38301),e=c(74776),f=c(38979);function g({onlyActive:a=!1,reloadInterval:b=null,job_type:c=null}={}){let[h,i]=(0,d.useState)([]),[j,k]=(0,d.useState)("idle"),l=(0,d.useRef)(!1),m=()=>{if(l.current)return;l.current=!0,k("loading");let b={};return c&&(b.job_type=c),a&&(b.only_active="true"),e.u.get("/api/jobs",{params:b}).then(a=>a.data).then(a=>{console.log("Jobs:",a),a.error?(console.log("Error fetching jobs:",a.error),k("error")):(i(a.jobs),k("success"))}).catch(a=>{console.error("Error fetching jobs:",a),k("error")}).finally(()=>{l.current=!1})};return(0,f.A)(m,b),{jobs:h,setJobs:i,status:j,refreshJobs:m}}},34654:(a,b,c)=>{"use strict";c.d(b,{A:()=>j});var d=c(21124),e=c(38301),f=c(31339),g=c(21564),h=c(49377);let i={indent:2,lineWidth:0xe8d4a50fff,defaultStringType:"QUOTE_DOUBLE",defaultKeyType:"PLAIN",directives:!0};function j({config:a,setConfig:b,transformOnParse:c}){let{theme:j}=(0,h.D)(),[k,l]=(0,e.useState)(""),[m,n]=(0,e.useState)(!1),o=(0,e.useRef)(""),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r=(0,e.useRef)(!1),s=a=>{let b=q.current,c=p.current?.getModel();if(!b||!c)return;let d=a.map(a=>({severity:b.MarkerSeverity.Error,message:a.message,startLineNumber:a.line,startColumn:1,endLineNumber:a.line,endColumn:c.getLineMaxColumn(a.line)}));b.editor.setModelMarkers(c,"yaml",d)};return(0,d.jsxs)("div",{className:"relative h-full w-full",children:[m&&(0,d.jsx)("div",{className:"absolute inset-0 z-10 pointer-events-none rounded-sm",style:{boxShadow:"inset 0 0 12px 2px rgba(239, 68, 68, 0.5)"}}),(0,d.jsx)(g.Ay,{height:"100%",width:"100%",defaultLanguage:"yaml",value:k,theme:"dark"===j?"vs-dark":"light",className:"z-0",onChange:a=>{if(void 0!==a)try{let d=f.parse(a);n(!1),s([]),JSON.stringify(d)!==o.current&&(c&&(d=c(d)),o.current=JSON.stringify(d),b(d))}catch(b){n(!0);let a=b?.linePos?.[0]?.line??b?.linePos?.line??1;s([{message:b?.message??"Invalid YAML",line:a}])}},onMount:(b,c)=>{p.current=b,q.current=c,r.current=!0;try{let b=function(a){let b=new f.Document(a,i);return f.visit(b,{Scalar(a,b){"string"==typeof b.value&&b.value.includes("\n")&&(b.type=f.Scalar.BLOCK_LITERAL)}}),b.toString(i)}(a);l(b),o.current=JSON.stringify(a)}catch(a){console.warn(a)}},options:{minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0}})]})}},35404:(a,b,c)=>{"use strict";c.d(b,{F:()=>f,S:()=>g});var d=c(38301),e=c.n(d);function f(a,b,c){let d,e={...a};c||(c="");let f=[],g=/([^[.\]]+)|\[(\d+)\]/g;for(;null!==(d=g.exec(c));)void 0!==d[1]?f.push(d[1]):f.push(Number(d[2]));let h=e;for(let a=0;a<f.length-1;a++){let b=f[a];if("number"==typeof b){if(!Array.isArray(h))throw Error(`Cannot access index ${b} of non-array`);let c=f[a+1],d=h[b];void 0===d?h[b]="number"==typeof c?[]:{}:Array.isArray(d)?h[b]=[...d]:"object"==typeof d&&null!==d&&(h[b]={...d})}else if(void 0===h[b]){let c=f[a+1];h[b]="number"==typeof c?[]:{}}else h[b]=Array.isArray(h[b])?[...h[b]]:{...h[b]};h=h[b]}let i=f[f.length-1];return void 0===b?delete h[i]:h[i]=b,e}function g(a){let[b,c]=e().useState(a);return[b,e().useCallback((a,b)=>{if(void 0===b)return void c(a);c(c=>f(c,a,b))},[])]}},38934:(a,b,c)=>{"use strict";c.d(b,{CN:()=>n,JK:()=>h,Wr:()=>j,cZ:()=>g,e7:()=>k,fi:()=>d,gO:()=>m,kO:()=>i,o3:()=>l});let d=a=>JSON.parse(JSON.stringify(a)),e=[".mp4",".avi",".mov",".mkv",".wmv",".m4v",".flv"],f=[".mp3",".wav",".flac",".ogg"],g=a=>e.includes(a.toLowerCase().slice(-4)),h=a=>f.includes(a.toLowerCase().slice(-4)),i=a=>{let b,c={},d=/<([A-Z_][A-Z0-9_]*)>([\s\S]*?)<\/\1>/g;for(;null!==(b=d.exec(a));){let a=b[2].trim();try{c[b[1]]=JSON.parse(a)}catch{c[b[1]]=a}}return c},j=a=>Object.entries(a).map(([a,b])=>{let c="string"==typeof b?b:JSON.stringify(b);return`<${a}>${c}</${a}>`}).join("\n"),k=a=>{let b=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\"));return -1===b?a:a.slice(b+1)},l=a=>{let b=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\"));return -1===b?"":a.slice(0,b)},m=a=>{let b=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\"));if(-1===b)return encodeURIComponent(a);let c=0===b?a[0]:a.slice(0,b);return`${encodeURIComponent(c)}/${encodeURIComponent(a.slice(b+1))}`},n=(...a)=>{let b=a.length>0&&a[0].includes("\\")?"\\":"/",c="\\"===b?/^\\+|\\+$/g:/^\/+|\/+$/g,d="\\"===b?/\\+$/:/\/+$/;return a.map((a,b)=>0===b?a.replace(d,""):a.replace(c,"")).filter(a=>a.length>0).join(b)}},38979:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(38301);function e(a,b,c=[]){(0,d.useRef)(a).current=a}},39810:(a,b,c)=>{"use strict";c.d(b,{a:()=>f});var d=c(21124),e=c(38301);let f=({isOpen:a,onClose:b,title:c,children:f,showCloseButton:g=!0,size:h="md",closeOnOverlayClick:i=!0})=>((0,e.useEffect)(()=>{let c=c=>{"Escape"===c.key&&a&&b()};return a&&(document.addEventListener("keydown",c),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",c),document.body.style.overflow="auto"}},[a,b]),a)?(0,d.jsx)(e.Fragment,{children:(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center overflow-y-auto bg-gray-900 bg-opacity-75 backdrop-blur-sm transition-opacity p-2 sm:p-4",onClick:a=>{a.target===a.currentTarget&&i&&b()},"aria-modal":"true",role:"dialog","aria-labelledby":"modal-title",children:(0,d.jsxs)("div",{className:`relative my-auto mx-auto w-full ${{sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"}[h]} rounded-xl bg-gray-900 shadow-xl shadow-black/10 dark:shadow-2xl dark:shadow-black/80 transition-all`,onClick:a=>a.stopPropagation(),children:[(c||g)&&(0,d.jsxs)("div",{className:"flex items-center justify-between bg-gray-800 px-4 py-3 rounded-t-xl",children:[c&&(0,d.jsx)("h3",{id:"modal-title",className:"font-semibold text-gray-100 truncate pr-2",children:c}),g&&(0,d.jsx)("button",{type:"button",className:"ml-auto inline-flex items-center justify-center rounded-md p-2 text-gray-400 hover:bg-gray-700 hover:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500 flex-shrink-0",onClick:b,"aria-label":"Close modal",children:(0,d.jsx)("svg",{className:"h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("div",{className:"px-4 sm:px-6 py-4",children:f})]})})}):null},43653:(a,b,c)=>{"use strict";c.d(b,{A:()=>d}),c(74776);let d=async(a,b={})=>{let c=new AbortController,d=()=>c.abort();b.signal&&(b.signal.aborted?c.abort():b.signal.addEventListener("abort",d));let e=setTimeout(()=>c.abort(),b.timeoutMs??12e5),f=null;try{let d=await fetch("/api/scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({script:a,args:b.args,stream:!0}),signal:c.signal});if(!d.ok||!d.body){let a=await d.text().catch(()=>"");throw Error(`Script stream failed: HTTP ${d.status} ${a}`)}let e=d.body.getReader(),g=new TextDecoder("utf-8"),h="";for(;;){let a,{value:c,done:d}=await e.read();if(d)break;for(h+=g.decode(c,{stream:!0});(a=h.indexOf("\n"))>=0;){let c=h.slice(0,a).trim();if(h=h.slice(a+1),c)try{let a=JSON.parse(c);b.onEvent?.(a),"stdout"===a.type&&a.data&&b.onStdout?.(a.data),"stderr"===a.type&&a.data&&b.onStderr?.(a.data),("exit"===a.type||"error"===a.type)&&(f=a)}catch{}}}}finally{clearTimeout(e),b.signal&&b.signal.removeEventListener("abort",d)}return f}},44109:(a,b,c)=>{Promise.resolve().then(c.bind(c,8474)),Promise.resolve().then(c.bind(c,75241)),Promise.resolve().then(c.bind(c,13802)),Promise.resolve().then(c.bind(c,4508)),Promise.resolve().then(c.bind(c,65371)),Promise.resolve().then(c.bind(c,92380)),Promise.resolve().then(c.bind(c,26531)),Promise.resolve().then(c.bind(c,49377)),Promise.resolve().then(c.bind(c,78568))},45291:(a,b,c)=>{"use strict";c.d(b,{ThemeProvider:()=>e});var d=c(97954);(0,d.registerClientReference)(function(){throw Error("Attempted to call useTheme() from the server but useTheme is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/ThemeProvider.tsx","useTheme");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call ThemeProvider() from the server but ThemeProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/ThemeProvider.tsx","ThemeProvider")},49377:(a,b,c)=>{"use strict";c.d(b,{D:()=>g,ThemeProvider:()=>h});var d=c(21124),e=c(38301);let f=(0,e.createContext)({theme:"dark",toggleTheme:()=>{}}),g=()=>(0,e.useContext)(f),h=({children:a})=>{let[b,c]=(0,e.useState)("dark"),[g,h]=(0,e.useState)(!1);return((0,e.useEffect)(()=>{let a=localStorage.getItem("theme")||"dark";c(a),document.documentElement.classList.toggle("dark","dark"===a),h(!0)},[]),g)?(0,d.jsx)(f.Provider,{value:{theme:b,toggleTheme:()=>{let a="dark"===b?"light":"dark";c(a),localStorage.setItem("theme",a),document.documentElement.classList.toggle("dark","dark"===a)}},children:a}):null}},50398:(a,b,c)=>{"use strict";c.d(b,{CC:()=>f,O$:()=>l,OR:()=>i,UH:()=>j,XX:()=>g,Yk:()=>m,_1:()=>e,xK:()=>h});var d=c(74776);let e=a=>new Promise((b,c)=>{d.u.get(`/api/jobs/${a}/start`).then(a=>a.data).then(a=>{console.log("Job started:",a),b()}).catch(a=>{console.error("Error starting job:",a),c(a)})}),f=a=>new Promise((b,c)=>{d.u.get(`/api/jobs/${a}/stop`).then(a=>a.data).then(a=>{console.log("Job stopped:",a),b()}).catch(a=>{console.error("Error stopping job:",a),c(a)})}),g=a=>new Promise((b,c)=>{d.u.get(`/api/jobs/${a}/delete`).then(a=>a.data).then(a=>{console.log("Job deleted:",a),b()}).catch(a=>{console.error("Error deleting job:",a),c(a)})}),h=a=>new Promise((b,c)=>{d.u.get(`/api/jobs/${a}/save_now`).then(a=>a.data).then(a=>{console.log("Job set to save on next step:",a),b()}).catch(a=>{console.error("Error setting job to save on next step:",a),c(a)})}),i=a=>new Promise((b,c)=>{d.u.get(`/api/jobs/${a}/sample_now`).then(a=>a.data).then(a=>{console.log("Job set to sample on next step:",a),b()}).catch(a=>{console.error("Error setting job to sample on next step:",a),c(a)})}),j=a=>new Promise((b,c)=>{d.u.get(`/api/jobs/${a}/mark_stopped`).then(a=>a.data).then(a=>{console.log("Job marked as stopped:",a),b()}).catch(a=>{console.error("Error marking job as stopped:",a),c(a)})}),k=a=>JSON.parse(a.job_config),l=a=>{let b=k(a),c=a.stop&&"running"===a.status,d=["queued","completed","stopped","error"].includes(a.status)&&!c,e=["queued","completed","stopped","error"].includes(a.status)&&!c,f="queued"===a.status,g="running"===a.status&&!c,h=["stopped","error"].includes(a.status)&&!c;return"completed"===a.status&&(b.config.process[0].train?.steps||0)>a.step&&!c&&(h=!0),{canDelete:d,canEdit:e,canStop:g,canStart:h,canRemoveFromQueue:f}},m=a=>{if(null!=a.total_steps)return a.total_steps;let b=k(a);return b.config.process[0].train?.steps||0}},51472:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>v,dynamic:()=>s,metadata:()=>t,viewport:()=>u});var d=c(75338),e=c(3305),f=c.n(e);c(61135);var g=c(87907),h=c(45291),i=c(12816),j=c(74515),k=c(61216),l=c(98934),m=c(21820),n=c.n(m),o=c(866),p=c(59653),q=c(67714),r=c(7518);let s="force-dynamic",t={title:"Ostris - AI Toolkit",description:"A toolkit for building AI things."},u={width:"device-width",initialScale:1,maximumScale:5};function v({children:a}){let b=!!process.env.AI_TOOLKIT_AUTH,c=n().platform();return(0,d.jsxs)("html",{lang:"en",suppressHydrationWarning:!0,children:[(0,d.jsxs)("head",{children:[(0,d.jsx)("meta",{name:"apple-mobile-web-app-title",content:"AI-Toolkit"}),(0,d.jsx)("script",{dangerouslySetInnerHTML:{__html:`
(function() {
var theme = localStorage.getItem('theme') || 'dark';
if (theme === 'dark') document.documentElement.classList.add('dark');
})();
`}})]}),(0,d.jsxs)("body",{className:f().className,children:[(0,d.jsx)("script",{dangerouslySetInnerHTML:{__html:`window.server_platform = "${c}";`}}),(0,d.jsx)(h.ThemeProvider,{children:(0,d.jsx)(k.default,{authRequired:b,children:(0,d.jsxs)("div",{className:"flex h-screen bg-gray-950",children:[(0,d.jsx)(g.default,{}),(0,d.jsx)("main",{className:"flex-1 overflow-auto bg-gray-950 text-gray-100 relative",children:(0,d.jsx)(j.Suspense,{children:a})})]})})}),(0,d.jsx)(i.default,{}),(0,d.jsx)(l.default,{}),(0,d.jsx)(o.CaptionDatasetModal,{}),(0,d.jsx)(p.default,{}),(0,d.jsx)(q.default,{}),(0,d.jsx)(r.default,{})]})]})}},52120:(a,b,c)=>{"use strict";c.d(b,{Ay:()=>n,Rw:()=>h,ZL:()=>i,b4:()=>m,dn:()=>k,vb:()=>j});var d=c(21124),e=c(38301),f=c(68813),g=c.n(f);function h(a){return`hsl(${(137.508*a%360).toFixed(1)}, 80%, 60%)`}function i(a,b){return`hsla(${(137.508*a%360).toFixed(1)}, 80%, 60%, ${b})`}function j(a){let b,c=a.trim();if(!c.startsWith("{"))return null;try{b=JSON.parse(c)}catch{return null}let d=b?.compositional_deconstruction?.elements;if(!Array.isArray(d))return null;let e=[];for(let a of d){let b=a?.bbox;if(Array.isArray(b)&&4===b.length&&b.every(a=>"number"==typeof a)){let c="text"===a.type,d=(c?a.text:a.desc)??"";e.push({y1:b[0],x1:b[1],y2:b[2],x2:b[3],label:`${d}`,type:c?"text":"obj"})}}return e.length>0?e:null}function k(a){let b=a?.compositional_deconstruction?.elements;if(!Array.isArray(b))return[];let c=[];return b.forEach((a,b)=>{let d=a?.bbox;if(Array.isArray(d)&&4===d.length&&d.every(a=>"number"==typeof a)){let e="text"===a.type,f=(e?a.text:a.desc)??"";c.push({y1:d[0],x1:d[1],y2:d[2],x2:d[3],label:`${f}`,type:e?"text":"obj",elementIndex:b})}}),c}function l(a){let b=a=>Math.max(0,Math.min(1e3,Math.round(a))),c=b(Math.min(a.x1,a.x2)),d=b(Math.max(a.x1,a.x2));return{y1:b(Math.min(a.y1,a.y2)),x1:c,y2:b(Math.max(a.y1,a.y2)),x2:d}}function m({boxes:a,selectedIndex:b,drawing:c,onSelect:f,onChangeBox:i,onCreateBox:j}){let k=(0,e.useRef)(null),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(null),q=(a,b)=>{let c=k.current.getBoundingClientRect();return{x:Math.max(0,Math.min(1e3,(a-c.left)/c.width*1e3)),y:Math.max(0,Math.min(1e3,(b-c.top)/c.height*1e3))}},r=(a,b,c)=>{a.preventDefault(),a.stopPropagation(),f(b.elementIndex);let d=k.current;if(!d)return;let e=a.clientX,g=a.clientY,h={...b},j={...b},m=a=>{let f=d.getBoundingClientRect();if(!f.width||!f.height)return;let i=(a.clientX-e)/f.width*1e3,k=(a.clientY-g)/f.height*1e3,{x1:l,y1:m,x2:o,y2:p}=h;if("move"===c){let a=o-l,b=p-m,c=Math.max(0,Math.min(1e3-a,l+i)),d=Math.max(0,Math.min(1e3-b,m+k));l=c,m=d,o=c+a,p=d+b}else c.includes("w")&&(l=Math.max(0,Math.min(o-8,l+i))),c.includes("e")&&(o=Math.min(1e3,Math.max(l+8,o+i))),c.includes("n")&&(m=Math.max(0,Math.min(p-8,m+k))),c.includes("s")&&(p=Math.min(1e3,Math.max(m+8,p+k)));j={...h,x1:l,y1:m,x2:o,y2:p},n({index:b.elementIndex,box:j})},o=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",o),n(null),i(b.elementIndex,l(j))};window.addEventListener("pointermove",m),window.addEventListener("pointerup",o)},s=[{mode:"nw",cls:"top-0 left-0 -translate-x-1/2 -translate-y-1/2 cursor-nwse-resize"},{mode:"ne",cls:"top-0 right-0 translate-x-1/2 -translate-y-1/2 cursor-nesw-resize"},{mode:"sw",cls:"bottom-0 left-0 -translate-x-1/2 translate-y-1/2 cursor-nesw-resize"},{mode:"se",cls:"bottom-0 right-0 translate-x-1/2 translate-y-1/2 cursor-nwse-resize"}];return(0,d.jsxs)("div",{ref:k,onPointerDown:a=>{if(!c)return void f(null);if(a.preventDefault(),a.stopPropagation(),!k.current)return;let b=q(a.clientX,a.clientY),d={x1:b.x,y1:b.y,x2:b.x,y2:b.y};p(d);let e=a=>{let c=q(a.clientX,a.clientY);p({...d={x1:b.x,y1:b.y,x2:c.x,y2:c.y}})},g=()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",g),p(null);let a=l(d);a.x2-a.x1>=8&&a.y2-a.y1>=8&&j(a)};window.addEventListener("pointermove",e),window.addEventListener("pointerup",g)},className:g()("absolute inset-0",c?"cursor-crosshair":""),children:[a.map(a=>{let e=m&&m.index===a.elementIndex?m.box:a,f=b===a.elementIndex,i=f&&!c,j=h(a.elementIndex);return(0,d.jsxs)("div",{onPointerDown:c?void 0:b=>r(b,a,"move"),className:g()("absolute border-2",{"pointer-events-none":c,"cursor-move touch-none":!c,"ring-2 ring-blue-400":i}),style:{left:`${e.x1/10}%`,top:`${e.y1/10}%`,width:`${(e.x2-e.x1)/10}%`,height:`${(e.y2-e.y1)/10}%`,borderColor:i?"#ffffff":j},children:[a.label&&(0,d.jsx)("span",{title:a.label,className:"absolute top-0 left-0 max-w-full px-1 py-0.5 text-[9px] leading-tight font-medium whitespace-pre-line break-words line-clamp-2 text-gray-900 pointer-events-none",style:{backgroundColor:j},children:a.label}),f&&!c&&s.map(b=>(0,d.jsx)("div",{onPointerDown:c=>r(c,{...a,...e},b.mode),className:g()("absolute w-3 h-3 rounded-sm border border-gray-900 bg-white touch-none",b.cls)},b.mode))]},a.elementIndex)}),o&&(0,d.jsx)("div",{className:"absolute border-2 border-dashed border-white bg-white/10 pointer-events-none",style:{left:`${Math.min(o.x1,o.x2)/10}%`,top:`${Math.min(o.y1,o.y2)/10}%`,width:`${Math.abs(o.x2-o.x1)/10}%`,height:`${Math.abs(o.y2-o.y1)/10}%`}})]})}function n({boxes:a}){return(0,d.jsx)("div",{className:"absolute inset-0 pointer-events-none",children:a.map((a,b)=>{let c=h(b);return(0,d.jsx)("div",{className:"absolute border-2",style:{left:`${a.x1/10}%`,top:`${a.y1/10}%`,width:`${(a.x2-a.x1)/10}%`,height:`${(a.y2-a.y1)/10}%`,borderColor:c},children:a.label&&(0,d.jsx)("span",{title:a.label,className:"absolute top-0 left-0 max-w-full px-1 py-0.5 text-[9px] leading-tight font-medium whitespace-pre-line break-words line-clamp-3 text-gray-900",style:{backgroundColor:c},children:a.label})},b)})})}},56199:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81170,23)),Promise.resolve().then(c.t.bind(c,23597,23)),Promise.resolve().then(c.t.bind(c,36893,23)),Promise.resolve().then(c.t.bind(c,89748,23)),Promise.resolve().then(c.t.bind(c,6060,23)),Promise.resolve().then(c.t.bind(c,7184,23)),Promise.resolve().then(c.t.bind(c,69576,23)),Promise.resolve().then(c.t.bind(c,73041,23)),Promise.resolve().then(c.t.bind(c,51384,23))},58449:(a,b,c)=>{"use strict";c.d(b,{Sc:()=>x,kM:()=>w,gE:()=>y,Q7:()=>t,pp:()=>u,Cw:()=>z,No:()=>s,ks:()=>r});var d=c(21124),e=c(38301),f=c.n(e),g=c(68813),h=c.n(g),i=c(13973),j=c(271),k=c(96328);let l={"config.name":{title:"Training Name",description:(0,d.jsx)(d.Fragment,{children:"The name of the training job. This name will be used to identify the job in the system and will the the filename of the final model. It must be unique and can only contain alphanumeric characters, underscores, and dashes. No spaces or special characters are allowed."})},gpuids:{title:"GPU ID",description:(0,d.jsx)(d.Fragment,{children:"This is the GPU that will be used for training. Only one GPU can be used per job at a time via the UI currently. However, you can start multiple jobs in parallel, each using a different GPU."})},"config.process[0].trigger_word":{title:"Trigger Word",description:(0,d.jsxs)(d.Fragment,{children:["Optional: This will be the word or token used to trigger your concept or character.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"When using a trigger word, If your captions do not contain the trigger word, it will be added automatically the beginning of the caption. If you do not have captions, the caption will become just the trigger word. If you want to have variable trigger words in your captions to put it in different spots, you can use the"," ",(0,d.jsx)("code",{children:"[trigger]"})," placeholder in your captions. This will be automatically replaced with your trigger word.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Trigger words will not automatically be added to your test prompts, so you will need to either add your trigger word manually or use the",(0,d.jsx)("code",{children:"[trigger]"})," placeholder in your test prompts as well."]})},"config.process[0].model.name_or_path":{title:"Name or Path",description:(0,d.jsx)(d.Fragment,{children:"The name of a diffusers repo on Huggingface or the local path to the base model you want to train from. The folder needs to be in diffusers format for most models. For some models, such as SDXL and SD1, you can put the path to an all in one safetensors checkpoint here."})},"datasets.control_path":{title:"Control Dataset",description:(0,d.jsx)(d.Fragment,{children:"The control dataset needs to have files that match the filenames of your training dataset. They should be matching file pairs. These images are fed as control/input images during training. The control images will be resized to match the training images."})},"datasets.multi_control_paths":{title:"Multi Control Dataset",description:(0,d.jsxs)(d.Fragment,{children:["The control dataset needs to have files that match the filenames of your training dataset. They should be matching file pairs. These images are fed as control/input images during training.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"For multi control datasets, the controls will all be applied in the order they are listed. If the model does not require the images to be the same aspect ratios, such as with Qwen/Qwen-Image-Edit-2509, then the control images do not need to match the aspect size or aspect ratio of the target image and they will be automatically resized to the ideal resolutions for the model / target images."]})},"datasets.num_frames":{title:"Number of Frames",description:(0,d.jsxs)(d.Fragment,{children:["This sets the number of frames to shrink videos to for a video dataset. If this dataset is images, set this to 1 for one frame. If your dataset is only videos, frames will be extracted evenly spaced from the videos in the dataset.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"It is best to trim your videos to the proper length before training. Wan is 16 frames a second. Doing 81 frames will result in a 5 second video. So you would want all of your videos trimmed to around 5 seconds for best results.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Example: Setting this to 81 and having 2 videos in your dataset, one is 2 seconds and one is 90 seconds long, will result in 81 evenly spaced frames for each video making the 2 second video appear slow and the 90second video appear very fast."]})},"datasets.do_i2v":{title:"Do I2V",description:(0,d.jsx)(d.Fragment,{children:"For video models that can handle both I2V (Image to Video) and T2V (Text to Video), this option sets this dataset to be trained as an I2V dataset. This means that the first frame will be extracted from the video and used as the start image for the video. If this option is not set, the dataset will be treated as a T2V dataset."})},"datasets.do_audio":{title:"Do Audio",description:(0,d.jsx)(d.Fragment,{children:"For models that support audio with video, this option will load the audio from the video and resize it to match the video sequence. Since the video is automatically resized, the audio may drop or raise in pitch to match the new speed of the video. It is important to prep your dataset to have the proper length before training."})},"datasets.audio_normalize":{title:"Audio Normalize",description:(0,d.jsx)(d.Fragment,{children:"When loading audio, this will normalize the audio volume to the max peaks. Useful if your dataset has varying audio volumes. Warning, do not use if you have clips with full silence you want to keep, as it will raise the volume of those clips."})},"datasets.audio_preserve_pitch":{title:"Audio Preserve Pitch",description:(0,d.jsx)(d.Fragment,{children:"When loading audio to match the number of frames requested, this option will preserve the pitch of the audio if the length does not match training target. It is recommended to have a dataset that matches your target length, as this option can add sound distortions."})},"datasets.flip":{title:"Flip X and Flip Y",description:(0,d.jsxs)(d.Fragment,{children:["You can augment your dataset on the fly by flipping the x (horizontal) and/or y (vertical) axis. Flipping a single axis will effectively double your dataset. It will result it training on normal images, and the flipped versions of the images. This can be very helpful, but keep in mind it can also be destructive. There is no reason to train people upside down, and flipping a face can confuse the model as a person's right side does not look identical to their left side. For text, obviously flipping text is not a good idea.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Control images for a dataset will also be flipped to match the images, so they will always match on the pixel level."]})},"train.unload_text_encoder":{title:"Unload Text Encoder",description:(0,d.jsx)(d.Fragment,{children:"Unloading text encoder will cache the trigger word and the sample prompts and unload the text encoder from the GPU. Captions in for the dataset will be ignored"})},"train.cache_text_embeddings":{title:"Cache Text Embeddings",description:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("small",{children:"(experimental)"}),(0,d.jsx)("br",{}),"Caching text embeddings will process and cache all the text embeddings from the text encoder to the disk. The text encoder will be unloaded from the GPU. This does not work with things that dynamically change the prompt such as trigger words, caption dropout, etc."]})},"model.multistage":{title:"Stages to Train",description:(0,d.jsx)(d.Fragment,{children:"Some models have multi stage networks that are trained and used separately in the denoising process. Most common, is to have 2 stages. One for high noise and one for low noise. You can choose to train both stages at once or train them separately. If trained at the same time, The trainer will alternate between training each model every so many steps and will output 2 different LoRAs. If you choose to train only one stage, the trainer will only train that stage and output a single LoRA."})},"train.switch_boundary_every":{title:"Switch Boundary Every",description:(0,d.jsxs)(d.Fragment,{children:["When training a model with multiple stages, this setting controls how often the trainer will switch between training each stage.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"For low vram settings, the model not being trained will be unloaded from the gpu to save memory. This takes some time to do, so it is recommended to alternate less often when using low vram. A setting like 10 or 20 is recommended for low vram settings.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"The swap happens at the batch level, meaning it will swap between a gradient accumulation steps. To train both stages in a single step, set them to switch every 1 step and set gradient accumulation to 2."]})},"train.force_first_sample":{title:"Force First Sample",description:(0,d.jsx)(d.Fragment,{children:"This option will force the trainer to generate samples when it starts. The trainer will normally only generate a first sample when nothing has been trained yet, but will not do a first sample when resuming from an existing checkpoint. This option forces a first sample every time the trainer is started. This can be useful if you have changed sample prompts and want to see the new prompts right away."})},"model.layer_offloading":{title:(0,d.jsxs)(d.Fragment,{children:["Layer Offloading"," ",(0,d.jsxs)("span",{className:"text-yellow-500",children:["( ",(0,d.jsx)(k.GaR,{className:"inline text-yellow-500",name:"Experimental"})," Experimental)"]})]}),description:(0,d.jsxs)(d.Fragment,{children:["This is an experimental feature based on"," ",(0,d.jsx)("a",{className:"text-blue-500",href:"https://github.com/lodestone-rock/RamTorch",target:"_blank",children:"RamTorch"}),". This feature is early and will have many updates and changes, so be aware it may not work consistently from one update to the next. It will also only work with certain models.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Layer Offloading uses the CPU RAM instead of the GPU ram to hold most of the model weights. This allows training a much larger model on a smaller GPU, assuming you have enough CPU RAM. This is slower than training on pure GPU RAM, but CPU RAM is cheaper and upgradeable. You will still need GPU RAM to hold the optimizer states and LoRA weights, so a larger card is usually still needed.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"You can also select the percentage of the layers to offload. It is generally best to offload as few as possible (close to 0%) for best performance, but you can offload more if you need the memory."]})},"model.qie.match_target_res":{title:"Match Target Res",description:(0,d.jsx)(d.Fragment,{children:"This setting will make the control images match the resolution of the target image. The official inference example for Qwen-Image-Edit-2509 feeds the control image is at 1MP resolution, no matter what size you are generating. Doing this makes training at lower res difficult because 1MP control images are fed in despite how large your target image is. Match Target Res will match the resolution of your target to feed in the control images allowing you to use less VRAM when training with smaller resolutions. You can still use different aspect ratios, the image will just be resizes to match the amount of pixels in the target image."})},"train.diff_output_preservation":{title:"Differential Output Preservation",description:(0,d.jsx)(d.Fragment,{children:'Differential Output Preservation (DOP) is a technique to help preserve class of the trained concept during training. For this, you must have a trigger word set to differentiate your concept from its class. For instance, You may be training a woman named Alice. Your trigger word may be "Alice". The class is "woman", since Alice is a woman. We want to teach the model to remember what it knows about the class "woman" while teaching it what is different about Alice. During training, the trainer will make a prediction with your LoRA bypassed and your trigger word in the prompt replaced with the class word. Making "photo of Alice" become "photo of woman". This prediction is called the prior prediction. Each step, we will do the normal training step, but also do another step with this prior prediction and the class prompt in order to teach our LoRA to preserve the knowledge of the class. This should not only improve the performance of your trained concept, but also allow you to do things like "Alice standing next to a woman" and not make both of the people look like Alice.'})},"train.blank_prompt_preservation":{title:"Blank Prompt Preservation",description:(0,d.jsx)(d.Fragment,{children:"Blank Prompt Preservation (BPP) is a technique to help preserve the current models knowledge when unprompted. This will not only help the model become more flexible, but will also help the quality of your concept during inference, especially when a model uses CFG (Classifier Free Guidance) on inference. At each step during training, a prior prediction is made with a blank prompt and with the LoRA disabled. This prediction is then used as a target on an additional training step with a blank prompt, to preserve the model's knowledge when no prompt is given. This helps the model to not overfit to the prompt and retain its generalization capabilities."})},"train.do_differential_guidance":{title:"Differential Guidance",description:(0,d.jsxs)(d.Fragment,{children:["Differential Guidance will amplify the difference of the model prediction and the target during training to make a new target. Differential Guidance Scale will be the multiplier for the difference. This is still experimental, but in my tests, it makes the model train faster, and learns details better in every scenario I have tried with it.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"The idea is that normal training inches closer to the target but never actually gets there, because it is limited by the learning rate. With differential guidance, we amplify the difference for a new target beyond the actual target, this would make the model learn to hit or overshoot the target instead of falling short.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("img",{src:"/imgs/diff_guidance.png",alt:"Differential Guidance Diagram",className:"max-w-full mx-auto"})]})},"dataset.num_repeats":{title:"Num Repeats",description:(0,d.jsx)(d.Fragment,{children:"Number of Repeats will allow you to repeate the items in a dataset multiple times. This is useful when you are using multiple datasets and want to balance the number of samples from each dataset. For instance, if you have a small dataset of 10 images and a large dataset of 100 images, you can set the small dataset to have 10 repeats to effectively make it 100 images, making the two datasets occour equally during training."})},"train.audio_loss_multiplier":{title:"Audio Loss Multiplier",description:(0,d.jsx)(d.Fragment,{children:"When training audio and video, sometimes the video loss is so great that it outweights the audio loss, causing the audio to become distorted. If you are noticing this happen, you can increase the audio loss multiplier to give more weight to the audio loss. You could try something like 2.0, 10.0 etc. Warning, setting this too high could overfit and damage the model."})},"datasets.auto_frame_count":{title:"Auto Frame Count",description:(0,d.jsx)(d.Fragment,{children:"This will automatically determine the number of frames to use for each video in your dataset instead of relying on a fixed num_frames. This allows you to include videos of different lengths in the dataset, and each video will be processed without speeding up or slowing down. Be careful about adding long videos into your dataset, as they use up more VRAM. This currently will not work with a batch size greater than 1."})},"model.model_kwargs.kv_cache":{title:"KV Cache",description:(0,d.jsx)(d.Fragment,{children:"This will enable KV Cache for control images in a model that supports it. LoRAs trained with this on need to also be inferenced with it, and vice versa. This does not speed up or slow down training, but on inference, the control images only need to be processed once for the entire generation, vs being processed for every step. Which leads to a significant speedup on inference."})},"train.guidance_loss_target":{title:"Guidance Loss Target",description:(0,d.jsx)(d.Fragment,{children:"For contrastive guidance loss, this is the target CGF to amplify predictions to."})},"datasets.caption_dropout_rate":{title:"Caption Dropout Rate",description:(0,d.jsxs)(d.Fragment,{children:["Caption dropout rate is the probability that the caption for an image will be dropped (replaced with a blank caption) for any given training step. For example, a value of 0.05 will drop the caption around 5% of the time. Dropping captions helps the model learn the concept being trained without relying entirely on the caption, and helps preserve the model's ability to generate without a prompt. If a trigger word is set, the trigger word is still used when the caption is dropped, so the model still associates the dropped samples with your trigger word. Regularization images, or images without a trigger word, drop to a fully blank caption.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Caption dropout also works when caching text embeddings. An additional embedding for the dropout caption (blank, or the trigger word alone) is cached to disk alongside the normal one, and it is randomly swapped in at train time at this rate."]})}},m=a=>a&&a in l?l[a]:null;var n=c(4508);let o=(0,i.default)(async()=>{},{loadableGenerated:{modules:["components/formInputs.tsx -> react-select"]},ssr:!1}),p="block text-xs mb-1 mt-2 text-gray-300",q="w-full text-sm px-3 py-1 bg-gray-950 dark:bg-gray-800 border border-gray-700 rounded-sm text-gray-100 placeholder:text-gray-500 focus:ring-2 focus:ring-gray-600 focus:border-transparent",r=(0,e.forwardRef)((a,b)=>{let{label:c,value:e,onChange:f,placeholder:g,required:i,disabled:k,type:l="text",className:o,docKey:r=null,suffix:s}=a,{doc:t}=a;return!t&&r&&(t=m(r)),(0,d.jsxs)("div",{className:h()(o),children:[c&&(0,d.jsxs)("label",{className:p,children:[c," ",t&&(0,d.jsx)("div",{className:"inline-block ml-1 text-xs text-gray-500 cursor-pointer",onClick:()=>(0,n.P)(t),children:(0,d.jsx)(j.A,{className:"inline-block w-4 h-4 cursor-pointer"})})]}),s?(0,d.jsxs)("div",{className:h()("flex items-stretch w-full bg-gray-950 dark:bg-gray-800 border border-gray-700 rounded-sm focus-within:ring-2 focus-within:ring-gray-600",k?"opacity-30 cursor-not-allowed":""),children:[(0,d.jsx)("input",{ref:b,type:l,value:e,onChange:a=>{k||f(a.target.value)},className:"flex-1 min-w-0 bg-transparent text-sm px-3 py-1 text-gray-100 placeholder:text-gray-500 focus:outline-none",placeholder:g,required:i,disabled:k}),(0,d.jsx)("span",{className:"flex items-center px-2 text-sm text-gray-400 border-l border-gray-700 bg-gray-900/50 select-none",children:s})]}):(0,d.jsx)("input",{ref:b,type:l,value:e,onChange:a=>{k||f(a.target.value)},className:`${q} ${k?"opacity-30 cursor-not-allowed":""}`,placeholder:g,required:i,disabled:k})]})});r.displayName="TextInput";let s=(0,e.forwardRef)((a,b)=>{let{label:c,value:e,onChange:f,placeholder:g,required:i,disabled:k,rows:l=4,className:o,docKey:r=null}=a,{doc:s}=a;return!s&&r&&(s=m(r)),(0,d.jsxs)("div",{className:h()(o),children:[c&&(0,d.jsxs)("label",{className:p,children:[c," ",s&&(0,d.jsx)("div",{className:"inline-block ml-1 text-xs text-gray-500 cursor-pointer",onClick:()=>(0,n.P)(s),children:(0,d.jsx)(j.A,{className:"inline-block w-4 h-4 cursor-pointer"})})]}),(0,d.jsx)("textarea",{ref:b,value:e,onChange:a=>{k||f(a.target.value)},className:`${q} ${k?"opacity-30 cursor-not-allowed":""}`,placeholder:g,required:i,disabled:k,rows:l})]})});s.displayName="TextAreaInput";let t=a=>{let{label:b,value:c,onChange:e,placeholder:g,required:i,min:k,max:l,allowEmpty:o,docKey:r=null}=a,{doc:s}=a;!s&&r&&(s=m(r));let[t,u]=f().useState(c??"");return f().useEffect(()=>{u(c??"")},[c]),(0,d.jsxs)("div",{className:h()(a.className),children:[b&&(0,d.jsxs)("label",{className:p,children:[b," ",s&&(0,d.jsx)("div",{className:"inline-block ml-1 text-xs text-gray-500 cursor-pointer",onClick:()=>(0,n.P)(s),children:(0,d.jsx)(j.A,{className:"inline-block w-4 h-4 cursor-pointer"})})]}),(0,d.jsx)("input",{type:"number",value:t,onChange:a=>{let b=a.target.value;if(u(b),""===b||"-"===b){""===b&&o&&e(null);return}let c=Number(b);isNaN(c)||e(c)},onBlur:()=>{let a=Number(t);if(""===t||isNaN(a))return;let b=a;void 0!==k&&b<k&&(b=k),void 0!==l&&b>l&&(b=l),b!==a&&(u(b),e(b))},className:q,placeholder:g,required:i,min:k,max:l,step:"any"})]})},u=a=>{let{label:b,value:c,onChange:e,options:f,docKey:g=null,multiple:i}=a,{doc:k}=a;!k&&g&&(k=m(g));let l=f&&f.length>0?"options"in f[0]?f.flatMap(a=>a.options):f:[],q=i?l.filter(a=>c.includes(a.value)):l.find(a=>a.value===c);return(0,d.jsxs)("div",{className:h()(a.className,{"opacity-30 cursor-not-allowed":a.disabled}),children:[b&&(0,d.jsxs)("label",{className:p,children:[b," ",k&&(0,d.jsx)("div",{className:"inline-block ml-1 text-xs text-gray-500 cursor-pointer",onClick:()=>(0,n.P)(k),children:(0,d.jsx)(j.A,{className:"inline-block w-4 h-4 cursor-pointer"})})]}),(0,d.jsx)(o,{value:q,options:f,isDisabled:a.disabled,isMulti:i,className:"aitk-react-select-container",classNamePrefix:"aitk-react-select",menuPosition:"fixed",menuPlacement:"auto",onChange:a=>{i?e((a??[]).map(a=>a.value)):a&&e(a.value)}})]})},v="__custom__",w=a=>{let{label:b,value:c,onChange:e,options:g,docKey:i=null}=a,{doc:k}=a;!k&&i&&(k=m(i));let l=!1;g&&g.length>0&&(l="options"in g[0]?g.flatMap(a=>a.options).some(a=>a.value===c):g.some(a=>a.value===c));let[r,s]=f().useState(!l&&!!c),t=f().useRef(null),u={value:v,label:"Custom"},w=f().useMemo(()=>g&&g.length>0&&"options"in g[0]?[{label:"",options:[u]},...g]:[u,...g],[g]),x=r?u:(()=>{if(g&&0!==g.length)return"options"in g[0]?g.flatMap(a=>a.options).find(a=>a.value===c):g.find(a=>a.value===c)})();return(0,d.jsxs)("div",{className:h()(a.className,{"opacity-30 cursor-not-allowed":a.disabled}),children:[b&&(0,d.jsxs)("label",{className:p,children:[b," ",k&&(0,d.jsx)("div",{className:"inline-block ml-1 text-xs text-gray-500 cursor-pointer",onClick:()=>(0,n.P)(k),children:(0,d.jsx)(j.A,{className:"inline-block w-4 h-4 cursor-pointer"})})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("div",{className:r?"w-20 shrink-0":"w-full",children:(0,d.jsx)(o,{value:x,options:w,isDisabled:a.disabled,className:"aitk-react-select-container",classNamePrefix:"aitk-react-select",menuPosition:"fixed",menuPlacement:"auto",formatOptionLabel:a=>a.value===v?(0,d.jsx)("span",{className:"opacity-50 italic",children:"~ Custom ~"}):a.label,onChange:a=>{if(a){let b=a.value;b===v?(s(!0),e(""),requestAnimationFrame(()=>t.current?.focus())):(s(!1),e(b))}}})}),r&&(0,d.jsx)("input",{ref:t,type:"text",value:c,onChange:a=>e(a.target.value),className:`${q} flex-1 min-w-0`,placeholder:a.placeholder??"Enter custom value",disabled:a.disabled})]})]})},x=a=>{let{label:b,checked:c,onChange:e,required:g,disabled:i}=a,{doc:k}=a;!k&&a.docKey&&(k=m(a.docKey));let l=f().useId();return(0,d.jsxs)("div",{className:h()("flex items-center gap-3",a.className),children:[(0,d.jsxs)("button",{type:"button",role:"switch",id:l,"aria-checked":c,"aria-required":g,disabled:i,onClick:()=>!i&&e(!c),className:h()("relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-600 focus:ring-offset-2",c?"bg-blue-500":"bg-gray-600",i?"opacity-50 cursor-not-allowed":"hover:bg-opacity-80"),children:[(0,d.jsxs)("span",{className:"sr-only",children:["Toggle ",b]}),(0,d.jsx)("span",{className:h()("pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out",c?"translate-x-5":"translate-x-0")})]}),b&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("label",{htmlFor:l,className:h()("text-sm font-medium cursor-pointer select-none",i?"text-gray-500":"text-gray-300"),children:b}),k&&(0,d.jsx)("div",{className:"inline-block ml-1 text-xs text-gray-500 cursor-pointer",onClick:()=>(0,n.P)(k),children:(0,d.jsx)(j.A,{className:"inline-block w-4 h-4 cursor-pointer"})})]})]})},y=a=>{let{label:b,className:c,children:e,docKey:f=null}=a,{doc:g}=a;return!g&&f&&(g=m(f)),(0,d.jsxs)("div",{className:h()(c),children:[b&&(0,d.jsxs)("label",{className:h()(p,"mb-2"),children:[b," ",g&&(0,d.jsx)("div",{className:"inline-block ml-1 text-xs text-gray-500 cursor-pointer",onClick:()=>(0,n.P)(g),children:(0,d.jsx)(j.A,{className:"inline-block w-4 h-4 cursor-pointer"})})]}),(0,d.jsx)("div",{className:"space-y-2",children:e})]})},z=a=>{let{label:b,value:c,onChange:e,min:g,max:i,step:k=1,disabled:l,className:o,docKey:q=null,showValue:r=!0}=a,{doc:s}=a;!s&&q&&(s=m(q));let t=f().useRef(null),[u,v]=f().useState(!1),w=f().useMemo(()=>{if(i===g)return 0;let a=(c-g)/(i-g)*100;return a<0?0:a>100?100:a},[c,g,i]),x=f().useCallback(a=>{let b=t.current;if(!b||!Number.isFinite(a))return;let c=b.getBoundingClientRect(),d=c.right-c.left;if(!(d>0))return;let f=(a-c.left)/d;e((a=>{if(!Number.isFinite(a))return g;let b=Math.round((a-g)/k);return(a=>a<g?g:a>i?i:a)(Number((g+b*k).toFixed(6)))})(g+(f<=0?0:f>=1?1:f)*(i-g)))},[g,i,k,e]),y=a=>{if(l)return;a.preventDefault();try{a.currentTarget.setPointerCapture?.(a.pointerId)}catch{}v(!0),x(a.clientX);let b=a=>{a.preventDefault(),x(a.clientX)},c=d=>{v(!1);try{a.currentTarget.releasePointerCapture?.(a.pointerId)}catch{}window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",c)};window.addEventListener("pointermove",b),window.addEventListener("pointerup",c)};return(0,d.jsxs)("div",{className:h()(o,l?"opacity-30 cursor-not-allowed":""),children:[b&&(0,d.jsxs)("label",{className:p,children:[b," ",s&&(0,d.jsx)("div",{className:"inline-block ml-1 text-xs text-gray-500 cursor-pointer",onClick:()=>(0,n.P)(s),children:(0,d.jsx)(j.A,{className:"inline-block w-4 h-4 cursor-pointer"})})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsxs)("div",{ref:t,onPointerDown:y,className:h()("relative w-full h-6 select-none outline-none",l?"pointer-events-none":"cursor-pointer"),children:[(0,d.jsx)("div",{className:"pointer-events-none absolute left-0 right-0 top-1/2 -translate-y-1/2 h-3 rounded-sm bg-gray-800 border border-gray-700"}),(0,d.jsx)("div",{className:"pointer-events-none absolute left-0 top-1/2 -translate-y-1/2 h-3 rounded-sm bg-blue-500",style:{width:`${w}%`}}),(0,d.jsx)("div",{onPointerDown:y,className:h()("absolute top-1/2 -translate-y-1/2 -ml-2","h-4 w-4 rounded-full bg-white shadow border border-gray-300 cursor-pointer",'after:content-[""] after:absolute after:inset-[-6px] after:rounded-full after:bg-transparent',u?"ring-2 ring-blue-600":""),style:{left:`calc(${w}% )`}})]}),(0,d.jsxs)("div",{className:"flex justify-between text-xs text-gray-500 mt-0.5 select-none",children:[(0,d.jsx)("span",{children:g}),(0,d.jsx)("span",{children:i})]})]}),r&&(0,d.jsx)("div",{className:"min-w-[3.5rem] text-right text-sm px-3 py-1 bg-gray-950 dark:bg-gray-800 border border-gray-700 rounded-sm",children:Number.isFinite(c)?c:""})]})]})}},58681:(a,b,c)=>{"use strict";c.d(b,{A:()=>w,N:()=>m});var d=c(21124),e=c(38301),f=c(68813),g=c.n(f),h=c(90447),i=c(55175),j=c(28256),k=c(40822),l=c(52120);function m(a){let b=a.trim();if(!b.startsWith("{"))return!1;try{let a=JSON.parse(b);return!!a&&"object"==typeof a&&"object"==typeof a.compositional_deconstruction}catch{return!1}}let n=["photograph","illustration","3d_render","painting","graphic_design"];function o(a){return({photograph:"photograph",photo:"photograph",illustration:"illustration","3d render":"3d_render","3d_render":"3d_render","3d-render":"3d_render","3drender":"3d_render",render:"3d_render","3d":"3d_render",painting:"painting","graphic design":"graphic_design",graphic_design:"graphic_design","graphic-design":"graphic_design",graphic:"graphic_design"})[(a||"").trim().replace(/\.+$/,"").trim().toLowerCase()]??(a||"").trim()}function p(a){let b=o(a);return"photograph"===b||!n.includes(b)}function q(a){let b=(a||"").trim();return/^#[0-9a-fA-F]{6}$/.test(b)?"#"+b.slice(1).toUpperCase():/^#[0-9a-fA-F]{3}$/.test(b)?"#"+b.slice(1).split("").map(a=>a+a).join("").toUpperCase():"#000000"}function r({title:a,children:b}){return(0,d.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-gray-800 bg-gray-900/40 p-2.5",children:[(0,d.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:a}),b]})}function s({label:a,value:b,onChange:c,placeholder:e}){return(0,d.jsxs)("label",{className:"flex flex-col gap-0.5",children:[a&&(0,d.jsx)("span",{className:"text-[10px] text-gray-400",children:a}),(0,d.jsx)("input",{type:"text",value:b,placeholder:e,spellCheck:!1,onChange:a=>c(a.target.value),className:"bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-100 outline-none focus:border-blue-500"})]})}function t({label:a,value:b,onChange:c,rows:e=3,placeholder:f}){return(0,d.jsxs)("label",{className:"flex flex-col gap-0.5",children:[a&&(0,d.jsx)("span",{className:"text-[10px] text-gray-400",children:a}),(0,d.jsx)("textarea",{value:b,rows:e,placeholder:f,onChange:a=>c(a.target.value),className:"bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-100 outline-none focus:border-blue-500 resize-none"})]})}function u({value:a,onChange:b}){let c=o(a),f=n.includes(c),[g,h]=(0,e.useState)(!f&&""!==(a||"").trim()),i=g||!f&&""!==(a||"").trim();return(0,d.jsxs)("label",{className:"flex flex-col gap-0.5",children:[(0,d.jsx)("span",{className:"text-[10px] text-gray-400",children:"Medium"}),(0,d.jsxs)("select",{value:i?"__custom__":c,onChange:a=>{let c=a.target.value;"__custom__"===c?h(!0):(h(!1),b(c))},className:"bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-100 outline-none focus:border-blue-500",children:[n.map(a=>(0,d.jsx)("option",{value:a,children:a},a)),(0,d.jsx)("option",{value:"__custom__",children:"Custom…"})]}),i&&(0,d.jsx)("input",{type:"text",value:a,placeholder:"custom medium",spellCheck:!1,onChange:a=>b(a.target.value),className:"mt-1 bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-100 outline-none focus:border-blue-500"})]})}function v({colors:a,max:b,onChange:c}){let e=(b,d)=>c(a.map((a,c)=>c===b?d:a));return(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5 items-center",children:[a.map((b,f)=>(0,d.jsxs)("div",{className:"flex items-center gap-1 bg-gray-800 border border-gray-700 rounded px-1 py-0.5",children:[(0,d.jsx)("input",{type:"color",value:q(b),onChange:a=>e(f,q(a.target.value)),className:"w-5 h-5 rounded cursor-pointer bg-transparent border-0 p-0",title:"Pick color"}),(0,d.jsx)("input",{type:"text",value:b,spellCheck:!1,onChange:a=>e(f,a.target.value),className:"w-[58px] bg-transparent text-[10px] text-gray-200 outline-none font-mono"}),(0,d.jsx)("button",{type:"button",onClick:()=>c(a.filter((a,b)=>b!==f)),className:"text-gray-500 hover:text-rose-400",title:"Remove color",children:(0,d.jsx)(h.A,{className:"w-3 h-3"})})]},f)),a.length<b&&(0,d.jsxs)("button",{type:"button",onClick:()=>c([...a,"#888888"]),className:"flex items-center gap-1 text-[10px] text-gray-400 hover:text-gray-200 border border-dashed border-gray-700 rounded px-1.5 py-1",children:[(0,d.jsx)(i.A,{className:"w-3 h-3"})," Add"]})]})}function w({caption:a,onChange:b,selectedIndex:c,onSelectIndex:f,isDrawing:h,onToggleDrawing:m,onSave:n,isDirty:o}){let[q,w]=(0,e.useState)(!1),x=(0,e.useMemo)(()=>{try{return JSON.parse(a)}catch{return null}},[a]),y=c=>{let d;try{d=JSON.parse(a)}catch{return}c(d),b(JSON.stringify(d,null,2))};if(!x)return(0,d.jsxs)("div",{className:"rounded border border-rose-700 bg-rose-950/30 p-2 text-xs text-rose-300",children:["Caption is not valid JSON, so the form editor is unavailable. Fix it in the raw text below.",(0,d.jsx)("textarea",{value:a,onChange:a=>b(a.target.value),rows:8,className:"mt-2 w-full bg-gray-800 border border-gray-700 rounded p-2 text-gray-100 outline-none resize-none"})]});let z=x.style_description||{},A=x.compositional_deconstruction||{},B=Array.isArray(A.elements)?A.elements:[],C=(a,b)=>y(c=>{c.style_description={...c.style_description||{},[a]:b}}),D=p(z.medium??""),E=(D?z.photo:z.art_style)??z.photo??z.art_style??"",F=(a,b)=>y(c=>{let d=c?.compositional_deconstruction?.elements;Array.isArray(d)&&d[a]&&b(d[a])});return(0,d.jsxs)("div",{className:"flex flex-col gap-4 text-sm",children:[(0,d.jsxs)("div",{className:"sticky -top-3 z-20 -mx-3 -mt-3 px-3 pt-3 pb-2 bg-gray-950/95 backdrop-blur border-b border-gray-800 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-gray-200",children:"Ideogram Caption"}),o&&(0,d.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-500 shadow-[0_0_6px] shadow-blue-500/60",title:"Unsaved changes"}),(0,d.jsx)("button",{type:"button",onClick:n,disabled:!o,className:g()("ml-auto px-4 py-1.5 rounded-md border text-xs font-medium transition-colors",{"bg-green-600 border-green-500 text-white hover:bg-green-500 shadow-sm":o,"border-gray-700 text-gray-500 cursor-default":!o}),children:o?"Save":"Saved"})]}),(0,d.jsx)(t,{label:"High-level description",value:x.high_level_description??"",onChange:a=>y(b=>b.high_level_description=a),rows:3,placeholder:"One-sentence summary of the image..."}),(0,d.jsxs)(r,{title:"Style",children:[(0,d.jsx)(s,{label:"Aesthetics",value:z.aesthetics??"",onChange:a=>C("aesthetics",a)}),(0,d.jsx)(s,{label:"Lighting",value:z.lighting??"",onChange:a=>C("lighting",a)}),(0,d.jsx)(u,{value:z.medium??"",onChange:a=>y(b=>{let c={...b.style_description||{}},d=p(c.medium??""),e=p(a);if(c.medium=a,d!==e){let a=c.photo??c.art_style??"";delete c.photo,delete c.art_style,e?c.photo=a:c.art_style=a}b.style_description=c})}),(0,d.jsx)(s,{label:D?"Photo (camera / film)":"Art style (rendering technique)",value:E,onChange:a=>y(b=>{let c={...b.style_description||{}};p(c.medium??"")?(c.photo=a,delete c.art_style):(c.art_style=a,delete c.photo),b.style_description=c}),placeholder:D?"35mm film still, shallow depth of field":"flat vector, clean edges"}),(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-[10px] text-gray-400",children:"Color palette (max 16)"}),(0,d.jsx)(v,{colors:Array.isArray(z.color_palette)?z.color_palette:[],max:16,onChange:a=>y(b=>{let c={...b.style_description||{}};a.length?c.color_palette=a:delete c.color_palette,b.style_description=c})})]})]}),(0,d.jsx)(r,{title:"Background",children:(0,d.jsx)(t,{label:"",value:A.background??"",onChange:a=>y(b=>{b.compositional_deconstruction={...b.compositional_deconstruction||{},background:a}}),rows:4,placeholder:"The scene shell: walls, floor, sky, ambient light..."})}),(0,d.jsxs)(r,{title:`Elements (${B.length})`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>{y(a=>{a.compositional_deconstruction&&"object"==typeof a.compositional_deconstruction||(a.compositional_deconstruction={}),Array.isArray(a.compositional_deconstruction.elements)||(a.compositional_deconstruction.elements=[]),a.compositional_deconstruction.elements.push({type:"obj",desc:""})}),f(B.length)},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-gray-600 text-gray-300 hover:bg-gray-800 text-xs transition-colors",children:[(0,d.jsx)(i.A,{className:"w-3.5 h-3.5"})," Add element"]}),(0,d.jsxs)("button",{type:"button",onClick:m,title:"Draw a new box on the image",className:g()("flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs transition-colors",{"bg-blue-600 border-blue-500 text-white":h,"border-gray-600 text-gray-300 hover:bg-gray-800":!h}),children:[(0,d.jsx)(j.A,{className:"w-3.5 h-3.5"})," ",h?"Drawing… (esc to cancel)":"Draw box"]})]}),B.map((a,b)=>{let e="text"===a.type,h=c===b,i=Array.isArray(a.bbox)&&4===a.bbox.length?a.bbox:null,j=Array.isArray(a.color_palette)?a.color_palette:[];return(0,d.jsxs)("div",{className:g()("rounded-md border p-2.5 flex flex-col gap-2.5 transition-colors",{"ring-1 ring-blue-500/40":h}),style:{backgroundColor:(0,l.ZL)(b,h?.22:.12),borderColor:h?(0,l.Rw)(b):(0,l.ZL)(b,.4)},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>f(h?null:b),className:g()("flex items-center gap-1.5 text-[11px] font-semibold px-2.5 py-1 rounded-md transition-colors",{"bg-blue-600 text-white":h,"bg-gray-800 text-gray-400 hover:text-gray-200":!h}),title:"Select (highlights its box on the image)",children:[(0,d.jsx)("span",{className:"w-2.5 h-2.5 rounded-sm border border-black/30",style:{backgroundColor:(0,l.Rw)(b)}}),"#",b+1]}),(0,d.jsxs)("div",{className:"flex items-center rounded-md border border-gray-700 overflow-hidden",children:[(0,d.jsx)("button",{type:"button",onClick:()=>F(b,a=>{a.type="obj",delete a.text}),className:g()("text-[11px] px-3 py-1 transition-colors",{"bg-cyan-600 text-white":!e,"text-gray-300 hover:bg-gray-800":e}),children:"obj"}),(0,d.jsx)("button",{type:"button",onClick:()=>F(b,a=>{a.type="text",null==a.text&&(a.text="")}),className:g()("text-[11px] px-3 py-1 border-l border-gray-700 transition-colors",{"bg-amber-600 text-white":e,"text-gray-300 hover:bg-gray-800":!e}),children:"text"})]}),(0,d.jsx)("button",{type:"button",onClick:()=>{y(a=>{a?.compositional_deconstruction?.elements?.splice(b,1)}),f(null)},className:"ml-auto text-gray-500 hover:text-rose-400 transition-colors",title:"Delete element",children:(0,d.jsx)(k.A,{className:"w-4 h-4"})})]}),e&&(0,d.jsx)(t,{label:"Text (rendered in image)",value:a.text??"",onChange:a=>F(b,b=>b.text=a),rows:2}),(0,d.jsx)(t,{label:"Description",value:a.desc??"",onChange:a=>F(b,b=>b.desc=a),rows:3}),(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("span",{className:"text-[10px] text-gray-400",children:["Bounding box ",i?"":"(none)"]}),i?(0,d.jsx)("button",{type:"button",onClick:()=>F(b,a=>delete a.bbox),className:"text-[10px] text-rose-400 hover:text-rose-300",children:"remove"}):(0,d.jsx)("button",{type:"button",onClick:()=>F(b,a=>a.bbox=[250,250,750,750]),className:"text-[10px] text-blue-400 hover:text-blue-300",children:"+ add box"})]}),i&&(0,d.jsx)("div",{className:"grid grid-cols-4 gap-1",children:["y1","x1","y2","x2"].map((a,c)=>(0,d.jsxs)("label",{className:"flex flex-col",children:[(0,d.jsx)("span",{className:"text-[9px] text-gray-500",children:a}),(0,d.jsx)("input",{type:"number",min:0,max:1e3,value:i[c],onChange:a=>F(b,b=>{let d,e=[...b.bbox];e[c]=Math.max(0,Math.min(1e3,Math.round(isNaN(d=parseInt(a.target.value,10))?0:d))),b.bbox=e}),className:"bg-gray-800 border border-gray-700 rounded px-1 py-0.5 text-[11px] text-gray-100 outline-none focus:border-blue-500"})]},c))})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-[10px] text-gray-400",children:"Colors (max 5)"}),(0,d.jsx)(v,{colors:j,max:5,onChange:a=>F(b,b=>{a.length?b.color_palette=a:delete b.color_palette})})]})]},b)})]}),(0,d.jsxs)("div",{className:"border-t border-gray-800 pt-2",children:[(0,d.jsx)("button",{type:"button",onClick:()=>w(a=>!a),className:"text-[11px] text-gray-500 hover:text-gray-300",children:q?"▾ Hide raw JSON":"▸ Raw JSON"}),q&&(0,d.jsx)("textarea",{value:a,onChange:a=>b(a.target.value),rows:10,spellCheck:!1,className:"mt-1 w-full bg-gray-800 border border-gray-700 rounded p-2 text-[11px] font-mono text-gray-100 outline-none resize-none"})]})]})}},59653:(a,b,c)=>{"use strict";c.d(b,{default:()=>e});var d=c(97954);(0,d.registerClientReference)(function(){throw Error("Attempted to call mergeLoRAsModalState() from the server but mergeLoRAsModalState is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/MergeLoRAsModal.tsx","mergeLoRAsModalState"),(0,d.registerClientReference)(function(){throw Error("Attempted to call openMergeLoRAsModal() from the server but openMergeLoRAsModal is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/MergeLoRAsModal.tsx","openMergeLoRAsModal");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call the default export of \"/app/ai-toolkit/ui/src/components/MergeLoRAsModal.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/MergeLoRAsModal.tsx","default")},61135:()=>{},61216:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(97954).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/app/ai-toolkit/ui/src/components/AuthWrapper.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/AuthWrapper.tsx","default")},65371:(a,b,c)=>{"use strict";c.d(b,{T:()=>m,default:()=>n});var d=c(21124),e=c(38301),f=c(44806),g=c(40822),h=c(39810),i=c(58449),j=c(38934),k=c(43653);let l=(0,f.VB)(null),m=(a,b,c,d)=>{l.set({folderPath:a,outputName:b,availableLoRAs:c,onClose:d})},n=()=>{let[a,b]=l.use(),c=null!==a,[f,m]=(0,e.useState)([]),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(""),v=(0,e.useRef)(null);(0,e.useEffect)(()=>{a||(m([]),o(!1),q(!1),s(!1),u(""))},[a]),(0,e.useEffect)(()=>{v.current&&(v.current.scrollTop=v.current.scrollHeight)},[t]);let w=()=>{n||(b(null),a?.onClose?.())},x=async()=>{if(n||!a)return;o(!0),q(!1),s(!1),u("");let b=((a,b)=>{let c=a.includes("\\")&&!a.includes("/")?"\\":"/",d=a.replace(/[\\/]+$/,"");return`${d}${c}${b}.safetensors`})(a.folderPath,a.outputName),c=a=>u(b=>b+a);try{let a=await (0,k.A)("merge_loras.py",{args:{loras:JSON.stringify(f),output:b,save_dtype:"bfloat16",device:"cpu"},onStdout:c,onStderr:c});(a?.type!=="exit"||!0!==a.ok)&&(s(!0),a?.type==="error"&&a.message?c(`
${a.message}
`):a?.type==="exit"&&a.timedOut?c("\nScript timed out.\n"):a?.type==="exit"&&c(`
Script exited with code ${a.exitCode}.
`))}catch(a){s(!0),c(`
${a?.message||"Unknown error"}
`)}finally{o(!1),q(!0)}},y=a=>(0,j.e7)(a).replace(".safetensors",""),z=a?.availableLoRAs??[],A=f.map(a=>a.path),B=z.filter(a=>!A.includes(a.path)).map(a=>({value:a.path,label:y(a.path)})),C=a=>{if(0===a.length)return a;let b=Math.round(1/a.length*1e3)/1e3;return a.map(a=>({...a,strength:b}))},D=n||p;return(0,d.jsx)(h.a,{isOpen:c,onClose:w,title:"Merge LoRAs",size:"lg",showCloseButton:!n,closeOnOverlayClick:!n,children:D?(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-2 text-sm",children:[n&&(0,d.jsx)("span",{className:"text-amber-400",children:"Merging LoRAs... please do not close this window."}),p&&r&&(0,d.jsx)("span",{className:"text-rose-400",children:"Merge failed. See log below."}),p&&!r&&(0,d.jsx)("span",{className:"text-emerald-400",children:"Merge complete."})]}),(0,d.jsx)("div",{ref:v,className:"font-mono text-xs whitespace-pre-wrap break-all overflow-y-auto rounded-md p-3 min-h-[400px] max-h-[60vh] bg-white text-gray-900 dark:bg-black dark:text-gray-100",children:t||(n?"Starting...\n":"")}),(0,d.jsx)("div",{className:"mt-4 flex justify-end gap-2",children:(0,d.jsx)("button",{type:"button",onClick:w,disabled:n,className:"px-4 py-2 text-sm bg-gray-700 hover:bg-gray-600 disabled:opacity-40 disabled:cursor-not-allowed text-gray-100 rounded-md",children:"Close"})})]}):(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),x()},children:[(0,d.jsx)(i.ks,{label:"Output Filename",value:a?.outputName||"",suffix:".safetensors",onChange:c=>{b({...a,outputName:c})},placeholder:"Enter output filename"}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(i.pp,{label:"Add LoRA",multiple:!1,value:"",onChange:a=>(a=>{!a||A.includes(a)||m(b=>C([...b,{path:a,strength:0}]))})(a),options:B})}),f.length>0&&(0,d.jsxs)("div",{className:"mt-4",children:[(0,d.jsx)("label",{className:"block text-xs mb-1 text-gray-300",children:"Selected LoRAs"}),(0,d.jsx)("div",{className:"bg-purple-500/10 rounded-xl p-2 max-h-48 overflow-y-auto space-y-1",children:f.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-0.5",children:[(0,d.jsx)("div",{className:"flex-1 min-w-0 text-xs text-gray-200 overflow-hidden text-ellipsis whitespace-nowrap",title:y(a.path),children:y(a.path)}),(0,d.jsx)("input",{type:"number",value:a.strength,onChange:b=>{var c;let d=b.target.value;if(""===d||"-"===d)return;let e=Number(d);isNaN(e)||(c=a.path,m(a=>a.map(a=>a.path===c?{...a,strength:e??0}:a)))},step:"any",className:"w-20 flex-shrink-0 text-xs px-2 py-0.5 bg-gray-950 dark:bg-gray-800 border border-gray-700 rounded-sm text-gray-100 focus:ring-1 focus:ring-gray-600 focus:outline-none"}),(0,d.jsx)("button",{type:"button",onClick:()=>{var b;return b=a.path,void m(a=>C(a.filter(a=>a.path!==b)))},className:"flex-shrink-0 text-gray-400 hover:text-rose-400 p-0.5","aria-label":"Remove",children:(0,d.jsx)(g.A,{className:"w-3.5 h-3.5"})})]},a.path))})]}),(0,d.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:w,className:"px-4 py-2 text-sm text-gray-300 hover:text-gray-100 rounded-md",children:"Cancel"}),(0,d.jsx)("button",{type:"submit",disabled:0===f.length||!a?.outputName,className:"px-4 py-2 text-sm bg-purple-600 hover:bg-purple-700 disabled:opacity-40 disabled:cursor-not-allowed text-white rounded-md",children:"Merge"})]})]})})}},67714:(a,b,c)=>{"use strict";c.d(b,{default:()=>e});var d=c(97954);(0,d.registerClientReference)(function(){throw Error("Attempted to call upsamplePromptsModalState() from the server but upsamplePromptsModalState is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/UpsamplePromptsModal.tsx","upsamplePromptsModalState"),(0,d.registerClientReference)(function(){throw Error("Attempted to call openUpsamplePromptsModal() from the server but openUpsamplePromptsModal is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/UpsamplePromptsModal.tsx","openUpsamplePromptsModal"),(0,d.registerClientReference)(function(){throw Error("Attempted to call toAspectRatio() from the server but toAspectRatio is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/UpsamplePromptsModal.tsx","toAspectRatio");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call the default export of \"/app/ai-toolkit/ui/src/components/UpsamplePromptsModal.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/UpsamplePromptsModal.tsx","default")},70440:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(97523);let e=async a=>[{type:"image/x-icon",sizes:"48x48",url:(0,d.fillMetadataSegment)(".",await a.params,"favicon.ico")+""}]},71471:(a,b,c)=>{"use strict";c.d(b,{U:()=>e,k:()=>f});var d=c(74776);let e=a=>new Promise((b,c)=>{d.u.get(`/api/queue/${a}/start`).then(a=>a.data).then(a=>{console.log("Queue started:",a),b()}).catch(a=>{console.error("Error starting queue:",a),c(a)})}),f=a=>new Promise((b,c)=>{d.u.get(`/api/queue/${a}/stop`).then(a=>a.data).then(a=>{console.log("Queue stopped:",a),b()}).catch(a=>{console.error("Error stopping queue:",a),c(a)})})},74776:(a,b,c)=>{"use strict";c.d(b,{F:()=>e,u:()=>f});var d=c(73852);let e=(0,c(44806).VB)(!1),f=d.A.create();f.interceptors.request.use(a=>{let b=localStorage.getItem("AI_TOOLKIT_AUTH");return b&&(a.headers.Authorization=`Bearer ${b}`),a}),f.interceptors.response.use(a=>a,a=>(a.response&&401===a.response.status&&(localStorage.removeItem("AI_TOOLKIT_AUTH"),e.set(!1)),Promise.reject(a)))},75241:(a,b,c)=>{"use strict";c.d(b,{CaptionDatasetModal:()=>H,S:()=>G});var d=c(21124),e=c(38301),f=c(39810),g=c(44806),h=c(95725);let i=["jpg","jpeg","png","bmp","webp"],j=[...i],k='Caption this video as if you were going to try to generate it with a video generator. Describe the visual content, how it moves and changes over time, and the camera work. Also describe the audio, including any speech, music, or sound effects, and transcribe spoken dialogue verbatim in quotes. Be decisive by stating things as they are. Do not say things like "It appears that" Or "possibly". No preamble. Just get to the point.',l=[{name:"AceStepCaptioner",label:"Ace Step",group:"music",defaults:{"config.process[0].caption.model_name_or_path":["ACE-Step/acestep-transcriber",""],"config.process[0].caption.model_name_or_path2":["ACE-Step/acestep-captioner",void 0],"config.process[0].caption.extensions":[["mp3","wav","flac","ogg"],j]},name_or_path_options:[{value:"ACE-Step/acestep-transcriber",label:"ACE-Step/acestep-transcriber"}],name_or_path2_options:[{value:"ACE-Step/acestep-captioner",label:"ACE-Step/acestep-captioner"}],additionalSections:["caption.model_name_or_path2","caption.fixed_caption"]},{name:"Qwen3VLCaptioner",label:"Qwen3-VL",group:"image",defaults:{"config.process[0].caption.model_name_or_path":["Qwen/Qwen3-VL-8B-Instruct",""],"config.process[0].caption.extensions":[i,j],"config.process[0].caption.caption_prompt":['Caption this image as if you were going to try to generate it with an image generator. Be thurough and describe everything in the image. Be decisive by stating things as they are. Do not say things like "It appears that" Or "possibly". Start out with things like "A person on the beach" or "A black dragon". No preamble. Just get to the point.',void 0],"config.process[0].caption.max_res":[512,void 0],"config.process[0].caption.max_new_tokens":[128,void 0]},name_or_path_options:[{value:"Qwen/Qwen3-VL-2B-Instruct",label:"Qwen/Qwen3-VL-2B-Instruct"},{value:"Qwen/Qwen3-VL-4B-Instruct",label:"Qwen/Qwen3-VL-4B-Instruct"},{value:"Qwen/Qwen3-VL-8B-Instruct",label:"Qwen/Qwen3-VL-8B-Instruct"},{value:"huihui-ai/Huihui-Qwen3-VL-8B-Instruct-abliterated",label:"huihui-ai/Huihui-Qwen3-VL-8B-Instruct-abliterated"},{value:"Qwen/Qwen3-VL-30B-A3B-Instruct",label:"Qwen/Qwen3-VL-30B-A3B-Instruct"},{value:"Qwen/Qwen3.6-27B",label:"Qwen/Qwen3.6-27B"},{value:"huihui-ai/Huihui-Qwen3.6-27B-abliterated",label:"huihui-ai/Huihui-Qwen3.6-27B-abliterated"}],additionalSections:["caption.caption_prompt","caption.max_res","caption.max_new_tokens","caption.thinking"]},{name:"Qwen3OmniCaptioner",label:"Qwen3-Omni",group:"image/video/sound",defaults:{"config.process[0].caption.model_name_or_path":["ai-toolkit/Qwen3-Omni-30B-A3B-Thinking",""],"config.process[0].caption.extensions":[["mp4","mov","webm","mkv","avi",...i],j],"config.process[0].caption.caption_prompt":[k,void 0],"config.process[0].caption.max_res":[512,void 0],"config.process[0].caption.max_new_tokens":[512,void 0],"config.process[0].caption.batch_size":[1,void 0],"config.process[0].caption.compile":[!0,!1]},name_or_path_options:[{value:"ai-toolkit/Qwen3-Omni-30B-A3B-Instruct",label:"ai-toolkit/Qwen3-Omni-30B-A3B-Instruct"},{value:"ai-toolkit/Qwen3-Omni-30B-A3B-Thinking",label:"ai-toolkit/Qwen3-Omni-30B-A3B-Thinking"},{value:"ai-toolkit/Huihui-Qwen3-Omni-30B-A3B-Thinking-abliterated",label:"ai-toolkit/Huihui-Qwen3-Omni-30B-A3B-Thinking-abliterated"}],captionPrompts:{General:k,"MiniMax H4 T2V":`Caption this video as a MiniMax text-to-video-audio (T2VA) training prompt. Watch the video and listen to the audio, then output exactly three fields in this order, each starting on its own line with these exact field names:
integrated_multimodal_description: [Shot 1] ...
overall_soundscape: ...
non_diegetic_music: ...
Rules for integrated_multimodal_description: Start with [Shot 1] (the first shot gets no timestamp) and state the overall visual style (Live-action, cinematic, 2D-animated, 3D CG, claymation, watercolor, or vintage film) and the initial framing. Then describe everything visible and audible in chronological order: subject appearance and position, scene and key props, actions and reactions, shot changes, speech, and the diegetic sounds that accompany them. Begin each later shot as "[Shot 2] At 00:03.500, the camera cuts to ..." with strictly increasing cut times within the video. Write camera motion as a natural action using this vocabulary: zoom in/out, push in, pull out, pan left/right, truck left/right, tilt up/down, pedestal up/down, arc shot, tracking shot, static shot, POV, roll clockwise/counterclockwise, shake slightly/strongly - adding "with small amplitude"/"with large amplitude" and "at slow speed"/"at fast speed" only when the range or pacing is notable. Give every person who speaks or sings a stable ID like (S1) or (S2); when a speaker first appears, identify them with type, age, gender, and voice quality (pitch, timbre, pace, accent). Transcribe all speech and lyrics verbatim in this form: The young woman with a quiet, breathy voice (S1) says: <d>[English] I get off at the next station.</d> - the language tag names the spoken language and only the exact spoken words go inside <d></d>. For narration with no visible lip movement, write "says in an off-screen voiceover:" before the <d> block and state afterwards that the character's lips remain completely closed. Put any legible on-screen text (signs, labels, subtitles) in double quotation marks verbatim without translating it.
overall_soundscape: 1-4 sentences in one paragraph summarizing the ambient sound, physical action sounds, and non-verbal human sounds across the whole video (wind, traffic, footsteps, fabric, impacts, breathing, laughter). Do not repeat dialogue, singing, or diegetic music here. Use N/A only if the video is completely silent.
non_diegetic_music: 1-3 sentences describing background music the characters cannot hear: instrumentation, tempo, rhythm, and dynamic changes, with no abstract mood words. Music coming from a source inside the scene belongs in the multimodal description instead. Use N/A if there is none.
Describe only what is actually seen and heard. Be decisive. No preamble and no extra text - output only the three fields.`,"MiniMax H4 Image":`Caption this image as a MiniMax training prompt for a single still frame. Output exactly three fields in this order, each starting on its own line with these exact field names:
integrated_multimodal_description: [Shot 1] ...
overall_soundscape: N/A
non_diegetic_music: N/A
Rules for integrated_multimodal_description: Write a single [Shot 1] with no timestamp, no cuts, and no camera motion - the camera holds a static shot on a still frame. State the overall visual style first (Live-action, cinematic, 2D-animated, 3D CG, claymation, watercolor, or vintage film) and the framing (extreme wide shot, wide shot, medium shot, medium close-up, close-up, or extreme close-up, plus the viewpoint). Then describe everything visible decisively and specifically: subject appearance, pose, and position; clothing, colors, and materials; the scene, lighting, and key props; and the spatial relationships between them. There is no motion, no dialogue, and no sound - do not invent any. Put any legible text in the image (signs, labels, packaging) in double quotation marks verbatim without translating it.
overall_soundscape and non_diegetic_music are always exactly N/A for a still image.
Describe only what is actually visible. Be decisive. No preamble and no extra text - output only the three fields.`},additionalSections:["caption.caption_prompt","caption.max_res","caption.max_new_tokens","caption.batch_size","caption.layer_offloading","caption.thinking"]},{name:"Ideogram4Captioner",label:"Ideogram 4 Captioner",group:"image",hasMultiLinePrompts:!0,minNewTokens:3072,defaults:{"config.process[0].caption.model_name_or_path":["Qwen/Qwen3-VL-8B-Instruct",""],"config.process[0].caption.extensions":[i,j],"config.process[0].caption.caption_prompt":["Describe only what is actually visible in the image — never invent, add, or infer content that is not present. Identify the medium (photograph, illustration, 3D render, or graphic design) and name any recognizable people, brands, characters, or landmarks. Be decisive and specific: commit to one concrete value per attribute (one color, one material, one pose) and avoid hedging. Transcribe every piece of legible text verbatim.",void 0],"config.process[0].caption.max_res":[512,void 0],"config.process[0].caption.max_new_tokens":[4096,void 0]},name_or_path_options:[{value:"Qwen/Qwen3-VL-2B-Instruct",label:"Qwen/Qwen3-VL-2B-Instruct"},{value:"Qwen/Qwen3-VL-4B-Instruct",label:"Qwen/Qwen3-VL-4B-Instruct"},{value:"Qwen/Qwen3-VL-8B-Instruct",label:"Qwen/Qwen3-VL-8B-Instruct"},{value:"Qwen/Qwen3-VL-30B-A3B-Instruct",label:"Qwen/Qwen3-VL-30B-A3B-Instruct"}],additionalSections:["caption.caption_prompt","caption.max_res","caption.max_new_tokens"]}].sort((a,b)=>a.label.localeCompare(b.label,void 0,{sensitivity:"base"})),m=l.reduce((a,b)=>{let c=a.find(a=>a.label===b.group);return c?c.options.push({value:b.name,label:b.label}):a.push({label:b.group,options:[{value:b.name,label:b.label}]}),a},[]),n=[{value:"",label:"- NONE -"},{value:"float8",label:"float8"},{value:"convrot8",label:"8bit convrot (default)"},{value:"convrot4",label:"4bit convrot (nvfp4)"},{value:"convrotint7",label:"7bit convrot"},{value:"convrotint6",label:"6bit convrot"},{value:"convrotint5",label:"5bit convrot"},{value:"convrotint4",label:"4bit convrot"},{value:"convrotint3",label:"3bit convrot"},{value:"convrotint2",label:"2bit convrot"},{value:"convrotbitnet",label:"1.58bit convrot (bitnet)"},{value:"uint7",label:"7 bit"},{value:"uint6",label:"6 bit"},{value:"uint5",label:"5 bit"},{value:"uint4",label:"4 bit"},{value:"uint3",label:"3 bit"},{value:"uint2",label:"2 bit"}],o=[{value:"1",label:"1 (default)"},{value:"2",label:"2"},{value:"4",label:"4"},{value:"8",label:"8"},{value:"12",label:"12"},{value:"16",label:"16"},{value:"24",label:"24"},{value:"32",label:"32"}],p=[{value:"256",label:"256"},{value:"512",label:"512 (default)"},{value:"768",label:"768"},{value:"1024",label:"1024"}],q=[{value:"64",label:"64"},{value:"128",label:"128 (default)"},{value:"256",label:"256"},{value:"512",label:"512"},{value:"1024",label:"1024"},{value:"2048",label:"2048"},{value:"3072",label:"3072"},{value:"4096",label:"4096"},{value:"8192",label:"8192"}],r={job:"extension",config:{name:"Caption Directory",process:[{type:"Qwen3OmniCaptioner",sqlite_db_path:"./aitk_db.db",device:"cuda",caption:{model_name_or_path:"ai-toolkit/Qwen3-Omni-30B-A3B-Thinking",dtype:"bf16",quantize:!0,qtype:"convrot8",low_vram:!1,extensions:["mp4","mov","webm","mkv","avi","jpg","jpeg","png","bmp","webp"],path_to_caption:"",recaption:!1,compile:!0,caption_extension:"txt",caption_prompt:'Caption this video as if you were going to try to generate it with a video generator. Describe the visual content, how it moves and changes over time, and the camera work. Also describe the audio, including any speech, music, or sound effects, and transcribe spoken dialogue verbatim in quotes. Be decisive by stating things as they are. Do not say things like "It appears that" Or "possibly". No preamble. Just get to the point.',max_res:512,max_new_tokens:512,batch_size:1}}]}},s=a=>{let b={};for(let c in a)c.startsWith("config.process[0].")?b[c]=a[c]:b[`config.process[0].${c}`]=a[c];return b};var t=c(38934),u=c(35404),v=c(11810),w=c(78418),x=c(74776),y=c(2117),z=c(50398),A=c(71471),B=c(58449);let C=({jobConfig:a,setJobConfig:b,gpuIDs:c,setGpuIDs:e,gpuList:f,showGPUSelect:g})=>{let h=l.find(b=>b.name===a.config.process[0].type),i=h?.additionalSections||[],j=h?.captionPrompts||{},k=Object.keys(j),r=h?.minNewTokens??0,t=q.filter(a=>parseInt(a.value)>=r);return(0,d.jsxs)("div",{className:"text-sm text-gray-400",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,d.jsx)("div",{children:(0,d.jsx)(B.pp,{label:"Captioner Type",value:a.config.process[0].type,onChange:c=>{((a,b,c,d)=>{let e=l.find(b=>b.name===a);if(!e||e.name===b)return;let f=l.find(a=>a.name===b),g=s(e.defaults||{}),h=s(f?.defaults||{});for(let a in d(b,"config.process[0].type"),g)d(g[a][1],a);for(let a in h)d(h[a][0],a)})(a.config.process[0].type,c,0,b)},options:m})}),g&&(0,d.jsx)("div",{children:(0,d.jsx)(B.pp,{label:"GPU ID",value:`${c}`,onChange:a=>e(a),options:f.map(a=>({value:`${a.index}`,label:`GPU #${a.index}`}))})})]}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(B.kM,{label:"Name or Path",value:a.config.process[0].caption.model_name_or_path,docKey:"config.process[0].caption.model_name_or_path",onChange:a=>{a?.trim()===""&&(a=null),b(a,"config.process[0].caption.model_name_or_path")},placeholder:"",options:h?.name_or_path_options||[],required:!0})}),i.includes("caption.model_name_or_path2")&&(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(B.kM,{label:"Name or Path 2",value:a.config.process[0].caption.model_name_or_path2||"",onChange:a=>{a?.trim()===""&&(a=null),b(a,"config.process[0].caption.model_name_or_path2")},placeholder:"",options:h?.name_or_path2_options||[]})}),i.includes("caption.fixed_caption")&&(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(B.ks,{label:"Fixed Caption",value:a.config.process[0].caption.fixed_caption||"",onChange:a=>{a?.trim()===""&&(a=void 0),b(a,"config.process[0].caption.fixed_caption")},placeholder:"Enter fixed caption (if you want the same caption for all audio files)"})}),(0,d.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(B.pp,{label:"Quantize",value:a.config.process[0].caption.quantize?a.config.process[0].caption.qtype:"",onChange:a=>{""===a?(b(!1,"config.process[0].caption.quantize"),a="convrot8"):b(!0,"config.process[0].caption.quantize"),b(a,"config.process[0].caption.qtype")},options:n}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(B.kM,{label:"Caption Extension",value:a.config.process[0].caption.caption_extension||"txt",onChange:a=>{b(a,"config.process[0].caption.caption_extension")},options:[{value:"txt",label:"txt"},{value:"json",label:"json"},{value:"caption",label:"caption"}]})}),i.includes("caption.max_res")&&(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(B.pp,{label:"Max Resolution",value:`${a.config.process[0].caption.max_res||""}`,onChange:a=>{let c=parseInt(a);isNaN(c)||b(c,"config.process[0].caption.max_res")},options:p})}),i.includes("caption.max_new_tokens")&&(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(B.pp,{label:"Max New Tokens",value:`${a.config.process[0].caption.max_new_tokens||""}`,onChange:a=>{let c=parseInt(a);isNaN(c)||b(c,"config.process[0].caption.max_new_tokens")},options:t})}),i.includes("caption.batch_size")&&(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(B.pp,{label:"Batch Size",value:`${a.config.process[0].caption.batch_size||""}`,onChange:a=>{let c=parseInt(a);isNaN(c)||b(c,"config.process[0].caption.batch_size")},options:o})})]}),(0,d.jsx)("div",{children:(0,d.jsxs)(B.gE,{label:"Options",children:[(0,d.jsx)(B.Sc,{label:"Low VRAM",checked:a.config.process[0].caption.low_vram,onChange:a=>b(a,"config.process[0].caption.low_vram")}),(0,d.jsx)(B.Sc,{label:"Recaption",checked:a.config.process[0].caption.recaption,onChange:a=>b(a,"config.process[0].caption.recaption")}),(0,d.jsx)(B.Sc,{label:"Compile Models",checked:a.config.process[0].caption.compile||!1,onChange:a=>b(a,"config.process[0].caption.compile")}),i.includes("caption.thinking")&&(0,d.jsx)(B.Sc,{label:"Thinking",checked:a.config.process[0].caption.thinking||!1,onChange:a=>b(a,"config.process[0].caption.thinking")}),i.includes("caption.layer_offloading")&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(B.Sc,{label:"Layer Offloading",checked:a.config.process[0].caption.layer_offloading||!1,onChange:a=>b(a,"config.process[0].caption.layer_offloading")}),a.config.process[0].caption.layer_offloading&&(0,d.jsx)("div",{className:"pt-2",children:(0,d.jsx)(B.Cw,{label:"Offload %",value:Math.round((a.config.process[0].caption.layer_offloading_percent??1)*100),onChange:a=>b(.01*a,"config.process[0].caption.layer_offloading_percent"),min:0,max:100,step:1})})]})]})})]}),i.includes("caption.caption_prompt")&&(0,d.jsxs)("div",{className:"mt-4",children:[k.length>1&&(0,d.jsx)("div",{className:"mb-4",children:(0,d.jsx)(B.pp,{label:"Prompt Preset",value:k.find(b=>j[b]===a.config.process[0].caption.caption_prompt)||"",onChange:a=>{void 0!==j[a]&&b(j[a],"config.process[0].caption.caption_prompt")},options:[{value:"",label:"- Custom -"},...k.map(a=>({value:a,label:a}))]})}),(0,d.jsx)(B.No,{label:"Caption Prompt",value:a.config.process[0].caption.caption_prompt||"",onChange:a=>{b(a,"config.process[0].caption.caption_prompt")},placeholder:"Enter caption prompt"})]})]})};var D=c(34654),E=c(49113);let F=(0,g.VB)(null),G=(a,b,c)=>{F.set({datasetPath:a,onClose:b,jobId:c?.jobId??null,cloneId:c?.cloneId??null,defaultCaptionExt:c?.defaultCaptionExt})},H=()=>{let[a,b]=F.use(),[c,g]=(0,u.S)((0,t.fi)(r)),[i,j]=(0,e.useState)(null),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!1),{gpuList:o,isGPUInfoLoaded:p}=(0,w.A)(),[q,s]=(0,e.useState)("simple"),G=null!==a,H=(0,e.useRef)(!1),[I,J]=(0,e.useState)(!1),K=!(0,v.c)(),L=!!(a?.jobId||a?.cloneId)&&!m;(0,h.v)(()=>{g((0,t.fi)(r)),s("simple"),l(null),a?.datasetPath&&g(a.datasetPath,"config.process[0].caption.path_to_caption"),a?.defaultCaptionExt&&g(a.defaultCaptionExt,"config.process[0].caption.caption_extension")},[a]),(0,e.useEffect)(()=>{a?.cloneId&&x.u.get(`/api/jobs?id=${a.cloneId}`).then(a=>a.data).then(a=>{j(a.gpu_ids);let b=JSON.parse(a.job_config);b.config.name=`${b.config.name}_copy`,g(b)}).catch(a=>console.error("Error fetching caption job:",a)).finally(()=>n(!0))},[a?.cloneId]),(0,e.useEffect)(()=>{a?.jobId&&x.u.get(`/api/jobs?id=${a.jobId}`).then(a=>a.data).then(a=>{j(a.gpu_ids),l(a.name),g(JSON.parse(a.job_config))}).catch(a=>console.error("Error fetching caption job:",a)).finally(()=>n(!0))},[a?.jobId]),(0,e.useEffect)(()=>{p&&null===i&&o.length>0&&j(`${o[0].index}`)},[o,p]);let M=()=>{a?.onClose&&a.onClose(),n(!1),b(null)},N=async()=>{if(H.current)return;if(!a?.datasetPath)return void alert("Dataset path is missing. Please try again.");H.current=!0,J(!0);let b=!!a.jobId;x.u.post("/api/jobs",{id:b?a.jobId:null,name:b&&k?k:(0,y.A)(),gpu_ids:i,job_config:c,job_type:"caption",job_ref:a.datasetPath}).then(async a=>{let b=a.data.id;await (0,z._1)(b),await (0,A.U)(i||""),H.current=!1,J(!1),M()}).catch(a=>{a.response?.status===409?alert("A caption job for this dataset already exists. Please check your jobs list."):alert("Failed to save job. Please try again."),console.log("Error saving training:",a),H.current=!1,J(!1)})},O=a=>`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${q===a?"border-blue-500 text-blue-400":"border-transparent text-gray-400 hover:text-gray-200 hover:border-gray-600"}`;return(0,d.jsx)(f.a,{isOpen:G,onClose:M,title:"Caption Dataset",size:"advanced"===q?"xl":"lg",children:(0,d.jsxs)("div",{className:"relative space-y-4 text-gray-200",children:[(L||I)&&(0,d.jsx)("div",{className:"absolute -left-6 -right-6 -top-4 -bottom-4 z-10 flex items-center justify-center backdrop-blur-sm bg-gray-900/40",children:(0,d.jsx)(E.A,{className:"w-10 h-10 text-blue-400 animate-spin"})}),(0,d.jsxs)("div",{className:"flex items-center border-b border-gray-700 -mt-2",children:[(0,d.jsx)("button",{type:"button",className:O("simple"),onClick:()=>s("simple"),children:"Simple"}),(0,d.jsx)("button",{type:"button",className:O("advanced"),onClick:()=>s("advanced"),children:"Advanced"}),(0,d.jsx)("div",{className:"flex-1"}),"advanced"===q&&K&&(0,d.jsx)("div",{className:"pb-2",children:(0,d.jsx)(B.pp,{value:`${i}`,onChange:a=>j(a),options:o.map(a=>({value:`${a.index}`,label:`GPU #${a.index}`}))})})]}),(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),N()},children:["simple"===q?(0,d.jsx)(C,{jobConfig:c,setJobConfig:g,gpuIDs:i,setGpuIDs:j,gpuList:o,showGPUSelect:K}):(0,d.jsx)("div",{className:"h-[60vh] mt-2",children:(0,d.jsx)(D.A,{config:c,setConfig:g})}),(0,d.jsxs)("div",{className:"mt-6 flex justify-end space-x-3",children:[(0,d.jsx)("button",{type:"button",className:"rounded-md bg-gray-700 px-4 py-2 text-gray-200 hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-500",onClick:M,children:"Cancel"}),(0,d.jsx)("button",{type:"submit",className:"rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500",children:"Add to Queue"})]})]})]})})}},78162:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(97523);let e=async a=>[{type:"image/png",sizes:"96x96",url:(0,d.fillMetadataSegment)(".",await a.params,"icon.png")+"?5af554287e132314"}]},78418:(a,b,c)=>{"use strict";c.d(b,{A:()=>f});var d=c(38301),e=c(15542);function f(a=null,b=null){let{gpu:c,connected:g}=(0,e.A)(),h=a?a.join(","):null,i=(0,d.useMemo)(()=>{if(!c)return[];let a=[...c.gpus].sort((a,b)=>a.index-b.index);if(null!==h){let b=""===h?[]:h.split(",").map(Number);a=a.filter(a=>b.includes(a.index))}return a},[c,h]);return{gpuList:i,isGPUInfoLoaded:null!==c,status:null!==c?"success":g?"loading":"idle",refreshGpuInfo:async()=>{}}}},78568:(a,b,c)=>{"use strict";c.d(b,{cy:()=>p,default:()=>r,x5:()=>q});var d=c(21124),e=c(38301),f=c(44806),g=c(8015),h=c(90447),i=c(49113),j=c(92080),k=c(68813),l=c.n(k),m=c(39810),n=c(43653);let o=(0,f.VB)(null),p=(a,b,c)=>{o.set({prompts:a,onApply:b,onClose:c})};function q(a,b){if(!a||!b||a<=0||b<=0)return"auto";let c=(a,b)=>b?c(b,a%b):a,d=c(a,b),e=a/d,f=b/d;if(e<=16&&f<=16)return`${e}:${f}`;let g=a/b,h=null;for(let a=1;a<=16;a++){let b=Math.max(1,Math.round(g*a)),c=Math.abs(b/a-g);(!h||c<h.err)&&(h={err:c,p:b,q:a})}return`${h.p}:${h.q}`}let r=()=>{let[a,b]=o.use(),c=null!==a,[f,k]=(0,e.useState)({}),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)({}),[v,w]=(0,e.useState)({}),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(""),F=(0,e.useRef)(null);(0,e.useEffect)(()=>{k({}),q(!1),s(""),u({}),w({}),y(!1),A(!1),C(!1),E("")},[a]),(0,e.useEffect)(()=>{F.current&&(F.current.scrollTop=F.current.scrollHeight)},[D]);let G=()=>{x||(b(null),a?.onClose?.())},H=a?.prompts??[],I=H.filter(a=>f[a.index]).length,J=a=>{if(x)return;let b={};H.forEach(c=>b[c.index]=a),k(b)},K=async()=>{if(x||!a)return;let b=a.prompts.filter(a=>f[a.index]);if(0===b.length)return;y(!0),A(!1),C(!1),E(""),w({});let c=b.map(a=>a.index);u(()=>{let a={};return c.forEach((b,c)=>a[b]=0===c?"running":"queued"),a});let d=b.map(a=>({prompt:a.prompt,aspect_ratio:a.aspectRatio})),e="",g=a=>E(b=>b+a);try{let b=await (0,n.A)("upsample_ideogram4_caption.py",{args:{prompts:JSON.stringify(d),stream:!0,temperature:.7,quantize:!0,...p?{creative:!0}:{},...r.trim()?{instructions:r.trim()}:{}},onStdout:b=>{let d;for(e+=b;(d=e.indexOf("\n"))>=0;){let b=e.slice(0,d).trim();if(e=e.slice(d+1),b)try{let d=JSON.parse(b);if("number"!=typeof d.index)continue;let e=c[d.index];if(void 0===e)continue;if(d.caption){let b=JSON.stringify(d.caption,null,2);w(a=>({...a,[e]:b})),u(a=>({...a,[e]:"done"})),a.onApply(e,b)}else u(a=>({...a,[e]:"failed"}));let f=c[d.index+1];void 0!==f&&u(a=>"queued"===a[f]?{...a,[f]:"running"}:a)}catch{}}},onStderr:g});(b?.type!=="exit"||!0!==b.ok)&&(C(!0),b?.type==="error"&&b.message?g(`
${b.message}
`):b?.type==="exit"&&b.timedOut?g("\nScript timed out.\n"):b?.type==="exit"&&g(`
Script exited with code ${b.exitCode}.
`))}catch(a){C(!0),g(`
${a?.message||"Unknown error"}
`)}finally{u(a=>{let b={...a};return c.forEach(a=>{("running"===b[a]||"queued"===b[a])&&(b[a]="failed")}),b}),y(!1),A(!0)}},L=({s:a})=>"done"===a?(0,d.jsx)(g.A,{className:"w-4 h-4 text-emerald-400"}):"failed"===a?(0,d.jsx)(h.A,{className:"w-4 h-4 text-rose-400"}):"running"===a?(0,d.jsx)(i.A,{className:"w-4 h-4 text-amber-400 animate-spin"}):"queued"===a?(0,d.jsx)(i.A,{className:"w-4 h-4 text-gray-500"}):(0,d.jsx)("span",{className:"inline-block w-4 h-4"});return(0,d.jsx)(m.a,{isOpen:c,onClose:G,title:"Upsample Prompts",size:"lg",showCloseButton:!x,closeOnOverlayClick:!x,children:(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-3 flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs text-amber-300",children:[(0,d.jsx)(j.A,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),(0,d.jsx)("span",{children:"This loads a model and runs on the GPU. You need at least 13GB of free VRAM to run this, so make sure the GPU is idle (no training or other jobs running) before starting, or it may run out of memory."})]}),(0,d.jsxs)("div",{className:"mb-2 flex items-center justify-between text-sm",children:[(0,d.jsxs)("div",{className:"text-gray-400",children:[x&&(0,d.jsx)("span",{className:"text-amber-400",children:"Upsampling... please do not close this window."}),z&&B&&(0,d.jsx)("span",{className:"text-rose-400",children:"Finished with errors. See log below."}),z&&!B&&(0,d.jsx)("span",{className:"text-emerald-400",children:"Upsampling complete."}),!x&&!z&&(0,d.jsxs)("span",{children:["Select prompts to upsample into structured Ideogram captions. ",I,"/",H.length," selected."]})]}),!x&&!z&&(0,d.jsxs)("div",{className:"flex gap-2 flex-shrink-0",children:[(0,d.jsx)("button",{type:"button",onClick:()=>J(!0),className:"text-xs text-gray-300 hover:text-gray-100",children:"Select all"}),(0,d.jsx)("span",{className:"text-gray-600",children:"|"}),(0,d.jsx)("button",{type:"button",onClick:()=>J(!1),className:"text-xs text-gray-300 hover:text-gray-100",children:"None"})]})]}),(0,d.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,d.jsxs)("button",{type:"button",disabled:x||z,onClick:()=>q(a=>!a),className:l()("px-2.5 py-1 text-xs rounded-md border transition-colors disabled:opacity-40 disabled:cursor-not-allowed",{"bg-purple-600 border-purple-500 text-white":p,"border-gray-700 text-gray-300 hover:border-gray-500":!p}),children:["Creative: ",p?"On":"Off"]}),(0,d.jsx)("span",{className:"text-[11px] text-gray-500",children:p?"Expands the idea — places the subject in a scene and adds fitting details.":"Faithful — structures the prompt as given, with a minimal background."})]}),(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsx)("label",{className:"block text-[11px] mb-1 text-gray-400",children:"Additional instructions (optional)"}),(0,d.jsx)("textarea",{value:r,onChange:a=>s(a.target.value),disabled:x||z,rows:2,placeholder:"e.g. keep it a close-up portrait, prefer a daytime setting, always include a 9:16 vertical framing...",className:"w-full text-xs px-2 py-1.5 bg-gray-950 border border-gray-700 rounded-md text-gray-100 placeholder-gray-600 focus:ring-1 focus:ring-gray-600 focus:outline-none resize-none disabled:opacity-50"})]}),(0,d.jsx)("div",{className:"rounded-md bg-gray-950 border border-gray-800 max-h-[45vh] overflow-y-auto divide-y divide-gray-800",children:H.map(a=>{let b=t[a.index],c=!!f[a.index],e=v[a.index]??a.prompt,g=(x||z)&&!b;return(0,d.jsxs)("div",{className:l()("flex items-start gap-2 px-3 py-2",{"opacity-40":g}),children:[(0,d.jsx)("input",{type:"checkbox",checked:c,disabled:x||z,onChange:()=>(a=>{x||k(b=>({...b,[a]:!b[a]}))})(a.index),className:"mt-0.5 flex-shrink-0 accent-purple-600"}),(0,d.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:(0,d.jsx)(L,{s:b})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("span",{className:"text-[10px] text-gray-500 flex-shrink-0",children:["#",a.index+1]}),(0,d.jsx)("span",{className:"text-[10px] text-gray-500 flex-shrink-0",children:a.aspectRatio}),v[a.index]&&(0,d.jsx)("span",{className:"text-[10px] text-emerald-400 flex-shrink-0",children:"upsampled"})]}),(0,d.jsx)("div",{className:l()("text-xs break-words line-clamp-2",{"text-emerald-200":v[a.index],"text-gray-300":!v[a.index]}),title:v[a.index]?v[a.index]:a.prompt,children:e})]})]},a.index)})}),(x||z)&&D&&(0,d.jsx)("div",{ref:F,className:"mt-3 font-mono text-[10px] whitespace-pre-wrap break-all overflow-y-auto rounded-md p-2 max-h-32 bg-black text-gray-300",children:D}),(0,d.jsxs)("div",{className:"mt-4 flex justify-end gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:G,disabled:x,className:"px-4 py-2 text-sm text-gray-300 hover:text-gray-100 disabled:opacity-40 disabled:cursor-not-allowed rounded-md",children:z?"Close":"Cancel"}),!z&&(0,d.jsx)("button",{type:"button",onClick:K,disabled:x||0===I,className:"px-4 py-2 text-sm bg-purple-600 hover:bg-purple-700 disabled:opacity-40 disabled:cursor-not-allowed text-white rounded-md",children:x?"Upsampling...":`Upsample (${I})`})]})]})})}},87907:(a,b,c)=>{"use strict";c.d(b,{default:()=>e});var d=c(97954);(0,d.registerClientReference)(function(){throw Error("Attempted to call mobileSidebarState() from the server but mobileSidebarState is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/Sidebar.tsx","mobileSidebarState");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call the default export of \"/app/ai-toolkit/ui/src/components/Sidebar.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/Sidebar.tsx","default")},92380:(a,b,c)=>{"use strict";c.d(b,{default:()=>r,f:()=>p});var d=c(21124),e=c(38301),f=c(23312),g=c(12999),h=c(44806),i=c(28256),j=c(90447),k=c(68813),l=c.n(k),m=c(52120),n=c(58681);let o=(0,h.VB)(null),p=a=>{o.set(a)};function q(a){try{return JSON.parse(a)}catch{return null}}let r=()=>{let[a,b]=(0,e.useState)(!1),[c,h]=o.use(),k=null!==c,[p,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(""),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!0);(0,e.useEffect)(()=>b(!0),[]),(0,e.useEffect)(()=>{let a=c?.prompt??"";r(a),t(a),v(null),x(!1),z(!0)},[c]);let A=(0,e.useMemo)(()=>(0,n.N)(p),[p]),B=p.trim()!==s.trim(),C=(0,e.useCallback)(()=>{c&&(c.onApply(p),t(p))},[c,p]),D=(0,e.useCallback)(()=>{c&&p.trim()!==s.trim()&&c.onApply(p),h(null)},[c,p,s,h]),E=(0,e.useCallback)(a=>{let b=q(p);if(!b)return;let c=b?.compositional_deconstruction?.elements;if(!Array.isArray(c))return;let d=a(c,b);return r(JSON.stringify(b,null,2)),d},[p]),F=(0,e.useCallback)((a,b)=>{E(c=>{c[a]&&(c[a].bbox=[b.y1,b.x1,b.y2,b.x2])})},[E]),G=(0,e.useCallback)(a=>{let b=E(b=>(b.push({type:"obj",bbox:[a.y1,a.x1,a.y2,a.x2],desc:""}),b.length-1));v("number"==typeof b?b:null),x(!1)},[E]),H=(0,e.useMemo)(()=>(0,m.dn)(q(p)),[p]);return a?(0,f.createPortal)((0,d.jsxs)(g.lG,{open:k,onClose:D,className:"relative z-10",children:[(0,d.jsx)(g.Xi,{transition:!0,className:"fixed inset-0 bg-gray-900/75 transition-opacity data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in"}),(0,d.jsx)("div",{className:"fixed inset-0 z-10 w-screen overflow-y-auto",children:(0,d.jsx)("div",{className:"flex min-h-full items-center justify-center p-0 sm:p-4 text-center",children:(0,d.jsxs)(g.Lj,{transition:!0,className:"relative transform rounded-none sm:rounded-lg bg-gray-800 text-left shadow-xl transition-all data-closed:translate-y-4 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in w-full sm:w-auto sm:max-w-[95vw] sm:max-h-[95vh] data-closed:sm:translate-y-0 data-closed:sm:scale-95 flex flex-col sm:flex-row overflow-hidden",children:[(0,d.jsxs)("div",{className:"relative flex-1 min-w-0 flex items-center justify-center bg-gray-900 overflow-hidden p-4 sm:p-8",children:[(0,d.jsxs)("div",{className:"relative h-[50vh] sm:h-[70vh] max-w-full rounded-lg overflow-hidden shadow-inner bg-gray-700",style:{aspectRatio:function(a){if(!a)return"1 / 1";let b=a.trim().match(/^(\d+)\s*[:/]\s*(\d+)$/);if(!b)return"1 / 1";let c=parseInt(b[1],10),d=parseInt(b[2],10);return c&&d?`${c} / ${d}`:"1 / 1"}(c?.aspectRatio)},children:[(0,d.jsx)("div",{className:"absolute inset-0 opacity-20 pointer-events-none",style:{backgroundImage:"linear-gradient(to right, rgba(255,255,255,0.4) 1px, transparent 1px), linear-gradient(to bottom, rgba(255,255,255,0.4) 1px, transparent 1px)",backgroundSize:"10% 10%"}}),!A&&(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center text-center px-6 pointer-events-none",children:(0,d.jsxs)("span",{className:"text-xs text-white/80",children:["No image — this is a layout preview.",(0,d.jsx)("br",{}),"Convert to a structured caption to place boxes."]})}),A&&y&&(0,d.jsx)(m.b4,{boxes:H,selectedIndex:u,drawing:w,onSelect:v,onChangeBox:F,onCreateBox:G})]}),(0,d.jsxs)("div",{className:"absolute top-2 right-2 flex items-center gap-2 z-20",children:[A&&(0,d.jsx)("button",{type:"button",onClick:()=>{let a=!y;z(a),a||(v(null),x(!1))},title:y?"Hide bounding boxes":"Show & edit bounding boxes",className:l()("bg-gray-900 rounded-full p-1 leading-[0px] hover:opacity-100",{"opacity-100 text-blue-400":y,"opacity-50":!y}),children:(0,d.jsx)(i.A,{})}),(0,d.jsx)("button",{type:"button",onClick:D,title:"Close",className:"bg-gray-900 rounded-full p-1 leading-[0px] opacity-50 hover:opacity-100",children:(0,d.jsx)(j.A,{})})]})]}),(0,d.jsxs)("div",{className:"bg-gray-950 w-full sm:w-96 shrink-0 flex flex-col gap-2 p-3 overflow-y-auto text-sm",children:[(0,d.jsx)("div",{className:"flex items-center justify-between gap-2",children:(0,d.jsx)("span",{className:"text-xs font-semibold text-gray-300",children:c?.title??"Edit Prompt"})}),A?(0,d.jsx)(n.A,{caption:p,onChange:r,selectedIndex:u,onSelectIndex:a=>{v(a),null!=a&&z(!0)},isDrawing:w,onToggleDrawing:()=>x(a=>!a),onSave:C,isDirty:B}):(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)("textarea",{className:"w-full min-h-[12rem] rounded border-2 border-gray-700 bg-gray-900 text-gray-100 text-sm p-2 resize-none outline-none focus:border-blue-500",placeholder:"Enter prompt...",value:p,onChange:a=>r(a.target.value)}),(0,d.jsxs)("button",{type:"button",onClick:()=>{r(JSON.stringify({high_level_description:p.trim(),style_description:{aesthetics:"",lighting:"",photo:"",medium:""},compositional_deconstruction:{background:"",elements:[]}},null,2)),z(!0)},className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-md border border-purple-500 bg-purple-600/20 text-purple-200 hover:bg-purple-600/30 text-xs transition-colors",children:[(0,d.jsx)(i.A,{className:"w-3.5 h-3.5"})," Convert to structured caption"]}),(0,d.jsx)("div",{className:"flex justify-end",children:(0,d.jsx)("button",{type:"button",onClick:C,disabled:!B,className:l()("px-4 py-1.5 rounded-md border text-xs font-medium transition-colors",{"bg-green-600 border-green-500 text-white hover:bg-green-500":B,"border-gray-700 text-gray-500 cursor-default":!B}),children:B?"Save":"Saved"})})]})]})]})})})]}),document.body):null}},94650:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(97523);let e=async a=>[{type:"image/png",sizes:"180x180",url:(0,d.fillMetadataSegment)(".",await a.params,"apple-icon.png")+"?b919ad13c80332e6"}]},95519:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,54160,23)),Promise.resolve().then(c.t.bind(c,31603,23)),Promise.resolve().then(c.t.bind(c,68495,23)),Promise.resolve().then(c.t.bind(c,75170,23)),Promise.resolve().then(c.t.bind(c,77526,23)),Promise.resolve().then(c.t.bind(c,78922,23)),Promise.resolve().then(c.t.bind(c,29234,23)),Promise.resolve().then(c.t.bind(c,12263,23)),Promise.resolve().then(c.bind(c,82146))},95725:(a,b,c)=>{"use strict";c.d(b,{v:()=>e});var d=c(38301);function e(a,b){(0,d.useRef)([])}},98934:(a,b,c)=>{"use strict";c.d(b,{default:()=>e});var d=c(97954);(0,d.registerClientReference)(function(){throw Error("Attempted to call docState() from the server but docState is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/DocModal.tsx","docState"),(0,d.registerClientReference)(function(){throw Error("Attempted to call openDoc() from the server but openDoc is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/DocModal.tsx","openDoc");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call the default export of \"/app/ai-toolkit/ui/src/components/DocModal.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/app/ai-toolkit/ui/src/components/DocModal.tsx","default")}};

Xet Storage Details

Size:
124 kB
·
Xet hash:
31ccba75315324a0ba3b680af497add235635aa6c55a3281caeed26b3667448f

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.