PageSourceSearch

https://www.playtex.ai/assets/ProceduralHDRIStudio-norxcPE_.js

js playtex.ai collected 2026-09-25 22:03:04 UTC 96,026 bytes, 140 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/topazUpscale-D7AW5efP.js","assets/supabaseClient-sffWuQ3N.js","assets/tslib.es6-CmEaCU22.js","assets/customerCredits-fzzOpXTs.js","assets/subscriptionBilling-BI1IslSf.js","assets/entitlements-BFUQn2ph.js","assets/creditRolloutPromotion-BeC4YVJw.js"])))=>i.map(i=>d[i]);
2var zt=Object.defineProperty;var _t=(e,r,t)=>r in e?zt(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var pt=(e,r,t)=>_t(e,typeof r!="symbol"?r+"":r,t);import{_ as Tt}from"./index-CGRuql43.js";import{j as a}from"./jsx-runtime-BjG_zV1W.js";import{r as T,v as bt,X as Et,al as At,n as wt,E as xe,bd as It,dc as Dt,bM as Gt,ap as Ft,aE as Lt,a as Fe,aq as ut,T as $t,bv as Ut,af as Ot,k as Ht,ba as Bt,ci as Yt,dX as qt,aR as Wt}from"./vendor-lucide-C-KNoM6r.js";import{H as Xt}from"./HDRIGeneratorPage-BeekrXEp.js";import{B as he}from"./button-DSt51qIy.js";import{u as Vt}from"./use-toast-BcPCDlL6.js";import{buildHDRIEnginePack as Kt}from"./hdriEnginePack-D90dAKr3.js";import{s as Zt}from"./supabaseClient-sffWuQ3N.js";import{d as yt}from"./worldLighting-Cs8WvcKd.js";import{X as Ge,q as Qt,Y as oe,a6 as xt,b as ve,eh as Le,V as ce,fU as $e,aw as mt,ay as Jt,aE as ye,aD as Pe,aA as er,as as Ue,en as _e,F as fe,f as ht,az as Ce,e as ge,c as me,a9 as Ke,aa as tr,Z as rr,v as or,Q as ar,fR as nr,D as Te,ad as sr,S as it,R as ir,B as cr,a as Ie,eK as vt,aR as Ze,H as Qe,aT as Je,aU as lr,aQ as et,c0 as dr,y as pr,W as ur,a7 as mr,c6 as hr,P as fr,aG as ft,ei as gr,eN as br,$ as Oe,L as wr,w as yr,ar as xr,U as vr,K as kr}from"./three.module-BZ7nkMkj.js";import{M as Sr}from"./hdri-DsNMFG4U.js";import{e as Mr}from"./rgbeEncoder-Cw6iYCGY.js";import{c as Rr,a as tt}from"./worldAnimatedSky-DP6sIjGI.js";import{mergeGeometries as Pr,mergeVertices as jr}from"./BufferGeometryUtils-DoiDggSv.js";import{P as Nr,a as Cr,b as zr}from"./popover-m61Lp99i.js";import{u as _r}from"./useWebMcpTools-CZx5Iwkm.js";import{r as He,a as rt,o as kt,b as Ae,c as Tr}from"./toolSupport-GhyEilG1.js";import{Z as Er}from"./toolDirectory-2fDnxDvB.js";import"./loadingAssets.generated-CP1z8LaS.js";import"./label-DLfc8iHM.js";import"./index-LUy1hCvC.js";import"./utils-LP6pax-4.js";import"./slider-HX7Z9GND.js";import"./index-BdQq_4o_.js";import"./index-DvM0x0iU.js";import"./index-VmSN9hoN.js";import"./index-CUxlOX4q.js";import"./index-DXh2eczi.js";import"./index-UQ17qT-9.js";import"./index-CInLAQeJ.js";import"./switch-CRzdaj5o.js";import"./accordion-CIVGY4TW.js";import"./index-J-fEf5dc.js";import"./index-BVp0Tdx7.js";import"./textarea-C94vs1vu.js";import"./select-Df_wPTwI.js";import"./index-Cw8VM0xs.js";import"./index-Cy9vfnzn.js";import"./index-Crioge1s.js";import"./index-T9Svog7G.js";import"./index-BD1hNHb3.js";import"./Combination-OKzzzLAb.js";import"./tslib.es6-CmEaCU22.js";import"./BabylonHDRIViewerCanvas-CtJRF3jS.js";import"./engine-DmXWGwEn.js";import"./thinEngine.pure-CD7O0cpz.js";import"./performanceConfigurator-cmuSgoC1.js";import"./timingTools-CleB5MpD.js";import"./tools.functions-24GcyPj6.js";import"./thinEngine-eEWGQ7kx.js";import"./abstractEngine.renderPass.pure-Bs92tsxW.js";import"./engine.dynamicBuffer.pure-Dlbjp1Hw.js";import"./sphericalPolynomial.pure-fqyzQv6A.js";import"./math.vector-DCgvxc91.js";
2import"./typeStore-NwCueW6e.js";import"./baseTexture.pure-Cm_6Nuk0.js";import"./decorators-OFRvS1Lw.js";import"./decorators.serialization-BPwgV9lK.js";import"./math.color-BKsq1Qv5.js";import"./math.size-F3xmSqZc.js";import"./scene-tY-ObsZa.js";import"./scene.pure-Cx9XSZ7l.js";import"./tools-DtbOIi0j.js";import"./instantiationTools-BAenXBEq.js";import"./smartArray-BsIpkRz3.js";import"./lightConstants-cISc88M3.js";import"./deviceInputEvents-DhiOQWdB.js";import"./math.plane-DnPL_XMS.js";import"./buffer-Bdetsybu.js";import"./buffer.pure-CMCUvHaY.js";import"./renderingManager-o-F6GSiA.js";import"./arcRotateCamera-Dc40VP45.js";import"./node-CVdk3oVr.js";import"./mesh.pure-d0LIYsOD.js";import"./mesh.vertexData-Bo-yiHrn.js";import"./subMesh.pure-BBMIRw4k.js";import"./drawWrapper-CNlMYq0q.js";import"./math.viewport-CgkTt1RS.js";import"./math.axis-EMgKXUND.js";import"./material.pure-CpFH7iqb.js";import"./textBuilder-DNg1YNhI.js";import"./texture.pure-CqF0q8Ma.js";import"./vertexPullingHelper.functions-_zdCPGJJ.js";import"./meshBuilder-D4apM4d2.js";import"./standardMaterial-Cy12FXAx.js";import"./imageProcessing-DwdPXtjV.js";import"./sharpenPostProcess-B8eMzYpg.js";import"./postProcess.pure-BNOQQPnr.js";import"./postprocess.vertex-K8vQUKJa.js";import"./postprocess.vertex-ROAKggzh.js";import"./texture-o43T8ty4.js";import"./FeedWatermarkOverlay-YQek-NxP.js";import"./visibleRenderLoop-DffrqbQ3.js";import"./customerCredits-fzzOpXTs.js";import"./subscriptionBilling-BI1IslSf.js";import"./entitlements-BFUQn2ph.js";import"./creditRolloutPromotion-BeC4YVJw.js";import"./AiUpscaleSelector-C4nNHYJ6.js";import"./imageResolutionLabels-oX2KYvHm.js";import"./CreditSpark-CFudovqi.js";import"./CreditActionCost-i_dl50Ll.js";import"./checkbox-BCC4QLQl.js";import"./durableGenerationStart-DdiDXPFh.js";import"./dialog-DAUMSarI.js";import"./PublicPageEditorial-CSTYn4uP.js";import"./minecraftTextureGeneratorSeo-CPaGt_3Y.js";import"./publicContentDates-4lAZ-sCY.js";import"./useGenerationLimitOfferPrompt-C0TaDUrI.js";import"./generationLimitToast-D-Hh91o0.js";import"./authRedirect-Epf4tCTr.js";import"./AuthContextCore-CO1D3YF1.js";import"./useFirstMonthPromotionAvailability-8NBIqbxO.js";import"./useUserPlan-Q9_V_b0e.js";import"./conversionTracking-DWcNFJCr.js";import"./offerExperimentTracking-IJOnvf1H.js";import"./toast-CFnhMuwi.js";import"./sessionOutputStore-BqZHYq2K.js";import"./react-CvJQA3jM.js";import"./vanilla-DtBHub2h.js";import"./textureStore-BJUb6yWA.js";import"./AppDialogContext-Cc-638fG.js";import"./useCustomerCredits-p--QIb4V.js";import"./CreditBalanceBadge-C-V0HPDy.js";import"./CreditPayerSelector-BB0v2a8E.js";import"./libraryUtils-BsAjwvuZ.js";import"./variantUtils-CqLSrtcK.js";import"./DownloadSizeSelector-Cz6Dc5FC.js";import"./adminAnalyticsEvents-sOfJXkMw.js";import"./downloadDimensions-u8pvg_Um.js";import"./dropdown-menu-DPPKuCOK.js";import"./index-BTmqkG-y.js";import"./feedDownloads-DYjIlhGL.js";import"./operationalErrorReporting-B2bVjo1G.js";import"./hdriUtils-Bw43r9IK.js";import"./hdriSeamCore-DLVqRx93.js";import"./seo-CpxjGMGC.js";import"./hdriSeo-hmy7BpYm.js";import"./toolWorkflowExamples.generated-ae0G73sM.js";import"./numericImageEncoders-oopQ6FaN.js";import"./browser-XZmX483V.js";import"./unifiedSeamEngine-NZtVYvnp.js";import"./generationUsage-C9TJRSaC.js";import"./WorkflowExampleGallery-CO2UZ5qF.js";import"./localWorkspaceStorage-BFBUEDZo.js";import"./hdriLighting-CHT9d2_R.js";import"./toolUtilityDirectory-BLGwZ856.js";import"./three.tsl-CCp2JOc7.js";const St=["neon-rim","warm-portrait","cool-editorial","celestial-nebula","chrome-cathedral"],ct=[...St,"porcelain-dawn","trade-wind","rosewater-dusk","arctic-veil","monsoon-shelf","copper-squall","ashfall","ember-crown","emerald-aurora","ion-vortex","waterfront-city","coastal-village","tropical-beach"],Ar=["All","Scenery","Atmosphere","Storm","Cosmic","Abstract"],Mt=["base","billowing","wispy","stormfront","smoke-plumes","firestorm","vortex"],Ir={type:"base",scale:.56,turbulence:.5,sharpness:.5,verticality:.5},de=(e,r,t,o)=>{const n=Number(e);return Math.min(t,Math.max(r,Number.isFinite(n)?n:o))},je=(e,r)=>typeof e=="string"&&/^#[0-9a-f]{6}$/i.test(e.trim())?e.trim().toLowerCase():r,Ne=(e,r,t,o,n,p)=>{const R=yt(e);return{version:1,name:r,prompt:t,preset:e,palette:{zenith:R.backdropTop,horizon:R.backdropHorizon,ground:R.backdropBottom,key:R.keyColor,rim:R.rimColor},motion:o,atmosphere:n,formation:{...Ir},seed:p,source:"preset"}},be=[{id:"neon-rim",basePreset:"neon-rim",category:"Cosmic",label:"Neon Rim",description:"Magenta and cyan aurora ribbons with a restrained star field.",recipe:Ne("neon-rim","Neon Rim","Electric cyan and violet aurora ribbons above a midnight horizon, slow fluid motion.",{speed:.62,detail
2:.76,glow:.72},{coverage:.58,brightness:.82,horizon:.46},92817)},{id:"warm-portrait",basePreset:"warm-portrait",category:"Atmosphere",label:"Golden Drift",description:"A glowing sunset horizon beneath slowly drifting warm clouds.",recipe:Ne("warm-portrait","Golden Drift","Long golden-hour clouds drifting over a warm cinematic horizon.",{speed:.42,detail:.64,glow:.58},{coverage:.64,brightness:.72,horizon:.55},52041)},{id:"cool-editorial",basePreset:"cool-editorial",category:"Atmosphere",label:"Blue Hour",description:"Steel-blue cloudlight with a quiet, low-contrast horizon.",recipe:Ne("cool-editorial","Blue Hour","Deep blue-hour clouds rolling gently across a cool glassy horizon.",{speed:.35,detail:.68,glow:.38},{coverage:.72,brightness:.7,horizon:.52},73120)},{id:"celestial-nebula",basePreset:"celestial-nebula",category:"Cosmic",label:"Nebula Bloom",description:"Cyan-violet stellar dust folding around a radiant core.",recipe:Ne("celestial-nebula","Nebula Bloom","A luminous violet and cyan nebula blooming around a bright stellar dust core.",{speed:.54,detail:.84,glow:.78},{coverage:.68,brightness:.86,horizon:.5},30296)},{id:"chrome-cathedral",basePreset:"chrome-cathedral",category:"Abstract",label:"Liquid Chrome",description:"Mirror-like arches flowing through cold cyan and hot magenta light.",recipe:Ne("chrome-cathedral","Liquid Chrome","Impossible liquid chrome vaults flowing overhead with cyan and magenta reflections.",{speed:.5,detail:.8,glow:.66},{coverage:.62,brightness:.9,horizon:.52},44519)},...[{id:"porcelain-dawn",label:"Porcelain Dawn",category:"Atmosphere",basePreset:"warm-portrait",description:"Feathered ivory clouds over a pale peach horizon, with a slow, soft drift.",palette:{zenith:"#597a9c",horizon:"#edc7ad",ground:"#302f40",key:"#fff2d6",rim:"#a8dce8"},motion:{speed:.18,detail:.46,glow:.3},atmosphere:{coverage:.34,brightness:.94,horizon:.57},formation:{type:"wispy",scale:.32,turbulence:.22,sharpness:.38,verticality:.18},seed:18463},{id:"trade-wind",label:"Trade Wind",category:"Atmosphere",basePreset:"warm-portrait",rendererPreset:"high-key-white",description:"Bright billowing clouds crossing a turquoise sky with warm sunlight and crisp edges.",palette:{zenith:"#176a9e",horizon:"#98dce3",ground:"#194758",key:"#fff4da",rim:"#d3faff"},motion:{speed:.58,detail:.58,glow:.24},atmosphere:{coverage:.46,brightness:1,horizon:.6},formation:{type:"billowing",scale:.76,turbulence:.42,sharpness:.64,verticality:.72},seed:26794},{id:"rosewater-dusk",label:"Rosewater Dusk",category:"Atmosphere",basePreset:"warm-portrait",description:"Long rose and lavender cloud ribbons catching the last apricot light.",palette:{zenith:"#473367",horizon:"#d8819e",ground:"#251d3b",key:"#ffd1a8",rim:"#e8a7ef"},motion:{speed:.26,detail:.72,glow:.48},atmosphere:{coverage:.58,brightness:.78,horizon:.48},formation:{type:"wispy",scale:.82,turbulence:.56,sharpness:.84,verticality:.24},seed:38512}
2,{id:"arctic-veil",label:"Arctic Veil",category:"Atmosphere",basePreset:"cool-editorial",description:"Fine silver-blue veils stretched across an icy horizon in a quiet polar twilight.",palette:{zenith:"#102b4d",horizon:"#88adb6",ground:"#0b202c",key:"#e0f8ff",rim:"#8ff0db"},motion:{speed:.12,detail:.9,glow:.22},atmosphere:{coverage:.4,brightness:.72,horizon:.63},formation:{type:"wispy",scale:.48,turbulence:.18,sharpness:.9,verticality:.12},seed:49627},{id:"monsoon-shelf",label:"Monsoon Shelf",category:"Storm",basePreset:"cool-editorial",description:"A dense charcoal shelf cloud rolling above a low, green-gray horizon.",palette:{zenith:"#111f2b",horizon:"#526e69",ground:"#071217",key:"#b3cdc4",rim:"#87bcbd"},motion:{speed:.68,detail:.78,glow:.18},atmosphere:{coverage:.92,brightness:.46,horizon:.64},formation:{type:"stormfront",scale:.9,turbulence:.86,sharpness:.82,verticality:.38},seed:57831},{id:"copper-squall",label:"Copper Squall",category:"Storm",basePreset:"warm-portrait",description:"Turbulent indigo storm banks edged in copper light above a burning sunset.",palette:{zenith:"#23283e",horizon:"#b05a36",ground:"#21171e",key:"#ffc477",rim:"#f58a50"},motion:{speed:.78,detail:.66,glow:.62},atmosphere:{coverage:.84,brightness:.64,horizon:.54},formation:{type:"stormfront",scale:.64,turbulence:.94,sharpness:.7,verticality:.7},seed:61948},{id:"ashfall",label:"Ashfall",category:"Storm",basePreset:"cool-editorial",description:"Tall soot-gray smoke plumes rising through a muted, sulfur-colored haze.",palette:{zenith:"#24282b",horizon:"#7b7261",ground:"#171718",key:"#c5b990",rim:"#8c9b9c"},motion:{speed:.32,detail:.82,glow:.12},atmosphere:{coverage:.88,brightness:.52,horizon:.58},formation:{type:"smoke-plumes",scale:.84,turbulence:.78,sharpness:.56,verticality:.98},seed:70256},{id:"ember-crown",label:"Ember Crown",category:"Storm",basePreset:"warm-portrait",description:"A crown of golden flame tongues and crimson smoke against a dark volcanic sky.",palette:{zenith:"#210c20",horizon:"#9c291d",ground:"#120b10",key:"#ffd077",rim:"#ff471c"},motion:{speed:.88,detail:.86,glow:.9},atmosphere:{coverage:.8,brightness:.62,horizon:.5},formation:{type:"firestorm",scale:.82,turbulence:.92,sharpness:.8,verticality:.94},seed:81635},{id:"emerald-aurora",label:"Emerald Aurora",category:"Cosmic",basePreset:"neon-rim",description:"Jade and mint aurora curtains with fine luminous wisps over a deep polar night.",palette:{zenith:"#052a27",horizon:"#0a3e41",ground:"#020d18",key:"#5bffba",rim:"#b1f77c"},motion:{speed:.38,detail:.62,glow:.76},atmosphere:{coverage:.5,brightness:.7,horizon:.44},formation:{type:"wispy",scale:.72,turbulence:.64,sharpness:.7,verticality:.34},seed:90372},{id:"ion-vortex",label:"Ion Vortex",category:"Cosmic",basePreset:"celestial-nebula",description:"Electric blue and coral plasma spiraling through a dark stellar cloud.",palette:{zenith:"#101039",horizon:"#273777",ground:"#050519",key:"#74e9ff",rim:"#ff8eae"},motion:{speed:.74,detail:.92,glow:.88},atmosphere:{coverage:.74,brightness:.82,horizon:.42},formation:{type:"vortex",scale:.92,turbulence:.88,sharpness:.76,verticality:.68},seed:95746},{id:"waterfront-city",label:"Waterfront City",category:"Scenery",basePreset:"cool-editorial",scenery:"waterfront-city",description:"A blue-hour harbor with a layered illuminated skyline, rooftop details, rippling reflections, and a stone promenade.",palette:{zenith:"#142e52",horizon:"#9d8a92",ground:"#152630",key:"#f4c5a4",rim:"#87bcd5"},motion:{speed:.24,detail:.65,glow:.45},atmosphere:{coverage:.3,brightness:.7,horizon:.5},formation:{type:"wispy",scale:.25,turbulence:.2,sharpness:.4,verticality:.2},seed:41081},{id:"coastal-village",label:"Coastal Village",category:"Scenery",basePreset:"warm-portrait",rendererPreset:"high-key-white",scenery:"coastal-village",description:"A sunlit Mediterranean harbor with tiled roofs, shuttered houses, balconies, cafe awnings, boats, and waterfront trees.",palette:{zenith:"#3785b2",horizon:"#bfd8d6",ground:"#677a73",key:"#fff0ca",rim:"#c1e7ea"},motion:{speed:.18,detail:.62,glow:.25},atmosphere:{coverage:.3,brightness:.88,horizon:.5},formation:{type:"base",scale:.5,turbulence:.4,sharpness:.5,verticality:.5},seed:62039}
2,{id:"tropical-beach",label:"Tropical Beach",category:"Scenery",basePreset:"warm-portrait",rendererPreset:"high-key-white",scenery:"tropical-beach",description:"An open turquoise bay with rolling shoreline foam, textured sand, feathered palms, dune grass, rocks, and distant headlands.",palette:{zenith:"#287fb6",horizon:"#b8dfe9",ground:"#6a9c9c",key:"#fff5dc",rim:"#c9f2ed"},motion:{speed:.34,detail:.58,glow:.3},atmosphere:{coverage:.24,brightness:.95,horizon:.5},formation:{type:"base",scale:.5,turbulence:.4,sharpness:.5,verticality:.5},seed:83027}].map(({palette:e,motion:r,atmosphere:t,formation:o,seed:n,...p})=>({...p,recipe:{version:1,name:p.label,prompt:p.description,preset:p.id,palette:e,motion:r,atmosphere:t,formation:o,seed:n,source:"preset"}}))],ue=be[0].recipe;function J(e){return be.find(r=>r.id===e)||be[0]}function Be(e){return e==="base"?"Original":e.split("-").map(r=>`${r.charAt(0).toUpperCase()}${r.slice(1)}`).join(" ")}function Dr(e){const r=e.toLowerCase();return/\b(fire|fiery|flame|flames|burning|inferno|lava|ember|embers)\b/.test(r)?{type:"firestorm",scale:.82,turbulence:.92,sharpness:.76,verticality:.9}:/\b(smoke|smoky|ash|soot|plume|plumes)\b/.test(r)?{type:"smoke-plumes",scale:.74,turbulence:.86,sharpness:.58,verticality:.94}:/\b(vortex|spiral|swirl|swirling|cyclone|hurricane|tornado)\b/.test(r)?{type:"vortex",scale:.78,turbulence:.9,sharpness:.68,verticality:.72}:/\b(storm|stormy|thunder|thunderhead|squall|tempest|shelf cloud)\b/.test(r)?{type:"stormfront",scale:.72,turbulence:.8,sharpness:.74,verticality:.46}:/\b(wisp|wispy|cirrus|streak|streaked|feathered|silky)\b/.test(r)?{type:"wispy",scale:.62,turbulence:.5,sharpness:.78,verticality:.28}:{type:"billowing",scale:.66,turbulence:.68,sharpness:.56,verticality:.62}}function Re(e,r=ue){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},o=typeof t.preset=="string"&&ct.includes(t.preset)?t.preset:r.preset,n=J(o).recipe,p=t.palette&&typeof t.palette=="object"?t.palette:{},R=t.motion&&typeof t.motion=="object"?t.motion:{},A=t.atmosphere&&typeof t.atmosphere=="object"?t.atmosphere:{},j=typeof t.name=="string"?t.name.trim().slice(0,48):"",L=typeof t.prompt=="string"?t.prompt.trim().slice(0,600):"",P=t.source==="sol"?"sol":"preset",U=P==="sol"?Dr(L||r.prompt||n.prompt):n.formation,k=t.formation&&typeof t.formation=="object"?t.formation:{},v=typeof k.type=="string"&&Mt.includes(k.type)?k.type:U.type,D=P==="sol"&&v==="base"?U.type:v;return{version:1,name:j||n.name,prompt:L||(r.preset===o?r.prompt:n.prompt),preset
2:o,palette:{zenith:je(p.zenith,n.palette.zenith),horizon:je(p.horizon,n.palette.horizon),ground:je(p.ground,n.palette.ground),key:je(p.key,n.palette.key),rim:je(p.rim,n.palette.rim)},motion:{speed:de(R.speed,.05,1,n.motion.speed),detail:de(R.detail,.05,1,n.motion.detail),glow:de(R.glow,0,1,n.motion.glow)},atmosphere:{coverage:de(A.coverage,.1,.95,n.atmosphere.coverage),brightness:de(A.brightness,.2,1,n.atmosphere.brightness),horizon:de(A.horizon,.28,.72,n.atmosphere.horizon)},formation:{type:D,scale:de(k.scale,.05,1,U.scale),turbulence:de(k.turbulence,0,1,U.turbulence),sharpness:de(k.sharpness,0,1,U.sharpness),verticality:de(k.verticality,0,1,U.verticality)},seed:Math.round(de(t.seed,1,999999,n.seed)),source:P}}function ot(e){const r=J(e.preset),t=yt(r.rendererPreset??r.basePreset);return{...t,backdropTop:e.palette.zenith,backdropHorizon:e.palette.horizon,backdropBottom:e.palette.ground,backdropIntensity:t.backdropIntensity*(.72+e.atmosphere.brightness*.36),horizonHeight:e.atmosphere.horizon,environmentIntensity:.25+e.motion.glow*.82,keyColor:e.palette.key,rimColor:e.palette.rim,rotation:e.seed%360}}function Gr(e,r,t){const o=.64+t*1.18;return[Math.max(1,Math.round(e*o)),r*o]}function at(e,r){var n;if(!(e instanceof Ge))return;const t=e.uniforms,o=(p,R)=>{var j;const A=(j=t[p])==null?void 0:j.value;A instanceof oe&&A.set(R)};if(o("uZenith",r.palette.zenith),o("uHorizon",r.palette.horizon),o("uBottom",r.palette.ground),o("uKeyColor",r.palette.key),o("uRimColor",r.palette.rim),St.includes(r.preset)||(o("uCloudShadow",r.palette.zenith),o("uCloudLight",r.palette.key)),t.uSpeed&&(t.uSpeed.value*=.45+r.motion.speed*1.8),((n=t.uCloudScale)==null?void 0:n.value)instanceof Qt){const p=t.uCloudScale.value,[R,A]=Gr(p.x,p.y,r.motion.detail);p.set(R,A)}t.uCoverage&&(t.uCoverage.value=.72-r.atmosphere.coverage*.42),t.uCloudOpacity&&(t.uCloudOpacity.value*=.58+r.motion.glow*.72),t.uSunStrength&&(t.uSunStrength.value*=.52+r.motion.glow*1.08),t.uBackdropIntensity&&(t.uBackdropIntensity.value*=.84+r.atmosphere.brightness*.2),t.uFormationType&&(t.uFormationType.value=Mt.indexOf(r.formation.type)),t.uFormationScale&&(t.uFormationScale.value=r.formation.scale),t.uFormationTurbulence&&(t.uFormationTurbulence.value=r.formation.turbulence),t.uFormationSharpness&&(t.uFormationSharpness.value=r.formation.sharpness),t.uFormationVerticality&&(t.uFormationVerticality.value=r.formation.verticality),e.needsUpdate=!0}function Fr(e,r,t){return Re({...e,motion:{...e.motion,[r]:t}},e)}class Ye extends Error{constructor(t,o=null){super(t);pt(this,"status");this.name="ProceduralSkyGenerationError",this.status=o}}const Lr=async e=>{const r=e&&typeof e=="object"?e.context:null;if(r instanceof Response)try{const t=await r.clone().json();return{message:(typeof t.error=="string"?t.error.trim():"")||"The procedural recipe service rejected this request.",status:r.status}}catch{return{message:"The procedural recipe service rejected this request.",status:r.status}}return{message:e instanceof Error&&e.message.trim()?e.message.trim():"Could not reach the procedural recipe service.",status:null}};async function $r(e){const r=crypto.randomUUID(),{data:t,error:o}=await Zt.functions.invoke("generate-procedural-sky",{body:{description:e.description.trim(),currentPreset:J(e.currentPreset).basePreset,creditRequestId:r,payerKind:e.payerKind||"personal",billingWorkspaceId:e.billingWorkspaceId||null}});if(o){const n=await Lr(o);throw new Ye(n.message,n.status)}if(t!=null&&t.error)throw new Ye(t.error);if(!(t!=null&&t.recipe))throw new Ye("Sol returned an empty sky recipe. Please try again.");return{recipe:Re({...t.recipe,source:"sol"},e.fallback),usage:t.usage||{},credits:t.credits||{}}}function Rt(e){let r=e>>>0;return()=>(r=Math.imul(1664525,r)+1013904223>>>0,r/4294967296)}function Ur(e,r,t){const o=document.createElement("canvas");o.width=512,o.height=e==="facade"||e==="emission"?1024:512;const n=o.getContext("2d");if(!n)throw new Error("Scenery textures require a 2D canvas.");const p=Rt(r);n.fillStyle=e==="sand"?"#e1cba3":e==="roof"?"#b87555":e==="facade"||e==="emission"?"#253c4a":e==="wood"?"#a58a66":e==="plaster"?"#eee8dc":"#b7b3a9",n.fillRect(0,0,o.width,o.height);const R=n.getImageData(0,0,o.width,o.height);for(let j=0;j<R.data.length;j+=4){const L=(p()-.5)*(e==="sand"?34:18);for(let P=0;P<3;P++)R.data[j+P]+=L}if(n.putImageData(R,0,0),e==="facade"||e==="emission"){e==="emission"&&(n.fillStyle="#000",
2n.fillRect(0,0,512,1024));for(let j=0;j<32;j++){const L=p()>.34;for(let P=0;P<12;P++){const U=t&&p()>(L?.42:.96),k=P*42.667+5,v=j*32+4,D=U?["#d5a96c","#a8bec3","#b9824c"][Math.floor(p()*3)]:["#091822","#0e2633","#16333e"][Math.floor(p()*3)];n.fillStyle=e==="emission"&&!U?"#000":D,n.fillRect(k,v,32,23),n.fillStyle="rgba(3,8,14,0.5)",n.fillRect(k+15,v,1,23),p()>.5&&n.fillRect(k,v+5,32,2+p()*8),n.fillStyle=e==="emission"?"#000":"rgba(255,255,255,0.12)",n.fillRect(k,v,32,1)}}}else if(e==="wood")for(let j=0;j<650;j++){n.strokeStyle=`rgba(50,30,15,${.03+p()*.12})`,n.beginPath();const L=p()*512;n.moveTo(L,0),n.bezierCurveTo(L+8,160,L-8,340,L,512),n.stroke()}else if(e==="sand")for(let j=0;j<32;j++){n.strokeStyle="rgba(112,87,53,0.055)",n.lineWidth=2,n.beginPath();for(let L=0;L<=512;L+=8)n.lineTo(L,j*16+Math.sin(L/512*Math.PI*4)*4);n.stroke()}else if(e!=="plaster"){const j=e==="roof"?24:12,L=e==="roof"?12:8;for(let P=0;P<j;P++)for(let U=-1;U<L;U++){const k=512/L,v=512/j,D=(U+P%2*.5)*k;n.fillStyle=`rgba(0,0,0,${.025+p()*.14})`,n.fillRect(D,P*v,k-1,v-2),n.strokeStyle="rgba(28,23,19,0.2)",n.strokeRect(D,P*v,k,v),n.fillStyle="rgba(255,241,208,0.2)",n.fillRect(D+1,P*v+1,k-2,1)}}const A=new sr(o);return A.colorSpace=it,A.wrapS=A.wrapT=ir,A.anisotropy=8,A}const Or=`
3  varying vec3 vWorld;
4  void main() {
5    vWorld = (modelMatrix * vec4(position, 1.0)).xyz;
6    gl_Position = projectionMatrix * viewMatrix * vec4(vWorld, 1.0);
7  }
8`,Hr=`
9  uniform float uTime;
10  uniform float uKind;
11  uniform samplerCube uReflection;
12  uniform vec3 uDeep;
13  uniform vec3 uShallow;
14  uniform vec3 uSunColor;
15  uniform vec3 uSunDirection;
16  varying vec3 vWorld;
17  float hash(vec2 p) { return fract(sin(dot(p, vec2(127.1,311.7))) * 43758.5453); }
18  float noise(vec2 p) {
19    vec2 i=floor(p), f=fract(p); f=f*f*(3.0-2.0*f);
20    return mix(mix(hash(i),hash(i+vec2(1,0)),f.x),mix(hash(i+vec2(0,1)),hash(i+vec2(1,1)),f.x),f.y);
21  }
22  void main() {
23    vec2 p=vWorld.xz;
24    float shore = uKind < 0.5 ? min(-7.0-p.y, p.y+165.0)
25      : uKind < 1.5 ? -p.x - 18.0 + sin(p.y*0.025)*4.0
26      : -p.y-9.0+sin(p.x*0.045)*8.0;
27    if (shore < 0.0) discard;
28    float t=uTime*0.35;
29    float fade=1.0/(1.0+length(p)*0.018);
30    vec2 ripple=vec2(sin(p.x*0.62+p.y*0.33+t),cos(p.y*0.75-p.x*0.27+t*1.3));
31    ripple+=0.5*vec2(sin(p.x*1.57-p.y*1.31-t*1.4),cos(p.x*1.24+p.y*1.65+t));
32    vec3 normal=normalize(vec3(ripple.x*0.018*fade,1.0,ripple.y*0.028*fade));
33    vec3 view=normalize(cameraPosition-vWorld);
34    vec3 reflectionDirection=reflect(-view,normal);
35    reflectionDirection.y=max(reflectionDirection.y,0.006);
36    vec3 r=normalize(reflectionDirection);
37    // Integrate a small reflection footprint to suppress sparkling window aliases.
38    float blur=.0015+min(.006,length(p)*.000025);
39    vec3 reflected=textureCube(uReflection,r).rgb*.4;
40    reflected+=textureCube(uReflection,normalize(r+vec3(blur,0.,0.))).rgb*.15;
41    reflected+=textureCube(uReflection,normalize(r-vec3(blur,0.,0.))).rgb*.15;
42    reflected+=textureCube(uReflection,normalize(r+vec3(0.,blur,0.))).rgb*.15;
43    reflected+=textureCube(uReflection,normalize(r-vec3(0.,blur,0.))).rgb*.15;
44    float fresnel=0.035+0.965*pow(1.0-max(dot(view,normal),0.0),5.0);
45    vec3 water=mix(uShallow,uDeep,smoothstep(0.0,85.0,shore));
46    water*=0.86+noise(p*0.35)*0.18;
47    vec3 color=mix(water,reflected,0.12+fresnel*0.8);
48    float sparkle=pow(max(dot(reflect(-uSunDirection,normal),view),0.0),220.0);
49    color+=uSunColor*sparkle*2.0;
50    if(uKind>1.5) {
51      float wave=sin(shore*1.5-t*2.4+noise(p*0.16)*1.2);
52      float foam=smoothstep(0.45,0.92,wave)*(1.0-smoothstep(0.2,13.0,shore));
53      foam*=0.4+0.6*smoothstep(0.2,0.67,noise(p*3.0));
54      foam=max(foam,(1.0-smoothstep(0.0,0.8,shore))*.8);
55      float caustic=pow(1.0-abs(sin(p.x*1.8+noise(p*.7)*5.0)*sin(p.y*1.5+t)),12.0);
56      color+=uShallow*caustic*.16*(1.0-smoothstep(0.0,24.0,shore));
57      color=mix(color,vec3(0.86,0.94,0.92),foam*0.85);
58    }
59    gl_FragColor=vec4(color,1.0);
60    #include <tonemapping_fragment>
61    #include <colorspace_fragment>
62  }
63`;function Pt(e,r){const t=Rt(r),o=e==="waterfront-city",n=e==="tropical-beach",p=new xt;p.name=`PLAYTEX AI ${e} scenery`;const R=[],A=[],j=new Map,L=(w,b=0)=>{const y=Ur(w,r+b,o);return R.push(y),y},P=w=>{const b=new rr(w);return A.push(b),b},U=L("stone"),k=L("roof",1),v=L("plaster",2),D=P({color:o?"#747f83":"#e4d9c0",map:U,roughness:.86,bumpMap:U,bumpScale:.08}),Q=P({color:"#d9a488",map:k,roughness:.85,bumpMap:k,bumpScale:.12}),_=P({color:"#344647",metalness:.6,roughness:.38}),ee=L("wood",4),B=P({color:"#bba486",map:ee,bumpMap:ee,bumpScale:.035,roughness:.82}),Y=P({color:"#efe6cf",roughness:.7}),te=P({color:"#b5afa0",vertexColors:!0,map:v,bumpMap:v,bumpScale:.15,roughness:.95}),K=P({color:o?"#729aaf":"#356876",metalness:.4,roughness:.24,emissive:o?"#d1ad73":"#080f13",emissiveIntensity:o?.8:.1}
63),q=["#3b5930","#536b36","#667844","#2b513d"].map(w=>P({color:w,roughness:.92,side:Te})),Z=["#fff3d9","#e8b39a","#fffdf0","#edc182","#bacebc","#efc7b4"].map(w=>P({color:w,roughness:.92,map:v,bumpMap:v,bumpScale:.025})),z=(w,b,y,d,s,u=1,l=1,x=1,i=0)=>{const g=new or().compose(new ce(y,d,s),new ar().setFromAxisAngle(new ce(0,1,0),i),new ce(u,l,x));w.applyMatrix4(g);const h=j.get(b)??[];h.push(w),j.set(b,h)},f=(w,b,y,d,s,u,l,x=0,i=1,g=i)=>{const h=new Ue(1,1,1);if(i!==1){const I=h.attributes.uv,O=h.attributes.normal;for(let $=0;$<I.count;$++){const H=Math.abs(O.getY($))>.5,N=Math.abs(O.getX($))>.5;I.setXY($,I.getX($)*(N?l:s)/i,I.getY($)*(H?l:u)/g)}}z(h,w,b,y,d,s,u,l,x)},G=(w,b,y,d,s,u)=>z(new Pe(s*.8,s,u,8),w,b,y,d),X=(w,b,y,d)=>{const s=new ye(1,4),u=jr(s);s.dispose();const l=u.attributes.position,x=[];for(let i=0;i<l.count;i++){const g=.88+.12*Math.sin(l.getX(i)*3+l.getY(i)*5+l.getZ(i)*4)+.035*Math.sin(l.getY(i)*19+l.getX(i)*7),h=.7+.24*(l.getY(i)*.5+.5)+.06*Math.sin(l.getX(i)*27+l.getZ(i)*13);x.push(h,h,h*.97),l.setXYZ(i,l.getX(i)*g,l.getY(i)*g,l.getZ(i)*g)}u.setAttribute("color",new fe(x,3)),u.computeVertexNormals(),z(u,te,w,b,y,d*1.4,d,d,t()*6.28)},W=(w,b,y,d=!1,s=-2.1)=>{if(!d){G(B,w,s+y*.4,b,y*.035,y*.8);for(let i=0;i<5;i++){const g=i*2.4;z(new ye(1,2),q[i%q.length],w+Math.cos(g)*y*.16,s+y*(.65+i%3*.12),b+Math.sin(g)*y*.16,y*.27,y*.31,y*.27)}return}const u=(t()-.5)*y*.35,l=new Le([new ce(w,s,b),new ce(w+u*.2,s+y*.5,b),new ce(w+u,s+y,b+y*.08)]);z(new $e(l,14,y*.025,7,!1),B,0,0,0);for(let i=1;i<14;i++){const g=l.getPoint(i/14);z(new nr(y*.0255,y*.002,3,7).rotateX(Math.PI/2),B,g.x,g.y,g.z)}const x=l.getPoint(1);for(let i=0;i<15;i++){const g=i*Math.PI*2/15+t()*.3,h=y*(.32+t()*.18),I=[],O=[],$=c=>new ce(x.x+Math.cos(g)*h*c,x.y+h*(.32*Math.sin(c*Math.PI)-.35*c*c),x.z+Math.sin(g)*h*c),H=new Le(Array.from({length:8},(c,m)=>$(m/7)));z(new $e(H,16,y*.0016,3,!1),q[1],0,0,0);for(let c=1;c<28;c++){const m=c/29;for(const M of[-1,1]){const F=$(m),V=$(m+.03),ie=Math.pow(Math.sin(Math.PI*m),.7)*h*(.19+t()*.04)*M,le=$(Math.min(1.06,m+.14));le.x-=Math.sin(g)*ie,le.z+=Math.cos(g)*ie,le.y-=Math.abs(ie)*.4;const ae=F.clone().lerp(le,.45);ae.y+=h*.018;const Se=ae.clone().addScaledVector(new ce(Math.cos(g),0,Math.sin(g)),h*.028);I.push(...F.toArray(),...ae.toArray(),...V.toArray(),...V.toArray(),...ae.toArray(),...Se.toArray(),...ae.toArray(),...le.toArray(),...Se.toArray()),O.push(0,m,.5,m,0,m+.018,0,m+.018,.5,m,.5,m+.018,.5,m,1,m,.5,m+.018)}}const N=new ht;N.setAttribute("position",new fe(I,3)),N.setAttribute("uv",new fe(O,2)),N.computeVertexNormals(),z(N,q[i%q.length],0,0,0)}},se=(w,b)=>{G(_,w,0,b,.065,4.5),f(_,w,2.2,b,.6,.12,.6),f(K,w,1.94,b,.38,.45,.38),z(new _e(.45,.32,4),_,w,2.42,b,1,1,1,Math.PI/4)};if(o){f(D,0,-2.7,-150,1800,1,1600,0,8),f(D,0,-2.15,6,420,.25,25,0,5),f(D,0,-2.05,-6.6,420,.4,.7);const w=Array.from({length:7},(d,s)=>{const u=L("facade",s+8),l=L("emission",s+8);return P({map:u,color:["#b9d2db","#aaaebd","#93b6c2","#aab5ae"][s%4],emissiveMap:l,emissive:"#fff1d5",emissiveIntensity:.85,roughness:.38,metalness:.05})});for(let d=0;d<3;d++)for(let s=0;s<23;s++){const u=(s-11)*30+(t()-.5)*10,l=-240-d*68+t()*15,x=11+t()*14,i=12+t()*20,g=Math.max(0,1-Math.abs(u+85)/160),h=16+t()*44+g*t()*70+d*6,I=w[(s+d)%w.length];f(I,u,h/2-2,l,x,h,i,0,38,105),f(_,u,h-1.6,l,x+.3,.65,i+.3),t()>.4&&(f(I,u,h+3,l,x*.65,8,i*.7,0,30,90),G(_,u,h+12,l,.18,14));for(let O=0;O<3;O++)f(_,u+(O-1)*x*.2,h+.2,l+i*.2,1.8,2,2.5);f(D,u,0,l+i*.5+2,x+3,4.5,5)}for(let d=0;d<4;d++){const s=28-d*5,u=d===0?118:12,l=d===0?57:116+(d-.5)*12;f(w[2],-74,l,-288,s,u,s*.85,0,38,105),f(Y,-74,l+u/2,-288,s+.5,.5,s*.85+.5)}G(_,-74,162,-288,.3,24);const b=P({color:"#ffd49a",emissive:"#ffbf77",emissiveIntensity:3});z(new ve(.65,8,6),b,-74,174,-288),f(D,0,-1.2,-166,800,2.4,5,0,5);for(let d=-32;d<=32;d++)f(b,d*12,.2,-163,1.4,.3,.3);const y=new Le(Array.from({length:33},(d,s)=>{const u=s/32;return new ce(70+u*145,3+Math.sin(u*Math.PI)*7,-178)}));z(new $e(y,64,.65,8,!1),D,0,0,0);for(let d=0;d<=32;d++){const s=y.getPoint(d/32);G(_,s.x,s.y+1.1,s.z,.08,2),z(new ve(.14,6,4),b,s.x,s.y+2.1,s.z)}for(let d=-42;d<=42;d++)G(_,d*5,-1.05,-6.2,.045,1.8);f(_,0,-.15,-6.2,420,.075,.075),f(_,0,-.9,-6.2,420,.035,.035);for(let d=-12;d<=12;d++)d!==0&&se(d*15,-5),Math.abs(d)>1&&(W(d*16,17,7+t()*3),f(B,d*15+3,-1.15,4,2.4,.12,.55),f(B,d*15+3,-.7,4.3,2.4,.6,.1),G(_,d*15+2.1,-1.7,4,.05,1),G(_,d*15+3.9,-1.7,4,.05,1));for(let d=-8;d<=8;d++){const s=60+t()*25;f(w[Math.abs(d)%7],d*22,5,s,16,14,18,0,30,90),f(D,d*22,12.2,s,17,.6,19)}}else if(n){const w=(i,g)=>{const h=g+9-Math.sin(i*.045)*8;return-2.3+(Math.max(0,g-18)*.006+Math.sin(i*.017)*Math.sin(g*.023)*Math.min(4,Math.max(0,g)*.045))+Math.min(.22,Math.max(0,h)*.016)},b=L("sand"),y=P({map:b,color:"#fff6e3",vertexColors:!0,roughness:.96,bumpMap:b,bumpScale:.045}),d=new Ce(1800,1600,240,220).rotateX(-Math.PI/2),s=d.attributes.position,u=d.attributes.uv,l=[];for(let i=0;i<s.count;i++){const g=s.getX(i),h=s.getZ(i),I=h+9-Math.sin(g*.045)*8;s.setY(i,w(g,h)),u.setXY(i,g/6,h/6);const O=1-ge.smoothstep(I,0,9),$=new oe("#fff5df").lerp(new oe("#9c8d70"),O*.65);l.push($.r,$.g,$.b)}d.setAttribute("color",new fe(l,3)),d.computeVertexNormals(),z(d,y,0,0,0),W(-11,-12,11,!0),W(18,-8,13,!0),W(24,-11,10,!0);for(let i=0;i<12;i++){const g=24+i*3.8,h=-48-Math.sin(i*.2)*16,I=2.2+Math.sin(i/12*Math.PI)*3.5;
63if(X(g,-1.4,h,I),i%3===0){W(g+1,h+2,9+t()*4,!0,1.1);for(let O=0;O<9;O++){const $=O*2.4;z(new ye(1,2),q[O%4],g+Math.sin($)*2.4,1.2+O%3*.4,h+3+Math.cos($)*1.7,1.7,1.2,1.5)}}}for(let i=0;i<90;i++){const h=(i%2?1:-1)*(20+t()*220),I=12+t()*110,O=w(h,I);if(W(h,I,8+t()*8,!0,O-.1),i%2===0)for(let $=0;$<6;$++){const H=h+Math.sin($*2.4)*2,N=I+Math.cos($*2.4)*2;z(new ye(1,2),q[$%4],H,w(H,N)+.65,N,1.5,.9,1.4)}}for(let i=0;i<60;i++){const g=i%2?1:-1;X(g*(28+t()*210),-1.9,-5+t()*30,.25+t()*1.6)}for(let i=0;i<900;i++){const g=(t()-.5)*450,h=8+t()*80;Math.abs(g)<15&&h<25||z(new _e(.1,.5+t()*.6,3),q[i%4],g,w(g,h)+.3,h,1,1,1,t()*6.28)}const x=P({vertexColors:!0,roughness:1});for(const i of[-1,1]){const g=new Ce(620,340,72,40).rotateX(-Math.PI/2),h=g.attributes.position,I=[];for(let O=0;O<h.count;O++){const $=h.getX(O),H=h.getZ(O),N=Math.pow(Math.max(0,Math.cos($/620*Math.PI)*Math.cos(H/340*Math.PI)),1.5),c=48+15*Math.sin($*.026+i)+9*Math.sin($*.063+H*.035),m=N*c-4;h.setY(O,m);const M=ge.smoothstep(m,2,13),F=.88+.12*Math.sin($*.41+H*.27),V=new oe("#8f9686").lerp(new oe("#365c46"),M).multiplyScalar(F);I.push(V.r,V.g,V.b)}g.setAttribute("color",new fe(I,3)),g.computeVertexNormals(),z(g,x,i*575,0,-460,1,1,1,i*.25)}}else{const w=["#426d6b","#5c7776","#56705a"].map(s=>P({color:s,map:ee,roughness:.85})),b=["#bc406f","#de728f","#f5d6b7"].map(s=>P({color:s,roughness:.85}));f(D,260,-2.7,0,570,1,1400,0,6),f(D,-13,-2.08,0,8,.24,350,0,3),f(D,-17,-1.8,0,.6,.7,350);for(let s=0;s<3;s++)for(let u=-7;u<=7;u++){if(s===0&&u===3)continue;const l=8+s*24+t()*3,x=u*16-40+t()*4,i=8+t()*4,g=8+t()*3,h=6+Math.floor(t()*3)*2.8;f(Z[Math.floor(t()*Z.length)],l,h/2-2.2,x,i,h,g),f(Y,l,h-2,x,i+.3,.22,g+.3);const I=i*.32,O=new mt;O.moveTo(-i/2-.45,0),O.lineTo(0,I),O.lineTo(i/2+.45,0),O.closePath();const $=new Jt(O,{depth:g+.8,bevelEnabled:!1}),H=$.attributes.uv;for(let N=0;N<H.count;N++)H.setXY(N,H.getX(N)/6,H.getY(N)/6);$.translate(0,0,-g/2-.4),z($,Q,l,h-2,x),f(Z[0],l+i*.23,h+I*.45-1,x+g*.17,.65,2.4,.7),f(Y,l+i*.23,h+I*.45+.25,x+g*.17,.9,.18,.95);for(let N=0;N<Math.floor(h/2.8);N++){for(let c=0;c<3;c++){const m=x+(c-1)*g*.27,M=-.5+N*2.8;if(f(Y,l-i/2-.08,M,m,.2,1.7,1.2),f(K,l-i/2-.2,M,m,.03,1.4,.92),f(w[(u+9)%3],l-i/2-.25,M,m-.78,.08,1.5,.48),f(w[(u+9)%3],l-i/2-.25,M,m+.78,.08,1.5,.48),N===1&&s===0){f(Q,l-i/2-.35,M-.85,m,.45,.28,1.3);for(let F=0;F<7;F++)z(new ye(.15,1),b[F%3],l-i/2-.4,M-.63+F%2*.06,m-.5+F/6)}f(Y,l-i/2-.26,M,m,.05,1.4,.05),f(Y,l-i/2-.26,M,m,.05,.06,.92)}for(const c of[-1,1])for(const m of[-i*.26,i*.26]){const M=-.5+N*2.8;f(Y,l+m,M,x+c*(g/2+.06),1.25,1.7,.16),f(K,l+m,M,x+c*(g/2+.16),.95,1.4,.03),f(Y,l+m,M,x+c*(g/2+.19),.06,1.4,.03)}}f(B,l-i/2-.1,-.95,x,.18,2.5,1.2),f(Y,l-i/2-.18,-2.1,x,.9,.2,1.7);for(const N of[-2.3,2.3])z(new Pe(.4,.27,.6,12),Q,l-i/2-.6,-1.85,x+N),z(new ye(.5,2),q[1],l-i/2-.6,-1.35,x+N);f(D,l-i/2-.8,.85,x,1.8,.18,4.4);for(let N=-6;N<=6;N++)G(_,l-i/2-1.6,1.45,x+N*.32,.025,1.1);f(_,l-i/2-1.6,2,x,.07,.07,4.1);for(let N=0;N<8;N++)f(N%2?Y:Z[(u+12)%Z.length],l-i/2-1,.3,x-1.8+N*.5,2.1,.09,.5);W(l+i/2+3,x+5,6+t()*3)}f(Z[0],-3,11,-78,7,26,7),f(D,-3,-1.7,-78,9,1,9);for(const s of[1,7,14,20])f(Y,-3,s,-78,7.35,.22,7.35);for(const s of[-3.2,3.2])f(Y,-3+s,10,-74.4,.4,23,.3);const y=new mt;y.moveTo(-.65,0),y.lineTo(.65,0),y.lineTo(.65,2.2),y.absarc(0,2.2,.65,0,Math.PI,!1),y.closePath();for(const s of[2,9,18])z(new er(y),_,-3,s,-74.48);z(new Pe(1.3,1.3,.15,32).rotateX(Math.PI/2),Q,-3,15.8,-74.35),z(new Pe(1.12,1.12,.17,32).rotateX(Math.PI/2),Y,-3,15.8,-74.24);for(let s=0;s<12;s++){const u=s/12*Math.PI*2;z(new Ue(.065,.18,.03).rotateZ(-u),_,-3+Math.sin(u)*.92,15.8+Math.cos(u)*.92,-74.13)}f(_,-3,16.15,-74.1,.075,.7,.04),z(new Ue(.07,.62,.04).rotateZ(-1.1),_,-2.75,15.93,-74.09),f(Y,-3,22.5,-78,8,.7,8);for(const s of[-2.5,2.5])for(const u of[-2.5,2.5])G(Y,-3+s,25,-78+u,.32,5);z(new _e(5.8,5.5,4),Q,-3,29,-78,1,1,1,Math.PI/4),z(new ve(.8,12,8),_,-3,25,-78,1,1.2,1),W(-10,-49,8),f(D,-10,-1.95,-49,3,.5,3);const d=P({color:"#356777",roughness:.9,side:Te});for(const s of[-11,-20,-32,12]){G(_,-2.5,-1.75,s,.06,.9),z(new Pe(.8,.8,.09,24),B,-2.5,-1.3,s),G(B,-2.5,-.6,s,.035,3.2);const l=new _e(2.1,.8,12,1,!0).toNonIndexed(),x=[];for(let g=0;g<l.attributes.position.count;g++){const h=new oe(Math.floor(g/3)%2?"#f7ebd4":"#477a87");x.push(h.r,h.g,h.b)}l.setAttribute("color",new fe(x,3));const i=P({vertexColors:!0,side:Te,roughness:.9});z(l,i,-2.5,1.2,s);for(const g of[-1,1]){f(B,-2.5,-1.5,s+g*1.25,.6,.08,.6),f(d,-2.5,-1.1,s+g*1.5,.6,.7,.06);for(const h of[-.24,.24])for(const I of[-.24,.24])G(_,-2.5+h,-1.85,s+g*1.25+I,.025,.7)}}for(let s=-8;s<=8;s++)s!==0&&se(-14,s*18);for(let s=-5;s<=5;s++){const u=s*25-8;f(D,5,-1.65,u,2.1,.9,2.1);for(let l=0;l<6;l++)z(new ye(.48,3),q[l%4],5+Math.sin(l*2.4)*.48,-.98,u+Math.cos(l*2.4)*.48);f(B,5,-1.1,u+4,.6,.12,2.8),f(B,5.3,-.65,u+4,.1,.65,2.8),G(_,5,-1.65,u+3,.06,1.1
63),G(_,5,-1.65,u+5,.06,1.1)}for(let s=0;s<5;s++){const u=-35-s*23;f(B,-30,-1.9,u,26,.22,2.5,0,3);for(let l=0;l<4;l++)G(B,-20-l*7,-2.4,u+1.2,.12,3);if(z(new ve(1,14,8),Z[s],-35,-2.15,u+5,1.8,.65,4.7),f(B,-35,-1.95,u+5,2.6,.15,7),f(Y,-35,-1.35,u+5,1.9,1.1,2.5),f(K,-35,-1.28,u+6.28,1.5,.6,.06),G(_,-35,2.3,u+4,.045,9),s===0||s===2){const l=new ht;l.setAttribute("position",new fe([-35,6.5,u+4,-35,-.8,u+4,-35,-.8,u+8.2],3)),l.setAttribute("uv",new fe([0,1,0,0,1,0],2)),l.computeVertexNormals(),z(l,P({color:"#f3e7cf",side:Te,roughness:.95}),0,0,0)}}}for(const[w,b]of j){const y=b.map(l=>l.index?l.toNonIndexed():l),d=Pr(y);if(!d)throw new Error("Could not assemble procedural scenery geometry.");const s=new me(d,w);s.castShadow=s.receiveShadow=!0,p.add(s),new Set([...b,...y]).forEach(l=>l.dispose())}const re=new ce(-.65,o?.25:.7,-.6).normalize(),C=new Ge({vertexShader:Or,fragmentShader:Hr,uniforms:{uTime:{value:0},uKind:{value:o?0:n?2:1},uReflection:{value:null},uDeep:{value:new oe(o?"#092937":"#096778")},uShallow:{value:new oe(o?"#17404b":"#51bdb2")},uSunColor:{value:new oe(o?"#ffc395":"#fff0cc")},uSunDirection:{value:re}}});A.push(C);const S=new me(new Ce(3e3,3e3).rotateX(-Math.PI/2),C);S.position.y=-2.17,p.add(S),p.add(new Ke(o?"#719bbf":"#b6e2f1","#8a7054",o?.65:1.35));const E=new tr(o?"#ffd5ad":"#fff0d1",o?.8:2.6);return E.position.copy(re).multiplyScalar(150),E.castShadow=!o,E.shadow.mapSize.set(2048,2048),E.shadow.camera.left=E.shadow.camera.bottom=-95,E.shadow.camera.right=E.shadow.camera.top=95,E.shadow.camera.far=420,E.shadow.normalBias=.08,E.shadow.bias=-1e-4,p.add(E),{group:p,water:S,update:w=>{C.uniforms.uTime.value=w},setReflection:w=>{C.uniforms.uReflection.value=w},dispose:()=>{var w;p.traverse(b=>{b instanceof me&&b.geometry.dispose()}),A.forEach(b=>b.dispose()),R.forEach(b=>b.dispose()),(w=E.shadow.map)==null||w.dispose(),p.clear()}}}function nt(e){const r=e.preset==="waterfront-city",t={value:0};return{material:new Ge({side:cr,depthTest:!0,depthWrite:!1,fog:!1,uniforms:{uTime:t,uSeed:{value:e.seed%1e3*.13},uSpeed:{value:e.motion.speed*.026},uDetail:{value:e.motion.detail},uGlow:{value:e.motion.glow},uCoverage:{value:e.atmosphere.coverage},uZenith:{value:new oe(r?"#101f42":"#247bbb")},uHorizon:{value:new oe(r?"#536780":"#c1dce9")},uGround:{value:new oe(e.palette.ground)},uCloud:{value:new oe(r?"#65758e":"#fff6e6")},uSun:{value:new oe(r?"#ffb477":"#fff1d4")},uSunDirection:{value:new ce(-.65,r?.25:.7,-.6).normalize()},uDay:{value:r?0:1}},vertexShader:"varying vec3 vDirection; void main(){vDirection=position; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}",fragmentShader:`
64      varying vec3 vDirection;
65      uniform float uTime,uSeed,uSpeed,uDetail,uGlow,uCoverage,uDay;
66      uniform vec3 uZenith,uHorizon,uGround,uCloud,uSun,uSunDirection;
67      float hash(vec3 p){p=fract(p*0.3183099+vec3(.1,.2,.3));p*=17.0;return fract(p.x*p.y*p.z*(p.x+p.y+p.z));}
68      float noise(vec3 p){vec3 i=floor(p),f=fract(p);f=f*f*(3.0-2.0*f);return mix(mix(mix(hash(i),hash(i+vec3(1,0,0)),f.x),mix(hash(i+vec3(0,1,0)),hash(i+vec3(1,1,0)),f.x),f.y),mix(mix(hash(i+vec3(0,0,1)),hash(i+vec3(1,0,1)),f.x),mix(hash(i+vec3(0,1,1)),hash(i+vec3(1,1,1)),f.x),f.y),f.z);}
69      float fbm(vec3 p){float v=0.,a=.5;for(int i=0;i<5;i++){v+=a*noise(p);p=p*2.03+vec3(13.1,7.7,5.3);a*=.5;}return v;}
70      void main(){
71        vec3 d=normalize(vDirection);
72        float height=max(d.y,0.0);
73        vec3 sky=mix(uHorizon,uZenith,pow(height,.38));
74        float sunDot=clamp(dot(d,uSunDirection),-1.,1.);
75        float sunAngle=acos(sunDot);
76        sky+=uSun*exp(-sunAngle*(5.+uDay*3.))*(.06+uGlow*.22);
77        float disk=1.-smoothstep(.009,.012,sunAngle);
78        sky+=uSun*disk*(12.+uGlow*24.);
79        // Cloud layers live on a curved atmospheric shell. Perspective compresses
80        // them toward the horizon instead of stretching noise across the sphere.
81        vec2 plane=d.xz/(max(d.y,0.0)+.22);
82        vec3 p=vec3(plane*1.15, .8)*(.8+uDetail*.65)+vec3(uSeed+uTime*uSpeed,0.,0.);
83        float field=fbm(p);
84        float threshold=.65-uCoverage*.3;
85        float cloud=smoothstep(threshold,threshold+.2,field);
86        cloud*=smoothstep(.015,.14,height);
87        float lightField=fbm(p+vec3(uSunDirection.xz*.18,.12));
88        float shading=clamp(.7+(field-lightField)*3.0,0.,1.);
89        vec3 cloudColor=mix(uCloud*.48,uCloud*1.5,shading);
90        cloudColor+=uSun*pow(max(sunDot,0.),8.)*.3;
91        sky=mix(sky,cloudColor,cloud*.94);
92        float wisps=fbm(vec3(plane*vec2(.6,3.8),3.)+vec3(uSeed,0.,uTime*uSpeed*.3));
93        float veil=smoothstep(.58,.78,wisps)*smoothstep(.08,.4,height)*.23;
94        sky=mix(sky,uCloud*1.1,veil);
95        sky=mix(uGround*.5,sky,smoothstep(-.1,.015,d.y));
96        gl_FragColor=vec4(max(sky,vec3(0.)),1.);
97        #include <tonemapping_fragment>
98        #include <colorspace_fragment>
99      }`}),timeUniform:t,motionKind:"clouds"}}function Br(){const e=new ve(2e3,128,64),r=new ce;for(let t=0;t<e.attributes.position.count;t++)r.fromBufferAttribute(e.attributes.position,t).normalize(),e.attributes.uv.setY(t,Math.acos(ge.clamp(r.y,-1,1))/Math.PI);return e}const Yr=`
100  uniform samplerCube uCube;
101  uniform bool uLinear;
102  varying vec2 vUv;
103  vec3 displayColor(vec3 c) {
104    const mat3 a=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);
105    const mat3 b=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);
106    c=a*(c*1.05/0.6);
107    c=clamp(b*((c*(c+0.0245786)-0.000090537)/(c*(0.983729*c+0.4329510)+0.238081)),0.0,1.0);
108    return mix(c*12.92,1.055*pow(c,vec3(1.0/2.4))-0.055,step(vec3(0.0031308),c));
109  }
110  void main() {
111    float phi=vUv.x*6.28318530718;
112    float theta=(1.0-vUv.y)*3.14159265359;
113    vec3 direction=vec3(-cos(phi)*sin(theta),cos(theta),sin(phi)*sin(theta));
114    vec3 c=max(textureCube(uCube,direction).rgb,vec3(0.0));
115    gl_FragColor=vec4(uLinear?c:displayColor(c),1.0);
116  }
117`;function qr(e,r,t,o){const n=J(t.preset).scenery;if(!n)throw new Error("This preset does not contain scenery.");const p=o/2,R=new Ie;R.fog=new vt(t.palette.horizon,n==="waterfront-city"?.0011:55e-5);const A=Pt(n,t.seed);R.add(A.group);const j=nt(t),L=Br(),P=new me(L,j.material);P.renderOrder=-100,R.add(P);const U=Math.min(2048,Math.max(256,o/4)),k=new Ze(U,{type:Qe}),v=new Je(.1,4e3,k),D=new Ze(256,{type:Qe}),Q=new Je(.1,4e3,D),_=new Ie,ee=new Ce(2,2),B=new Ge({uniforms:{uCube:{value:k.texture},uLinear:{value:!1}},vertexShader:"varying vec2 vUv; void main(){vUv=uv; gl_Position=vec4(position.xy,0.0,1.0);}",fragmentShader:Yr,depthTest:!1,depthWrite:!1,toneMapped:!1});_.add(new me(ee,B));const Y=new lr,te=new et(o,p,{depthBuffer:!1});let K=null;function q(Z,z){const f=e.getRenderTarget(),G=e.toneMapping,X=e.shadowMap.enabled;try{e.shadowMap.enabled=!0,e.toneMapping=dr,j.timeUniform.value=Z,A.update(Z*t.motion.speed),A.water.visible=!1,Q.update(e,R),A.water.visible=!0,A.setReflection(D.texture),v.update(e,R),B.uniforms.uLinear.value=z,z&&!K&&(K=new et(o,p,{type:pr,depthBuffer:!1}));const W=z?K:te;return e.setRenderTarget(W),e.render(_,Y),W}finally{A.water.visible=!0,e.setRenderTarget(f),e.toneMapping=G,e.shadowMap.enabled=X}}return{runtime:j,render(Z){const z=q(Z,!1),f=new Uint8Array(o*p*4);e.readRenderTargetPixels(z,0,0,o,p,f);const G=new ImageData(o,p);for(let X=0;X<p;X++)G.data.set(f.subarray(X*o*4,(X+1)*o*4),(p-X-1)*o*4);return G},renderLinear(Z){const z=q(Z,!0),f=new Float32Array(o*p*4);e.readRenderTargetPixels(z,0,0,o,p,f);const G=new Float32Array(o*p*3);for(let X=0;X<p;X++)for(let W=0;W<o;W++){const se=(X*o+W)*4,re=((p-X-1)*o+W)*3;G[re]=f[se],G[re+1]=f[se+1],G[re+2]=f[se+2]}return{width:o,height:p,data:G}},dispose(){A.dispose(),L.dispose(),j.material.dispose(),k.dispose(),D.dispose(),te.dispose(),K==null||K.dispose(),ee.dispose(),B.dispose()}}}const Wr=8192,Xr=e=>{const r=e.attributes.position,t=e.attributes.uv,o=new ce;for(let n=0;n<r.count;n+=1)o.fromBufferAttribute(r,n).normalize(),t.setY(n,Math.acos(ge.clamp(o.y,-1,1))/Math.PI);t.needsUpdate=!0},Vr=e=>{const r=e.attributes.uv;for(let t=0;t<r.count;t+=1)r.setY(t,1-r.getY(t));r.needsUpdate=!0},qe=(e,r)=>{const t=Math.round(Number(e)||r);return Math.max(512,Math.min(Wr,t-t%2))},Kr=(e,r="image/png",t)=>new Promise((o,n)=>{e.toBlob(p=>{p?o(p):n(new Error("The browser could not encode the procedural panorama."))},r,t)}),Zr=e=>new Promise((r,t)=>{const o=new FileReader;o.onload=()=>r(String(o.result||"")),o.onerror=()=>t(o.error||new Error("Could not read the panorama export.")),o.readAsDataURL(e)}),We=(e,r,t,o)=>
117{if(J(t.preset).scenery)return qr(e,r,t,o);const n=o/2,p=new Ie,R=new yr(-1,1,1,-1,.1,2);R.position.z=1;const A=new Ce(2,2,1,1);Vr(A);const j=tt(ot(t),r,"webgl");at(j.material,t),j.material.side=xr;const L=new me(A,j.material);p.add(L);const P=new et(o,n,{depthBuffer:!1,stencilBuffer:!1,format:kr,type:vr});P.texture.colorSpace=it;const U=new Uint8Array(o*n*4),k=new Uint8ClampedArray(o*n*4),v=new ImageData(k,o,n);return{runtime:j,render:D=>{j.timeUniform.value=D;const Q=e.getRenderTarget();try{e.setRenderTarget(P),e.clear(),e.render(p,R),e.readRenderTargetPixels(P,0,0,o,n,U)}finally{e.setRenderTarget(Q)}const _=o*4;for(let ee=0;ee<n;ee+=1){const B=n-ee-1;k.set(U.subarray(ee*_,(ee+1)*_),B*_)}return v},dispose:()=>{A.dispose(),j.material.dispose(),P.dispose()}}},Qr=e=>{const r=document.createElement("canvas");r.width=e.width,r.height=e.height;const t=r.getContext("2d");if(!t)throw new Error("A 2D canvas is required to encode the panorama.");return t.putImageData(e,0,0),r},Xe=e=>{const r=e/255;return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)},Jr=(e,r)=>{const t=e.data,o=new Float32Array(e.width*e.height*3);for(let n=0,p=0;n<t.length;n+=4,p+=3){const R=Xe(t[n]),A=Xe(t[n+1]),j=Xe(t[n+2]),L=R*.2126+A*.7152+j*.0722,P=Math.pow(Math.max(R,A,j),3.4),U=(.8+r.atmosphere.brightness*.9)*(1+P*(2.2+r.motion.glow*7.8))*(.92+L*.22);o[p]=R*U,o[p+1]=A*U,o[p+2]=j*U}return{width:e.width,height:e.height,data:o}},eo=()=>typeof MediaRecorder>"u"?null:["video/mp4;codecs=avc1.42E01E","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"].find(r=>MediaRecorder.isTypeSupported(r))||"",to=T.forwardRef(function({recipe:r,className:t,paused:o=!1,groundGridVisible:n=!0,onReady:p},R){const A=T.useRef(null),j=T.useRef(null),L=T.useRef(null),P=T.useRef(null),U=T.useRef(null),k=T.useRef(null),v=T.useRef(null),D=T.useRef(null),Q=T.useRef(null),_=T.useRef(null),ee=T.useRef(""),B=T.useRef(r),Y=T.useRef(r.seed%997/29),te=T.useRef(null),K=T.useRef(0),q=T.useRef(.26),Z=T.useRef(null),z=T.useRef(o),f=T.useRef(()=>{}),G=T.useRef(null);B.current=r,z.current=o,T.useEffect(()=>{const C=A.current;if(!C)return;const S=new ur({canvas:C,alpha:!1,antialias:!0,powerPreference:"high-performance"});j.current=S,S.outputColorSpace=it,S.toneMapping=mr,S.toneMappingExposure=1.05,S.shadowMap.enabled=!0,S.shadowMap.type=hr,S.setPixelRatio(Math.min(window.devicePixelRatio||1,1.65));const E=new Ie;D.current=E,E.background=new oe("#02030b");const w=new fr(70,1,.05,4e3);w.rotation.order="YXZ",w.rotation.set(q.current,K.current,0,"YXZ"),te.current=w;const b=new ve(48,128,64);Xr(b);const y=Rr();k.current=y;const d=J(B.current.preset).scenery?nt(B.current):tt(ot(B.current),y,"webgl");J(B.current.preset).scenery||at(d.material,B.current),d.timeUniform.value=Y.current,v.current=d;const s=new me(b,d.material);s.renderOrder=-100,s.rotation.y=J(B.current.preset).scenery?0:ge.degToRad(B.current.seed%360),L.current=s,E.add(s);const u=new ft({color:"#050811",metalness:.72,roughness:.24,clearcoat:.78,clearcoatRoughness:.2}),l=new gr(16,96),x=new me(l,u);x.rotation.x=-Math.PI/2,x.position.set(0,-1.55,-4.2),x.renderOrder=1,P.current=x,E.add(x);const i=new ve(.92,80,48),g=new ft({color:"#a8d8ff",metalness:1,roughness:.055,clearcoat:1,clearcoatRoughness:.03}),h=new me(i,g);h.position.set(.9,1.3,-5.2),h.renderOrder=2,E.add(h);const I=new br(30,48,"#8055ff","#163f61");I.position.set(0,-1.535,-4.2),I.material.transparent=!0,I.material.opacity=.16,I.renderOrder=3,U.current=I,E.add(I),E.add(new Ke("#96dcff","#150521",1.15));const O=new Oe("#3ee7ff",58,20,1.6);O.position.set(-4,3,-2),E.add(O);const $=new Oe("#e95cff",48,18,1.6);$.position.set(5,1,-5),E.add($);const H=new Oe("#ffffff",30,14,1.8);H.position.set(0,-.4,-8),E.add(H);const N=new xt;N.add(x,h,I,O,$,H),E.children.filter(ne=>ne instanceof Ke).forEach(ne=>N.add(ne)),E.add(N),Q.current=N;const c=new Ze(256,{type:Qe,generateMipmaps:!0,minFilter:wr}),m=new Je(.1,4e3,c);E.add(m),g.envMap=c.texture,u.envMap=c.texture;const M=()=>{const ne=h.visible,pe=x.visible,ze=I.visible;h.visible=!1,x.visible=!1,I.visible=!1;const we=_.current;we&&(we.water.visible=!1);try{m.update(S,E),we==null||we.setReflection(c.texture)}finally{we&&(we.water.visible=!0),h.visible=ne,x.visible=pe,I.visible=ze}g.needsUpdate=!0,u.needsUpdate=!0};f.current=M;const F=()=>{const ne=Math.max(1,C.clientWidth),pe=Math.max(1,C.clientHeight);S.setSize(ne,pe,!1),w.aspect=ne/pe,w.updateProjectionMatrix()},V=new ResizeObserver(F);V.observe(C),F(),M();let ie=0,le=!0,ae=performance.now();const Se=window.matchMedia("(prefers-reduced-motion: reduce)"),Me=ne=>{var ze;if(!le||document.hidden)return;const pe=Math.min(.05,Math.max(0,(ne-ae)/1e3));ae=ne,!Se.matches&&!z.current&&(Y.current+=pe),v.current&&(v.current.timeUniform.value=Y.current),(ze=_.current)==null||ze.update(Y.current*B.current.motion.speed),h.rotation.y+=
117pe*.09,S.render(E,w),ie=requestAnimationFrame(Me)},lt=()=>{!le||document.hidden||ie||(ae=performance.now(),ie=requestAnimationFrame(Me))},dt=()=>{document.hidden?(cancelAnimationFrame(ie),ie=0):lt()};return document.addEventListener("visibilitychange",dt),lt(),p==null||p(),()=>{var ne,pe;le=!1,cancelAnimationFrame(ie),document.removeEventListener("visibilitychange",dt),V.disconnect(),G.current!==null&&(window.clearTimeout(G.current),G.current=null),f.current=()=>{},(ne=v.current)==null||ne.material.dispose(),v.current=null,(pe=_.current)==null||pe.dispose(),_.current=null,ee.current="",D.current=null,Q.current=null,y.dispose(),k.current=null,b.dispose(),l.dispose(),u.dispose(),i.dispose(),g.dispose(),I.geometry.dispose(),I.material.dispose(),c.dispose(),S.dispose(),j.current=null,L.current=null,P.current=null,U.current=null,te.current=null}},[p]),T.useEffect(()=>{P.current&&(P.current.visible=n),U.current&&(U.current.visible=n)},[n]),T.useEffect(()=>{var s;const C=L.current,S=k.current;if(!C||!S)return;const E=v.current,w=J(r.preset).scenery?nt(r):tt(ot(r),S,"webgl");J(r.preset).scenery||at(w.material,r),w.timeUniform.value=Y.current,C.material=w.material,C.rotation.y=J(r.preset).scenery?0:ge.degToRad(r.seed%360),v.current=w,E==null||E.material.dispose();const b=J(r.preset).scenery,y=b?`${b}:${r.seed}`:"",d=D.current;if(d&&y!==ee.current){const u=_.current;u&&(d.remove(u.group),u.dispose());const l=b?Pt(b,r.seed):null;_.current=l,ee.current=y,l&&d.add(l.group),d.fog=b?new vt(r.palette.horizon,b==="waterfront-city"?.0011:55e-5):null,Q.current&&(Q.current.visible=!l),C.scale.setScalar(l?2e3/48:1),q.current=l?0:.26,K.current=b==="coastal-village"?-.12:0,(s=te.current)==null||s.rotation.set(q.current,K.current,0,"YXZ")}G.current!==null&&window.clearTimeout(G.current),G.current=window.setTimeout(()=>{f.current(),G.current=null},90)},[r]),T.useImperativeHandle(R,()=>({capturePanorama:async(C={})=>{const S=qe(C.width,4096),E=j.current,w=k.current;if(!E||!w)throw new Error("The procedural renderer is not ready yet.");const b=We(E,w,B.current,S);let y=null;try{y=Qr(b.render(C.time??Y.current));const d=await Kr(y,"image/png");return{blob:d,dataUrl:await Zr(d),width:S,height:S/2}}finally{b.dispose(),y&&(y.width=1,y.height=1)}},captureHdr:async(C={})=>{const S=qe(C.width,2048),E=j.current,w=k.current;if(!E||!w)throw new Error("The procedural renderer is not ready yet.");const b=We(E,w,B.current,S);try{const y=C.time??Y.current,d=b.renderLinear?b.renderLinear(y):Jr(b.render(y),B.current);return new Blob([Mr(d)],{type:"image/vnd.radiance"})}finally{b.dispose()}},captureLoop:async(C={})=>{const S=eo();if(S===null||typeof HTMLCanvasElement.prototype.captureStream!="function")throw new Error("Animated 360 export is not supported by this browser.");const E=qe(C.width,1280),w=Math.min(12,Math.max(2,Number(C.durationSeconds)||6)),b=j.current,y=k.current;if(!b||!y)throw new Error("The procedural renderer is not ready yet.");const d=We(b,y,B.current,E),s=document.createElement("canvas");s.width=E,s.height=E/2;const u=s.getContext("2d");if(!u)throw d.dispose(),new Error("A 2D canvas is required to record the animated panorama.");const l=s.captureStream(30),x=new MediaRecorder(l,{...S?{mimeType:S}:{},videoBitsPerSecond:8e6}),i=[],g=Y.current;try{const h=new Promise((H,N)=>{x.ondataavailable=c=>{c.data.size>0&&i.push(c.data)},x.onerror=()=>N(new Error("The browser could not record the animated panorama.")),x.onstop=()=>H(new Blob(i,{type:x.mimeType||S||"video/webm"}))});h.catch(()=>{}),x.start(250);const I=performance.now();await new Promise((H,N)=>{const c=m=>{var M;try{if(j.current!==b)throw new Error("The procedural workspace was closed during loop export.");if(x.state==="inactive")throw new Error("The browser stopped recording the panorama.");const F=Math.min(1,(m-I)/(w*1e3)),V=.5-.5*Math.cos(F*Math.PI*2);if(u.putImageData(d.render(g+V*16),0,0),(M=C.onProgress)==null||M.call(C,F),F>=1){x.stop(),H();return}requestAnimationFrame(c)}catch(F){N(F)}};requestAnimationFrame(c)});const O=await h,$=O.type||x.mimeType||S||"video/webm";return{blob:O,extension:$.includes("mp4")?"mp4":"webm",mimeType:$}}
117finally{x.state!=="inactive"&&x.stop(),l.getTracks().forEach(h=>h.stop()),d.dispose(),s.width=1,s.height=1}},resetView:()=>{const C=J(B.current.preset).scenery;K.current=C==="coastal-village"?-.12:0,q.current=C?0:.26;const S=te.current;S&&(S.rotation.set(q.current,K.current,0,"YXZ"),S.fov=70,S.updateProjectionMatrix())}}),[]);const X=C=>{Z.current={id:C.pointerId,x:C.clientX,y:C.clientY},C.currentTarget.setPointerCapture(C.pointerId)},W=C=>{const S=Z.current,E=te.current;!S||S.id!==C.pointerId||!E||(K.current-=(C.clientX-S.x)*.0032,q.current=ge.clamp(q.current-(C.clientY-S.y)*.0026,-1.25,1.25),S.x=C.clientX,S.y=C.clientY,E.rotation.set(q.current,K.current,0,"YXZ"))},se=C=>{var S;((S=Z.current)==null?void 0:S.id)===C.pointerId&&(Z.current=null),C.currentTarget.hasPointerCapture(C.pointerId)&&C.currentTarget.releasePointerCapture(C.pointerId)},re=C=>{const S=te.current;S&&(C.preventDefault(),S.fov=ge.clamp(S.fov+C.deltaY*.025,38,82),S.updateProjectionMatrix())};return a.jsx("canvas",{ref:A,className:t,"aria-label":`Interactive procedural 360 sky preview: ${r.name}`,"data-ground-grid-visible":n?"true":"false","data-sky-formation":r.formation.type,"data-scenery":J(r.preset).scenery??"none",onPointerDown:X,onPointerMove:W,onPointerUp:se,onPointerCancel:se,onWheel:re})});function ro({recipe:e,disabled:r,onSelect:t}){const[o,n]=T.useState(!1),[p,R]=T.useState("All"),[A,j]=T.useState(""),L=T.useId(),P=A.trim().toLowerCase(),U=be.filter(v=>(p==="All"||v.category===p)&&(!P||`${v.label} ${v.description}`.toLowerCase().includes(P))),k=J(e.preset);return a.jsxs(Nr,{open:o,onOpenChange:n,children:[a.jsx(Cr,{asChild:!0,children:a.jsxs("button",{type:"button","data-testid":"procedural-preset-browser-toggle","aria-label":`Browse ${be.length} sky presets`,className:"flex w-[min(280px,calc(100vw-2rem))] items-center gap-3 rounded-xl border border-white/20 bg-[#070b22]/85 p-2 text-left text-white shadow-lg backdrop-blur-xl transition hover:border-cyan-200/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-200",children:[a.jsx("span",{className:"h-10 w-14 shrink-0 rounded-md border border-white/15",style:{background:`linear-gradient(155deg, ${e.palette.zenith}, ${e.palette.horizon} 65%, ${e.palette.ground})`}}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"block text-[9px] font-black uppercase tracking-[0.15em] text-cyan-100/75",children:["Sky presets · ",be.length]}),a.jsx("span",{className:"mt-0.5 block truncate text-xs font-semibold",children:e.name})]}),a.jsx(bt,{className:"h-4 w-4 shrink-0 text-white/60"})]})}),a.jsxs(zr,{align:"start",side:"bottom",sideOffset:8,collisionPadding:12,"aria-labelledby":L,"data-testid":"procedural-preset-browser",className:"flex max-h-[min(640px,calc(100dvh-11rem))] w-[min(600px,calc(100vw-1.5rem))] flex-col overflow-y-auto overscroll-contain rounded-xl border-white/20 bg-[#080d24]/95 p-3 text-white shadow-[0_24px_80px_rgba(0,0,0,0.65)] backdrop-blur-2xl sm:p-4",children:[a.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h2",{id:L,className:"text-sm font-bold",children:"Find your atmosphere"}),a.jsxs("p",{className:"mt-1 text-[11px] text-white/55",children:[be.length," skies and scenes. Select one to preview."]})]}),a.jsx("button",{type:"button","aria-label":"Close sky presets",onClick:()=>n(!1),className:"grid h-8 w-8 shrink-0 place-items-center rounded-md text-white/65 hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-200",children:a.jsx(Et,{className:"h-4 w-4"})})]}),a.jsxs("label",{className:"mt-3 flex shrink-0 items-center gap-2 rounded-lg border border-white/15 bg-black/25 px-3 focus-within:border-cyan-200/60",children:[a.jsx(At,{className:"h-4 w-4 shrink-0 text-white/40"}),a.jsx("input",{type:"search","aria-label":"Search sky presets",value:A,onChange:v=>j(v.target.value),placeholder:"Search skies, scenery, or moods…",className:"h-10 min-w-0 flex-1 !bg-transparent text-xs !text-white outline-none placeholder:!text-white/40"})]}),a.jsx("div",{className:"my-3 flex shrink-0 flex-wrap gap-1.5",role:"group","aria-label":"Preset categories",children:Ar.map(v=>a.jsx("button",{type:"button","aria-pressed":p===v,onClick:()=>R(v),className:`rounded-md border px-2.5 py-2 text-[10px] font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-200 ${p===v?"border-cyan-200/45 bg-cyan-200/15 text-cyan-100":"border-white/10 text-white/60 hover:border-white/30 hover:text-white"}`,children:v},v))}),a.jsx("div",{className:"min-h-0 overflow-y-auto overscroll-contain pr-1 [@media(max-height:540px)]:shrink-0","aria-label":"Procedural sky presets",children:U.length?a.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:U.map(v=>{const D=e.source==="preset"&&e.preset===v.id;return a.jsxs("button",{type:"button",disabled:r,"aria-label":`Load ${v.label}`,"aria-pressed":D,title:v.description,"data-testid":"procedural-preset-card",onClick:()=>t(v.id),className:`group min-w-0 overflow-hidden rounded-lg border bg-black/20 p-1 text-left transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-200 disabled:cursor-not-allowed disabled:opacity-45 ${D?"border-cyan-200/80 ring-1 ring-cyan-200/30":"border-white/12 hover:border-cyan-200/45"}`,children:[a.jsxs("span",{className:"relative block h-20 overflow-hidden rounded-md",style:{background:`radial-gradient(ellipse at 60% 80%, ${v.recipe.palette.rim} 0, transparent 48%), linear-gradient(155deg, ${v.recipe.palette.zenith}, ${v.recipe.palette.horizon} 65%, ${v.recipe.palette.ground})`},children:[a.jsx("img",{src:`/images/procedural-sky-presets/${v.id}.webp`,alt:"",width:400,height:225,loading:"lazy",className:"h-full w-full object-cover"}),D?a.jsx("span",{className:"absolute right-1.5 top-1.5 rounded-full bg-cyan-100 p-1 text-slate-950",children:a.jsx(wt,{className:"h-3 w-3"})}):null]}),a.jsxs("span",{className:"block px-1.5 pb-1.5 pt-2",children:[a.jsx("span",{className:"block truncate text-[11px] font-semibold text-white/90",children:v.label}),a.jsx("span",{className:"mt-1 block text-[9px] text-white/50",children:v.category})]})]},v.id)})}):a.jsxs("div",{className:"py-8 text-center",children:[a.jsx("p",{className:"text-sm font-semibold",children:"No matching skies"}),a.jsx("p",{className:"mt-1 text-xs text-white/55",children:"Try another mood or browse the full collection."}),a.jsx("button",{type:"button",onClick:()=>{j(""),R("All")},className:"mt-3 rounded-md border border-cyan-200/30 px-3 py-2 text-xs text-cyan-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-200",children:"Clear filters"})]})}),a.jsxs("div",{className:"mt-3 shrink-0 border-t border-white/10 pt-3","aria-live":"polite","aria-atomic":"true",children:[a.jsxs("p",{className:"text-[11px] font-semibold text-cyan-100",children:[e.source==="preset"?k.label:e.name," ",a.jsxs("span",{className:"font-normal text-white/40",children:["· ",U.length," shown"]})]}),a.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-white/55",children:e.source==="preset"?k.description:"Your saved sky is active. Choose a preset to explore another atmosphere."})]})]})]})}const ke={speed:.05,detail:.05,glow:0},jt={type:"object",properties:{preset:{type:"string",enum:[...ct]},speed:{type:"number",minimum:ke.speed,maximum:1,multipleOf:.01},detail:{type:"number",minimum:ke.detail,maximum:1,multipleOf:.01},glow:{type:"number",minimum:ke.glow,maximum:1,multipleOf:.01},paused:{type:"boolean"},groundGridVisible:{type:"boolean"},panelMinimized:{type:"boolean"},description:{type:"string",maxLength:500}},required:[],additionalProperties:!1};function oo(e,r){for(const R of Object.keys(e))if(!(R in jt.properties))throw new TypeError(`Unknown procedural HDRI setting: ${R}.`);const t=rt(e,"preset",ct),o=t?J(t).recipe:r,n={...o.motion};for(const R of["speed","detail","glow"]){const A=kt(e,R,{min:ke[R],max:1});if(A!==void 0){if(Math.abs(A*100-Math.round(A*100))>1e-7)throw new TypeError(`${R} must use increments of 0.01.`);n[R]=A}}const p=Ae(e,"groundGridVisible");
117if(p!==void 0&&J(o.preset).scenery)throw new TypeError("The demo ground and grid control is available for sky-only presets. Scenery includes its own terrain.");return{recipe:{...o,motion:n},preset:t,description:Tr(e,"description",{maxLength:500,trim:!1})??(t?o.prompt:void 0),paused:Ae(e,"paused"),groundGridVisible:p,panelMinimized:Ae(e,"panelMinimized")}}function ao(e){const r={type:"object",properties:{},required:[],additionalProperties:!1};return[{name:"playtex.get_procedural_hdri_state",title:"Read procedural HDRI workspace",description:"Read the visible preset library, scenery, motion controls, saved sky names, readiness and export formats. Presets render locally; no credits are needed to select them.",inputSchema:r,annotations:{readOnlyHint:!0,untrustedContentHint:!0},execute:async(t,{signal:o})=>{if(o.aborted)throw o.reason;return e.read()}},{name:"playtex.configure_procedural_hdri",title:"Configure procedural sky or scenery",description:"Select a curated sky or detailed waterfront-city, coastal-village or tropical-beach scene, edit motion, pause, or minimize controls. The preview updates automatically. Description edits prepare a separate sky recipe request; descriptions do not create scenery geometry.",inputSchema:jt,annotations:{readOnlyHint:!1,untrustedContentHint:!1},execute:async(t,{signal:o})=>{if(o.aborted)throw o.reason;return e.configure(t)}},{name:"playtex.generate_procedural_hdri",title:"Create a procedural sky recipe",description:"Create a sky from the visible description using the normal sign-in and credit checks. This costs one credit and replaces the current preset with a saved sky. It does not generate scenery geometry.",inputSchema:r,annotations:{readOnlyHint:!1,untrustedContentHint:!1},execute:async(t,{signal:o})=>{if(o.aborted)throw o.reason;return{status:await He(e.generate(),o)?"created":"not_created"}}},{name:"playtex.export_procedural_hdri",title:"Export procedural HDRI",description:"Download the current sky or full scenery as a 4096×2048 PNG, 2048×1024 scene-linear Radiance HDR, or six-second 1280×640 animated 360 loop. Exports use the visible scene and render locally. No binary data is returned to the agent.",inputSchema:{type:"object",properties:{format:{type:"string",enum:["png","hdr","loop"]}},required:["format"],additionalProperties:!1},annotations:{readOnlyHint:!1,untrustedContentHint:!1},execute:async(t,{signal:o})=>{if(o.aborted)throw o.reason;const n=rt(t,"format",["png","hdr","loop"]);if(!n)throw new TypeError("format is required.");return{status:await He(e.export(n),o)?"download_started":"not_downloaded",format:n}}},{name:"playtex.export_hdri_engine_pack",title:"Export procedural HDRI engine pack",description:"Download the current procedural sky or scenery as an engine cubemap pack through the same access checks as the visible export menu. The scene has no depth asset. Paid upscaling remains a separate visible choice.",inputSchema:{type:"object",properties:{target:{type:"string",enum:["unity","unreal","godot","roblox","threejs"]},faceSize:{type:"integer",enum:[256,512,1024,2048,4096],default:1024,description:"256 is available for Three.js only."},includeLightRig:{type:"boolean",default:!0}},required:["target"],additionalProperties:!1},annotations:{readOnlyHint:!1,untrustedContentHint:!1},execute:async(t,{signal:o})=>{if(o.aborted)throw o.reason;const n=rt(t,"target",["unity","unreal","godot","roblox","threejs"]);if(!n)throw new TypeError("target is required.");const p=kt(t,"faceSize",{min:256,max:4096,integer:!0})??1024;if(!Er(n,8192).includes(p))throw new TypeError("Choose a supported cubemap face size for this engine.");const R=Ae(t,"includeLightRig")??!0;return{status:await He(e.exportEngine({target:n,faceSize:p,includeLightRig:R,includeDepthRuntime:!1}),o)?"download_started":"not_downloaded",target:n,faceSize:p}}},{name:"playtex.reset_procedural_hdri_view",title:"Reset procedural HDRI view",description:"Restore the preset’s starting view and zoom without changing the panorama or recipe.",inputSchema:r,annotations:{readOnlyHint:!1,untrustedContentHint:!1},execute:async(t,{signal:o})=>{if(o.aborted)throw o.reason;return e.resetView(),{status:"view_reset"}}}]}const Nt="playtex:procedural-hdri-beta:v1",st=500,De=12,Ct=["Interpreting atmosphere","Sculpting sky formation","Lighting the horizon"],no=e=>{if(!Array.isArray(e))return[];const r=[];return e.slice(0,De).forEach((t,o)=>{if(!t||typeof t!="object"||Array.isArray(t))return;const n=t,p=Re(n.recipe,ue);p.source==="sol"&&r.push({id:typeof n.id=="string"&&n.id.trim()?n.id.trim().slice(0,96):`restored-${p.seed}-${o}`,createdAt:Number.isFinite(Number(n.createdAt))?Number(n.createdAt):0,recipe:p})}),r},so=()=>
117{if(typeof window>"u")return{recipe:ue,description:ue.prompt,groundGridVisible:!0,generatedSkies:[],activeGeneratedSkyId:null,panelMinimized:!1};try{const e=JSON.parse(window.localStorage.getItem(Nt)||"{}"),r=Re(e.recipe,ue);let t=no(e.generatedSkies);r.source==="sol"&&!t.some(R=>R.recipe.seed===r.seed)&&(t=[{id:`restored-current-${r.seed}`,createdAt:0,recipe:r},...t].slice(0,De));const o=typeof e.activeGeneratedSkyId=="string"?e.activeGeneratedSkyId:null,n=t.find(R=>R.recipe.seed===r.seed),p=o&&t.some(R=>R.id===o)?o:r.source==="sol"&&(n==null?void 0:n.id)||null;return{recipe:r,description:typeof e.description=="string"?e.description.slice(0,st):r.prompt,groundGridVisible:e.groundGridVisible!==!1,generatedSkies:t,activeGeneratedSkyId:p,panelMinimized:e.panelMinimized===!0}}catch{return{recipe:ue,description:ue.prompt,groundGridVisible:!0,generatedSkies:[],activeGeneratedSkyId:null,panelMinimized:!1}}},gt=e=>e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)||"procedural-sky",Ee=(e,r)=>{const t=URL.createObjectURL(e),o=document.createElement("a");o.href=t,o.download=r,o.style.display="none",document.body.appendChild(o),o.click(),o.remove(),window.setTimeout(()=>URL.revokeObjectURL(t),3e4)},io=e=>{const{basePreset:r,category:t,scenery:o}=J(e.preset);return{mode:"text-to-hdri",additionalDetails:e.prompt,seamFixEnabled:!1,timeOfDay:o?o==="waterfront-city"?"dusk":"afternoon":e.preset==="trade-wind"?"noon":e.preset==="porcelain-dawn"?"dawn":r==="warm-portrait"?"dusk":"night",cloudDensity:e.atmosphere.coverage,sunPosition:e.seed%360,stars:r==="neon-rim"||r==="celestial-nebula",resolution:Sr.value,generationQuality:"4K",style:o?"stylized-clean":r==="chrome-cathedral"?"scifi-minimal":"fantasy-atmosphere",environmentOption:o==="waterfront-city"?"city-skyline":o==="tropical-beach"?"tropical-beach":o==="coastal-village"?"ocean-horizon":t==="Storm"?"storm-clouds":e.preset==="trade-wind"?"clear-blue-sky":r==="celestial-nebula"?"space-nebula":"night-sky-stars",environmentStyle:o?"stylized-game-sky":r==="chrome-cathedral"?"scifi-futuristic":"dreamy-ethereal"}},co=e=>({backgroundColor:e.palette.ground,backgroundImage:e.formation.type==="firestorm"?`radial-gradient(ellipse at 24% 100%, ${e.palette.key} 0, transparent 36%), radial-gradient(ellipse at 67% 112%, ${e.palette.rim} 0, transparent 48%), linear-gradient(155deg, ${e.palette.zenith}, ${e.palette.horizon} 62%, ${e.palette.ground})`:`radial-gradient(circle at 68% 56%, ${e.palette.key} 0, transparent 9%), radial-gradient(ellipse at 46% 84%, ${e.palette.rim} 0, transparent 48%), linear-gradient(155deg, ${e.palette.zenith}, ${e.palette.horizon} 58%, ${e.palette.ground})`}),Ve=({label:e,value:r,icon:t,onChange:o,disabled:n})=>a.jsxs("label",{className:"min-w-0 flex-1 border-l border-white/10 px-3 first:border-l-0 sm:px-4",children:[a.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-black uppercase tracking-[0.13em] text-white/72",children:[a.jsx("span",{className:"text-cyan-200",children:t}),e]}),a.jsxs("span",{className:"mt-2 flex items-center gap-2",children:[a.jsx("span",{className:"w-8 text-[10px] font-semibold tabular-nums text-white/70",children:r.toFixed(2)}),a.jsx("input",{type:"range",min:e==="Glow"?ke.glow:ke.speed,max:"1",step:"0.01",value:r,disabled:n,"aria-label":`${e} ${r.toFixed(2)}`,onChange:p=>o(Number(p.target.value)),className:"h-1.5 min-w-0 flex-1 cursor-pointer accent-cyan-300 disabled:cursor-not-allowed disabled:opacity-40"})]})]});function lo({stage:e}){const r=T.useMemo(()=>Array.from({length:8},(o,n)=>n),[]),t=T.useMemo(()=>Array.from({length:34},(o,n)=>({id:n,left:`${8+n*37%84}%`,top:`${9+n*53%72}%`,delay:`${-(n*.19%3.2)}s`,duration:`${2.4+n%7*.24}s`})),[]);return a.jsxs("div",{className:"pointer-events-none absolute inset-0 z-10 grid place-items-center overflow-hidden",role:"status","aria-live":"polite",children:[a.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_50%_50%,rgba(26,20,75,0.1),rgba(2,3,11,0.3)_54%,rgba(2,3,11,0.58)_100%)]"}),a.jsxs("div",{className:"procedural-forge relative -translate-y-10 sm:-translate-y-16",children:[a.jsx("div",{className:"procedural-forge__aura"}),r.map(o=>a.jsx("span",{className:"procedural-forge__ring",style:{"--forge-index":o,"--forge-delay":`${o*-.22}s`}},o)),a.jsx("span",{className:"procedural-forge__axis"}),a.jsx("span",{className:"procedural-forge__core"}),t.map(o=>a.jsx("i",{className:"procedural-forge__particle",style:{left:o.left,top:o.top,animationDelay:o.delay,animationDuration:o.duration}},o.id))]}),a.jsx("div",{className:"absolute bottom-[min(34dvh,19rem)] left-1/2 w-[min(460px,calc(100vw-2rem))] -translate-x-1/2 text-center sm:bottom-[min(31dvh,17rem)]",children:a.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cyan-200/20 bg-[#090d25]/75 px-3 py-1.5 text-[9px] font-black uppercase tracking-[0.18em] text-cyan-100 shadow-[0_0_36px_rgba(57,210,255,0.16)] backdrop-blur-xl",children:[a.jsx(xe,{className:"h-3.5 w-3.5 animate-spin"}),Ct[e]]})})]})}function Qn({authenticated:e,initialEngineTarget:r,creditMode:t,creditPlanName:o,engineExportAllowed:n,fourKExportAllowed:p,entitlementLoading:R,payerKind:A,billingWorksp
117aceId:j,onRequireAuth:L,onCreditsChanged:P}){const U=T.useMemo(so,[]),[k,v]=T.useState(U.recipe),[D,Q]=T.useState(U.description),[_,ee]=T.useState(!1),[B,Y]=T.useState(0),[te,K]=T.useState(!1),[q,Z]=T.useState(U.groundGridVisible),[z,f]=T.useState(U.generatedSkies),[G,X]=T.useState(U.activeGeneratedSkyId),[W,se]=T.useState(U.panelMinimized),[re,C]=T.useState(!1),[S,E]=T.useState(null),[w,b]=T.useState(null),y=T.useRef(null),d=T.useRef(!0),s=T.useRef(!1),{toast:u}=Vt();T.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]),T.useEffect(()=>{window.localStorage.setItem(Nt,JSON.stringify({recipe:k,description:D,groundGridVisible:q,generatedSkies:z,activeGeneratedSkyId:G,panelMinimized:W}))},[G,D,z,q,W,k]),T.useEffect(()=>{if(!_){Y(0);return}const c=window.setInterval(()=>{Y(m=>Math.min(Ct.length-1,m+1))},1550);return()=>window.clearInterval(c)},[_]);const l=c=>{if(_||S)return;const m=J(c),M=Re(m.recipe,m.recipe);v(M),Q(M.prompt),X(null)},x=(c,m)=>{const M=Fr(k,c,m);v(M),G&&f(F=>F.map(V=>V.id===G?{...V,recipe:M}:V))},i=c=>{if(_||S)return;const m=Re(c.recipe,c.recipe);v(m),Q(m.prompt),X(c.id)},g=c=>{if(_||S)return;const m=z.filter(F=>F.id!==c);if(f(m),G!==c)return;const M=m[0];M?(v(M.recipe),Q(M.recipe.prompt),X(M.id)):(v(ue),Q(ue.prompt),X(null))},h=async()=>{if(s.current)return!1;if(!e)return L(),!1;const c=D.replace(/\s+/g," ").trim();if(c.length<8)return u({title:"Describe the atmosphere",description:"Add at least a few words so Sol has a clear direction."}),!1;s.current=!0,ee(!0),Y(0);const m=new Promise(M=>window.setTimeout(M,1900));try{const[M]=await Promise.all([$r({description:c,currentPreset:k.preset,fallback:k,payerKind:A,billingWorkspaceId:j}),m]);if(!d.current)return!1;v(M.recipe);const F={id:`sky-${Date.now()}-${M.recipe.seed}`,createdAt:Date.now(),recipe:M.recipe};return f(V=>[F,...V].slice(0,De)),X(F.id),P(),u({title:`${M.recipe.name} is live`,description:"Its new formation is rendering locally and has been saved in New Skies."}),!0}catch(M){return d.current&&u({variant:"destructive",title:"Could not form that sky",description:M instanceof Error?M.message:"Please try the recipe again."}),!1}finally{s.current=!1,d.current&&ee(!1)}},I=async c=>{const m=y.current;if(!m||!re||s.current)return!1;s.current=!0,E(c),b({progress:.08,label:"Preparing panorama"});try{const M=gt(k.name);if(c==="png"){const F=await m.capturePanorama({width:4096});if(!d.current)return!1;Ee(F.blob,`${M}-4096x2048.png`),u({title:"360 PNG ready",description:"Exported as a seamless 2:1 equirectangular panorama."})}else if(c==="hdr"){const F=await m.captureHdr({width:2048});if(!d.current)return!1;Ee(F,`${M}-scene-linear.hdr`),u({title:"Radiance HDR ready",description:"The procedural highlights preserve values above 1.0 for environment lighting."})}else{const F=await m.captureLoop({width:1280,durationSeconds:6,onProgress:V=>{d.current&&b({progress:V,label:`Rendering 360 loop · ${Math.round(V*100)}%`})}});if(!d.current)return!1;Ee(F.blob,`${M}-seamless-360-loop.${F.extension}`),u({title:"Animated 360 loop ready",description:"A six-second equirectangular loop was rendered locally—no AI frames were generated."})}return!0}catch(M){return u({variant:"destructive",title:"Export did not finish",description:M instanceof Error?M.message:"Please try the export again."}),!1}finally{s.current=!1,d.current&&(E(null),b(null))}},O=async c=>{const m=y.current;if(!m||!re||s.current||R)return!1;if(!(c.faceSize>=4096?p:n))return u({title:c.faceSize>=4096?"Creator+ required":"Starter+ required",description:"Your current plan does not include this engine export."}),!1;s.current=!0,E("engine"),b({progress:.02,label:"Baking procedural panorama"});let M=null;try{const F=c.upscaleFactor?8192:Math.min(8192,Math.max(4096,c.faceSize*4)),V=await m.capturePanorama({width:F});if(!d.current)return!1;let ie=V.dataUrl;if(t&&c.upscaleFactor){const{createTopazUpscale:ae}=await Tt(async()=>{const{createTopazUpscale:Me}=await import("./topazUpscale-D7AW5efP.js");return{createTopazUpscale:Me}},__vite__mapDeps([0,1,2,3,4,5,6])),Se=await ae(V.blob,{factor:c.upscaleFactor,payerKind:A,billingWorksp
117aceId:j,projectId:null,sourceOrigin:"hdri_result",onStatus:Me=>{d.current&&b({progress:.1,label:Me})}});M=URL.createObjectURL(Se.blob),ie=M}const le=await Kt({imageUrl:ie,settings:io(k),options:{...c,includeDepthRuntime:!1},baseName:gt(k.name),onProgress:ae=>{d.current&&b({progress:ae.progress,label:ae.label})}});return d.current?(Ee(le.blob,le.filename),u({title:`${c.target} pack ready`,description:c.upscaleFactor?`The ${c.upscaleFactor}× AI-upscaled panorama, cubemap faces, light rig, and setup files are inside the ZIP.`:"The 360 panorama, cubemap faces, light rig, and setup files are inside the ZIP."}),!0):!1}catch(F){return u({variant:"destructive",title:"Engine pack did not finish",description:F instanceof Error?F.message:"Please try the export again."}),!1}finally{M&&URL.revokeObjectURL(M),s.current=!1,d.current&&t&&c.upscaleFactor&&P(),d.current&&(E(null),b(null))}},$=T.useCallback(()=>C(!0),[]),H=_||S!==null,N=J(k.preset);return _r(ao({read:()=>({workspace:"procedural",ready:re,busy:H,exportTask:S,signedIn:e,recipe:k,scenery:N.scenery??null,description:D,paused:te,panelMinimized:W,groundGridVisible:N.scenery?null:q,presets:be.map(({id:c,label:m,category:M,scenery:F})=>({id:c,label:m,category:M,scenery:F??null})),savedSkies:z.map(({id:c,recipe:m})=>({id:c,name:m.name})),motionRanges:{minimum:ke,maximum:1,step:.01},exports:{png:[4096,2048],hdr:[2048,1024],loop:[1280,640],loopSeconds:6},canCreateSky:e&&D.trim().length>=8&&!H,enginePackAllowed:n,fourKEnginePackAllowed:p,entitlementLoading:R,sceneDescriptionSupport:"Curated scenery presets; description generation creates sky recipes only."}),configure:c=>{if(s.current)return{status:"busy"};const m=oo(c,k);return v(m.recipe),m.preset?X(null):G&&f(M=>M.map(F=>F.id===G?{...F,recipe:m.recipe}:F)),m.description!==void 0&&Q(m.description),m.paused!==void 0&&K(m.paused),m.groundGridVisible!==void 0&&Z(m.groundGridVisible),m.panelMinimized!==void 0&&se(m.panelMinimized),{status:"configured",preset:m.recipe.preset,motion:m.recipe.motion,preview:"updates_automatically"}},generate:h,export:I,exportEngine:O,resetView:()=>{var c;return(c=y.current)==null?void 0:c.resetView()}})),a.jsxs("div",{className:"absolute inset-0 isolate overflow-hidden bg-[#02030b] text-white","data-procedural-hdri-studio":!0,children:[a.jsx(to,{ref:y,recipe:k,paused:te||_,groundGridVisible:q,onReady:$,className:"absolute inset-0 h-full w-full touch-none cursor-grab active:cursor-grabbing"}),a.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:`linear-gradient(180deg,rgba(0,0,0,0.4),transparent 26%,transparent 54%,rgba(0,0,0,${N.scenery?.32:.82}))`}}),a.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_50%_65%,rgba(126,74,255,0.12),transparent_38%)]"}),re?null:a.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center bg-[#02030b] text-xs font-bold uppercase tracking-[0.16em] text-cyan-100",children:a.jsxs("span",{className:"inline-flex items-center gap-2",children:[a.jsx(xe,{className:"h-4 w-4 animate-spin"})," Loading local GPU"]})}),a.jsxs("div",{className:"absolute left-4 top-[calc(env(safe-area-inset-top)+4.8rem)] z-30 sm:left-6",children:[a.jsx(ro,{recipe:k,disabled:H,onSelect:l}),a.jsx("p",{className:"mt-2 hidden px-1 text-[10px] text-white/60 sm:block",children:"Drag to look around · scroll to zoom"})]}),a.jsxs("div",{className:"absolute right-4 top-[calc(env(safe-area-inset-top)+1rem)] z-30 flex items-center gap-2 sm:right-6",children:[a.jsxs("div",{className:"hidden items-center gap-1.5 rounded-md border border-white/12 bg-[#050716]/52 px-2.5 py-2 text-[9px] font-black uppercase tracking-[0.12em] text-emerald-200 backdrop-blur-xl md:flex",children:[a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-300"}),k.source==="sol"?"Sol recipe":"Preset"," · Local GPU"]}),a.jsx(he,{type:"button",size:"icon",variant:"ghost",title:te?"Resume procedural motion":"Pause procedural motion","aria-label":te?"Resume procedural motion":"Pause procedural motion",onClick:()=>K(c=>!c),className:"h-9 w-9 rounded-md border border-white/12 bg-[#050716]/52 text-white backdrop-blur-xl hover:bg-white/14 hover:text-white",children:te?a.jsx(It,{className:"h-4 w-4"}):a.jsx(Dt,{className:"h-4 w-4"})}),a.jsx(he,{type:"button",size:"icon",variant:"ghost",title:N.scener
117y?"Scenery includes its own terrain":q?"Hide ground and grid":"Show ground and grid","aria-label":q?"Hide ground and grid":"Show ground and grid","aria-pressed":q,"data-testid":"procedural-ground-grid-toggle",disabled:!!N.scenery,onClick:()=>Z(c=>!c),className:"h-9 w-9 rounded-md border border-white/12 bg-[#050716]/52 text-white backdrop-blur-xl hover:bg-white/14 hover:text-white",children:q?a.jsx(Gt,{className:"h-4 w-4"}):a.jsx(Ft,{className:"h-4 w-4"})}),a.jsx(he,{type:"button",size:"icon",variant:"ghost",title:"Reset procedural viewer","aria-label":"Reset procedural viewer",onClick:()=>{var c;return(c=y.current)==null?void 0:c.resetView()},className:"h-9 w-9 rounded-md border border-white/12 bg-[#050716]/52 text-white backdrop-blur-xl hover:bg-white/14 hover:text-white",children:a.jsx(Lt,{className:"h-4 w-4"})})]}),_?a.jsx(lo,{stage:B}):null,a.jsx("div",{className:`absolute left-1/2 z-30 w-[min(1220px,calc(100vw-1rem))] -translate-x-1/2 sm:w-[min(1220px,calc(100vw-2rem))] lg:left-6 lg:translate-x-0 ${W?"bottom-[max(4.75rem,env(safe-area-inset-bottom))] sm:bottom-[max(0.65rem,env(safe-area-inset-bottom))] lg:w-[min(620px,calc(100vw-3rem))]":"bottom-[max(0.65rem,env(safe-area-inset-bottom))] lg:right-44 lg:w-auto xl:right-56"}`,children:a.jsx("div",{id:"procedural-hdri-controls","data-testid":"procedural-control-panel","data-minimized":W?"true":"false",className:`rounded-xl border border-white/18 bg-[#070b22]/72 shadow-[0_34px_110px_-40px_rgba(0,0,0,0.98)] backdrop-blur-2xl transition-[width,background-color] duration-200 ${W?"overflow-hidden p-1.5":"max-h-[min(58dvh,480px)] overflow-y-auto p-2.5 sm:p-3"}`,children:W?a.jsxs("button",{type:"button","aria-label":"Expand sky controls","aria-expanded":"false","aria-controls":"procedural-hdri-controls","data-testid":"procedural-panel-toggle",onClick:()=>se(!1),className:"flex h-11 w-full items-center gap-3 rounded-lg border border-cyan-200/12 bg-black/20 px-3 text-left text-white transition hover:border-cyan-200/38 hover:bg-cyan-100/[0.08]",children:[a.jsx("span",{className:"grid h-7 w-7 shrink-0 place-items-center rounded-md border border-cyan-200/18 bg-cyan-200/10 text-cyan-100",children:a.jsx(Fe,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[10px] font-black uppercase tracking-[0.14em] text-white/86",children:k.name}),a.jsxs("span",{className:"block truncate text-[8px] font-bold uppercase tracking-[0.1em] text-white/42",children:[k.source==="sol"?`${Be(k.formation.type)} form`:`${N.label} preset`," · Tap to restore"]})]}),a.jsxs("span",{className:"hidden shrink-0 items-center gap-1.5 text-[8px] font-black uppercase tracking-[0.12em] text-cyan-100/70 sm:flex",children:["Open controls ",a.jsx(ut,{className:"h-4 w-4"})]}),a.jsx(ut,{className:"h-4 w-4 shrink-0 text-cyan-100 sm:hidden"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[a.jsxs("section",{className:"rounded-lg border border-cyan-200/12 bg-cyan-100/[0.035] p-2","data-testid":"procedural-new-skies-dock","aria-label":"New skies",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3 px-0.5",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx(Fe,{className:"h-3.5 w-3.5 shrink-0 text-cyan-200"}),a.jsx("p",{className:"text-[10px] font-black uppercase tracking-[0.16em] text-white/80",children:"New skies"}),a.jsx("span",{className:"hidden text-[9px] text-white/36 sm:inline",children:"Generated from your descriptions"})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsxs("span",{className:"text-[8px] font-bold uppercase tracking-[0.12em] text-white/38",children:[z.length,"/",De]}),a.jsxs(he,{type:"button",size:"sm",variant:"ghost",title:"Minimize sky controls","aria-label":"Minimize sky controls","aria-expanded":"true","aria-controls":"procedural-hdri-controls","data-testid":"procedural-panel-toggle",onClick:()=>se(!0),className:"h-7 gap-1 rounded-md border border-white/12 bg-black/20 px-2 text-[8px] font-black uppercase tracking-[0.1em] text-white/65 hover:border-cyan-200/38 hover:bg-cyan-100/10 hover:text-white",children:[a.jsx("span",{className:"hidden sm:inline",children:"Minimize"}),a.jsx(bt,{className:"h-3.5 w-3.5"})]})]})]}),z.length?a.jsx("div",{className:"grid auto-cols-[9.6rem] grid-flow-col gap-2 overflow-x-auto pb-1","aria-label":"Generated procedural skies",children:z.map(c=>{const m=G===c.id;return a.jsxs("div",{className:"relative min-w-0","data-testid":"procedural-new-sky-card","data-sky-id":c.id,"data-sky-formation":c.recipe.formation.type,children:[a.jsxs("button",{type:"button",disabled:H,"aria-label":`Load ${c.recipe.name}`,"aria-pressed":m,onClick:()=>i(c),className:`group w-full min-w-0 overflow-hidden rounded-lg border bg-black/30 p-1 text-left transition disabled:cursor-not-allowed disabled:opacity-45 ${m?"border-cyan-200/80 shadow-[0_0_0_1px_rgba(205,75,255,0.5),0_0_22px_rgba(57,210,255,0.16)]":"border-white/12 hover:border-cyan-200/45 hover:bg-white/8"}`,children:[a.jsxs("span",{className:"relative block h-11 overflow-hidden rounded-md",style:co(c.recipe),children:[a.jsx("i",{className:"absolute inset-x-0 bottom-[23%] h-px bg-white/65 shadow-[0_0_9px_rgba(255,255,255,0.75)]"}),a.jsx("span",{className:"absolute bottom-1 left-1 max-w-[7.5rem] truncate rounded bg-black/45 px-1 py-0.5 text-[7px] font-black uppercase tracking-[0.08em] text-white/80 backdrop-blur-sm",children:Be(c.recipe.formation.type)})]}),a.jsx("span",{className:"block truncate px-1 pb-0.5 pt-1 text-[9px] font-bold text-white/80 group-hover:text-white",children:c.recipe.name})]}),a.jsx("button",{type:"button",disabled:H,title:`Delete ${c.recipe.name}`,"aria-label":`Delete ${c.recipe.name}`,onClick:()=>g(c.id),className:"absolute right-1.5 top-1.5 grid h-6 w-6 place-items-center rounded-md border border-white/14 bg-black/60 text-white/60 backdrop-blur-sm transition hover:border-rose-200/45 hover:bg-rose-400/20 hover:text-rose-100 disabled:pointer-events-none",children:a.jsx($t,{className:"h-3 w-3"})})]},c.id)})}):a.jsx("div",{className:"rounded-md border border-dashed border-white/10 bg-black/15 px-3 py-2 text-[9px] text-white/42","data-testid":"procedural-new-skies-empty",children:"Your next generated sky will appear here so you can compare, revisit, or delete it."})]}),a.jsx("div",{children:a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[a.jsx("label",{htmlFor:"procedural-sky-description",className:"text-[10px] font-black uppercase tracking-[0.16em] text-white/74",children:"Describe your sky"}),a.jsxs("span",{className:"text-[8px] font-bold uppercase tracking-[0.1em] text-white/34",children:[D.length,"/",st]})]}),N.scenery?a.jsx("p",{className:"mb-2 text-[10px] text-white/55",children:"Scener
117y is included in every export. Creating a sky below replaces this scene with a new sky recipe."}):null,a.jsx("textarea",{id:"procedural-sky-description",value:D,maxLength:st,disabled:H,placeholder:"Aurora ribbons above a violet storm, slow seamless motion…",onChange:c=>Q(c.target.value),onKeyDown:c=>{(c.metaKey||c.ctrlKey)&&c.key==="Enter"&&h()},className:"h-[68px] w-full resize-none rounded-lg border border-white/16 !bg-black/30 px-3 py-2 text-[11px] leading-relaxed !text-white outline-none placeholder:!text-white/34 focus:border-cyan-200/48 focus:ring-2 focus:ring-cyan-200/10 disabled:opacity-50"}),a.jsxs(he,{type:"button",disabled:H||D.trim().length<8,onClick:()=>void h(),className:"mt-2 h-10 w-full rounded-lg border border-cyan-100/20 bg-[linear-gradient(100deg,#39c9ff_0%,#7c69ff_50%,#cb43f4_100%)] text-[10px] font-black uppercase tracking-[0.12em] text-white shadow-[0_12px_34px_-16px_rgba(119,83,255,0.85)] hover:brightness-110 disabled:opacity-55",children:[_?a.jsx(xe,{className:"h-4 w-4 animate-spin"}):a.jsx(Fe,{className:"h-4 w-4"}),_?"Forming your sky":e?"Create procedural sky":"Sign in to create",!_&&e?a.jsx("span",{className:"ml-auto rounded border border-white/18 bg-black/15 px-1.5 py-0.5 text-[8px] tracking-[0.08em]",children:"1 credit"}):null]})]})})]}),a.jsxs("div",{className:"mt-3 grid gap-2 border-t border-white/10 pt-3 lg:grid-cols-[minmax(310px,0.92fr)_minmax(0,1.08fr)]",children:[a.jsxs("div",{className:"grid grid-cols-3 rounded-lg border border-white/10 bg-black/20 py-2",children:[a.jsx(Ve,{label:"Speed",value:k.motion.speed,icon:a.jsx(Ut,{className:"h-3.5 w-3.5"}),disabled:H,onChange:c=>x("speed",c)}),a.jsx(Ve,{label:"Detail",value:k.motion.detail,icon:a.jsx(Ot,{className:"h-3.5 w-3.5"}),disabled:H,onChange:c=>x("detail",c)}),a.jsx(Ve,{label:"Glow",value:k.motion.glow,icon:a.jsx(Ht,{className:"h-3.5 w-3.5"}),disabled:H,onChange:c=>x("glow",c)})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[a.jsxs(he,{type:"button",variant:"ghost",disabled:H||!re,title:"Export a 4096 × 2048 equirectangular PNG",onClick:()=>void I("png"),className:"h-10 rounded-lg border border-white/14 bg-white/[0.045] text-[9px] font-black uppercase tracking-[0.1em] text-white hover:border-cyan-200/35 hover:bg-cyan-200/10 hover:text-white",children:[S==="png"?a.jsx(xe,{className:"h-4 w-4 animate-spin"}):a.jsx(Bt,{className:"h-4 w-4 text-cyan-200"}),"360 PNG"]}),a.jsxs(he,{type:"button",variant:"ghost",disabled:H||!re,title:"Export a scene-linear Radiance HDR environment",onClick:()=>void I("hdr"),className:"h-10 rounded-lg border border-white/14 bg-white/[0.045] text-[9px] font-black uppercase tracking-[0.1em] text-white hover:border-cyan-200/35 hover:bg-cyan-200/10 hover:text-white",children:[S==="hdr"?a.jsx(xe,{className:"h-4 w-4 animate-spin"}):a.jsx(Yt,{className:"h-4 w-4 text-cyan-200"}),"HDR"]}),a.jsxs(he,{type:"button",variant:"ghost",disabled:H||!re,title:"Render a seamless six-second animated 360 loop locally",onClick:()=>void I("loop"),className:"h-10 rounded-lg border border-white/14 bg-white/[0.045] text-[9px] font-black uppercase tracking-[0.1em] text-white hover:border-fuchsia-200/35 hover:bg-fuchsia-200/10 hover:text-white",children:[S==="loop"?a.jsx(xe,{className:"h-4 w-4 animate-spin"}):a.jsx(qt,{className:"h-4 w-4 text-fuchsia-200"}),"Loop"]}),a.jsx(Xt,{disabled:H||!re,initialTarget:r,sourceWidth:8192,sourceHeight:4096,creditMode:t,planName:o,engineExportAllowed:n,fourKExportAllowed:p,entitlementLoading:R,triggerMode:"button",triggerClassName:"h-10 w-full rounded-lg border border-white/14 bg-white/[0.045] text-[9px] font-black uppercase tracking-[0.08em] text-white hover:border-cyan-200/35 hover:bg-cyan-200/10 hover:text-white disabled:opacity-45",hasDepth:!1,depthGenerating:!1,depthProgress:null,exporting:S==="engine",exportProgress:w,onCreateDepth:()=>u({title:"Bake first, add depth next",description:"Export the still panorama, switch to AI HDRI, then use Create Depth."}),onExportPack:c=>void O(c),onOpenImageExports:()=>u({title:"Image exports are here",description:"Use 360 PNG or HDR beside the engine pack button."}),onDownloadDepthPng:()=>{},onDownloadDepthExr:()=>{}})]})]}),a.jsxs("div",{className:"mt-2 flex flex-col gap-2 rounded-lg border border-white/10 bg-black/18 px-3 py-2 sm:flex-row sm:items-center sm:justify-between",children:[a.jsxs("p",{className:"flex items-center gap-2 text-[9px] text-white/58",children:[a.jsx(Wt,{className:"h-4 w-4 shrink-0 text-cyan-200"}),a.jsxs("span",{children:[a.jsx("strong",{className:"text-white/80",children:"Sol designs the recipe once."})," Your GPU renders every frame—no per-frame AI bill."]})]}),a.jsx("div",{className:"flex items-center gap-2 text-[8px] font-bold uppercase tracking-[0.1em] text-white/42",children:w?a.jsxs(a.Fragment,{children:[a.jsx(xe,{className:"h-3.5 w-3.5 animate-spin text-cyan-200"}),a.jsx("span",{className:"max-w-[210px] truncate",children:w.label})]}):a.jsxs(a.Fragment,{children:[a.jsx(wt,{className:"h-3.5 w-3.5 text-emerald-300"}),a.jsxs("span",{children:[k.source==="sol"?`${Be(k.formation.type)} form · ${N.label} base`:`${N.label} preset`," · Seam-safe"]})]})})]})]})})}),a.jsx("style",{children:`
118        @keyframes procedural-forge-spin {
119          from { transform: translate(-50%, -50%) rotateX(var(--forge-tilt)) rotateZ(0deg) scale(var(--forge-scale)); }
120          to { transform: translate(-50%, -50%) rotateX(var(--forge-tilt)) rotateZ(360deg) scale(var(--forge-scale)); }
121        }
122        @keyframes procedural-forge-pulse {
123          0%, 100% { opacity: .28; transform: scale(.58); }
124          45% { opacity: 1; transform: scale(1.18); }
125        }
126        @keyframes procedural-particle {
127          0%, 100% { opacity: .1; transform: translate3d(-8px, 8px, 0) scale(.6); }
128          48% { opacity: .92; transform: translate3d(10px, -12px, 0) scale(1.5); }
129        }
130        .procedural-forge { width: min(44vw, 440px); aspect-ratio: 1; filter: drop-shadow(0 0 24px rgba(56,210,255,.25)); }
131        .procedural-forge__aura { position: absolute; inset: 16%; border-radius: 999px; background: radial-gradient(circle, rgba(255,255,255,.72) 0 1%, rgba(68,225,255,.25) 5%, rgba(134,66,255,.18) 36%, transparent 69%); filter: blur(8px); animation: procedural-forge-pulse 2.4s ease-in-out infinite; }
132        .procedural-forge__ring { --forge-scale: calc(.36 + var(--forge-index) * .085); --forge-tilt: calc(52deg + var(--forge-index) * 3deg); position: absolute; left: 50%; top: 50%; width: 86%; height: 86%; border-radius: 50%; border: 1px solid rgba(91,225,255,.68); border-left-color: rgba(222,79,255,.86); border-right-color: rgba(255,255,255,.18); box-shadow: 0 0 8px rgba(62,218,255,.28), inset 0 0 10px rgba(155,67,255,.12); animation: procedural-forge-spin calc(8s - var(--forge-index) * .48s) linear infinite; animation-delay: var(--forge-delay); }
133        .procedural-forge__axis { position: absolute; left: 50%; top: 7%; width: 1px; height: 86%; background: linear-gradient(transparent, rgba(83,222,255,.7), white, rgba(217,68,255,.7), transparent); box-shadow: 0 0 14px rgba(107,219,255,.85); }
134        .procedural-forge__core { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: white; box-shadow: 0 0 10px white, 0 0 34px #53e0ff, 0 0 62px #cf48ff; animation: procedural-forge-pulse 1.4s ease-in-out infinite; }
135        .procedural-forge__particle { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #c6f8ff; box-shadow: 0 0 8px #4ae5ff, 0 0 14px #d14eff; animation: procedural-particle ease-in-out infinite; }
136        @media (prefers-reduced-motion: reduce) {
137          .procedural-forge__ring, .procedural-forge__aura, .procedural-forge__core, .procedural-forge__particle { animation-duration: 12s !important; }
138        }
139      `})]})}
139export{Qn as default};
140//# sourceMappingURL=ProceduralHDRIStudio-norxcPE_.js.map

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.