PageSourceSearch

https://app.showfloor.ai/assets/VisualizationResults-DXVoUfLo.js

js showfloor.ai collected 2026-10-05 15:25:29 UTC 78,500 bytes, 31 lines download raw bytes

1import{j as e,b as a,c as Ta,u as Aa,d as rs,h as Fr}from"./query-CYOR7zGO.js";import{b as La,u as Ma}from"./react-vendor-5heRg20C.js";import{v as Zr,w as zr,O as ea,x as ta,T as sa,z as Ua,E as ra}from"./ui-vendor-B7dXr53s.js";import{B as H,aZ as Oa,aQ as Br,q as L,a as Ge,u as Da,J as Fa,aU as as,ai as Ba,d as oe,y as Va,G as qa,b0 as Ha,b1 as Wa,b2 as $a,aV as ut,aY as Vr,b3 as Ya,aX as Xa,g as Ga,A as Qa,S as Ot,C as qr,l as Ka,aT as Ja,b4 as Za,z as Hr,T as za,a_ as en}from"./index-DcQpqDRc.js";import{c as de,b as tn,r as Wr,f as sn,d as Xe,e as rn,u as an,L as ht,g as nn,R as Dt,M as ln,a as on,U as cn,s as dn}from"./WoodLayoutDialog-C2xf7oSe.js";import{B as un}from"./BeforeAfterSlider-DTK9_nKb.js";import{C as fs}from"./ContentAwareBeforeAfter-DZaaQTzJ.js";import{ac as mn,ad as hn,ae as fn,af as pn,ag as xn,X as us,a5 as ms,T as $r,ah as gn,d as Qe,ai as aa,f as hs,R as ns,aj as wn,l as Yr,ak as bn}from"./lucide-Da0VTTkw.js";import{S as na,p as Xr,U as vn}from"./UnifiedShareDialog-xORL9Nio.js";import{D as la,a as ia,b as oa,c as ca}from"./useClient-PO3eGZij.js";import{E as jn}from"./featureFlags-BK6ibwsO.js";import{u as _n}from"./useVisualCounts-C6ELMLUK.js";import{h as ls}from"./handleApi-Bn-VBBSr.js";import{P as yn}from"./ProposalDrawer-_4pRcMZq.js";import{e as Gr,b as is}from"./proposalVisualAdoption-BTfU91Ia.js";import{s as Nn,a as kn,r as In}from"./designTokens-DA9ehrN4.js";import{a as mt,i as Ft,b as Sn}from"./media-DgqNRsgm.js";import{m as En,M as Rn,h as Cn,f as Pn}from"./materials-f_Ubtn_x.js";import{n as os,g as Tn,p as Qr}from"./materialIdentity-CKYJ4aGQ.js";import"./supabase-B3MrfvGd.js";import"./image-skeleton-Ds9NfaoT.js";import"./CategoryIcons-BESZXkwa.js";import"./brand-logos-39jiU3Qs.js";import"./popover-CM0enkPq.js";import"./materialCopy-BpVi17Yn.js";import"./dialog-Z0L3JMVc.js";import"./stripe-Cm15Xifo.js";import"./switch--eabXujz.js";import"./textarea-DDWlAW4z.js";import"./proposalDefaults-BWP4L_jM.js";import"./money-CBTwGRdT.js";import"./proposalTerms-DIL26JBP.js";import"./quoteCalculations-fptBfoVH.js";import"./alert-dialog-d6c_q2ih.js";import"./proposalPdfDownload-Y8FuqE2p.js";const An=({error:n,onRetry:o,isRetrying:f=!1,onClose:x})=>{const m=de(n);return e.jsx(Zr,{open:!0,onOpenChange:I=>{I||x()},children:e.jsxs(zr,{children:[e.jsx(ea,{className:"fixed inset-0 z-50 bg-black/40"}),e.jsx(ta,{className:"fixed inset-x-0 bottom-0 z-50 max-h-[90dvh] overflow-y-auto overscroll-contain rounded-t-2xl border-t border-gray-200 bg-white p-6 shadow-xl focus:outline-none",children:e.jsxs("div",{className:"mx-auto flex max-w-4xl flex-col gap-4",children:[e.jsx(sa,{className:"text-lg font-semibold text-gray-900",children:m.title}),e.jsx(Ua,{className:"text-sm text-gray-700",children:m.message}),o&&m.canRetry&&e.jsx(H,{onClick:o,disabled:f,className:"min-h-12 w-full",children:f?"Trying again…":"Try again"}),e.jsx(H,{asChild:!0,variant:"outline",className:"min-h-12 w-full",children:e.jsx("a",{href:"mailto:[email protected]",children:"Contact support"})}),e.jsx(ra,{asChild:!0,children:e.jsx(H,{variant:"outline",className:"min-h-12 w-full",children:"Close"})})]})})]})})};function Ln(n){const o=n.toLowerCase();return o.includes("domino")?{label:"BEST",icon:"★",gradient:"from-amber-400 via-yellow-300 to-amber-400"}:o.includes("gunmetal")?{label:"LUX",icon:"◆",gradient:"from-slate-300 via-white to-slate-300"}:o.includes("saddle")?{label:"PRO",icon:"●",gradient:"from-orange-400 via-amber-300 to-orange-400"}:o.includes("metallic")?{label:"NEW",icon:"✦",gradient:"from-violet-400 via-fuchsia-300 to-violet-400"}:null}function Mn(n){const o=n.indexOf("•");if(o>0){const x=n.slice(o+1).trim(),m=x.split(" ");return m.length>2?m.slice(0,2).join(" "):x}const f=n.split(" ");return f.length>2?f.slice(0,2).join(" "):n}function Un({visualizations:n,activeId:o,onSelect:f}){const x=a.useRef(null),m=a.useRef(null),[I,j]=a.useState({}),P=c=>{j(y=>({...y,[c]:!0}))};return a.useEffect(()=>{if(m.current&&x.current){const c=x.current,y=m.current,b=y.getBoundingClientRect(),N=c.getBoundingClientRect(),R=y.offsetLeft-N.width/2+b.width/2;c.scrollTo({left:R,behavior:"smooth"})}},[o]),!n||n.length===0?null:e.jsx("div",{className:"w-full flex justify-center",children:e.jsxs("div",{className:"relative w-full max-w-full overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/20 to-transparent blur-xl pointer-events-none"}),e.jsx("div",{className:"relative py-2",children:e.jsxs("div",{ref:x,className:"flex gap-4 overflow-x-auto scrollbar-hide snap-x snap-mandatory px-4 md:justify-center",style:{scrollPaddingInline:"16
1px"},children:[e.jsx(Oa,{mode:"popLayout",children:n.map((c,y)=>{var F;const b=c.id===o;Ln(c.materialName);const N=Mn(c.materialName),R=I[c.id];return e.jsxs(Br.button,{ref:b?m:void 0,onClick:()=>f(c.id),"aria-label":N,"aria-current":b?"true":void 0,className:L("relative flex-shrink-0 snap-center group flex flex-col items-center gap-1.5","focus:outline-none focus-visible:ring-2 focus-visible:ring-orange-400/50 focus-visible:ring-offset-2 focus-visible:ring-offset-black/50 rounded-xl"),initial:{opacity:0,scale:.8,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.8},transition:{type:"spring",stiffness:500,damping:30,delay:y*.05},whileHover:{scale:1.05},whileTap:{scale:.95},children:[e.jsxs("div",{className:L("relative rounded-full p-[2.5px] transition-all duration-500",b?"bg-gradient-to-br from-orange-400 via-rose-400 to-orange-500":"bg-white/20 group-hover:bg-white/40"),style:b?{boxShadow:"0 0 15px rgba(249, 115, 22, 0.4), 0 0 30px rgba(249, 115, 22, 0.2)"}:void 0,children:[b&&e.jsx(Br.div,{className:"absolute inset-0 rounded-full bg-gradient-to-r from-transparent via-white/40 to-transparent",animate:{x:["-100%","200%"]},transition:{duration:2,repeat:1/0,ease:"linear"},style:{maskImage:"linear-gradient(black, black)"}}),e.jsxs("div",{className:L("relative w-14 h-14 sm:w-16 sm:h-16 rounded-full overflow-hidden border-2 border-black/80","bg-slate-900"),children:[!R&&c.thumbnailUrl&&e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-slate-700 to-slate-800 animate-pulse"}),c.thumbnailUrl?e.jsx("img",{src:c.thumbnailUrl,alt:c.materialName,className:L("w-full h-full object-cover transition-all duration-500",R?"opacity-100":"opacity-0",!b&&"group-hover:scale-110"),loading:"lazy",draggable:!1,onLoad:()=>P(c.id)}):e.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-slate-700 via-slate-800 to-slate-900",children:e.jsx("span",{className:"text-lg font-light text-white/40 font-mono",children:(F=N[0])==null?void 0:F.toUpperCase()})}),e.jsx("div",{className:"absolute inset-0 rounded-full shadow-[inset_0_2px_4px_rgba(255,255,255,0.2),inset_0_-2px_4px_rgba(0,0,0,0.4)]"})]})]}),e.jsx("p",{className:L("text-[10px] sm:text-xs font-medium truncate max-w-[72px] text-center tracking-tight leading-none drop-shadow-md",b?"text-white":"text-white/70 group-hover:text-white"),children:N})]},c.id)})}),n.length===1&&e.jsx("span",{className:"flex-shrink-0 self-center text-[11px] text-white/40 italic pl-2 whitespace-nowrap",children:"Try another material to compare"})]})})]})})}function On({beforeSrc:n,afterSrc:o,beforeLabel:f="Before",afterLabel:x="After",natural:m,onClose:I,onBeforeError:j,onAfterError:P}){const[c,y]=a.useState("slider"),[b,N]=a.useState(!1),[R,F]=a.useState(!1),[Se,O]=a.useState(.5),[ue,pe]=a.useState(!1),Ue=a.useRef(null),Oe=a.useRef(void 0);a.useEffect(()=>{requestAnimationFrame(()=>pe(!0))},[]),a.useEffect(()=>{const C=()=>{N(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",C),()=>document.removeEventListener("fullscreenchange",C)},[]);const De=async()=>{if(Ue.current)try{document.fullscreenElement?await document.exitFullscreen():await Ue.current.requestFullscreen()}catch{console.log("Fullscreen not supported")}};a.useEffect(()=>{const C=Q=>{c==="slider"?Q.key==="ArrowLeft"?O(K=>Math.max(0,K-.05)):Q.key==="ArrowRight"&&O(K=>Math.min(1,K+.05)):c==="toggle"&&Q.key===" "&&(Q.preventDefault(),F(K=>!K)),Q.key==="Escape"&&I()};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[c,I]);const Ke=()=>{c==="toggle"&&(F(!0),Oe.current=setTimeout(()=>{},100))},Ee=()=>{c==="toggle"&&(Oe.current&&clearTimeout(Oe.current),F(!1))},Fe=()=>{c==="toggle"&&F(C=>!C)},[Be,Re]=a.useState(!1);a.useEffect(()=>{const C=window.innerWidth<window.innerHeight,Q=localStorage.getItem("seenOrientationHint");C&&!Q&&(Re(!0),setTimeout(()=>{Re(!1),localStorage.setItem("seenOrientationHint","true")},3e3))},[]);const xe=[{id:"slider",icon:mn,label:"Slider"},{id:"toggle",icon:hn,label:"Toggle"},{id:"sidebyside",icon:fn,label:"Side by Side"}];return e.jsxs("div",{ref:Ue,className:L("fixed inset-0 z-50 bg-black flex flex-col transition-opacity duration-200",ue?"opacity-100":"opacity-0",b&&"fullscreen"),style:{height:"100svh",contain:"paint"},children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 z-10 bg-gradient-to-b from-black/80 to-transparent p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex gap-2",children:xe.map(({id:C,icon:Q,label:K})=>e.jsxs(H,{variant:c===C?"default":"secondary",size:"sm",onClick:()=>y(C),className:"min-h-[44px] min-w-[44px] opacity-90 sm:min-h-0 sm:min-w-0",children:[e.jsx(Q,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:K})]},C))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(H,{variant:"secondary",size:"sm",onClick:De,className:"min-h-[44px] min-w-[44px] opacity-90 sm:min-h-0 sm:min-w-0",children:b?e.jsx(pn,{className:"h-4 w-4"}):e.jsx(xn,{className:"h-4 w-4"})}),e.jsx(H,{variant:"secondary",size:"sm",onClick:I,className:"min-h-[44px] min-w-[44px] opacity-90 sm:min-h-0 sm:min-w-0",children:e.jsx(us,{className:"h-4 w-4"})})]})]})}),e.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[c==="slider"&&e.jsx(fs,{beforeSrc:n,afterSrc:o,labels:{before:f,after:x}
1,start:Se,onChange:O,natural:m,onBeforeError:j,onAfterError:P,className:"w-full h-full"}),c==="toggle"&&e.jsxs("div",{className:"w-full h-full relative cursor-pointer select-none",onClick:Fe,onPointerDown:Ke,onPointerUp:Ee,onPointerLeave:Ee,children:[e.jsx("img",{src:R?o:n,alt:R?x:f,className:"w-full h-full object-contain",draggable:!1,onError:R?P:j}),e.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 px-4 py-2 bg-black/60 text-white rounded-full text-sm",children:[R?x:f," • Tap to toggle"]})]}),c==="sidebyside"&&e.jsxs("div",{className:"w-full h-full flex",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx("img",{src:n,alt:f,className:"w-full h-full object-contain",draggable:!1,onError:j}),e.jsx("div",{className:"absolute bottom-2 left-2 px-2 py-1 bg-black/60 text-white rounded text-xs",children:f})]}),e.jsx("div",{className:"w-[2px] bg-white/20"}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsx("img",{src:o,alt:x,className:"w-full h-full object-contain",draggable:!1,onError:P}),e.jsx("div",{className:"absolute bottom-2 right-2 px-2 py-1 bg-black/60 text-white rounded text-xs",children:x})]})]})]}),Be&&e.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-black/80 text-white px-6 py-4 rounded-lg animate-pulse",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("svg",{className:"w-8 h-8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:[e.jsx("rect",{x:"5",y:"7",width:"10",height:"14",rx:"2"}),e.jsx("path",{d:"M15 7h2a2 2 0 012 2v6a2 2 0 01-2 2h-2"}),e.jsx("path",{d:"M8 4l3 3-3 3"})]}),e.jsx("span",{children:"Rotate for a wider view"})]})}),c==="slider"&&e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white/60 text-xs",children:"Drag to compare • Use ← → arrow keys"})]})}function Dn({beforeSrc:n,afterSrc:o,category:f,materialName:x,qualifier:m,caption:I,footnote:j,onFootnoteClick:P,footerCard:c,natural:y,sourceAspect:b,sharePending:N,onShare:R,onPriceIt:F,onBack:Se,onOpenSwap:O,onChangeLayout:ue,layoutLabel:pe,onReportIssue:Ue,hasSiblings:Oe,siblingStrip:De,overlay:Ke,forceCanvas:Ee,onBeforeError:Fe,onAfterError:Be,reducedMotion:Re}){const[xe,C]=a.useState({value:.5,seq:0}),Q=W=>C(ae=>({value:W,seq:ae.seq+1})),K=tn(),[Bt,Ve]=a.useState(null),Je=a.useCallback(W=>Ve(Wr(W)),[]),Ze=a.useRef(null),Ce=a.useId(),ze=a.useRef(null),[et,J]=a.useState(null);a.useLayoutEffect(()=>{const W=ze.current;if(!W)return;const ae=()=>J(Math.ceil(W.getBoundingClientRect().height));if(ae(),typeof ResizeObserver>"u")return;const ft=new ResizeObserver(ae);return ft.observe(W),()=>ft.disconnect()},[]),a.useEffect(()=>{const W=requestAnimationFrame(()=>sn(Ze.current));return()=>cancelAnimationFrame(W)},[]);const Pe=!!(I&&I.trim().length>0),V=(typeof m=="string"?[m]:m??[]).map(W=>W.trim()).filter(Boolean),re=Oe&&!!De;return e.jsx("div",{ref:Ze,tabIndex:-1,role:"region","aria-labelledby":Ce,className:L(Xe.shell,"md:min-h-[100dvh] focus:outline-none"),children:e.jsxs("div",{className:L("relative overflow-hidden bg-black","w-screen h-[100dvh]",Xe.stage),children:[e.jsxs("button",{type:"button",onClick:Se,"aria-label":"Back",className:L("absolute left-4 top-[calc(env(safe-area-inset-top,0px)+12px)] z-40 grid h-[46px] w-[46px] place-items-center rounded-full bg-[var(--sf-label-plate)] text-white backdrop-blur-md transition-transform active:scale-95",Xe.back,"md:top-[26px] md:h-auto md:rounded-[var(--sf-label-plate-radius)] md:py-2 md:pr-2.5"),children:[e.jsx(ms,{className:"h-[23px] w-[23px] md:h-5 md:w-5"}),e.jsx("span",{className:"hidden font-chrome text-[15px] md:inline",children:"Back"})]}),e.jsx("div",{className:L("absolute inset-0",Xe.region),children:e.jsxs("div",{"data-room-frame":!0,className:L("absolute inset-0",Xe.box),style:rn(Bt??Wr(y)),children:[e.jsx(fs,{beforeSrc:n,afterSrc:o,natural:y,fit:K?"contain":"cover",handleVariant:"editorial",hideDefaultLabels:!0,start:.5,revealTarget:xe,reducedMotion:Re,forceCanvas:Ee,onBeforeError:Fe,onAfterError:Be,onNaturalSize:Je,className:"absolute inset-0 h-full w-full"}),Ke,e.jsxs("div",{className:"sf-room-labels absolute left-0 right-0 top-[calc(env(safe-area-inset-top,0px)+57px)] z-40 flex items-start justify-between px-[26px] md:top-[13px]",children:[e.jsxs("button",{type:"button",onClick:()=>Q(0),className:"flex flex-col items-start rounded-[var(--sf-label-plate-radius)] bg-[var(--sf-label-plate)] px-2 py-[7px] font-chrome","aria-label":"Show before",children:[e.jsx("span",{className:"text-[12px] font-semibold uppercase tracking-[0.20em] text-sf-label",children:"Before"}),e.jsx("span",{className:"mt-1 h-px w-14 bg-sf-label-underline"})]}),e.jsxs("button",{type:"button",onClick:()=>Q(1),className:"flex flex-col items-end rounded-[var(--sf-label-plate-radius)] bg-[var(--sf-label-plate)] px-2 py-[7px] font-chrome","aria-label":"Show after",children:[e.jsx("span",{className:"text-[12px] font-semibold uppercase tracking-[0.20em] text-sf-label",children:"After"}),e.jsx("span",{className:"mt-1 h-px w-14 bg-sf-label-underline"})]})]})]})}),e.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 md:hidden sf-scrim-phone",style:et?{"--sf-scrim-block":`${et}px`}:void 0}),e.jsxs("div",{ref:ze,className:L("absolute inset-x-0 bottom-0 z-40 pb-[calc(env(safe-area-inset-bottom,0px)+22px)]",Xe.footer,"md:flex md:flex-wrap md:items-center md:gap-x-6 md:gap-y-4 lg:flex-nowrap"),children:[re?e.jsx("div",{className:"pointer-events-auto mb-4 px-[30px] md:order-3 md:mb-0 md:min-w-0 md:basis-full md:px-0 lg:order-2 lg:max-w-[40%] lg:basis-auto",children:De}):null,e.jsxs("div",{className:"flex items-end justify-between gap-4 pl-[30px] pr-[28px] md:contents",children:[e.jsxs("div",{className:L("min-w-0 flex-1 md:order-1",re&&"md:flex md:min-
1h-[160px] md:flex-col md:justify-center lg:block lg:min-h-0"),children:[e.jsxs("div",{className:"flex items-center gap-[9px]",children:[e.jsx($r,{className:"h-[16px] w-[16px] text-white/80",strokeWidth:1.75}),e.jsx("span",{className:"truncate font-chrome text-[12px] font-semibold uppercase tracking-[0.20em] text-sf-text-dim",children:f||"Material"})]}),e.jsx("h1",{id:Ce,className:L("mt-2 font-display-serif text-sf-text",b==="landscape"?"text-[36px] lg:text-[36px]":"text-[32px] lg:text-[32px]","md:text-[28px]","leading-[1.04]"),style:{fontWeight:350,letterSpacing:"-0.01em"},children:x}),V.length>0?e.jsx("p",{className:"mt-1 font-chrome text-[12px] leading-[1.35] text-sf-text-dim line-clamp-2 max-w-[265px]",children:V.map((W,ae)=>e.jsxs(Ta.Fragment,{children:[ae>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:" · "}),e.jsx("span",{className:"sr-only",children:", "})]}):null,W]},ae))}):null,e.jsxs("div",{className:"md:mt-2 md:flex md:flex-wrap md:items-center md:gap-x-5 md:gap-y-1",children:[e.jsxs("button",{type:"button",onClick:O,className:"pointer-events-auto mt-2 inline-flex items-center gap-2 font-chrome text-[12px] text-white/60 transition-colors hover:text-white/80 md:mt-0 md:text-white/60 md:relative md:before:absolute md:before:-inset-x-2 md:before:-inset-y-3 md:before:content-['']","aria-label":"Change material",children:[e.jsx(gn,{className:"h-[14px] w-[14px]",strokeWidth:1.75,"aria-hidden":"true"}),"Change material"]}),ue?e.jsxs("button",{type:"button",onClick:ue,className:"pointer-events-auto mt-2 block font-chrome text-[12px] text-white/60 transition-colors hover:text-white/80 md:mt-0 md:text-white/60 md:relative md:before:absolute md:before:-inset-x-2 md:before:-inset-y-3 md:before:content-['']","aria-label":`Change layout${pe?`, currently ${pe}`:""}`,children:["Change layout",pe?` · ${pe}`:""]}):null,e.jsx("button",{type:"button",onClick:Ue,className:"pointer-events-auto mt-2 block font-chrome text-[12px] text-white/60 transition-colors hover:text-white/75 md:mt-0 md:text-white/60 md:relative md:before:absolute md:before:-inset-x-2 md:before:-inset-y-3 md:before:content-['']",children:"Something look wrong?"})]}),j&&P?e.jsx("button",{type:"button","data-testid":"editorial-result-footnote",onClick:P,className:"pointer-events-auto mt-1 block min-h-11 max-w-[290px] py-1.5 text-left font-chrome text-[12px] leading-[1.35] text-white/80 underline decoration-white/40 underline-offset-[3px] transition-colors hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80",children:j.replace(/ →$/," →")}):j?e.jsx("p",{"data-testid":"editorial-result-footnote",className:"mt-2 max-w-[265px] font-chrome text-[11px] leading-[1.35] text-white/55",children:j}):null,Pe?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-[11px] mt-[9px] h-px w-[200px] bg-sf-hairline"}),e.jsx("p",{className:"font-display-serif text-[13px] italic leading-[1.4] text-sf-text-caption",style:{maxWidth:265},children:I})]}):null]}),e.jsxs("div",{className:L("flex flex-shrink-0 flex-col items-end gap-2 md:order-3",re&&"md:order-2 lg:order-3 lg:flex-1"),children:[F?e.jsxs("button",{type:"button",onClick:F,className:"pointer-events-auto inline-flex h-11 w-[160px] items-center justify-center gap-2 rounded-[16px] border border-white/25 bg-white/10 font-chrome text-[14px] font-semibold text-white backdrop-blur-[14px] transition-colors hover:bg-white/20 active:scale-95",children:[e.jsx($r,{className:"h-4 w-4","aria-hidden":"true"}),e.jsx("span",{children:"Price it"})]}):null,e.jsxs("button",{type:"button",onClick:R,disabled:N,"aria-label":na,className:"pointer-events-auto inline-flex h-[56px] w-[160px] items-center justify-center gap-[10px] rounded-[19px] bg-orange-700 font-chrome text-[16px] font-semibold text-white shadow-sf-cta-glow transition-transform hover:bg-orange-800 active:scale-95 disabled:opacity-70",children:[N?e.jsx(Qe,{className:"h-5 w-5 animate-spin"}):e.jsx(aa,{className:"h-5 w-5"}),e.jsx("span",{children:"Share & send"})]}),c?e.jsx("div",{className:"hidden md:block",children:c("desktop")}):null]})]}),c?e.jsx("div",{className:"mt-4 px-[30px] md:hidden",children:c("phone")}):null]})]})})}function Fn({visualizations:n,activeId:o,onSelect:f,reducedMotion:x}){const m=a.useRef(null),I=a.useRef(null);if(a.useEffect(()=>{const c=m.current,y=I.current;if(!c||!y)return;const b=y.getBoundingClientRect(),N=c.getBoundingClientRect(),R=b.left+b.width/2-(N.left+N.width/2);Math.abs(R)<2||c.scrollBy({left:R,behavior:x?"auto":"smooth"})},[o,x,n.length]),!n||n.length<2)return null;const j=n.reduce((c,y)=>(c[y.materialName]=(c[y.materialName]||0)+1,c),{}),P={};return e.jsx("div",{ref:m,role:"group","aria-label":"Other renders for this room",className:"flex gap-2.5 overflow-x-auto scrollbar-hide",children:n.map(c=>{const y=c.id===o,b=P[c.materialName]=(P[c.materialName]||0)+1,N=j[c.materialName]||1,R=N>1?`View ${c.materialName}, attempt ${b} of ${N}`:`View ${c.materialName}`;return e.jsx("button",{ref:y?I:void 0,type:"button",onClick:()=>f(c.id),"aria-label":R,"aria-current":y?"true":void 0,className:L("relative h-11 w-11 flex-shrink-0 overflow-hidden rounded-[10px] transition-opacity","md:first:ml-auto md:last:mr-auto",y?"opacity-100 ring-1 ring-white/85":"opacity-55 hover:opacity-80"),children:c.thumbnailUrl?e.jsx("img",{src:c.thumbnailUrl,alt:"",className:"h-full w-full object-cover",loading:"lazy",draggable:!1}):e.jsx("span",{className:"block h-full w-full bg-white/10"})},c.id)})})}const Bn=[["floor_pattern_wrong_size","Floor pattern is the wrong size"],["flooring_outside_floor","Flooring goes where it shouldn’t"],["room_changed","Something in the room changed or is missing"],["material_mismatch","Color or material doesn’t match the sample"],["other","Something else"]];function Vn({open:n,onOpenChange:o,visualizationId:f}){const[x,m]=a.useState(""),[I,j]=a.useState(""),[P,c]=a.useState(!1),[y,b]=a.useState(""),[N,R]=a.use
1State(null);a.useEffect(()=>{m(""),j(""),b(""),R(null)},[f]);const F=O=>{o(O),O||(m(""),j(""),b(""),R(null))},Se=async()=>{if(!(!x||!f)){c(!0),b("");try{const O=await Ge("/api/visualization-reports",{method:"POST",body:JSON.stringify({visualizationId:f,reason:x,note:I.trim()||void 0})}),ue=await O.json().catch(()=>({}));if(!O.ok)throw new Error("report_not_submitted");R(ue.duplicate?"duplicate":"first")}catch{b("Could not submit this report. Please try again.")}finally{c(!1)}}};return e.jsx(la,{open:n,onOpenChange:F,children:e.jsxs(ia,{className:"z-[70] mx-auto max-h-[92dvh] max-w-[393px] overflow-hidden rounded-t-[24px] border-[#dbdbd4] bg-[#fbfaf8] text-[#0f1724]",children:[N?null:e.jsxs(oa,{className:"px-6 pb-3 pt-2 text-left",children:[e.jsx(ca,{className:"text-[22px] font-semibold leading-tight text-[#0f1724]",children:"What’s wrong with this render?"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-[#596375]",children:"Choose the closest issue. Your report is tied to this exact result."})]}),N?e.jsxs("div",{className:"px-6 pb-10 pt-6",children:[e.jsx("div",{className:"grid h-[42px] w-[42px] place-items-center rounded-full bg-[#e3f3e9] text-[#176638]",children:e.jsx(hs,{className:"h-5 w-5"})}),e.jsx("p",{className:"mt-5 text-[22px] font-semibold leading-tight text-[#0f1724]",children:N==="duplicate"?"This render is already under review":"Thanks—we received your report"}),e.jsx("p",{className:"mt-6 text-sm leading-5 text-[#596375]",children:N==="duplicate"?"We’ve kept your report with this result. Our team reviews every report.":"We’ve tied it to this exact render. Our team reviews every report."}),e.jsx(H,{type:"button",onClick:()=>F(!1),className:"mt-9 h-[52px] w-full rounded-[16px] bg-[#0f1724] text-white hover:bg-[#1b2638]",children:"Done"})]}):e.jsxs("div",{className:"overflow-y-auto px-6 pb-7 pt-1",children:[e.jsx("div",{className:"space-y-2",role:"radiogroup","aria-label":"Generation issue",children:Bn.map(([O,ue])=>e.jsxs("label",{className:"flex min-h-[41px] cursor-pointer items-center gap-3 rounded-[11px] border border-[#dbdbd4] bg-white px-3 text-xs text-[#0f1724]",children:[e.jsx("input",{type:"radio",name:"generation-issue",value:O,checked:x===O,onChange:()=>m(O),className:"h-[17px] w-[17px] accent-[#0f1724]"}),e.jsx("span",{children:ue})]},O))}),e.jsxs("label",{className:"mt-4 block rounded-[11px] border border-[#dbdbd4] bg-white px-3 py-2",children:[e.jsx("span",{className:"block text-[10px] font-semibold text-[#596375]",children:"Optional detail"}),e.jsx("textarea",{value:I,onChange:O=>j(O.target.value),maxLength:1e3,rows:2,className:"mt-1 w-full resize-none border-0 bg-transparent p-0 text-xs text-[#0f1724] outline-none placeholder:text-[#8c919c] focus:ring-0",placeholder:"Tell us anything that would help us review it"})]}),y?e.jsx("p",{role:"alert",className:"mt-3 text-sm text-red-700",children:y}):null,e.jsxs("div",{className:"mt-6 flex items-center justify-between gap-4",children:[e.jsx(H,{type:"button",variant:"ghost",onClick:()=>F(!1),className:"text-[#596375] hover:bg-transparent hover:text-[#0f1724]",children:"Cancel"}),e.jsxs(H,{type:"button",onClick:Se,disabled:!x||P,className:"h-[52px] min-w-[191px] rounded-[16px] bg-[#0f1724] text-white hover:bg-[#1b2638] disabled:bg-[#d5d6d3] disabled:text-[#8c919c]",children:[P?e.jsx(Qe,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Send report"]})]})]})]})})}function qn({open:n,onOpenChange:o,title:f,description:x,children:m}){return an()?e.jsx(la,{open:n,onOpenChange:o,children:e.jsxs(ia,{className:"max-h-[85vh] z-[60]",children:[e.jsx(oa,{className:"border-b",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(ca,{className:"text-xl font-semibold",children:f}),e.jsx("p",{className:"text-sm text-gray-600",children:x})]}),e.jsx(H,{type:"button",variant:"ghost",size:"icon",onClick:()=>o(!1),className:"shrink-0","aria-label":"Close materials drawer",children:e.jsx(us,{className:"h-4 w-4"})})]})}),e.jsx("div",{className:"overflow-y-auto px-4 py-4",children:m})]})}):e.jsx(Zr,{open:n,onOpenChange:o,children:e.jsxs(zr,{children:[e.jsx(ea,{"data-testid":"material-picker-panel-overlay",className:"fixed inset-0 z-[60] bg-black/45 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:animate-none"}),e.jsxs(ta,{"data-testid":"material-picker-panel","aria-describedby":void 0,className:"fixed inset-y-0 right-0 z-[60] flex w-[min(600px,calc(100vw-48px))] flex-col border-l border-hairline bg-white shadow-[0_0_48px_rgba(15,23,42,0.18)] outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right data-[state=closed]:duration-200 data-[state=open]:duration-300 motion-reduce:animate-none",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-hairline px-6 pb-4 pt-6",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(sa,{className:"text-[20px] font-semibold leading-7 text-ink",children:f}),e.jsx("p",{className:"mt-0.5 text-sm text-ink-secondary",children:x})]}),e.jsx(ra,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Close materials drawer",className:"-mr-2 -mt-1 grid h-11 w-11 shrink-0 place-items-center rounded-full text-ink transition-colors hover:bg-fill-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink focus-visible:ring-offset-2",children:e.jsx(us,{className:"h-5 w-5","aria-hidden":"true"})})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 pb-8 pt-5",children:m})]})]})})}function Hn({onSeeOptions:n,variant:o}){return e.jsxs("div",{"data-testid":`last-preview-card-${o}`,className:L("pointer-events-auto rounded-2xl border border-white/20 bg-black/55 p-4 text-left font-chrome text-white backdrop-blur-[14px]",o==="desktop"?"mt-1 w-[320px]":"w-full"),children:[e.jsx("p",{className:"text-[14px] font-semibold leading-snug",children:ht.title}),e.jsx("p",{className:"mt-1 text-[13px] leading-snug text-white/80",children:ht.body}),e.jsx("button",{type:"button","data-testid":"last-preview-see-options",onClick:n,className:"mt-3 inline-flex h-11 items-center justify-center rounded-full bg-white px-5 text-[14px] font-semibold text-ink transition-colors hover:bg-white/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-2 focus-visible:ring-offset-black",children:ht.cta})]})}const Wn=65e3,$n=1.5,da=300*1e3;function Yn(n){const o=Number(n);return Number.isFinite(o)&&o>0?o:Wn}function Xn(n){return Math.round(Yn(n)*$n)}function Gn(n,o){return n>Xn(o)&&n<=da}const cs={straight:"Straight plank",herringbone:"Herringbone",chevron:"Chevron"};function ds(n,o,f){const m=(f?new Date(f):new Date).toLocaleDateString("en-US",{month:"short",day:"numeric"});if(!n)return{eyebrow:(o==null?void 0:o.replace(/_/g," ").toUpperCase())||"VISUAL",hero:"Untitled",subtitle:m};const I=n.indexOf("•");if(I>0){const j=n.slice(0,I).trim().toUpperCase(),P=n.slice(I+1).trim(),c=P.split(/\s+/),y=["Full","Medium","Light","Heavy"],b=c.findIndex(F=>y.includes(F));let N,R="";return b>0?(N=c.slice(0,b).join(" "),R=c.slice(b).join(" ").toUpperCase()):N=P,{eyebrow:[j,R].filter(
1Boolean).join(" • "),hero:N,subtitle:m}}return{eyebrow:(o==null?void 0:o.replace(/_/g," ").toUpperCase())||"MATERIAL",hero:n,subtitle:m}}function Kr(n){if(ua(n))return!1;const o=(n==null?void 0:n.message)||"";return!navigator.onLine||o.includes("Failed to fetch")||o.includes("NetworkError")||o.includes("Request failed after retries")}function ua(n){const o=(n==null?void 0:n.message)||"",f=(n==null?void 0:n.code)||"";return(n==null?void 0:n.status)===429||f==="RATE_LIMITED"||o.includes("RATE_LIMIT_EXCEEDED")||o.includes("VIZ_IP_RATE_LIMITED")||o.includes("Too many requests")}function Qn(n){if(!n)return 3e4;const o=Number(n);if(Number.isFinite(o))return Math.max(0,o*1e3);const f=Date.parse(n);return Number.isFinite(f)?Math.max(0,f-Date.now()):3e4}const Kn=1600,Jn=6e3;function Jr(n,o=8e3){return new Promise((f,x)=>{const m=new Image;let I=!1,j;const P=c=>{if(!I){if(I=!0,j!==void 0&&window.clearTimeout(j),c){x(c);return}f()}};j=window.setTimeout(()=>P(),o),m.onload=async()=>{var c;try{await((c=m.decode)==null?void 0:c.call(m))}catch{}P()},m.onerror=()=>P(new Error("Image failed to load for reveal")),m.decoding="async",m.src=n})}function Zn(n,o){return n?!o||o.startsWith("blob:")||Sn(o):!1}function Ll(){var Js,Zs,zs,er,tr,sr,rr,ar,nr,lr,ir,or,cr,dr,ur,mr,hr,fr,pr,xr,gr,wr,br,vr,jr,_r,yr,Nr,kr,Ir,Sr,Er,Rr,Cr,Pr,Tr,Ar,Lr,Mr,Ur,Or;const{id:n}=La(),[,o]=Ma(),{toast:f}=Da(),x=Fa(),m=Aa(),[I,j]=a.useState(!1),[P,c]=a.useState(!1),[y,b]=a.useState(null),N=a.useRef(null);a.useEffect(()=>{c(!1),b(null)},[n]);const[R,F]=a.useState(!1),[Se,O]=a.useState(""),[ue,pe]=a.useState(!1),[Ue,Oe]=a.useState(!1),[De,Ke]=a.useState(!1),[Ee,Fe]=a.useState(!1),[Be,Re]=a.useState(!1),[xe,C]=a.useState(!1),[Q,K]=a.useState(!1),[Bt,Ve]=a.useState(!1),[Je,Ze]=a.useState("straight"),[Ce,ze]=a.useState(1),et=a.useRef(null),[J,Pe]=a.useState(null),[V,re]=a.useState(null),[W,ae]=a.useState(!1),[ft,ps]=a.useState(0),xs=a.useRef(!1),[gs,qe]=a.useState(!1),[Te,He]=a.useState(null),me=a.useRef(null),tt=a.useRef(0),pt=a.useRef(0),B=a.useRef(null),Vt=a.useRef(null),qt=a.useRef(null),[d,Ht]=a.useState(()=>{const s=as();return(s==null?void 0:s.vizId)===n?s:null}),[ee,ws]=a.useState((d==null?void 0:d.roomPhotoUrl)??null),[Ae,bs]=a.useState((d==null?void 0:d.materialThumbUrl)??null),[Wt,$t]=a.useState(x?"online":"offline"),[Yt,xt]=a.useState(!1),[vs,st]=a.useState(!1),js=a.useRef(null),Xt=a.useRef(null),gt=a.useRef(!1),rt=a.useRef(null),wt=a.useRef(null),at=a.useRef(null),je=a.useRef(null),_s=a.useRef(null),bt=a.useCallback(()=>{Ba(),o("/")},[o]),ge=a.useCallback(()=>{rt.current&&(window.clearTimeout(rt.current),rt.current=null),wt.current&&(window.clearTimeout(wt.current),wt.current=null)},[]),ma=a.useCallback(()=>C(!1),[]),ha=a.useCallback(()=>K(!1),[]);Gr(xe,ma),Gr(Q,ha);const[ys,Ns]=a.useState(!1),{data:Gt}=_n(),[fa,nt]=a.useState(!1),[_e,ks]=a.useState({used:0,limit:0,remaining:0,tier:""}
1),[pa,Is]=a.useState("limit"),[xa,ga]=a.useState(null),[ye,vt]=a.useState(null);a.useEffect(()=>{const s=setTimeout(()=>Ke(!0),50);return()=>clearTimeout(s)},[]),a.useEffect(()=>{const s=as(),l=(s==null?void 0:s.vizId)===n?s:null;at.current=null,Ht(l),ws((l==null?void 0:l.roomPhotoUrl)??null),bs((l==null?void 0:l.materialThumbUrl)??null)},[n]),a.useEffect(()=>{if(n){if(!x){$t("offline"),oe("viz_connection_lost",{vizId:n,from:"results"});return}$t(s=>s==="offline"?(oe("viz_reconnect_attempted",{vizId:n,from:"results"}),"reconnecting"):s)}},[n,x]);const Qt=a.useRef(Ce),jt=a.useRef({initialDistance:0,initialScale:1});a.useEffect(()=>{Qt.current=Ce},[Ce]),a.useEffect(()=>{const s=et.current;if(!s)return;const l=h=>{if(h.touches.length===2){const S=h.touches[0],r=h.touches[1];jt.current.initialDistance=Math.hypot(r.clientX-S.clientX,r.clientY-S.clientY),jt.current.initialScale=Qt.current}},u=h=>{if(h.touches.length===2){h.preventDefault();const S=h.touches[0],r=h.touches[1],g=Math.hypot(r.clientX-S.clientX,r.clientY-S.clientY)/jt.current.initialDistance,v=Math.min(Math.max(jt.current.initialScale*g,1),3);ze(v)}},p=h=>{h.touches.length<2&&Qt.current>1&&setTimeout(()=>ze(1),300)};return s.addEventListener("touchstart",l,{passive:!0}),s.addEventListener("touchmove",u,{passive:!1}),s.addEventListener("touchend",p,{passive:!0}),()=>{s.removeEventListener("touchstart",l),s.removeEventListener("touchmove",u),s.removeEventListener("touchend",p)}},[]);const Ss=typeof window<"u"?new URLSearchParams(window.location.search).get("sliderV2"):null,wa=Ss===null?!0:Ss==="1",Es=typeof window<"u"?new URLSearchParams(window.location.search).get("editorial"):null,ba=Es==="1"?!0:Es==="0"?!1:jn,{user:Rs,isAdmin:Cs}=Va(),Z=Rs??null,{data:Y}=qa({enabled:!!Rs}),Ps=Cs?null:Ha(Y),Kt=a.useCallback(s=>{const l=Wa(Y)??0,u=$a(Y),p=typeof(Y==null?void 0:Y.used)=="number"?Y.used:typeof(Y==null?void 0:Y.count)=="number"?Y.count:Math.max(0,l-u);ks({used:p,limit:l,remaining:u,tier:(Y==null?void 0:Y.tier)||"free_trial"}),Is(s),nt(!0)},[Y]),{data:i,dataUpdatedAt:va,isLoading:Ts,isFetching:ja,isError:_t,error:we,refetch:Ne}=rs({queryKey:["viz-detail",n],enabled:!!n,retry:!1,queryFn:async()=>{if(!n)throw new Error("Missing visualization id");const s=await Ge("/api/visualizations/"+n);if(s.status===404)throw Object.assign(new Error("Visualization not found"),{code:"NOT_FOUND"});if(s.status===403)throw Object.assign(new Error("You do not have access to this visualization"),{code:"FORBIDDEN"});if(s.status===429){const r=Qn(s.headers.get("Retry-After"));throw Object.assign(new Error("Visualization status is temporarily rate-limited"),{code:"RATE_LIMITED",status:429,retryAfterMs:r})}const l=await ls(s,o),u=l&&typeof l=="object"&&(Object.prototype.hasOwnProperty.call(l,"photo")||Object.prototype.hasOwnProperty.call(l,"outputs")||l.version==="v2"),p=r=>{var T,q,_,A,E,U,le,te,fe,ie,ve,$,Ie,dt;if(!r)throw new Error("Malformed visualization payload (legacy)");const g=r.after&&(r.after.url||r.after.path)||r.output_path?[{id:(r.id?r.id:"viz")+":final",kind:"final",url:((T=r.after)==null?void 0:T.url)??null,thumbUrl:((q=r.after)==null?void 0:q.thumbUrl)||((_=r.after)==null?void 0:_.url)||null,width:((A=r.after)==null?void 0:A.width)??(r.before?r.before.width:null),height:((E=r.after)==null?void 0:E.height)??(r.before?r.before.height:null),path:((U=r.after)==null?void 0:U.path)??r.output_path??null,created_at:r.completed_at??r.updated_at??r.created_at??null}]:[];return{visualization:{id:r.id,status:r.status,quality:r.quality||"hd",created_at:r.created_at,updated_at:r.updated_at??r.completed_at??r.created_at,completed_at:r.completed_at??null,photo_id:r.photo_id??null,project_id:r.project_id??null,project_title:r.name??null,material_id:((le=r.material)==null?void 0:le.id)??null,render_options:r.render_options??{},render_options_key:r.render_options_key||"default",progress_stage:r.progress_stage??null,estimated_duration_ms:r.estimated_duration_ms??null,processing_started_at:r.processing_started_at??null,request_id:r.request_id??null,provider_used:r.provider_used??null,duration_ms:r.duration_ms??null,error:r.error??null,error_code:((te=r.error)==null?void 0:te.code)??null,error_message:((fe=r.error)==null?void 0:fe.message)??null,poll_after_ms:["processing","pending","queued"].includes(r.status)?r.poll_after_ms??1500:null,viz_photos:r.before?{id:r.photo_id??null,project_id:r.project_id??null,viz_project_id:r.project_id??null,src_signed_url:r.before.url,src_url:r.before.url,src_path:r.before.path??null,width:r.before.width??null,height:r.before.height??null,viz_projects:r.name?{id:r.project_id??void 0,title:r.name??void 0,client_id:r.client_id??null,assignment_state:r.assignment_state??"review"}:void 0}:null,materials:r.material??null,material:r.material??null,material_identity:os(r.material_identity),output_signed_url:((ie=g[0])==null?void 0:ie.url)??null,output_url:((ve=g[0])==null?void 0:ve.url)??null,output_path:(($=g[0])==null?void 0:$.path)??null,output_width:((Ie=g[0])==null?void 0:Ie.width)??null,output_height:((dt=g[0])==null?void 0:dt.height)??null},outputs:g,version:r.version??"v1",raw:r}},h=r=>
1{var _,A,E,U,le,te,fe,ie,ve,$,Ie,dt;if(!r||typeof r!="object")throw new Error("Malformed visualization payload (canonical)");const M=Array.isArray(r.outputs)?r.outputs.filter(se=>se&&(se.path||se.url)).map((se,Dr)=>({id:se.id||(r.id||"viz")+":output:"+Dr,kind:se.kind||(Dr===0?"final":"variant"),url:se.url??null,thumbUrl:se.thumbUrl||se.url||null,width:se.width??null,height:se.height??null,path:se.path??null,created_at:se.created_at??r.updated_at??r.created_at??null})):[],g=M[0]||null,v=r.material&&r.material.source?r.material.source:r.material&&r.material.owner_id?"custom":r.material&&((_=r.material)!=null&&_.catalog_id)?"catalog":r.material&&r.material.source===null?null:r.material&&r.material.source,T=r.material?{id:r.material.id??null,name:r.material.name??null,category:r.material.category??null,attributes:r.material.attributes??{},source:v,owner_id:r.material.owner_id??null,catalog_id:((A=r.material)==null?void 0:A.catalog_id)??null,thumbnail_path:((E=r.material)==null?void 0:E.thumbnail_path)??null,image_url:((U=r.material)==null?void 0:U.image_url)??null}:null;return{visualization:{id:r.id,status:r.status,quality:r.quality||"hd",created_at:r.created_at,updated_at:r.updated_at??r.created_at,completed_at:r.status==="completed"?r.updated_at??r.created_at:null,photo_id:((le=r.photo)==null?void 0:le.id)??null,project_id:((te=r.project)==null?void 0:te.id)??null,project_title:((fe=r.project)==null?void 0:fe.title)??null,material_id:((ie=r.material)==null?void 0:ie.id)??null,render_options:r.render_options??{},render_options_key:r.render_options_key||"default",progress_stage:r.progress_stage??null,estimated_duration_ms:r.estimated_duration_ms??null,processing_started_at:r.processing_started_at??null,request_id:r.request_id??null,provider_used:r.provider_used??null,duration_ms:r.duration_ms??null,error:r.error??null,error_code:((ve=r.error)==null?void 0:ve.code)??null,error_message:(($=r.error)==null?void 0:$.message)??null,poll_after_ms:r.poll_after_ms??(["processing","pending","queued"].includes(r.status)?1500:null),viz_photos:r.photo?{id:r.photo.id??null,project_id:((Ie=r.project)==null?void 0:Ie.id)??null,viz_project_id:((dt=r.project)==null?void 0:dt.id)??null,src_signed_url:r.photo.url??null,src_url:r.photo.url??null,src_path:r.photo.path??null,width:r.photo.width??null,height:r.photo.height??null,viz_projects:r.project?{id:r.project.id??void 0,title:r.project.title??void 0,client_id:r.project.clientId??null,assignment_state:r.project.assignmentState??"review"}:void 0}:null,materials:T,material:T,material_identity:os(r.material_identity),output_signed_url:(g==null?void 0:g.url)??null,output_url:(g==null?void 0:g.url)??null,output_path:(g==null?void 0:g.path)??null,output_width:(g==null?void 0:g.width)??null,output_height:(g==null?void 0:g.height)??null},outputs:M,version:r.version??"v2",raw:r}};let S;try{S=u?h(l):p(l)}catch{throw console.error("[VisualizationResults] Could not read preview data"),new Error("Could not read preview data")}return S},refetchInterval:s=>{const l=s.state.data;if(!l)return!1;const u=l.visualization,p=u==null?void 0:u.status;if(!p||u!=null&&u.created_at&&["processing","pending","queued"].includes(p)&&Date.now()-new Date(u.created_at).getTime()>300*1e3)return!1;const h=(u==null?void 0:u.poll_after_ms)??2e3;return["processing","pending","queued"].includes(p)?h:!1}});a.useEffect(()=>{if(je.current&&(window.clearTimeout(je.current),je.current=null),!_t||!ua(we))return;const s=typeof(we==null?void 0:we.retryAfterMs)=="number"?we.retryAfterMs:3e4;return je.current=window.setTimeout(()=>{je.current=null,Ne()},s),()=>{je.current&&(window.clearTimeout(je.current),je.current=null)}},[we,_t,Ne]),a.useEffect(()=>{var l,u,p,h,S,r;if(!n)return;const s=i==null?void 0:i.visualization;s&&(ut(s.status)?(Vr({vizId:n,photoId:s.photo_id,projectId:s.project_id,materialId:s.material_id,materialName:((l=s.materials)==null?void 0:l.name)||null,materialThumbUrl:Ae||((u=s.materials)==null?void 0:u.thumbnail_path)||((p=s.materials)==null?void 0:p.image_url)||null,roomPhotoPath:((h=s.viz_photos)==null?void 0:h.src_path)||(d==null?void 0:d.roomPhotoPath)||null,roomPhotoUrl:ee||((S=s.viz_photos)==null?void 0:S.src_signed_url)||((r=s.viz_photos)==null?void 0:r.src_url)||(d==null?void 0:d.roomPhotoUrl)||null,status:s.status,progressStage:s.progress_stage||null,estimatedDurationMs:s.estimated_duration_ms??null,processingStartedAt:s.processing_started_at??null}),Ht(as())):(s.status==="completed"||s.status==="failed")&&(Ya(n),Ht(null)),Wt==="reconnecting"&&(oe("viz_reconnected",{vizId:n,from:"results"}),$t("online")))},[n,i==null?void 0:i.visualization,Ae,ee,Wt,d==null?void 0:d.roomPhotoPath,d==null?void 0:d.roomPhotoUrl]),a.useEffect(()=>{if(!n)return;const s=()=>{const u=i==null?void 0:i.visualization;x&&(ut(u==null?void 0:u.status)||ut(d==null?void 0:d.status))&&Ne()},l=u=>{u.persisted&&s()};return window.addEventListener("online",s),window.addEventListener("focus",s),window.addEventListener("pageshow",l),()=>{window.removeEventListener("online",s),window.removeEventListener("focus",s),window.removeEventListener("pageshow",l)}},[n,x,Ne,d==null?void 0:d.status,i==null?void 0:i.visualization]);const{data:z,dataUpdatedAt:_a,refetch:ya}=rs({queryKey:["selectable-materials"],queryFn:async()=>{const s=await Ge("/api/selectable-materials");if(!s.ok)throw new Error("Failed to fetch materials");const l=await s.json();return Pn(l)},refetchInterval:s=>{var l;return Cn((l=s.state)==null?void 0:l.data)},enabled:!!(i!=null&&i.visualization)&&i.visualization.status==="completed"}),yt=a.useRef(null),Na=a.useCallback(()=>
1{if(yt.current)return yt.current;const s=m.invalidateQueries({queryKey:["selectable-materials"]},{cancelRefetch:!1}).then(()=>{},()=>{}).finally(()=>{yt.current=null});return yt.current=s,s},[m]);a.useEffect(()=>{!xe||!z||En(_a,z.my)&&ya()},[xe]);const{data:w}=rs({queryKey:["viz-siblings",n],queryFn:async()=>{const s=await Ge(`/api/visualizations/${n}/siblings`);if(!s.ok)throw new Error("Failed to fetch siblings");return s.json()},enabled:!!n&&!!(i!=null&&i.visualization)&&i.visualization.status==="completed",staleTime:3e4}),[X,Nt]=a.useState(null),[ka,As]=a.useState({}),We=a.useRef(new Map);a.useEffect(()=>{if(!(w!=null&&w.siblings))return;const s=50,l=3;let u=!1,p=0;const h=v=>new Promise(T=>{const q=new Image,_=()=>T(q);q.onload=_,q.onerror=_,q.src=v}),S=async v=>{const T=We.current.get(v.id);if(T!=null&&T.__signedUrl){As(_=>_[v.id]===T.__signedUrl?_:{..._,[v.id]:T.__signedUrl});return}if(v.outputPath||v.outputUrl)try{const _=v.outputPath?await mt(v.outputPath,{transform:"full",maxAttempts:2}).then(A=>A!=null&&A.ok?A.url:null):v.outputUrl||null;if(_){if(u)return;const A=await h(_);if(u)return;if(A.__signedUrl=_,We.current.set(v.id,A),As(E=>E[v.id]===_?E:{...E,[v.id]:_}),We.current.size>s){const E=We.current.keys().next().value;E&&We.current.delete(E)}}}catch(_){console.warn("[FilterStrip] Failed to preload sibling",v.id.substring(0,8),_)}},r=w.siblings,M=Math.min(l,r.length),g=async()=>{for(;!u;){const v=r[p];if(p+=1,!v)return;await S(v)}};return Promise.all(Array.from({length:M},g)),()=>{u=!0}},[w==null?void 0:w.siblings]),a.useEffect(()=>{n&&Nt(n)},[n]),a.useEffect(()=>{C(!1),j(!1),pe(!1),nt(!1),K(!1)},[n]);const Ls=a.useCallback(s=>{var p;if(s===X)return;const l=(p=w==null?void 0:w.siblings)==null?void 0:p.find(h=>h.id===s);if(!l)return;const u=We.current.get(s);u&&u.__signedUrl?(Nt(s),re(u.__signedUrl)):l.outputUrl?(Nt(s),re(l.outputUrl)):l.outputPath&&mt(l.outputPath,{transform:"full",maxAttempts:2}).then(h=>{h&&h.ok===!0&&(Nt(s),re(h.url))}).catch(h=>{console.error("[FilterStrip] Failed to switch sibling",h)})},[X,w==null?void 0:w.siblings]),k=a.useMemo(()=>!(w!=null&&w.siblings)||!X?null:w.siblings.find(s=>s.id===X)||null,[w==null?void 0:w.siblings,X]),t=i==null?void 0:i.visualization,Ms=t==null?void 0:t.created_at,Jt=t==null?void 0:t.status,Us=Jt==="processing"||Jt==="pending"||Jt==="queued",Os=Ms&&Us?(va||Date.now())-new Date(Ms).getTime():0,lt=(t==null?void 0:t.estimated_duration_ms)??(d==null?void 0:d.estimatedDurationMs)??void 0,$e=Os>da,kt=Gn(Os,lt),Le=Us&&!$e,D=(t==null?void 0:t.status)==="completed",Zt=(t==null?void 0:t.status)==="failed"||$e,Ds=y??{code:t==null?void 0:t.error_code},Fs=de(Ds),Bs=!!(D&&J&&V&&!W&&Te===null),be=!!(d&&d.vizId===n&&ut(d.status)),It=(ye==null?void 0:ye.name)||((Js=t==null?void 0:t.materials)==null?void 0:Js.name)||(d==null?void 0:d.materialName)||"Material",St=ye&&!Le?"pending":(t==null?void 0:t.status)??(d==null?void 0:d.status)??void 0,Et=ye&&!Le?"pending":(t==null?void 0:t.progress_stage)||(d==null?void 0:d.progressStage)||void 0,Rt=(t==null?void 0:t.processing_started_at)??(d==null?void 0:d.processingStartedAt)??void 0,Ct=x?Wt==="reconnecting"||ja&&be&&!t||_t&&be&&Kr(we)?"reconnecting":"online":"offline",Ia=((Zs=t==null?void 0:t.viz_photos)==null?void 0:Zs.src_signed_url)||((zs=t==null?void 0:t.viz_photos)==null?void 0:zs.src_url)||null,it=(ee&&!ee.startsWith("blob:")?ee:null)||Ia||ee||(d==null?void 0:d.roomPhotoUrl)||void 0,zt=((er=t==null?void 0:t.viz_photos)==null?void 0:er.src_path)||(d==null?void 0:d.roomPhotoPath)||null,Pt=!!(zt&&!it);a.useEffect(()=>{gt.current=!1,Xt.current=null,xt(!1),st(!1),ge()},[n,ge]),a.useEffect(()=>{(Le||be)&&(gt.current=!0)},[be,Le]),a.useEffect(()=>{!n||(t==null?void 0:t.status)!=="completed"||Xt.current===n||!gt.current||(Xt.current=n,ga(n),m.invalidateQueries({queryKey:["usage"]}),xt(!0),st(!1),ge(),rt.current=window.setTimeout(()=>{st(!0),rt.current=null},Kn),wt.current=window.setTimeout(()=>{xt(!1),st(!1),ge()},Jn))},[ge,n,m,t==null?void 0:t.status]),a.useEffect(()=>{!Yt||!vs||!Bs||(ge(),xt(!1),st(!1))},[ge,vs,Bs,Yt]),a.useEffect(()=>()=>ge(),[ge]),a.useEffect(()=>{const s=zt;if(!Le&&!be||!Zn(s,ee)||at.current===s)return;let l=!1;return at.current=s,mt(s,{transform:"full",maxAttempts:2}).then(u=>{!l&&(u!=null&&u.ok)?(ee!=null&&ee.startsWith("blob:")&&ee!==u.url&&URL.revokeObjectURL(ee),ws(u.url)):l||(at.current=null)}
1).catch(u=>{l||(at.current=null),console.warn("[VisualizationResults] Processing photo sign failed",u)}),()=>{l=!0}},[be,Le,zt,ee]),a.useEffect(()=>{if(!(t!=null&&t.materials))return;const s=t.materials.thumbnail_path||t.materials.image_url||(d==null?void 0:d.materialThumbUrl)||null;s&&bs(s)},[t==null?void 0:t.materials,d==null?void 0:d.materialThumbUrl]),a.useEffect(()=>{(D||Zt)&&(He(null),B.current&&(window.clearInterval(B.current),B.current=null))},[D,Zt]),a.useEffect(()=>{!n||!d||_s.current===n||!(i!=null&&i.visualization)||d.vizId===n&&ut(i.visualization.status)&&(_s.current=n,oe("viz_resume_restored",{vizId:n,from:"results",status:i.visualization.status}))},[n,d,i==null?void 0:i.visualization]),a.useEffect(()=>{!n||!t||!D||js.current===n||(js.current=n,oe("viz_completed",{id:n,source:"results",durationMs:t.duration_ms,requestId:t.request_id}),oe("createflow_generation_completed",{vizId:n,materialId:t.material_id,durationMs:t.duration_ms}),Xa("showfloor_first_preview_completed_v1")&&oe("first_preview_completed",Ga({source_path:"/visualizations",destination:typeof window>"u"?`/visualizations/${n}`:window.location.href,vizId:n,materialId:t.material_id,durationMs:t.duration_ms})))},[n,D,t]),a.useEffect(()=>{if(!D||!J||!V||xs.current)return;if(xs.current=!0,window.matchMedia("(prefers-reduced-motion: reduce)").matches){ps(.5);return}requestAnimationFrame(()=>{ps(.5)})},[D,J,V]);const Vs=Gt==null?void 0:Gt.completed;a.useEffect(()=>{if(!D||!J||!V||Vs!==1)return;const s="sf-first-viz-seen";if(localStorage.getItem(s))return;localStorage.setItem(s,"1"),Ns(!0);const l=setTimeout(()=>Ns(!1),2e3);return()=>clearTimeout(l)},[D,J,V,Vs]);const{parsedMaterial:Tt,resultQualifier:Sa,snapshotMaterialName:qs}=a.useMemo(()=>{var u,p;const s=!!(k&&X&&X!==n),l=s?os(k==null?void 0:k.material_identity):(t==null?void 0:t.material_identity)??null;if(l){const h=l.category?Rn[l.category]??l.category:void 0;return{parsedMaterial:ds(l.name??void 0,h,t==null?void 0:t.created_at),resultQualifier:Tn(l),snapshotMaterialName:l.name??null}}return{parsedMaterial:s?ds(k==null?void 0:k.materialName,k==null?void 0:k.materialCategory,t==null?void 0:t.created_at):ds((u=t==null?void 0:t.materials)==null?void 0:u.name,(p=t==null?void 0:t.materials)==null?void 0:p.category,t==null?void 0:t.created_at),resultQualifier:null,snapshotMaterialName:null}},[(tr=t==null?void 0:t.materials)==null?void 0:tr.name,(sr=t==null?void 0:t.materials)==null?void 0:sr.category,t==null?void 0:t.material_identity,t==null?void 0:t.created_at,k,X,n]),At=a.useMemo(()=>{var s,l;return X&&X!==n&&(k!=null&&k.materialCategory)?k.materialCategory:((s=t==null?void 0:t.materials)==null?void 0:s.source)==="custom"?"my_stuff":((l=t==null?void 0:t.materials)==null?void 0:l.category)||"all"},[k==null?void 0:k.materialCategory,X,n,(rr=t==null?void 0:t.materials)==null?void 0:rr.category,(ar=t==null?void 0:t.materials)==null?void 0:ar.source]),Hs=a.useMemo(()=>At==="all"?"categories":"materials",[At]),Ye=(nr=t==null?void 0:t.viz_photos)!=null&&nr.width&&((lr=t==null?void 0:t.viz_photos)!=null&&lr.height)?{width:t.viz_photos.width,height:t.viz_photos.height}:t!=null&&t.output_width&&(t!=null&&t.output_height)?{width:t.output_width,height:t.output_height}:void 0,Ws=new URLSearchParams(location.search).get("sliderCanvas")==="1",ot=!!(X&&X!==n&&k),ne=(ot?X:n)||n||"",Lt=((or=(ir=t==null?void 0:t.viz_photos)==null?void 0:ir.viz_projects)==null?void 0:or.client_id)||void 0,es=((dr=(cr=t==null?void 0:t.viz_photos)==null?void 0:cr.viz_projects)==null?void 0:dr.id)||((ur=t==null?void 0:t.viz_photos)==null?void 0:ur.project_id)||(t==null?void 0:t.project_id)||void 0,Ea=a.useCallback(()=>{if(Lt){o(Qa(Lt,{intent:"proposal",vizId:ne}));return}o(is({vizId:ne,projectId:es,source:"result-price-it"}))},[ne,o,Lt,es]),ct=Xr(qs,ot?k==null?void 0:k.materialName:(mr=t==null?void 0:t.materials)==null?void 0:mr.name),$s=Xr(qs,ot?k==null?void 0:k.materialName:(hr=t==null?void 0:t.materials)==null?void 0:hr.name,"After"),Ra=ot?(k==null?void 0:k.outputPath)||void 0:((pr=(fr=i==null?void 0:i.outputs)==null?void 0:fr[0])==null?void 0:pr.path)||(t==null?void 0:t.output_path)||void 0,G=a.useMemo(()=>{var s;return((s=t==null?void 0:t.materials)==null?void 0:s.category)==="wood"?nn(t.materials.attributes||{}):null},[(xr=t==null?void 0:t.materials)==null?void 0:xr.attributes,(gr=t==null?void 0:t.materials)==null?void 0:gr.category]),ce=((br=(wr=t==null?void 0:t.render_options)==null?void 0:wr.layout)==null?void 0:br.pattern)||(G==null?void 0:G.recommendedLayout)||null,Ys=!!(!ot&&(G!=null&&G.requiresConfirmation)&&ce),Xs=a.useCallback(()=>
1{if(!(G!=null&&G.recommendedLayout)||!ce)return;const s=G.layouts.find(l=>l!==ce)||ce;Ze(s),Ve(!0)},[ce,G]),ke=a.useCallback(async function s(l="initial"){var g,v,T,q,_,A;if(!D||!t)return;me.current&&(window.clearTimeout(me.current),me.current=null);const u=++pt.current,p=((g=t.viz_photos)==null?void 0:g.src_path)??null,h=((v=t.viz_photos)==null?void 0:v.src_url)??null,S=((q=(T=i==null?void 0:i.outputs)==null?void 0:T[0])==null?void 0:q.path)??t.output_path??null,r=((A=(_=i==null?void 0:i.outputs)==null?void 0:_[0])==null?void 0:A.url)??t.output_url??null;Vt.current=p,qt.current=S,l==="initial"?(tt.current=0,qe(!1),ae(!0)):l==="manual-after"&&(ae(!0),qe(!1));const M=l==="scheduled"?2:3;try{const[E,U]=await Promise.all([h?Promise.resolve({ok:!0,url:h}):p?mt(p,{transform:"full",maxAttempts:M}):Promise.resolve(null),S?mt(S,{transform:"full",maxAttempts:M}):r?Promise.resolve({ok:!0,url:r}):Promise.resolve(null)]);if(!D||!t||u!==pt.current)return;const le=E&&E.ok?E.url:null,te=U&&U.ok?U.url:null;if(gt.current&&le&&te&&await Promise.allSettled([Jr(le),Jr(te)]),!D||!t||u!==pt.current)return;Pe(le),re(te);const fe=!!(U&&!U.ok&&U.code==="NotFound");te?(He(null),B.current&&(window.clearInterval(B.current),B.current=null),qe(!1),tt.current=0):fe?l==="initial"&&tt.current===0?(qe(!0),tt.current+=1,He(10),B.current=window.setInterval(()=>{He(ie=>ie===null||ie<=1?(B.current&&(window.clearInterval(B.current),B.current=null),null):ie-1)},1e3),me.current=window.setTimeout(()=>{B.current&&(window.clearInterval(B.current),B.current=null),He(null),s("scheduled")},1e4)):qe(!0):U&&(U==null?void 0:U.ok)===!1&&console.warn("[VisualizationResults] After image sign failed",{status:U.status,code:U.code}),E&&E.ok===!1&&E.code!=="NotFound"&&console.warn("[VisualizationResults] Before image sign failed",{status:E.status,code:E.code})}catch(E){l==="initial"&&console.error("[VisualizationResults] Failed to fetch signed URLs:",E),Pe(null),re(null)}finally{ae(!1)}},[D,t,i==null?void 0:i.outputs]);a.useEffect(()=>{if(!D||!t){me.current&&(window.clearTimeout(me.current),me.current=null),B.current&&(window.clearInterval(B.current),B.current=null),tt.current=0,pt.current=0,Pe(null),re(null),ae(!1),qe(!1),He(null);return}return ke("initial"),()=>{me.current&&(window.clearTimeout(me.current),me.current=null),B.current&&(window.clearInterval(B.current),B.current=null)}},[D,t,ke]);const Mt=a.useCallback(()=>{const s=Vt.current;s&&Ft(s,"full"),Pe(null),ke("manual-after")},[ke]),Ut=a.useCallback(()=>{const s=qt.current;s&&Ft(s,"full"),re(null),ke("manual-after")},[ke]),Gs=a.useCallback(()=>{const s=Vt.current;s&&Ft(s,"full");const l=qt.current;l&&Ft(l,"full"),Pe(null),re(null),ke("manual-after"),Ne()},[ke,Ne]);a.useEffect(()=>{if(!D)return;let s=!1;try{s=localStorage.getItem("seenDragHint")==="true"}catch{}if(s)return;let l,u;const p=setTimeout(()=>{Fe(!0),Re(!1),l=setTimeout(()=>{Re(!0),u=setTimeout(()=>{Fe(!1);try{localStorage.setItem("seenDragHint","true")}catch{}},300)},3e3)},800);return()=>{clearTimeout(p),l&&clearTimeout(l),u&&clearTimeout(u)}},[D]);const Me=Fr({mutationFn:async s=>{const l=await Ge("/api/viz-share",{method:"POST",body:JSON.stringify({vizId:s,days:30})});return ls(l,o)},onMutate:s=>{oe("viz_share_initiated",{id:s,from:"results"})},onSuccess:async(s,l)=>{if(!(s!=null&&s.url)){f({title:de(null,"share").title,description:de(null,"share").message,variant:"destructive"});return}oe("viz_share_success",{id:l,from:"results"}),O(s.url),j(!0)},onError:(s,l)=>{Hr(s)||(oe("viz_share_failed",{id:l,from:"results",error:"share_failed"}),f({title:de(s,"share").title,description:de(s,"share").message,variant:"destructive"}))}}),Qs=a.useRef(!1),{mutate:Ks}=Me;a.useEffect(()=>{if(Qs.current||!D||!n)return;const s=new URLSearchParams(window.location.search);if(s.get("share")!=="1")return;Qs.current=!0,s.delete("share");const l=s.toString();window.history.replaceState(window.history.state,"",`${window.location.pathname}${l?`?${l}`:""}${window.location.hash}`),Ks(n)},[n,D,Ks]);const he=Fr({mutationFn:async({materialId:s,quality:l="hd",layout:u,changeLayout:p=!1})=>
1{var v,T,q,_,A,E,U,le,te,fe,ie;const h=s||((v=i==null?void 0:i.visualization)==null?void 0:v.material_id)||((q=(T=i==null?void 0:i.visualization)==null?void 0:T.materials)==null?void 0:q.id),S=((_=i==null?void 0:i.visualization)==null?void 0:_.photo_id)||((E=(A=i==null?void 0:i.visualization)==null?void 0:A.viz_photos)==null?void 0:E.id);if(!h)throw Object.assign(new Error("Select a material before regenerating."),{code:"MATERIAL_NOT_FOUND"});if(!S)throw Object.assign(new Error("Original photo not found for this visualization."),{code:"PHOTO_NOT_FOUND"});const r=((U=i==null?void 0:i.visualization)==null?void 0:U.material_id)||((te=(le=i==null?void 0:i.visualization)==null?void 0:le.materials)==null?void 0:te.id),M=!p&&h===r?((fe=i==null?void 0:i.visualization)==null?void 0:fe.id)||n:void 0,g=await Ge("/api/visualizations",{method:"POST",body:JSON.stringify({photoId:S,materialId:h,quality:l,...u?{layout:{pattern:u}}:{},...M?{retryOfVisualizationId:M}:{}})});if(g.status===403){const ve=await g.text();let $={};try{$=JSON.parse(ve)}catch{$={message:ve}}if($.code==="USAGE_LIMIT_EXCEEDED"||$.code==="HD_LIMIT_EXCEEDED"||$.code==="HD_NOT_AVAILABLE"){const Ie=new Error("USAGE_LIMIT_EXCEEDED");throw Ie.limitData={used:$.used??0,limit:$.limit??0,remaining:$.remaining??0,tier:$.tier||"free_trial",variant:"limit"},Ie}throw Object.assign(new Error(ve),{code:$.code??((ie=$.error)==null?void 0:ie.code)})}return ls(g,o)},onMutate:s=>{var p,h,S,r;b(null);const l=s.materialId,u=((p=z==null?void 0:z.catalog)==null?void 0:p.find(M=>M.id===l))||((h=z==null?void 0:z.mine)==null?void 0:h.find(M=>M.id===l))||((S=z==null?void 0:z.favorites)==null?void 0:S.find(M=>M.id===l));u?vt({id:l,name:u.name||"Material"}):(r=t==null?void 0:t.materials)!=null&&r.name&&vt({id:l||t.material_id,name:t.materials.name})},onSuccess:s=>{var u,p,h,S,r,M,g,v,T,q,_,A;vt(null);const l=(s==null?void 0:s.id)||(s==null?void 0:s.visualizationId);if(!l){f({title:de(null).title,description:de(null).message,variant:"destructive"});return}if(l===n){f({title:"Already generated",description:"This visualization already exists."});return}Vr({vizId:l,photoId:((u=i==null?void 0:i.visualization)==null?void 0:u.photo_id)||null,projectId:((p=i==null?void 0:i.visualization)==null?void 0:p.project_id)||null,materialId:((h=s==null?void 0:s.material)==null?void 0:h.id)||(s==null?void 0:s.material_id)||null,materialName:(ye==null?void 0:ye.name)||((S=s==null?void 0:s.material)==null?void 0:S.name)||((M=(r=i==null?void 0:i.visualization)==null?void 0:r.materials)==null?void 0:M.name)||null,materialThumbUrl:Ae||((v=(g=i==null?void 0:i.visualization)==null?void 0:g.materials)==null?void 0:v.thumbnail_path)||((q=(T=i==null?void 0:i.visualization)==null?void 0:T.materials)==null?void 0:q.image_url)||null,roomPhotoPath:((A=(_=i==null?void 0:i.visualization)==null?void 0:_.viz_photos)==null?void 0:A.src_path)||null,roomPhotoUrl:ee,status:(s==null?void 0:s.status)||"pending",progressStage:(s==null?void 0:s.progress_stage)||null,estimatedDurationMs:(s==null?void 0:s.estimated_duration_ms)||null,processingStartedAt:(s==null?void 0:s.processing_started_at)||null}),m.invalidateQueries({queryKey:["viz-detail",l]}),oe("viz_live_job_opened",{vizId:l,source:"results"}),o(`/visualizations/${l}`)},onError:s=>{if(vt(null),!Hr(s)){if((s==null?void 0:s.message)==="USAGE_LIMIT_EXCEEDED"&&(s!=null&&s.limitData)){ks(s.limitData),Is("limit"),c(!0),dn(s.limitData.tier)?nt(!0):f({title:en(0),action:e.jsx(za,{altText:ht.cta,onClick:()=>nt(!0),children:ht.cta})});return}b(s),f({title:de(s).title,description:de(s).message,variant:"destructive"})}}}),ts=Yt,ss=Le||he.isPending||ts,Ca=a.useCallback(s=>{C(!1),he.mutate({materialId:s})},[he]),Pa=a.useCallback(()=>{C(!1),o("/materials")},[o]);if(Ts&&be)return e.jsxs(e.Fragment,{children:[e.jsx(Ot,{title:"Visual"}),e.jsx(Dt,{materialName:It,status:St,estimatedDurationMs:lt,progressStage:Et,roomPhotoUrl:it,isRoomPhotoLoading:Pt,materialThumbUrl:Ae||(d==null?void 0:d.materialThumbUrl)||void 0,processingStartedAt:Rt,connectionState:Ct,isSlow:kt,isTimedOut:$e},"viz-recovery-loading")]});if(Ts)return e.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-7xl",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("div",{className:"h-9 w-64 bg-gray-200 rounded animate-pulse mb-2"}),e.jsx("div",{className:"h-5 w-48 bg-gray-200 rounded animate-pulse"})]}),e.jsx("div",{className:"w-full max-w-[900px] mx-auto",children:e.jsxs("div",{className:"rounded-2xl bg-gray-200 shadow-sm p-4 animate-pulse",children:[e.jsx("div",{className:"h-6 w-40 bg-gray-300 rounded mb-3"}),e.jsx("div",{className:"aspect-video bg-gray-300 rounded-lg"})]})})]});if(_t){if(be&&Kr(we))return e.jsxs(e.Fragment,{children:[e.jsx(Ot,{title:"Visual"}),e.jsx(Dt,{materialName:It,status:St,estimatedDurationMs:lt,progressStage:Et,roomPhotoUrl:it,isRoomPhotoLoading:Pt,materialThumbUrl:Ae||(d==null?void 0:d.materialThumbUrl)||void 0,processingStartedAt:Rt,connectionState:Ct,isSlow:kt,isTimedOut:$e},"viz-recovery-error")]});const s=de(we,"load");return e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] gap-4 px-4 text-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:s.title}),e.jsx("p",{className:"text-sm text-gray-600 max-w-md mt-1",children:s.message})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[e.jsx(H,{onClick:()=>Ne(),className:"min-w-[120px]",children:"Try loading again"}),e.jsx(H,{variant:"outline",onClick:bt,className:"min-w-[120px]",children:"Back to Home"})]})]})}return t?e.jsxs(e.Fragment,{children:[e.jsx(Ot,{title:ct&&ct!=="Floor Visualization"?ct:"Visual"}),e.jsx("style",{children:`
2        @keyframes slideUpFadeIn {
3          0% {
4            opacity: 0;
5            transform: translate(-50%, -50%) translateY(12px);
6          }
7          100% {
8            opacity: 1;
9            transform: translate(-50%, -50%) translateY(0);
10          }
11        }
12
13        @keyframes slideDownFadeOut {
14          0% {
15            opacity: 1;
16            transform: translate(-50%, -50%) translateY(0);
17          }
18          100% {
19            opacity: 0;
20            transform: translate(-50%, -50%) translateY(8px);
21          }
22        }
23
24        .drag-hint-enter {
25          animation: slideUpFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
26        }
27
28        .drag-hint-exit {
29          animation: slideDownFadeOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
30        }
31      `}),ss&&e.jsx(Dt,{isStarting:he.isPending,materialName:It,status:St,estimatedDurationMs:lt,progressStage:Et,isCompleting:ts,roomPhotoUrl:it,isRoomPhotoLoading:Pt,revealImageUrl:ts&&V||void 0,materialThumbUrl:Ae||(d==null?void 0:d.materialThumbUrl)||void 0,processingStartedAt:Rt,connectionState:Ct,isSlow:kt,isTimedOut:$e},"generating-overlay"),Zt&&!ss&&e.jsx("div",{className:"min-h-[100dvh] bg-white flex flex-col",children:e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[e.jsx("button",{"aria-label":"Go back",onClick:()=>{window.history.length>1&&document.referrer?window.history.back():o("/")},className:"p-2 rounded-lg hover:bg-gray-100 transition-colors",children:e.jsx(ms,{className:"w-5 h-5 text-gray-600"})}),e.jsx("h1",{className:"text-2xl font-semibold text-gray-900",children:((jr=(vr=t==null?void 0:t.viz_photos)==null?void 0:vr.viz_projects)==null?void 0:jr.title)||(t==null?void 0:t.project_title)||"Visualization"})]}),e.jsx(qr,{className:L("border-0",In.lg,kn.md),children:e.jsxs(Ka,{className:L("flex flex-col items-center justify-center py-16",Nn.inlineGap),children:[e.jsx("div",{className:"text-red-500",children:e.jsx(ns,{className:"h-12 w-12"})}),e.jsx("h2",{className:"text-xl font-semibold",children:Fs.title}),e.jsx("p",{className:"text-gray-600",children:Fs.message}),e.jsx(H,{ref:N,variant:"outline",className:"min-h-11",onClick:()=>c(!1),children:"View recovery options"})]})}),!P&&e.jsx(An,{error:Ds,isRetrying:he.isPending,onRetry:()=>{var s;he.isPending||he.mutate({materialId:(t==null?void 0:t.material_id)||((s=t==null?void 0:t.materials)==null?void 0:s.id)})},onClose:()=>{c(!0),requestAnimationFrame(()=>{var s;return(s=N.current)==null?void 0:s.focus()})}}),((_r=t==null?void 0:t.viz_photos)==null?void 0:_r.src_path)&&e.jsx(qr,{className:"p-4 mt-4 border-primary/20 bg-primary/5",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:"Want to try a different material?"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a different flooring option to start another preview."})]}),e.jsxs(H,{onClick:()=>{var s;localStorage.setItem(Ja,JSON.stringify({imagePath:(s=t.viz_photos)==null?void 0:s.src_path,timestamp:Date.now()})),o("/new")},variant:"default",children:[e.jsx(wn,{className:"h-4 w-4 mr-2"})," Try Different Material"]})]})})]})}),D&&!ss&&e.jsxs(e.Fragment,{children:[ba?W||Te!==null?e.jsxs("div",{className:"h-[100dvh] w-screen grid place-items-center bg-slate-950 text-white gap-3",children:[e.jsx(Qe,{className:"w-12 h-12 animate-spin text-white/60"}),e.jsx("p",{className:"text-sm text-white/70",children:Te!==null?`Still rendering… ${Te}s`:"Loading images…"})]}):!J||!V?e.jsx("div",{className:"h-[100dvh] w-screen grid place-items-center bg-slate-950 text-white",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 px-8 text-center",children:[e.jsx(Yr,{className:"w-14 h-14 text-white/50"}),e.jsx("p",{className:"text-sm text-white/70",children:gs?"Image not ready yet. This can take a moment.":"Unable to load visualization images"}),e.jsxs(H,{onClick:Gs,variant:"secondary",size:"sm",className:"mt-2",children:[e.jsx(ns,{className:"w-4 h-4 mr-2"})," Check Status Again"]})]})}):e.jsx(Dn,{beforeSrc:J,afterSrc:V,category:Tt.eyebrow,materialName:Tt.hero,qualifier:Sa,c
31aption:null,footnote:Ps,onFootnoteClick:Ps?()=>Kt("watermark"):void 0,footerCard:!Cs&&Za(Y,xa===n)?s=>e.jsx(Hn,{variant:s,onSeeOptions:()=>Kt("last_preview")}):void 0,natural:Ye,sourceAspect:Ye&&Ye.width>=Ye.height?"landscape":"portrait",sharePending:Me.isPending,onShare:()=>Me.mutate(ne),onPriceIt:Lt||es?Ea:void 0,onBack:bt,onOpenSwap:()=>C(!0),onChangeLayout:Ys?Xs:void 0,layoutLabel:ce?cs[ce]:void 0,onReportIssue:()=>K(!0),hasSiblings:!!(w!=null&&w.siblings&&w.siblings.length>1),siblingStrip:w!=null&&w.siblings&&w.siblings.length>1?e.jsx(Fn,{visualizations:w.siblings.map(s=>({...s,materialName:Qr(s),thumbnailUrl:ka[s.id]||s.outputUrl||s.thumbnailUrl||""})),activeId:X||n||"",onSelect:Ls}):null,overlay:e.jsxs(e.Fragment,{children:[ys&&e.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none z-30 animate-[celebrationPop_1.6s_ease-out_forwards]",children:e.jsxs("div",{className:"flex items-center gap-2 px-5 py-3 rounded-full bg-white/95 backdrop-blur-sm shadow-2xl",children:[e.jsx(hs,{className:"w-5 h-5 text-green-600"}),e.jsx("span",{className:"text-sm font-semibold text-gray-800",children:"First visualization!"})]})}),Ee&&e.jsxs("div",{className:L("absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","flex items-center gap-2 px-4 py-3 rounded-full","bg-white/95 backdrop-blur-sm shadow-2xl pointer-events-none select-none",Be?"drag-hint-exit":"drag-hint-enter"),children:[e.jsx("svg",{className:"w-5 h-5 text-gray-700",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M8 9l-3 3m0 0l3 3m-3-3h12m-6-6l3 3m0 0l-3 3"})}),e.jsx("span",{className:"text-sm font-medium text-gray-900",children:"Drag to compare"})]})]}),forceCanvas:Ws,onBeforeError:Mt,onAfterError:Ut}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:L("relative bg-slate-950 transition-opacity duration-300 h-[100dvh] overflow-hidden",De?"opacity-100":"opacity-0"),children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 z-50 pointer-events-none p-4 md:p-6 pb-0 pt-[env(safe-area-inset-top,1rem)]",children:e.jsx("button",{onClick:bt,className:"pointer-events-auto h-11 w-11 rounded-full text-white bg-black/20 backdrop-blur-xl border border-white/10 hover:bg-white/20 active:scale-95 transition-all flex items-center justify-center shadow-lg","aria-label":"Back",children:e.jsx(ms,{className:"w-6 h-6"})})}),e.jsx("div",{ref:et,className:"flex items-center justify-center px-0 md:px-0 pt-0 pb-0 h-[100dvh] w-full overflow-hidden relative",children:e.jsxs("div",{className:"w-full h-full relative transition-transform duration-200 ease-out",style:{transform:`scale(${Ce})`,transformOrigin:"center"},children:[W||Te!==null?e.jsxs("div",{className:"w-full h-full rounded-2xl overflow-hidden shadow-2xl bg-gray-100 flex flex-col items-center justify-center gap-3",children:[e.jsx(Qe,{className:"w-12 h-12 animate-spin text-gray-400"}),Te!==null?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-base font-medium text-gray-700",children:"Still rendering..."}),e.jsxs("p",{className:"text-sm text-gray-500",children:["Checking again in ",Te,"s"]})]}):e.jsx("p",{className:"text-sm text-gray-600",children:"Loading images..."})]}):!J||!V?e.jsxs("div",{className:"w-full h-full rounded-2xl overflow-hidden shadow-2xl bg-gray-100 flex flex-col items-center justify-center gap-3 p-8 text-center",children:[e.jsx(Yr,{className:"w-16 h-16 text-gray-400"}),e.jsx("div",{children:gs?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-base font-medium text-gray-700",children:"Image not ready yet"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"The visualization is still being processed. This can take a moment."})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-base font-medium text-gray-700",children:"Images unavailable"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Unable to load visualization images"})]})}),e.jsxs(H,{onClick:Gs,variant:"default",size:"sm",className:"mt-4",children:[e.jsx(ns,{className:"w-4 h-4 mr-2"}),"Check Status Again"]})]}):wa?e.jsx(fs,{beforeSrc:J,afterSrc:V,start:ft,labels:{before:"Original",after:$s},natural:Ye,forceCanvas:Ws,onBeforeError:Mt,onAfterError:Ut,className:"w-full h-full rounded-2xl overflow-hidden shadow-2xl"}):e.jsx(un,{beforeImage:J,afterImage:V,beforeLabel:"Original",afterLabel:$s,width:((yr=t.viz_photos)==null?void 0:yr.width)||t.output_width,height:((Nr=t.viz_photos)==null?void 0:Nr.height)||t.output_height,onBeforeError:Mt,onAfterError:Ut,className:"w-auto h-auto max-w-full max-h-full rounded-2xl overflow-hidden shadow-2xl mx-auto"}),ys&&e.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none z-30 animate-[celebrationPop_1.6s_ease-out_forwards]",children:e.jsxs("div",{className:"flex items-center gap-2 px-5 py-3 rounded-full bg-white/95 backdrop-blur-sm shadow-2xl",children:[e.jsx(hs,{className:"w-5 h-5 text-green-600"}),e.jsx("span",{className:"text-sm font-semibold text-gray-800",children:"First visualization!"})]})}),Ee&&e.jsxs("div",{className:L("absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","flex items-center gap-2 px-4 py-3 rounded-full","bg-white/95 backdrop-blur-sm shadow-2xl","pointer-events-none select-none",Be?"drag-hint-exit":"drag-hint-enter"),children:[e.jsx("svg",{className:"w-5 h-5 text-gray-700",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M8 9l-3 3m0 0l3 3m-3-3h12m-6-6l3 3m0 0l-3 3"})}),e.jsx("span",{className:"text-sm font-medium text-gray-900",children:"Drag to compare"})]})]})}),e.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-50 pb-[env(safe-area-inset-bottom,1.5rem)] pt-8 bg-gradient-to-t from-black/60 to-transparent pointer-events-none",children:[(w==null?void 0:w.siblings)&&w.siblings.length>1&&e.jsx("div",{className:"mb-4 px-4 w-full max-w-[1600px] mx-auto pointer-events-auto",children:e.jsx(Un,{visualizations:w.siblings.map(s=>({...s,materialName:Qr(s),thumbnailUrl:s.thumbnailUrl||""})),activeId:X||n||"",onSelect:Ls})}),e.jsx("div",{className:"px-4 pb-2 w-full max-w-[1600px] mx-auto pointer-events-auto",children:e.jsxs("div",{className:"w-full flex items-center justify-between p-2 pl-5 pr-2 bg-black/40 backdrop-blur-3xl border border-white/20 rounded-[32px] shadow-[0_8px_32px_rgba(0,0,0,0.3)]",children:[e.jsx("button",{onClick:()=>C(!0),className:"flex-1 flex items-center text-left active:scale-95 transition-transform group mr-2",children:e.jsxs("div",{className:"flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx(bn,{className:"w-3 h-3 text-white/55 group-hover:text-white transition-colors flex-shrink-0"}),e.jsxs("p",{className:"text-white/55 text-[11px] font-semibold tracking-[0.16em] uppercase truncate",children:[Tt.eyebrow,e.jsx("span",{className:"hidden sm:inline text-white/35",children:" · Tap to swap"})]})]}),e.jsx("h3",{className:"text-white text-[16px] sm:text-[17px] font-semibold tracking-[-0.01em] leading-[22px] drop-shadow-sm truncate",children:Tt.hero})]})}),e.jsxs("div",{className:"flex items-center pl-2 ml-1 border-l border-white/10 flex-shrink-0",children:[Ys?e.jsxs("button",{type:"button",onClick:Xs,className:"mr-2 inline-flex h-11 items-center rounded-full border border-white/25 px-3 text-xs font-semibold text-white transition-colors hover:bg-white/10 sm:h-12","aria-label":`Change layout, currently ${cs[ce]}`,children:[e.jsx("span",{className:"sm:hidden",children:"Layout"}),e.jsx("span",{className:"hidden sm:inline",children:cs[ce]})]}):null,e.jsxs("button",{onClick:()=>Me.mutate(ne),disabled:Me.isPending,className:"inline-flex items-center gap-2 h-11 sm:h-12 px-4 sm:px-5 rounded-full bg-white text-slate-950 text-[13px] sm:text-sm font-semibold tracking-[-0.005em] active:scale-95 transition-all shadow-[0_2px_6px_rgba(0,0,0,0.18)] hover:bg-white/95 disabled:opacity-60","aria-label":na,children:[Me.isPending?e.jsx(Qe,{className:"w-4 h-4 animate-spin"}):e.jsx(aa,{className:"w-4 h-4"}),e.jsx("span",{children:"Share & send"})]})]})]})})]})]})}),e.jsx(qn,{open:xe,onOpenChange:C,title:"Try Different Materials",description:"See how other options would look in this space",children:z?e.jsx(ln,{onImageError:Na,materials:{favorites:z.favorites??[],mine:z.mine??[],
31catalog:z.catalog??[]},selectedMaterial:t.material_id||"",onSelect:Ca,disabled:he.isPending,inDrawer:!0,allowInternalScroll:!1,initialView:Hs,initialCategory:At,showSavedDesigns:!1,onManageLibrary:Pa},`${xe}-${Hs}-${At}`):e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(Qe,{className:"mx-auto h-5 w-5 animate-spin text-slate-400"}),e.jsx("p",{className:"mt-3 text-sm text-slate-500",children:"Loading materials…"})]})}),G!=null&&G.recommendedLayout?e.jsx(on,{open:Bt,onOpenChange:Ve,mode:"change",materialName:((kr=t==null?void 0:t.materials)==null?void 0:kr.name)||"Wood flooring",layouts:G.layouts,recommendedLayout:G.recommendedLayout,selectedLayout:Je,currentLayout:ce,pending:he.isPending,onSelect:Ze,onConfirm:()=>{Ve(!1),oe("viz_layout_change_started",{vizId:ne,from:ce,to:Je}),he.mutate({materialId:t==null?void 0:t.material_id,layout:Je,changeLayout:!0})},onReportIssue:()=>{Ve(!1),K(!0)}}):null,e.jsx(Vn,{open:Q,onOpenChange:K,visualizationId:ne}),e.jsx(vn,{open:I,onOpenChange:j,beforeImageUrl:J||"",afterImageUrl:V||"",materialName:ct,projectTitle:((Sr=(Ir=t==null?void 0:t.viz_photos)==null?void 0:Ir.viz_projects)==null?void 0:Sr.title)||(t==null?void 0:t.project_title)||"Floor Visualization",shareUrl:Se,vizId:ne,onCreateShareLink:()=>Me.mutate(ne),userTier:Z==null?void 0:Z.subscription_tier,onUpgrade:()=>{j(!1),setTimeout(()=>Kt("share"),300)},logoUrl:typeof(Z==null?void 0:Z.logo_url)=="string"?Z.logo_url:void 0,companyName:typeof(Z==null?void 0:Z.company_name)=="string"?Z.company_name:void 0,businessPhone:typeof(Z==null?void 0:Z.phone)=="string"?Z.phone:void 0,hasJobContext:!!((Rr=(Er=t==null?void 0:t.viz_photos)==null?void 0:Er.viz_projects)!=null&&Rr.client_id),onStartProposal:()=>{j(!1),setTimeout(()=>F(!0),300)},onSetupProposal:()=>{var l,u,p;const s=((u=(l=t==null?void 0:t.viz_photos)==null?void 0:l.viz_projects)==null?void 0:u.id)||((p=t==null?void 0:t.viz_photos)==null?void 0:p.project_id)||(t==null?void 0:t.project_id)||void 0;j(!1),o(is({vizId:ne,projectId:s,attachProjectId:s,source:"visualization-results-share"}))},onTryAnotherMaterial:()=>{j(!1),setTimeout(()=>C(!0),300)}}),e.jsx(yn,{open:R,onOpenChange:F,vizId:ne,clientId:((Pr=(Cr=t==null?void 0:t.viz_photos)==null?void 0:Cr.viz_projects)==null?void 0:Pr.client_id)||void 0,clientName:void 0,vizImagePath:Ra,proposalSetupPath:is({vizId:ne,projectId:((Ar=(Tr=t==null?void 0:t.viz_photos)==null?void 0:Tr.viz_projects)==null?void 0:Ar.id)||((Lr=t==null?void 0:t.viz_photos)==null?void 0:Lr.project_id)||(t==null?void 0:t.project_id)||void 0,attachProjectId:((Ur=(Mr=t==null?void 0:t.viz_photos)==null?void 0:Mr.viz_projects)==null?void 0:Ur.id)||((Or=t==null?void 0:t.viz_photos)==null?void 0:Or.project_id)||(t==null?void 0:t.project_id)||void 0,source:"visualization-results-share"})}),ue&&J&&V&&e.jsx(On,{beforeSrc:J,afterSrc:V,beforeLabel:"Original",afterLabel:ct,natural:Ye,onClose:()=>pe(!1),onBeforeError:Mt,onAfterError:Ut})]}),e.jsx(cn,{source:"results",trigger:pa,thumbnailUrl:V,isOpen:fa,onClose:()=>nt(!1),currentTier:_e.tier,used:_e.used,limit:_e.limit,remaining:_e.remaining,percentUsed:_e.limit>0?Math.round(_e.used/_e.limit*100):100,variant:_e.variant})]}):be?e.jsxs(e.Fragment,{children:[e.jsx(Ot,{title:"Visual"}),e.jsx(Dt,{materialName:It,status:St,estimatedDurationMs:lt,progressStage:Et,roomPhotoUrl:it,isRoomPhotoLoading:Pt,materialThumbUrl:Ae||(d==null?void 0:d.materialThumbUrl)||void 0,processingStartedAt:Rt,connectionState:Ct,isSlow:kt,isTimedOut:$e},"viz-recovery-empty")]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] gap-4 px-4 text-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Visualization unavailable"}),e.jsx("p",{className:"text-sm text-gray-600 max-w-md mt-1",children:"It looks like this visualization is still being prepared. Try again in a moment."})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[e.jsx(H,{onClick:()=>Ne(),className:"min-w-[120px]",children:"Refresh"}),e.jsx(H,{variant:"outline",onClick:bt,className:"min-w-[120px]",children:"Back to Home"})]})]})}export{Ll as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.