@volter/editor 0.5.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BUNDLED_NOTICES +6196 -0
- package/LICENSE +686 -0
- package/LICENSE-BLENDER +1409 -0
- package/LICENSE-MCP +21 -0
- package/NOTICE +20 -0
- package/dist/.vite/manifest.json +1744 -0
- package/dist/assets/AudioViewer-DILwc7Pt.js +1 -0
- package/dist/assets/BVHLoader--2mLoe3e.js +1 -0
- package/dist/assets/BufferGeometryUtils-oP8-Ve4I.js +1 -0
- package/dist/assets/ColladaLoader-CyOCKXko.js +3 -0
- package/dist/assets/EntityModelDocument-DVlDQ_IJ.js +1 -0
- package/dist/assets/EnvironmentAssetDocument-BVGDJjW4.js +5 -0
- package/dist/assets/FBXLoader-DzWtiWYm.js +1 -0
- package/dist/assets/GameplaySessionTimeline-X_nMT8Sa.js +142 -0
- package/dist/assets/ImageViewer-D-aZoyr1.js +1 -0
- package/dist/assets/InspectorCanvasPreview-CLDhscy0.js +1 -0
- package/dist/assets/InspectorObjectPreview-CpHEw6QH.js +1 -0
- package/dist/assets/JsonAssetDocument-CLVN1V9Z.js +3 -0
- package/dist/assets/LineSegments2-vfeDUBfs.js +370 -0
- package/dist/assets/MTLLoader-D8SKGOsv.js +2 -0
- package/dist/assets/ModelAssetDocument-C60lQ11c.js +1 -0
- package/dist/assets/NonThreeAuthoringBootstrap-D8oHDftw.js +2 -0
- package/dist/assets/OBJLoader-8SrBLZ7J.js +5 -0
- package/dist/assets/Object3DPreview-CSmLPKkk.js +2 -0
- package/dist/assets/OnlineAssetDetail-D8wVVoay.js +2 -0
- package/dist/assets/OrbitControls-BHxt84w6.js +1 -0
- package/dist/assets/PLYLoader-BXUWXVtV.js +2 -0
- package/dist/assets/RectAreaLightUniformsLib-BGT7Bu4n.js +1 -0
- package/dist/assets/STLLoader-U-3fQm8v.js +1 -0
- package/dist/assets/SourceAssetViewer-BcOCJ2ye.js +13 -0
- package/dist/assets/StageHost-B_YrFNiC.js +1126 -0
- package/dist/assets/TDSLoader-BtiaQ4S3.js +1 -0
- package/dist/assets/ToolObject3DPreview-Crowr7IN.js +1 -0
- package/dist/assets/TransientHint-GNwuzA4c.js +1 -0
- package/dist/assets/VideoViewer-CjQ4P9AJ.js +1 -0
- package/dist/assets/_commonjsHelpers-D6-XlEtG.js +1 -0
- package/dist/assets/agx-base-srgb-BjWZJgrZ.lut +0 -0
- package/dist/assets/agx-look-medium-high-contrast-D5F_ob1L.lut +0 -0
- package/dist/assets/agx-look-punchy-dxsnycNs.lut +0 -0
- package/dist/assets/asset-editor-persistence-D3Yy77wZ.js +1 -0
- package/dist/assets/blender-emscripten-engine-C_uFxIuO.js +2 -0
- package/dist/assets/blender-node-editor.document-BfvoBocD.js +1 -0
- package/dist/assets/blender-outliner-model-B8b00oxr.js +1 -0
- package/dist/assets/blender-properties-tab-0M780SHF.js +3 -0
- package/dist/assets/blender-runtime-host-D8NHsAfD.js +4 -0
- package/dist/assets/blender-runtime-skin-DcwXD-m8.js +61 -0
- package/dist/assets/blender-runtime.document-BixTvrw8.js +7 -0
- package/dist/assets/blender-timeline.document-RtHIpbT1.js +1 -0
- package/dist/assets/blender-uv-editor.document-ChwaS3BG.js +1 -0
- package/dist/assets/blender-version.status-Bnhf8h1I.js +1 -0
- package/dist/assets/blender-wali-engine-C7bet0ss.js +2 -0
- package/dist/assets/blender.command-BCCEp0kb.js +1 -0
- package/dist/assets/blender.keymap-GAQgeklK.js +1 -0
- package/dist/assets/blender.status-ujwGU6dU.js +1 -0
- package/dist/assets/blender.style-Dcem5f_T.js +1 -0
- package/dist/assets/browserAll-Do0ehj3Q.js +14 -0
- package/dist/assets/client-DNXj_opT.js +25 -0
- package/dist/assets/clip-planes-CnAI6DZn.js +1 -0
- package/dist/assets/edit-mode-authoring-BX4IRQq9.js +1 -0
- package/dist/assets/editor-presentation-activity-C7SNSmTd.js +1 -0
- package/dist/assets/events-156d8d12.esm-Dy_KXdhT.js +36 -0
- package/dist/assets/fflate.module-DPuTF8aG.js +6 -0
- package/dist/assets/filmic-srgb-Ct35FIH6.lut +0 -0
- package/dist/assets/hosted-asset-materialization-BK7DHisS.js +2 -0
- package/dist/assets/index-5av5LJja.js +1691 -0
- package/dist/assets/index-BP6wv2A0.js +5 -0
- package/dist/assets/index-Bge9JUr6.js +1 -0
- package/dist/assets/index-BncK9THk.js +1 -0
- package/dist/assets/index-C5UECeSr.js +952 -0
- package/dist/assets/index-CJbYy-CF.js +3 -0
- package/dist/assets/index-CanA16PU.js +2 -0
- package/dist/assets/index-CinJrH5C.js +9 -0
- package/dist/assets/index-Cl83EGRl.js +2 -0
- package/dist/assets/index-CtzuWnCS.js +1 -0
- package/dist/assets/index-D2LwEE0L.js +562 -0
- package/dist/assets/index-D2fNXpHa.css +1 -0
- package/dist/assets/index-DUqP1RMl.js +1 -0
- package/dist/assets/index-D_NuPfjr.js +9 -0
- package/dist/assets/index-DaQZGF7d.js +1 -0
- package/dist/assets/index-DgapqSPi.js +7 -0
- package/dist/assets/index-IEjydI9d.js +1 -0
- package/dist/assets/index-gHZae-lw.js +13 -0
- package/dist/assets/jsx-runtime-DPjLkJKQ.js +9 -0
- package/dist/assets/model.layout-BJUEQYUI.js +1 -0
- package/dist/assets/models.finder-Bm1YfG95.js +1 -0
- package/dist/assets/product-Ywxte8eQ.js +1 -0
- package/dist/assets/properties-bone-constraints.inspector-Ck0Hzlvr.js +1 -0
- package/dist/assets/properties-bone.inspector-B8M42o0V.js +1 -0
- package/dist/assets/properties-collection.inspector-D-RSO5zy.js +1 -0
- package/dist/assets/properties-constraints.inspector-DbJa57oa.js +1 -0
- package/dist/assets/properties-data.inspector-DLgjbRW6.js +1 -0
- package/dist/assets/properties-material.inspector-B11LZYDW.js +1 -0
- package/dist/assets/properties-modifiers.inspector-BCWwuA26.js +1 -0
- package/dist/assets/properties-object.inspector-UZVJG49S.js +1 -0
- package/dist/assets/properties-output.inspector-XOwcBits.js +1 -0
- package/dist/assets/properties-particles.inspector-By04vT7R.js +1 -0
- package/dist/assets/properties-physics.inspector-D3T7FLdg.js +1 -0
- package/dist/assets/properties-render.inspector-Y0Rjr9gZ.js +1 -0
- package/dist/assets/properties-scene.inspector-CfyDWB4W.js +1 -0
- package/dist/assets/properties-texture.inspector-AFRsJx6-.js +1 -0
- package/dist/assets/properties-view-layer.inspector-Co07LAmQ.js +1 -0
- package/dist/assets/properties-world.inspector-C7T4JocI.js +1 -0
- package/dist/assets/react-18-DyywM-Z2.js +1 -0
- package/dist/assets/react-story-board-vrmj74Ng.js +1 -0
- package/dist/assets/react-three-rapier.esm-D874pLFD.js +1 -0
- package/dist/assets/sculpt.layout-zJF55yCR.js +1 -0
- package/dist/assets/session-1bPxsLdy.js +4167 -0
- package/dist/assets/shading.layout-DULYZV6M.js +1 -0
- package/dist/assets/sky-precompute-worker-ChN7J87v.js +1 -0
- package/dist/assets/spark.module-D1CUMLYS.js +12120 -0
- package/dist/assets/stage-keyboard-Cx90EYIT.js +1 -0
- package/dist/assets/stage-overlay-set-duu3P0mZ.js +1 -0
- package/dist/assets/stage-presence-markers-DKH3p_ao.js +1 -0
- package/dist/assets/story-capture-Dqurwlhr.js +1 -0
- package/dist/assets/story-mount-turn-2IYGgHob.js +1 -0
- package/dist/assets/story-pixi-preview-c78Aygdi.js +1 -0
- package/dist/assets/story-three-preview-CbZo5B3D.js +2 -0
- package/dist/assets/texture.layout-DASpHVht.js +1 -0
- package/dist/assets/three.module-BynznMJN.js +3840 -0
- package/dist/assets/uv-editing.layout-BEKHxmHw.js +1 -0
- package/dist/assets/vgai-shared-fontawesome-CFSkqz69.js +1 -0
- package/dist/assets/vgai-shared-jsx-dev-runtime-VfxIYu0y.js +9 -0
- package/dist/assets/vgai-shared-jsx-runtime-DIqBpTut.js +1 -0
- package/dist/assets/vgai-shared-react-DL5U9FnC.js +1 -0
- package/dist/assets/vgai-shared-react-dom-DFajMqMT.js +1 -0
- package/dist/assets/vgai-shared-react-dom-client-S0ozfl6_.js +1 -0
- package/dist/assets/vgai-shared-three-BWkbSQ3V.js +1 -0
- package/dist/assets/viewport-pick-context-DkawXbEi.js +1 -0
- package/dist/assets/webworkerAll-iMzrvNir.js +101 -0
- package/dist/assets/worker-DTgfRRas.js +1 -0
- package/dist/assets/world-documents-CGbrcsYk.js +3 -0
- package/dist/vgai-shared-react.json +10 -0
- package/dist/vgai-shared-three.json +3 -0
- package/dist-node/cli.js +17823 -0
- package/dist-node/create.js +14084 -0
- package/package.json +56 -0
- package/presets.mjs +2 -0
- package/src/contributions.d.ts +4 -0
- package/src/index.ts +9 -0
- package/starter/cube.blend +0 -0
- package/starter/cube.py +81 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e="workspace.layout",t={id:"uv-editing",title:"UV Editing",description:"Blender-shaped UV editing: the viewport beside the mesh's UV layout, read-only.",requires:{documentKind:"model"},regions:{header:"shown",shelf:"shown",inspector:"properties",drawer:"hidden"},areas:[{id:"uv",document:"blender-uv-editor.document",place:"left",ratio:.5003}]};export{t as layout,e as point};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e}from"./index-D2LwEE0L.js";import"./index-DaQZGF7d.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";const o=e,a=o.FontAwesomeIcon,c=o.FontAwesomeLayers,p=o.LayersCounter,y=o.LayersText;export{a as FontAwesomeIcon,c as FontAwesomeLayers,p as LayersCounter,y as LayersText,o as default};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{g as x}from"./_commonjsHelpers-D6-XlEtG.js";function v(e,i){for(var o=0;o<i.length;o++){const t=i[o];if(typeof t!="string"&&!Array.isArray(t)){for(const r in t)if(r!=="default"&&!(r in e)){const s=Object.getOwnPropertyDescriptor(t,r);s&&Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:()=>t[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var u={exports:{}},n={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-dev-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var a;function g(){if(a)return n;a=1;var e=Symbol.for("react.fragment");return n.Fragment=e,n.jsxDEV=void 0,n}var c;function R(){return c||(c=1,u.exports=g()),u.exports}var f=R();const m=x(f),_=v({__proto__:null,default:m},[f]),p=m??_,D=p.Fragment,l=p.jsxDEV;export{D as Fragment,p as default,l as jsxDEV};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,_ as n}from"./jsx-runtime-DPjLkJKQ.js";import"./_commonjsHelpers-D6-XlEtG.js";const s=t??n,a=s.Fragment,j=s.jsx,r=s.jsxs;export{a as Fragment,s as default,j as jsx,r as jsxs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as t,a as s}from"./index-DaQZGF7d.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";const e=t??s,a=e.Activity,u=e.Children,r=e.Component,i=e.Fragment,E=e.Profiler,_=e.PureComponent,l=e.StrictMode,f=e.Suspense,m=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R=e.__COMPILER_RUNTIME,S=e.cache,C=e.cacheSignal,d=e.cloneElement,N=e.createContext,T=e.createElement,p=e.createRef,I=e.forwardRef,A=e.isValidElement,O=e.lazy,h=e.memo,v=e.startTransition,y=e.unstable_useCacheRefresh,D=e.use,L=e.useActionState,M=e.useCallback,P=e.useContext,U=e.useDebugValue,x=e.useDeferredValue,b=e.useEffect,g=e.useEffectEvent,V=e.useId,H=e.useImperativeHandle,k=e.useInsertionEffect,w=e.useLayoutEffect,z=e.useMemo,F=e.useOptimistic,G=e.useReducer,W=e.useRef,Y=e.useState,j=e.useSyncExternalStore,q=e.useTransition,B=e.version;export{a as Activity,u as Children,r as Component,i as Fragment,E as Profiler,_ as PureComponent,l as StrictMode,f as Suspense,m as __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R as __COMPILER_RUNTIME,S as cache,C as cacheSignal,d as cloneElement,N as createContext,T as createElement,p as createRef,e as default,I as forwardRef,A as isValidElement,O as lazy,h as memo,v as startTransition,y as unstable_useCacheRefresh,D as use,L as useActionState,M as useCallback,P as useContext,U as useDebugValue,x as useDeferredValue,b as useEffect,g as useEffectEvent,V as useId,H as useImperativeHandle,k as useInsertionEffect,w as useLayoutEffect,z as useMemo,F as useOptimistic,G as useReducer,W as useRef,Y as useState,j as useSyncExternalStore,q as useTransition,B as version};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,_ as o}from"./index-CtzuWnCS.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-CinJrH5C.js";import"./index-D_NuPfjr.js";const t=e??o,c=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,a=t.createPortal,p=t.flushSync,u=t.preconnect,i=t.prefetchDNS,S=t.preinit,l=t.preinitModule,d=t.preload,N=t.preloadModule,m=t.requestFormReset,R=t.unstable_batchedUpdates,E=t.useFormState,O=t.useFormStatus,A=t.version;export{c as __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,a as createPortal,t as default,p as flushSync,u as preconnect,i as prefetchDNS,S as preinit,l as preinitModule,d as preload,N as preloadModule,m as requestFormReset,R as unstable_batchedUpdates,E as useFormState,O as useFormStatus,A as version};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as t,_ as r}from"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";const o=t??r,n=o.createRoot,i=o.hydrateRoot,m=o.version;export{n as createRoot,o as default,i as hydrateRoot,m as version};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as t}from"./three.module-BynznMJN.js";const e=t,n=e.ACESFilmicToneMapping,r=e.AddEquation,a=e.AddOperation,c=e.AdditiveAnimationBlendMode,s=e.AdditiveBlending,i=e.AgXToneMapping,l=e.AlphaFormat,p=e.AlwaysCompare,m=e.AlwaysDepth,u=e.AlwaysStencilFunc,d=e.AmbientLight,C=e.AnimationAction,S=e.AnimationClip,T=e.AnimationLoader,g=e.AnimationMixer,M=e.AnimationObjectGroup,F=e.AnimationUtils,A=e.ArcCurve,G=e.ArrayCamera,h=e.ArrowHelper,B=e.AttachedBindMode,_=e.Audio,R=e.AudioAnalyser,L=e.AudioContext,y=e.AudioListener,D=e.AudioLoader,f=e.AxesHelper,E=e.BackSide,x=e.BasicDepthPacking,b=e.BasicShadowMap,P=e.BatchedMesh,I=e.Bone,U=e.BooleanKeyframeTrack,N=e.Box2,O=e.Box3,v=e.Box3Helper,k=e.BoxGeometry,q=e.BoxHelper,H=e.BufferAttribute,V=e.BufferGeometry,w=e.BufferGeometryLoader,W=e.ByteType,K=e.Cache,Q=e.Camera,X=e.CameraHelper,j=e.CanvasTexture,z=e.CapsuleGeometry,Z=e.CatmullRomCurve3,J=e.CineonToneMapping,Y=e.CircleGeometry,$=e.ClampToEdgeWrapping,ee=e.Clock,te=e.Color,oe=e.ColorKeyframeTrack,ne=e.ColorManagement,re=e.CompressedArrayTexture,ae=e.CompressedCubeTexture,ce=e.CompressedTexture,se=e.CompressedTextureLoader,ie=e.ConeGeometry,le=e.ConstantAlphaFactor,pe=e.ConstantColorFactor,me=e.Controls,ue=e.CubeCamera,de=e.CubeReflectionMapping,Ce=e.CubeRefractionMapping,Se=e.CubeTexture,Te=e.CubeTextureLoader,ge=e.CubeUVReflectionMapping,Me=e.CubicBezierCurve,Fe=e.CubicBezierCurve3,Ae=e.CubicInterpolant,Ge=e.CullFaceBack,he=e.CullFaceFront,Be=e.CullFaceFrontBack,_e=e.CullFaceNone,Re=e.Curve,Le=e.CurvePath,ye=e.CustomBlending,De=e.CustomToneMapping,fe=e.CylinderGeometry,Ee=e.Cylindrical,xe=e.Data3DTexture,be=e.DataArrayTexture,Pe=e.DataTexture,Ie=e.DataTextureLoader,Ue=e.DataUtils,Ne=e.DecrementStencilOp,Oe=e.DecrementWrapStencilOp,ve=e.DefaultLoadingManager,ke=e.DepthFormat,qe=e.DepthStencilFormat,He=e.DepthTexture,Ve=e.DetachedBindMode,we=e.DirectionalLight,We=e.DirectionalLightHelper,Ke=e.DiscreteInterpolant,Qe=e.DodecahedronGeometry,Xe=e.DoubleSide,je=e.DstAlphaFactor,ze=e.DstColorFactor,Ze=e.DynamicCopyUsage,Je=e.DynamicDrawUsage,Ye=e.DynamicReadUsage,$e=e.EdgesGeometry,et=e.EllipseCurve,tt=e.EqualCompare,ot=e.EqualDepth,nt=e.EqualStencilFunc,rt=e.EquirectangularReflectionMapping,at=e.EquirectangularRefractionMapping,ct=e.Euler,st=e.EventDispatcher,it=e.ExternalTexture,lt=e.ExtrudeGeometry,pt=e.FileLoader,mt=e.Float16BufferAttribute,ut=e.Float32BufferAttribute,dt=e.FloatType,Ct=e.Fog,St=e.FogExp2,Tt=e.FramebufferTexture,gt=e.FrontSide,Mt=e.Frustum,Ft=e.FrustumArray,At=e.GLBufferAttribute,Gt=e.GLSL1,ht=e.GLSL3,Bt=e.GreaterCompare,_t=e.GreaterDepth,Rt=e.GreaterEqualCompare,Lt=e.GreaterEqualDepth,yt=e.GreaterEqualStencilFunc,Dt=e.GreaterStencilFunc,ft=e.GridHelper,Et=e.Group,xt=e.HalfFloatType,bt=e.HemisphereLight,Pt=e.HemisphereLightHelper,It=e.IcosahedronGeometry,Ut=e.ImageBitmapLoader,Nt=e.ImageLoader,Ot=e.ImageUtils,vt=e.IncrementStencilOp,kt=e.IncrementWrapStencilOp,qt=e.InstancedBufferAttribute,Ht=e.InstancedBufferGeometry,Vt=e.InstancedInterleavedBuffer,wt=e.InstancedMesh,Wt=e.Int16BufferAttribute,Kt=e.Int32BufferAttribute,Qt=e.Int8BufferAttribute,Xt=e.IntType,jt=e.InterleavedBuffer,zt=e.InterleavedBufferAttribute,Zt=e.Interpolant,Jt=e.InterpolateDiscrete,Yt=e.InterpolateLinear,$t=e.InterpolateSmooth,eo=e.InterpolationSamplingMode,to=e.InterpolationSamplingType,oo=e.InvertStencilOp,no=e.KeepStencilOp,ro=e.KeyframeTrack,ao=e.LOD,co=e.LatheGeometry,so=e.Layers,io=e.LessCompare,lo=e.LessDepth,po=e.LessEqualCompare,mo=e.LessEqualDepth,uo=e.LessEqualStencilFunc,Co=e.LessStencilFunc,So=e.Light,To=e.LightProbe,go=e.Line,Mo=e.Line3,Fo=e.LineBasicMaterial,Ao=e.LineCurve,Go=e.LineCurve3,ho=e.LineDashedMaterial,Bo=e.LineLoop,_o=e.LineSegments,Ro=e.LinearFilter,Lo=e.LinearInterpolant,yo=e.LinearMipMapLinearFilter,Do=e.LinearMipMapNearestFilter,fo=e.LinearMipmapLinearFilter,Eo=e.LinearMipmapNearestFilter,xo=e.LinearSRGBColorSpace,bo=e.LinearToneMapping,Po=e.LinearTransfer,Io=e.Loader,Uo=e.LoaderUtils,No=e.LoadingManager,Oo=e.LoopOnce,vo=e.LoopPingPong,ko=e.LoopRepeat,qo=e.MOUSE,Ho=e.Material,Vo=e.MaterialLoader,wo=e.MathUtils,Wo=e.Matrix2,Ko=e.Matrix3,Qo=e.Matrix4,Xo=e.MaxEquation,jo=e.Mesh,zo=e.MeshBasicMaterial,Zo=e.MeshDepthMaterial,Jo=e.MeshDistanceMaterial,Yo=e.MeshLambertMaterial,$o=e.MeshMatcapMaterial,en=e.MeshNormalMaterial,tn=e.MeshPhongMaterial,on=e.MeshPhysicalMaterial,nn=e.MeshStandardMaterial,rn=e.MeshToonMaterial,an=e.MinEquation,cn=e.MirroredRepeatWrapping,sn=e.MixOperation,ln=e.MultiplyBlending,pn=e.MultiplyOperation,mn=e.NearestFilter,un=e.NearestMipMapLinearFilter,dn=e.NearestMipMapNearestFilter,Cn=e.NearestMipmapLinearFilter,Sn=e.NearestMipmapNearestFilter,Tn=e.NeutralToneMapping,gn=e.NeverCompare,Mn=e.NeverDepth,Fn=e.NeverStencilFunc,An=e.NoBlending,Gn=e.NoColorSpace,hn=e.NoToneMapping,Bn=e.NormalAnimationBlendMode,_n=e.NormalBlending,Rn=e.NotEqualCompare,Ln=e.NotEqualDepth,yn=e.NotEqualStencilFunc,Dn=e.NumberKeyframeTrack,fn=e.Object3D,En=e.ObjectLoader,xn=e.ObjectSpaceNormalMap,bn=e.OctahedronGeometry,Pn=e.OneFactor,In=e.OneMinusConstantAlphaFactor,Un=e.OneMinusConstantColorFactor,Nn=e.OneMinusDstAlphaFactor,On=e.OneMinusDstColorFactor,vn=e.OneMinusSrcAlphaFactor,kn=e.OneMinusSrcColorFactor,qn=e.OrthographicCamera,Hn=e.PCFShadowMap,Vn=e.PCFSoftShadowMap,wn=e.PMREMGenerator,Wn=e.Path,Kn=e.PerspectiveCamera,Qn=e.Plane,Xn=e.PlaneGeometry,jn=e.PlaneHelper,zn=e.PointLight,Zn=e.PointLightHelper,Jn=e.Points,Yn=e.PointsMaterial,$n=e.PolarGridHelper,er=e.PolyhedronGeometry,tr=e.PositionalAudio,or=e.PropertyBinding,nr=e.PropertyMixer,rr=e.QuadraticBezierCurve,ar=e.QuadraticBezierCurve3,cr=e.Quaternion,sr=e.QuaternionKeyframeTrack,ir=e.QuaternionLinearInterpolant,lr=e.RED_GREEN_RGTC2_Format,pr=e.RED_RGTC1_Format,mr=e.REVISION,ur=e.RGBADepthPacking,dr=e.RGBAFormat,Cr=e.RGBAIntegerFormat,Sr=e.RGBA_ASTC_10x10_Format,Tr=e.RGBA_ASTC_10x5_Format,gr=e.RGBA_ASTC_10x6_Format,Mr=e.RGBA_ASTC_10x8_Format,Fr=e.RGBA_ASTC_12x10_Format,Ar=e.RGBA_ASTC_12x12_Format,Gr=e.RGBA_ASTC_4x4_Format,hr=e.RGBA_ASTC_5x4_Format,Br=e.RGBA_ASTC_5x5_Format,_r=e.RGBA_ASTC_6x5_Format,Rr=e.RGBA_ASTC_6x6_Format,Lr=e.RGBA_ASTC_8x5_Format,yr=e.RGBA_ASTC_8x6_Format,Dr=e.RGBA_ASTC_8x8_Format,fr=e.RGBA_BPTC_Format,Er=e.RGBA_ETC2_EAC_Format,xr=e.RGBA_PVRTC_2BPPV1_Format,br=e.RGBA_PVRTC_4BPPV1_Format,Pr=e.RGBA_S3TC_DXT1_Format,Ir=e.RGBA_S3TC_DXT3_Format,Ur=e.RGBA_S3TC_DXT5_Format,Nr=e.RGBDepthPacking,Or=e.RGBFormat,vr=e.RGBIntegerFormat,kr=e.RGB_BPTC_SIGNED_Format,qr=e.RGB_BPTC_UNSIGNED_Format,Hr=e.RGB_ETC1_Format,Vr=e.RGB_ETC2_Format,wr=e.RGB_PVRTC_2BPPV1_Format,Wr=e.RGB_PVRTC_4BPPV1_Format,Kr=e.RGB_S3TC_DXT1_Format,Qr=e.RGDepthPacking,Xr=e.RGFormat,jr=e.RGIntegerFormat,zr=e.RawShaderMaterial,Zr=e.Ray,Jr=e.Raycaster,Yr=e.RectAreaLight,$r=e.RedFormat,ea=e.RedIntegerFormat,ta=e.ReinhardToneMapping,oa=e.RenderTarget,na=e.RenderTarget3D,ra=e.RepeatWrapping,aa=e.ReplaceStencilOp,ca=e.ReverseSubtractEquation,sa=e.RingGeometry,ia=e.SIGNED_RED_GREEN_RGTC2_Format,la=e.SIGNED_RED_RGTC1_Format,pa=e.SRGBColorSpace,ma=e.SRGBTransfer,ua=e.Scene,da=e.ShaderChunk,Ca=e.ShaderLib,Sa=e.ShaderMaterial,Ta=e.ShadowMaterial,ga=e.Shape,Ma=e.ShapeGeometry,Fa=e.ShapePath,Aa=e.ShapeUtils,Ga=e.ShortType,ha=e.Skeleton,Ba=e.SkeletonHelper,_a=e.SkinnedMesh,Ra=e.Source,La=e.Sphere,ya=e.SphereGeometry,Da=e.Spherical,fa=e.SphericalHarmonics3,Ea=e.SplineCurve,xa=e.SpotLight,ba=e.SpotLightHelper,Pa=e.Sprite,Ia=e.SpriteMaterial,Ua=e.SrcAlphaFactor,Na=e.SrcAlphaSaturateFactor,Oa=e.SrcColorFactor,va=e.StaticCopyUsage,ka=e.StaticDrawUsage,qa=e.StaticReadUsage,Ha=e.StereoCamera,Va=e.StreamCopyUsage,wa=e.StreamDrawUsage,Wa=e.StreamReadUsage,Ka=e.StringKeyframeTrack,Qa=e.SubtractEquation,Xa=e.SubtractiveBlending,ja=e.TOUCH,za=e.TangentSpaceNormalMap,Za=e.TetrahedronGeometry,Ja=e.Texture,Ya=e.TextureLoader,$a=e.TextureUtils,ec=e.Timer,tc=e.TimestampQuery,oc=e.TorusGeometry,nc=e.TorusKnotGeometry,rc=e.Triangle,ac=e.TriangleFanDrawMode,cc=e.TriangleStripDrawMode,sc=e.TrianglesDrawMode,ic=e.TubeGeometry,lc=e.UVMapping,pc=e.Uint16BufferAttribute,mc=e.Uint32BufferAttribute,uc=e.Uint8BufferAttribute,dc=e.Uint8ClampedBufferAttribute,Cc=e.Uniform,Sc=e.UniformsGroup,Tc=e.UniformsLib,gc=e.UniformsUtils,Mc=e.UnsignedByteType,Fc=e.UnsignedInt101111Type,Ac=e.UnsignedInt248Type,Gc=e.UnsignedInt5999Type,hc=e.UnsignedIntType,Bc=e.UnsignedShort4444Type,_c=e.UnsignedShort5551Type,Rc=e.UnsignedShortType,Lc=e.VSMShadowMap,yc=e.Vector2,Dc=e.Vector3,fc=e.Vector4,Ec=e.VectorKeyframeTrack,xc=e.VideoFrameTexture,bc=e.VideoTexture,Pc=e.WebGL3DRenderTarget,Ic=e.WebGLArrayRenderTarget,Uc=e.WebGLCoordinateSystem,Nc=e.WebGLCubeRenderTarget,Oc=e.WebGLRenderTarget,vc=e.WebGLRenderer,kc=e.WebGLUtils,qc=e.WebGPUCoordinateSystem,Hc=e.WebXRController,Vc=e.WireframeGeometry,wc=e.WrapAroundEnding,Wc=e.ZeroCurvatureEnding,Kc=e.ZeroFactor,Qc=e.ZeroSlopeEnding,Xc=e.ZeroStencilOp,jc=e.createCanvasElement;export{n as ACESFilmicToneMapping,r as AddEquation,a as AddOperation,c as AdditiveAnimationBlendMode,s as AdditiveBlending,i as AgXToneMapping,l as AlphaFormat,p as AlwaysCompare,m as AlwaysDepth,u as AlwaysStencilFunc,d as AmbientLight,C as AnimationAction,S as AnimationClip,T as AnimationLoader,g as AnimationMixer,M as AnimationObjectGroup,F as AnimationUtils,A as ArcCurve,G as ArrayCamera,h as ArrowHelper,B as AttachedBindMode,_ as Audio,R as AudioAnalyser,L as AudioContext,y as AudioListener,D as AudioLoader,f as AxesHelper,E as BackSide,x as BasicDepthPacking,b as BasicShadowMap,P as BatchedMesh,I as Bone,U as BooleanKeyframeTrack,N as Box2,O as Box3,v as Box3Helper,k as BoxGeometry,q as BoxHelper,H as BufferAttribute,V as BufferGeometry,w as BufferGeometryLoader,W as ByteType,K as Cache,Q as Camera,X as CameraHelper,j as CanvasTexture,z as CapsuleGeometry,Z as CatmullRomCurve3,J as CineonToneMapping,Y as CircleGeometry,$ as ClampToEdgeWrapping,ee as Clock,te as Color,oe as ColorKeyframeTrack,ne as ColorManagement,re as CompressedArrayTexture,ae as CompressedCubeTexture,ce as CompressedTexture,se as CompressedTextureLoader,ie as ConeGeometry,le as ConstantAlphaFactor,pe as ConstantColorFactor,me as Controls,ue as CubeCamera,de as CubeReflectionMapping,Ce as CubeRefractionMapping,Se as CubeTexture,Te as CubeTextureLoader,ge as CubeUVReflectionMapping,Me as CubicBezierCurve,Fe as CubicBezierCurve3,Ae as CubicInterpolant,Ge as CullFaceBack,he as CullFaceFront,Be as CullFaceFrontBack,_e as CullFaceNone,Re as Curve,Le as CurvePath,ye as CustomBlending,De as CustomToneMapping,fe as CylinderGeometry,Ee as Cylindrical,xe as Data3DTexture,be as DataArrayTexture,Pe as DataTexture,Ie as DataTextureLoader,Ue as DataUtils,Ne as DecrementStencilOp,Oe as DecrementWrapStencilOp,ve as DefaultLoadingManager,ke as DepthFormat,qe as DepthStencilFormat,He as DepthTexture,Ve as DetachedBindMode,we as DirectionalLight,We as DirectionalLightHelper,Ke as DiscreteInterpolant,Qe as DodecahedronGeometry,Xe as DoubleSide,je as DstAlphaFactor,ze as DstColorFactor,Ze as DynamicCopyUsage,Je as DynamicDrawUsage,Ye as DynamicReadUsage,$e as EdgesGeometry,et as EllipseCurve,tt as EqualCompare,ot as EqualDepth,nt as EqualStencilFunc,rt as EquirectangularReflectionMapping,at as EquirectangularRefractionMapping,ct as Euler,st as EventDispatcher,it as ExternalTexture,lt as ExtrudeGeometry,pt as FileLoader,mt as Float16BufferAttribute,ut as Float32BufferAttribute,dt as FloatType,Ct as Fog,St as FogExp2,Tt as FramebufferTexture,gt as FrontSide,Mt as Frustum,Ft as FrustumArray,At as GLBufferAttribute,Gt as GLSL1,ht as GLSL3,Bt as GreaterCompare,_t as GreaterDepth,Rt as GreaterEqualCompare,Lt as GreaterEqualDepth,yt as GreaterEqualStencilFunc,Dt as GreaterStencilFunc,ft as GridHelper,Et as Group,xt as HalfFloatType,bt as HemisphereLight,Pt as HemisphereLightHelper,It as IcosahedronGeometry,Ut as ImageBitmapLoader,Nt as ImageLoader,Ot as ImageUtils,vt as IncrementStencilOp,kt as IncrementWrapStencilOp,qt as InstancedBufferAttribute,Ht as InstancedBufferGeometry,Vt as InstancedInterleavedBuffer,wt as InstancedMesh,Wt as Int16BufferAttribute,Kt as Int32BufferAttribute,Qt as Int8BufferAttribute,Xt as IntType,jt as InterleavedBuffer,zt as InterleavedBufferAttribute,Zt as Interpolant,Jt as InterpolateDiscrete,Yt as InterpolateLinear,$t as InterpolateSmooth,eo as InterpolationSamplingMode,to as InterpolationSamplingType,oo as InvertStencilOp,no as KeepStencilOp,ro as KeyframeTrack,ao as LOD,co as LatheGeometry,so as Layers,io as LessCompare,lo as LessDepth,po as LessEqualCompare,mo as LessEqualDepth,uo as LessEqualStencilFunc,Co as LessStencilFunc,So as Light,To as LightProbe,go as Line,Mo as Line3,Fo as LineBasicMaterial,Ao as LineCurve,Go as LineCurve3,ho as LineDashedMaterial,Bo as LineLoop,_o as LineSegments,Ro as LinearFilter,Lo as LinearInterpolant,yo as LinearMipMapLinearFilter,Do as LinearMipMapNearestFilter,fo as LinearMipmapLinearFilter,Eo as LinearMipmapNearestFilter,xo as LinearSRGBColorSpace,bo as LinearToneMapping,Po as LinearTransfer,Io as Loader,Uo as LoaderUtils,No as LoadingManager,Oo as LoopOnce,vo as LoopPingPong,ko as LoopRepeat,qo as MOUSE,Ho as Material,Vo as MaterialLoader,wo as MathUtils,Wo as Matrix2,Ko as Matrix3,Qo as Matrix4,Xo as MaxEquation,jo as Mesh,zo as MeshBasicMaterial,Zo as MeshDepthMaterial,Jo as MeshDistanceMaterial,Yo as MeshLambertMaterial,$o as MeshMatcapMaterial,en as MeshNormalMaterial,tn as MeshPhongMaterial,on as MeshPhysicalMaterial,nn as MeshStandardMaterial,rn as MeshToonMaterial,an as MinEquation,cn as MirroredRepeatWrapping,sn as MixOperation,ln as MultiplyBlending,pn as MultiplyOperation,mn as NearestFilter,un as NearestMipMapLinearFilter,dn as NearestMipMapNearestFilter,Cn as NearestMipmapLinearFilter,Sn as NearestMipmapNearestFilter,Tn as NeutralToneMapping,gn as NeverCompare,Mn as NeverDepth,Fn as NeverStencilFunc,An as NoBlending,Gn as NoColorSpace,hn as NoToneMapping,Bn as NormalAnimationBlendMode,_n as NormalBlending,Rn as NotEqualCompare,Ln as NotEqualDepth,yn as NotEqualStencilFunc,Dn as NumberKeyframeTrack,fn as Object3D,En as ObjectLoader,xn as ObjectSpaceNormalMap,bn as OctahedronGeometry,Pn as OneFactor,In as OneMinusConstantAlphaFactor,Un as OneMinusConstantColorFactor,Nn as OneMinusDstAlphaFactor,On as OneMinusDstColorFactor,vn as OneMinusSrcAlphaFactor,kn as OneMinusSrcColorFactor,qn as OrthographicCamera,Hn as PCFShadowMap,Vn as PCFSoftShadowMap,wn as PMREMGenerator,Wn as Path,Kn as PerspectiveCamera,Qn as Plane,Xn as PlaneGeometry,jn as PlaneHelper,zn as PointLight,Zn as PointLightHelper,Jn as Points,Yn as PointsMaterial,$n as PolarGridHelper,er as PolyhedronGeometry,tr as PositionalAudio,or as PropertyBinding,nr as PropertyMixer,rr as QuadraticBezierCurve,ar as QuadraticBezierCurve3,cr as Quaternion,sr as QuaternionKeyframeTrack,ir as QuaternionLinearInterpolant,lr as RED_GREEN_RGTC2_Format,pr as RED_RGTC1_Format,mr as REVISION,ur as RGBADepthPacking,dr as RGBAFormat,Cr as RGBAIntegerFormat,Sr as RGBA_ASTC_10x10_Format,Tr as RGBA_ASTC_10x5_Format,gr as RGBA_ASTC_10x6_Format,Mr as RGBA_ASTC_10x8_Format,Fr as RGBA_ASTC_12x10_Format,Ar as RGBA_ASTC_12x12_Format,Gr as RGBA_ASTC_4x4_Format,hr as RGBA_ASTC_5x4_Format,Br as RGBA_ASTC_5x5_Format,_r as RGBA_ASTC_6x5_Format,Rr as RGBA_ASTC_6x6_Format,Lr as RGBA_ASTC_8x5_Format,yr as RGBA_ASTC_8x6_Format,Dr as RGBA_ASTC_8x8_Format,fr as RGBA_BPTC_Format,Er as RGBA_ETC2_EAC_Format,xr as RGBA_PVRTC_2BPPV1_Format,br as RGBA_PVRTC_4BPPV1_Format,Pr as RGBA_S3TC_DXT1_Format,Ir as RGBA_S3TC_DXT3_Format,Ur as RGBA_S3TC_DXT5_Format,Nr as RGBDepthPacking,Or as RGBFormat,vr as RGBIntegerFormat,kr as RGB_BPTC_SIGNED_Format,qr as RGB_BPTC_UNSIGNED_Format,Hr as RGB_ETC1_Format,Vr as RGB_ETC2_Format,wr as RGB_PVRTC_2BPPV1_Format,Wr as RGB_PVRTC_4BPPV1_Format,Kr as RGB_S3TC_DXT1_Format,Qr as RGDepthPacking,Xr as RGFormat,jr as RGIntegerFormat,zr as RawShaderMaterial,Zr as Ray,Jr as Raycaster,Yr as RectAreaLight,$r as RedFormat,ea as RedIntegerFormat,ta as ReinhardToneMapping,oa as RenderTarget,na as RenderTarget3D,ra as RepeatWrapping,aa as ReplaceStencilOp,ca as ReverseSubtractEquation,sa as RingGeometry,ia as SIGNED_RED_GREEN_RGTC2_Format,la as SIGNED_RED_RGTC1_Format,pa as SRGBColorSpace,ma as SRGBTransfer,ua as Scene,da as ShaderChunk,Ca as ShaderLib,Sa as ShaderMaterial,Ta as ShadowMaterial,ga as Shape,Ma as ShapeGeometry,Fa as ShapePath,Aa as ShapeUtils,Ga as ShortType,ha as Skeleton,Ba as SkeletonHelper,_a as SkinnedMesh,Ra as Source,La as Sphere,ya as SphereGeometry,Da as Spherical,fa as SphericalHarmonics3,Ea as SplineCurve,xa as SpotLight,ba as SpotLightHelper,Pa as Sprite,Ia as SpriteMaterial,Ua as SrcAlphaFactor,Na as SrcAlphaSaturateFactor,Oa as SrcColorFactor,va as StaticCopyUsage,ka as StaticDrawUsage,qa as StaticReadUsage,Ha as StereoCamera,Va as StreamCopyUsage,wa as StreamDrawUsage,Wa as StreamReadUsage,Ka as StringKeyframeTrack,Qa as SubtractEquation,Xa as SubtractiveBlending,ja as TOUCH,za as TangentSpaceNormalMap,Za as TetrahedronGeometry,Ja as Texture,Ya as TextureLoader,$a as TextureUtils,ec as Timer,tc as TimestampQuery,oc as TorusGeometry,nc as TorusKnotGeometry,rc as Triangle,ac as TriangleFanDrawMode,cc as TriangleStripDrawMode,sc as TrianglesDrawMode,ic as TubeGeometry,lc as UVMapping,pc as Uint16BufferAttribute,mc as Uint32BufferAttribute,uc as Uint8BufferAttribute,dc as Uint8ClampedBufferAttribute,Cc as Uniform,Sc as UniformsGroup,Tc as UniformsLib,gc as UniformsUtils,Mc as UnsignedByteType,Fc as UnsignedInt101111Type,Ac as UnsignedInt248Type,Gc as UnsignedInt5999Type,hc as UnsignedIntType,Bc as UnsignedShort4444Type,_c as UnsignedShort5551Type,Rc as UnsignedShortType,Lc as VSMShadowMap,yc as Vector2,Dc as Vector3,fc as Vector4,Ec as VectorKeyframeTrack,xc as VideoFrameTexture,bc as VideoTexture,Pc as WebGL3DRenderTarget,Ic as WebGLArrayRenderTarget,Uc as WebGLCoordinateSystem,Nc as WebGLCubeRenderTarget,Oc as WebGLRenderTarget,vc as WebGLRenderer,kc as WebGLUtils,qc as WebGPUCoordinateSystem,Hc as WebXRController,Vc as WireframeGeometry,wc as WrapAroundEnding,Wc as ZeroCurvatureEnding,Kc as ZeroFactor,Qc as ZeroSlopeEnding,Xc as ZeroStencilOp,jc as createCanvasElement,e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let t=null;function n(e){t=e}function o(){return t}export{o as g,n as s};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import{eD as v,eE as C,b_ as Z,eF as z,eG as R,eH as T,eI as te,eJ as Ce,eK as ce,eL as F,bZ as P,eM as E,b$ as Se,c0 as he}from"./index-5av5LJja.js";import"./index-DaQZGF7d.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";const B=Object.create(null),re=Object.create(null);function Q(s,e){let t=re[s];return t===void 0&&(B[e]===void 0&&(B[e]=1),re[s]=t=B[e]++),t}let k;function Pe(){return(!k||k?.isContextLost())&&(k=v.get().createCanvas().getContext("webgl",{})),k}let G;function Ie(){if(!G){G="mediump";const s=Pe();s&&s.getShaderPrecisionFormat&&(G=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision?"highp":"mediump")}return G}function Ae(s,e,t){return e?s:t?(s=s.replace("out vec4 finalColor;",""),`
|
|
2
|
+
|
|
3
|
+
#ifdef GL_ES // This checks if it is WebGL1
|
|
4
|
+
#define in varying
|
|
5
|
+
#define finalColor gl_FragColor
|
|
6
|
+
#define texture texture2D
|
|
7
|
+
#endif
|
|
8
|
+
${s}
|
|
9
|
+
`):`
|
|
10
|
+
|
|
11
|
+
#ifdef GL_ES // This checks if it is WebGL1
|
|
12
|
+
#define in attribute
|
|
13
|
+
#define out varying
|
|
14
|
+
#endif
|
|
15
|
+
${s}
|
|
16
|
+
`}function Me(s,e,t){const r=t?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if(s.substring(0,9)!=="precision"){let i=t?e.requestedFragmentPrecision:e.requestedVertexPrecision;return i==="highp"&&r!=="highp"&&(i="mediump"),`precision ${i} float;
|
|
17
|
+
${s}`}else if(r!=="highp"&&s.substring(0,15)==="precision highp")return s.replace("precision highp","precision mediump");return s}function Re(s,e){return e?`#version 300 es
|
|
18
|
+
${s}`:s}const Ee={},ke={};function Ge(s,{name:e="pixi-program"},t=!0){e=e.replace(/\s+/g,"-"),e+=t?"-fragment":"-vertex";const r=t?Ee:ke;return r[e]?(r[e]++,e+=`-${r[e]}`):r[e]=1,s.indexOf("#define SHADER_NAME")!==-1?s:`${`#define SHADER_NAME ${e}`}
|
|
19
|
+
${s}`}function Oe(s,e){return e?s.replace("#version 300 es",""):s}const V={stripVersion:Oe,ensurePrecision:Me,addProgramDefines:Ae,setProgramName:Ge,insertVersion:Re},I=Object.create(null),de=class j{constructor(e){e={...j.defaultOptions,...e};const t=e.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:t,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Ie()},setProgramName:{name:e.name},addProgramDefines:t,insertVersion:t};let i=e.fragment,n=e.vertex;Object.keys(V).forEach(o=>{const a=r[o];i=V[o](i,a,!0),n=V[o](n,a,!1)}),this.fragment=i,this.vertex=n,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=Q(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null,I[this._cacheKey]=null}static from(e){const t=`${e.vertex}:${e.fragment}`;return I[t]||(I[t]=new j(e),I[t]._cacheKey=t),I[t]}};de.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let J=de;const ie={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function De(s){return ie[s]??ie.float32}const ze={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},se=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function ne(s,e){let t;for(;(t=se.exec(s))!==null;){const r=ze[t[3]]??"float32";e[t[2]]={location:parseInt(t[1],10),format:r,stride:De(r).stride,offset:0,instance:!1,start:0}}se.lastIndex=0}function Be(s){return s.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function Ve({source:s,entryPoint:e}){const t={},r=Be(s),i=r.indexOf(`fn ${e}(`);if(i===-1)return t;const n=r.indexOf("->",i);if(n===-1)return t;const o=r.substring(i,n);if(ne(o,t),Object.keys(t).length===0){const a=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(a){const u=a[1],c=new RegExp(`struct\\s+${u}\\s*\\{([^}]+)\\}`,"s"),h=r.match(c);h&&ne(h[1],t)}}return t}function L(s){const e=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,t=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,i=/var(<[^>]+>)? (\w+)/,n=/:\s*([\w<>]+)/,o=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,u=/struct\s+(\w+)/,c=s.match(e)?.map(l=>({group:parseInt(l.match(t)[1],10),binding:parseInt(l.match(r)[1],10),name:l.match(i)[2],isUniform:l.match(i)[1]==="<uniform>",type:l.match(n)[1]}));if(!c)return{groups:[],structs:[]};const h=s.match(o)?.map(l=>{const d=l.match(u)[1],f=l.match(a).reduce((g,m)=>{const[x,_]=m.split(":");return g[x.trim()]=_.trim(),g},{});return f?{name:d,members:f}:null}).filter(({name:l})=>c.some(d=>d.type===l||d.type.includes(`<${l}>`)))??[];return{groups:c,structs:h}}var w=(s=>(s[s.VERTEX=1]="VERTEX",s[s.FRAGMENT=2]="FRAGMENT",s[s.COMPUTE=4]="COMPUTE",s))(w||{});function Le({groups:s}){const e=[];for(let t=0;t<s.length;t++){const r=s[t];e[r.group]||(e[r.group]=[]),r.isUniform?e[r.group].push({binding:r.binding,visibility:w.VERTEX|w.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?e[r.group].push({binding:r.binding,visibility:w.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"||r.type.startsWith("texture_2d<")?e[r.group].push({binding:r.binding,visibility:w.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):r.type==="texture_2d_array"||r.type.startsWith("texture_2d_array<")?e[r.group].push({binding:r.binding,visibility:w.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(r.type==="texture_cube"||r.type.startsWith("texture_cube<"))&&e[r.group].push({binding:r.binding,visibility:w.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let t=0;t<e.length;t++)e[t]||(e[t]=[]);return e}function Ne({groups:s}){const e=[];for(let t=0;t<s.length;t++){const r=s[t];e[r.group]||(e[r.group]={}),e[r.group][r.name]=r.binding}return e}function Ue(s,e){const t=new Set,r=new Set,i=[...s.structs,...e.structs].filter(o=>t.has(o.name)?!1:(t.add(o.name),!0)),n=[...s.groups,...e.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return r.has(a)?!1:(r.add(a),!0)});return{structs:i,groups:n}}const A=Object.create(null);class M{constructor(e){this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:t,vertex:r,layout:i,gpuLayout:n,name:o}=e;if(this.name=o,this.fragment=t,this.vertex=r,t.source===r.source){const a=L(t.source);this.structsAndGroups=a}else{const a=L(r.source),u=L(t.source);this.structsAndGroups=Ue(a,u)}this.layout=i??Ne(this.structsAndGroups),this.gpuLayout=n??Le(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:e,fragment:t}=this,r=e.source+t.source+e.entryPoint+t.entryPoint;this._layoutKey=Q(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Ve(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,A[this._cacheKey]=null}static from(e){const t=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return A[t]||(A[t]=new M(e),A[t]._cacheKey=t),A[t]}}const fe=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],$e=fe.reduce((s,e)=>(s[e]=!0,s),{});function We(s,e){switch(s){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const pe=class ge{constructor(e,t){this._touched=0,this.uid=C("uniform"),this._resourceType="uniformGroup",this._resourceId=C("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,t={...ge.defaultOptions,...t},this.uniformStructures=e;const r={};for(const i in e){const n=e[i];if(n.name=i,n.size=n.size??1,!$e[n.type]){const o=n.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(o){const[,a,u]=o;throw new Error(`Uniform type ${n.type} is not supported. Use type: '${a}', size: ${u} instead.`)}throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${fe.join(", ")}`)}n.value??(n.value=We(n.type,n.size)),r[i]=n.value}this.uniforms=r,this._dirtyId=1,this.ubo=t.ubo,this.isStatic=t.isStatic,this._signature=Q(Object.keys(r).map(i=>`${i}-${e[i].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};pe.defaultOptions={ubo:!1,isStatic:!1};let me=pe;class O{constructor(e){this.resources=Object.create(null),this._dirty=!0;let t=0;for(const r in e){const i=e[r];this.setResource(i,t++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const e=[];let t=0;for(const r in this.resources)e[t++]=this.resources[r]._resourceId;this._key=e.join("|")}setResource(e,t){const r=this.resources[t];e!==r&&(r?.off?.("change",this.onResourceChange,this),e.on?.("change",this.onResourceChange,this),this.resources[t]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e,t){const r=this.resources;for(const i in r)r[i]._gcLastUsed=e,r[i]._touched=t}destroy(){const e=this.resources;for(const t in e)e[t]?.off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(e){this._dirty=!0,e.destroyed?this.destroy():this._updateKey()}}var D=(s=>(s[s.WEBGL=1]="WEBGL",s[s.WEBGPU=2]="WEBGPU",s[s.CANVAS=4]="CANVAS",s[s.BOTH=3]="BOTH",s))(D||{});class ee extends Z{constructor(e){super(),this.uid=C("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:t,glProgram:r,groups:i,resources:n,compatibleRenderers:o,groupMap:a}=e;this.gpuProgram=t,this.glProgram=r,o===void 0&&(o=0,t&&(o|=D.WEBGPU),r&&(o|=D.WEBGL)),this.compatibleRenderers=o;const u={};if(!n&&!i&&(n={}),n&&i)throw new Error("[Shader] Cannot have both resources and groups");if(!t&&i&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!t&&i&&a)for(const c in a)for(const h in a[c]){const l=a[c][h];u[l]={group:c,binding:h,name:l}}else if(t&&i&&!a){const c=t.structsAndGroups.groups;a={},c.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,u[h.name]=h})}else if(n){i={},a={},t&&t.structsAndGroups.groups.forEach(l=>{a[l.group]=a[l.group]||{},a[l.group][l.binding]=l.name,u[l.name]=l});let c=0;for(const h in n)u[h]||(i[99]||(i[99]=new O,this._ownedBindGroups.push(i[99])),u[h]={group:99,binding:c,name:h},a[99]=a[99]||{},a[99][c]=h,c++);for(const h in n){const l=h;let d=n[h];!d.source&&!d._resourceType&&(d=new me(d));const f=u[l];f&&(i[f.group]||(i[f.group]=new O,this._ownedBindGroups.push(i[f.group])),i[f.group].setResource(d,f.binding))}}this.groups=i,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(i,u)}addResource(e,t,r){var i,n;(i=this._uniformBindMap)[t]||(i[t]={}),(n=this._uniformBindMap[t])[r]||(n[r]=e),this.groups[t]||(this.groups[t]=new O,this._ownedBindGroups.push(this.groups[t]))}_buildResourceAccessor(e,t){const r={};for(const i in t){const n=t[i];Object.defineProperty(r,n.name,{get(){return e[n.group].getResource(n.binding)},set(o){e[n.group].setResource(o,n.binding)}})}return r}destroy(e=!1){this._destroyed||(this._destroyed=!0,this.emit("destroy",this),e&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(t=>{t.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(e){const{gpu:t,gl:r,...i}=e;let n,o;return t&&(n=M.from(t)),r&&(o=J.from(r)),new ee({gpuProgram:n,glProgram:o,...i})}}const Ye={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},N=0,U=1,$=2,W=3,Y=4,X=5,H=class xe{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<N)}set blend(e){!!(this.data&1<<N)!==e&&(this.data^=1<<N)}get offsets(){return!!(this.data&1<<U)}set offsets(e){!!(this.data&1<<U)!==e&&(this.data^=1<<U)}set cullMode(e){if(e==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=e==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<$)}set culling(e){!!(this.data&1<<$)!==e&&(this.data^=1<<$)}get depthTest(){return!!(this.data&1<<W)}set depthTest(e){!!(this.data&1<<W)!==e&&(this.data^=1<<W)}get depthMask(){return!!(this.data&1<<X)}set depthMask(e){!!(this.data&1<<X)!==e&&(this.data^=1<<X)}get clockwiseFrontFace(){return!!(this.data&1<<Y)}set clockwiseFrontFace(e){!!(this.data&1<<Y)!==e&&(this.data^=1<<Y)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=Ye[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const e=new xe;return e.depthTest=!1,e.blend=!0,e}};H.default2d=H.for2d();let Xe=H;const _e=class q extends ee{constructor(e){e={...q.defaultOptions,...e},super(e),this.enabled=!0,this._state=Xe.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1),e.blendRequired&&this.addResource("uBackTexture",0,3)}apply(e,t,r,i){e.applyFilter(this,t,r,i)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){const{gpu:t,gl:r,...i}=e;let n,o;return t&&(n=M.from(t)),r&&(o=J.from(r)),new q({gpuProgram:n,glProgram:o,...i})}};_e.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let je=_e;var b=(s=>(s[s.MAP_READ=1]="MAP_READ",s[s.MAP_WRITE=2]="MAP_WRITE",s[s.COPY_SRC=4]="COPY_SRC",s[s.COPY_DST=8]="COPY_DST",s[s.INDEX=16]="INDEX",s[s.VERTEX=32]="VERTEX",s[s.UNIFORM=64]="UNIFORM",s[s.STORAGE=128]="STORAGE",s[s.INDIRECT=256]="INDIRECT",s[s.QUERY_RESOLVE=512]="QUERY_RESOLVE",s[s.STATIC=1024]="STATIC",s))(b||{});class K extends Z{constructor(e){let{data:t,size:r}=e;const{usage:i,label:n,shrinkToFit:o}=e;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=C("buffer"),this._resourceType="buffer",this._resourceId=C("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,t instanceof Array&&(t=new Float32Array(t)),this._data=t,r??(r=t?.byteLength);const a=!!t;this.descriptor={size:r,usage:i,mappedAtCreation:a,label:n},this.shrinkToFit=o??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&b.STATIC)}set static(e){e?this.descriptor.usage|=b.STATIC:this.descriptor.usage&=~b.STATIC}setDataWithSize(e,t,r){if(this._updateID++,this._updateSize=t*e.BYTES_PER_ELEMENT,this._data===e){r&&this.emit("update",this);return}const i=this._data;if(this._data=e,this._dataInt32=null,!i||i.length!==e.length){!this.shrinkToFit&&i&&e.byteLength<i.byteLength?r&&this.emit("update",this):(this.descriptor.size=e.byteLength,this._resourceId=C("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(e){this._updateSize=e??this._updateSize,this._updateID++,this.emit("update",this)}unload(){this.emit("unload",this);for(const e in this._gpuData)this._gpuData[e]?.destroy();this._gpuData=Object.create(null)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}function ye(s,e){if(!(s instanceof K)){let t=e?b.INDEX:b.VERTEX;s instanceof Array&&(e?(s=new Uint32Array(s),t=b.INDEX|b.COPY_DST):(s=new Float32Array(s),t=b.VERTEX|b.COPY_DST)),s=new K({data:s,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:t})}return s}function He(s,e,t){const r=s.getAttribute(e);if(!r)return t.minX=0,t.minY=0,t.maxX=0,t.maxY=0,t;const i=r.buffer.data;let n=1/0,o=1/0,a=-1/0,u=-1/0;const c=i.BYTES_PER_ELEMENT,h=(r.offset||0)/c,l=(r.stride||8)/c;for(let d=h;d<i.length;d+=l){const f=i[d],g=i[d+1];f>a&&(a=f),g>u&&(u=g),f<n&&(n=f),g<o&&(o=g)}return t.minX=n,t.minY=o,t.maxX=a,t.maxY=u,t}function qe(s){return(s instanceof K||Array.isArray(s)||s.BYTES_PER_ELEMENT)&&(s={buffer:s}),s.buffer=ye(s.buffer,!1),s}class Ke extends Z{constructor(e={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=C("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new z,this._boundsDirty=!0;const{attributes:t,indexBuffer:r,topology:i}=e;if(this.buffers=[],this.attributes={},t)for(const n in t)this.addAttribute(n,t[n]);this.instanceCount=e.instanceCount??1,r&&this.addIndex(r),this.topology=i||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}getSize(){for(const e in this.attributes){const t=this.attributes[e];return t.buffer.data.length/(t.stride/4||t.size)}return 0}addAttribute(e,t){const r=qe(t);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[e]=r}addIndex(e){this.indexBuffer=ye(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,He(this,"aPosition",this._bounds)):this._bounds}unload(){this.emit("unload",this);for(const e in this._gpuData)this._gpuData[e]?.destroy();this._gpuData=Object.create(null)}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners(),e&&this.buffers.forEach(t=>t.destroy()),this.unload(),this.indexBuffer?.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}let S;function oe(s){const e=v.get().createCanvas(6,1),t=e.getContext("2d");return t.fillStyle=s,t.fillRect(0,0,6,1),e}function Ze(){if(S!==void 0)return S;try{const s=oe("#ff00ff"),e=oe("#ffff00"),r=v.get().createCanvas(6,1).getContext("2d");r.globalCompositeOperation="multiply",r.drawImage(s,0,0),r.drawImage(e,2,0);const i=r.getImageData(2,0,1,1);if(!i)S=!1;else{const n=i.data;S=n[0]===255&&n[1]===0&&n[2]===0}}catch{S=!1}return S}const p={canvas:null,convertTintToImage:!1,cacheStepsPerColorChannel:8,canUseMultiply:Ze(),tintMethod:null,_canvasSourceCache:new WeakMap,_unpremultipliedCache:new WeakMap,getCanvasSource:s=>{const e=s.source,t=e?.resource;if(!t)return null;const r=e.alphaMode==="premultiplied-alpha",i=e.resourceWidth??e.pixelWidth,n=e.resourceHeight??e.pixelHeight,o=i!==e.pixelWidth||n!==e.pixelHeight;if(r){if((t instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)&&!o)return t;const a=p._unpremultipliedCache.get(e);if(a?.resourceId===e._resourceId)return a.canvas}if(t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Uint32Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof ArrayBuffer){const a=p._canvasSourceCache.get(e);if(a?.resourceId===e._resourceId)return a.canvas;const u=v.get().createCanvas(e.pixelWidth,e.pixelHeight),c=u.getContext("2d"),h=c.createImageData(e.pixelWidth,e.pixelHeight),l=h.data,d=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(e.format==="bgra8unorm")for(let f=0;f<l.length&&f+3<d.length;f+=4)l[f]=d[f+2],l[f+1]=d[f+1],l[f+2]=d[f],l[f+3]=d[f+3];else l.set(d.subarray(0,l.length));return c.putImageData(h,0,0),p._canvasSourceCache.set(e,{canvas:u,resourceId:e._resourceId}),u}if(r){const a=v.get().createCanvas(e.pixelWidth,e.pixelHeight),u=a.getContext("2d",{willReadFrequently:!0});a.width=e.pixelWidth,a.height=e.pixelHeight,u.drawImage(t,0,0);const c=u.getImageData(0,0,a.width,a.height),h=c.data;for(let l=0;l<h.length;l+=4){const d=h[l+3];if(d>0){const f=255/d;h[l]=Math.min(255,h[l]*f+.5),h[l+1]=Math.min(255,h[l+1]*f+.5),h[l+2]=Math.min(255,h[l+2]*f+.5)}}return u.putImageData(c,0,0),p._unpremultipliedCache.set(e,{canvas:a,resourceId:e._resourceId}),a}if(o){const a=p._canvasSourceCache.get(e);if(a?.resourceId===e._resourceId)return a.canvas;const u=v.get().createCanvas(e.pixelWidth,e.pixelHeight),c=u.getContext("2d");return u.width=e.pixelWidth,u.height=e.pixelHeight,c.drawImage(t,0,0),p._canvasSourceCache.set(e,{canvas:u,resourceId:e._resourceId}),u}return t},getTintedCanvas:(s,e)=>{const t=s.texture,r=R.shared.setValue(e).toHex(),i=t.tintCache||(t.tintCache={}),n=i[r],o=t.source._resourceId;if(n?.tintId===o)return n;const a=n&&"getContext"in n?n:v.get().createCanvas();return p.tintMethod(t,e,a),a.tintId=o,i[r]=a,i[r]},getTintedPattern:(s,e)=>{const t=R.shared.setValue(e).toHex(),r=s.patternCache||(s.patternCache={}),i=s.source._resourceId;let n=r[t];return n?.tintId===i||(p.canvas||(p.canvas=v.get().createCanvas()),p.tintMethod(s,e,p.canvas),n=p.canvas.getContext("2d").createPattern(p.canvas,"repeat"),n.tintId=i,r[t]=n),n},applyPatternTransform:(s,e,t=!0)=>{if(!e)return;const r=s;if(!r.setTransform)return;const i=globalThis.DOMMatrix;if(!i)return;const n=new i([e.a,e.b,e.c,e.d,e.tx,e.ty]);r.setTransform(t?n.inverse():n)},tintWithMultiply:(s,e,t)=>{const r=t.getContext("2d"),i=s.frame.clone(),n=s.source._resolution??s.source.resolution??1,o=s.rotate;i.x*=n,i.y*=n,i.width*=n,i.height*=n;const a=T.isVertical(o),u=a?i.height:i.width,c=a?i.width:i.height;t.width=Math.ceil(u),t.height=Math.ceil(c),r.save(),r.fillStyle=R.shared.setValue(e).toHex(),r.fillRect(0,0,u,c),r.globalCompositeOperation="multiply";const h=p.getCanvasSource(s);if(!h){r.restore();return}o&&p._applyInverseRotation(r,o,i.width,i.height),r.drawImage(h,i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.globalCompositeOperation="destination-atop",r.drawImage(h,i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore()},tintWithOverlay:(s,e,t)=>{const r=t.getContext("2d"),i=s.frame.clone(),n=s.source._resolution??s.source.resolution??1,o=s.rotate;i.x*=n,i.y*=n,i.width*=n,i.height*=n;const a=T.isVertical(o),u=a?i.height:i.width,c=a?i.width:i.height;t.width=Math.ceil(u),t.height=Math.ceil(c),r.save(),r.globalCompositeOperation="copy",r.fillStyle=R.shared.setValue(e).toHex(),r.fillRect(0,0,u,c),r.globalCompositeOperation="destination-atop";const h=p.getCanvasSource(s);if(!h){r.restore();return}o&&p._applyInverseRotation(r,o,i.width,i.height),r.drawImage(h,i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore()},tintWithPerPixel:(s,e,t)=>{const r=t.getContext("2d"),i=s.frame.clone(),n=s.source._resolution??s.source.resolution??1,o=s.rotate;i.x*=n,i.y*=n,i.width*=n,i.height*=n;const a=T.isVertical(o),u=a?i.height:i.width,c=a?i.width:i.height;t.width=Math.ceil(u),t.height=Math.ceil(c),r.save(),r.globalCompositeOperation="copy";const h=p.getCanvasSource(s);if(!h){r.restore();return}o&&p._applyInverseRotation(r,o,i.width,i.height),r.drawImage(h,i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore();const l=e>>16&255,d=e>>8&255,f=e&255,g=r.getImageData(0,0,u,c),m=g.data;for(let x=0;x<m.length;x+=4)m[x]=m[x]*l/255,m[x+1]=m[x+1]*d/255,m[x+2]=m[x+2]*f/255;r.putImageData(g,0,0)},_applyInverseRotation:(s,e,t,r)=>{const i=T.inv(e),n=T.uX(i),o=T.uY(i),a=T.vX(i),u=T.vY(i),c=-Math.min(0,n*t,a*r,n*t+a*r),h=-Math.min(0,o*t,u*r,o*t+u*r);s.transform(n,o,a,u,c,h)}};p.tintMethod=p.canUseMultiply?p.tintWithMultiply:p.tintWithPerPixel;class Qe{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){const r=v.get().createCanvas();r.width=e,r.height=t;const i=r.getContext("2d");return{canvas:r,context:i}}getOptimalCanvasAndContext(e,t,r=1){e=Math.ceil(e*r-1e-6),t=Math.ceil(t*r-1e-6),e=te(e),t=te(t);const i=(e<<17)+(t<<1);this._canvasPool[i]||(this._canvasPool[i]=[]);let n=this._canvasPool[i].pop();return n||(n=this._createCanvasAndContext(e,t)),n}returnCanvasAndContext(e){const t=e.canvas,{width:r,height:i}=t,n=(r<<17)+(i<<1);e.context.resetTransform(),e.context.clearRect(0,0,r,i),this._canvasPool[n].push(e)}clear(){this._canvasPool={}}}const be=new Qe;Ce.register(be);const ae=new ce;function ve(s,e){e.clear();const t=e.matrix;for(let r=0;r<s.length;r++){const i=s[r];if(i.globalDisplayStatus<7)continue;const n=i.renderGroup??i.parentRenderGroup;n?.isCachedAsTexture?e.matrix=ae.copyFrom(n.textureOffsetInverseTransform).append(i.worldTransform):n?._parentCacheAsTextureRenderGroup?e.matrix=ae.copyFrom(n._parentCacheAsTextureRenderGroup.inverseWorldTransform).append(i.groupTransform):e.matrix=i.worldTransform,e.addBounds(i.bounds)}return e.matrix=t,e}const Je=new z;function et(s,e,t,r,i=!1){const n=Je;n.minX=0,n.minY=0,n.maxX=s.width/r|0,n.maxY=s.height/r|0;const o=F.getOptimalTexture(n.width,n.height,r,!1,i);return o.source.uploadMethodId="image",o.source.resource=s,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=e/r,o.frame.height=t/r,o.source.emit("update",o.source),o.updateUvs(),o}function ue(s){return typeof s.getCanvasFilterString=="function"}class tt{constructor(){this.skip=!1,this.useClip=!1,this.filters=null,this.container=null,this.bounds=new z,this.cssFilterString=""}}class Te{constructor(e){this._filterStack=[],this._filterStackIndex=0,this._savedStates=[],this._alphaMultiplier=1,this._warnedFilterTypes=new Set,this.renderer=e}push(e){const t=this._pushFilterFrame(),r=e.filterEffect.filters;if(t.skip=!1,t.useClip=!1,t.filters=r,t.container=e.container,t.cssFilterString="",r.every(u=>!u.enabled)){t.skip=!0;return}const i=[],n=1;for(const u of r){if(!u.enabled)continue;if(!ue(u)){this._warnUnsupportedFilter(u);continue}const c=u.getCanvasFilterString();if(c===null){this._warnUnsupportedFilter(u);continue}c&&i.push(c)}if(i.length===0&&n===1){t.skip=!0;return}t.cssFilterString=i.join(" "),this._calculateFilterArea(e,t.bounds),t.useClip=!!e.filterEffect.filterArea;const o=this.renderer.canvasContext.activeContext,a=o.filter||"none";if(this._savedStates.push({filter:a,alphaMultiplier:this._alphaMultiplier}),t.useClip&&Number.isFinite(t.bounds.width)&&Number.isFinite(t.bounds.height)&&t.bounds.width>0&&t.bounds.height>0){const u=this.renderer.canvasContext.activeResolution||1;o.save(),o.setTransform(1,0,0,1,0,0),o.beginPath(),o.rect(t.bounds.x*u,t.bounds.y*u,t.bounds.width*u,t.bounds.height*u),o.clip()}else t.useClip=!1;t.cssFilterString&&(o.filter=a!=="none"?`${a} ${t.cssFilterString}`:t.cssFilterString)}pop(){const e=this._popFilterFrame();if(e.skip)return;const t=this._savedStates.pop();if(!t)return;const r=this.renderer.canvasContext.activeContext;e.useClip?r.restore():r.filter=t.filter,this._alphaMultiplier=t.alphaMultiplier}generateFilteredTexture({texture:e,filters:t}){if(!t?.length||t.every(_=>!_.enabled))return e;const r=[],i=1;for(const _ of t){if(!_.enabled)continue;if(!ue(_)){this._warnUnsupportedFilter(_);continue}const y=_.getCanvasFilterString();if(y===null){this._warnUnsupportedFilter(_);continue}y&&r.push(y)}if(r.length===0&&i===1)return e;const n=p.getCanvasSource(e);if(!n)return e;const o=e.frame,a=e.source._resolution??e.source.resolution??1,u=o.width,c=o.height,h=be.getOptimalCanvasAndContext(u,c,a),{canvas:l,context:d}=h;d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,l.width,l.height),r.length&&(d.filter=r.join(" "));const f=o.x*a,g=o.y*a,m=u*a,x=c*a;return d.drawImage(n,f,g,m,x,0,0,m,x),d.filter="none",d.globalAlpha=1,et(l,u,c,a)}_calculateFilterArea(e,t){if(e.renderables?ve(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){const i=(e.container.renderGroup||e.container.parentRenderGroup)?.cacheToLocalTransform;i&&t.applyMatrix(i)}}_warnUnsupportedFilter(e){const t=e?.constructor?.name||"Filter";this._warnedFilterTypes.has(t)||(this._warnedFilterTypes.add(t),console.warn(`CanvasRenderer: filter "${t}" is not supported in Canvas2D and will be skipped.`))}get alphaMultiplier(){return this._alphaMultiplier}_pushFilterFrame(){let e=this._filterStack[this._filterStackIndex];return e||(e=this._filterStack[this._filterStackIndex]=new tt),this._filterStackIndex++,e}_popFilterFrame(){return this._filterStackIndex<=0?this._filterStack[0]:(this._filterStackIndex--,this._filterStack[this._filterStackIndex])}destroy(){this._filterStack=null,this._savedStates=null,this._warnedFilterTypes=null,this._alphaMultiplier=1}}Te.extension={type:[P.CanvasSystem],name:"filter"};var rt=`in vec2 aPosition;
|
|
20
|
+
out vec2 vTextureCoord;
|
|
21
|
+
|
|
22
|
+
uniform vec4 uInputSize;
|
|
23
|
+
uniform vec4 uOutputFrame;
|
|
24
|
+
uniform vec4 uOutputTexture;
|
|
25
|
+
|
|
26
|
+
vec4 filterVertexPosition( void )
|
|
27
|
+
{
|
|
28
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
29
|
+
|
|
30
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
31
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
32
|
+
|
|
33
|
+
return vec4(position, 0.0, 1.0);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
vec2 filterTextureCoord( void )
|
|
37
|
+
{
|
|
38
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
void main(void)
|
|
42
|
+
{
|
|
43
|
+
gl_Position = filterVertexPosition();
|
|
44
|
+
vTextureCoord = filterTextureCoord();
|
|
45
|
+
}
|
|
46
|
+
`,it=`in vec2 vTextureCoord;
|
|
47
|
+
out vec4 finalColor;
|
|
48
|
+
uniform sampler2D uTexture;
|
|
49
|
+
void main() {
|
|
50
|
+
finalColor = texture(uTexture, vTextureCoord);
|
|
51
|
+
}
|
|
52
|
+
`,le=`struct GlobalFilterUniforms {
|
|
53
|
+
uInputSize: vec4<f32>,
|
|
54
|
+
uInputPixel: vec4<f32>,
|
|
55
|
+
uInputClamp: vec4<f32>,
|
|
56
|
+
uOutputFrame: vec4<f32>,
|
|
57
|
+
uGlobalFrame: vec4<f32>,
|
|
58
|
+
uOutputTexture: vec4<f32>,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
@group(0) @binding(0) var <uniform> gfu: GlobalFilterUniforms;
|
|
62
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
63
|
+
@group(0) @binding(2) var uSampler: sampler;
|
|
64
|
+
|
|
65
|
+
struct VSOutput {
|
|
66
|
+
@builtin(position) position: vec4<f32>,
|
|
67
|
+
@location(0) uv: vec2<f32>
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
fn filterVertexPosition(aPosition: vec2<f32>) -> vec4<f32>
|
|
71
|
+
{
|
|
72
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
73
|
+
|
|
74
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
75
|
+
position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
76
|
+
|
|
77
|
+
return vec4(position, 0.0, 1.0);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
fn filterTextureCoord(aPosition: vec2<f32>) -> vec2<f32>
|
|
81
|
+
{
|
|
82
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@vertex
|
|
86
|
+
fn mainVertex(
|
|
87
|
+
@location(0) aPosition: vec2<f32>,
|
|
88
|
+
) -> VSOutput {
|
|
89
|
+
return VSOutput(
|
|
90
|
+
filterVertexPosition(aPosition),
|
|
91
|
+
filterTextureCoord(aPosition)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@fragment
|
|
96
|
+
fn mainFragment(
|
|
97
|
+
@location(0) uv: vec2<f32>,
|
|
98
|
+
) -> @location(0) vec4<f32> {
|
|
99
|
+
return textureSample(uTexture, uSampler, uv);
|
|
100
|
+
}
|
|
101
|
+
`;class st extends je{constructor(){const e=M.from({vertex:{source:le,entryPoint:"mainVertex"},fragment:{source:le,entryPoint:"mainFragment"},name:"passthrough-filter"}),t=J.from({vertex:rt,fragment:it,name:"passthrough-filter"});super({gpuProgram:e,glProgram:t})}}class Fe{constructor(e){this._renderer=e}push(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}}Fe.extension={type:[P.WebGLPipes,P.WebGPUPipes,P.CanvasPipes],name:"filter"};const nt=new Ke({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:8,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])});class ot{constructor(){this.skip=!1,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new z,this.container=null,this.blendRequired=!1,this.outputRenderSurface=null,this.globalFrame={x:0,y:0,width:0,height:0},this.firstEnabledIndex=-1,this.lastEnabledIndex=-1}}class we{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new me({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new O({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){const t=this.renderer,r=e.filterEffect.filters,i=this._pushFilterData();i.skip=!1,i.filters=r,i.container=e.container,i.outputRenderSurface=t.renderTarget.renderSurface;const n=t.renderTarget.renderTarget.colorTexture.source,o=n.resolution,a=n.antialias;if(r.every(f=>!f.enabled)){i.skip=!0;return}const u=i.bounds;if(this._calculateFilterArea(e,u),this._calculateFilterBounds(i,t.renderTarget.rootViewPort,a,o,1),i.skip)return;const c=this._getPreviousFilterData(),h=this._findFilterResolution(o);let l=0,d=0;c&&(l=c.bounds.minX,d=c.bounds.minY),this._calculateGlobalFrame(i,l,d,h,n.width,n.height),this._setupFilterTextures(i,u,t,c)}generateFilteredTexture({texture:e,filters:t}){const r=this._pushFilterData();this._activeFilterData=r,r.skip=!1,r.filters=t;const i=e.source,n=i.resolution,o=i.antialias;if(t.every(f=>!f.enabled))return r.skip=!0,e;const a=r.bounds;if(a.addRect(e.frame),this._calculateFilterBounds(r,a.rectangle,o,n,0),r.skip)return e;const u=n;this._calculateGlobalFrame(r,0,0,u,i.width,i.height),r.outputRenderSurface=F.getOptimalTexture(a.width,a.height,r.resolution,r.antialias),r.backTexture=E.EMPTY,r.inputTexture=e,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,!0);const d=r.outputRenderSurface;return d.source.alphaMode="premultiplied-alpha",d}pop(){const e=this.renderer,t=this._popFilterData();t.skip||(e.globalUniforms.pop(),e.renderTarget.finishRenderPass(),this._activeFilterData=t,this._applyFiltersToTexture(t,!1),t.blendRequired&&F.returnTexture(t.backTexture),F.returnTexture(t.inputTexture))}getBackTexture(e,t,r){const i=e.colorTexture.source._resolution,n=F.getOptimalTexture(t.width,t.height,i,!1);let o=t.minX,a=t.minY;r&&(o-=r.minX,a-=r.minY),o=Math.floor(o*i),a=Math.floor(a*i);const u=Math.ceil(t.width*i),c=Math.ceil(t.height*i);return this.renderer.renderTarget.copyToTexture(e,n,{x:o,y:a},{width:u,height:c},{x:0,y:0}),n}applyFilter(e,t,r,i){const n=this.renderer,o=this._activeFilterData,u=o.outputRenderSurface===r,c=n.renderTarget.rootRenderTarget.colorTexture.source._resolution,h=this._findFilterResolution(c);let l=0,d=0;if(u){const g=this._findPreviousFilterOffset();l=g.x,d=g.y}this._updateFilterUniforms(t,r,o,l,d,h,u,i);const f=e.enabled?e:this._getPassthroughFilter();this._setupBindGroupsAndRender(f,t,n)}calculateSpriteMatrix(e,t){const r=this._activeFilterData,i=e.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),n=t.worldTransform.copyTo(ce.shared),o=t.renderGroup||t.parentRenderGroup;return o&&o.cacheToLocalTransform&&n.prepend(o.cacheToLocalTransform),n.invert(),i.prepend(n),i.scale(1/t.texture.orig.width,1/t.texture.orig.height),i.translate(t.anchor.x,t.anchor.y),i}destroy(){this._passthroughFilter?.destroy(!0),this._passthroughFilter=null}_getPassthroughFilter(){return this._passthroughFilter??(this._passthroughFilter=new st),this._passthroughFilter}_setupBindGroupsAndRender(e,t,r){if(r.renderPipes.uniformBatch){const i=r.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(i,0)}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,r.encoder.draw({geometry:nt,shader:e,state:e._state,topology:"triangle-list"}),r.type===D.WEBGL&&r.renderTarget.finishRenderPass()}_setupFilterTextures(e,t,r,i){if(e.backTexture=E.EMPTY,e.inputTexture=F.getOptimalTexture(t.width,t.height,e.resolution,e.antialias),e.blendRequired){r.renderTarget.finishRenderPass();const n=r.renderTarget.getRenderTarget(e.outputRenderSurface);e.backTexture=this.getBackTexture(n,t,i?.bounds)}r.renderTarget.bind(e.inputTexture,!0),r.globalUniforms.push({offset:t})}_calculateGlobalFrame(e,t,r,i,n,o){const a=e.globalFrame;a.x=t*i,a.y=r*i,a.width=n*i,a.height=o*i}_updateFilterUniforms(e,t,r,i,n,o,a,u){const c=this._filterGlobalUniforms.uniforms,h=c.uOutputFrame,l=c.uInputSize,d=c.uInputPixel,f=c.uInputClamp,g=c.uGlobalFrame,m=c.uOutputTexture;a?(h[0]=r.bounds.minX-i,h[1]=r.bounds.minY-n):(h[0]=0,h[1]=0),h[2]=e.frame.width,h[3]=e.frame.height,l[0]=e.source.width,l[1]=e.source.height,l[2]=1/l[0],l[3]=1/l[1],d[0]=e.source.pixelWidth,d[1]=e.source.pixelHeight,d[2]=1/d[0],d[3]=1/d[1],f[0]=.5*d[2],f[1]=.5*d[3],f[2]=e.frame.width*l[2]-.5*d[2],f[3]=e.frame.height*l[3]-.5*d[3];const x=this.renderer.renderTarget.rootRenderTarget.colorTexture;g[0]=i*o,g[1]=n*o,g[2]=x.source.width*o,g[3]=x.source.height*o,t instanceof E&&(t.source.resource=null);const _=this.renderer.renderTarget.getRenderTarget(t);this.renderer.renderTarget.bind(t,!!u),t instanceof E?(m[0]=t.frame.width,m[1]=t.frame.height):(m[0]=_.width,m[1]=_.height),m[2]=_.isRoot?-1:1,this._filterGlobalUniforms.update()}_findFilterResolution(e){let t=this._filterStackIndex-1;for(;t>0&&this._filterStack[t].skip;)--t;return t>0&&this._filterStack[t].inputTexture?this._filterStack[t].inputTexture.source._resolution:e}_findPreviousFilterOffset(){let e=0,t=0,r=this._filterStackIndex;for(;r>0;){r--;const i=this._filterStack[r];if(!i.skip){e=i.bounds.minX,t=i.bounds.minY;break}}return{x:e,y:t}}_calculateFilterArea(e,t){if(e.renderables?ve(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){const i=(e.container.renderGroup||e.container.parentRenderGroup).cacheToLocalTransform;i&&t.applyMatrix(i)}}_applyFiltersToTexture(e,t){const r=e.inputTexture,i=e.bounds,n=e.filters,o=e.firstEnabledIndex,a=e.lastEnabledIndex;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(e.backTexture.source,3),o===a)n[o].apply(this,r,e.outputRenderSurface,t);else{let u=e.inputTexture;const c=F.getOptimalTexture(i.width,i.height,u.source._resolution,!1);let h=c;for(let l=o;l<a;l++){const d=n[l];if(!d.enabled)continue;d.apply(this,u,h,!0);const f=u;u=h,h=f}n[a].apply(this,u,e.outputRenderSurface,t),F.returnTexture(c)}}_calculateFilterBounds(e,t,r,i,n){const o=this.renderer,a=e.bounds,u=e.filters;let c=1/0,h=0,l=!0,d=!1,f=!1,g=!0,m=-1,x=-1;for(let _=0;_<u.length;_++){const y=u[_];if(!y.enabled)continue;if(m===-1&&(m=_),x=_,c=Math.min(c,y.resolution==="inherit"?i:y.resolution),h+=y.padding,y.antialias==="off"?l=!1:y.antialias==="inherit"&&l&&(l=r),y.clipToViewport||(g=!1),!!!(y.compatibleRenderers&o.type)){f=!1;break}if(y.blendRequired&&!(o.backBuffer?.useBackBuffer??!0)){Se("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),f=!1;break}f=!0,d||(d=y.blendRequired)}if(!f){e.skip=!0;return}if(g&&a.fitBounds(0,t.width/i,0,t.height/i),a.scale(c).ceil().scale(1/c).pad((h|0)*n),!a.isPositive){e.skip=!0;return}e.antialias=l,e.resolution=c,e.blendRequired=d,e.firstEnabledIndex=m,e.lastEnabledIndex=x}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let e,t=this._filterStackIndex-1;for(;t>0&&(t--,e=this._filterStack[t],!!e.skip););return e}_pushFilterData(){let e=this._filterStack[this._filterStackIndex];return e||(e=this._filterStack[this._filterStackIndex]=new ot),this._filterStackIndex++,e}}we.extension={type:[P.WebGLSystem,P.WebGPUSystem],name:"filter"};he.add(we,Te);he.add(Fe);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const d="/work/.vgai-session",re=`${d}/session.py`,oe=[`${d}/in`,`${d}/reply`],x="/__editor/blender-wasm";function L(e){return new URL(`${x}/${e}`,import.meta.url).href}async function P(){const e=await fetch(L("status"));return e.ok?await e.json():{available:!1,skew:null,dir:null,sizes:{},encoded:{},missing:[`${x}/status answered ${e.status}`]}}async function M(e){const t=await P();if(!t.available)throw new Error(`The headless Blender WebAssembly build is not served by this editor: ${t.missing.join("; ")}`);if(t.skew==="wali"){const{startWaliBlenderEngine:n}=await import("./blender-wali-engine-C7bet0ss.js");return n(e,t)}const{startEmscriptenBlenderEngine:r}=await import("./blender-emscripten-engine-C_uFxIuO.js");return r(e,t)}function D(e){return e<200?1:e<5e3?5:25}const J=e=>new Promise(t=>setTimeout(t,e)),B=new TextDecoder;function ae(e,t,r){let n=0,a=0;const o=new Set;async function s(f){for(const l of o)f.has(`${l}.done`)||(await e.unlink(`${d}/reply/${l}.json`),await e.unlink(`${d}/reply/${l}.done`),o.delete(l))}async function i(){let f;try{f=await e.readdir(`${d}/ask`)}catch{return}const l=new Set(f.filter(h=>h.endsWith(".done")));await s(l);for(const h of l){const w=h.slice(0,-5);if(Number(w)<=a)continue;a=Number(w);const m=JSON.parse(B.decode(await e.readFile(`${d}/ask/${w}.json`)));let E;try{E=await t.ask(m)}catch(O){E={error:O instanceof Error?O.message:String(O)}}await e.writeFile(`${d}/reply/${w}.json`,JSON.stringify(E??null)),await e.writeFile(`${d}/reply/${w}.done`,"1"),o.add(w)}}async function c(f){const l=String(++n);await e.writeFile(`${d}/in/${l}.json`,JSON.stringify(f)),await e.writeFile(`${d}/in/${l}.done`,"1");const h=performance.now();for(;;){if(await i(),await e.stat(`${d}/out/${l}.done`)){const m=JSON.parse(B.decode(await e.readFile(`${d}/out/${l}.json`)));if(await e.unlink(`${d}/in/${l}.json`),await e.unlink(`${d}/in/${l}.done`),m.error)throw new Error(m.error);return m.result}const w=r?.();if(w)throw new Error(`Blender is gone, so this call will never be answered: ${w}. The session keeps its directory and its cached banner, so every later call would wait on the same missing answer; start a new program with \`blender-start {fresh: true}\` (\`VGAI_BLENDER_FRESH_SESSION=1\` for the battery harness).`);await J(D(performance.now()-h))}}return{request:c}}const _=e=>typeof e=="object"&&e!==null&&typeof e.offset=="number"&&typeof e.length=="number"&&typeof e.dtype=="string"&&typeof e.count=="number"&&typeof e.stride=="number",U={f32:e=>new Float32Array(e.buffer,e.byteOffset,e.byteLength>>2),f64:e=>new Float64Array(e.buffer,e.byteOffset,e.byteLength>>3),u32:e=>new Uint32Array(e.buffer,e.byteOffset,e.byteLength>>2),i32:e=>new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),u16:e=>new Uint16Array(e.buffer,e.byteOffset,e.byteLength>>1),i16:e=>new Int16Array(e.buffer,e.byteOffset,e.byteLength>>1),u8:e=>e,i8:e=>new Int8Array(e.buffer,e.byteOffset,e.byteLength)};function V(e,t,r){const n=U[r.dtype];if(!n)throw new Error(`Blender frame column ${t}: unknown dtype ${r.dtype}`);const{offset:a,length:o}=r;if(a<0||o<0||a+o>e.byteLength)throw new Error(`Blender frame column ${t}: bytes ${a}..${a+o} lie outside the ${e.byteLength}-byte export arena`);const s=e.subarray(a,a+o).slice(),i=n(s),c=r.count*r.stride;if(i.length!==c)throw new Error(`Blender frame column ${t}: ${i.length} values, ${c} declared (${r.count} x ${r.stride})`);return i}function C(e,t){const r=(n,a)=>{if(_(n)){const o=V(e,a,n);return a==="co"?Float64Array.from(o):o}if(Array.isArray(n))return n.map(o=>r(o,a));if(typeof n=="object"&&n!==null){const o={};for(const[s,i]of Object.entries(n))o[s]=r(i,s);return o}return n};return r(t,"")}async function W(e,t){const r=async(n,a)=>{if(_(n)){const{offset:o,length:s,dtype:i}=n;if(o<0||s<0||o+s>e.byteLength)throw new Error(`Blender frame column ${a}: bytes ${o}..${o+s} lie outside the ${e.byteLength}-byte export arena`);const c=e.subarray(o,o+s).slice(),f=await crypto.subtle.digest("SHA-256",c),l=[...new Uint8Array(f)].map(h=>h.toString(16).padStart(2,"0")).join("");return{dtype:i,length:s,sha256:l}}if(Array.isArray(n))return Promise.all(n.map(o=>r(o,a)));if(typeof n=="object"&&n!==null){const o={};for(const[s,i]of Object.entries(n))o[s]=await r(i,s);return o}return n};return r(t,"")}const S=e=>self.postMessage(e),p=(e,t)=>S({op:"log",level:e,text:t});let b=null,v=null,z=0;const A=new Map;function G(e,t,r){const n=++z,a=[],o=e;for(const s of[o?.meshes??{},o?.images??{}])for(const i of Object.values(s))for(const c of Object.values(i))ArrayBuffer.isView(c)&&c.buffer instanceof ArrayBuffer&&!a.includes(c.buffer)&&a.push(c.buffer);return new Promise((s,i)=>{A.set(n,{resolve:s,reject:i}),self.postMessage({op:"present",id:n,frame:e,description:t,...r?{capture:r}:{}},a)})}let u=null,j=null,g=null,k=0;const H=1e3;function N(){j!==null&&(g!==null&&clearTimeout(g),g=setTimeout(()=>{g=null,K()},H))}async function K(){if(!u||j===null)return;if(k>0){N();return}const e=j;let t;try{t=await u.request({op:"save-document"})}catch(n){p("error",`@@VGAI-ERROR the Blender document ${e} could not be saved: ${$(n)}`);return}if(!t?.saved||typeof t.path!="string")return;let r;try{r=await u.files.readFile(t.path)}catch(n){p("error",`@@VGAI-ERROR the Blender document ${e} was saved but could not be read back out of the engine: ${$(n)}`);return}y.delete(t.path);try{const n=await fetch(`/__editor/blender-document?path=${encodeURIComponent(e)}`,{method:"POST",headers:{"content-type":"application/octet-stream"},body:new Blob([r])});if(!n.ok){const a=await n.text().catch(()=>"");p("error",`@@VGAI-ERROR the Blender document ${e} was not written to the project: HTTP ${n.status} ${a}`);return}}catch(n){p("error",`@@VGAI-ERROR the Blender document ${e} was not written to the project: ${$(n)}`);return}p("log",`@@VGAI-DOCUMENT ${JSON.stringify({path:e,bytes:r.length})}`)}async function Q(e,t){const r={engine:null},n=await M({project:e,log:p,ask:async({frame:o,capture:s,saveDue:i})=>{if(!r.engine)throw new Error("The Blender session presented before it started");i&&N();const c=await r.engine.readArena(),f=await W(c,o),l=await G(C(c,o),f,s);return{...typeof l.capture=="object"&&l.capture!==null?l.capture:{},..."held"in l?{held:l.held}:{}}}});r.engine=n,u=n,t&&await F(n.files,e);const a=await n.request({op:"start",project:e,...t?{document:t}:{}});return t&&(j=t),b={start:async()=>a,execute:async o=>{const s=await n.request({op:"execute",code:o});return s.error?`Error executing code: ${s.error}`:`Code executed successfully: ${s.result}`},sceneInfo:async()=>JSON.stringify(await n.request({op:"scene-info"}),null,2),objectInfo:async o=>JSON.stringify(await n.request({op:"object-info",name:o}),null,2),screenshotView:async o=>(await n.request({op:"present",capture:{size:o}}),JSON.stringify({view:{size:o}}))},{...a,engine:"blender-wasm",skew:n.skew,bootMs:Math.round(n.bootMs),releasedPayloadMB:n.releasedPayloadBytes===null?null:Math.round(n.releasedPayloadBytes/1048576)}}async function X(){try{const e=await fetch("/__editor/blender-wasm/status");return e.ok?await e.json():{available:!1,missing:[`status answered ${e.status}`]}}catch(e){return{available:!1,missing:[String(e)]}}}async function Y(e,t){if(b)throw new Error("The Blender session is already started");if(!e.startsWith("/"))throw new Error("The Blender session needs the project's absolute path");if(t!==void 0&&!Z(t))throw new Error(`The Blender document must be a project-relative .blend path with no traversal (models/model.blend); got ${JSON.stringify(t)}`);const r=await X();if(!r.available)throw new Error(`Headless Blender is not served by this editor, so there is no modeling engine: ${r.missing.join("; ")}. The engine is Blender compiled to WebAssembly (packages/blender-engine/wasm, or the directory VGAI_BLENDER_WASM_DIR names); nothing stands in for it.`);return v=e,Q(e,t)}function Z(e){return!e.endsWith(".blend")||e.startsWith("/")||e.includes("\\")?!1:e.split("/").every(r=>r!==""&&r!=="."&&r!=="..")}const I=new Set;function T(e){I.has(e)||(I.add(e),p("error",e))}async function q(e){const t=s=>(T(`The project's files are not readable from Python: ${s}`),null);let r;try{r=await fetch("/__editor/blender-project-index")}catch(s){return t(String(s))}if(!r.ok)return t(`/__editor/blender-project-index answered ${r.status}`);let n;try{if(n=await r.json(),typeof n?.root!="string"||!Array.isArray(n.files))return t("invalid project index")}catch(s){return t(String(s))}const{root:a,files:o}=n;return a!==e&&T(`The editor serving this tab has ${a} open, not ${e}; its files are mounted at ${e}, which is where Python is looking.`),o}const y=new Map;async function ee(e,t){const r=await e.stat(t);return r?`${r.size}:${r.mtimeMs}`:""}async function F(e,t){const r=await q(t);if(!r)return;const n=new Set(r.map(a=>`${t}/${a.path}`));for(const a of[...y.keys()])if(!n.has(a)){try{await e.unlink(a)}catch{}y.delete(a)}for(const a of r){const o=`${t}/${a.path}`,s=`${a.size}:${a.mtime}`;if(y.get(o)?.host===s||!y.has(o)&&await e.stat(o)!==null)continue;const i=await fetch(`/__editor/blender-project-file?path=${encodeURIComponent(a.path)}`);if(!i.ok){T(`${a.path}: HTTP ${i.status}`);continue}const c=o.slice(0,o.lastIndexOf("/"));c&&await e.mkdirTree(c),await e.writeFile(o,new Uint8Array(await i.arrayBuffer())),y.set(o,{host:s,engine:await ee(e,o)})}}async function te(e,t){const r=[],n=async a=>{let o;try{o=await e.readdir(a)}catch{return}for(const s of o){if(s==="."||s==="..")continue;const i=`${a.replace(/\/$/,"")}/${s}`,c=await e.stat(i);if(c){if((c.mode&61440)===16384){await n(i);continue}y.get(i)?.engine!==`${c.size}:${c.mtimeMs}`&&r.push({path:i,size:c.size,mtime:c.mtimeMs})}}};return await n(t),r}async function R(e){switch(e.op){case"start":return Y(e.project,e.document);case"present-result":{const n=A.get(e.id);A.delete(e.id),n&&(e.error?n.reject(new Error(e.error)):n.resolve({...e.capture===void 0?{}:{capture:e.capture},..."held"in e?{held:e.held}:{}}));return}}if(!b||!v||!u)throw new Error("The Blender session has not started");const t=u.files,r=u.request.bind(u);switch(e.op){case"execute":return await F(t,v),b.execute(e.code);case"present":return r({op:"present"});case"scene-info":return b.sceneInfo();case"object-info":return b.objectInfo(e.name);case"rna":return r({op:"rna",path:e.path,...e.names===void 0?{}:{names:e.names}});case"rna-context":return r({op:"rna-context",...e.object===void 0?{}:{object:e.object},...e.collection===void 0?{}:{collection:e.collection}});case"rna-set":return r({op:"rna-set",path:e.path,property:e.property,value:e.value,...e.index===void 0?{}:{index:e.index}});case"outliner":return r({op:"outliner",...e.selected===void 0?{}:{selected:[...e.selected]}});case"node-tree":return r({op:"node-tree",...e.path===void 0?{}:{path:e.path},...e.material===void 0?{}:{material:e.material}});case"uv-layout":return r({op:"uv-layout",...e.object===void 0?{}:{object:e.object},...e.uvLayer===void 0?{}:{uvLayer:e.uvLayer}});case"rig":return r({op:"rig",...e.object===void 0?{}:{object:e.object}});case"action-clip":return r({op:"action-clip",...e.object===void 0?{}:{object:e.object},...e.bake===void 0?{}:{bake:e.bake}});case"outliner-set":return r({op:"outliner-set",path:e.path,column:e.column,value:e.value});case"screenshot-view":return JSON.parse(await b.screenshotView(e.maxSize));case"read-file":return t.readFile(e.path);case"write-file":{const n=e.path.slice(0,e.path.lastIndexOf("/"));n&&await t.mkdirTree(n),await t.writeFile(e.path,e.bytes),y.delete(e.path);return}case"list-files":return te(t,e.path)}throw new Error(`Unknown Blender worker request ${e.op}`)}function $(e){if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(typeof e=="object"&&e!==null){const t=e;if(typeof t.message=="string")return typeof t.name=="string"?`${t.name}: ${t.message}`:t.message;try{return JSON.stringify(e)??Object.prototype.toString.call(e)}catch{return Object.prototype.toString.call(e)}}return String(e)}function ne(){if(!u)return;const e=u.memoryBytes();e!==null&&S({op:"memory",bytes:e})}self.onmessage=async e=>{const t=e.data;if(t.op==="present-result"){await R(t);return}k+=1;try{S({id:t.id,result:await R(t)})}catch(r){S({id:t.id,error:$(r)})}finally{k-=1}ne()};export{x as A,oe as P,d as S,re as a,L as b,ae as o,J as s};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a}from"./jsx-runtime-DPjLkJKQ.js";import{cc as co,cd as uo,ce as po,cf as ee,az as bn,cg as Ge,ch as fo,Z as Ft,ci as ho,cj as yn,ck as go,cl as je,cm as ne,cn as Pe,co as Kt,u as oe,cp as vn,cq as mo,bq as Ut,bc as xo,bd as et,a4 as nt,br as bo,B as Zt,cr as wn,cs as Sn,ct as En,cu as Yt,a6 as yo,cv as vo,cw as wo,G as re,cx as _e,cy as Xe,cz as He,cA as So,cB as Eo,cC as Co,cD as ko,cE as Io,cF as J,cG as Ro,cH as Cn,cI as zo,cJ as jo,cK as pe,cL as Po,cM as F,cN as Se,cO as Rt,cP as Mo,cQ as Do,cR as To,cS as Lo,cT as $o,cU as Ve,cV as Bo,cW as Oo,cX as Ao,cY as Fo,cZ as Yo,c_ as No,c$ as Go,d0 as kn,d1 as _o,d2 as Xo,t as zt,d3 as Ho,d4 as Vo,d5 as Wo,d6 as Ko,as as In,d7 as Uo,d8 as Zo,d9 as qo,da as Jo,db as Qo,dc as tr,dd as er,aj as nr,de as or,df as rr,dg as Nt,dh as fe,di as ir,dj as Gt,dk as sr,dl as he,dm as We,dn as ar,Y as lr,dp as cr,W as dr,dq as ur,dr as pr,ds as fr,dt as hr,du as gr,dv as mr,dw as xr,dx as Ke,dy as br,dz as yr}from"./index-5av5LJja.js";import{r as c}from"./index-DaQZGF7d.js";import{B as It,q as Ue,I as vr}from"./edit-mode-authoring-BX4IRQq9.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{T as wr}from"./TransientHint-GNwuzA4c.js";import{s as Sr,g as Er,a as Cr,f as kr,t as Ir,z as Rr,b as zr}from"./react-story-board-vrmj74Ng.js";import{g as Me}from"./viewport-pick-context-DkawXbEi.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-BynznMJN.js";const qt=[],Ze=new Set,jr=[];function Pr(){return qt.length===0?jr:qt}function vt(t){for(let e=qt.length-1;e>=0;e--){const n=qt[e];if(n&&n.kind===t)return n}return null}function Mr(t){return Ze.add(t),()=>{Ze.delete(t)}}const Dr={width:null,height:null};let Vt=Dr;const Ee=new Set;function Rn(){return Vt}function Jt(t,e){const n=t===null?null:Math.max(1,Math.round(t)),r=e===null?null:Math.max(1,Math.round(e));if(!(Vt.width===n&&Vt.height===r)){Vt={width:n,height:r};for(const s of Ee)s()}}function Tr(){Jt(null,null)}function zn(t){return Ee.add(t),()=>Ee.delete(t)}const Lr=1;function jn(t){const e=[];for(const{worldId:n,adapter:r}of t.childAdapters()){if(!(r instanceof It))continue;const s=r.inspector.get(n,"kind");if(s!=="dom"&&s!=="canvas"||r.inspector.get(n,"reason")!==void 0)continue;const d=r.inspector.get(n,"adapter");d?.startsWith("ingest")||d?.startsWith("module")||e.push({worldId:n,kind:s,path:r.inspector.get(n,"path"),zOrder:Number(r.inspector.get(n,"zOrder")??0),pausable:r.inspector.get(n,"pausable")!==!1})}return e}function $r(t){return jn(t)}function ge(t,e){return t.childAdapters().some(n=>n.worldId===e)}function Pn(t,e,n="dom"){const r=yn(e)?"none":"block";t.style.display=r,t.style.pointerEvents=vt(n)?.alwaysInteractive||go(e)?"auto":"none";for(const s of Array.from(t.parentElement?.children??[]))s instanceof HTMLElement&&s.dataset.vgaiStoryBoardChromeFor===e&&(s.style.display=r)}function Br(t,e,n,r){const{worldId:s}=e,i=document.createElement("div");return i.dataset.worldId=s,i.dataset.vgaiRootSurface="true",r&&(i.dataset.vgaiCanvasScene="true"),i.style.position="absolute",i.style.top="0",i.style.left="0",i.style.width="100%",i.style.height="100%",i.style.zIndex=String(n),i.style.contain="layout paint",Pn(i,s,e.kind),Ce(i),t.appendChild(i),i}function Ce(t){if(t.dataset.vgaiCanvasScene==="true"){t.style.transform="",t.style.width="100%",t.style.height="100%";return}if(t.style.transform=je(ne())??"",t.style.transformOrigin="0 0",t.dataset.vgaiReactStoryBoard==="true")return;const e=Rn();t.style.width=e.width===null?"100%":`${e.width}px`,t.style.height=e.height===null?"100%":`${e.height}px`}function Or(t,e,n,r,s,i,d){i?i.canvasSceneView.reset():co(),Tr();const x=bn();if(!i&&x?.config.resolution&&Jt(x.config.resolution.width,x.config.resolution.height),n.playState!=="stopped"){let u=!1,I=!1;const L=n.subscribe(()=>{u||I||n.playState!=="stopped"||(I=!0,u||Ue())});return()=>{u=!0,L()}}const v=x?.rootPath,y=r?[...r]:jn(e);if(y.length===0||!v)return()=>{};const w=v,z=uo(y.map(u=>({id:u.worldId,zOrder:u.zOrder}))).map(u=>y.find(I=>I.worldId===u.id)),j=new Map(z.map(u=>[u.worldId,u])),b=new Map,m=new Map,p=new Map,S=new Set,f=new Set,P=new Set;let D=!1,M=!1,k=!1;function X(){for(const u of m.values())try{u()}catch(I){Ft.error(`[design-time-layers] dispose failed: ${I}`,"authoring")}m.clear();for(const u of b.values())u.remove();b.clear();for(const u of z)s?.(u.worldId,null)}function V(){X();for(const u of S){const I=j.get(u);if(!I)continue;const L={id:I.worldId,kind:I.kind,entryOrScenePath:I.path,zOrder:I.zOrder,pausable:I.pausable};e.replaceChild(u,new It(n,L,"Design-time layer suspended by play mode — Stop restores it."))}S.clear(),n.notifyIngestEdit()}function W(u,I,L){const B=vt(u.kind);if(!B){f.add(u.worldId);return}f.delete(u.worldId);const G=(p.get(u.worldId)??0)+1;p.set(u.worldId,G);const A=Br(t,u,Lr+I,!!i);b.set(u.worldId,A);const xt={projectRootPath:w,store:n,...i?{view:i.canvasSceneView}:{},...d?{activationDocumentId:d}:{}};(async()=>B.mount(u,A,xt))().then(K=>{if(D||M||p.get(u.worldId)!==G){K.dispose();return}if(K.adapter)ge(e,u.worldId)&&(e.replaceChild(u.worldId,K.adapter),S.add(u.worldId)),s?.(u.worldId,K.adapter);else if(K.pick){const Q={id:u.worldId,kind:u.kind,entryOrScenePath:u.path,zOrder:u.zOrder,pausable:u.pausable};e.replaceChild(u.worldId,new It(n,Q,void 0,K.pick)),S.add(u.worldId)}m.set(u.worldId,K.dispose),Ge(u.worldId),n.notifyIngestEdit(),L?.()}).catch(K=>{if(p.get(u.worldId)!==G||(L?.(),A.remove(),b.get(u.worldId)===A&&b.delete(u.worldId),D||M))return;const Q=fo(K);Ft.error(`[design-time-layers] world "${u.worldId}" (${u.kind}) failed to mount: ${Q}`,"authoring");const ut={id:u.worldId,kind:u.kind,entryOrScenePath:u.path,zOrder:u.zOrder,pausable:u.pausable};s?.(u.worldId,null),ge(e,u.worldId)&&e.replaceChild(u.worldId,new It(n,ut,Q)),ho({worldId:u.worldId,kind:u.kind,identity:B.identity,message:Q}),n.notifyIngestEdit()})}z.forEach((u,I)=>{W(u,I)});function Mt(u,I){const L=m.get(u.worldId);m.delete(u.worldId);const B=b.get(u.worldId);b.delete(u.worldId),W(u,I,()=>{const A=b.get(u.worldId);if(A&&(A.style.visibility=""),L)try{L()}catch(xt){Ft.error(`[design-time-layers] re-projection dispose failed: ${xt}`,"authoring")}B?.remove()});const G=b.get(u.worldId);G&&G!==B&&(G.style.visibility="hidden")}function gt(u,I){const L=m.get(u.worldId);if(m.delete(u.worldId),L)try{L()}catch(G){Ft.error(`[design-time-layers] remount dispose failed: ${G}`,"authoring")}const B=b.get(u.worldId);B&&(B.remove(),b.delete(u.worldId)),W(u,I)}const Y=new Map;function Dt(){for(const[u,I]of Y)vt(u.kind)!==u&&(I(),Y.delete(u));for(const u of Pr()){if(Y.has(u)||vt(u.kind)!==u||!z.some(B=>B.kind===u.kind))continue;const I=[],L=B=>()=>{D||M||n.playState!=="stopped"||z.forEach((G,A)=>{G.kind===u.kind&&B(G,A)})};u.remountWhen&&I.push(u.remountWhen(L(gt))),u.reprojectWhen&&I.push(u.reprojectWhen(L(Mt))),Y.set(u,()=>{for(const B of I)B()})}}Dt();const mt=Mr(()=>{D||M||n.playState!=="stopped"||(z.forEach((u,I)=>{f.has(u.worldId)&&vt(u.kind)&&(P.delete(u.worldId),Ge(u.worldId),W(u,I))}),Dt())}),O=po(()=>{if(D||M)return;let u=!1;for(const I of z){if(!f.has(I.worldId)||P.has(I.worldId)||vt(I.kind)||(P.add(I.worldId),!ge(e,I.worldId)))continue;const L={id:I.worldId,kind:I.kind,entryOrScenePath:I.path,zOrder:I.zOrder,pausable:I.pausable};e.replaceChild(I.worldId,new It(n,L,`No package in this editor registered a design-time mount for a "${I.kind}" world, so there is nothing here to author it with. A build ships the packages its own entry in \`builds/\` lists.`)),u=!0}u&&n.notifyIngestEdit()}),se=ee(()=>{for(const u of b.values())Ce(u)}),ae=zn(()=>{for(const u of b.values())Ce(u)}),dt=n.subscribe(()=>{if(!M&&n.playState!=="stopped"){M=!0,V();return}if(M&&!k&&n.playState==="stopped"&&!D){k=!0,D||Ue();return}if(!M)for(const[u,I]of b)Pn(I,u,j.get(u)?.kind??"dom")});return()=>{D=!0;for(const u of Y.values())u();Y.clear(),mt(),O(),dt(),se(),ae(),X()}}const Mn=.1,Dn=4,Tn=.002,Ar=4;function ke(t,e,n){return e===1?t*16:e===2?t*n:t}function Fr(t,e){let n=ke(e.deltaX,e.deltaMode,e.bounds.width),r=ke(e.deltaY,e.deltaMode,e.bounds.height);if(e.ctrlKey||e.metaKey){const s=Math.min(Dn,Math.max(Mn,t.zoom*Math.exp(-r*Tn))),i=e.clientX-e.bounds.left,d=e.clientY-e.bounds.top,x=(i-t.x)/t.zoom,v=(d-t.y)/t.zoom;return{x:i-x*s,y:d-v*s,zoom:s}}return e.shiftKey&&n===0&&(n=r,r=0),{x:t.x-n,y:t.y-r,zoom:t.zoom}}function Yr(t,e){const n=ke(e.deltaY,e.deltaMode,e.bounds.height),r=Math.min(Dn,Math.max(Mn,t.zoom*Math.exp(-n*Tn))),s=e.clientX-e.bounds.left,i=e.clientY-e.bounds.top,d=(s-t.x)/t.zoom,x=(i-t.y)/t.zoom;return{x:s-d*r,y:i-x*r,zoom:r}}function me(t){return t instanceof Element&&t.closest('[data-vgai-canvas-navigation-ignore="true"]')!==null}function Ln(t,e,n,r={}){let s=null,i=!1,d="";const x=()=>t.querySelector('[data-testid="world-selection-overlay-interaction"]'),v=m=>{t.dataset.canvasPanning=m?"true":"false",t.style.cursor=m?"grabbing":"";const p=x();p&&(m?(d=p.style.cursor,p.style.cursor="grabbing"):p.style.cursor=d)},y=m=>{if(!s||m.pointerId!==s.pointerId)return;const p=s.button===1?4:2;if((m.buttons&p)===0){w(m);return}const S=m.clientX-s.startClientX,f=m.clientY-s.startClientY;if(!s.moved){if(Math.hypot(S,f)<=Ar)return;s.moved=!0,v(!0)}e.setPan(s.startPan.x+S,s.startPan.y+f)},w=m=>{if(!s||m.pointerId!==s.pointerId)return;const p=s.pointerId;s.button===2&&s.moved&&(i=!0),s=null,v(!1),t.hasPointerCapture?.(p)&&t.releasePointerCapture(p),window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w)},E=m=>{const p=m.button===1,S=r.rightDragPans===!0&&m.button===2;!p&&!S||me(m.target)||(S&&(i=!1),m.preventDefault(),p&&m.stopPropagation(),s={pointerId:m.pointerId,button:m.button,startClientX:m.clientX,startClientY:m.clientY,startPan:e.get(),moved:p},t.setPointerCapture?.(m.pointerId),v(p),window.addEventListener("pointermove",y),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w))},z=m=>{m.button===1&&!me(m.target)&&m.preventDefault()},j=m=>{r.rightDragPans!==!0||!(s?.button===2&&s.moved)&&!i||(i=!1,m.preventDefault(),m.stopPropagation())},b=m=>{if(me(m.target))return;m.preventDefault(),m.stopPropagation();const p=n(e.get(),{clientX:m.clientX,clientY:m.clientY,deltaX:m.deltaX,deltaY:m.deltaY,deltaMode:m.deltaMode,ctrlKey:m.ctrlKey,metaKey:m.metaKey,shiftKey:m.shiftKey,bounds:t.getBoundingClientRect()});e.setView(p.x,p.y,p.zoom)};return t.addEventListener("pointerdown",E,!0),t.addEventListener("lostpointercapture",w,!0),t.addEventListener("mousedown",z,!0),t.addEventListener("contextmenu",j,!0),t.addEventListener("wheel",b,{capture:!0,passive:!1}),()=>{s=null,v(!1),t.removeEventListener("pointerdown",E,!0),t.removeEventListener("lostpointercapture",w,!0),t.removeEventListener("mousedown",z,!0),t.removeEventListener("contextmenu",j,!0),t.removeEventListener("wheel",b,!0),window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w)}}function Nr(t,e=Pe){return Ln(t,e,Fr)}function Gr(t,e){return Ln(t,e,Yr,{rightDragPans:!0})}const Ie="#191c22",_r="rgba(255, 255, 255, 0.2)",jt=[],qe=new Set,Xr=[];function Hr(){return jt.length===0?Xr:jt}function Vr(t){for(let e=jt.length-1;e>=0;e--){const n=jt[e];if(n&&n.medium===t)return n}return null}function Wr(t){return jt.find(e=>e.documentId===t)??null}function Kr(t){return qe.add(t),()=>{qe.delete(t)}}function St(t){return t.map(e=>`“${e}”`).join(", ")}function Ur(t,e){const n=e.map(r=>r.worldId);return{tone:"error",title:n.length===1?`${t} root ${St(n)} failed`:`${n.length} ${t} roots failed`,description:`${e.map(r=>`${r.worldId} (${r.kind}, ${r.identity}): ${r.message}`).join(`
|
|
2
|
+
`)}
|
|
3
|
+
If this followed an edit, Undo (Ctrl+Z) restores the previous source and remounts.`}}function Zr(t,e){return{tone:"loading",title:e.length===0?`Loading ${t}`:e.length===1?`Loading ${t} root ${St(e)}`:`Loading ${e.length} ${t} roots`,description:e.length===0?"Reading the project declaration to identify the root that belongs here.":`Waiting for ${St(e)} to finish mounting.`}}function qr(t,e){return e.length===0?{tone:"neutral",title:`No ${t} root`,description:"No declared root belongs to this surface."}:{tone:"neutral",title:"No renderable content",description:(e.length===1?`Root ${St(e)} mounted successfully but currently produces no renderable content.`:`Roots ${St(e)} mounted successfully but currently produce no renderable content.`)+" If this world builds its content under its game systems, press Play (▶) to run it."}}function Jr(t){if(t.content==="present")return null;if(t.playSuspended)return{tone:"neutral",title:"Editing paused during Play",description:`${St(t.rootIds)} is running in the Game tab. Press Stop (⏹) to edit it here.`};const e=new Set(t.rootIds),n=(t.failures??[]).filter(i=>e.has(i.worldId));if(n.length>0)return Ur(t.surface,n);const r=(t.readiness??[]).filter(i=>i.state==="waiting"&&e.has(i.rootId)).map(i=>i.rootId),s=r.length>0?r:t.rootIds;return t.phase==="loading"||r.length>0||t.content==="unknown"?Zr(t.surface,s):qr(t.surface,t.rootIds)}const Qt=globalThis;function Re(){return Qt.__vgaiBreakpointListeners??=new Set,Qt.__vgaiBreakpointListeners}function Qr(){return Qt.__vgaiActiveBreakpoint??null}function ti(t){Qt.__vgaiActiveBreakpoint=t;for(const e of Re())e()}function ei(t){return Re().add(t),()=>Re().delete(t)}const $n="vgai:board-guides:v1";function Bn(){return typeof window>"u"?null:window.localStorage}function On(){try{return bn()?.rootPath??"(no-project)"}catch{return"(no-project)"}}function An(){try{return JSON.parse(Bn()?.getItem($n)??"{}")}catch{return{}}}function ni(t){try{Bn()?.setItem($n,JSON.stringify(t))}catch{}}const ze=new Set;let xe=null,Je=Date.now()%1e6;function Pt(){return xe||(xe=An()[On()]??{}),xe}function De(){const t=An();t[On()]=Pt(),ni(t);for(const e of ze)e()}const oi=[];function ie(t){return Pt()[t]??oi}function ri(t){return ze.add(t),()=>ze.delete(t)}function ii(t,e,n){Je+=1;const r=`guide-${Je}`;return Pt()[t]=[...ie(t),{id:r,axis:e,value:n}],De(),r}function Qe(t,e,n){Pt()[t]=ie(t).map(r=>r.id===e?{...r,value:n}:r),De()}function tn(t,e){Pt()[t]=ie(t).filter(n=>n.id!==e),De()}const q=16,be="rgba(255, 82, 82, 0.9)",en="rgba(18, 22, 26, 0.92)",_t="rgba(255, 255, 255, 0.28)";function si(t){return[10,25,50,100,250,500,1e3,2500,5e3].find(n=>n*t>=60)??1e4}function nn(t){return Math.abs(t)>=1e3?`${t/1e3}k`:String(t)}function ai({docId:t,containerRef:e}){const n=c.useSyncExternalStore(ee,ne),r=c.useSyncExternalStore(ri,()=>ie(t)),[s,i]=c.useState(null),d=c.useRef(null);c.useEffect(()=>{const p=e.current;if(!p)return;const S=p.getBoundingClientRect();return S.left,S.top,n.x,n.y,n.zoom,()=>void 0},[t,e,n.x,n.y,n.zoom]);const x=(p,S)=>Math.round((p-(S==="x"?n.x:n.y))/n.zoom),v=(p,S)=>(S==="x"?n.x:n.y)+p*n.zoom,y=p=>{const S=e.current?.getBoundingClientRect();return S?{x:p.clientX-S.left,y:p.clientY-S.top}:{x:0,y:0}},w=p=>S=>{S.preventDefault(),S.currentTarget.setPointerCapture(S.pointerId);const f=y(S);i({kind:"place",axis:p,id:null,at:p==="x"?f.x:f.y})},E=p=>S=>{S.preventDefault(),S.stopPropagation(),S.currentTarget.setPointerCapture(S.pointerId);const f=y(S);i({kind:"move",axis:p.axis,id:p.id,at:p.axis==="x"?f.x:f.y})},z=p=>{if(!s)return;const S=y(p),f=s.axis==="x"?S.x:S.y;i({...s,at:f}),s.kind==="move"&&s.id&&Qe(t,s.id,x(f,s.axis))},j=p=>{if(!s)return;const S=y(p),f=s.axis==="x"?S.x:S.y,P=f<=q;s.kind==="place"?P||ii(t,s.axis,x(f,s.axis)):s.id&&(P?tn(t,s.id):Qe(t,s.id,x(f,s.axis))),i(null)},b=p=>{const S=e.current,f=S?p==="x"?S.clientWidth:S.clientHeight:0,P=si(n.zoom),D=Math.ceil(x(q,p)/P)*P,M=x(f,p),k=[];for(let X=D;X<=M&&k.length<200;X+=P)k.push(X);return k},m={position:"absolute",background:en,zIndex:61,userSelect:"none",touchAction:"none",overflow:"hidden"};return a.jsxs("div",{ref:d,"data-testid":"board-rulers",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:60},onPointerMove:z,onPointerUp:j,children:[r.map(p=>{const S=v(p.value,p.axis),f=p.axis==="x";return a.jsx("div",{"data-testid":`board-guide-${p.axis}-${p.value}`,title:`${p.axis} = ${p.value} — drag to move, drop on the ruler or double-click to remove`,onPointerDown:E(p),onPointerMove:z,onPointerUp:j,onDoubleClick:()=>tn(t,p.id),style:{position:"absolute",pointerEvents:"auto",cursor:f?"col-resize":"row-resize",zIndex:60,...f?{left:S-2,top:0,bottom:0,width:5}:{top:S-2,left:0,right:0,height:5}},children:a.jsx("div",{style:{position:"absolute",background:be,...f?{left:2,top:0,bottom:0,width:1}:{top:2,left:0,right:0,height:1}}})},p.id)}),s&&a.jsx("div",{style:{position:"absolute",background:be,zIndex:62,...s.axis==="x"?{left:s.at,top:0,bottom:0,width:1}:{top:s.at,left:0,right:0,height:1}},children:a.jsx("span",{style:{position:"absolute",...s.axis==="x"?{top:q+4,left:4}:{left:q+4,top:4},fontSize:9,fontFamily:"ui-monospace, monospace",color:be,background:en,padding:"1px 3px",borderRadius:3,whiteSpace:"nowrap"},children:x(s.at,s.axis)})}),a.jsx("div",{"data-testid":"board-ruler-top",onPointerDown:w("y"),style:{...m,top:0,left:q,right:0,height:q,cursor:"row-resize",pointerEvents:"auto"},children:b("x").map(p=>a.jsx("span",{style:{position:"absolute",left:v(p,"x"),bottom:0,borderLeft:`1px solid ${_t}`,height:5},children:a.jsx("span",{style:{position:"absolute",left:2,bottom:3,fontSize:8,color:_t,fontFamily:"ui-monospace, monospace"},children:nn(p)})},p))}),a.jsx("div",{"data-testid":"board-ruler-left",onPointerDown:w("x"),style:{...m,top:q,left:0,bottom:0,width:q,cursor:"col-resize",pointerEvents:"auto"},children:b("y").map(p=>a.jsx("span",{style:{position:"absolute",top:v(p,"y"),right:0,borderTop:`1px solid ${_t}`,width:5},children:a.jsx("span",{style:{position:"absolute",top:1,right:3,fontSize:8,color:_t,fontFamily:"ui-monospace, monospace",writingMode:"vertical-rl"},children:nn(p)})},p))}),a.jsx(li,{}),a.jsx("div",{style:{...m,top:0,left:0,width:q,height:q,borderRight:`1px solid ${Kt.border}`,borderBottom:`1px solid ${Kt.border}`}})]})}function li(){const t=c.useSyncExternalStore(ei,Qr);return t?a.jsxs("button",{type:"button","data-testid":"board-breakpoint-pill",title:"Style edits are scoped to this breakpoint — click to return to Base",onClick:()=>ti(null),style:{position:"absolute",top:q+8,right:12,zIndex:62,pointerEvents:"auto",background:"rgba(18, 22, 26, 0.92)",color:Kt.accent,border:`1px solid ${Kt.accent}`,borderRadius:999,fontSize:10,padding:"3px 10px",cursor:"pointer"},children:["@ ",t," · editing this breakpoint — click to clear"]}):null}const on=new WeakMap;let rn=0;function Et(t){let e=on.get(t);return e||(e={guides:[],listeners:new Set,revision:0},on.set(t,e)),e}function Te(t){t.revision+=1;for(const e of t.listeners)e()}function Fn(t){return Et(t).guides}function Yn(t){return Et(t).revision}function Nn(t,e){const n=Et(t);return n.listeners.add(e),()=>n.listeners.delete(e)}function ci(t,e,n){rn+=1;const r=Et(t),s=`canvas-guide-${rn}`;return r.guides=[...r.guides,{id:s,axis:e,value:n}],Te(r),s}function Gn(t,e,n){const r=Et(t),s=r.guides.map(i=>i.id===e?{...i,value:n}:i);s.every((i,d)=>i===r.guides[d])||(r.guides=s,Te(r))}function di(t,e){const n=Et(t),r=n.guides.filter(s=>s.id!==e);r.length!==n.guides.length&&(n.guides=r,Te(n))}const sn="#111214";function _n(t){let e=32;for(;e*t<12;)e*=2;for(;e*t>48;)e/=2;return e}function ui(t){return _n(t)*t}function ye(t){if(t.length===0)return null;let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const i of t)e=Math.min(e,i.x),n=Math.min(n,i.y),r=Math.max(r,i.x+i.width),s=Math.max(s,i.y+i.height);return{x:e,y:n,width:r-e,height:s-n}}function ve(t,e,n){if(!n||!(n.width>0)||!(n.height>0))return;const r=Math.max(1,t.clientWidth-96),s=Math.max(1,t.clientHeight-96),i=Math.min(4,Math.max(.1,Math.min(r/n.width,s/n.height)));e.setView(t.clientWidth/2-(n.x+n.width/2)*i,t.clientHeight/2-(n.y+n.height/2)*i,i)}function pi({view:t}){const e=oe();c.useSyncExternalStore(e.subscribe,e.getSnapshot);const n=c.useSyncExternalStore(t.subscribe,t.get,t.get);c.useSyncExternalStore(c.useCallback(d=>Nn(t,d),[t]),c.useCallback(()=>Yn(t),[t]));const r=Fn(t),s=ui(n.zoom),i=s*4;return a.jsxs("div",{"data-testid":"canvas-scene-backdrop",style:{position:"absolute",inset:0,zIndex:2,overflow:"hidden",pointerEvents:"none"},children:[e.showGrid&&a.jsx("div",{style:{position:"absolute",inset:0,backgroundImage:"linear-gradient(rgba(255,255,255,.075) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.075) 1px, transparent 1px),linear-gradient(rgba(255,255,255,.14) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.14) 1px, transparent 1px)",backgroundPosition:`${n.x}px ${n.y}px`,backgroundSize:`${s}px ${s}px, ${s}px ${s}px, ${i}px ${i}px, ${i}px ${i}px`}}),a.jsx("div",{"data-testid":"canvas-scene-origin-y",style:{position:"absolute",left:0,right:0,top:n.y,height:1,background:"rgba(238, 91, 91, .8)"}}),a.jsx("div",{"data-testid":"canvas-scene-origin-x",style:{position:"absolute",top:0,bottom:0,left:n.x,width:1,background:"rgba(87, 199, 126, .8)"}}),a.jsx("div",{style:{position:"absolute",left:n.x+6,top:n.y+6,color:"rgba(255,255,255,.68)",font:"10px ui-monospace, SFMono-Regular, Menlo, monospace"},children:"0, 0"}),r.map(d=>a.jsx("div",{"data-testid":`canvas-scene-guide-${d.axis}`,title:`${d.axis.toUpperCase()} ${Math.round(d.value*100)/100} · drag to move · right-click to remove`,onContextMenu:x=>{x.preventDefault(),di(t,d.id)},onPointerDown:x=>{x.preventDefault(),x.stopPropagation();const v=x.currentTarget.parentElement?.getBoundingClientRect();if(!v)return;const y=E=>{const z=d.axis==="x"?E.clientX-v.left:E.clientY-v.top,j=t.get();Gn(t,d.id,(z-(d.axis==="x"?j.x:j.y))/j.zoom)},w=()=>{window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",w)};window.addEventListener("pointermove",y),window.addEventListener("pointerup",w,{once:!0})},style:{position:"absolute",pointerEvents:"auto",cursor:d.axis==="x"?"ew-resize":"ns-resize",...d.axis==="x"?{left:n.x+d.value*n.zoom-4,top:20,bottom:0,width:9,borderLeft:"1px solid rgba(74, 180, 255, .95)"}:{top:n.y+d.value*n.zoom-4,left:20,right:0,height:9,borderTop:"1px solid rgba(74, 180, 255, .95)"}}},d.id)),a.jsx(fi,{view:t})]})}function fi({view:t}){const e=c.useSyncExternalStore(t.subscribe,t.get,t.get),n=c.useRef(null),r=c.useRef(null),[s,i]=c.useState({width:0,height:0});c.useEffect(()=>{const E=()=>{const j=n.current?.clientWidth??0,b=r.current?.clientHeight??0;i(m=>m.width===j&&m.height===b?m:{width:j,height:b})};if(E(),typeof ResizeObserver>"u")return;const z=new ResizeObserver(E);return n.current&&z.observe(n.current),r.current&&z.observe(r.current),()=>z.disconnect()},[]);const d=(E,z)=>{if(!(z>0))return[];const j=E==="x"?e.x:e.y,b=_n(e.zoom),m=b*e.zoom,p=20,S=Math.ceil((p-j)/m),f=Math.floor((p+z-j)/m);return Array.from({length:Math.max(0,f-S+1)},(P,D)=>{const M=S+D;return{major:M%4===0,screen:j+M*m-p,value:M*b}})},x=d("x",s.width),v=d("y",s.height),y=(E,z)=>{z.preventDefault(),z.stopPropagation();const j=z.currentTarget.parentElement?.getBoundingClientRect();if(!j)return;const b=(f,P)=>{const D=t.get();return((E==="x"?f-j.left:P-j.top)-(E==="x"?D.x:D.y))/D.zoom},m=ci(t,E,b(z.clientX,z.clientY)),p=f=>Gn(t,m,b(f.clientX,f.clientY)),S=()=>{window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",S)};window.addEventListener("pointermove",p),window.addEventListener("pointerup",S,{once:!0})},w={position:"absolute",pointerEvents:"auto",backgroundColor:"rgba(24, 26, 30, .96)",border:0,borderColor:"rgba(255,255,255,.14)",boxSizing:"border-box"};return a.jsxs(a.Fragment,{children:[a.jsx("button",{ref:n,type:"button","data-testid":"canvas-scene-ruler-x","aria-label":"Horizontal ruler; drag to create a horizontal guide",onPointerDown:E=>y("y",E),style:{...w,left:20,right:0,top:0,height:20,borderBottomStyle:"solid",borderBottomWidth:1,cursor:"row-resize",padding:0,overflow:"hidden"},children:x.map(E=>a.jsx("span",{"aria-hidden":"true","data-ruler-axis":"x","data-ruler-value":E.value,style:{position:"absolute",left:E.screen,bottom:0,width:1,height:E.major?8:4,background:E.major?"rgba(255,255,255,.5)":"rgba(255,255,255,.28)",pointerEvents:"none"},children:E.major&&a.jsx("span",{style:{position:"absolute",left:3,bottom:5,color:"rgba(255,255,255,.62)",font:"9px ui-monospace, SFMono-Regular, Menlo, monospace",lineHeight:1,whiteSpace:"nowrap"},children:E.value})},E.value))}),a.jsx("button",{ref:r,type:"button","data-testid":"canvas-scene-ruler-y","aria-label":"Vertical ruler; drag to create a vertical guide",onPointerDown:E=>y("x",E),style:{...w,top:20,bottom:0,left:0,width:20,borderRightStyle:"solid",borderRightWidth:1,cursor:"col-resize",padding:0,overflow:"hidden"},children:v.map(E=>a.jsx("span",{"aria-hidden":"true","data-ruler-axis":"y","data-ruler-value":E.value,style:{position:"absolute",top:E.screen,right:0,width:E.major?8:4,height:1,background:E.major?"rgba(255,255,255,.5)":"rgba(255,255,255,.28)",pointerEvents:"none"},children:E.major&&a.jsx("span",{style:{position:"absolute",right:4,top:3,color:"rgba(255,255,255,.62)",font:"9px ui-monospace, SFMono-Regular, Menlo, monospace",lineHeight:1,whiteSpace:"nowrap",writingMode:"vertical-rl",transform:"rotate(180deg)"},children:E.value})},E.value))}),a.jsx("div",{style:{...w,left:0,top:0,width:20,height:20}})]})}function hi({active:t,adapter:e,containerRef:n,view:r}){const s=oe();c.useSyncExternalStore(s.subscribe,s.getSnapshot);const i=c.useSyncExternalStore(r.subscribe,r.get,r.get),d=c.useCallback(w=>{const E=n.current;if(!E)return;const z=Math.min(4,Math.max(.1,w)),j=E.clientWidth/2,b=E.clientHeight/2,m=(j-i.x)/i.zoom,p=(b-i.y)/i.zoom;r.setView(j-m*z,b-p*z,z)},[n,i,r]),x=c.useCallback(w=>{if(!e?.rects)return[];const E=[];for(const z of w){const j=e.rects.rect(z);j&&j.width>0&&j.height>0&&E.push(j)}return E},[e]),v=c.useCallback(()=>{const w=n.current;w&&ve(w,r,ye(x(s.selectedEntityIds)))},[n,x,s,r]),y=c.useCallback(()=>{const w=n.current;!w||!e||ve(w,r,ye(x(vn(e))))},[e,n,x,r]);return c.useEffect(()=>{if(t)return s.onViewportAction(w=>{if(w.type==="focus-entity"){const E=n.current;if(!E)return;ve(E,r,ye(x([w.id])))}else w.type==="focus-selection"?v():w.type==="focus-scene"&&y()})},[t,n,y,v,x,s,r]),a.jsxs(a.Fragment,{children:[a.jsx(wr,{}),a.jsx(mo,{dimensions:"2d"}),a.jsxs(Ut,{label:"2D scene display",className:"vgai-viewport-toolbar vgai-viewport-toolbar-right","data-vgai-canvas-navigation-ignore":"true",children:[a.jsx(xo,{text:`Grid: ${s.showGrid?"On":"Off"}`,children:a.jsx(et,{"aria-label":"Toggle 2D grid","aria-pressed":s.showGrid,size:"comfortable",onClick:()=>s.toggleGrid(),children:a.jsx(nt,{icon:bo,size:"md"})})}),a.jsx(Zt,{"aria-label":"Frame all",variant:"ghost",size:"comfortable",onClick:y,children:"Frame all"})]}),a.jsxs(Ut,{label:"2D scene navigation",className:"vgai-canvas-scene-navigation","data-vgai-canvas-navigation-ignore":"true",children:[a.jsx(et,{"aria-label":"Frame selection",title:"Frame selection",size:"comfortable",disabled:s.selectedEntityIds.size===0,onClick:v,children:a.jsx(nt,{icon:wn,size:"md"})}),a.jsx(et,{"aria-label":"Zoom out",title:"Zoom out",size:"comfortable",onClick:()=>d(i.zoom/1.2),children:a.jsx(nt,{icon:Sn,size:"md"})}),a.jsxs(Zt,{variant:"ghost","aria-label":"Reset zoom to 100%",title:"Reset zoom to 100%",size:"comfortable",onClick:()=>d(1),children:[Math.round(i.zoom*100),"%"]}),a.jsx(et,{"aria-label":"Zoom in",title:"Zoom in",size:"comfortable",onClick:()=>d(i.zoom*1.2),children:a.jsx(nt,{icon:En,size:"md"})})]})]})}const an={fill:null,desktop:{width:1440,height:900},tablet:{width:768,height:1024},mobile:{width:390,height:844}};function gi({boardViewport:t,containerRef:e,selectViewport:n,viewportValue:r}){return a.jsxs(a.Fragment,{children:[a.jsxs(yo,{"aria-label":"Responsive viewport",title:t?.locked?"Viewport is locked by this story’s globals.viewport":"Responsive viewport",value:r,disabled:t?.locked===!0,onChange:s=>n(s.target.value),className:"vgai-react-viewport-select",children:[a.jsx("option",{value:"fill",children:"Responsive"}),t?t.choices.map(s=>a.jsxs("option",{value:s.id,children:[s.label," · ",s.width,"×",s.height]},s.id)):a.jsxs(a.Fragment,{children:[a.jsx("option",{value:"desktop",children:"Desktop · 1440×900"}),a.jsx("option",{value:"tablet",children:"Tablet · 768×1024"}),a.jsx("option",{value:"mobile",children:"Mobile · 390×844"})]})]}),t&&a.jsx(et,{"aria-label":"Rotate viewport",title:t.locked?"Viewport is locked by this story’s globals.viewport":"Rotate viewport",size:"comfortable",disabled:t.locked,onClick:()=>Ir(e.current),children:a.jsx(nt,{icon:vo,size:"md"})})]})}function mi({containerRef:t,context:e,boardOnly:n=!1}){const r=oe();c.useSyncExternalStore(r.subscribe,r.getSnapshot);const s=c.useSyncExternalStore(ee,ne),i=c.useSyncExternalStore(zn,Rn),d=c.useSyncExternalStore(Sr,()=>Er(t.current),()=>null),x=c.useCallback(b=>{const m=t.current;if(!m)return;const p=Math.min(4,Math.max(.1,b)),S=m.clientWidth/2,f=m.clientHeight/2,P=(S-s.x)/s.zoom,D=(f-s.y)/s.zoom;Yt(S-P*p,f-D*p,p)},[t,s]),v=c.useCallback(()=>{const b=t.current,m=[...r.selectedEntityIds].at(-1);if(!b||!m)return;const p=e?.adapter.rects?.rect(m);if(!p||p.width<=0||p.height<=0)return;const S=Math.max(1,b.clientWidth-96),f=Math.max(1,b.clientHeight-96),P=Math.min(4,Math.max(.1,Math.min(S/p.width,f/p.height)));Yt(b.clientWidth/2-(p.x+p.width/2)*P,b.clientHeight/2-(p.y+p.height/2)*P,P)},[t,e,r]),y=c.useCallback(b=>{const m=t.current;if(d){Cr(m,b==="fill"?null:b);return}const p=an[b];if(!m||p===null){Jt(null,null),Yt(0,0,1);return}Jt(p.width,p.height);const S=Math.min(1,Math.max(.1,Math.min((m.clientWidth-96)/p.width,(m.clientHeight-96)/p.height)));Yt((m.clientWidth-p.width*S)/2,(m.clientHeight-p.height*S)/2,S)},[d,t]),w=c.useCallback(()=>{const b=t.current;b&&kr(b)},[t]),E=d!==null,z=e?.kind==="dom"&&!!e.adapter.rects;if(n?!E:!z)return null;const j=d?d.selectedViewportId??"fill":Object.entries(an).find(([,b])=>b===null?i.width===null:b.width===i.width&&b.height===i.height)?.[0]??"fill";return a.jsxs(a.Fragment,{children:[!E&&i.width!==null&&i.height!==null&&a.jsx("div",{"data-testid":"react-canvas-device-frame",style:{position:"absolute",left:0,top:0,zIndex:0,width:i.width,height:i.height,transform:je(s),transformOrigin:"0 0",pointerEvents:"none",background:"#fff",boxShadow:"0 0 0 1px #ffffff40, 0 8px 30px #0009"}}),a.jsxs(Ut,{label:n?"2D component board view":"React canvas view","data-testid":n?"canvas-board-zoom-controls":"react-canvas-zoom-controls","data-vgai-canvas-navigation-ignore":"true",className:"vgai-react-canvas-controls",children:[!n&&a.jsx(gi,{boardViewport:d,containerRef:t,selectViewport:y,viewportValue:j}),E&&a.jsx(Zt,{variant:"ghost","aria-label":"Fit story board",title:"Fit all stories",size:"comfortable",onClick:w,children:"Fit board"}),a.jsx(et,{"aria-label":"Zoom out",title:"Zoom out",size:"comfortable",onClick:()=>x(s.zoom/1.2),children:a.jsx(nt,{icon:Sn,size:"md"})}),a.jsxs(Zt,{variant:"ghost","aria-label":"Reset zoom to 100%",title:"Reset zoom to 100%",size:"comfortable",onClick:()=>x(1),children:[Math.round(s.zoom*100),"%"]}),a.jsx(et,{"aria-label":"Zoom in",title:"Zoom in",size:"comfortable",onClick:()=>x(s.zoom*1.2),children:a.jsx(nt,{icon:En,size:"md"})}),!n&&a.jsx(et,{"aria-label":"Zoom to selection",title:"Zoom to selection",size:"comfortable",onClick:v,children:a.jsx(nt,{icon:wn,size:"md"})})]})]})}let xi=null;const ln=new Set;function bi(){return xi!==null}function yi(t){return ln.add(t),()=>ln.delete(t)}const vi=new Set(["","transparent","rgba(0, 0, 0, 0)"]);function wi(t){return vi.has(t)}function Si(t){for(const e of t)if(!wi(e))return e;return"#fff"}function cn(t,e){for(const n of e){const r=J(t,n.id);if(!r)continue;const s={};n.x!==void 0&&(s.x=n.x),n.y!==void 0&&(s.y=n.y),Object.keys(s).length!==0&&(r.begin(n.id),r.apply(n.id,s),r.end(n.id))}}const Ei=[{op:"left",testId:"align-left",label:"Align left",icon:_e},{op:"hcenter",testId:"align-hcenter",label:"Align horizontal center",icon:Xe},{op:"right",testId:"align-right",label:"Align right",icon:He},{op:"top",testId:"align-top",label:"Align top",icon:_e,rotate:!0},{op:"vcenter",testId:"align-vcenter",label:"Align vertical center",icon:Xe,rotate:!0},{op:"bottom",testId:"align-bottom",label:"Align bottom",icon:He,rotate:!0}],Ci=[{axis:"horizontal",testId:"distribute-horizontal",label:"Distribute horizontally",icon:Co},{axis:"vertical",testId:"distribute-vertical",label:"Distribute vertically",icon:ko}];function ki(t){const r=t.y-30-8;return{left:t.x,top:r<0?t.y+t.height+8:r}}function Ii({adapter:t,entries:e}){if(e.length<2)return null;const n=wo(e.map(d=>d.rect));if(!n)return null;const{left:r,top:s}=ki(n),i=e.length>=3;return a.jsxs(Ut,{label:"Align and distribute","data-testid":"align-toolbar",style:{position:"absolute",left:r,top:s,zIndex:re.overlayLow,gap:2,padding:3},children:[Ei.map(({op:d,testId:x,label:v,icon:y,rotate:w})=>a.jsx(et,{"data-testid":x,title:v,"aria-label":v,variant:"ghost",size:"compact",onClick:()=>cn(t,So(e,d)),children:a.jsx(nt,{icon:y,"aria-hidden":"true",style:w?{transform:"rotate(90deg)"}:void 0})},d)),i&&a.jsxs(a.Fragment,{children:[a.jsx(Eo,{}),Ci.map(({axis:d,testId:x,label:v,icon:y})=>a.jsx(et,{"data-testid":x,title:v,"aria-label":v,variant:"ghost",size:"compact",onClick:()=>cn(t,Io(e,d)),children:a.jsx(nt,{icon:y,"aria-hidden":"true"})},d))]})]})}function Ri({rect:t,initialText:e,onCommit:n,onCancel:r}){const[s,i]=c.useState(e),d=c.useRef(null),x=c.useRef(!1);c.useEffect(()=>{const w=d.current;w&&(w.focus(),w.select())},[]);const v=()=>{x.current||(x.current=!0,n(s))},y=()=>{x.current||(x.current=!0,r())};return a.jsx(Ro,{ref:d,"data-testid":"world-text-editor",value:s,onChange:w=>i(w.target.value),onBlur:v,onKeyDown:w=>{w.key==="Escape"?(w.stopPropagation(),y()):w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),v())},"data-variant":"inline-editor",style:{position:"absolute",left:t.x,top:t.y,width:Math.max(t.width,40),height:Math.max(t.height,20),boxSizing:"border-box",zIndex:re.overlayLow,pointerEvents:"auto",resize:"none"}})}const _=zt.accent.default,zi=re.overlayLow,te=5;function ji(t,e,n){return t?!1:Me()?.editorControls?.activate(e,n)??!1}function Pi(t,e,n,r,s,i){const d=t?null:Me()?.editorControls?.hover(e,n)??null;s(d),i(d?null:r(e,n))}function Mi(t,e){const n=t.hierarchy.node(e);return n?`${n.label}·${n.kind}`:e}function Di(t){return t instanceof In?t.childAdapters().some(e=>!!e.adapter.rects):!!t.rects}function Ti(t){const e=t instanceof In?t.childAdapters():[{worldId:"",adapter:t}],n=[];for(const{worldId:r,adapter:s}of e)if(s.rects&&!(r&&yn(r)))for(const i of vn(s)){if(s.inspector?.get(i,"locked")===!0)continue;const d=s.rects.rect(i);d&&n.push({id:i,rect:d})}return n}function Li(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function $i(t,e,n){if(!n)return[e];const r=new Set(t);return r.has(e)?r.delete(e):r.add(e),[...r]}function Bi(t,e,n,r){return e&&!!n&&(n.width>te||n.height>te)&&n?Ti(t).filter(d=>Li(n,d.rect)).map(d=>d.id):r?null:[]}function Oi(t,e,n,r){return t?"grabbing":e?"grab":n||r?"crosshair":"default"}function ct(t){try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}}function we(t){t.currentTarget.hasPointerCapture?.(t.pointerId)&&t.currentTarget.releasePointerCapture?.(t.pointerId)}function Ai(t,e){if(e!==null)return!1;const n=t.currentTarget.parentElement?.parentElement??null;return zr(n,t.clientX,t.clientY)}function dn(t,e){return{position:"absolute",left:t.x,top:t.y,width:t.width,height:t.height,border:`${e?2:1}px solid ${_}`,background:e?`color-mix(in srgb, ${_} 6%, transparent)`:"transparent",boxSizing:"border-box",pointerEvents:"none"}}function Fi(t){return{position:"absolute",left:t.x,top:Math.max(0,t.y-18),padding:"2px 6px",fontSize:11,fontFamily:"'SF Mono', 'Fira Code', Menlo, Consolas, monospace",fontWeight:600,color:"#fff",background:_,borderRadius:3,pointerEvents:"none",whiteSpace:"nowrap"}}const Xt=10,un=48;function pn(t,e){return{position:"absolute",left:t.x-Xt/2,top:t.y-Xt/2,width:Xt,height:Xt,background:"#fff",border:`1px solid ${_}`,boxSizing:"border-box",cursor:e,pointerEvents:"auto"}}const wt=12,Yi=24;function Ni(t){return{position:"absolute",left:t.x+t.width/2-wt/2,top:t.y-Yi-wt/2,width:wt,height:wt,borderRadius:"50%",background:"#fff",border:`1px solid ${_}`,boxSizing:"border-box",cursor:"grab",padding:0,pointerEvents:"auto"}}const fn=12;function Gi(t){return{position:"absolute",left:t.position[0],top:t.position[1],width:fn,height:fn,borderRadius:"50%",background:t.writable?t.color:"transparent",border:`2px solid ${t.color}`,boxSizing:"border-box",cursor:t.writable?"grab":"not-allowed",padding:0,pointerEvents:t.writable?"auto":"none",touchAction:"none"}}function _i(t){return{position:"absolute",left:t.x-8,top:t.y-8,width:16,height:16,display:"grid",placeItems:"center",borderRadius:t.kind==="anchor"?"50%":2,background:"#fff",border:`1px solid ${_}`,boxSizing:"border-box",color:_,cursor:"crosshair",fontSize:9,fontFamily:"'SF Mono', 'Fira Code', Menlo, Consolas, monospace",fontWeight:700,lineHeight:1,padding:0,pointerEvents:"auto",touchAction:"none"}}function Xi(t){return{position:"absolute",left:t.x,top:t.y+t.height+4,padding:"2px 6px",fontSize:11,fontFamily:"'SF Mono', 'Fira Code', Menlo, Consolas, monospace",fontWeight:600,color:"#fff",background:_,borderRadius:3,pointerEvents:"none",whiteSpace:"nowrap"}}const Hi="rgba(46, 204, 113, 0.25)",Vi="rgba(230, 126, 34, 0.25)";function Wi(t){return{position:"absolute",left:t.x,top:t.y,width:t.width,height:t.height,background:t.kind==="padding"?Hi:Vi,boxSizing:"border-box",cursor:t.cursor,pointerEvents:"auto"}}function Ki(t){return{position:"absolute",left:t.labelX,top:t.labelY,transform:"translate(-50%, -50%)",fontSize:10,fontFamily:"monospace",color:t.kind==="padding"?"#1b7a3d":"#a35a12",background:"rgba(255,255,255,0.85)",padding:"0 2px",borderRadius:2,pointerEvents:"none",whiteSpace:"nowrap"}}function Ui(t){return{position:"absolute",left:t.x,top:t.y,width:t.width,height:t.height,border:`2px dashed ${_}`,background:`color-mix(in srgb, ${_} 15%, transparent)`,boxSizing:"border-box",pointerEvents:"none",opacity:.7}}function Zi(t){return{position:"absolute",left:t.x,top:t.y,width:t.width,height:t.height,background:"#ff5fa2",borderRadius:2,pointerEvents:"none"}}const Le="#ff2d92",Ht=6;function qi(t){const e=t.orientation==="horizontal";return{position:"absolute",left:Math.min(t.x1,t.x2),top:Math.min(t.y1,t.y2),width:e?Math.abs(t.x2-t.x1):1,height:e?1:Math.abs(t.y2-t.y1),background:Le,pointerEvents:"none"}}function hn(t,e,n){return{position:"absolute",left:n?t:t-Ht/2,top:n?e-Ht/2:e,width:n?1:Ht,height:n?Ht:1,background:Le,pointerEvents:"none"}}function Ji(t){return{position:"absolute",left:t.labelX,top:t.labelY,transform:"translate(-50%, -50%)",padding:"1px 4px",fontSize:10,fontFamily:"monospace",fontWeight:600,color:"#fff",background:Le,borderRadius:2,pointerEvents:"none",whiteSpace:"nowrap"}}const gn="#f24822";function Qi(t){const e=t.orientation==="vertical";return{position:"absolute",left:e?t.at:t.start,top:e?t.start:t.at,width:e?1:t.end-t.start,height:e?t.end-t.start:1,borderLeft:e?`1px dashed ${gn}`:void 0,borderTop:e?void 0:`1px dashed ${gn}`,pointerEvents:"none"}}function ts(t){return{position:"absolute",left:t.x,top:Math.max(0,t.y-36),display:"flex",gap:4,pointerEvents:"none"}}const mn={padding:"2px 6px",fontSize:10,fontFamily:"'SF Mono', 'Fira Code', Menlo, Consolas, monospace",fontWeight:600,color:zt.content.onAccent,background:`color-mix(in srgb, ${_} 85%, transparent)`,borderRadius:3,whiteSpace:"nowrap"};function es(t){return{position:"absolute",left:t.x,top:t.y,width:t.width,height:t.height,border:`1px dashed color-mix(in srgb, ${_} 45%, transparent)`,boxSizing:"border-box",pointerEvents:"none"}}function xn(t,e,n){return e&&n>0?Math.round(t/n)*n:t}function ns(t,e,n,r,s,i){const d=t.nativeHandleSpan??1,x=t.nativeScaleAxis??"both";let v,y;if(x==="x")v=1+e/d,y=1;else if(x==="y")v=1,y=1+n/d;else{const w=1+(e+n)/(Math.SQRT2*d);v=w,y=w}return{...x!=="y"?{scaleXFactor:v}:{},...x!=="x"?{scaleYFactor:y}:{},...r&&!s?{scaleStep:i}:{}}}function os(t,e,n,r,s,i){const d=t.nativeOrigin;if(!d)return{};const x=r&&!s;return{...t.moveAxis!=="y"?{originX:xn(d.x+e,x,i)}:{},...t.moveAxis!=="x"?{originY:xn(d.y+n,x,i)}:{}}}function rs(t,e,n){return t==="x"?{x:e.x+n,y:e.y}:t==="y"?{x:e.x,y:e.y+n}:{x:e.x+n/Math.SQRT2,y:e.y+n/Math.SQRT2}}function is(t,e,n){return t==="x"?{dx:e,dy:0}:t==="y"?{dx:0,dy:n}:{dx:e,dy:n}}function ss(t,e){t.ownerBoxEdit.begin(t.id);for(const n of t.peers)n.ownerBoxEdit.begin(n.id);return{kind:"move",id:t.id,ownerBoxEdit:t.ownerBoxEdit,startLocal:e,origRect:t.origRect,context:t.context,...t.nativeOrigin?{nativeOrigin:t.nativeOrigin}:{},movePeers:t.peers}}function as(t,e,n){let r=e;for(let s=0;r!==null&&s<256;s++){if(n.has(r))return r;r=t.hierarchy.node(r)?.parentId??null}return null}function ls(t,e,n){const r=J(t,e);if(!r)return null;const s=t.inspector?.get(e,"style.position"),i=Se(t,e)==="2d";if(s!=="absolute"&&s!=="fixed"&&!i)return null;const d=F(t,e);if(!d)return null;const x=i?r.gizmoOrigin?.(e)??void 0:void 0,v=[];for(const y of n){if(y===e)continue;const w=J(t,y),E=F(t,y);if(!w||!E)continue;const z=t.inspector?.get(y,"style.position"),j=Se(t,y)==="2d";if(z!=="absolute"&&z!=="fixed"&&!j)continue;const b=j?w.gizmoOrigin?.(y)??void 0:void 0;v.push({id:y,ownerBoxEdit:w,origRect:E,...b?{nativeOrigin:b}:{}})}return{id:e,ownerBoxEdit:r,origRect:d,context:Rt(t,e),...x?{nativeOrigin:x}:{},peers:v}}function cs(t,e){if(!Wo(t,e)?.reorder)return null;const r=Ko(t,e);if(!r||r.length<3)return null;const s=F(t,e);if(!s)return null;const i=[];for(const d of r){if(d===e)continue;const x=F(t,d);x&&i.push({id:d,rect:x})}return i.length===0?null:{id:e,adapter:t,origRect:s,siblingRects:i}}function ds(){return Uo()}function us(t,e){if(e.size!==1)return null;const n=[...e][0],r=J(t,n);if(!r)return null;const s=F(t,n);if(!s)return null;const i=Zo(s,qo(t,n));return{id:n,rect:s,ownerBoxEdit:r,spacingBands:i}}function ps(t,e){if(e.size<2)return null;const n=[];for(const r of e){const s=F(t,r);if(!s||!J(t,r))return null;n.push({id:r,rect:s})}return n}function fs(t,e,n){const r=e.size===1?[...e][0]:null,s=r?F(t,r):null,i=s&&n?Jo(s,n):[],d=r?Qo(t,r):null,x=!!(d&&(d.position||d.parentLayout)),v=r?Rt(t,r)?.parent??null:null;return{selectedSingleRect:s,measureLines:i,positionBadge:d,showPositionBadge:x,parentRect:v}}function hs({state:t,adapter:e,onClose:n}){const r=c.useRef(null);return c.useEffect(()=>{const s=d=>{r.current?.contains(d.target)||n()},i=d=>{d.key==="Escape"&&n()};return document.addEventListener("pointerdown",s),document.addEventListener("keydown",i),()=>{document.removeEventListener("pointerdown",s),document.removeEventListener("keydown",i)}},[n]),a.jsx(tr,{children:a.jsx(er,{ref:r,"aria-label":"Pick object under pointer","data-testid":"viewport-pick-menu",style:{position:"fixed",left:t.x,top:t.y,minWidth:190,maxWidth:320,zIndex:re.dropdown},children:t.ids.map(s=>{const i=e.hierarchy.node(s);return a.jsxs(nr,{"data-testid":"viewport-pick-menu-item",onSelect:()=>{kn(e,[s]),n()},style:{justifyContent:"space-between",gap:20},children:[a.jsx("span",{children:i?.label??s}),a.jsx("span",{style:{color:zt.content.muted,fontSize:11},children:i?.kind??""})]},s)})})})}function gs({adapter:t,view:e,transformModeAware:n=!1}={}){const r=oe(),s=c.useSyncExternalStore(r.subscribe,r.getSnapshot),i=t??Cn(r),d=c.useCallback((o,l)=>t?t.pickable?.pick(o,l)??null:zo(r,o,l),[t,r]),x=c.useRef(null),v=c.useRef(null),y=c.useRef(null),[w,E]=c.useState(null),[z,j]=c.useState(null),[b,m]=c.useState(null),[p,S]=c.useState(null),f=c.useRef(null),P=c.useCallback((o,l)=>{const g=jo(r,o,l,{...t?{adapter:t}:{}});if(g.length===0){S(null);return}S({x:o,y:l,ids:g})},[t,r]);c.useEffect(()=>{const o=g=>{const h=f.current;!h||h.pointerId!==g.pointerId||h.moved||Math.hypot(g.clientX-h.startClientX,g.clientY-h.startClientY)>te&&(h.moved=!0)},l=g=>{const h=f.current;!h||h.pointerId!==g.pointerId||(f.current=null,g.type==="pointerup"&&!h.moved&&P(g.clientX,g.clientY))};return window.addEventListener("pointermove",o),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l),()=>{window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",l)}},[P]);const D=c.useCallback(o=>{o.preventDefault(),o.stopPropagation()},[]),M=e??Pe,k=c.useSyncExternalStore(M.subscribe,M.get,M.get);c.useSyncExternalStore(c.useCallback(o=>Nn(M,o),[M]),c.useCallback(()=>Yn(M),[M]));const X=n?Fn(M):[],V=n?1/k.zoom:1,W=c.useRef(!1),[Mt,gt]=c.useState(!1),Y=c.useRef(null),[Dt,mt]=c.useState(!1),O=c.useRef(null);c.useEffect(()=>()=>{const o=O.current;if(O.current=null,!!o){o.ownerBoxEdit.end(o.id);for(const l of o.movePeers??[])l.ownerBoxEdit.end(l.id)}},[]);const[,se]=c.useState(0),[ae,dt]=c.useState(null),[u,I]=c.useState([]),L=c.useRef(null),[B,G]=c.useState(null),A=c.useCallback(o=>{L.current=o,G(o)},[]),xt=c.useRef(null),[$e,K]=c.useState(null),[Q,ut]=c.useState(null),pt=c.useCallback(o=>{xt.current=o,K(o)},[]),le=c.useRef(null),Be=c.useRef(null);c.useEffect(()=>{const o=le.current;if(!o)return;le.current=null;const l=pe(i,o.id);l&&l.get(o.id)===null&&ut({id:o.id,rect:o.rect})},[s]);const Oe=c.useRef("");c.useEffect(()=>{const o=[...r.selectedEntityIds].sort().join(",");o!==Oe.current&&(Oe.current=o,Q&&ut(null))}),c.useEffect(()=>{if(!Q)return;const o=window.setTimeout(()=>ut(null),4e3);return()=>window.clearTimeout(o)},[Q]);const st=c.useSyncExternalStore(yi,bi),[Xn,Ae]=c.useState(null),tt=c.useCallback(o=>{y.current=o,E(o)},[]),T=c.useCallback((o,l)=>{const g=x.current?.getBoundingClientRect();return{x:(o-(g?.left??0)-k.x)/k.zoom,y:(l-(g?.top??0)-k.y)/k.zoom}},[k.x,k.y,k.zoom]),Hn=c.useCallback(o=>{!e||!n||!i.assetDrop||!o.dataTransfer.types.includes("application/x-editor-asset")||(o.preventDefault(),o.dataTransfer.dropEffect="copy")},[i.assetDrop,e,n]),Vn=c.useCallback(o=>{if(!e||!n||!i.assetDrop)return;const l=o.dataTransfer.getData("application/x-editor-asset");if(!l)return;let g;try{g=JSON.parse(l)}catch{return}const h=T(o.clientX,o.clientY),C={position:[h.x,h.y,0],item:g.component??{kind:"file",name:g.name??g.path.split("/").pop()??g.path}};i.assetDrop.accepts("",g.path,C)&&(o.preventDefault(),o.stopPropagation(),Po(i,"",g.path,C))},[i.assetDrop,e,T,n]),at=c.useCallback(()=>se(o=>o+1),[]),Tt=c.useCallback(()=>{const o=O.current;if(!o)return!1;O.current=null,o.ownerBoxEdit.end(o.id);for(const l of o.movePeers??[])l.ownerBoxEdit.end(l.id);return dt(null),I([]),at(),!0},[at]),Wn=c.useCallback((o,l)=>{if(l.stopPropagation(),l.button!==0)return;const g=r.selectedEntityIds;if(g.size!==1)return;const h=[...g][0],C=J(i,h),R=F(i,h);if(!C||!R)return;const $=i.inspector?.get(h,"style.position"),it=Se(i,h)==="2d";ct(l),C.begin(h),O.current={kind:"resize",id:h,ownerBoxEdit:C,startLocal:T(l.clientX,l.clientY),origRect:R,pos:o,isPositioned:$==="absolute"||$==="fixed"||it,context:Rt(i,h)}},[i,r,T]),Kn=c.useCallback(o=>{if(o.stopPropagation(),o.button!==0)return;const l=r.selectedEntityIds;if(l.size!==1)return;const g=[...l][0],h=J(i,g),C=F(i,g);if(!h||!C)return;const R=n?h.gizmoOrigin?.(g):null;ct(o),h.begin(g),O.current={kind:"rotate",id:g,ownerBoxEdit:h,startLocal:T(o.clientX,o.clientY),origRect:C,center:R??{x:C.x+C.width/2,y:C.y+C.height/2},...R?{nativeOrigin:R}:{}}},[i,r,T,n]),ce=c.useCallback((o,l)=>{if(l.stopPropagation(),l.button!==0)return;const g=r.selectedEntityIds;if(g.size!==1)return;const h=[...g][0],C=J(i,h),R=F(i,h);if(!C||!R)return;const $=C.gizmoOrigin?.(h)??{x:R.x+R.width/2,y:R.y+R.height/2};ct(l),C.begin(h),O.current={kind:"move",id:h,ownerBoxEdit:C,startLocal:T(l.clientX,l.clientY),origRect:R,context:Rt(i,h),moveAxis:o,nativeOrigin:$}},[i,r,T]),Un=c.useCallback((o,l)=>{if(l.stopPropagation(),l.button!==0)return;const g=r.selectedEntityIds;if(g.size!==1)return;const h=[...g][0],C=J(i,h),R=F(i,h);if(!C||!R)return;const $=C.gizmoOrigin?.(h)??{x:R.x+R.width/2,y:R.y+R.height/2};ct(l),C.begin(h),O.current={kind:"native-scale",id:h,ownerBoxEdit:C,startLocal:T(l.clientX,l.clientY),origRect:R,nativeOrigin:$,nativeScaleAxis:o,nativeHandleSpan:un/k.zoom}},[i,k.zoom,r,T]),Zn=c.useCallback((o,l)=>{if(l.stopPropagation(),l.button!==0)return;const g=r.selectedEntityIds;if(g.size!==1)return;const h=[...g][0],C=J(i,h),R=F(i,h);!C||!R||C.referencePoint?.(h)?.id!==o.id||(ct(l),C.begin(h),O.current={kind:"reference",id:h,ownerBoxEdit:C,startLocal:T(l.clientX,l.clientY),origRect:R,context:Rt(i,h),pointerId:l.pointerId,referencePoint:o})},[i,r,T]),Lt=c.useRef(null),qn=c.useCallback((o,l,g,h)=>{h.stopPropagation(),!(h.button!==0||!g.writable)&&(ct(h),Lt.current={id:o,handleId:g.id,provider:l})},[]),Jn=c.useCallback(o=>{const l=Lt.current;if(!l)return;const g=T(o.clientX,o.clientY);l.provider.preview(l.id,l.handleId,[g.x,g.y,0]),at()},[at,T]),de=c.useCallback(o=>{const l=Lt.current;if(Lt.current=null,!l)return;we(o);const g=T(o.clientX,o.clientY);l.provider.commit(l.id,l.handleId,[g.x,g.y,0]),at()},[at,T]),Qn=c.useCallback((o,l)=>{if(l.stopPropagation(),l.button!==0)return;const g=r.selectedEntityIds;if(g.size!==1)return;const h=[...g][0],C=J(i,h),R=F(i,h);!C||!R||(ct(l),C.begin(h),O.current={kind:"spacing",id:h,ownerBoxEdit:C,startLocal:T(l.clientX,l.clientY),origRect:R,side:o.side,origValue:o.value})},[i,r,T]),$t=c.useCallback((o,l)=>{if(o.pointerId!==void 0&&l.pointerId!==o.pointerId)return;const g=T(l.clientX,l.clientY),h=g.x-o.startLocal.x,C=g.y-o.startLocal.y;let R;if(o.kind==="resize")R=Mo(o.pos,h,C,o.origRect,!!o.isPositioned,l.altKey,o.context),I(Do(o.pos,h,C,o.origRect,l.altKey,o.context));else if(o.kind==="native-scale")R=ns(o,h,C,r.snapEnabled,l.altKey,r.snapValues.scale),I([]);else if(o.kind==="move"){const{dx:$,dy:it}=is(o.moveAxis,h,C);if(o.nativeOrigin){R=os(o,$,it,r.snapEnabled,l.altKey,r.snapValues.translate);const Z=To({x:R.originX??o.nativeOrigin.x,y:R.originY??o.nativeOrigin.y},o.nativeOrigin,o.origRect,o.context,o.moveAxis,!r.snapEnabled||l.altKey,Lo/Math.max(k.zoom,.01),{x:X.filter(ht=>ht.axis==="x").map(ht=>ht.value),y:X.filter(ht=>ht.axis==="y").map(ht=>ht.value)});R.originX!==void 0&&(R.originX=Z.position.x),R.originY!==void 0&&(R.originY=Z.position.y),I(Z.guides)}else R=$o($,it,o.origRect,l.altKey,o.context);dt(Ve(o.origRect,$,it)),o.nativeOrigin||I(Bo($,it,o.origRect,l.altKey,o.context))}else if(o.kind==="reference"){const $=Oo(g,o.origRect,l.altKey,o.context,{bounded:o.referencePoint?.bounded,snapPoints:o.referencePoint?.snapPoints});R={referenceX:$.position.x,referenceY:$.position.y},I($.guides)}else o.kind==="rotate"?R=Ao(o.center,o.startLocal,g,o.nativeOrigin&&!r.snapEnabled||l.altKey,o.nativeOrigin?r.snapValues.rotate:15):R=Fo(o.side,h,C,o.origValue??0);if(o.ownerBoxEdit.apply(o.id,R),o.kind==="move"&&o.movePeers){const $=o.nativeOrigin?(R.originX??o.nativeOrigin.x)-o.nativeOrigin.x:(R.x??o.origRect.x)-o.origRect.x,it=o.nativeOrigin?(R.originY??o.nativeOrigin.y)-o.nativeOrigin.y:(R.y??o.origRect.y)-o.origRect.y;for(const Z of o.movePeers)Z.ownerBoxEdit.apply(Z.id,Z.nativeOrigin?{originX:Z.nativeOrigin.x+$,originY:Z.nativeOrigin.y+it}:{x:Z.origRect.x+$,y:Z.origRect.y+it})}at()},[T,at,r,X,k.zoom]),Bt=c.useCallback((o,l)=>{const g=d(o,l);if(!g)return null;const h=Yo(i,g)?.backgroundChainAt(o,l)??null;return h?Si(h):null},[i,d]);c.useEffect(()=>{if(!st)return;const o=l=>{l.key};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[st]),c.useEffect(()=>{const o=h=>h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLSelectElement||h instanceof HTMLElement&&h.isContentEditable,l=h=>{h.code!=="Space"||h.repeat||o(h.target)||h.target instanceof HTMLButtonElement||(h.preventDefault(),W.current=!0,gt(!0))},g=h=>{h.code==="Space"&&(W.current=!1,gt(!1),Y.current&&(Y.current=null,mt(!1)))};return window.addEventListener("keydown",l),window.addEventListener("keyup",g),()=>{window.removeEventListener("keydown",l),window.removeEventListener("keyup",g)}},[]);const Fe=c.useCallback(o=>{if(o.stopPropagation(),ct(o),W.current){Y.current={startClientX:o.clientX,startClientY:o.clientY,startPan:M.get()},mt(!0);return}if(st){Bt(o.clientX,o.clientY),Ae(null);return}if(ji(t,o.clientX,o.clientY)){v.current=null,j(null),tt(null);return}const l=d(o.clientX,o.clientY);if(Ai(o,l)){v.current=null,j(null),tt(null);return}const g=l!==null?as(i,l,r.selectedEntityIds):null,h=(!n||r.transformMode==="translate")&&g!==null?ls(i,g,r.selectedEntityIds):null,C=!h&&g!==null?cs(i,g):null;v.current={downClientX:o.clientX,downClientY:o.clientY,downLocal:T(o.clientX,o.clientY),hitAtDown:l,moved:!1,moveCandidate:h,reorderCandidate:C},j(null),tt(null)},[i,r,M,n,T,tt,st,Bt,d,t]),to=c.useCallback(o=>{if(o.button===2){f.current={pointerId:o.pointerId,startClientX:o.clientX,startClientY:o.clientY,moved:!1};return}o.button===0&&Fe(o)},[Fe]),Ye=c.useCallback((o,l)=>{const g=l.clientX-o.downClientX,h=l.clientY-o.downClientY;if(!o.moved&&Math.hypot(g,h)>te&&(o.moved=!0),!!o.moved){if(o.moveCandidate){const C=ss(o.moveCandidate,o.downLocal);O.current=C,$t(C,l);return}if(o.reorderCandidate){const C=T(l.clientX,l.clientY),R=No(o.reorderCandidate.siblingRects,C);R&&(A({id:o.reorderCandidate.id,adapter:o.reorderCandidate.adapter,gap:R}),dt(Ve(o.reorderCandidate.origRect,C.x-o.downLocal.x,C.y-o.downLocal.y)));return}if(o.hitAtDown===null){const C=T(l.clientX,l.clientY);tt({x:Math.min(o.downLocal.x,C.x),y:Math.min(o.downLocal.y,C.y),width:Math.abs(C.x-o.downLocal.x),height:Math.abs(C.y-o.downLocal.y)})}}},[T,tt,$t,A]),ot=c.useCallback(o=>{const l=Y.current;if(l){M.setPan(l.startPan.x+(o.clientX-l.startClientX),l.startPan.y+(o.clientY-l.startClientY));return}if(st){const C=T(o.clientX,o.clientY);Ae({...C,color:Bt(o.clientX,o.clientY)});return}const g=O.current;if(g){$t(g,o);return}if((o.buttons&1)===0){Pi(t,o.clientX,o.clientY,d,m,j);return}const h=v.current;h&&Ye(h,o)},[r,M,T,$t,st,Bt,Ye,d,t]),rt=c.useCallback(o=>{if(we(o),Y.current){Y.current=null,mt(!1);return}const l=O.current;if(l?.pointerId!==void 0&&o.pointerId!==l.pointerId||Tt())return;const g=L.current;if(g){A(null),dt(null),v.current=null,Go(g.adapter,g.id,g.gap.beforeSiblingId);return}const h=v.current;if(v.current=null,!h)return;const C=h.hitAtDown!==null?$i(r.selectedEntityIds,h.hitAtDown,o.shiftKey):Bi(i,h.moved,y.current,o.shiftKey);C!==null&&kn(i,C),tt(null)},[i,r,tt,Tt,A]),U=c.useCallback(o=>{if(we(o),Y.current){Y.current=null,mt(!1);return}const l=O.current;l?.pointerId!==void 0&&o.pointerId!==l.pointerId||Tt()||(L.current&&(A(null),dt(null)),v.current=null,tt(null))},[Tt,tt,A]),eo=c.useCallback(()=>{t||Me()?.editorControls?.clearHover(),m(null),j(null)},[t]),no=c.useCallback(o=>{const l=x.current?.parentElement??null;if(Rr(l,o.clientX,o.clientY))return;const g=d(o.clientX,o.clientY);if(!g)return;const h=pe(i,g);if(!h)return;const C=F(i,g);if(!C)return;const R=h.get(g);if(R===null){console.warn(`[RootSelectionOverlay] text edit refused for "${g}": dynamic body or has child elements — not inline-editable.`),pt(null),ut({id:g,rect:C});return}ut(null),pt({id:g,rect:C,initialText:R})},[i,d,pt]),oo=c.useCallback(o=>{const l=xt.current;if(!l)return;const g=pe(i,l.id);g&&(le.current={id:l.id,rect:l.rect},g.set(l.id,o)),pt(null)},[i,pt]),ro=c.useCallback(()=>pt(null),[pt]);if(!Di(i)||ds())return null;const ft=new Set([...r.selectedEntityIds].filter(o=>i.hierarchy.node(o)!==void 0)),ue=z!==null&&!ft.has(z)?F(i,z):null,H=us(i,ft),bt=H?.rect??null,io=H?.ownerBoxEdit??null,N=n&&H?H.ownerBoxEdit.gizmoOrigin?.(H.id)??{x:H.rect.x+H.rect.width/2,y:H.rect.y+H.rect.height/2}:null,Ct=un/k.zoom,lt=H?H.ownerBoxEdit.referencePoint?.(H.id):null,so=H?.spacingBands??[],yt=ft.size===1?[...ft][0]:null,Ot=yt?_o(i,yt):null,ao=yt&&Ot&&r.showHelpers?Ot.layers(yt).filter(o=>r.helperVisibility[o.category]??!0):[],kt=n?{selectedSingleRect:null,measureLines:[],positionBadge:null,showPositionBadge:!1,parentRect:null}:fs(i,ft,ue),Ne=n?null:ps(i,ft),At=Be.current,lo=n?[]:At&&At.adapter===i&&At.version===s?At.hints:(()=>{const o=Xo(i);return Be.current={adapter:i,version:s,hints:o},o})();return a.jsxs("div",{style:{position:"absolute",inset:0,zIndex:zi,pointerEvents:"none"},children:[a.jsx("div",{ref:x,"data-testid":"world-selection-overlay-interaction",style:{position:"absolute",inset:0,pointerEvents:"auto",touchAction:"none",userSelect:"none",cursor:b??Oi(Dt,Mt,st,!!w)},onPointerDownCapture:to,onPointerMove:ot,onPointerUp:rt,onPointerCancel:U,onLostPointerCapture:U,onPointerLeave:eo,onDoubleClick:no,onContextMenu:D,onDragOver:Hn,onDrop:Vn}),p?a.jsx(hs,{state:p,adapter:i,onClose:()=>S(null)}):null,a.jsxs("div",{"data-testid":"world-selection-overlay-chrome",style:{position:"absolute",inset:0,pointerEvents:"none",transform:je(k),transformOrigin:"0 0"},children:[!n&&lo.map(o=>a.jsx("div",{"data-testid":"world-empty-container-hint","data-entity-id":o.id,title:o.displayName,style:{position:"absolute",left:o.rect.x,top:o.rect.y,width:o.rect.width,height:o.rect.height,border:"1px dashed rgba(154, 160, 166, 0.7)",borderWidth:n?1/k.zoom:1,boxSizing:"border-box",pointerEvents:"none"}},o.id)),ue&&a.jsx("div",{"data-testid":"world-selection-hover",style:{...dn(ue,!1),...n?{borderWidth:1/k.zoom}:{}}}),[...ft].map(o=>{const l=F(i,o);return l?a.jsxs("div",{children:[a.jsx("div",{"data-testid":"world-selection-box","data-entity-id":o,style:{...dn(l,!0),...n?{borderWidth:1/k.zoom,background:"transparent"}:{}}}),!n&&a.jsx("div",{"data-testid":"world-selection-label",style:Fi(l),children:Mi(i,o)})]},o):null}),w&&a.jsx("div",{"data-testid":"world-selection-marquee",style:{position:"absolute",left:w.x,top:w.y,width:w.width,height:w.height,border:`1px solid ${_}`,background:`color-mix(in srgb, ${_} 10%, transparent)`,pointerEvents:"none"}}),!n&&a.jsx(ms,{measureLines:kt.measureLines,snapGuides:u,positionBadge:kt.positionBadge,showPositionBadge:kt.showPositionBadge,badgeAnchorRect:kt.selectedSingleRect,parentRect:kt.parentRect,screenScale:V,screenZoom:1}),!n&&a.jsx(xs,{dragGhost:ae,reorderPreview:B}),!n&&Ne&&a.jsx(Ii,{adapter:i,entries:Ne}),bt&&io&&a.jsxs(a.Fragment,{children:[!n&&so.map(o=>a.jsxs("div",{children:[a.jsx("div",{"data-testid":`world-spacing-${o.kind}-${ys(o.side)}`,style:Wi(o),onPointerDown:l=>Qn(o,l),onPointerMove:ot,onPointerUp:rt,onPointerCancel:U}),!o.isZero&&a.jsx("div",{style:{...Ki(o),...n?{transform:`translate(-50%, -50%) scale(${V})`,transformOrigin:"center"}:{}},children:Math.round(o.value)})]},o.side)),lt&&a.jsx("div",{"aria-label":`Edit ${lt.label}`,"data-reference-kind":lt.kind,"data-testid":"world-reference-point-handle",title:`${lt.label} (${lt.bounded?"native corner/edge/center snap":"8px/alignment snap"}, Alt for free movement)`,style:{..._i(lt),...n?{transform:`scale(${V})`,transformOrigin:"center"}:{}},onPointerDown:o=>Zn(lt,o),onPointerMove:ot,onPointerUp:rt,onPointerCancel:U,onLostPointerCapture:U,role:"button",tabIndex:0,children:lt.kind==="anchor"?"A":"P"}),yt&&Ot&&ao.flatMap(o=>o.handles.map(l=>a.jsx("div",{"aria-label":l.label,"data-testid":"world-spatial-handle","data-handle-id":l.id,"data-writable":l.writable,role:"button",tabIndex:0,title:l.writable?l.label:`${l.label} — ${l.reason}`,style:{...Gi(l),transform:`translate(-50%, -50%) scale(${V})`},onPointerDown:g=>qn(yt,Ot,l,g),onPointerMove:Jn,onPointerUp:de,onPointerCancel:de,onLostPointerCapture:de},`${o.id}:${l.id}`))),n&&r.transformMode==="translate"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-testid":"world-2d-move-axis-x",title:"Move on X axis",style:{position:"absolute",left:N.x,top:N.y-5/k.zoom,width:Ct,height:10/k.zoom,borderTop:`${2/k.zoom}px solid #ef5350`,boxSizing:"border-box",cursor:"ew-resize",pointerEvents:"auto"},onPointerDown:o=>ce("x",o),onPointerMove:ot,onPointerUp:rt,onPointerCancel:U}),a.jsx("div",{"data-testid":"world-2d-move-axis-y",title:"Move on Y axis",style:{position:"absolute",left:N.x-5/k.zoom,top:N.y,width:10/k.zoom,height:Ct,borderLeft:`${2/k.zoom}px solid #66bb6a`,boxSizing:"border-box",cursor:"ns-resize",pointerEvents:"auto"},onPointerDown:o=>ce("y",o),onPointerMove:ot,onPointerUp:rt,onPointerCancel:U}),a.jsx("div",{"data-testid":"world-2d-move-center",title:"Move freely",style:{position:"absolute",left:N.x-5/k.zoom,top:N.y-5/k.zoom,width:10/k.zoom,height:10/k.zoom,border:"1px solid rgba(255,255,255,.9)",background:"#4aa3ff",boxSizing:"border-box",cursor:"move",pointerEvents:"auto"},onPointerDown:o=>ce("both",o),onPointerMove:ot,onPointerUp:rt,onPointerCancel:U})]}),(!n||r.transformMode==="scale")&&(n?a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-testid":"world-2d-scale-axis-x",style:{position:"absolute",left:N.x,top:N.y,width:Ct,borderTop:`${2/k.zoom}px solid #ef5350`,pointerEvents:"none"}}),a.jsx("div",{"data-testid":"world-2d-scale-axis-y",style:{position:"absolute",left:N.x,top:N.y,height:Ct,borderLeft:`${2/k.zoom}px solid #66bb6a`,pointerEvents:"none"}}),[["x","ew-resize"],["y","ns-resize"],["both","nwse-resize"]].map(([o,l])=>{const g=rs(o,N,Ct),h=o==="x"?"e":o==="y"?"s":"se";return a.jsx("div",{"data-testid":`world-resize-handle-${h}`,style:{...pn(g,l),transform:`scale(${V})`,transformOrigin:"center",background:o==="x"?"#ef5350":o==="y"?"#66bb6a":"#fff"},onPointerDown:C=>Un(o,C),onPointerMove:ot,onPointerUp:rt,onPointerCancel:U},o)})]}):a.jsxs(a.Fragment,{children:[Ho.map(({pos:o,cursor:l})=>a.jsx("div",{"data-testid":`world-resize-handle-${o}`,style:pn(Vo(bt,o),l),onPointerDown:g=>Wn(o,g),onPointerMove:ot,onPointerUp:rt,onPointerCancel:U},o)),a.jsx("div",{"data-testid":"world-resize-dimension-label",style:Xi(bt),children:`${Math.round(bt.width)}×${Math.round(bt.height)}`})]})),(!n||r.transformMode==="rotate")&&a.jsxs(a.Fragment,{children:[n&&a.jsx("div",{"data-testid":"world-2d-rotate-ring",style:{position:"absolute",left:N.x-40/k.zoom,top:N.y-40/k.zoom,width:80/k.zoom,height:80/k.zoom,border:`${1/k.zoom}px solid #4aa3ff`,borderRadius:"50%",boxSizing:"border-box",pointerEvents:"none"}}),a.jsx("div",{"data-testid":"world-rotate-handle","aria-label":"Rotate selection",title:"Rotate selection (15° snap, Alt for free rotation)",style:{...Ni(bt),...n?{left:N.x-wt/2,top:N.y-40/k.zoom-wt/2,transform:`scale(${V})`,transformOrigin:"center",background:"#4aa3ff"}:{}},onPointerDown:Kn,onPointerMove:ot,onPointerUp:rt,onPointerCancel:U,role:"button",tabIndex:0})]})]}),!n&&a.jsx(bs,{textEdit:$e,onCommitTextEdit:oo,onCancelTextEdit:ro,textEditRefused:Q,eyedropperActive:st,eyedropperPreview:Xn})]})]})}function ms(t){const{measureLines:e,snapGuides:n,positionBadge:r,showPositionBadge:s,badgeAnchorRect:i,parentRect:d,screenScale:x,screenZoom:v}=t;return a.jsxs(a.Fragment,{children:[d&&a.jsx("div",{"data-testid":"world-parent-outline",style:es(d)}),e.map(y=>a.jsxs("div",{"data-testid":"world-measure-line",children:[a.jsx("div",{style:qi(y)}),a.jsx("div",{style:hn(y.x1,y.y1,y.orientation==="horizontal")}),a.jsx("div",{style:hn(y.x2,y.y2,y.orientation==="horizontal")}),a.jsx("div",{"data-testid":"world-measure-line-label",style:{...Ji(y),...x!==1?{transform:`translate(-50%, -50%) scale(${x})`,transformOrigin:"center"}:{}},children:y.distance})]},y.orientation)),n.map(y=>a.jsx("div",{"data-testid":"world-snap-guide",style:Qi(y)},y.orientation)),s&&i&&r&&a.jsxs("div",{"data-testid":"world-position-badge",style:{...ts(i),...x!==1?{top:i.y-36/v,transform:`scale(${x})`,transformOrigin:"top left"}:{}},children:[r.position&&a.jsx("span",{"data-testid":"world-position-badge-mode",style:mn,children:r.position}),r.parentLayout&&a.jsx("span",{"data-testid":"world-position-badge-layout",style:mn,children:r.parentLayout})]})]})}function xs(t){const{dragGhost:e,reorderPreview:n}=t;return a.jsxs(a.Fragment,{children:[e&&a.jsx("div",{"data-testid":"world-drag-ghost",style:Ui(e)}),n&&a.jsx("div",{"data-testid":"world-reorder-preview",style:Zi(n.gap.marker)})]})}function bs(t){const{textEdit:e,onCommitTextEdit:n,onCancelTextEdit:r,textEditRefused:s,eyedropperActive:i,eyedropperPreview:d}=t;return a.jsxs(a.Fragment,{children:[e&&a.jsx("div",{style:{pointerEvents:"auto"},children:a.jsx(Ri,{rect:e.rect,initialText:e.initialText,onCommit:n,onCancel:r})}),s&&a.jsx("div",{"data-testid":"world-text-edit-refused",title:"dynamic body — not inline-editable",style:{position:"absolute",left:s.rect.x,top:s.rect.y,width:Math.max(s.rect.width,40),height:Math.max(s.rect.height,20),border:`2px dashed ${zt.semantic.danger}`,boxSizing:"border-box",background:zt.semantic.dangerMuted,pointerEvents:"none"}}),i&&d&&a.jsx("div",{"data-testid":"world-eyedropper-swatch","data-color-state":d.color?"resolved":"unknown",style:{position:"absolute",left:d.x+12,top:d.y+12,width:24,height:24,borderRadius:4,border:"2px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.5)",background:d.color??"repeating-linear-gradient(45deg, #999, #999 4px, #ccc 4px, #ccc 8px)",pointerEvents:"none"}})]})}function ys(t){return t.endsWith("Top")?"top":t.endsWith("Right")?"right":t.endsWith("Bottom")?"bottom":"left"}function vs({explanation:t,testId:e,style:n}){return t?a.jsx(or,{"data-testid":e,tone:t.tone,title:t.title,description:a.jsx("span",{style:{whiteSpace:"pre-wrap"},children:t.description}),style:{position:"absolute",inset:0,pointerEvents:"none",...n}}):null}const ws="Scene";function Ss({active:t,composite:e,descriptor:n,documentId:r,store:s}){const i=c.useRef(null),d=c.useRef(null),[x]=c.useState(ur),v=n.kind==="canvas",y=v?x:Pe;c.useSyncExternalStore(s.subscribe,s.getSnapshot);const w=c.useSyncExternalStore(pr,fr),E=c.useSyncExternalStore(hr,gr),[z,j]=c.useState(null),b=e.childAdapters().find(k=>k.worldId===n.worldId)?.adapter??z??void 0,m=v&&b?.provenance?.label==="babylon",p=b?.hierarchy.roots()??[],S=new Set(b?.rects?.emptyContainers?.().map(k=>k.id)??[]),f=p.some(k=>!S.has(k.id)),P=Jr({surface:v?"Scene":n.kind==="dom"?"UI":"World",rootIds:[n.worldId],playSuspended:s.playState!=="stopped"&&(!b||b.provenance?.source==="boundary"),phase:!b||b.provenance?.source==="boundary"?"loading":"ready",content:!b||b.provenance?.source==="boundary"?"unknown":f?"present":"empty",readiness:w,failures:E});c.useEffect(()=>{if(b)return mr(r,()=>({adapter:b,nodeId:[...s.selectedEntityIds].find(k=>b.hierarchy.node(k))??null}))},[e,b,r,s]),c.useEffect(()=>{const k=i.current;if(k&&!m)return v?Gr(k,y):Nr(k,y)},[y,m,v]),c.useEffect(()=>{if(!t)return;if(!!!d.current&&i.current){d.current=Or(i.current,e,s,[n],(Mt,gt)=>j(gt),v?{canvasSceneView:x}:void 0,r);return}let X=0,V=0;const W=()=>{if(X+=1,X<2){V=requestAnimationFrame(W);return}yr(r)};return V=requestAnimationFrame(W),()=>cancelAnimationFrame(V)},[t,x,e,n,r,v,s]),c.useEffect(()=>()=>{d.current?.(),d.current=null},[]);const D=xr(Cn(s),s.selectedEntityIds),M=D?.worldId===n.worldId?D:b?.rects?{worldId:n.worldId,kind:"dom",adapter:b}:null;return a.jsxs("div",{ref:i,"data-testid":`world-document:${n.worldId}`,"data-vgai-backdrop-color":t?m?"#111827":v?sn:Ie:void 0,"data-vgai-backdrop-policy":t?"dark-frost":void 0,onPointerDown:()=>br("viewport"),style:{position:"absolute",inset:0,overflow:"hidden",pointerEvents:"auto",backgroundColor:m?"#111827":v?sn:Ie,touchAction:"none"},children:[m?null:v?a.jsx(pi,{view:x}):a.jsx(Es,{}),a.jsx(gs,{...b?{adapter:b}:{},...v&&!m?{view:x,transformModeAware:!0}:{}},`selection:${Ke(b)}`),a.jsx(vs,{explanation:P,testId:`world-surface-status:${n.worldId}`,style:{zIndex:20}}),m?null:v?a.jsx(hi,{active:t,...b?{adapter:b}:{},containerRef:i,view:x},`controls:${Ke(b)}`):a.jsxs(a.Fragment,{children:[a.jsx(ai,{docId:n.worldId,containerRef:i}),a.jsx(mi,{containerRef:i,context:M})]})]})}function Es(){const t=c.useSyncExternalStore(ee,ne),e=Math.max(8,24*t.zoom),n=Math.max(.7,Math.min(1.4,t.zoom));return a.jsx("div",{"data-testid":"react-design-canvas-backdrop","aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:Ie,backgroundImage:`radial-gradient(circle, ${_r} ${n}px, transparent ${n}px)`,backgroundPosition:`${t.x}px ${t.y}px`,backgroundSize:`${e}px ${e}px`}})}let Wt=null;function As(){return Wt}function Fs(t,e){Wt={store:t,composite:e};const n=lr(),r=e.childAdapters().some(f=>f.role==="world"&&f.kind==="three"),s=e.childAdapters().some(f=>f.kind===vr);!r&&!s&&rr(Nt,{discardDirty:!0});const i=new Set,d=[];let x=!1;for(const f of e.childAdapters())f.role==="world"&&f.kind==="three"&&d.push(fe(f.worldId,Nt));const v=$r(e),y=v.find(f=>f.kind==="canvas");y&&d.push(fe(y.worldId,Gt));const w=new Set([...e.childAdapters().filter(f=>f.role==="world"&&f.kind==="three"),...y?[y]:[]].map(f=>f.worldId)),E=new Map;function z(){for(const f of v){if(w.has(f.worldId)||E.has(f.worldId))continue;const P=Vr(f.kind);if(!P)continue;const D=fe(f.worldId,P.documentId),M=cr(f.worldId,()=>P.presence()==="absent"?`Root "${f.worldId}" has no document of its own: its design surface is the project's ${P.title} board (${P.documentId}). ${P.absentReason()}`:null);E.set(f.worldId,()=>{M(),D()})}}d.push(ir(f=>{const P=dr();if(P.some(M=>M.descriptor.id===f))return null;const D=Wr(f);return D?D.presence()==="absent"?D.absentReason():null:`No workspace document is named "${f}". Open in this session: ${P.map(M=>M.descriptor.id).join(", ")||"(none)"}. A component board is present only when the package that owns its medium says this project has one, so a board id can be absent for this project and present for another.`}));function j(f){const P=D=>a.jsx(Ss,{...D,composite:e,descriptor:f,store:t});ar({id:Gt,title:ws,kind:"world",workspaceRole:"authored-subject",provenance:{rootId:f.worldId,...f.path?{sourcePath:f.path}:{}},Content:P,presentation:()=>({kind:"world",id:f.worldId}),onActivate:()=>t.setActiveViewportTab("edit")},{category:"scene",default:!r,rootId:f.worldId})}function b(f){i.add(f.documentId);const P=()=>{i.delete(f.documentId)};try{Promise.resolve(f.install({store:t,composite:e})).catch(P)}catch{P()}}function m(){if(!x){z();for(const f of Hr()){const P=f.presence();if(P===null)continue;const D=i.has(f.documentId);P==="present"!==D&&(P==="present"?b(f):(We(f.documentId),i.delete(f.documentId)))}}}y&&(j(y),i.add(Gt)),m();const p=Kr(m),S=y?Gt:[...i][0];return!r&&S!==void 0&&(n===null||n===Nt||n===sr)?he(S):n?he(n):r&&he(Nt),()=>{x=!0,Wt?.store===t&&(Wt=null),p();for(const f of d)f();for(const f of E.values())f();E.clear();for(const f of i)We(f)}}export{Ss as RootDocumentContent,As as activeRootDocumentHost,Fs as installRootDocuments};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": {
|
|
3
|
+
"react": "assets/vgai-shared-react-DL5U9FnC.js",
|
|
4
|
+
"react-dom": "assets/vgai-shared-react-dom-DFajMqMT.js",
|
|
5
|
+
"react-dom/client": "assets/vgai-shared-react-dom-client-S0ozfl6_.js",
|
|
6
|
+
"react/jsx-runtime": "assets/vgai-shared-jsx-runtime-DIqBpTut.js",
|
|
7
|
+
"react/jsx-dev-runtime": "assets/vgai-shared-jsx-dev-runtime-VfxIYu0y.js",
|
|
8
|
+
"@fortawesome/react-fontawesome": "assets/vgai-shared-fontawesome-CFSkqz69.js"
|
|
9
|
+
}
|
|
10
|
+
}
|