1import{j as e}from"./vendor-three-C-sNbonx.js";import{u as C,l as Z,ac as oe,ad as ce,v as N,K as b,r as G,ae as Pe,a as Me,m as Fe,o as Te,s as Re,af as de,t as v,Q as Y,n as Ee,I as Ae,F as Ke}from"./index-Ccs5Lsg7.js";import{L as Be,l as qe,r as a}from"./vendor-lottie-CQYgE2V-.js";import{u as xe}from"./useQueries-BLf_uW0c.js";import{u as Qe}from"./useQuery-B9r9HPq_.js";import{u as Ge,a as Ue}from"./label-CYsV3NX5.js";import{S as ze,O as We}from"./gallery-thumbnail-BMQ3YzPc.js";import{K as me}from"./kyrall-tag-CT6I92ke.js";import{f as $e}from"./vendor-tabler-icons-DqN7Oq1m.js";import{u as He}from"./useProjects-C4J6wCyL.js";import{d as Je,e as Ve,a as Xe,g as Ye}from"./useObjects-C91EpwHB.js";import{i as Ze,d as et}from"./file-CR3FeIh-.js";import{g as tt}from"./projects-9CWFiI97.js";import{K as I}from"./kyrall-modal-B1e2DANz.js";import{F as st,a as at,b as lt,c as rt,d as it,e as nt}from"./form-Cdn8Wq6v.js";import{u as ue,a as ot}from"./useEditorGeneration-DXNdWvDd.js";import{b as ct}from"./vendor-lucide-icons-cr9SWMqi.js";import{U as dt}from"./upgrade-dialog-KymFpEhL.js";import{a as xt,u as mt}from"./useBilling-Dc9FND9g.js";import{B as ut}from"./banner-BFgrDDsH.js";import"./vendor-sentry-DrDLclI6.js";import"./model-viewer-helper-QZ44MfNa.js";import"./object-visit-B7z43xuv.js";import"./dashboard-store-R3TdlRM2.js";import"./use-mobile-BhclYwAO.js";import"./editor-utils-b7HoC-Hd.js";import"./Ico_Close-C-3lgpQW.js";import"./use-refinements-D0aYISIU.js";import"./refinements-DJ2nJgXR.js";import"./ChevronRight-_I6bQ8M7.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new s.Error().stack;i&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[i]="5e65e9ab-39b1-4bfe-a1a7-45326de9660a",s._sentryDebugIdIdentifier="sentry-dbid-5e65e9ab-39b1-4bfe-a1a7-45326de9660a")}catch{}})();function pe({variant:s,title:i,models:l,onViewAll:u,completedCount:n,totalCount:f,onMenuAction:h,onCreateFirst:D,onStartGenerate:y,className:w}){const{t:o}=C(),x=[{label:o("dashboard.modelList.menuOpen"),action:"open",separator:!0},{label:o("dashboard.modelList.menuDownload"),action:"download"},{label:o("dashboard.modelList.menuRename"),action:"rename"},{label:o("dashboard.modelList.menuMove"),action:"move",separator:!0},{label:o("dashboard.modelList.menuDelete"),action:"delete",destructive:!0}],p=r=>{const j=r.status!=="completed";return[{label:o("dashboard.modelList.menuOpen"),action:"open",separator:!0},{label:o("dashboard.modelList.menuDownload"),action:"download",disabled:j},{label:o("dashboard.modelList.menuRename"),action:"rename",disabled:j}]};return e.jsxs("div",{className:Z(" bg-grid-on-black p-4 4xl:p-8 flex flex-col gap-3 4xl:gap-6 overflow-hidden ",w),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 overflow-hidden",children:[e.jsx("h2",{className:"text-lg 2xl:text-xl 4xl:text-3xl font-semibold text-adaptive truncate",children:i}),s==="recent"&&u&&e.jsx("button",{onClick:u,className:"relative shrink-0 px-2 xl:px-3 py-0.5 xl:py-1 font-ufficio-mono text-[10px] xl:text-xs 4xl:text-base text-ky-white border border-ky-white hover:text-ky-white transition uppercase after:absolute after:bottom-0.5 xl:after:bottom-1 after:left-2 xl:after:left-3 after:right-2 xl:after:right-3 after:h-px after:bg-current after:scale-x-0 after:origin-left hover:after:scale-x-100 after:transition-transform after:duration-300",children:o("dashboard.modelList.viewAll")}),s==="generation"&&f!==void 0&&e.jsxs("span",{className:"shrink-0 text-base md:text-sm 4xl:text-base text-adaptive whitespace-nowrap",children:[e.jsx("span",{className:"font-medium",children:n??0}),e.jsxs("span",{children:[" /",f]})]})]}),l.length===0&&s==="recent"&&e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[e.jsx("img",{src:"/assets/dashboard/Ico_Empty.svg",alt:"",className:"w-12 h-12 xl:w-16 xl:h-16 4xl:w-20 4xl:h-20 mb-1 xl:mb-2 4xl:mb-4 icon-adaptive"}),e.jsx("span",{className:"text-sm xl:text-base 4xl:text-lg font-bold text-adaptive",children:o("dashboard.modelList.noRecentModel")}),e.jsx("span",{className:"text-xs xl:text-sm font-light 4xl:text-base text-adaptive text-center leading-relaxed px-2 xl:px-0 4xl:px-4",children:o("dashboard.modelList.noRecentModelDesc")})]}),l.length===0&&s==="generation"&&e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[e.jsx("img",{src:"/assets/website/home/icons/Ico_Generate.svg",alt:"",className:"w-12 h-12 xl:w-16 xl:h-16 4xl:w-20 4xl:h-20 opacity-80 icon-adaptive"}),e.jsx("span",{className:"text-sm xl:text-base 4xl:text-lg font-bold text-adaptive",children:o("dashboard.modelList.noGenerationTask")}),e.jsx("span",{className:"text-xs xl:text-sm font-light 4xl:text-base text-adaptive text-center leading-relaxed px-2 xl:px-0",children:o("dashboard.modelList.noGenerationTaskDesc")})]}),l.length>0&&e.jsx("div",{className:Z("overflow-y-auto overflow-x-hidden kyrall-scroll flex-1 min-h-0"),children:e.jsx(ze,{className:"min-h-full",children:e.jsx("div",{className:"flex flex-col overflow-hidden",children:l.map((r,j)=>e.jsxs("div",{children:[e.jsxs("div",{onClick:r.onClick,className:"flex items-stretch gap-3 p-1 4xl:p-2 cursor-pointer group hover:bg-white/5 transition-colors overflow-hidden",children:[e.jsx("div",{className:"shrink-0 w-20 md:w-14 xl:w-16 2xl:w-20 3xl:w-24 4xl:w-[5vw] h-20md:h-14 xl:h-16 2xl:h-20 3xl:h-24 4xl:h-[5vw] overflow-hidden bg-ky-white/10",children:e.jsx(We,{viewId:`panel-${r.id}-${r.modelUrl||r.objectId||""}`,objectId:r.objectId,modelUrl:r.modelUrl,status:r.status,className:"w-full h-full",loaderSize:"sm",showBadge:!1,showLoader:!1})}),s==="recent"?e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-between min-h-[56px] xl:min-h-[64px] 2xl:min-h-[80px]",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-sm xl:text-base 4xl:text-xl font-medium text-adaptive truncate",children:r.name}),e.jsx("span",{className:"text-xs xl:text-xs 4xl:text-base text-adaptive/60",children:r.updatedAt?oe(r.updatedAt,o):"â"})]}),e.jsxs("div",{className:"flex items-center justify-between mt-1 xl:mt-2 shrink-0 gap-1 overflow-hidden",children:[r.projectName?e.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[e.jsx("img",{src:"/assets/dashboard/homepage/sidebar/Ico_Sidebar_File.svg",className:"w-3 h-3 xl:w-3.5 xl:h-3.5 4xl:w-5 4xl:h-5 shrink-0 opacity-70 icon-adaptive",alt:""}),e.jsx("span",{className:"text-xs xl:text-xs 4xl:text-base text-adaptive/70 truncate",children:r.projectName})]}):e.jsx("span",{}),e.jsx(ce,{options:x.map(m=>({label:m.label,onClick:()=>h?.(r,m.action),variant:m.destructive?"destructive":"default",separator:m.separator,disabled:m.disabled})),triggerClassName:"shrink-0 p-1"})]})]}):e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-1 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 overflow-hidden",children:[e.jsx("span",{className:"text-sm xl:text-base 4xl:text-lg font-medium text-adaptive truncate min-w-0",children:r.name}),e.jsx(ce,{options:p(r).map(m=>({label:m.label,onClick:()=>h?.(r,m.action),variant:m.destructive?"destructive":"default",separator:m.separator,disabled:m.disabled})),triggerClassName:"shrink-0 p-1"})]}),e.jsx("span",{className:"text-xs xl:text-xs 4xl:text-base text-adaptive/60",children:r.updatedAt?oe(r.updatedAt,o):"â"}),e.jsx("div",{className:"flex flex-col gap-1.5",children:e.jsx(pt,{status:r.status})})]})]}),j<l.length-1&&e.jsx("div",{className:"h-px bg-white/5 my-[6px] 4xl:my-[3px]"})]},r.id))})})}),s==="recent"&&l.length===0&&D&&e.jsx("button",{onClick:()=>{N.capture("empty_state_cta_clicked",{variant:s}),D()},className:"relative w-fit self-center px-3 py-1 font-ufficio-mono text-xs 4xl:text-base text-ky-white border border-ky-white hover:text-ky-white transition uppercase after:absolute after:bottom-1 after:left-3 after:right-3 after:h-px after:bg-current after:scale-x-0 after:origin-left hover:after:scale-x-100 after:transition-transform after:duration-300",children:o("dashboard.modelList.createFirstModel")}),s==="generation"&&l.length===0&&y&&e.jsx("button",{onClick:()=>{N.capture("empty_state_cta_clicked",{variant:s}),y()},className:"relative w-fit self-center px-3 py-1 font-ufficio-mono text-xs 4xl:text-base text-ky-white border border-ky-white hover:text-ky-white transition uppercase after:absolute after:bottom-1 after:left-3 after:right-3 after:h-px after:bg-current after:scale-x-0 after:origin-left hover:after:scale-x-100 after:transition-transform after:duration-300",children:o("dashboard.modelList.startToGenerate")})]})}const pt=({status:s})=>{const{t:i}=C();return s==="completed"?e.jsx(me,{label:i("dashboard.modelList.statusCompleted"),color:"yellow",variant:"filled",shape:"chamfer",icon:e.jsx($e,{className:"w-3 h-3"})}):e.jsx(me,{label:i("dashboard.modelList.statusGenerating"),color:"white",variant:"outlined",shape:"chamfer",icon:e.jsx("span",{className:"[filter:brightness(0)] dark:[filter:brightness(0)_invert(1)]",children:e.jsx(Be,{animationData:qe,loop:!0,style:{width:"12px",height:"12px"}})})})};function ft({open:s,onClose:i,onContinue:l,onDashboard:u}){const{t:n}=C();a.useEffect(()=>{s&&N.capture("payment_successful_viewed")},[s]);const f=[n("paymentSuccessfulDialog.features.unlimited"),n("paymentSuccessfulDialog.features.apiAccess"),n("paymentSuccessfulDialog.features.dataPrivacy")];return e.jsx(I,{open:s,onOpenChange:h=>!h&&i(),size:"sm",footer:e.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[e.jsx(b,{priority:"primary",className:"w-full",shape:"normal",onClick:l??i,children:n("paymentSuccessfulDialog.continueEditing")}),e.jsx(b,{priority:"thirdly",className:"w-full",shape:"normal",color:"white",onClick:u??i,children:n("paymentSuccessfulDialog.goToDashboard")})]}),children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"relative flex items-center justify-center h-40",children:[e.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 240 160",fill:"none",children:[e.jsx("circle",{cx:"60",cy:"30",r:"5",fill:"#22c55e",opacity:"0.8"}),e.jsx("circle",{cx:"180",cy:"45",r:"7",fill:"#22c55e",opacity:"0.9"}),e.jsx("circle",{cx:"40",cy:"100",r:"9",fill:"#22c55e",opacity:"0.85"}
1),e.jsx("circle",{cx:"200",cy:"110",r:"6",fill:"#22c55e",opacity:"0.7"}),e.jsx("circle",{cx:"155",cy:"130",r:"5",fill:"#22c55e",opacity:"0.75"}),e.jsx("circle",{cx:"85",cy:"140",r:"4",fill:"#22c55e",opacity:"0.6"}),e.jsx("circle",{cx:"165",cy:"28",r:"4",fill:"#22c55e",opacity:"0.6"}),e.jsx("circle",{cx:"75",cy:"60",r:"3",fill:"#22c55e",opacity:"0.5"}),e.jsx("circle",{cx:"210",cy:"75",r:"3",fill:"#22c55e",opacity:"0.5"}),e.jsx("g",{transform:"translate(44,52)",opacity:"0.85",children:e.jsx("polygon",{points:"6,0 7.5,4.5 12,4.5 8.5,7 10,12 6,9 2,12 3.5,7 0,4.5 4.5,4.5",fill:"#22c55e",transform:"scale(0.6)"})}),e.jsx("g",{transform:"translate(185,22)",opacity:"0.75",children:e.jsx("polygon",{points:"6,0 7.5,4.5 12,4.5 8.5,7 10,12 6,9 2,12 3.5,7 0,4.5 4.5,4.5",fill:"#22c55e",transform:"scale(0.6)"})}),e.jsx("g",{transform:"translate(100,138)",opacity:"0.7",children:e.jsx("polygon",{points:"6,0 7.5,4.5 12,4.5 8.5,7 10,12 6,9 2,12 3.5,7 0,4.5 4.5,4.5",fill:"#22c55e",transform:"scale(0.55)"})}),e.jsx("g",{transform:"translate(190,90)",opacity:"0.65",children:e.jsx("polygon",{points:"6,0 7.5,4.5 12,4.5 8.5,7 10,12 6,9 2,12 3.5,7 0,4.5 4.5,4.5",fill:"#22c55e",transform:"scale(0.5)"})})]}),e.jsx("div",{className:"relative z-10 w-20 h-20 rounded-full bg-[#22c55e] flex items-center justify-center shadow-[0_0_32px_8px_rgba(34,197,94,0.35)]",children:e.jsx("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",children:e.jsx("path",{d:"M7 18l8 8L29 10",stroke:"white",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[e.jsx("h2",{className:"text-2xl font-bold",children:n("paymentSuccessfulDialog.title")}),e.jsx("p",{className:"text-ky-white text-sm",children:n("paymentSuccessfulDialog.subtitle")})]}),e.jsx("div",{className:"border-t border-dashed border-ky-white/30"}),e.jsx("div",{className:"flex flex-col gap-2",children:f.map(h=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-shrink-0 w-5 h-5 ky-polygon-check bg-ky-yellow text-ky-black-on-yellow flex items-center justify-center",children:e.jsx(ct,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-base",children:h})]},h))})]})})}function ht({open:s,onClose:i,onTryAgain:l,onMaybeLater:u}){const{t:n}=C();return a.useEffect(()=>{s&&N.capture("payment_failed_viewed")},[s]),e.jsx(I,{open:s,onOpenChange:f=>!f&&i(),size:"sm",footer:e.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[e.jsx(b,{priority:"primary",shape:"normal",className:"w-full",onClick:l??i,children:n("paymentFailedDialog.tryAgain")}),e.jsx(b,{priority:"thirdly",shape:"normal",color:"white",className:"w-full",onClick:u??i,children:n("paymentFailedDialog.maybeLater")})]}),children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"flex items-center justify-center py-6",children:e.jsx("div",{className:"w-20 h-20 rounded-full bg-[#f08080] flex items-center justify-center",children:e.jsx("svg",{width:"46",height:"46",viewBox:"0 0 36 36",fill:"none",children:e.jsx("path",{d:"M10 10l16 16M26 10L10 26",stroke:"#3a3a3a",strokeWidth:"3.5",strokeLinecap:"round"})})})}),e.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[e.jsx("h2",{className:"text-2xl font-bold",children:n("paymentFailedDialog.title")}),e.jsx("p",{className:"text-ky-white text-sm leading-snug",children:n("paymentFailedDialog.description")})]})]})})}function bt({children:s,className:i}){return e.jsx("div",{className:Z("backdrop-blur-[16px] backdrop-saturate-[180%]","bg-[linear-gradient(150deg,rgba(26,26,26,0.1)_0%,rgba(164,163,163,0.1)_80%,rgba(121,114,114,0.2)_100%)]","shadow-[inset_-1px_-1px_0_rgba(255,255,255,0.4),inset_1px_1px_0_rgba(255,255,255,0.2)]",i),children:s})}function jt({balance:s,onClose:i}){const{t:l}=C(),u=(s/100).toFixed(2),n=.3,f=Math.floor(s/30);return a.useEffect(()=>{N.capture("topup_successful_viewed",{balance_cents:s})},[]),e.jsxs(bt,{className:"w-96 rounded-2xl p-6 flex flex-col gap-4 text-white",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:i,className:"text-white/60 hover:text-white transition-colors","aria-label":"Close",children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:e.jsx("path",{d:"M1 1l16 16M17 1L1 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})}),e.jsxs("div",{className:"relative flex items-center justify-center h-40",children:[e.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 240 160",fill:"none",children:[e.jsx("circle",{cx:"60",cy:"30",r:"5",fill:"#3b82f6",opacity:"0.8"}),e.jsx("circle",{cx:"180",cy:"45",r:"7",fill:"#3b82f6",opacity:"0.9"}),e.jsx("circle",{cx:"40",cy:"100",r:"9",fill:"#3b82f6",opacity:"0.85"}
1),e.jsx("circle",{cx:"200",cy:"110",r:"6",fill:"#3b82f6",opacity:"0.7"}),e.jsx("circle",{cx:"155",cy:"130",r:"5",fill:"#3b82f6",opacity:"0.75"}),e.jsx("circle",{cx:"85",cy:"140",r:"4",fill:"#3b82f6",opacity:"0.6"})]}),e.jsx("div",{className:"relative z-10 w-20 h-20 rounded-full bg-ky-blue flex items-center justify-center shadow-[0_0_32px_8px_rgba(0,90,150,0.35)]",children:e.jsx("span",{className:"text-3xl font-bold text-white",children:"â¬"})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[e.jsx("h2",{className:"text-2xl font-bold",children:l("topupDialog.title")}),e.jsx("p",{className:"text-white/60 text-sm",children:l("topupDialog.subtitle")})]}),e.jsx("div",{className:"border-t border-dashed border-white/20"}),e.jsxs("div",{className:"flex flex-col gap-3 px-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-white/70 text-sm",children:l("topupDialog.currentBalance")}),e.jsxs("span",{className:"text-2xl font-bold",children:["â¬",u]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-white/70 text-sm",children:l("topupDialog.costPerCall")}),e.jsxs("span",{className:"text-sm",children:["â¬",n.toFixed(2)]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-white/70 text-sm",children:l("topupDialog.availableCalls")}),e.jsxs("span",{className:"text-sm font-medium text-ky-blue",children:["~",f," ",l("topupDialog.callsUnit")]})]})]}),e.jsx("div",{className:"pt-1",children:e.jsx(b,{priority:"primary",className:"w-full rounded-full text-base text-white font-medium",onClick:i,children:l("topupDialog.continue")})})]})}function Vt(){const{t:s}=C(),[i,l]=a.useState(!1),u=a.useRef(null),n=G(t=>t.initialPrompt),f=G(t=>t.setInitialPrompt),h=G(t=>t.justOnboarded),D=G(t=>t.setJustOnboarded),y=a.useCallback(()=>{u.current&&clearTimeout(u.current),l(!1),requestAnimationFrame(()=>{l(!0),u.current=setTimeout(()=>l(!1),3300)})},[]);a.useEffect(()=>{h&&(y(),D(!1))},[h,D,y]);const{upgraded:w,topup:o}=Pe.useSearch(),x=Me(),p=Fe(),[r,j]=a.useState(w==="true"),[m,U]=a.useState(!1),[fe,S]=a.useState(!1),[he,z]=a.useState(!1),[be,je]=a.useState(0),W=a.useRef(null),ge=xt(),{data:P,refetch:M}=mt(),[O,F]=a.useState(null),[k,T]=a.useState(null),[R,E]=a.useState(null),[ye,$]=a.useState(!1),[ee,H]=a.useState(null),A=Je(),K=Ve(),J=Xe(),we=Te({name:Re().min(1)}),_=Ge({resolver:Ue(we),defaultValues:{name:""}}),{data:ve,isLoading:Ne}=Qe({queryKey:["projects-all"],queryFn:()=>tt(1,50),enabled:!!k}),B=(ve?.items??[]).filter(t=>t.id!==k?.project_id),ke=xe({queries:B.map(t=>({queryKey:["objects",t.id,1],queryFn:()=>de(t.id,1,1),enabled:!!k&&B.length>0}))});a.useEffect(()=>{w==="true"&&M()},[w,M]),a.useEffect(()=>{o==="true"&&M().then(({data:t})=>{t?(je(t.api_credit_balance),z(!0),x({to:"/dashboard",search:{},replace:!0})):(v.success("Top-up successful!"),x({to:"/dashboard",search:{},replace:!0}))})},[o,M,x]),a.useEffect(()=>{if(!P||P.can_generate||P.role!=="free"||w==="true")return;const t=600*1e3,c=localStorage.getItem("upgradeDialogLastShown"),d=Date.now();(!c||d-Number(c)>=t)&&(S(!0),localStorage.setItem("upgradeDialogLastShown",String(d)))},[P,w]);const{data:_e}=He(1),te=_e?.items??[],{items:V}=Ye(),X=xe({queries:te.map(t=>({queryKey:["objects",t.id,1],queryFn:()=>de(t.id,1,10),enabled:!!t.id}))}).flatMap(t=>t.data?.items??[]).sort((t,c)=>new Date(c.created_at).getTime()-new Date(t.created_at).getTime()),se=new Map(te.map(t=>[t.id,t.name])),ae=a.useCallback((t,c)=>({id:t.id,name:Y(t.name),objectId:t.id,projectId:t.project_id??void 0,projectName:c&&t.project_id!=null?se.get(t.project_id):void 0,description:`Created ${new Date(t.created_at).toLocaleDateString()}`,status:t.status,updatedAt:t.created_at,progress:t.status==="completed"?100:void 0,onClick:()=>{x({to:"/editor",search:{objectId:t.id,...t.project_id?{projectId:t.project_id}:{},showPrompt:!1}})},onDoubleClick:()=>{x({to:"/editor",search:{objectId:t.id,...t.project_id?{projectId:t.project_id}:{},showPrompt:!1}})}}),[x,se]),Ce=X.map(t=>ae(t,!0)),q=V.map(t=>ae(t,!0)),le=a.useMemo(()=>{const t=[...X,...V];return new Map(t.map(c=>[c.id,c]))},[X,V]),g=Ee(t=>t.lastResponse),{handleGenerate:De}=ue({currentObjectId:null,currentObject:void 0,urlProjectId:void 0,urlFreshObject:void 0,promptOnlyMode:!0,onQuotaExceeded:()=>S(!0)}),{handleAgenticGenerate:Se}=ue({currentObjectId:null,currentObject:void 0,urlProjectId:void 0,urlFreshObject:void 0,promptOnlyMode:!0,onQuotaExceeded:()=>S(!0)});a.useEffect(()=>
1{g&&(g.status==="completed"&&g.object_id?(p.invalidateQueries({queryKey:["generation-tasks"]}),p.invalidateQueries({queryKey:["objects"]})):g.status==="processing"||g.status==="pending"?p.invalidateQueries({queryKey:["generation-tasks"]}):g.status==="error"&&v.error(g.error||"Generation failed"))},[g,p]);const re=a.useCallback(async(t,c)=>{const d=t.objectId?le.get(t.objectId):null;if(d)if(c==="open")x({to:"/editor",search:{objectId:d.id,...d.project_id?{projectId:d.project_id}:{},showPrompt:!1}});else if(c==="download")try{const Q=Ze(d.file_url),Ie=await et({object_id:d.id,file_type:Q}),ne=window.URL.createObjectURL(Ie),L=document.createElement("a");L.href=ne,L.download=`${d.name||"object"}.${Q}`,document.body.appendChild(L),L.click(),L.remove(),window.URL.revokeObjectURL(ne)}catch{v.error("Failed to download file")}else c==="rename"?(H(d),_.reset({name:Y(d.name)}),$(!0)):c==="move"?T(d):F(d)},[le,x,_]),Oe=async()=>{if(O)try{await A.mutateAsync(O.id),p.invalidateQueries({queryKey:["objects"]}),p.invalidateQueries({queryKey:["generation-tasks"]}),v.success("Object deleted")}catch{v.error("Failed to delete object")}finally{F(null)}},Le=async t=>{if(k)try{await K.mutateAsync({objectId:k.id,projectId:t}),T(null),E(null),p.invalidateQueries({queryKey:["objects"]}),p.invalidateQueries({queryKey:["generation-tasks"]})}catch{v.error("Failed to move object")}},ie=async t=>{if(ee)try{await J.mutateAsync({id:ee.id,data:{name:t.name,is_custom_name:!0}}),$(!1),H(null),p.invalidateQueries({queryKey:["objects"]}),p.invalidateQueries({queryKey:["generation-tasks"]})}catch{v.error("Failed to rename object")}};return e.jsxs(e.Fragment,{children:[e.jsx(ft,{open:r,onClose:()=>{j(!1),x({to:"/dashboard",search:{},replace:!0})},onContinue:()=>{j(!1),x({to:"/editor",search:{showPrompt:!0}})},onDashboard:()=>{j(!1),x({to:"/dashboard",search:{},replace:!0})}}),e.jsx(ht,{open:m,onClose:()=>U(!1),onTryAgain:()=>{U(!1),ge.mutate({yearly:!1,source:"payment_failed_retry"})},onMaybeLater:()=>U(!1)}),e.jsx(dt,{open:fe,onClose:()=>{S(!1),W.current=null},onMaybeLater:()=>{S(!1),W.current?.(),W.current=null}}),he&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:()=>z(!1),children:e.jsx("div",{onClick:t=>t.stopPropagation(),children:e.jsx(jt,{balance:be,onClose:()=>z(!1)})})}),e.jsxs("div",{className:"@container/main flex flex-col gap-2 lg:gap-3 relative flex-1 min-h-0",children:[e.jsx(ut,{className:"order-2 md:order-1 pb-10 md:pb-0",getButtonConfig:t=>t.category==="New Release"||t.category==="Tutorial"?{primaryButton:{label:s("dashboard.banner.exploreNow"),onClick:()=>x({to:"/dashboard/community"})}}:{}}),e.jsxs("div",{className:"order-1 md:order-2 flex flex-col xl:flex-row gap-3 items-stretch xl:flex-1 xl:min-h-0 xl:max-h-[calc(100vh-16rem)] xl:overflow-hidden",children:[e.jsx("div",{className:"hidden xl:flex shrink min-w-[240px] min-h-0 overflow-hidden",children:e.jsx(pe,{variant:"recent",title:s("dashboard.modelList.recentModels"),models:Ce.filter(t=>!q.some(c=>c.id===t.id)).slice(0,4),onViewAll:()=>x({to:"/dashboard/projects"}),onMenuAction:re,onCreateFirst:y,className:"h-full"})}),e.jsx("div",{className:"w-full xl:flex-1 xl:min-w-[400px] xl:min-h-0 xl:overflow-hidden",children:e.jsx(ot,{className:"w-full xl:h-full",onGenerate:t=>{N.capture("dashboard_card_generate_clicked",{mode:"normal"}),De(t),n&&f(null)},onAgenticGenerate:t=>{N.capture("dashboard_card_generate_clicked",{mode:"thinking"}),Se(t),n&&f(null)},highlighted:i,initialPrompt:n??void 0})}),e.jsx("div",{className:"w-full max-h-[500px] pb-2 md:pb-6 xl:pb-0 xl:max-h-none xl:w-72 2xl:w-80 3xl:w-[22vw] xl:shrink xl:min-w-[240px] xl:min-h-0 xl:overflow-hidden",children:e.jsx(pe,{variant:"generation",title:s("dashboard.modelList.generationTasks"),models:q,completedCount:q.filter(t=>t.status==="completed").length,totalCount:q.length,onMenuAction:re,onStartGenerate:y,className:"h-full"})})]})]}),e.jsx(I,{open:ye,onOpenChange:t=>{$(t),t||H(null)},title:"Rename Object",footer:e.jsx(b,{priority:"primary",shape:"normal",className:"w-full",onClick:_.handleSubmit(ie),disabled:J.isPending,children:J.isPending?"Saving...":"Save"}),children:e.jsx(st,{..._,children:e.jsx("form",{onSubmit:_.handleSubmit(ie),className:"space-y-4",children:e.jsx(at,{control:_.control,name:"name",render:({field:t})=>e.jsxs(lt,{children:[e.jsx(rt,{children:"Name"}),e.jsx(it,{children:e.jsx(Ae,{placeholder:"Object name",maxLength:255,...t})}),e.jsx(nt,{})]})})})})}),e.jsx(I,{open:!!O,onOpenChange:t=>{t||F(null)},title:"Delete the object",footer:e.jsxs("div",{className:"flex w-full gap-2",children:[e.jsx(b,{priority:"thirdly",color:"white",shape:"normal",className:"flex-1",onClick:()=>F(null),disabled:A.isPending,children:"Cancel"}),e.jsx(b,{priority:"primary",shape:"normal",className:"flex-1",onClick:Oe,disabled:A.isPending,children:A.isPending?"Deleting...":"Delete"})]}),children:e.jsx("p",{className:"text-base text-ky-white",children:O?`Are you sure you want to delete "${Y(O.name)}"?`:""})}),e.jsx(I,{open:!!k,onOpenChange:t=>{t||(T(null),E(null))},title:"Move Object",footer:e.jsxs("div",{className:"flex w-full gap-3",children:[e.jsx(b,{priority:"thirdly",color:"white",shape:"normal",className:"flex-1",onClick:()=>{T(null),E(null)},disabled:K.isPending,children:s("common.cancel")}),e.jsx(b,{priority:"primary",shape:"normal",className:"flex-1",onClick:()=>R&&Le(R),disabled:!R||K.isPending,children:K.isPending?s("common.loading"):s("objects.moveObjectConfirm")})]}),children:Ne?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Ke,{size:"md"})}):B.length===0?e.jsx("p",{className:"text-sm text-ky-white/60",children:s("projects.noOtherProjects")}):e.jsx("ul",{className:"kyrall-scroll space-y-1 max-h-[calc(5*3.5rem)] overflow-y-auto pr-1",children:B.map((t,c)=>{const d=ke[c]?.data?.total,Q=R===t.id;return e.jsx("li",{children:e.jsxs("button",{className:`w-full flex items-center gap-4 px-3 py-1 rounded-sm transition-colors text-left ${Q?"bg-ky-yellow text-ky-black-on-yellow":"text-ky-white hover:bg-ky-yellow hover:text-ky-black-on-yellow"}`,onClick:()=>
1E(t.id),children:[e.jsx("span",{className:"size-9 shrink-0 block bg-current",style:{maskImage:"url('/assets/dashboard/homepage/sidebar/Ico_Sidebar_File.svg')",WebkitMaskImage:"url('/assets/dashboard/homepage/sidebar/Ico_Sidebar_File.svg')",maskSize:"contain",WebkitMaskSize:"contain",maskRepeat:"no-repeat",WebkitMaskRepeat:"no-repeat",maskPosition:"center",WebkitMaskPosition:"center"}}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-base font-regular",children:t.name}),e.jsx("span",{className:"text-sm opacity-60",children:d!=null?`${d} objects`:"â¦"})]})]})},t.id)})})})]})}export{Vt as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.