PageSourceSearch

https://www.phototo3d.org/_next/static/chunks/app/%5Blocale%5D/(de…/page-d2b8c83697c4581b.js

js phototo3d.org collected 2026-10-01 06:53:30 UTC 56,013 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[229],{1242:(e,t,r)=>{"use strict";r.d(t,{default:()=>l});var a=r(76601),s=r(18813);function l(e){let{locale:t,...r}=e;if(!t)throw Error(void 0);return(0,s.jsx)(a.Dk,{locale:t,...r})}},4656:(e,t,r)=>{"use strict";r.d(t,{A:()=>g});var a=r(18813),s=r(77641),l=r(30280),n=r(37303),i=r(85922),o=r(12403),d=r(94112),c=r(45706),u=r(62028),m=r(36593),x=r(93054),p=r(83763);function g(e){let{generationId:t,isGenerating:r,directModelData:g,onGenerationEnd:h}=e,f=(0,x.c3)("result"),{setShowPricingModal:b}=(0,p.U)(),[v,w]=(0,s.useState)(null),[j,y]=(0,s.useState)(null),N=(0,s.useRef)(t),_=(0,s.useRef)(null),[k,S]=(0,s.useState)("glb"),[R,E]=(0,s.useState)(3),A=(0,s.useRef)(!1);(0,s.useEffect)(()=>{N.current=t},[t]),(0,s.useEffect)(()=>{g&&(w(g),y(null))},[g]),(0,s.useEffect)(()=>{if(!t||g)return;let e=!0,r=!1,a=null;if(t.startsWith("demo-")){console.log("\uD83C\uDFAD [Demo Mode] Detected demo generation:",t);let r=setInterval(()=>{let a=localStorage.getItem("demo-generation");if(a){let s=JSON.parse(a);e&&N.current===t&&s.generationId===t&&s.isDemo&&(console.log("\uD83C\uDFAD [Demo Mode] Found demo data, displaying preset GLB:",s.meshUrl),w({status:"completed",mesh_url:s.meshUrl,texture_url:null,isDemo:!0}),localStorage.removeItem("demo-generation"),clearInterval(r))}},1e3);return()=>{e=!1,clearInterval(r)}}if(v&&("completed"===v.status||j))return;let s=0,l=async()=>{if(r)return;if(++s>300){console.log("⏰ [ModelResultSection] Polling timed out after 10 minutes"),y("3D model generation timed out. Please try again.");return}r=!0;let l=new AbortController;a=l;try{console.log("\uD83D\uDD04 [ModelResultSection] Polling status:",{generationId:t});let r=await fetch("/api/3d-task-status?generation_id=".concat(t),{signal:l.signal}),a=await r.json();if(!e||N.current!==t)return;a.success&&a.data&&(console.log("\uD83D\uDCCA [ModelResultSection] Status response:",{status:a.data.status,hasMeshUrl:!!a.data.mesh_url}),"completed"===a.data.status&&a.data.mesh_url?(w(a.data),y(null)):"failed"===a.data.status&&y(a.data.error_message||"Generation failed"))}catch(e){if("AbortError"===e.name)return;console.error("❌ [ModelResultSection] Failed to fetch status:",e)}finally{a===l&&(a=null),r=!1}};l();let n=setInterval(l,2e3);return()=>{e=!1,null==a||a.abort(),clearInterval(n)}},[t,g,v,j]),(0,s.useEffect)(()=>{if(A.current)return;let e=!!((null==v?void 0:v.status)==="completed"&&(null==v?void 0:v.mesh_url)),t=!!j;(e||t)&&(A.current=!0,h&&h())},[v,j,h]),(0,s.useEffect)(()=>{A.current=!1,g||w(null),y(null)},[t,g]),(0,s.useEffect)(()=>{r&&(w(null),y(null),A.current=!1)},[r]),(0,s.useEffect)(()=>{if((null==v?void 0:v.mesh_url)&&_.current){let e=_.current,t=()=>{console.log("✅ Model loaded successfully")},r=e=>{console.error("❌ Model load error:",e),y("Failed to load 3D model")};return e.addEventListener("load",t),e.addEventListener("error",r),()=>{e.removeEventListener("load",t),e.removeEventListener("error",r)}}},[v]);let D=(null==v?void 0:v.provider)==="wavespeed"||(null==v?void 0:v.credits_used)===20;return t||v?(0,a.jsx)("section",{id:"result-section",className:"py-12 md:py-16 bg-gradient-to-b from-gray-900 to-black",children:(0,a.jsx)("div",{className:"container mx-auto px-4 md:px-6",children:(0,a.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsxs)("h2",{className:"text-2xl sm:text-3xl md:text-4xl font-bold text-white mb-2 flex flex-wrap items-center gap-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 shrink-0 bg-gradient-to-br from-amber-500 to-yellow-500 rounded-lg flex items-center justify-center",children:(0,a.jsx)("svg",{className:"w-6 h-6 text-black",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"})})}),f("title")]}),(0,a.jsx)("p",{className:"text-gray-400",children:f("subtitle")})]}),t&&!(null==v?void 0:v.mesh_url)&&!j&&(0,a.jsxs)("div",{className:"mb-8 bg-gray-800/50 backdrop-blur-sm rounded-2xl p-4 sm:p-6 border border-gray-700",children:[(0,a.jsxs)("div",{className:"mb-6 rounded-xl border border-emerald-500/40 bg-emerald-500/10 p-4 text-center",children:[(0,a.jsx)("p",{className:"text-base md:text-lg font-semibold text-white",children:f("progress_notice_title")}),(0,a.jsx)("div",{className:"mt-2 text-xs md:text-sm text-gray-300",children:f.rich("progress_notice_hint",{assets:e=>(0,a.jsx)("a",{href:"/my-images",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-4 hover:text-white",children:e})})})]}),(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 roun
1ded-xl border border-gray-700/60 bg-gray-900/40 px-6 py-10 text-center",children:[(0,a.jsx)("div",{className:"h-12 w-12 rounded-full border-4 border-amber-500/30 border-t-amber-400 animate-spin"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-white",children:f("generating")}),(0,a.jsx)("p",{className:"text-sm text-gray-400",children:f("step_processing")}),(0,a.jsx)("p",{className:"text-xs text-gray-500",children:f("estimated_time")})]})]})]}),j&&(0,a.jsx)("div",{className:"mb-8 bg-red-500/10 border border-red-500/50 rounded-2xl p-6",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 text-red-400",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-red-500/20 rounded-full flex items-center justify-center",children:(0,a.jsx)("span",{className:"text-xl",children:"!"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"font-semibold",children:f("error_title")}),(0,a.jsx)("p",{className:"text-sm",children:j})]})]})}),(null==v?void 0:v.mesh_url)&&(0,a.jsxs)("div",{className:"grid lg:grid-cols-3 gap-4 sm:gap-6",children:[(0,a.jsx)("div",{className:"lg:col-span-2 space-y-4",children:(0,a.jsx)("div",{className:"relative p-[2px] rounded-2xl bg-gradient-to-br from-amber-500/50 via-yellow-500/30 to-amber-500/50",children:(0,a.jsxs)("div",{className:"bg-gray-900 rounded-2xl overflow-hidden",children:[(0,a.jsxs)("div",{className:"p-4 border-b border-gray-700/50 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between bg-gray-800/30",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-white",children:f("preview_title")}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsx)(l.$,{variant:"ghost",size:"sm",onClick:()=>{_.current&&(_.current.cameraOrbit="0deg 75deg 105%",_.current.fieldOfView="45deg")},className:"text-gray-400 hover:text-white",children:(0,a.jsx)(n.A,{className:"w-4 h-4"})})})]}),(0,a.jsxs)("div",{className:"relative h-[320px] sm:h-[420px] md:h-[500px] bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900",children:[(0,a.jsx)("model-viewer",{ref:e=>{_.current=e},src:v.mesh_url,"camera-controls":!0,"auto-rotate":!0,exposure:"1.0","shadow-intensity":"1",ar:!0,"ar-modes":"webxr scene-viewer quick-look",crossorigin:"anonymous",style:{width:"100%",height:"100%",background:"transparent"},children:(0,a.jsx)("div",{slot:"progress-bar",className:"w-full h-1 bg-amber-500 animate-pulse"})}),(0,a.jsxs)("div",{className:"absolute bottom-3 left-1/2 z-10 -translate-x-1/2 bg-black/70 backdrop-blur-md rounded-full px-2 py-2 sm:px-3 flex items-center gap-1 border border-gray-700 max-w-[calc(100%-1.5rem)]",children:[(0,a.jsx)("button",{onClick:()=>{let e=_.current;if(e){let t=e.getCameraOrbit(),r=Math.max(.9*t.radius,.5);e.cameraOrbit="".concat(t.theta,"rad ").concat(t.phi,"rad ").concat(r,"m")}},className:"w-8 h-8 flex items-center justify-center text-white hover:text-amber-500 transition-colors hover:bg-white/10 rounded-full",children:(0,a.jsx)(i.A,{className:"w-4 h-4"})}),(0,a.jsx)("button",{onClick:()=>{let e=_.current;if(e){let t=e.getCameraOrbit(),r=Math.min(1.1*t.radius,10);e.cameraOrbit="".concat(t.theta,"rad ").concat(t.phi,"rad ").concat(r,"m")}},className:"w-8 h-8 flex items-center justify-center text-white hover:text-amber-500 transition-colors hover:bg-white/10 rounded-full",children:(0,a.jsx)(o.A,{className:"w-4 h-4"})}),(0,a.jsx)("button",{onClick:()=>{let e=_.current;e&&(e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen&&e.msRequestFullscreen())},className:"w-8 h-8 flex items-center justify-center text-white hover:text-amber-500 transition-colors hover:bg-white/10 rounded-full",title:"Fullscreen",children:(0,a.jsx)(d.A,{className:"w-4 h-4"})})]}),(0,a.jsx)("div",{className:"absolute top-3 left-3 right-3 sm:right-auto bg-black/70 backdrop-blur-md rounded-lg px-3 py-2 text-xs text-gray-300 border border-gray-700/50",children:f("interaction_hint")}),(0,a.jsxs)("div",{className:"absolute bottom-16 right-3 sm:bottom-4 sm:right-4 bg-black/70 backdrop-blur-md rounded-lg px-3 py-2 text-xs text-gray-300 border border-gray-700/50",children:["Contrast: ",R.toFixed(1)]})]})]})})}),(0,a.jsxs)("div",{className:"space-y-4",children:[D&&(0,a.jsxs)("div",{className:"rounded-2xl border border-amber-500/50 bg-amber-500/10 p-4 sm:p-6",children:[(0,a.jsxs)("div",{className:"mb-3 flex items-start gap-3",children:[(0,a.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-amber-500 text-black",children:(0,a.jsx)(c.A,{className:"h-5 w-5"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-white",children:f("rapid_preview_title")}),(0,a.jsx)("p",{className:"mt-1 text-sm leading-relaxed text-gray-300",children:f("rapid_preview_desc")})]})]}),(0,a.jsxs)(l.$,{onClick:()=>b(!0),className:"w-full bg-gradient-to-r from-amber-500 to-yellow-500 text-black hover:from-amber-600 hover:to-yellow-600 font-semibold",children:[(0,a.jsx)(u.A,{className:"h-4 w-4"}),f("upgrade_standard_button")]})]}),(0,a.jsxs)("div",{className:"bg-gray-800/50 backdrop-blur-sm rounded-2xl p-4 sm:p-6 border border-gray-700",children:[(0,a.jsxs)("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[(0,a.jsx)(m.A,{className:"w-5 h-5 text-amber-500"}),f("download_title")]}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("label",{className:"text-sm text-gray-400 mb-2 block",children:f("format_label")}),(0,a.jsx)("select",{value:k,onChange:e=>S(e.target.value),className:"w-full bg-gray-700 border border-gray-600 rounded-lg px-4 py-2.5 text-white focus:outline-none focus:ring-2 focus:ring-amber-500",children:(0,a.jsx)("option",{value:"glb",children:"GLB (Recommended) - Binary GLTF"})}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Note: Currently only GLB format is available. Other formats will be supported soon."})]}),(0,a.jsxs)(l.$,{onClick:()=>
1{if(null==v?void 0:v.mesh_url){let e=document.createElement("a");e.href=v.mesh_url,e.download="3d-model.glb",document.body.appendChild(e),e.click(),document.body.removeChild(e)}},className:"w-full bg-gradient-to-r from-green-600 to-emerald-600 hover:from-green-700 hover:to-emerald-700 text-white font-semibold py-3 rounded-xl flex items-center justify-center gap-2 transition-all",children:[(0,a.jsx)(m.A,{className:"w-5 h-5"}),f("download_button")]}),(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-gray-700 space-y-2 text-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between text-gray-400",children:[(0,a.jsx)("span",{children:f("file_size")}),(0,a.jsx)("span",{className:"text-white",children:"~6.25 MB"})]}),(0,a.jsxs)("div",{className:"flex justify-between text-gray-400",children:[(0,a.jsx)("span",{children:f("format")}),(0,a.jsx)("span",{className:"text-white uppercase",children:k})]})]})]}),(0,a.jsx)("div",{className:"bg-blue-500/10 border border-blue-500/50 rounded-xl p-4",children:(0,a.jsxs)("p",{className:"text-sm text-blue-300",children:["\uD83D\uDCA1 ",f("tip_message")]})})]})]})]})})}):null}},10090:(e,t,r)=>{"use strict";r.d(t,{default:()=>i});var a=r(18813),s=r(77641),l=r(4656),n=r(18854);function i(){let[e,t]=(0,s.useState)(null),[r,i]=(0,s.useState)(!1),[o,d]=(0,s.useState)(0),[c,u]=(0,s.useState)(null),m=()=>{setTimeout(()=>{var e;null===(e=document.getElementById("result-section"))||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"})},50)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.A,{generationFlow:"hf-then-wavespeed",onGenerationRequestStart:()=>{u(null)},onGenerationStart:e=>{t(e),i(!0),m()},onDirectGenerationComplete:(e,r)=>{t(e),u({status:"completed",mesh_url:r.modelUrl,texture_url:null,provider:"free-ai",model:r.modelLabel,credits_used:0}),i(!1),m()},generationFinishedCounter:o}),(0,a.jsx)(l.A,{generationId:e,isGenerating:r,directModelData:c,onGenerationEnd:()=>{i(!1),d(e=>e+1)}},e||"empty")]})}},12800:(e,t,r)=>{"use strict";r.d(t,{PW:()=>l,np:()=>n,pr:()=>s});var a=r(59971);let s=e=>{let t=localStorage.getItem(e);if(!t)return null;let r=t.split(":");if(!r||r.length<2)return null;let s=Number(r[0]),l=(0,a.lg)();if(-1!==s&&s<l)return n(e),null;let i=r[0]+":";return t.replace(i,"")},l=(e,t,r)=>{localStorage.setItem(e,r+":"+t)},n=e=>{localStorage.removeItem(e)}},14333:(e,t,r)=>{"use strict";var a=r(93673);r.o(a,"permanentRedirect")&&r.d(t,{permanentRedirect:function(){return a.permanentRedirect}}),r.o(a,"redirect")&&r.d(t,{redirect:function(){return a.redirect}}),r.o(a,"useParams")&&r.d(t,{useParams:function(){return a.useParams}}),r.o(a,"usePathname")&&r.d(t,{usePathname:function(){return a.usePathname}}),r.o(a,"useRouter")&&r.d(t,{useRouter:function(){return a.useRouter}})},18854:(e,t,r)=>{"use strict";r.d(t,{A:()=>T});var a=r(18813),s=r(30280),l=r(48570),n=r(69343),i=r(18004),o=r(24311),d=r(62028),c=r(45706),u=r(59864),m=r(26569),x=r(77641),p=r(55428),g=r(1357),h=r(93054),f=r(28032),b=r(7989),v=r(83763),w=r(93827);let j={triposg:{id:"triposg",label:"TripoSG",spaceId:"VAST-AI/TripoSG"},"trellis-2":{id:"trellis-2",label:"TRELLIS.2",spaceId:"microsoft/TRELLIS.2"}},y=["triposg","trellis-2"];function N(e,t){if(t.startsWith("http"))return t;let r=t.startsWith("/")?t:"/gradio_api/file=".concat(t);return"".concat("https://".concat(e.toLowerCase().replace("/","-").replace(/[^a-z0-9-]/g,"-"),".hf.space")).concat(r)}function _(e,t){if(!e)return null;if("string"==typeof e)return e.startsWith("http")?e:N(t,e);if(Array.isArray(e)){for(let r of e){let e=_(r,t);if(e)return e}return null}return"object"==typeof e?e.url?e.url:e.path?N(t,e.path):_(e.model,t)||_(e.file,t)||_(e.value,t)||_(e.data,t):null}function k(e){return e instanceof Error?e.message:"object"==typeof e&&null!==e?[e.title,e.message,e.error].filter(e=>!!e).join(" - "):String(e)}function S(e){return Array.isArray(e)?e[0]:e}async function R(e,t,r,a){let s=e.submit(t,r),l=null;for await(let e of s){if("status"===e.type){let r="number"==typeof e.position?" #".concat(e.position+1):"",s="number"==typeof e.eta&&Number.isFinite(e.eta)?" ~".concat(Math.max(1,Math.round(e.eta)),"s"):"";
1if(a([e.message,e.stage,r,s].filter(Boolean).join(" ")),"error"===e.stage)throw Error([e.title,e.message].filter(Boolean).join(" - ")||"".concat(t," failed"))}"data"===e.type&&(l=e.data)}return l}async function E(e,t,r,a){try{return await R(e,t,r,a)}catch(e){return null}}async function A(e,t,r){let a=await w.Kj.connect(t.spaceId,{events:["data","status"]});try{await E(a,"/start_session",{},r),r("Segmenting image");let s=await R(a,"/run_segmentation",{image:e},r);r("Generating 3D mesh");let l=await R(a,"/image_to_3d",{image:S(s),seed:0,num_inference_steps:30,guidance_scale:7,simplify:!0,target_face_num:1e5},r),n=_(l,t.spaceId);if(!n)throw Error("No GLB model returned");return n}finally{await E(a,"/end_session",{},()=>void 0),a.close()}}async function D(e,t,r){let a=await w.Kj.connect(t.spaceId,{events:["data","status"]});try{var s;await E(a,"/start_session",{},r),r("Preprocessing image");let l=await R(a,"/preprocess_image",{input:e},r);r("Generating 3D asset"),await R(a,"/image_to_3d",{image:null!==(s=S(l))&&void 0!==s?s:e,seed:0,resolution:"1024",ss_guidance_strength:7.5,ss_guidance_rescale:.7,ss_sampling_steps:12,ss_rescale_t:5,shape_slat_guidance_strength:7.5,shape_slat_guidance_rescale:.5,shape_slat_sampling_steps:12,shape_slat_rescale_t:3,tex_slat_guidance_strength:1,tex_slat_guidance_rescale:0,tex_slat_sampling_steps:12,tex_slat_rescale_t:3},r),r("Extracting GLB");let n=await R(a,"/extract_glb",{decimation_target:3e5,texture_size:2048},r),i=_(n,t.spaceId);if(!i)throw Error("No GLB model returned");return i}finally{await E(a,"/end_session",{},()=>void 0),a.close()}}async function C(e,t){let r=null;for(let a of y){let s=j[a];try{return t("Connecting to ".concat(s.label)),{modelUrl:"triposg"===a?await A(e,s,t):await D(e,s,t),modelLabel:s.label}}catch(a){r=a;let e=k(a);if(/NSFW|unsafe|flagged|moderation|safety|policy|violate/i.test(e))throw a;t("".concat(s.label," unavailable, trying the next model"))}}throw r||Error("All 3D generation spaces are unavailable")}function I(e){return new Blob([e]).size}async function L(e,t){var r;let a=await new Promise((t,r)=>{let a=new FileReader;a.onload=e=>{var r;return t(null===(r=e.target)||void 0===r?void 0:r.result)},a.onerror=()=>r(a.error||Error("file_read_failed")),a.readAsDataURL(e)});if(921600>=I(a))return a;let s=await (r=a||t,new Promise((e,t)=>{let a=new window.Image;a.onload=()=>e(a),a.onerror=()=>t(Error("image_load_failed")),a.src=r})),l=s.naturalWidth||s.width,n=s.naturalHeight||s.height,i=Math.min(1,1536/Math.max(l,n));l=Math.max(1,Math.round(l*i)),n=Math.max(1,Math.round(n*i));let o=document.createElement("canvas"),d=o.getContext("2d");if(!d)throw Error("canvas_unavailable");let c=[.82,.72,.62,.52,.44,.36];for(let e=1;e>=.45;e-=.15)for(let t of(o.width=Math.max(1,Math.round(l*e)),o.height=Math.max(1,Math.round(n*e)),d.clearRect(0,0,o.width,o.height),d.drawImage(s,0,0,o.width,o.height),c)){let e=o.toDataURL("image/jpeg",t);if(921600>=I(e))return e}throw Error("rapid_image_too_large_after_compression")}function T(){let{onGenerationStart:e,onGenerationRequestStart:t,onDirectGenerationComplete:r,generationFinishedCounter:s,sectionTitle:d,sectionDescription:c,generationFlow:u="default"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},m=(0,h.c3)(),{ref:w,isVisible:j}=(0,p.r)(),{data:y}=(0,b.wV)(),{setShowSignModal:N,setShowPricingModal:_}=(0,v.U)(),[S,R]=(0,x.useState)([]),[E,A]=(0,x.useState)([]),[D,I]=(0,x.useState)("rapid"),[T,P]=(0,x.useState)(!1),[O,M]=(0,x.useState)("image"),[q,U]=(0,x.useState)("");(0,x.useRef)(null);let[G,z]=(0,x.useState)(!1),[B,W]=(0,x.useState)(null);(0,x.useEffect)(()=>{(null==y?void 0:y.user)?fetch("/api/get-user-credits",{method:"POST"}).then(e=>e.json()).then(e=>{var t;(null===(t=e.data)||void 0===t?void 0:t.is_recharged)?P(!0):P(!1)}).catch(e=>console.error("Failed to fetch user credits:",e)):P(!1)},[y]),(0,x.useEffect)(()=>{void 0!==s&&z(!1)},[s]);let $="rapid"===D?20:100,V=e=>{if("standard"===e&&!T){(null==y?void 0:y.user)?_(!0):N(!0);return}I(e)},J=e=>{let t=S.filter((t,r)=>r!==e),r=E.filter((t,r)=>r!==e);R(t),A(r);let a=document.getElementById("image-upload");a&&(a.value="")},X=async e=>{try{if(!y||!y.user){g.oR.error(m("upload.login_required")),N(!0);return}let t=await fetch(e),r=await t.blob(),a=e.split("/").pop()||"sample.png",s=new File([r],a,{type:r.type});R([s]);let l=new FileReader;l.onload=e=>{var t;let r=null===(t=e.target)||void 0===t?void 0:t.result;A([r])}
1,l.readAsDataURL(s),g.oR.success(m("upload.upload_success")),setTimeout(()=>{K(e)},500)}catch(e){console.error("Failed to load sample image:",e),g.oR.error("Failed to load sample image")}},K=async t=>{let r=t.includes("3.png")?"/imgs/upload/1.glb":"/imgs/upload/2.glb",a="demo-".concat(Date.now());z(!0),W(a),g.oR.success("Demo: Starting 3D generation simulation..."),e&&e(a),setTimeout(()=>{console.log("Demo generation completed, showing preset GLB:",r),localStorage.setItem("demo-generation",JSON.stringify({generationId:a,meshUrl:r,isDemo:!0})),z(!1),g.oR.success("Demo: 3D model ready!")},6e4)},Q=async()=>{if("image"===O){if(0===E.length){g.oR.error(m("upload.upload_image_first"));return}if(E.length>1){g.oR.error(m("upload.single_image_only"));return}}if("text"===O&&!q.trim()){g.oR.error(m("upload.enter_prompt_error"));return}let a=q.trim();if("text"===O&&"rapid"===D&&a.length>200){g.oR.error(m("upload.prompt_length_error",{max:200}));return}z(!0),null==t||t();try{let t;if("hf-then-wavespeed"===u&&"image"===O&&S[0])try{g.oR.info(m("upload.free_3d_trying"));let t=await C(S[0],e=>
1{e&&console.log("[Free AI 3D] Status:",e)}),a="hf-".concat(Date.now());W(a),null==e||e(a),null==r||r(a,t),g.oR.success(m("upload.generation_started")),z(!1);return}catch(t){let e=k(t);if(/NSFW|unsafe|flagged|moderation|safety|policy|violate/i.test(e)){g.oR.error(e||m("upload.generation_failed_3d")),z(!1);return}console.warn("[Free AI 3D] Free provider failed, falling back:",t),g.oR.message(m("upload.free_3d_fallback_login"))}if(!y||!y.user){g.oR.error(m("upload.login_required")),N(!0),z(!1);return}"image"===O&&(t=E[0],"rapid"===D&&S[0]&&(t=await L(S[0],E[0]))),console.log("Starting 3D generation:",{mode:O,version:D,imageUrl:t,prompt:"text"===O?a:void 0});let s=await fetch("/api/generate-3d",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:O,imageUrl:t,prompt:"text"===O?a:void 0,version:D})}),l=await s.json();l.success?(console.log("3D generation started:",{generationId:l.generation_id,predictionId:l.prediction_id}),g.oR.success(m("upload.generation_started")),l.generation_id&&(W(l.generation_id),e&&e(l.generation_id))):(console.error("3D generation failed:",l),401===s.status?(g.oR.error(m("upload.login_required")),N(!0)):402===s.status?_(!0):g.oR.error(l.message||m("upload.generation_failed")),z(!1))}catch(t){console.error("Error starting 3D generation:",t);let e=t instanceof Error&&"rapid_image_too_large_after_compression"===t.message?m("upload.rapid_image_compress_error"):m("upload.generation_request_failed");g.oR.error(e),z(!1)}};return(0,a.jsx)("section",{ref:w,id:"upload-section",className:"py-12 md:py-24 relative overflow-hidden transition-all duration-1000 bg-gradient-to-b from-background via-background to-background/60 ".concat(j?"opacity-100":"opacity-0"),children:(0,a.jsxs)("div",{className:"container mx-auto px-4 md:px-6 relative z-10",children:[(0,a.jsxs)("div",{className:"mx-auto mb-10 max-w-6xl text-center md:mb-16",children:[(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"w-8 h-px bg-gradient-to-r from-transparent via-purple-500 to-transparent"}),(0,a.jsx)("span",{className:"text-xs font-mono text-white/70 uppercase tracking-[0.2em]",children:"AI 3D Generator"}),(0,a.jsx)("div",{className:"w-8 h-px bg-gradient-to-r from-transparent via-purple-500 to-transparent"})]}),(0,a.jsx)("h1",{className:"text-3xl font-bold leading-tight text-white sm:text-4xl md:text-5xl tracking-tight",children:d||m("upload.hero_title")})]}),(0,a.jsx)("div",{className:"relative p-[2px] rounded-3xl bg-gradient-to-br from-purple-500/30 via-purple-700/20 to-orange-500/30 shadow-[0_0_40px_-10px_rgba(168,85,247,0.2)]",children:(0,a.jsxs)("div",{className:"bg-gradient-to-br from-[#1a1f33] via-[#1d2238] to-[#1a1f33] rounded-3xl p-5 sm:p-6 md:p-12",children:[(0,a.jsx)("div",{className:"flex justify-center mb-8",children:(0,a.jsxs)("div",{className:"inline-flex rounded-2xl bg-white/5 p-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>M("image"),className:"rounded-xl px-6 py-2.5 text-sm font-medium transition-all sm:text-base ".concat("image"===O?"bg-gradient-to-r from-purple-600 to-orange-500 text-white shadow-lg shadow-purple-500/20":"text-gray-400 hover:text-white hover:bg-white/5"),children:"Image to 3D"}),(0,a.jsx)("button",{type:"button",onClick:()=>M("text"),className:"rounded-xl px-6 py-2.5 text-sm font-medium transition-all sm:text-base ".concat("text"===O?"bg-gradient-to-r from-purple-600 to-orange-500 text-white shadow-lg shadow-purple-500/20":"text-gray-400 hover:text-white hover:bg-white/5"),children:"Text to 3D"})]})}),"image"===O?(0,a.jsxs)("div",{className:"grid lg:grid-cols-2 gap-8 lg:gap-12 items-center",children:[(0,a.jsxs)("div",{className:"space-y-6 md:space-y-8",children:[(0,a.jsx)("div",{className:"text-center lg:text-left space-y-2",children:(0,a.jsx)("p",{className:"text-xl sm:text-2xl md:text-3xl font-bold text-white leading-tight text-pretty",children:m("upload.hero_title")})}),(0,a.jsx)("div",{className:"relative",children:(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3 sm:gap-6 lg:gap-8",children:[(0,a.jsxs)("div",{className:"text-center w-[c
1alc(50%-1.5rem)] max-w-[220px] min-w-0",children:[(0,a.jsx)("p",{className:"text-base sm:text-xl font-semibold mb-2 sm:mb-4 text-white",children:m("upload.before")}),(0,a.jsxs)("div",{className:"relative aspect-square w-full rounded-xl sm:rounded-2xl overflow-hidden shadow-2xl ring-1 ring-white/10",children:[(0,a.jsx)(f.default,{src:"/imgs/upload/1.png",alt:"Input Image",fill:!0,className:"object-cover"}),(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/20 to-transparent"})]})]}),(0,a.jsxs)("div",{className:"flex flex-col items-center shrink-0",children:[(0,a.jsx)("div",{className:"w-10 h-10 sm:w-12 sm:h-12 bg-gradient-to-br from-purple-500 to-orange-500 rounded-full flex items-center justify-center shadow-lg shadow-purple-500/30",children:(0,a.jsx)(n.A,{className:"w-5 h-5 sm:w-6 sm:h-6 text-white ml-1"})}),(0,a.jsx)("div",{className:"w-1 h-8 sm:h-16 bg-gradient-to-b from-purple-500 to-orange-500 mt-2"})]}),(0,a.jsxs)("div",{className:"text-center w-[calc(50%-1.5rem)] max-w-[220px] min-w-0",children:[(0,a.jsx)("p",{className:"text-base sm:text-xl font-semibold mb-2 sm:mb-4 text-white",children:m("upload.now")}),(0,a.jsxs)("div",{className:"relative aspect-square w-full rounded-xl sm:rounded-2xl overflow-hidden shadow-2xl ring-1 ring-white/10 bg-white/5",children:[(0,a.jsx)("img",{src:"/imgs/upload/2.webp",alt:"3D Generated Result",className:"absolute inset-0 w-full h-full object-cover"}),(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/20 to-transparent pointer-events-none"})]})]})]})})]}),(0,a.jsxs)("div",{className:"w-full max-w-md mx-auto lg:mx-0 space-y-5",children:[0===E.length?(0,a.jsxs)("div",{className:"border-2 border-dashed border-white/30 rounded-2xl px-4 py-8 sm:p-8 text-center hover:border-purple-500/50 hover:bg-purple-500/10 transition-all cursor-pointer group",onClick:()=>{var e;return null===(e=document.getElementById("image-upload"))||void 0===e?void 0:e.click()},onDragOver:e=>{e.preventDefault(),e.currentTarget.classList.add("border-primary","bg-primary/5")},onDragLeave:e=>{e.preventDefault(),e.currentTarget.classList.remove("border-primary","bg-primary/5")},onDrop:e=>{e.preventDefault(),e.currentTarget.classList.remove("border-primary","bg-primary/5");let t=Array.from(e.dataTransfer.files);if(t.length>0)for(let e of t){if(!e.type.startsWith("image/")){g.oR.error(m("upload.file_type_error"));continue}if(e.size>6291456){g.oR.error(m("upload.file_size_error"));continue}if(S.length>=5){g.oR.error(m("upload.max_images"));break}R(t=>[...t,e]);let t=new FileReader;t.onload=e=>{var t;let r=null===(t=e.target)||void 0===t?void 0:t.result;A(e=>[...e,r])},t.readAsDataURL(e),g.oR.success(m("upload.upload_success"))}},children:[(0,a.jsx)(i.A,{className:"w-14 h-14 mx-auto mb-4 text-white/90 group-hover:text-purple-400 transition-colors"}),(0,a.jsx)("p",{className:"text-sm text-white/90 mb-2 break-words",children:m("upload.drag_hint")}),(0,a.jsx)("p",{className:"text-sm text-white/70 break-words",children:m("upload.format_support")})]}):(0,a.jsx)("div",{className:"space-y-3",children:(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3",children:E.map((e,t)=>(0,a.jsxs)("div",{className:"relative aspect-square rounded-xl overflow-hidden ring-1 ring-white/10",children:[(0,a.jsx)(f.default,{src:e,alt:"Uploaded",fill:!0,className:"object-cover"}),(0,a.jsx)("button",{onClick:()=>J(t),className:"absolute top-2 right-2 p-1 bg-red-500/80 text-white rounded-full hover:bg-red-600 transition-colors",children:(0,a.jsx)(o.A,{className:"w-3 h-3"})})]},t))})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("p",{className:"text-sm text-white/90 text-center",children:m("upload.no_image_hint")}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 justify-center",children:[{name:"示例图片 1",image:"/imgs/upload/3.png"},{name:"示例图片 2",image:"/imgs/upload/4.png"}].map((e,t)=>(0,a.jsx)("div",{className:"w-16 h-16 rounded-xl overflow-hidden ring-1 ring-white/10 opacity-85 hover:opacity-100 hover:ring-purple-500/50 transition-all cursor-pointer",onClick:()=>X(e.image),children:(0,a.jsx)(f.default,{src:e.image,alt:e.name,width:64,height:64,className:"w-full h-full object-cover rounded-xl"})},t))})]}),(0,a.jsx)(F,{version:D,isRecharged:T,isGenerating:G,CREDIT_COST:$,onVersionClick:V,onGenerate:Q,disabled:0===E.length,t:m})]})]}):(0,a.jsxs)("div",{className:"grid lg:grid-cols-2 gap-8 lg:gap-12 items-start",children:[(0,a.jsxs)("div",{className:"w-full max-w-lg mx-auto lg:mx-0 space-y-4",children:[(0,a.jsx)("p",{className:"text-xl font-bold text-white text-center lg:text-left",children:m("upload.title")}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.T,{value:q,onChange:e=>U(e.target.value),maxLength:"rapid"===D?200:void 0,placeholder:m("upload.prompt_placeholder"),className:"min-h-40 w-full resize-none rounded-2xl border border-white/10 bg-white/5 text-white placeholder:text-white/50 focus:border-purple-500/50 focus:outline-none p-4 text-sm"}),"rapid"===D&&(0,a.jsx)("p",{className:"mt-1 text-right text-xs text-gray-400",children:m("upload.prompt_length_hint",{count:q.length,max:200})})]}),(0,a.jsx)("p",{className:"text-xs text-white/70 text-center lg:text-left",children:m("upload.description")})]}),(0,a.jsx)("div",{className:"w-full max-w-md mx-auto lg:mx-0",children:(0,a.jsx)("div",{className:"p-4 sm:p-6 md:p-8 rounded-3xl border border-white/10 bg-gradient-to-br from-white/[0.06] to-white/[0.02] backdrop-blur-sm shadow-2xl",children:(0,a.jsx)(F,{version:D,isRecharged:T,isGenerating:G,CREDIT_COST:$,onVersionClick:V,onGenerate:Q,disabled:!q.trim(),t:m})})})]}),(0,a.jsx)("input",{type:"file",id:"image-upload",multiple:!0,accept:"image/*",onChange:e=>{let t=Array.from(e.target.files||[]);if(0!==t.length)for(let e of t){if(!e.type.startsWith("image/")){g.oR.error(m("upload.file_type_error"));continue}if(e.size>6291456){g.oR.error(m("upload.file_size_error"));continue}if(S.length>=5){g.oR.error(m("upload.max_images"));break}R(t=>[...t,e]);let t=new FileReader;t.onload=e=>{var t;let r=null===(t=e.target)||void 0===t?void 0:t.result;A(e=>[...e,r])}
1,t.readAsDataURL(e),g.oR.success(m("upload.upload_success"))}},className:"hidden"})]})}),(0,a.jsx)("div",{className:"flex items-center justify-center gap-2 text-sm text-white/80 text-center mt-6",children:(0,a.jsx)("span",{className:"break-words",children:m("upload.login_hint")})})]})})}function F(e){let{version:t,isRecharged:r,isGenerating:l,CREDIT_COST:n,onVersionClick:i,onGenerate:o,disabled:x,t:p}=e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-white/80",children:"Version"}),(0,a.jsx)("span",{className:"rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-1 text-xs font-semibold text-amber-300",children:p("upload.free_trial_badge")})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i("rapid"),className:"relative rounded-xl border p-3 text-left transition-all ".concat("rapid"===t?"border-purple-500/50 bg-purple-500/10":"border-white/10 bg-white/5 hover:border-white/20"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm font-semibold ".concat("rapid"===t?"text-white":"text-gray-300"),children:p("upload.version_rapid")}),(0,a.jsx)("div",{className:"w-4 h-4 rounded-full border-2 flex items-center justify-center ".concat("rapid"===t?"border-purple-500":"border-gray-600"),children:"rapid"===t&&(0,a.jsx)("div",{className:"w-2 h-2 rounded-full bg-gradient-to-r from-purple-500 to-orange-500"})})]}),(0,a.jsx)("span",{className:"mt-2 inline-flex rounded-full bg-gray-700 px-2 py-0.5 text-[11px] font-semibold text-gray-200",children:p("upload.rapid_tag")}),(0,a.jsx)("p",{className:"text-sm text-white/70 mt-1",children:p("upload.version_rapid_desc")})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>i("standard"),className:"relative rounded-xl border p-3 text-left transition-all ".concat("standard"===t?"border-purple-500/50 bg-purple-500/10":"border-white/10 bg-white/5 hover:border-white/20"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"text-sm font-semibold flex items-center gap-1 ".concat("standard"===t?"text-white":"text-gray-300"),children:[p("upload.version_standard"),!r&&(0,a.jsx)(d.A,{className:"w-3.5 h-3.5 text-amber-400"})]}),(0,a.jsx)("div",{className:"w-4 h-4 rounded-full border-2 flex items-center justify-center ".concat("standard"===t?"border-purple-500":"border-gray-600"),children:"standard"===t&&(0,a.jsx)("div",{className:"w-2 h-2 rounded-full bg-gradient-to-r from-purple-500 to-orange-500"})})]}),(0,a.jsx)("span",{className:"mt-2 inline-flex rounded-full bg-amber-500 px-2 py-0.5 text-[11px] font-semibold text-black",children:p("upload.standard_tag")}),(0,a.jsx)("p",{className:"text-sm text-white/70 mt-1",children:p("upload.version_standard_desc")})]})]})]}),(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-3",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(c.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-300"}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-white",children:p("rapid"===t?"upload.rapid_quality_note_title":"upload.standard_quality_note_title")}),(0,a.jsx)("p",{className:"text-xs leading-relaxed text-gray-300",children:p("rapid"===t?"upload.rapid_quality_note_desc":"upload.standard_quality_note_desc")})]})]})}),(0,a.jsx)(s.$,{onClick:o,disabled:l||x,className:"w-full min-h-14 h-auto px-4 py-3 bg-gradient-to-r from-purple-600 to-orange-500 hover:from-purple-500 hover:to-orange-400 text-white font-bold rounded-xl flex flex-wrap items-center justify-center sm:justify-between gap-2 shadow-lg shadow-purple-500/20 hover:shadow-xl hover:shadow-purple-500/30 transition-all disabled:opacity-50 disabled:cursor-not-allowed hover:scale-[1.02]",children:l?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"w-5 h-5 border-2 border-white border-t-transparent roun
1ded-full animate-spin"}),(0,a.jsx)("span",{className:"text-center break-words",children:p("upload.generating_3d")})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)(u.A,{className:"w-5 h-5 shrink-0"}),(0,a.jsx)("span",{className:"text-center break-words",children:p("upload.generate_button")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsx)(m.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{className:"text-sm",children:n})]})]})})]})}},20250:(e,t,r)=>{Promise.resolve().then(r.bind(r,55425)),Promise.resolve().then(r.bind(r,10090)),Promise.resolve().then(r.bind(r,59502)),Promise.resolve().then(r.bind(r,1242))},24311:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(26944).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},26944:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var a=r(77641);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),l=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter((e,t,r)=>!!e&&r.indexOf(e)===t).join(" ")};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,a.forwardRef)((e,t)=>{let{color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:d="",children:c,iconNode:u,...m}=e;return(0,a.createElement)("svg",{ref:t,...n,width:s,height:s,stroke:r,strokeWidth:o?24*Number(i)/Number(s):i,className:l("lucide",d),...m},[...u.map(e=>{let[t,r]=e;return(0,a.createElement)(t,r)}),...Array.isArray(c)?c:[c]])}),o=(e,t)=>{let r=(0,a.forwardRef)((r,n)=>{let{className:o,...d}=r;return(0,a.createElement)(i,{ref:n,iconNode:t,className:l("lucide-".concat(s(e)),o),...d})});return r.displayName="".concat(e),r}},28672:(e,t,r)=>{"use strict";r.d(t,{DT:()=>o,FP:()=>n,TK:()=>s,Zn:()=>l,aM:()=>i,x3:()=>d});var a=r(33291);function s(e){return"string"==typeof e?{pathname:e}:e}function l(e){let t=new URLSearchParams;for(let[r,a]of Object.entries(e))Array.isArray(a)?a.forEach(e=>{t.append(r,String(e))}):t.set(r,String(a));return"?"+t.toString()}function n({pathname:e,locale:t,params:r,pathnames:s,query:n}){function i(e){let i;let o=s[e];return o?(i=(0,a.Wl)(o,t,e),r&&Object.entries(r).forEach(([e,t])=>{let r,a;Array.isArray(t)?(r=`(\\[)?\\[...${e}\\](\\])?`,a=t.map(e=>String(e)).join("/")):(r=`\\[${e}\\]`,a=String(t)),i=i.replace(RegExp(r,"g"),a)}),i=(i=i.replace(/\[\[\.\.\..+\]\]/g,"")).split("/").map(e=>encodeURIComponent(e)).join("/")):i=e,i=(0,a.po)(i),n&&(i+=l(n)),i}if("string"==typeof e)return i(e);{let{pathname:t,...r}=e;return{...r,pathname:i(t)}}}function i(e,t,r){let s=(0,a.FD)(Object.keys(r)),l=decodeURI(t);for(let t of s){let s=r[t];if("string"==typeof s){if((0,a.ql)(s,l))return t}else if((0,a.ql)((0,a.Wl)(s,e,t),l))return t}return t}function o(e,t=window.location.pathname){return"/"===e?t:t.replace(e,"")}function d(e,t,r,s){let l;let{mode:n}=r.localePrefix;return void 0!==s?l=s:(0,a._x)(e)&&("always"===n?l=!0:"as-needed"===n&&(l=r.domains?!r.domains.some(e=>e.defaultLocale===t):t!==r.defaultLocale)),l?(0,a.PJ)((0,a.XP)(t,r.localePrefix),e):e}},30280:(e,t,r)=>{"use strict";r.d(t,{$:()=>d,r:()=>o});var a=r(18813),s=r(77641),l=r(66418),n=r(56860),i=r(54727);let o=(0,n.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=s.forwardRef((e,t)=>
1{let{className:r,variant:s,size:n,asChild:d=!1,...c}=e,u=d?l.DX:"button";return(0,a.jsx)(u,{className:(0,i.cn)(o({variant:s,size:n,className:r})),ref:t,...c})});d.displayName="Button"},33291:(e,t,r)=>{"use strict";r.d(t,{FD:()=>f,MY:()=>l,PJ:()=>n,Wl:()=>o,XP:()=>u,_x:()=>s,bL:()=>m,po:()=>d,ql:()=>c,wO:()=>i,yL:()=>b});var a=r(55036);function s(e){return("object"==typeof e?null==e.host&&null==e.hostname:!/^[a-z]+:/i.test(e))&&!function(e){let t="object"==typeof e?e.pathname:e;return null!=t&&!t.startsWith("/")}(e)}function l(e,t){return e.replace(RegExp(`^${t}`),"")||"/"}function n(e,t){let r=e;return/^\/(\?.*)?$/.test(t)&&(t=t.slice(1)),r+=t}function i(e,t){return t===e||t.startsWith(`${e}/`)}function o(e,t,r){return"string"==typeof e?e:e[t]||r}function d(e){let t=function(){try{return"true"===a.env._next_intl_trailing_slash}catch{return!1}}(),[r,...s]=e.split("#"),l=s.join("#"),n=r;if("/"!==n){let e=n.endsWith("/");t&&!e?n+="/":!t&&e&&(n=n.slice(0,-1))}return l&&(n+="#"+l),n}function c(e,t){let r=d(e),a=d(t);return(function(e){let t=e.replace(/\[\[(\.\.\.[^\]]+)\]\]/g,"?(.*)").replace(/\[(\.\.\.[^\]]+)\]/g,"(.+)").replace(/\[([^\]]+)\]/g,"([^/]+)");return RegExp(`^${t}$`)})(r).test(a)}function u(e,t){return"never"!==t.mode&&t.prefixes?.[e]||m(e)}function m(e){return"/"+e}function x(e){return e.includes("[[...")}function p(e){return e.includes("[...")}function g(e){return e.includes("[")}function h(e,t){let r=e.split("/"),a=t.split("/"),s=Math.max(r.length,a.length);for(let e=0;e<s;e++){let t=r[e],s=a[e];if(!t&&s)return -1;if(t&&!s)return 1;if(t||s){if(!g(t)&&g(s))return -1;if(g(t)&&!g(s))return 1;if(!p(t)&&p(s))return -1;if(p(t)&&!p(s))return 1;if(!x(t)&&x(s))return -1;if(x(t)&&!x(s))return 1}}return 0}function f(e){return e.sort(h)}function b(e){return"function"==typeof e.then}},48570:(e,t,r)=>{"use strict";r.d(t,{T:()=>n});var a=r(18813),s=r(77641),l=r(54727);let n=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)("textarea",{className:(0,l.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),ref:t,...s})});n.displayName="Textarea"},54727:(e,t,r)=>{"use strict";r.d(t,{cn:()=>l});var a=r(49322),s=r(5523);function l(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.QP)((0,a.$)(t))}},55425:(e,t,r)=>{"use strict";r.d(t,{default:()=>o});var a=r(18813),s=r(55428),l=r(93054),n=r(39839),i=r(77641);function o(){let{ref:e,isVisible:t}=(0,s.r)(),r=(0,l.c3)("faq"),[o,d]=(0,i.useState)(null),c=r.raw("questions"),u={"@context":"https://schema.org","@type":"FAQPage",mainEntity:c.map(e=>({"@type":"Question",name:e.question,acceptedAnswer:{"@type":"Answer",text:e.answer}}))};return(0,a.jsxs)("section",{ref:e,className:"py-12 md:py-24 relative overflow-hidden transition-all duration-1000 ".concat(t?"opacity-100":"opacity-0"),children:[(0,a.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(u)}}),(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-b from-background via-background to-background/60"}),(0,a.jsx)("div",{className:"absolute top-1/4 left-1/5 w-72 h-72 bg-gradient-to-r from-cyan-500/5 to-blue-500/5 rounded-full blur-3xl pointer-events-none"}),(0,a.jsx)("div",{className:"absolute bottom-1/3 right-1/5 w-96 h-96 bg-gradient-to-r from-rose-500/5 to-pink-500/5 rounded-full blur-3xl pointer-events-none"}),(0,a.jsx)("div",{className:"absolute top-3/4 left-1/3 w-64 h-64 bg-gradient-to-r from-emerald-500/5 to-teal-500/5 rounded-full blur-3xl pointer-events-none"}),(0,a.jsxs)("div",{className:"container mx-auto px-6 relative z-10",children:[(0,a.jsxs)("div",{className:"text-center mb-12 md:mb-16 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,a.jsx)("div",{className:"w-8 h-px bg-gradient-to-r from-transparent via-cyan-500 to-transparent"}),(0,a.jsx)("span",{className:"text-xs font-mono text-white/40 uppercase tracking-[0.2em]",children:"FAQ"}),(0,a.jsx)("div",{className:"w-8 h-px bg-gradient-to-r from-transparent via-cyan-500 to-transparent"})]}),(0,a.jsx)("h2",{className:"text-2xl md:text-5xl font-bold text-white tracking-tight text-balance",children:r("title")}),(0,a.jsx)("p",{className:"text-lg text-white/60 max-w-3xl mx-auto leading-relaxed",children:r("description")})]}
1),(0,a.jsx)("div",{className:"max-w-4xl mx-auto space-y-3",children:c.map((e,t)=>{let r=o===t;return(0,a.jsxs)("div",{className:"group rounded-2xl border transition-all duration-300 overflow-hidden ".concat(r?"border-cyan-500/20 bg-gradient-to-br from-cyan-500/[0.08] to-blue-500/[0.03] shadow-[0_0_30px_-10px_rgba(6,182,212,0.15)]":"border-white/10 bg-gradient-to-br from-white/[0.06] to-white/[0.02] hover:border-white/20"),children:[(0,a.jsxs)("button",{onClick:()=>d(r?null:t),className:"w-full flex items-center gap-4 p-5 md:p-6 text-left",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-full border flex items-center justify-center shrink-0 transition-all duration-300 ".concat(r?"border-cyan-500/50 bg-cyan-500/20 text-cyan-400":"border-white/10 bg-white/5 text-white/50"),children:(0,a.jsx)("span",{className:"text-sm font-semibold",children:t+1})}),(0,a.jsx)("h3",{className:"flex-1 text-base md:text-lg font-semibold transition-colors ".concat(r?"text-white":"text-white/90 group-hover:text-white"),children:e.question}),(0,a.jsx)("div",{className:"w-6 h-6 rounded-full flex items-center justify-center transition-all duration-300 shrink-0 ".concat(r?"bg-cyan-500/20":""),children:(0,a.jsx)(n.A,{className:"w-4 h-4 transition-all duration-300 ".concat(r?"rotate-180 text-cyan-400":"text-white/40")})})]}),(0,a.jsx)("div",{className:"grid transition-all duration-300 ease-in-out ".concat(r?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0"),children:(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsxs)("div",{className:"flex gap-4 px-5 md:px-6 pb-5 md:pb-6 pl-[72px]",children:[(0,a.jsx)("div",{className:"w-px bg-gradient-to-b from-cyan-500/40 to-transparent shrink-0"}),(0,a.jsx)("p",{className:"text-white/60 leading-relaxed text-sm",children:e.answer})]})})})]},t)})}),(0,a.jsx)("div",{className:"text-center mt-20 relative",children:(0,a.jsx)("div",{className:"relative mx-auto max-w-5xl rounded-3xl bg-gradient-to-b from-green-400/25 via-transparent to-yellow-400/20 p-[1px] transition-all duration-500 hover:shadow-2xl hover:shadow-green-400/10",children:(0,a.jsxs)("div",{className:"relative rounded-3xl p-8 md:p-12 overflow-hidden bg-gradient-to-br from-green-400/[0.07] via-background to-yellow-400/[0.05] backdrop-blur-sm",children:[(0,a.jsx)("div",{className:"absolute top-0 left-1/4 right-1/4 h-px bg-gradient-to-r from-transparent via-green-300/30 to-transparent"}),(0,a.jsx)("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[500px] h-[500px] bg-[radial-gradient(ellipse_at_center,_rgba(74,222,128,0.06)_0%,_transparent_70%)] pointer-events-none"}),(0,a.jsx)("div",{className:"absolute -top-32 -right-32 w-96 h-96 bg-gradient-to-br from-green-400/20 via-lime-300/10 to-transparent rounded-full blur-[100px] pointer-events-none"}),(0,a.jsx)("div",{className:"absolute -bottom-32 -left-32 w-96 h-96 bg-gradient-to-br from-yellow-400/20 via-green-400/10 to-transparent rounded-full blur-[100px] pointer-events-none"}),(0,a.jsx)("div",{className:"absolute top-1/3 -right-16 w-32 h-32 bg-green-400/10 rounded-full blur-[60px] pointer-events-none animate-pulse"}),(0,a.jsx)("div",{className:"absolute bottom-1/3 -left-16 w-32 h-32 bg-lime-400/10 rounded-full blur-[60px] pointer-events-none animate-pulse"}),(0,a.jsx)("div",{className:"absolute inset-0 opacity-[0.02]",style:{backgroundImage:"radial-gradient(circle at 1px 1px, white 1px, transparent 0)",backgroundSize:"24px 24px"}}),(0,a.jsxs)("div",{className:"relative z-10",children:[(0,a.jsx)("h2",{className:"text-3xl md:text-5xl font-bold text-white tracking-tight text-balance mb-6",children:r("cta_title")}),(0,a.jsx)("p",{className:"text-lg text-white/60 max-w-2xl mx-auto leading-relaxed mb-12",children:r("cta_description")}),(0,a.jsxs)("div",{className:"flex flex-wrap justify-center gap-0 mb-12 max-w-2xl mx-auto",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-[120px] py-4 relative",children:[(0,a.jsx)("div",{className:"text-3xl md:text-4xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-green-400 via-lime-300 to-yellow-400",children:"50K+"}),(0,a.jsx)("div",{className:"text-xs text-white/40 mt-1.5 uppercase tracking-wider",children:r("stats.gardens_designed")}),(0,a.jsx)("div",{className:"hidden md:block absolute right-0 top-1/4 h-1/2 w-px bg-gradient-to-b from-transparent via-white/10 to-transparent"})]}),(0,a.jsxs)("div",{className:"flex-1 min-w-[120px] py-4 relative",children:[(0,a.jsx)("div",{className:"text-3xl md:text-4xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-green-400 via-lime-300 to-yellow-400",children:"10K+"}),(0,a.jsx)("div",{className:"text-xs text-white/40 mt-1.5 uppercase tracking-wider",children:r("stats.cities_served")}),(0,a.jsx)("div",{className:"hidden md:block absolute right-0 top-1/4 h-1/2 w-px bg-gradient-to-b from-transparent via-white/10 to-transparent"})]}),(0,a.jsxs)("div",{className:"flex-1 min-w-[120px] py-4",children:[(0,a.jsx)("div",{className:"text-3xl md:text-4xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-green-400 via-lime-300 to-yellow-400",children:"60s"}),(0,a.jsx)("div",{className:"text-xs text-white/40 mt-1.5 uppercase tracking-wider",children:r("stats.design_time")})]})]}),(0,a.jsxs)("button",{className:"group relative inline-flex items-center gap-2 px-10 py-4 rounded-2xl text-base font-semibold text-white border-0 overflow-hidden transition-all duration-300 hover:scale-105 active:scale-[1.02]",onClick:()=>{let e=document.getElementById("upload-section");e&&e.scrollIntoView({behavior:"smooth"})},children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-green-500 via-lime-400 to-yellow-500 bg-[length:200%_100%] group-hover:bg-[position:100%_0] transition-all duration-700"}),(0,a.jsx)("div",{className:"absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity duration-500 shadow-[0_0_40px_rgba(74,222,128,0.35)]"}),(0,a.jsx)("div",{className:"absolute inset-0 -translate-x-full group-hover:translate-x-full transition-transform duration-1000 bg-gradient-to-r from-transparent via-white/15 to-transparent"}),(0,a.jsx)("span",{className:"relative z-10",children:r("cta_button")})]})]})]})})})]})]})}},55428:(e,t,r)=>{"use strict";r.d(t,{r:()=>s});var a=r(77641);let s=function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0],{ref:(0,a.useRef)(null),isVisible:!0}}},56860:(e,t,r)=>{"use strict";r.d(t,{F:()=>n});var a=r(49322);let s=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,l=a.$,n=(e,t)=>r=>{var a;if((null==t?void 0:t.variants)==null)return l(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:n,defaultVariants:i}=t,o=Object.keys(n).map(e=>{let t=null==r?void 0:r[e],a=null==i?void 0:i[e];if(null===t)return null;let l=s(t)||s(a);return n[e][l]}),d=r&&Object.entries(r).reduce((e,t)=>
1{let[r,a]=t;return void 0===a||(e[r]=a),e},{});return l(e,o,null==t?void 0:null===(a=t.compoundVariants)||void 0===a?void 0:a.reduce((e,t)=>{let{class:r,className:a,...s}=t;return Object.entries(s).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...i,...d}[t]):({...i,...d})[t]===r})?[...e,r,a]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},59502:(e,t,r)=>{"use strict";r.d(t,{default:()=>d});var a=r(31496),s=r(14333),l=r(77641),n=r(76601),i=r(82772),o=r(18813),d=(0,l.forwardRef)(function(e,t){let{href:r,locale:l,localeCookie:d,onClick:c,prefetch:u,...m}=e,x=(0,n.Ym)(),p=null!=l&&l!==x,g=(0,s.usePathname)();return p&&(u=!1),(0,o.jsx)(a,{ref:t,href:r,hrefLang:p?l:void 0,onClick:function(e){(0,i.A)(d,g,x,l),c&&c(e)},prefetch:u,...m})})},59971:(e,t,r)=>{"use strict";r.d(t,{lg:()=>a});let a=()=>Date.parse(new Date().toUTCString())/1e3},82772:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var a=r(28672);function s(e,t,r,s){if(!e||s===r||null==s||!t)return;let l=(0,a.DT)(t),{name:n,...i}=e;i.path||(i.path=""!==l?l:"/");let o=`${n}=${s};`;for(let[e,t]of Object.entries(i))o+=`${"maxAge"===e?"max-age":e}`,"boolean"!=typeof t&&(o+="="+t),o+=";";document.cookie=o}},83763:(e,t,r)=>{"use strict";r.d(t,{AppContextProvider:()=>h,U:()=>p});var a=r(18813),s=r(77641),l=r(12800),n=r(86279),i=r(8864),o=r.n(i),d=r(74553),c=r.n(d),u=r(7989),m=r(55036);let x=(0,s.createContext)({}),p=()=>(0,s.useContext)(x);function g(){return!function(){let{data:e,status:t}=(0,u.wV)(),r=(0,s.useRef)(!1),l=()=>{let e=new Date(Date.now()+864e5).toUTCString();document.cookie="onetap_dismissed=1; Path=/; SameSite=Lax; Expires=".concat(e)},n=()=>"undefined"!=typeof document&&document.cookie.includes("onetap_dismissed=1"),i=async function(){let e=async()=>{let e=Date.now();for(;Date.now()-e<2e3;){var t,r;if(null===(r=globalThis.google)||void 0===r?void 0:null===(t=r.accounts)||void 0===t?void 0:t.id)return!0;await new Promise(e=>setTimeout(e,50))}return!1};await e()&&c()({client_id:"795569333990-3e05kakcn0s1af89g33cf6013l0eip3k.apps.googleusercontent.com",auto_select:!0,cancel_on_tap_outside:!0,context:"signin"},e=>{console.log("onetap login ok",e),o(e.credential)})},o=async function(e){console.log("signIn ok",await (0,u.Jv)("google-one-tap",{credential:e,redirect:!1}));try{var t,r,a,s,n,i,o,d;null===(s=globalThis.google)||void 0===s||null===(a=s.accounts)||void 0===a||null===(r=a.id)||void 0===r||null===(t=r.cancel)||void 0===t||t.call(r),null===(d=globalThis.google)||void 0===d||null===(o=d.accounts)||void 0===o||null===(i=o.id)||void 0===i||null===(n=i.disableAutoSelect)||void 0===n||n.call(i)}catch(e){}l()};(0,s.useEffect)(()=>{r.current||"unauthenticated"!==t||n()||(r.current=!0,i())},[t]),(0,s.useEffect)(()=>{if("authenticated"===t){try{var e,r,a,s,n,i,o,d;null===(s=globalThis.google)||void 0===s||null===(a=s.accounts)||void 0===a||null===(r=a.id)||void 0===r||null===(e=r.cancel)||void 0===e||e.call(r),null===(d=globalThis.google)||void 0===d||null===(o=d.accounts)||void 0===o||null===(i=o.id)||void 0===i||null===(n=i.disableAutoSelect)||void 0===n||n.call(i)}catch(e){}l()}},[t]),a.Fragment}(),null}let h=e=>{let{children:t}=e,r=m.env.NEXT_PUBLIC_GOOGLE_ADS_ID||"AW-18120497412",i=m.env.NEXT_PUBLIC_GOOGLE_ADS_SIGNUP_LABEL||"YR3lCOeOrqMcEISyw8BD",d="google_ads_registration_conversion_tracked",{data:c}
1=(0,u.wV)(),[p,h]=(0,s.useState)(()=>"light"),[f,b]=(0,s.useState)(!1),[v,w]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[N,_]=(0,s.useState)(!1),k=async function(){try{let e=await fetch("/api/get-user-info",{method:"POST"});if(!e.ok)throw Error("fetch user info failed with status: "+e.status);let{code:t,message:r,data:a}=await e.json();if(0!==t)throw Error(r);y(a),R(a)}catch(e){console.log("fetch user info failed")}},S=async function(){try{await fetch("/api/update-user-source",{method:"POST"})}catch(e){}},R=async e=>{try{if(e.invited_by){console.log("user already been invited",e.invited_by);return}let t=(0,l.pr)(n.wD.InviteCode);if(!t)return;let r=o()(e.created_at).unix(),a=o()().unix(),s=Number(a-r);if(s<=0||s>7200){console.log("user created more than 2 hours");return}console.log("update invite",t,e.uuid);let i={invite_code:t,user_uuid:e.uuid},d=await fetch("/api/update-invite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!d.ok)throw Error("update invite failed with status: "+d.status);let{code:c,message:u,data:m}=await d.json();if(0!==c)throw Error(u);y(m),(0,l.np)(n.wD.InviteCode)}catch(e){console.log("update invite failed: ",e)}};return(0,s.useEffect)(()=>{c&&c.user&&(k(),S())},[c]),(0,s.useEffect)(()=>{if(!(null==c?void 0:c.isNewUser)||!(null==j?void 0:j.uuid)||window.sessionStorage.getItem(d))return;let e=()=>{if(!window.gtag){window.setTimeout(e,1e3);return}window.gtag("event","conversion",{send_to:"".concat(r,"/").concat(i),transaction_id:j.uuid}),window.sessionStorage.setItem(d,"true")};e()},[r,i,null==c?void 0:c.isNewUser,null==j?void 0:j.uuid]),(0,a.jsxs)(x.Provider,{value:{theme:p,setTheme:h,showSignModal:f,setShowSignModal:b,showPricingModal:v,setShowPricingModal:w,user:j,setUser:y,showFeedback:N,setShowFeedback:_},children:[(0,a.jsx)(g,{}),t]})}},86279:(e,t,r)=>{"use strict";r.d(t,{wD:()=>a});let a={Theme:"THEME",InviteCode:"INVITE_CODE",UtmSourceFirst:"UTM_SOURCE_FIRST"}}},e=>{var t=t=>e(e.s=t);e.O(0,[6601,3491,1496,1357,8673,4705,7989,1140,7519,7358],()=>t(20250)),_N_E=e.O()}]);

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.