1import{r,j as e,aw as $e,ax as Me,X as ce,ay as pe,L as be,ai as Ce,ag as Le,az as oe,s as T,aA as me,y as xe,aB as Ve,aC as qe,aD as Oe,M as De,aE as Be,aF as Ge,aG as Ue,D as We,z as Ye}from"./index-BQdhh5bh.js";import{C as He}from"./chevron-up-vVSxxE5H.js";const Je="/assets/showroom-intro-bg-DdjNbJF0.jpg",Ke=({vehicleName:c,heroImageUrl:t,brandLogoUrl:g,subtitle:d,onDone:j})=>{const[l,k]=r.useState(0),[P,S]=r.useState(!1),p=r.useRef(null),_=r.useRef(null),w=r.useRef(!1),f=6200;r.useEffect(()=>{const E=new Image;E.src=t;const F=L=>{p.current==null&&(p.current=L);const Q=L-p.current,X=Math.min(1,Q/f);k(X),X<1&&!w.current?_.current=requestAnimationFrame(F):w.current||(w.current=!0,j())};return _.current=requestAnimationFrame(F),()=>{_.current&&cancelAnimationFrame(_.current)}},[t,j]);const i=()=>{w.current||(w.current=!0,S(!0),_.current&&cancelAnimationFrame(_.current),setTimeout(j,280))},y=E=>1-Math.pow(1-E,3),N=(E,F,L)=>Math.max(0,Math.min(1,(E*f-F)/(L-F))),H=1-N(l,200,900),$=N(l,400,1800),J=1+y(N(l,800,3200))*.18,A=N(l,1200,2600),B=y(N(l,1400,2400))*(1-N(l,3400,4200)),G=y(N(l,2800,4400)),M=1.18-y(N(l,2800,5200))*.18,K=(1-y(N(l,2800,3800)))*12,U=y(N(l,4e3,5200)),Z=P?0:1-y(N(l,5600,6200)),de=l*f>1500&&!w.current;return e.jsxs("div",{className:"fixed inset-0 z-[400] overflow-hidden bg-black pointer-events-auto",style:{opacity:Z,transition:P?"opacity 280ms ease-out":void 0},onClick:i,role:"presentation",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:`url(${Je})`,backgroundSize:"cover",backgroundPosition:"center",transform:`scale(${J})`,opacity:$,transition:"opacity 50ms linear"}}),e.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"radial-gradient(ellipse 38% 55% at 50% 42%, rgba(255,240,210,0.35), transparent 65%)",opacity:A*.9,mixBlendMode:"screen"}}),G>0&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",style:{opacity:G},children:e.jsx("img",{src:t,alt:"","aria-hidden":!0,draggable:!1,className:"max-w-[78%] max-h-[68%] object-contain select-none",style:{transform:`scale(${M})`,filter:`blur(${K}px) drop-shadow(0 40px 60px rgba(0,0,0,0.7))`,willChange:"transform, filter"}})}),g&&B>.02&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",style:{opacity:B},children:e.jsx("img",{src:g,alt:"","aria-hidden":!0,draggable:!1,className:"max-w-[140px] max-h-[80px] object-contain select-none",style:{filter:"drop-shadow(0 0 20px rgba(255,240,210,0.4))"}})}),U>0&&e.jsxs("div",{className:"absolute left-0 right-0 bottom-[10%] flex flex-col items-center text-center px-6 pointer-events-none",style:{opacity:U,transform:`translateY(${(1-U)*16}px)`},children:[e.jsx("div",{className:"text-[11px] tracking-[0.32em] uppercase text-white/60 mb-3",children:"Tour interattivo"}),e.jsx("div",{className:"text-white text-2xl sm:text-3xl md:text-4xl font-light tracking-tight",style:{fontFamily:"'Space Grotesk', sans-serif"},children:c}),d&&e.jsx("div",{className:"text-white/65 text-xs sm:text-sm mt-2 tracking-wide",children:d})]}),e.jsx("div",{className:"absolute inset-0 bg-black pointer-events-none",style:{opacity:H}}),e.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.08] mix-blend-overlay",style:{backgroundImage:`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.7'/></svg>")`}}),e.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.7) 100%)"}}),de&&e.jsx("button",{type:"button",onClick:E=>{E.stopPropagation(),i()},className:"absolute bottom-5 right-5 text-white/55 hover:text-white text-xs tracking-wider uppercase px-3 py-1.5 border border-white/15 rounded-full backdrop-blur-sm bg-black/30 transition-colors",children:"Salta intro"})]})},Ze=c=>{const d=Math.ceil(c.length/2),j=100/Math.max(d,1);return{rooms:c.map((l,k)=>({room_id:l.id,x:k%2*50+2,y:Math.floor(k/2)*j+2,w:46,h:j-4})),doors:[]}},Qe=({rooms:c,layout:t,backgroundUrl:g,activeRoomId:d,yaw:j,onRoomSelect:l})=>{const[k,P]=r.useState(!0),[S,p]=r.useState(!1);r.useEffect(()=>{if(!S)return;const i=y=>{y.key==="Escape"&&p(!1)};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[S]);const w=r.useMemo(()=>t&&t.rooms&&t.rooms.length>0?t:Ze(c),[t,c]).rooms.find(i=>i.room_id===d),f=w?{cx:w.x+w.w/2,cy:w.y+w.h/2}:null;return c.length===0?null:e.jsxs("div",{className:"select-none",children:[e.jsxs("div",{className:"bg-black/75 backdrop-blur border border-white/15 rounded-xl overflow-hidden shadow-2xl",children:[e.jsxs("button",{onClick:()=>P(i=>!i),className:"w-full flex items-center justify-between px-3 py-1.5 text-[11px] text-white/80 hover:bg-white/5 transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-medium tracking-wide uppercase",children:[e.jsx($e,{className:"w-3 h-3"})," Planimetria"]}
1),k?e.jsx(Me,{className:"w-3 h-3"}):e.jsx(He,{className:"w-3 h-3"})]}),k&&e.jsx("div",{className:"px-2 pb-2",children:e.jsxs("div",{className:`relative bg-white/[0.04] border border-white/10 rounded-lg overflow-hidden ${g?"cursor-zoom-in":""}`,style:{width:200,height:160},onClick:()=>g&&p(!0),role:g?"button":void 0,"aria-label":g?"Apri planimetria":void 0,children:[g&&e.jsx("img",{src:g,alt:"",className:"absolute inset-0 w-full h-full object-contain pointer-events-none"}),e.jsx("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",className:"absolute inset-0 w-full h-full pointer-events-none",children:f&&e.jsxs("g",{transform:`rotate(${j*180/Math.PI} ${f.cx} ${f.cy})`,children:[e.jsx("path",{d:`M ${f.cx} ${f.cy} L ${f.cx-4} ${f.cy-8} L ${f.cx+4} ${f.cy-8} Z`,fill:"hsl(var(--primary))",opacity:.75}),e.jsx("circle",{cx:f.cx,cy:f.cy,r:1.2,fill:"hsl(var(--primary))"})]})})]})})]}),S&&g&&e.jsxs("div",{className:"fixed inset-0 z-[250] bg-black/95 backdrop-blur-sm flex items-center justify-center p-4",onClick:()=>p(!1),children:[e.jsx("button",{onClick:i=>{i.stopPropagation(),p(!1)},"aria-label":"Chiudi",className:"absolute top-4 right-4 w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 text-white flex items-center justify-center",children:e.jsx(ce,{className:"w-5 h-5"})}),e.jsx("img",{src:g,alt:"Planimetria",className:"max-w-full max-h-full object-contain rounded-lg shadow-2xl",onClick:i=>i.stopPropagation()})]})]})},Xe=({open:c,onClose:t,rooms:g,layout:d,dollhouseImageUrl:j,activeRoomId:l,onRoomSelect:k,onGenerate:P,generating:S=!1})=>(r.useEffect(()=>{if(!c)return;const p=_=>{_.key==="Escape"&&t()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[c,t]),c?(d!=null&&d.rooms,e.jsxs("div",{className:"fixed inset-0 z-[200] bg-black/95 backdrop-blur-sm flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/10",children:[e.jsxs("div",{className:"flex items-center gap-2 text-white/90 text-sm",children:[e.jsx(pe,{className:"w-4 h-4"}),e.jsx("span",{className:"font-medium",children:"Vista d'insieme"}),e.jsx("span",{className:"text-white/40",children:"·"}),e.jsxs("span",{className:"text-white/60 text-xs",children:[g.length," stanze"]})]}),e.jsx("button",{onClick:t,"aria-label":"Chiudi",className:"w-9 h-9 rounded-full bg-white/10 hover:bg-white/20 text-white flex items-center justify-center",children:e.jsx(ce,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"flex-1 relative overflow-hidden flex items-center justify-center p-4",children:j?e.jsx("div",{className:"relative max-w-full max-h-full",style:{aspectRatio:"16/9"},children:e.jsx("img",{src:j,alt:"Vista isometrica dell'immobile",className:"w-full h-full object-contain rounded-lg shadow-2xl"})}):e.jsxs("div",{className:"text-center max-w-md",children:[e.jsx(pe,{className:"w-12 h-12 mx-auto mb-4 text-white/30"}),e.jsx("div",{className:"text-white/80 text-sm mb-2",children:"Vista d'insieme non ancora disponibile"}),e.jsx("div",{className:"text-white/50 text-xs mb-6",children:P?"Genera ora un render isometrico dell'immobile per dare al cliente una visione d'insieme.":"Il proprietario del tour non ha ancora generato la vista d'insieme."}),P&&e.jsx("button",{onClick:P,disabled:S,className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-white text-black text-sm font-medium hover:bg-white/90 disabled:opacity-50",children:S?e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"w-4 h-4 animate-spin"})," Generazione in corso..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{className:"w-4 h-4"})," Genera vista d'insieme"]})})]})}),e.jsx("div",{className:"border-t border-white/10 p-3 bg-black/50",children:e.jsx("div",{className:"max-w-5xl mx-auto flex gap-2 overflow-x-auto",children:g.map(p=>e.jsx("button",{onClick:()=>{k(p.id),t()},className:`shrink-0 text-xs px-3 py-1.5 rounded-full border transition-colors ${l===p.id?"bg-white text-black border-white":"bg-white/10 text-white/90 border-white/20 hover:bg-white/20"}`,children:p.name},p.id))})})]})):null),he=[{key:"real",label:"Originale"},{key:"modern",label:"Moderno"},{key:"luxury",label:"Luxury"},{key:"minimal",label:"Minimal"},{key:"classic",label:"Classic"},{key:"industrial",label:"Industrial"},{key:"scandi",label:"Scandinavian"},{key:"warm_italian",label:"Warm Italian"},{key:"contemporary",label:"Contemporary"},{key:"boho",label:"Boho"},{key:"japandi",label:"Japandi"},{key:"urban_jungle",label:"Urban Jungle"}],st=()=>{var _e,Ne,ke;const{slug:c}=Le(),[t,g]=r.useState(null),[d,j]=r.useState([]),[l,k]=r.useState(null),[P,S]=r.useState(!0),[p,_]=r.useState(null),[w,f]=r.useState(!1),[i,y]=r.useState("real"),[N,H]=r.useState(!1),[$,J]=r.useState({}),[A,B]=r.useState(null),[G,M]=r.useState(null),[K,U]=r.useState(null),[Z,de]=r.useState(null),[E,F]=r.useState(null),[L,Q]=r.useState(!1),[X,Pe]=r.useState(0),[fe,ee]=r.useState(!1),[W,ue]=r.useState(null),[Ee,ge]=r.useState(!1);r.useEffect(()=>{if(!t||!c||t.vertical!=="automotive")return;const s=`tour-intro-played:${c}`;typeof window>"u"||sessionStorage.getItem(s)||!(t.vertical==="automotive"&&t.orbit_reel_url)&&(!d.length||!d[0].panorama_url)||(ge(!0),sessionStorage.setItem(s,"1"))},[t,c,d]);const te=r.useCallback(async()=>
1{if(c){S(!0),_(null);try{const{data:s,error:a}=await oe(T.from("virtual_tours").select("*").eq("public_slug",c).eq("status","published").maybeSingle(),8e3,"virtual_tours.read");if(a||!s){_("Tour non trovato o non più disponibile.");return}g(s);try{const n=`tour-viewed:${c}`;typeof window<"u"&&!sessionStorage.getItem(n)&&(sessionStorage.setItem(n,"1"),T.rpc("increment_tour_view",{_slug:c}).then(({error:I})=>{I&&console.warn("[PublicVirtualTour] increment_tour_view",I)}))}catch{}const x=s.vertical==="automotive"&&!!s.orbit_reel_url;let o=T.from("virtual_tour_rooms").select("id, name, order_index, panorama_url, hotspots, is_static_view, depth_map_url, source_photo_urls, default_style, allowed_styles").eq("tour_id",s.id).order("order_index",{ascending:!0});x||(o=o.not("panorama_url","is",null));const{data:u}=await oe(o,8e3,"virtual_tour_rooms.list"),v=(u||[]).map(n=>({...n,hotspots:Array.isArray(n.hotspots)?n.hotspots:[],source_photo_urls:Array.isArray(n.source_photo_urls)?n.source_photo_urls:[],allowed_styles:Array.isArray(n.allowed_styles)?n.allowed_styles:[]}));j(v);const b=v.find(n=>!!n.panorama_url)||v[0];if(b){k(b.id);const n=b.default_style??s.default_style,I=b.allowed_styles||[];n&&I.includes(n)&&y(n)}S(!1);const C=s.id,q=s.staging_enabled&&v.length>0,re=v.map(n=>n.id),ie=q?oe(T.from("virtual_tour_room_variants").select("room_id, style, panorama_url").in("room_id",re).eq("status","ready"),8e3,"virtual_tour_room_variants.list"):Promise.resolve({data:null}),le=oe(T.from("virtual_tour_floorplans").select("layout, background_url, dollhouse_image_url").eq("tour_id",C).maybeSingle(),8e3,"virtual_tour_floorplans.read");ie.then(({data:n})=>{if(!n||!n.length)return;const I={};for(const O of n)O.panorama_url&&(I[`${O.room_id}:${O.style}`]=O.panorama_url);J(I)},n=>{n instanceof me?console.warn("[PublicVirtualTour] variants timeout"):console.error("[PublicVirtualTour] variants error",n)}),le.then(({data:n})=>{n&&(U(n.layout||null),de(n.background_url||null),F(n.dollhouse_image_url||null))},n=>{n instanceof me?console.warn("[PublicVirtualTour] floorplan timeout"):console.error("[PublicVirtualTour] floorplan error",n)})}catch(s){const a=s instanceof me;console.error("[PublicVirtualTour] load failed",s),_(a?"Connessione lenta. Riprova.":"Impossibile caricare il tour. Riprova."),S(!1)}}},[c]);r.useEffect(()=>{te()},[te]),r.useEffect(()=>{if(!t)return;const s=T.channel(`vt-rooms-${t.id}`).on("postgres_changes",{event:"UPDATE",schema:"public",table:"virtual_tour_rooms",filter:`tour_id=eq.${t.id}`},a=>{const m=a.new;j(x=>x.map(o=>o.id===m.id?{...o,depth_map_url:m.depth_map_url??o.depth_map_url}:o))}).subscribe();return()=>{T.removeChannel(s)}},[t]),r.useEffect(()=>{var re,ie,le;if(!t||!c)return;const s=`https://presentazioni.ai/tour/${c}`,a=t.vertical==="automotive",m=a?`Motion View 360 di ${t.title}.`:`Interior Tour Experience di ${t.title}${t.address?` - ${t.address}`:""}.`,x=((re=t.description)==null?void 0:re.slice(0,155))||m,o=((ie=d[0])==null?void 0:ie.panorama_url)||"https://presentazioni.ai/social-preview.jpg";document.title=`${t.title} | ${a?"Motion View 360":"Interior Tour Experience"}`;const u=(n,I,O,Se)=>{let D=document.querySelector(n);if(!D&&Se){D=document.createElement("meta");for(const[Fe,ze]of Object.entries(Se))D.setAttribute(Fe,ze);document.head.appendChild(D)}D&&D.setAttribute(I,O)};u('meta[name="description"]',"content",x,{name:"description"}),u('meta[property="og:title"]',"content",t.title,{property:"og:title"}),u('meta[property="og:description"]',"content",x,{property:"og:description"}),u('meta[property="og:url"]',"content",s,{property:"og:url"}),u('meta[property="og:image"]',"content",o,{property:"og:image"}),u('meta[name="twitter:title"]',"content",t.title,{name:"twitter:title"}),u('meta[name="twitter:description"]',"content",x,{name:"twitter:description"});
1let v=document.querySelector('link[rel="canonical"]');v||(v=document.createElement("link"),v.setAttribute("rel","canonical"),document.head.appendChild(v)),v.setAttribute("href",s);const b="tour-jsonld";(le=document.getElementById(b))==null||le.remove();const C={"@context":"https://schema.org","@type":a?"Vehicle":"RealEstateListing",name:t.title,url:s,description:x};!a&&t.address&&(C.address={"@type":"PostalAddress",streetAddress:t.address}),t.price_cents&&(C.offers={"@type":"Offer",price:t.price_cents/100,priceCurrency:"EUR"}),(t.agent_name||t.agent_phone||t.agent_email)&&(C.seller={"@type":a?"AutoDealer":"RealEstateAgent",...t.agent_name&&{name:t.agent_name},...t.agent_phone&&{telephone:t.agent_phone},...t.agent_email&&{email:t.agent_email}});const q=document.createElement("script");return q.id=b,q.type="application/ld+json",q.text=JSON.stringify(C),document.head.appendChild(q),()=>{var n;(n=document.getElementById(b))==null||n.remove()}},[t,c,d]);const se=async s=>{if(s===l)return;const a=d.find(o=>o.id===s);f(!0);const x=(i!=="real"?$[`${s}:${i}`]:null)||(a==null?void 0:a.panorama_url)||null;x&&await new Promise(o=>{const u=new Image;u.crossOrigin="anonymous",u.onload=()=>o(),u.onerror=()=>o(),u.src=x}),k(s),setTimeout(()=>f(!1),120)},V=r.useCallback(async(s,a,m=!1)=>{if(!(a==="real"||!c)&&!(!m&&$[`${s}:${a}`])){B(a),M(null);try{const{data:x,error:o}=await T.functions.invoke("generate-staged-panorama",{body:{tourSlug:c,roomId:s,style:a,force:m}});if(o){const v=o==null?void 0:o.context;let b=null;try{b=v&&typeof v.json=="function"?await v.json():null}catch{}if((b==null?void 0:b.code)==="insufficient_credits"){M(`Crediti insufficienti per generare questo stile (servono ${b.required||2} crediti).`),y("real");return}throw o}const u=x==null?void 0:x.panorama_url;if(u){await new Promise(b=>{const C=new Image;C.crossOrigin="anonymous",C.onload=()=>b(),C.onerror=()=>b(),C.src=m?`${u}${u.includes("?")?"&":"?"}t=${Date.now()}`:u});const v=m?`${u}${u.includes("?")?"&":"?"}t=${Date.now()}`:u;J(b=>({...b,[`${s}:${a}`]:v}))}else if(x!=null&&x.processing){setTimeout(()=>V(s,a,m),8e3);return}else throw new Error("Risposta non valida")}catch(x){console.error("staging error",x),M("Generazione non riuscita. Torno alla versione reale."),y("real")}finally{B(null)}}},[c,$]),Re=r.useCallback(()=>{!l||i==="real"||A||V(l,i,!0)},[l,i,A,V]),Ie=s=>{M(null),s!==i&&(y(s),!(s==="real"||!l)&&($[`${l}:${s}`]||V(l,s)))};r.useEffect(()=>{if(!l)return;const s=d.find(m=>m.id===l);if(!s)return;const a=s.allowed_styles||[];if(i!=="real"&&!a.includes(i)){const m=s.default_style??(t==null?void 0:t.default_style);y(m&&a.includes(m)?m:"real");return}i!=="real"&&!$[`${l}:${i}`]&&A!==i&&V(l,i)},[l,i,$,A,V,d,t]);const h=d.find(s=>s.id===l)||null,Y=(()=>{if(!h)return null;if(i==="real")return h.panorama_url;const s=$[`${h.id}:${i}`];return s||h.panorama_url})();if(P)return e.jsxs("div",{className:"min-h-screen bg-black flex flex-col items-center justify-center gap-4",children:[e.jsx(be,{className:"w-6 h-6 animate-spin text-white/70"}),e.jsxs("button",{onClick:()=>te(),className:"inline-flex items-center gap-1.5 text-[11px] uppercase tracking-[0.18em] text-white/55 hover:text-white/85 transition-colors",children:[e.jsx(xe,{className:"w-3 h-3"})," Sta impiegando troppo? Riprova"]})]});if(p||!t)return e.jsx("div",{className:"min-h-screen bg-black text-white flex items-center justify-center px-4 text-center",children:e.jsxs("div",{children:[e.jsx(pe,{className:"w-8 h-8 mx-auto mb-3 opacity-60"}),e.jsx("div",{className:"text-sm opacity-80 mb-4",children:p||"Tour non disponibile"}),e.jsxs("button",{onClick:()=>te(),className:"inline-flex items-center gap-2 px-4 py-2 rounded-full border border-white/20 text-xs uppercase tracking-[0.18em] text-white/85 hover:bg-white/5 transition-colors",children:[e.jsx(xe,{className:"w-3.5 h-3.5"})," Riprova"]})]})});const we=t.price_cents?new Intl.NumberFormat("it-IT",{style:"currency",currency:"EUR",maximumFractionDigits:0}).format(t.price_cents/100):null,ae=A!==null,Ae=((_e=he.find(s=>s.key===A))==null?void 0:_e.label)||"",z=t.vertical==="automotive"&&!!t.orbit_reel_url,ve=z&&t.orbit_reel_cover_url?t.orbit_reel_cover_url:((Ne=d[0])==null?void 0:Ne.panorama_url)||null,
1ne=Array.from(new Set(d.flatMap(s=>s.source_photo_urls||[]).filter(Boolean))),R=ne.length,Te=s=>ue(s),ye=()=>ue(null),je=s=>{ue(a=>a===null||R===0?a:(a+s+R)%R)};return e.jsxs("div",{className:"fixed inset-0 bg-black text-white",children:[Ee&&ve&&!z&&e.jsx(Ke,{vehicleName:t.title,heroImageUrl:ve,subtitle:t.address||t.agent_name||null,onDone:()=>ge(!1)}),z?e.jsx(Ve,{videoUrl:t.orbit_reel_url,title:t.title,photoCount:R,onOpenPhotos:()=>ee(!0)}):Y&&h&&e.jsx("div",{className:`absolute inset-0 transition-all duration-300 ${w?"opacity-0":"opacity-100"} ${ae?"blur-lg scale-105":""}`,children:h.is_static_view?h.depth_map_url?e.jsx(qe,{imageUrl:Y,depthMapUrl:h.depth_map_url,povIndex:d.findIndex(s=>s.id===h.id)}):e.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[e.jsx("img",{src:Y,"aria-hidden":!0,className:"absolute inset-0 w-full h-full object-cover scale-110 blur-2xl opacity-70 select-none",draggable:!1}),e.jsx("img",{src:Y,alt:h.name||"Vista",className:"relative w-full h-full object-contain select-none",draggable:!1})]}):e.jsx(Oe,{panoramaUrl:Y,hotspots:h.hotspots||[],onHotspotClick:s=>
1se(s.target_room_id),onYawChange:Pe,staticView:!1},`${h.id}-${i==="real"||!$[`${h.id}:${i}`]?"real":i}`)}),w&&e.jsx("div",{className:"absolute inset-0 z-10 pointer-events-none overflow-hidden bg-neutral-900",children:e.jsx("div",{className:"absolute inset-0 bg-[linear-gradient(110deg,transparent_30%,rgba(255,255,255,0.08)_50%,transparent_70%)] bg-[length:200%_100%] animate-shimmer"})}),ae&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 pointer-events-none z-20",children:e.jsxs("div",{className:"bg-black/70 border border-white/20 rounded-2xl px-6 py-5 flex items-center gap-4 max-w-sm pointer-events-auto",children:[e.jsx(be,{className:"w-5 h-5 animate-spin shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Sto arredando la stanza"}),e.jsxs("div",{className:"text-xs opacity-70 mt-0.5",children:["Stile ",Ae,". Bastano circa 30 secondi."]})]})]})}),e.jsx("div",{className:"absolute top-0 left-0 right-0 p-4 bg-gradient-to-b from-black/70 to-transparent pointer-events-none",children:e.jsxs("div",{className:"max-w-5xl mx-auto flex items-start justify-between gap-4 pointer-events-auto",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-base sm:text-lg font-semibold truncate",children:t.title}),t.address&&e.jsxs("div",{className:"text-xs sm:text-sm opacity-80 flex items-center gap-1 mt-0.5",children:[e.jsx(De,{className:"w-3 h-3"})," ",t.address]}),R>0&&!z&&e.jsxs("button",{onClick:()=>ee(s=>!s),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-white border border-black/10 text-black text-[11px] font-medium hover:bg-white/90 transition-colors shadow-xl mt-2",children:[e.jsx(Be,{className:"w-3.5 h-3.5"}),"Foto",e.jsx("span",{className:"ml-0.5 inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-black text-white text-[10px] font-semibold tabular-nums",children:R})]})]}),e.jsxs("div",{className:"text-right shrink-0 flex flex-col items-end gap-2",children:[we&&e.jsx("div",{className:"text-sm sm:text-base font-semibold",children:we}),t.sqm&&e.jsx("div",{className:"text-xs opacity-70",children:t.vertical==="automotive"?`${t.sqm.toLocaleString("it-IT")} km`:`${t.sqm} mq`})]})]})}),R>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`absolute inset-0 z-[100] bg-black/50 backdrop-blur-sm transition-opacity duration-200 ${fe?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}`,onClick:()=>ee(!1)}),e.jsxs("aside",{className:`absolute top-0 right-0 bottom-0 z-[110] w-full sm:w-[420px] bg-black/90 backdrop-blur-xl border-l border-white/10 shadow-2xl transition-transform duration-300 ease-out ${fe?"translate-x-0":"translate-x-full"}`,children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/10",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold",children:"Foto"}),e.jsxs("div",{className:"text-[11px] opacity-60",children:[R," foto disponibili"]})]}),e.jsx("button",{onClick:()=>ee(!1),className:"w-8 h-8 rounded-full flex items-center justify-center hover:bg-white/10 transition-colors","aria-label":"Chiudi",children:e.jsx(ce,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"overflow-y-auto h-[calc(100%-57px)] p-3",children:e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ne.map((s,a)=>e.jsx("button",{onClick:()=>Te(a),className:"relative aspect-square rounded-lg overflow-hidden bg-white/5 border border-white/10 hover:border-white/30 transition-colors group",children:e.jsx("img",{src:s,alt:`Foto ${a+1}`,loading:"lazy",className:"absolute inset-0 w-full h-full object-cover group-hover:scale-105 transition-transform duration-300",draggable:!1})},s+a))})})]})]}),W!==null&&ne[W]&&e.jsxs("div",{className:"fixed inset-0 z-[300] bg-black/95 flex items-center justify-center",onClick:ye,children:[e.jsx("button",{onClick:s=>{s.stopPropagation(),ye()},className:"absolute top-4 right-4 w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors","aria-label":"Chiudi",children:e.jsx(ce,{className:"w-5 h-5"})}),R>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s=>{s.stopPropagation(),je(-1)},className:"absolute left-4 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors","aria-label":"Precedente",children:e.jsx(Ge,{className:"w-5 h-5"})}),e.jsx("button",{onClick:s=>{s.stopPropagation(),je(1)},className:"absolute right-4 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors","aria-label":"Successiva",children:e.jsx(Ue,{className:"w-5 h-5"})})]}),e.jsx("img",{src:ne[W],alt:`Foto ${W+1}`,className:"max-w-[92vw] max-h-[88vh] object-contain select-none",draggable:!1,onClick:s=>s.stopPropagation()}),e.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-[11px] opacity-70 tabular-nums",children:[W+1," / ",R]})]}),d.length>1&&!z&&(Z||E)&&e.jsxs("div",{className:`absolute top-20 right-4 z-30 flex flex-col items-end gap-2 transition-opacity duration-200 ${w?"opacity-0 pointer-events-none":"opacity-100"}`,children:[e.jsx(Qe,{rooms:d.map(({id:s,name:a,order_index:m})=>({id:s,name:a,order_index:m})),layout:K,backgroundUrl:Z,activeRoomId:l,yaw:X,onRoomSelect:se}),e.jsxs("button",{onClick:()=>Q(!0),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-black/75 backdrop-blur border border-white/15 text-white text-[11px] font-medium hover:bg-black/85 transition-colors shadow-xl",children:[e.jsx($e,{className:"w-3.5 h-3.5"}),"Vista d'insieme"]})]}),e.jsx(Xe,{open:L,onClose:()=>Q(!1),rooms:d.map(({id:s,name:a,order_index:m})=>({id:s,name:a,order_index:m})),layout:K,dollhouseImageUrl:E,activeRoomId:l,onRoomSelect:se}),e.jsx("div",{className:`absolute bottom-0 left-0 right-0 px-4 pt-4 ${z?"pb-16 sm:pb-4":"pb-4"} bg-gradient-to-t from-black/85 to-transparent transition-opacity duration-200 ${w?"opacity-0 pointer-events-none":"opacity-100"}
1`,children:e.jsxs("div",{className:"max-w-5xl mx-auto space-y-3",children:[(()=>{var x;const s=(h==null?void 0:h.allowed_styles)||[],a=he.filter(o=>o.key==="real"||s.includes(o.key));return t.staging_enabled&&a.length>1?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"relative group",children:[e.jsx("span",{className:"absolute -inset-[1.5px] rounded-[17.5px] overflow-hidden opacity-40 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none",children:e.jsx("span",{className:"absolute inset-[-200%] animate-[spin_4s_linear_infinite] bg-[conic-gradient(from_0deg,transparent_0%,transparent_75%,rgba(255,255,255,0.7)_100%)]"})}),e.jsx("span",{className:"absolute -inset-1 bg-white/10 rounded-2xl blur-xl opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none"}),e.jsxs("button",{onClick:()=>H(o=>!o),className:"relative flex items-center gap-1.5 px-3 py-1.5 rounded-2xl bg-white text-black border border-zinc-200 shadow-[0_10px_40px_-10px_rgba(255,255,255,0.2)] transition-all duration-300 active:scale-95",children:[e.jsx(Ce,{className:"w-3.5 h-3.5 text-zinc-500 group-hover:text-zinc-900 group-hover:rotate-12 transition-all duration-500"}),e.jsx("span",{className:"text-xs font-semibold tracking-tight",children:"Cambia arredamento"}),i!=="real"&&e.jsxs("span",{className:"text-xs text-zinc-500",children:["· ",(x=he.find(o=>o.key===i))==null?void 0:x.label]})]}),N&&e.jsx("div",{className:"absolute bottom-full left-0 mb-2 min-w-[220px] rounded-xl border border-white/15 bg-black/85 backdrop-blur p-1.5 shadow-xl z-10",children:a.map(o=>{const u=i===o.key;return e.jsx("button",{onClick:()=>{Ie(o.key),H(!1)},disabled:ae&&!u,className:`w-full flex items-center justify-between text-left text-xs px-3 py-2 rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${u?"bg-white text-black":"text-white/90 hover:bg-white/10"}`,children:e.jsx("span",{children:o.label})},o.key)})})]}),i!=="real"&&h&&$[`${h.id}:${i}`]&&!ae&&e.jsxs("button",{onClick:Re,className:"flex items-center gap-1.5 text-xs px-3 py-1.5 rounded-full border bg-white/10 text-white/90 border-white/20 hover:bg-white/20 transition-colors",title:"Genera una nuova variante con lo stesso stile",children:[e.jsx(xe,{className:"w-3.5 h-3.5"}),"Rigenera"]})]}):null})(),G&&e.jsx("div",{className:"text-[11px] text-amber-300/90 bg-amber-500/10 border border-amber-500/30 rounded-lg px-3 py-1.5 inline-block",children:G}),t.staging_enabled&&(((ke=h==null?void 0:h.allowed_styles)==null?void 0:ke.length)||0)>0&&e.jsx("div",{className:"h-px bg-gradient-to-r from-transparent via-white/20 to-transparent"}),e.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:items-end justify-between gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex gap-2 overflow-x-auto pb-1 flex-1",children:!z&&d.map(s=>e.jsx("button",{onClick:()=>se(s.id),className:`shrink-0 text-xs px-3 py-1.5 rounded-full border transition-colors ${l===s.id?"bg-white text-black border-white":"bg-white/10 text-white/90 border-white/20 hover:bg-white/20"}`,children:s.name},s.id))}),(t.agent_phone||t.agent_email)&&e.jsxs("div",{className:"flex flex-col items-start sm:items-end text-xs opacity-90 shrink-0",children:[t.agent_name&&e.jsx("div",{className:"font-medium",children:t.agent_name}),e.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:gap-3 mt-0.5",children:[t.agent_phone&&e.jsxs("a",{href:`tel:${t.agent_phone}`,className:"flex items-center gap-1 hover:text-white",children:[e.jsx(We,{className:"w-3 h-3"})," ",t.agent_phone]}),t.agent_email&&e.jsxs("a",{href:`mailto:${t.agent_email}`,className:"flex items-center gap-1 hover:text-white",children:[e.jsx(Ye,{className:"w-3 h-3"})," ",t.agent_email]})]})]})]})]})})]})};export{st 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.