@galacean/cli 2.0.0-alpha.12 → 2.0.0-alpha.14
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/dist/cli.bundle.cjs +134 -135
- package/dist/viewport-client/_static/Accordion-3d330bc6.js +1 -0
- package/dist/viewport-client/_static/{AmbientLightAsset-f70b95f1.js → AmbientLightAsset-bdbc4e1d.js} +2 -2
- package/dist/viewport-client/_static/AnimationClipAsset-9167378a.js +1 -0
- package/dist/viewport-client/_static/AnimatorControllerAsset-21dc6332.js +1 -0
- package/dist/viewport-client/_static/AnimatorStore-18d3c551.js +1 -0
- package/dist/viewport-client/_static/{AssetViewer-bc198e16.js → AssetViewer-64cd01fa.js} +1 -1
- package/dist/viewport-client/_static/AudioAsset-0c828c80.js +1 -0
- package/dist/viewport-client/_static/AudioComponent-fbff3825.js +1 -0
- package/dist/viewport-client/_static/{Callout-cb4a55ff.js → Callout-ba7e2adf.js} +1 -1
- package/dist/viewport-client/_static/CameraComponent-74975570.js +1 -0
- package/dist/viewport-client/_static/{Component-f923abb1.js → Component-ed7aa0ab.js} +1 -1
- package/dist/viewport-client/_static/DirectLight-b884e7db.js +1 -0
- package/dist/viewport-client/_static/FontAsset-d1ced18d.js +5 -0
- package/dist/viewport-client/_static/FormItemArray-6d69acd4.js +6 -0
- package/dist/viewport-client/_static/{GlTFAsset-9c68f862.js → GlTFAsset-2723b84a.js} +9 -9
- package/dist/viewport-client/_static/IconEdit-ab77303f.js +6 -0
- package/dist/viewport-client/_static/{IconPointFilled-a304fd34.js → IconPointFilled-811fc660.js} +1 -1
- package/dist/viewport-client/_static/LightBaseComponent-12dc27d1.js +1 -0
- package/dist/viewport-client/_static/LottieAnimationComponent-c48c5eb5.js +1 -0
- package/dist/viewport-client/_static/LottieAsset-3692580d.js +6 -0
- package/dist/viewport-client/_static/MarkdownAsset-bcb90be4.js +1 -0
- package/dist/viewport-client/_static/MaterialAsset-6ef9b4ed.js +1 -0
- package/dist/viewport-client/_static/MaterialInspector-e8242674.js +1 -0
- package/dist/viewport-client/_static/Menu-0b8da92f.js +17 -0
- package/dist/viewport-client/_static/MeshAsset-ca9305e5.js +1 -0
- package/dist/viewport-client/_static/MeshRendererBaseComponent-9efd3943.js +1 -0
- package/dist/viewport-client/_static/MeshRendererComponent-c9a03641.js +1 -0
- package/dist/viewport-client/_static/{MeshThumbnail-49273f71.js → MeshThumbnail-ab28b3b8.js} +1 -1
- package/dist/viewport-client/_static/ParticleRendererComponent-96947c1d.js +26 -0
- package/dist/viewport-client/_static/PhysicsMaterialAsset-4a1e5ea3.js +1 -0
- package/dist/viewport-client/_static/PhysicsStore-33cac578.js +1 -0
- package/dist/viewport-client/_static/PointLight-fd514526.js +1 -0
- package/dist/viewport-client/_static/PostProcessComponent-d0ea27a4.js +6 -0
- package/dist/viewport-client/_static/PrefabAsset-9179b95c.js +1 -0
- package/dist/viewport-client/_static/PrimitiveMesh-0572a073.js +1 -0
- package/dist/viewport-client/_static/ProxyConfigs-3a5fd860.js +1 -0
- package/dist/viewport-client/_static/{ReferencedMaterial-a87818f3.js → ReferencedMaterial-5773c9d2.js} +1 -1
- package/dist/viewport-client/_static/RenderTargetAsset-ab6e06d2.js +1 -0
- package/dist/viewport-client/_static/SceneAsset-385fa837.js +1 -0
- package/dist/viewport-client/_static/{ShaderAsset-cb3ff628.js → ShaderAsset-f4514b03.js} +6 -6
- package/dist/viewport-client/_static/ShaderChunkAsset-34116f2c.js +5 -0
- package/dist/viewport-client/_static/{ShaderUIScriptAsset-d13fa4e2.js → ShaderUIScriptAsset-fc503291.js} +5 -5
- package/dist/viewport-client/_static/SkinnedMeshRendererComponent-494ad439.js +1 -0
- package/dist/viewport-client/_static/SpineAnimationComponent-3918d7b5.js +1 -0
- package/dist/viewport-client/_static/SpineSkeletonDataAsset-27244892.js +1 -0
- package/dist/viewport-client/_static/SpotLight-f9972dc0.js +1 -0
- package/dist/viewport-client/_static/SpriteAsset-558ffca8.js +6 -0
- package/dist/viewport-client/_static/SpriteAtlasAsset-cdc34386.js +1 -0
- package/dist/viewport-client/_static/SpriteBaseComponent-3edafa31.js +1 -0
- package/dist/viewport-client/_static/SpriteMaskComponent-de2e5231.js +1 -0
- package/dist/viewport-client/_static/SpriteRendererComponent-e999e735.js +1 -0
- package/dist/viewport-client/_static/{TextBaseComponent-69233798.js → TextBaseComponent-ce1402c3.js} +2 -2
- package/dist/viewport-client/_static/TextRendererComponent-f7c0deae.js +1 -0
- package/dist/viewport-client/_static/TextureAsset-39fb07fe.js +36 -0
- package/dist/viewport-client/_static/Tooltip-82063435.js +1 -0
- package/dist/viewport-client/_static/TrailRendererComponent-37f5c981.js +1 -0
- package/dist/viewport-client/_static/TransformBaseComponent-713d57e9.js +1 -0
- package/dist/viewport-client/_static/TransformComponent-40a57948.js +1 -0
- package/dist/viewport-client/_static/XRReferenceImageAsset-2f6ff226.js +1 -0
- package/dist/viewport-client/_static/audio-7120ec91.js +1 -0
- package/dist/viewport-client/_static/glTFIO-79bbca27.js +1 -0
- package/dist/viewport-client/_static/index-483b5738.js +1 -0
- package/dist/viewport-client/_static/{index-98982ce2.js → index-74130ff3.js} +1 -1
- package/dist/viewport-client/_static/index-78269e76.js +1 -0
- package/dist/viewport-client/_static/index-7834b582.js +1 -0
- package/dist/viewport-client/_static/{index-237c84cd.js → index-7917f782.js} +3 -3
- package/dist/viewport-client/_static/index-7acd49d2.js +1 -0
- package/dist/viewport-client/_static/index-9d3917da.js +1 -0
- package/dist/viewport-client/_static/index-a9b2675e.js +1 -0
- package/dist/viewport-client/_static/index-aec7e708.js +11487 -0
- package/dist/viewport-client/_static/index-b5582401.js +1 -0
- package/dist/viewport-client/_static/{index-e46ec5b1.js → index-bfe6f30e.js} +7 -7
- package/dist/viewport-client/_static/index-c63c9606.js +2 -0
- package/dist/viewport-client/_static/index-cd1fee9d.js +1 -0
- package/dist/viewport-client/_static/index-e73ceaed.js +1 -0
- package/dist/viewport-client/_static/index-e8a45e82.js +1 -0
- package/dist/viewport-client/_static/index-f2cb64af.js +1 -0
- package/dist/viewport-client/_static/index-fbe040bf.js +31 -0
- package/dist/viewport-client/_static/ktx2-encoder-53b21bdc.js +1 -0
- package/dist/viewport-client/_static/{module-5c85b07e.js → module-220b3921.js} +1 -1
- package/dist/viewport-client/_static/{module-6406b050.js → module-8816772d.js} +1 -1
- package/dist/viewport-client/_static/{module-107b7430.js → module-ffeaf99f.js} +1 -1
- package/dist/viewport-client/_static/postmen-2f47f6bb.js +1 -0
- package/dist/viewport-client/index.html +2 -2
- package/package.json +1 -1
- package/dist/viewport-client/_static/Accordion-4897319b.js +0 -6
- package/dist/viewport-client/_static/AnimationClipAsset-01f3deb6.js +0 -1
- package/dist/viewport-client/_static/AnimatorControllerAsset-b7424e9c.js +0 -1
- package/dist/viewport-client/_static/AnimatorStore-fd98c00e.js +0 -1
- package/dist/viewport-client/_static/AssetPreviewer-24e31d97.js +0 -6
- package/dist/viewport-client/_static/AudioAsset-eae03324.js +0 -1
- package/dist/viewport-client/_static/AudioComponent-44070c2c.js +0 -1
- package/dist/viewport-client/_static/CameraComponent-907ac745.js +0 -1
- package/dist/viewport-client/_static/CanvasRenderer-9dd98cb3.js +0 -1
- package/dist/viewport-client/_static/DirectLight-58f5fe9e.js +0 -1
- package/dist/viewport-client/_static/FontAsset-abfb9a8a.js +0 -5
- package/dist/viewport-client/_static/FormItemArray-66be8701.js +0 -1
- package/dist/viewport-client/_static/IconPlayerPlayFilled-b058c98f.js +0 -6
- package/dist/viewport-client/_static/InstanceEditorAsset-a70e73fe.js +0 -1
- package/dist/viewport-client/_static/LightBaseComponent-fbc3ae49.js +0 -1
- package/dist/viewport-client/_static/LottieAnimationComponent-1c3e02a5.js +0 -1
- package/dist/viewport-client/_static/LottieAsset-377c1419.js +0 -1
- package/dist/viewport-client/_static/MarkdownAsset-7ea387a9.js +0 -1
- package/dist/viewport-client/_static/MaterialAsset-74a15124.js +0 -1
- package/dist/viewport-client/_static/MaterialInspector-aec1248b.js +0 -1
- package/dist/viewport-client/_static/Menu-cd3be298.js +0 -17
- package/dist/viewport-client/_static/MeshAsset-73e2cc8e.js +0 -1
- package/dist/viewport-client/_static/MeshRendererBaseComponent-3a0e09ed.js +0 -1
- package/dist/viewport-client/_static/MeshRendererComponent-5385d30f.js +0 -1
- package/dist/viewport-client/_static/ParticleRendererComponent-5a7b57d9.js +0 -21
- package/dist/viewport-client/_static/PhysicsMaterialAsset-a5ac9f82.js +0 -1
- package/dist/viewport-client/_static/PhysicsStore-0729e76d.js +0 -1
- package/dist/viewport-client/_static/PointLight-0e1d1546.js +0 -1
- package/dist/viewport-client/_static/PostProcessComponent-8276d33c.js +0 -1
- package/dist/viewport-client/_static/PrefabAsset-1a7edfbd.js +0 -1
- package/dist/viewport-client/_static/PrimitiveMesh-3ce6fa2f.js +0 -1
- package/dist/viewport-client/_static/ProxyConfigs-4de3304c.js +0 -1
- package/dist/viewport-client/_static/RenderTargetAsset-33c0d9e7.js +0 -1
- package/dist/viewport-client/_static/SceneAsset-8917c210.js +0 -1
- package/dist/viewport-client/_static/ShaderChunkAsset-83f923f4.js +0 -5
- package/dist/viewport-client/_static/SkinnedMeshRendererComponent-2a8323bf.js +0 -1
- package/dist/viewport-client/_static/SpineAnimationComponent-e733d50f.js +0 -1
- package/dist/viewport-client/_static/SpineSkeletonDataAsset-b64a3ee3.js +0 -1
- package/dist/viewport-client/_static/SpotLight-ca6c0c3b.js +0 -1
- package/dist/viewport-client/_static/SpriteAsset-9a31ec24.js +0 -1
- package/dist/viewport-client/_static/SpriteAtlasAsset-a862db46.js +0 -1
- package/dist/viewport-client/_static/SpriteBaseComponent-f6f1731f.js +0 -1
- package/dist/viewport-client/_static/SpriteMaskComponent-778be04f.js +0 -1
- package/dist/viewport-client/_static/SpriteRendererComponent-2b4d153b.js +0 -1
- package/dist/viewport-client/_static/TextRendererComponent-130b4e99.js +0 -1
- package/dist/viewport-client/_static/TextureAsset-28fedf2a.js +0 -36
- package/dist/viewport-client/_static/ThumbnailMixin-35997457.js +0 -1
- package/dist/viewport-client/_static/ThumbnailRegistry-495c18c9.js +0 -1
- package/dist/viewport-client/_static/Tooltip-33f770ba.js +0 -1
- package/dist/viewport-client/_static/TrailRendererComponent-148550b5.js +0 -1
- package/dist/viewport-client/_static/TransformBaseComponent-02318c5a.js +0 -1
- package/dist/viewport-client/_static/TransformComponent-96106065.js +0 -1
- package/dist/viewport-client/_static/ViewerManager-202b570a.js +0 -1
- package/dist/viewport-client/_static/XRReferenceImageAsset-6a6adb3b.js +0 -1
- package/dist/viewport-client/_static/audio-244358e2.js +0 -1
- package/dist/viewport-client/_static/glTFIO-45ff9a17.js +0 -1
- package/dist/viewport-client/_static/index-0a8702e2.js +0 -11217
- package/dist/viewport-client/_static/index-37c74ae9.js +0 -26
- package/dist/viewport-client/_static/index-4cca0201.js +0 -1
- package/dist/viewport-client/_static/index-59732f86.js +0 -1
- package/dist/viewport-client/_static/index-6c8198f6.js +0 -2
- package/dist/viewport-client/_static/index-6f827618.js +0 -1
- package/dist/viewport-client/_static/index-803ca489.js +0 -1
- package/dist/viewport-client/_static/index-85a6cf6a.js +0 -1
- package/dist/viewport-client/_static/index-b3d51f87.js +0 -1
- package/dist/viewport-client/_static/index-be6bc38a.js +0 -177
- package/dist/viewport-client/_static/index-c403cbcd.js +0 -1
- package/dist/viewport-client/_static/index-e73966ae.js +0 -1
- package/dist/viewport-client/_static/index-e95b4498.js +0 -1
- package/dist/viewport-client/_static/index-f5a67a46.js +0 -1
- package/dist/viewport-client/_static/ktx-parse.modern-6c9f771f.js +0 -1
- package/dist/viewport-client/_static/ktx2-encoder-1e63c1eb.js +0 -1
- package/dist/viewport-client/_static/postmen-45d4c238.js +0 -1
- package/dist/viewport-client/_static/utilities-e09052e3.js +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{K as E,b as w,T as I,a as R}from"./TextureAsset-39fb07fe.js";import{G as F,a as G}from"./GlTFAsset-2723b84a.js";import{M as V,a as K}from"./MaterialAsset-6ef9b4ed.js";import{MeshAsset as X}from"./MeshAsset-ca9305e5.js";import{AnimatorControllerAsset as D}from"./AnimatorControllerAsset-21dc6332.js";import{A as j,a as q,b as z}from"./AnimationClipAsset-9167378a.js";import{S as H}from"./SpriteAsset-558ffca8.js";import{S as N}from"./SpriteAtlasAsset-cdc34386.js";import{AmbientLightAsset as W}from"./AmbientLightAsset-bdbc4e1d.js";import{LottieAsset as Z}from"./LottieAsset-3692580d.js";import{a as $,S as rr}from"./ShaderChunkAsset-34116f2c.js";import{S as tr}from"./SpineSkeletonDataAsset-27244892.js";import{FontAsset as sr}from"./FontAsset-d1ced18d.js";import{SceneAsset as ar}from"./SceneAsset-385fa837.js";import{E as mr,c as Ar,b as Sr,a as fr,S as xr}from"./ShaderAsset-f4514b03.js";import{E as hr,a as lr,S as Tr,b as cr,t as dr}from"./ShaderUIScriptAsset-fc503291.js";import{PrimitiveMesh as Mr}from"./PrimitiveMesh-0572a073.js";import{XRReferenceImageAsset as ur}from"./XRReferenceImageAsset-2f6ff226.js";import{PrefabAsset as Pr}from"./PrefabAsset-9179b95c.js";import{PhysicsMaterialAsset as Er}from"./PhysicsMaterialAsset-4a1e5ea3.js";import{RenderTargetAsset as Ir}from"./RenderTargetAsset-ab6e06d2.js";import{AudioAsset as kr}from"./AudioAsset-0c828c80.js";import{StateMachineScript as Gr}from"./index-78269e76.js";import{MarkdownAsset as Vr}from"./MarkdownAsset-bcb90be4.js";import"./index-aec7e708.js";import"./enum-58295f88.js";import"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";import"./encode-ac4bb64e.js";import"./meshopt_simplifier.module-cd99529d.js";import"./Tooltip-82063435.js";import"./AssetViewer-64cd01fa.js";import"./ktx2-encoder-53b21bdc.js";import"./TaskQueue-05c94a4d.js";import"./glTFIO-79bbca27.js";import"./MaterialInspector-e8242674.js";import"./IconPointFilled-811fc660.js";import"./ProxyConfigs-3a5fd860.js";import"./index-74130ff3.js";import"./MeshThumbnail-ab28b3b8.js";import"./bundlers-9b0d37fc.js";import"./assetEditorActions-c4e5962f.js";import"./module-8816772d.js";import"./module-ffeaf99f.js";import"./FormItemArray-6d69acd4.js";import"./Accordion-3d330bc6.js";import"./IconEdit-ab77303f.js";import"./module-220b3921.js";export{W as AmbientLightAsset,j as AnimationClipAsset,q as AnimationClipInspector,z as AnimationClipViewer,D as AnimatorControllerAsset,kr as AudioAsset,hr as EScriptSubType,mr as EShaderPropertyType,sr as FontAsset,F as GlTFAsset,G as GlTFViewer,E as KTX2Options,Z as LottieAsset,Vr as MarkdownAsset,V as MaterialAsset,K as MaterialViewer,X as MeshAsset,Er as PhysicsMaterialAsset,Pr as PrefabAsset,Mr as PrimitiveMesh,Ir as RenderTargetAsset,ar as SceneAsset,lr as ScriptAsset,Ar as ShaderAsset,$ as ShaderChunkAsset,Sr as ShaderPropertyEnumType,fr as ShaderPropertyRangeType,xr as ShaderTemplateConfigs,Tr as ShaderUIScript,cr as ShaderUIScriptAsset,rr as SpineAtlasAsset,tr as SpineSkeletonDataAsset,H as SpriteAsset,N as SpriteAtlasAsset,Gr as StateMachineScript,w as TextureAsset,I as TextureShape,R as TextureUseType,ur as XRReferenceImageAsset,dr as scriptTemplates};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var v=Object.defineProperty;var x=(r,n,e)=>n in r?v(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var c=(r,n,e)=>(x(r,typeof n!="symbol"?n+"":n,e),e);import{di as w,dj as D,n as A,e as B,q as E,o as R,j as S,dk as m,u as T,x as F,bD as z,aL as O,K as C,U as P,S as k,dl as M,aU as f}from"./index-aec7e708.js";let y=null;function l(){return y??(y=new w),y}const j=new Proxy({},{get(r,n,e){const t=l(),s=Reflect.get(t,n,t);return typeof s=="function"?s.bind(t):s},set(r,n,e,t){return Reflect.set(l(),n,e),!0},has(r,n){return Reflect.has(l(),n)},ownKeys(){return Reflect.ownKeys(l())},getOwnPropertyDescriptor(r,n){const e=Reflect.getOwnPropertyDescriptor(l(),n);return e||{configurable:!0,enumerable:!0,writable:!0,value:l()[n]}}});function I(r){D(r)}var L=Object.defineProperty,K=Object.getOwnPropertyDescriptor,h=(r,n,e,t)=>{for(var s=t>1?void 0:t?K(n,e):n,i=r.length-1,o;i>=0;i--)(o=r[i])&&(s=(t?o(n,e,s):o(s))||s);return t&&s&&L(n,e,s),s};let u=class extends S{constructor(n){super(n);c(this,"isRoot",!1);c(this,"isFolder",!0);c(this,"hidden",!1);c(this,"extname","");c(this,"childrenId",[]);c(this,"acceptDragLayer",E.MainAsset);T(this)}get thumbnailUrl(){return this.locked?m.FolderLocked:m.Folder}get children(){const n=[];return this.childrenId.forEach(e=>{const t=this.root.assetStore.assets[e];t&&n.push(t)}),n}afterDelete(){const n=this.root.assetStore.assets;for(;this.childrenId.length;){const e=this.childrenId[0],t=n[e];t.loadingStatus==="success"&&t.beforeDelete&&t.beforeDelete(),this.childrenId.splice(0,1),delete this.root.assetStore.assets[e],t.loadingStatus==="success"&&t.afterDelete&&t.afterDelete()}}async initByMeta(n){super.initByMeta(n),this.isRoot=!!n.isRoot,n.hidden!=null&&(this.hidden=n.hidden),this.initObjectProperties()}async initByMain(n){}initByCreation(n,e,t){return Promise.resolve()}onDoubleClick(){this.root.assetStore.openFolder(this.id)}saveMain(){return null}recursive(n,e=!1){const t=this.children,s=[];for(let i=0;i<t.length;i++){const o=t[i];o.isFolder?(s.push(o),e&&n(o)):n(o)}return s.forEach(i=>i.recursive(n,e))}async asyncRecursive(n,e=!1){const t=this.children,s=[];for(let i=0;i<t.length;i++){const o=t[i];o.isFolder?(s.push(o),e&&await n(o)):await n(o)}for(let i=0;i<s.length;i++)await s[i].asyncRecursive(n,e)}_onDrop(n,e){if(!e||this.id===e.id)return;const{assetStore:t,assetUIStore:s,assetFacade:i}=this.root;if(this.dropping=!1,s.pickedAssets.includes(e.id)){if(s.pickedAssets.includes(this.id))return;for(let o=0;o<s.pickedAssets.length;o++)try{const a=s.pickedAssets[o];if(!t.assets[a])continue;i.moveAsset(a,this.id)}catch(a){I(a instanceof Error?a.message:String(a))}}else try{i.moveAsset(e.id,this.id)}catch(o){I(o instanceof Error?o.message:String(o))}}};h([F],u.prototype,"childrenId",2);h([z],u.prototype,"children",1);h([O],u.prototype,"_onDrop",1);u=h([A({type:"Folder",label:B("asset.folder.title"),dragLayer:E.Folder,importMenuConfig:{type:R.Add}})],u);const d=class d extends S{constructor(){super(...arguments);c(this,"isTemplate",!0);c(this,"_clonedEntities",[]);c(this,"_instances",new Map);c(this,"_rootKey","");c(this,"_tempSize",0)}_buildInstanceLink(){const e=this.getMetaConfig().type;if(e!=="Prefab"&&e!=="glTF")return null;const t=e;return{assetId:this.id,bindingId:"",assetKind:t,role:"root",...this._rootKey&&{sourceEntityId:this._rootKey}}}instantiateEngineObject(){const e=this._instantiateEngineObject();this._clonedEntities.push(e);const t=this._clonedEntities;return e.addComponent(class extends k{onDestroy(){const s=t.indexOf(this.entity);s>=0&&t.splice(s,1)}}),e}addInstance(e,t){var g;const s=e.instanceAssetId;if(s){const p=this.root.assetStore.assets[s];p.isTemplate&&p.removeInstance(e)}const o=e.root.domainStore.getNormalizedState().entities[e.id],a=this._buildInstanceLink();o&&a?(g=o.instance)!=null&&g.bindingId||e.root.entityFacade.updateEntity(e.id,{instance:a}):a&&(e.pendingInstance=a),this._instances.set(e.id,e.entityManager),e.on("delete",()=>{this.removeInstance(e)})}removeInstance(e){var s;((s=e.root.domainStore.getNormalizedState().entities[e.id])==null?void 0:s.instance)!==void 0?e.root.entityFacade.updateEntity(e.id,{instance:null}):e.pendingInstance=null,this._instances.delete(e.id)}get instanceCount(){return this._instances.size}static resolveInstanceEntityIds(e,t){const s=new Set;for(let i=0;i<e.length;i++){const o=e[i],a=t[o];a&&s.add(a.parentId===null?o:a.parentId)}return Array.from(s)}getInstanceEntityIds(){return d.resolveInstanceEntityIds(Array.from(this._instances.keys()),this.root.domainStore.state.entities)}unpackAllInstances(){this._instances.forEach((e,t)=>{var i;const s=e.entities.get(t);s&&(((i=s.root.domainStore.getNormalizedState().entities[s.id])==null?void 0:i.instance)!==void 0?s.root.entityFacade.updateEntity(s.id,{instance:null}):s.pendingInstance=null)}),this._instances.clear()}afterDelete(){this.unpackAllInstances(),this.root.sceneStore.selectEntity(null),this._clonedEntities.forEach(t=>t.destroy());const e=this.getDragTempEntity();e&&(e.destroy(),this.setDragTempEntity(null))}_updateDragTempEntity(){try{const e=this.instantiateEngineObject();this.setDragTempEntity(e),this._tempSize=this._getSize(e)}catch(e){console.warn(`[InstanceEditorAsset] Failed to create drag temp entity for asset ${this.id}:`,e)}}_destroyInstances(){this._instances.forEach((e,t)=>{const s=e.entities.get(t);s==null||s.destroy()}),this._instances.clear()}async updateThumbnail(){this._tempSize?super.updateThumbnail():super.updateThumbnail(!0)}_getSize(e){M(e,d._tempBoundingBox),d._tempBoundingBox.getExtent(d._tempExtend);const t=d._tempExtend.length();return t===1/0?0:t}};c(d,"_tempExtend",new C),c(d,"_tempBoundingBox",new P);let _=d;const b=f.createContext(j);function q(){const r=f.useContext(b);if(!r)throw new Error("useRootStore must be used within a RootProvider");return r}const V=r=>f.useContext(b)[r];export{u as F,_ as I,V as a,j as r,q as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var G=Object.defineProperty;var $=(n,t,e)=>t in n?G(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var X=(n,t,e)=>($(n,typeof t!="symbol"?t+"":t,e),e);import{aQ as x,aS as f,aW as K,E as b,bQ as Y,bP as A,x as Z,p as ee,e as p,cE as P,S as w,ee as re,e4 as te,aR as j,bm as ne,dH as oe,aO as D,bN as ae,q as ie,cC as se,ef as U,by as ce,C as m,t as W}from"./index-aec7e708.js";import{a as d,b as O,c as E,d as z,e as L,f as V,g as B}from"./module-220b3921.js";import"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";import{F as J}from"./FormItemArray-6d69acd4.js";import{c as pe,a as le}from"./scriptPropertyActions-d3a583d2.js";const ue=x(function(t){const{model:e}=t,o=pe(e.properties,e.root);return f.jsx(K.List,{fullWidth:!0,model:o,configs:e.propertiesConfig,onModelChange:(r,a)=>{a!==void 0&&le(e.root,e.id,r,a)}})});var fe=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Q=(n,t,e,o)=>{for(var r=o>1?void 0:o?ge(t,e):t,a=n.length-1,i;a>=0;a--)(i=n[a])&&(r=(o?i(t,e,r):i(r))||r);return o&&r&&fe(t,e,r),r};class h extends b{constructor(e,o){super(e,o);X(this,"propertiesConfig",[]);X(this,"properties",{})}onInitComplete(){const e=b.getRegisteredImportComponentProperty(this.type),{engineObject:o}=this,r={},a=[];for(let s=0;s<e.length;s++){const l=e[s];r[l.property]=o[l.property],a.push(l)}this.propertiesConfig=a;const{properties:i}=this;for(const[s,l]of Object.entries(r))i[s]=i[s]??l;Object.keys(i).forEach(s=>{Y(this,s,{getActualEditorValue:()=>A(i[s]),setActualEditorValue:(l,c,u)=>{l.properties[c]=u}})})}deserialize(e){if(super.deserialize(e),e.props)for(const[o,r]of Object.entries(e.props))o!=="enabled"&&(this.properties[o]=r)}toJSON(){const e=super.toJSON();if(delete e.props.script,this.properties){const o=A(this.properties),r=e.props||{};for(const[a,i]of Object.entries(o))a!=="root"&&(r[a]=i);e.props=r}return e}}Q([Z.ref],h.prototype,"propertiesConfig",2);Q([ee({label:p("component.script.properties-label"),customComponent:ue})],h.prototype,"properties",2);function S(n,t){return S=Object.setPrototypeOf||function(o,r){return o.__proto__=r,o},S(n,t)}function y(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),t&&S(n,t)}var me=function(n){y(t,n);function t(){var o;return o=n.apply(this,arguments)||this,o.mode=d.AR,o}var e=t.prototype;return e.onEnable=function(){var r=this.engine.xrManager;if(r)switch(this.mode){case d.AR:var a;r.origin=this.origin;var i=(a=this.camera)==null?void 0:a.getComponent(P);if(i)r.cameraManager.attachCamera(O.Camera,i);else throw new Error("XROrigin: The Camera is not included on the Camera Entity");break;case d.VR:var s,l;r.origin=this.origin;var c=(s=this.leftCamera)==null?void 0:s.getComponent(P);if(c)r.cameraManager.attachCamera(O.LeftCamera,c);else throw new Error("XROrigin: The Camera is not included on the Left Camera Entity");var u=(l=this.rightCamera)==null?void 0:l.getComponent(P);if(u)r.cameraManager.attachCamera(O.RightCamera,u);else throw new Error("XROrigin: The Camera is not included on the Right Camera Entity");break}},t}(w);function N(n,t){for(var e=0;e<t.length;e++){var o=t[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}function de(n,t,e){return t&&N(n.prototype,t),e&&N(n,e),n}var he=function(n){y(t,n);function t(){var e;return e=n.apply(this,arguments)||this,e._destroyedOnRemoval=!0,e}return de(t,[{key:"data",get:function(){return this._data},set:function(o){this._data=o}},{key:"destroyedOnRemoval",get:function(){return this._destroyedOnRemoval},set:function(o){this._destroyedOnRemoval=o}}]),t}(w);function q(n,t){return t!=null&&typeof Symbol<"u"&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](n):n instanceof t}var M=function(n){y(t,n);function t(o,r){var a;return a=n.call(this,o)||this,a._trackIdToIndex=[],a._trackedComponents=[],a._feature=r,a._onTrackedChanged=a._onTrackedChanged.bind(a),a._onSessionChanged=a._onSessionChanged.bind(a),a}var e=t.prototype;return e.getTrackedComponentByTrackId=function(r){var a=this._trackIdToIndex[r];return a!==void 0?this._trackedComponents[a]:void 0},e.onEnable=function(){var r;(r=this.engine.xrManager)==null||r.sessionManager.addStateChangedListener(this._onSessionChanged)},e.onDisable=function(){var r,a=this.engine.xrManager;a&&((r=a.getFeature(this._feature))==null||r.removeChangedListener(this._onTrackedChanged),a.sessionManager.removeStateChangedListener(this._onSessionChanged))},e._onSessionChanged=function(r){switch(r){case E.Initializing:this._initXRFeature();break;case E.Initialized:var a=this._engine.xrManager.getFeature(this._feature);a?a.addChangedListener(this._onTrackedChanged):console.error("XRTrackedObjectManager: Feature ",this._feature.name," not found");break}},e._onTrackedChanged=function(r,a,i){if(r.length>0)for(var s=0,l=r.length;s<l;s++)this._createOrUpdateTrackedComponents(r[s]);if(a.length>0)for(var c=0,u=a.length;c<u;c++)this._createOrUpdateTrackedComponents(a[c]);if(i.length>0)for(var g=this,I=g._trackIdToIndex,v=g._trackedComponents,k=0,H=i.length;k<H;k++){var F=i[k].id,C=I[F];if(C!==void 0){var T=v[C];v.splice(C,1),delete I[F],T.destroyedOnRemoval?T.entity.destroy():T.entity.parent=null}}},e._createOrUpdateTrackedComponents=function(r){var a=this.getTrackedComponentByTrackId(r.id);if(!a){var i=this,s=i._trackIdToIndex,l=i._trackedComponents;a=this._createTrackedComponents(r),s[r.id]=l.length,l.push(a)}a.data=r;var c=a.entity.transform,u=r.pose;return c.position=u.position,c.rotationQuaternion=u.rotation,a},e._createTrackedComponents=function(r){var a=this._engine.xrManager.origin,i=this.prefab,s;return i?(q(i,re)?s=i.instantiateSceneRoot():q(i,te)?s=i.instantiate():s=i.clone(),s.name="TrackedImage"+r.id,a.addChild(s)):s=a.createChild("TrackedImage"+r.id),s.addComponent(he)},t}(w),ye=function(n){y(t,n);function t(o){var r;return r=n.call(this,o,z)||this,r.anchors=[],r}var e=t.prototype;return e._initXRFeature=function(){var r=this.anchors,a=this.engine.xrManager;try{for(var i=a.addFeature(z),s=0,l=r.length;s<l;s++){var c=r[s];i.addAnchor(c.position,c.rotation)}}catch(u){console.error("Anchor Tracking is not supported.",u)}},t}(M),be=function(n){y(t,n);function t(o){var r;return r=n.call(this,o,L)||this,r.trackingImages=[],r}var e=t.prototype;return e._initXRFeature=function(){try{this.engine.xrManager.addFeature(L,this.trackingImages)}catch(r){console.error("Image Tracking is not supported.",r)}},t}(M),xe=function(n){y(t,n);function t(o){var r;return r=n.call(this,o,V)||this,r.detectionMode=B.EveryThing,r}var e=t.prototype;return e._initXRFeature=function(){try{this.engine.xrManager.addFeature(V,this.detectionMode)}catch(r){console.error("Plane Tracking is not supported.",r)}},t}(M);const ve=x(({model:n,inspectorConfig:t,onModelChange:e})=>{const o=t.property||"anchors",r=n[o]||[],{t:a}=j();return f.jsx(f.Fragment,{children:f.jsx(J,{defaultValue:[],label:a("xr.anchor.list.label"),items:r.map((i,s)=>({removable:!0,children:f.jsx(_e,{item:i,onChange:l=>{const c=r.map((u,g)=>g!==s?u:l);e==null||e(o,c)}}),id:String(s),name:a("xr.anchor.item",{index:s})})),addable:!0,onAdd:()=>{const i=r.concat({position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0,w:1}});e==null||e(o,i)},onDelete:i=>{const s=Number(i.id),l=r.filter((c,u)=>u!==s);e==null||e(o,l)}})})}),_e=x(({item:n,onChange:t})=>{const{t:e}=j(),{position:o,rotation:r}=n;return f.jsxs(f.Fragment,{children:[f.jsx(ne,{label:e("xr.anchor.position"),info:e("xr.anchor.position"),value:{x:o.x,y:o.y,z:o.z},onChange:(a,i)=>{const s={...o,[i]:a[i]};t({...n,position:s})}}),f.jsx(oe,{label:e("xr.anchor.rotation"),info:e("xr.anchor.rotation"),value:{x:r.x,y:r.y,z:r.z,w:r.w},onChange:(a,i)=>{const s={...r,[i]:a[i]};t({...n,rotation:s})}})]})}),Re=D("div",{textAlign:"center"}),Ie=D("img",{maxHeight:"200px",maxWidth:"100%",height:"auto",width:"auto"}),ke=x(({model:n,inspectorConfig:t,onModelChange:e})=>{const o=t.property||"trackingImages",r=n[o]||[],{assets:a}=n.root.assetStore,{t:i}=j(),s=r.map((c,u)=>{const g=a[c.refId];return g?{removable:!0,children:f.jsx(Ce,{item:g,model:n}),id:String(u),arrow:!1,name:Te(g.name)}:null}).filter(Boolean),l=[];return Object.values(a).forEach(c=>{const{type:u}=c.getMetaConfig();u==="XRReferenceImage"&&!r.find(g=>g.refId===c.id)&&l.push(c)}),f.jsxs(f.Fragment,{children:[f.jsx(J,{defaultValue:[],label:i("xr.image.list.label"),info:i("xr.image.list.info"),items:s,onDelete:async c=>{const u=Number(c.id),g=r.filter((I,v)=>v!==u);e==null||e(o,g)}}),f.jsx(ae,{assets:l,dropLayer:ie.XRReferenceImage,onSelect:c=>{const u=r.concat(c.getCurrentRef());e==null||e(o,u)},placeholder:i("xr.image.select"),label:i("xr.image.add"),value:null,asset:null})]})}),Ce=x(({item:n,model:t})=>f.jsxs(f.Fragment,{children:[f.jsx(Re,{children:f.jsx(Ie,{src:n.imgUrl})}),f.jsx(se,{label:p("xr.image.width.label"),value:n.physicalWidth,onChange:e=>{t.root.inspectorFacade.assetChange(n.id,"physicalWidth",e,"asset-meta")}})]}));function Te(n,t=30){return n.length>t?n.slice(0,t-3)+"...":n}function R(n,t,e,o){b.registerComponent(n,e),b.registerCustomEngineComponent(n,t),b.registerImportComponentProperty(n,o)}const _={};U.on("ComponentAddToScene",n=>{const{type:t}=n;if(t)switch(t){case"XR Origin":case"XR Anchor Manager":case"XR Image Manager":case"XR Plane Manager":(_[t]=(_[t]||0)+1)>1&&ce(p("xr.toast.only-one-effect"));break}});U.on("ComponentDestroyInScene",n=>{const{type:t}=n;!t||!_[t]||(_[t]-=1)});R("XR Origin",me,{class:h,componentsMenu:{label:p("xr.origin.title"),group:"XR"},type:"XR Origin",refMap:new Set,external:!1,unique:!0},[{type:m.SegmentControl,property:"mode",label:p("xr.origin.mode.label"),info:p("xr.origin.mode.info"),options:W(d,void 0,n=>p(`xr.origin.mode.${n.toLowerCase()}`))},{type:m.EntityPicker,property:"origin",label:p("xr.origin.origin.label"),info:p("xr.origin.origin.info"),when:n=>n.mode!==d.None},{type:m.EntityPicker,property:"camera",label:p("xr.origin.camera.label"),info:p("xr.origin.camera.info"),when:n=>n.mode===d.AR},{type:m.EntityPicker,property:"leftCamera",label:p("xr.origin.left-camera.label"),info:p("xr.origin.left-camera.info"),when:n=>n.mode===d.VR},{type:m.EntityPicker,property:"rightCamera",label:p("xr.origin.right-camera.label"),info:p("xr.origin.right-camera.info"),when:n=>n.mode===d.VR}]);R("XR Anchor Manager",ye,{class:h,componentsMenu:{label:p("xr.anchor.title"),group:"XR"},type:"XR Anchor Manager",refMap:new Set,external:!1,unique:!0},[{customComponent:ve,property:"anchors",label:p("xr.anchor.list.label"),info:p("xr.anchor.list.info")},{type:m.AssetPicker,assetType:"Prefab",property:"prefab",label:"Prefab",info:p("xr.prefab")}]);R("XR Image Manager",be,{class:h,componentsMenu:{label:p("xr.image.title"),group:"XR"},type:"XR Image Manager",refMap:new Set,external:!1,unique:!0},[{customComponent:ke,property:"trackingImages",label:p("xr.image.list.label"),info:p("xr.image.list.info")},{type:m.AssetPicker,assetType:"Prefab",property:"prefab",label:"Prefab",info:p("xr.prefab")}]);R("XR Plane Manager",xe,{class:h,componentsMenu:{label:p("xr.plane.title"),group:"XR"},type:"XR Plane Manager",refMap:new Set,external:!1,unique:!0},[{type:m.Select,property:"detectionMode",label:p("xr.plane.detection-mode.label"),info:p("xr.plane.detection-mode.info"),options:W(B)},{type:m.AssetPicker,assetType:"Prefab",property:"prefab",label:"Prefab",info:p("xr.prefab")}]);const Fe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{h as I,Fe as i};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import{aH as q,aO as b,b3 as S,aC as n,b8 as w,b9 as De,ex as G,ey as Oe,aP as Ye,ez as it,aT as se,aX as st,eA as at}from"./index-aec7e708.js";import{C as lt,M as ct}from"./Menu-0b8da92f.js";/**
|
|
2
|
+
* @license @tabler/icons-react v3.17.0 - MIT
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/var ut=q("outline","zoom-reset","IconZoomReset",[["path",{d:"M21 21l-6 -6",key:"svg-0"}],["path",{d:"M3.268 12.043a7.017 7.017 0 0 0 6.634 4.957a7.012 7.012 0 0 0 7.043 -6.131a7 7 0 0 0 -5.314 -7.672a7.021 7.021 0 0 0 -8.241 4.403",key:"svg-1"}],["path",{d:"M3 4v4h4",key:"svg-2"}]]);/**
|
|
7
|
+
* @license @tabler/icons-react v3.17.0 - MIT
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/var dt=q("filled","circle-plus-filled","IconCirclePlusFilled",[["path",{d:"M4.929 4.929a10 10 0 1 1 14.141 14.141a10 10 0 0 1 -14.14 -14.14zm8.071 4.071a1 1 0 1 0 -2 0v2h-2a1 1 0 1 0 0 2h2v2a1 1 0 1 0 2 0v-2h2a1 1 0 1 0 0 -2h-2v-2z",key:"svg-0"}]]);/**
|
|
12
|
+
* @license @tabler/icons-react v3.17.0 - MIT
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/var xt=q("filled","circle-x-filled","IconCircleXFilled",[["path",{d:"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-6.489 5.8a1 1 0 0 0 -1.218 1.567l1.292 1.293l-1.292 1.293l-.083 .094a1 1 0 0 0 1.497 1.32l1.293 -1.292l1.293 1.292l.094 .083a1 1 0 0 0 1.32 -1.497l-1.292 -1.293l1.292 -1.293l.083 -.094a1 1 0 0 0 -1.497 -1.32l-1.293 1.292l-1.293 -1.292l-.094 -.083z",key:"svg-0"}]]);/**
|
|
17
|
+
* @license @tabler/icons-react v3.17.0 - MIT
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the MIT license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/var ht=q("filled","player-play-filled","IconPlayerPlayFilled",[["path",{d:"M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z",key:"svg-0"}]]);/**
|
|
22
|
+
* @license @tabler/icons-react v3.17.0 - MIT
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var yt=q("filled","zoom-in-filled","IconZoomInFilled",[["path",{d:"M14 3.072a8 8 0 0 1 2.617 11.424l4.944 4.943a1.5 1.5 0 0 1 -2.008 2.225l-.114 -.103l-4.943 -4.944a8 8 0 0 1 -12.49 -6.332l-.006 -.285l.005 -.285a8 8 0 0 1 11.995 -6.643zm-4 2.928a1 1 0 0 0 -.993 .883l-.007 .117v2h-2l-.117 .007a1 1 0 0 0 0 1.986l.117 .007h2v2l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-2h2l.117 -.007a1 1 0 0 0 0 -1.986l-.117 -.007h-2v-2l-.007 -.117a1 1 0 0 0 -.993 -.883z",key:"svg-0"}]]);/**
|
|
27
|
+
* @license @tabler/icons-react v3.17.0 - MIT
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the MIT license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/var ft=q("filled","zoom-out-filled","IconZoomOutFilled",[["path",{d:"M14 3.072a8 8 0 0 1 2.617 11.424l4.944 4.943a1.5 1.5 0 0 1 -2.008 2.225l-.114 -.103l-4.943 -4.944a8 8 0 0 1 -12.49 -6.332l-.006 -.285l.005 -.285a8 8 0 0 1 11.995 -6.643zm-1 5.928h-6l-.117 .007a1 1 0 0 0 0 1.986l.117 .007h6l.117 -.007a1 1 0 0 0 0 -1.986l-.117 -.007z",key:"svg-0"}]]);function Fe(r,o){return r.map(t=>({point:{x:t.point.x/o,y:t.point.y/o},controlPoint:t.controlPoint?{x:t.controlPoint.x/o,y:t.controlPoint.y/o}:null}))}function Be(r,o=1,t,e){const l=Fe(r,o),a=l[0],x=l[l.length-1];let s=t!==void 0?`M ${t} ${a.point.y} L ${a.point.x} ${a.point.y}`:`M ${a.point.x} ${a.point.y}`;return s+=` C ${a.controlPoint.x} ${a.controlPoint.y}, ${l[1].controlPoint.x} ${l[1].controlPoint.y} ${l[1].point.x} ${l[1].point.y}`,s+=l.slice(2).map(u=>` S ${u.controlPoint.x} ${u.controlPoint.y}, ${u.point.x} ${u.point.y}`).join(""),e!==void 0&&(s+=` L ${e} ${x.point.y}`),s}function Ge(r,o=1,t,e){const l=Fe(r,o),a=l[0],x=l[l.length-1];let s=t!==void 0?`M ${t} ${a.point.y} L ${a.point.x} ${a.point.y}`:`M ${a.point.x} ${a.point.y}`;return s+=l.slice(1).map(u=>` L ${u.point.x} ${u.point.y}`).join(""),e!==void 0&&(s+=` L ${e} ${x.point.y}`),s}function ye(r,o="bezier"){if(r.length<=3&&(o="linear"),o==="linear")return r.map(s=>({point:s,controlPoint:null}));const[t,e,...l]=r,a=[{point:t,controlPoint:e}],x=l.length;for(let s=0;s<x;s+=2){const[u,f]=l.slice(s,s+2);a.push({point:f,controlPoint:u})}return a}function Xe(r,o="bezier"){if(o==="linear")return r.map(e=>e.point);const t=[];for(const e of r)t.length===0?t.push(e.point,e.controlPoint):t.push(e.controlPoint,e.point);return t}function fe(r,o,t,e=1){return r.map(l=>({x:l.x*o*e,y:-l.y*t*e}))}function gt(r,o,t,e=1){return r.map(l=>({x:l.x/o*e,y:-l.y/t*e}))}function pt(r){return{x:0,y:-Math.round(r/2)}}function de(r){if(r===0)return 1;let o=1;for(let t=2;t<=r;t++)o*=t;return o}function mt(r,o){if(r.length<2)throw new Error("At least 2 points are required to calculate the point on a linear curve");o=Math.max(0,Math.min(1,o));const t=r.length-1,e=Math.min(Math.floor(o*t),t-1),l=o*t-e,a=r[e],x=r[e+1];return{x:a.x+(x.x-a.x)*l,y:a.y+(x.y-a.y)*l}}function Pt(r,o){const t=r.length-1;let e=0,l=0;for(let a=0;a<=t;a++){const s=de(t)/(de(a)*de(t-a))*Math.pow(o,a)*Math.pow(1-o,t-a);e+=s*r[a].x,l+=s*r[a].y}return{x:e,y:l}}const ee=10,vt=5,$t=2,Ct=10,St=6,te=b("circle",{fill:"$green9",cursor:"pointer",transition:"r 0.2s ease",variants:{pointType:{main:{fill:"$orange9",'&[data-point-type="ring"]':{fill:"$orange4"}},control:{fill:"$green8",'&[data-point-type="ring"]':{fill:"$green4"}},placeholder:{fill:"$amber9",'&[data-point-type="ring"]':{fill:"$amber4"}}}},'&[data-point-type="hitpoint"]':{stroke:"transparent",fill:"transparent"},'&[data-point-type="ring"]':{fill:"$green4"}}),bt=b("g",{cursor:"grab",touchAction:"none","&:hover":{[`${te}[data-point-type="ring"]`]:{r:Ct},[`${te}[data-point-type="point"]`]:{r:St}}}),It=b("text",{fill:"$gray12",fontSize:"10px",pointerEvents:"none",userSelect:"none"}),Mt=b("rect",{fill:"$gray2",stroke:"$gray7",strokeWidth:1,rx:3,ry:3,pointerEvents:"none"});function xe(r){const{point:o,main:t,type:e="pivot",onPointChange:l,onHoverChange:a,getRoot:x,hoverLabel:s,pointClipPath:u}=r,f=S.useRef(l);f.current=l;const c=S.useRef(x);c.current=x;const g=S.useRef(),[$,A]=S.useState(!1),[E,I]=S.useState(!1);function m(P,p){g.current||(g.current=c.current().createSVGPoint()),g.current.x=P,g.current.y=p;const k=c.current().getScreenCTM();if(!k)return{x:0,y:0};const C=g.current.matrixTransform(k.inverse());return{x:C.x,y:C.y}}function h(P){var p;P.button===0&&(P.preventDefault(),P.stopPropagation(),(p=window.getSelection())==null||p.removeAllRanges(),$||A(!0))}return S.useEffect(()=>{if(!$)return;const P=()=>A(!1),p=k=>{k.preventDefault(),f.current(m(k.clientX,k.clientY))};return window.addEventListener("mouseup",P),window.addEventListener("mousemove",p),()=>{window.removeEventListener("mouseup",P),window.removeEventListener("mousemove",p)}},[$]),n.jsxs(bt,{onMouseDown:h,onMouseEnter:()=>{I(!0),a==null||a(!0)},onMouseLeave:()=>{I(!1),a==null||a(!1)},children:[s&&(E||$)&&n.jsxs(n.Fragment,{children:[n.jsx(Mt,{x:o.x-(s.length*6+8)/2,y:o.y-24,width:s.length*6+8,height:14}),n.jsx(It,{x:o.x,y:o.y-14,textAnchor:"middle",children:s})]}),n.jsxs("g",{style:u?{clipPath:u}:void 0,children:[n.jsx(te,{"data-point-type":"hitpoint",cx:o.x,cy:o.y,r:ee}),n.jsx(te,{"data-point-type":"ring",pointType:t?"main":"control",cx:o.x,cy:o.y,r:vt}),n.jsx(te,{"data-point-type":"point",pointType:t?"main":"control",type:e,cx:o.x,cy:o.y,r:$t})]})]})}const Ie=b("line",{stroke:"$gray5"});function kt(r){const{pointId:o,bezierPoint:t,onPointChange:e,onHoverChange:l,algo:a,doublePoint:x=!1,pointHoverLabel:s,pointClipPath:u,getRoot:f}=r,{point:c,controlPoint:g}=t,$=u?{clipPath:u}:void 0,A=a==="bezier"?{x:2*c.x-g.x,y:2*c.y-g.y}:null,E=h=>{const P=h.x-c.x,p=h.y-c.y;e(o,{point:h,controlPoint:a==="bezier"?{x:g.x+P,y:g.y+p}:null})},I=h=>{e(o,{point:c,controlPoint:h})},m=h=>{e(o,{point:c,controlPoint:{x:2*c.x-h.x,y:2*c.y-h.y}})};return n.jsxs(n.Fragment,{children:[a==="bezier"&&n.jsxs(n.Fragment,{children:[n.jsx(Ie,{strokeWidth:1,x1:c.x,y1:c.y,x2:g.x,y2:g.y,style:$}),x&&n.jsx(Ie,{strokeWidth:1,x1:c.x,y1:c.y,x2:A.x,y2:A.y,style:$})]}),n.jsx(xe,{type:"pivot",main:!0,point:c,getRoot:f,onPointChange:E,onHoverChange:h=>l==null?void 0:l(o,h),hoverLabel:s,pointClipPath:u}),a==="bezier"&&n.jsxs(n.Fragment,{children:[n.jsx(xe,{type:"control",point:g,getRoot:f,onPointChange:I,pointClipPath:u}),x&&n.jsx(xe,{type:"control",point:A,getRoot:f,onPointChange:m,pointClipPath:u})]})]})}const Me=b("path",{strokeWidth:1,stroke:"$orange10",fill:"none",variants:{hitline:{true:{strokeWidth:5,stroke:"transparent"}}}}),jt=b("path",{strokeWidth:1,stroke:"$orange6",fill:"none"}),Tt=b("circle",{fill:"$orange11",r:3,transition:"transform .1s ease",strokeWidth:1,stroke:"$orange12"});function wt(r){const{points:o,getRoot:t,zoom:e=1,algo:l="bezier",extendMinX:a,extendMaxX:x}=r,s=o.length===2?l:"linear",u=s==="linear"?Ge:Be,f=u(o),c=u(o,1,a,x),g=o[0].point,$=o[o.length-1].point,A=a!==void 0?`M ${a} ${g.y} L ${g.x} ${g.y} M ${$.x} ${$.y} L ${x} ${$.y}`:void 0,[E,I]=S.useState(!1),m=w.useRef(),[h,P]=S.useState(null);S.useEffect(()=>{P(null)},[e]);function p(j){m.current||(m.current=t().createSVGPoint()),m.current.x=j.clientX,m.current.y=j.clientY;const O=t().getScreenCTM();return O?m.current.matrixTransform(O.inverse()):{x:0,y:0}}const k=j=>{I(!0),P(p(j))},C=j=>{P(p(j))},L=()=>{if(!h)return;const j={point:{x:h.x,y:h.y},controlPoint:{x:h.x+20,y:h.y+20}};l==="linear"&&(j.controlPoint=null);let O=0;for(let Y=1;Y<o.length;Y++){const W=Math.sqrt(Math.pow(o[Y].point.x-j.point.x,2)+Math.pow(o[Y].point.y-j.point.y,2)),M=Math.sqrt(Math.pow(o[O].point.x-j.point.x,2)+Math.pow(o[O].point.y-j.point.y,2));W<M&&(O=Y)}r.onAddPoint&&r.onAddPoint(j,O)},N=j=>{j.stopPropagation(),I(!1),P(null)};return n.jsxs("g",{className:"bezier-path",onMouseLeave:N,children:[A&&n.jsx(jt,{d:A}),n.jsx(Me,{d:f}),n.jsx(Me,{hitline:!0,d:c,onMouseEnter:k,onMouseMove:C}),s==="linear"&&E&&h&&n.jsx(Tt,{cx:h.x,cy:h.y,onClick:L})]})}const U=1e-8,At=1,Rt=2;function ge(r,o=At,t=Rt){if(!Number.isFinite(r)||r<=0)return o;for(let e=0;e<=t;e++){const l=r*Math.pow(10,e);if(Math.abs(l-Math.round(l))<U)return Math.max(o,e)}return t}function Z(r,o){return(Math.abs(r)<U?0:r).toFixed(o)}function zt(r,o){return Z(r,o).replace(/\.?0+$/,"")}function ke(r,o){return r.reduce((t,e)=>{const l=zt(e,o),a=l.indexOf("."),x=a===-1?0:l.length-a-1;return Math.max(t,x)},0)}const He=8,je=He,_t=16,Et=22,Te=56,we=8,Lt=He,Nt=16,Dt=12,Ae=b("text",{fontSize:"10px",fill:"$gray10",userSelect:"none",pointerEvents:"none",variants:{direction:{vertical:{textOrientation:"mixed",textAnchor:"end"},horizontal:{textAnchor:"middle"}}},defaultVariants:{direction:"horizontal"}}),Ot=b("text",{fontSize:"11px",textAnchor:"middle",fill:"$grayA11",userSelect:"none",pointerEvents:"none"}),Re=b("rect",{fill:"$grayA3"}),ze=b("line",{stroke:"$grayA6"});function Yt(r){const{size:{width:o,height:t},offset:e,zoom:l,yTickScale:a=1,axisYScale:x=.4,tick:s={x:10,y:10},axisLabel:u}=r,f=Math.ceil(s.x*l)+1,c=o/(s.x*l),g=Math.ceil(s.y*l)+1,$=t/(s.y*l),A=w.useId().replace(/:/g,""),E=`${A}-grid`,I=`${A}-x-ticks`,m=`${A}-y-ticks`,h=10,P=ge(1/s.x),p=ge(Math.abs(a/(s.y*x))),k=R=>-R/(t*x)*l,C=R=>k(R)*a;function L(){return Math.abs(e.x)<U?null:n.jsx(ze,{className:"y-axis",x1:0,y1:e.y,x2:0,y2:e.y+t,strokeWidth:"1"})}function N(){return n.jsx("g",{className:"grid-x-lines",children:[...Array(g).keys()].map(R=>n.jsx(Re,{x:e.x,y:R*$+e.y-e.y%$,width:o,height:1},R))})}function j(R=-16,T=0){const X=[...Array(g).keys()].map(D=>{const z=D*$+e.y-e.y%$;return{index:D,worldY:z,value:C(z)}}),B=ke(X.map(D=>D.value),p);return n.jsx("g",{className:"grid-y-ticks",style:{clipPath:`url(#${m})`},children:X.map(D=>n.jsx(Ae,{className:"y-axis-tick",x:R,direction:"vertical",y:D.worldY+T,children:Z(D.value,B)},`y-${D.index}`))})}function O(){return n.jsx(Ot,{className:"x-axis-label",x:e.x+o/2,y:e.y+t-h,children:u??"x"})}function Y(){return n.jsx("g",{className:"grid-y-lines",children:[...Array(f).keys()].map(R=>{const T=R*c+e.x-e.x%c;return Math.abs(T-e.x)<U?null:n.jsx(Re,{x:T,y:e.y,width:1,height:t},R)})})}function W(R=-10,T=100){const X=e.x>0?Math.floor(e.x/c):Math.ceil(e.x/c),B=[...Array(f).keys()].map(z=>({index:z,value:(z+X)/s.x,x:z*c+e.x-e.x%c+R})),D=ke(B.map(z=>z.value),P);return n.jsx("g",{className:"grid-x-ticks",style:{clipPath:`url(#${I})`},children:B.map(z=>n.jsx(Ae,{className:"x-axis-tick",y:T,x:z.x,children:Z(z.value,D)},`x-${z.index}`))})}function M(){return n.jsx(ze,{className:"x-axis",x1:e.x,y1:0,x2:e.x+o,y2:0,strokeWidth:"1"})}return n.jsxs(n.Fragment,{children:[n.jsxs("defs",{children:[n.jsx("clipPath",{id:E,children:n.jsx("rect",{x:e.x,y:e.y,width:o,height:t})}),n.jsx("clipPath",{id:I,children:n.jsx("rect",{x:e.x-je,y:e.y+t,width:o+je+_t,height:Et})}),n.jsx("clipPath",{id:m,children:n.jsx("rect",{x:e.x-Te,y:e.y-we,width:Te,height:t+we+Lt})})]}),n.jsxs("g",{className:"bezier-curve-grid",height:t,width:o,style:{clipPath:`url(#${E})`,overflow:"hidden"},children:[N(),Y(),M(),L(),O(),r.children]}),r.overlay,j(e.x-Dt,4),W(0,t+e.y+Nt)]})}const Ft=b("circle",{fill:"transparent",transition:"fill 0.3s ease",pointerEvents:"none",variants:{display:{false:{fill:"transparent"},true:{fill:"$orange10",display:"block"}}}}),Bt=S.forwardRef(function(o,t){const{points:e,algo:l}=o,a=w.useRef(0),x=w.useRef(null),s=w.useRef(0),[u,f]=w.useState(!1),c=S.useMemo(()=>Xe(e,l),[e,l]);S.useImperativeHandle(t,()=>({play:g,getIsPlaying:()=>u,stop:$}),[u,c]);function g(A=800){var m,h;f(!0),(m=x.current)==null||m.setAttribute("cx",c[0].x.toString()),(h=x.current)==null||h.setAttribute("cy",c[0].y.toString());const E=Date.now(),I=()=>{var C,L;const p=(Date.now()-E)/A;a.current=p;const k=l==="bezier"?Pt(c,p):mt(c,p);(C=x.current)==null||C.setAttribute("cx",k.x.toString()),(L=x.current)==null||L.setAttribute("cy",k.y.toString()),p<1&&(s.current=requestAnimationFrame(I)),p>=1&&$()};s.current=requestAnimationFrame(I)}function $(){f(!1),cancelAnimationFrame(s.current)}return n.jsx(Ft,{ref:x,r:"6",cx:c[0].x,cy:c[0].y,display:u})}),_e=1e-4,Gt=10,Xt=-10,Ht=-3.5;function Ee(r,o,t){return r<=o+_e?o:r>=t-_e?t:r}function Le(r,o,t){return r.map(e=>({x:G(e.x,0,1),y:G(e.y,o,t)}))}const Kt=b("svg",{overflow:"unset",fontSize:0,userSelect:"none",backgroundImage:"linear-gradient(180deg, rgba(0,0,0,0) 0%, $orangeA2 100%)"}),Wt=b("rect",{fill:"none",stroke:"$orange7",strokeWidth:1,shapeRendering:"crispEdges",pointerEvents:"none"}),Vt=b("div",{position:"relative",marginLeft:"$7",outline:"none"}),Zt=b("div",{position:"absolute",left:`${Xt}px`,top:`${Ht}px`,transform:"translateX(-100%)",width:"1.2ch",height:"10px",fontSize:"10px",fontVariantNumeric:"tabular-nums",zIndex:3,pointerEvents:"auto",display:"flex",alignItems:"center",borderRadius:"$1",backgroundColor:"$gray3",boxShadow:"inset 0 0 0 1px $colors$grayA6"}),Ut=b("input",{all:"unset",boxSizing:"border-box",display:"block",width:"100%",height:"100%",backgroundColor:"$gray3",color:"$gray12",fontSize:"10px",lineHeight:"10px",textAlign:"right",fontVariantNumeric:"tabular-nums",userSelect:"text"}),qt=[{x:0,y:0},{x:.25,y:.25},{x:.75,y:.75},{x:1,y:1}];function Jt(r,o){const{width:t=300,height:e=300,points:l,defaultPoints:a,doubleControlPoint:x=!0,algo:s="linear",zoomable:u=!0,zoomLimit:f=[.2,1],zoomSpeed:c=.03,yRangeMode:g="symmetric",yTickScale:$=1,yTickScaleMin:A=.01,yTickScaleMax:E}=r,I=w.useRef(null),m=w.useRef(null),h=g==="positive"?1:.5,P=g==="positive"?0:-1,p=1,k=Math.min(f[0],f[1]),C=Math.max(f[0],f[1]),L=G(1,k,C),N=g==="positive"?{x:0,y:-e}:pt(e),j=w.useRef(null),O=w.useRef(0),Y=w.useRef([]),W=w.useId().replace(/:/g,""),[M,R]=S.useState(L),[T,X]=S.useState(N),B=1/M,D=t*B,z=e*h*B,Ve=Math.min(-P*z,-p*z),Ze=Math.max(-P*z,-p*z),Ue=E??Number.MAX_VALUE,V=Z($,ge(Math.abs($/(Gt*h)),0)),[ne,J]=S.useState(V),ae=w.useRef(!1),Q=w.useRef(null),oe=w.useRef(null),pe=w.useRef(!1),qe=i=>{const d=i.x/t*M,y=-i.y/(e*h)*M;return`${Z(d,3)}, ${Z(y,3)}`},me=i=>({point:{x:Ee(i.point.x,0,D),y:Ee(i.point.y,Ve,Ze)},controlPoint:i.controlPoint}),Pe=()=>`bezier-point-${O.current++}`,re=i=>{const d=Y.current;for(;d.length<i;)d.push(Pe());return d.length>i&&(d.length=i),d},[H,le]=De({prop:l?ye(fe(Le(l,P,p),t,e*h,B),s):void 0,defaultProp:ye(fe(Le(a||qt,P,p),t,e*h,B),s),onChange:i=>{var y;const d=gt(Xe(i,s),t,e*h,M);(y=r.onPointsChange)==null||y.call(r,d)}}),ve=(i,d)=>{const y=i.map((v,_)=>_).sort((v,_)=>{const F=i[v].point.x-i[_].point.x;return Math.abs(F)<=U?v-_:F});return Y.current=y.map(v=>d[v]),y.map(v=>i[v])},Je=(i,d)=>{le(y=>{if(!y)return y;const v=re(y.length),_=v.indexOf(i);if(_===-1)return y;const F=me(d),K=y.map((ue,rt)=>rt===_?F:ue);return ve(K,v)})},$e=w.useCallback((i,d)=>{const y=1/d,v=Math.max(0,t*y-t),_=-P*e*h*y,F=-p*e*h*y,K=Math.min(_,F),ue=Math.max(_,F);return{x:G(i.x,0,v),y:G(i.y,K,ue-e)}},[h,e,p,P,t]),ie=w.useCallback((i,d)=>{const y=G(i,k,C);if(Math.abs(y-M)<U)return;const v=M/y,_=T.x+d.x*t,F=T.y+d.y*e,K={x:_*v-d.x*t,y:F*v-d.y*e};R(y),X($e(K,y))},[$e,e,C,k,T.x,T.y,t,M]),ce=w.useCallback(i=>{if(i.preventDefault(),i.stopPropagation(),!m.current)return;const d=m.current.getBoundingClientRect();if(!d.width||!d.height)return;const y={x:G((i.clientX-d.left)/d.width,0,1),y:G((i.clientY-d.top)/d.height,0,1)},v=i.deltaY>0?M+c:M-c;ie(v,y)},[ie,M,c]),Qe=(i,d)=>{le(y=>{const v=[...y];v.splice(d,0,me(i));const _=[...re(y.length)];return _.splice(d,0,Pe()),ve(v,_)})},et=()=>{!pe.current&&!(document.activeElement instanceof HTMLInputElement)&&I.current.focus()},Ce=i=>{le(d=>{if(d.length<=1)return d;const y=re(d.length),v=y.indexOf(i);if(v===-1)return d;const _=d.filter((F,K)=>K!==v);return y.splice(v,1),_}),Q.current=null},tt=(i,d)=>{Q.current=d?i:null,d&&et()},nt=i=>{oe.current=Q.current,oe.current||(i.preventDefault(),i.stopPropagation())},ot=i=>{i.target instanceof HTMLInputElement||(i.key==="Delete"||i.key==="Backspace")&&Q.current&&H.length>1&&(i.preventDefault(),Ce(Q.current))},Se=i=>{if(!r.onYTickScaleChange||Number.isNaN(i))return;const d=G(i,A,Ue);r.onYTickScaleChange(d)};S.useEffect(()=>{if(!m.current||!u)return;const i=m.current;return i.addEventListener("wheel",ce,{passive:!1}),()=>{i.removeEventListener("wheel",ce)}},[ce,u]),S.useEffect(()=>{R(L),X(N)},[N.x,N.y,L]),S.useEffect(()=>{ae.current||J(V)},[V,$]);const be=H?re(H.length):[];return n.jsx(lt,{onOpenChange:i=>{pe.current=i,i||I.current.focus()},trigger:n.jsxs(Vt,{ref:I,tabIndex:0,onKeyDown:ot,children:[n.jsxs(Kt,{xmlns:"http://www.w3.org/2000/svg",viewBox:`${T.x} ${T.y} ${t} ${e}`,width:t,height:e,ref:Oe([o,m]),onMouseDown:i=>i.preventDefault(),onContextMenu:nt,children:[n.jsx("defs",{children:n.jsx("clipPath",{id:W,clipPathUnits:"userSpaceOnUse",children:n.jsx("rect",{x:T.x-ee,y:T.y-ee,width:t+ee*2,height:e+ee*2})})}),n.jsxs(Yt,{size:{width:t,height:e},offset:T,axisLabel:r.axisLabel,zoom:M,yTickScale:$,axisYScale:h,overlay:n.jsxs(n.Fragment,{children:[n.jsx(Wt,{x:T.x,y:T.y,width:t,height:e}),n.jsx("g",{className:"bezier-curve-points",children:H.map((i,d)=>n.jsx(kt,{pointId:be[d],bezierPoint:i,pointHoverLabel:qe(i.point),pointClipPath:`url(#${W})`,onPointChange:Je,onHoverChange:tt,getRoot:()=>m.current,doublePoint:x,algo:s},be[d]))})]}),children:[n.jsx(wt,{algo:s,points:H,zoom:M,getRoot:()=>m.current,onAddPoint:Qe,extendMinX:T.x,extendMaxX:T.x+t}),n.jsx(Bt,{points:H,algo:s,ref:j})]})]}),r.onYTickScaleChange&&n.jsx(Zt,{style:{width:`${ne.length-(ne.match(/[.\-]/g)||[]).length*.5+.2}ch`},children:n.jsx(Ut,{type:"text",inputMode:"decimal",value:ne,onFocus:()=>{ae.current=!0},onBlur:i=>{var y;if(ae.current=!1,i.currentTarget.dataset.escaping){delete i.currentTarget.dataset.escaping,J(V);return}const d=Number(ne.trim()||0);Number.isNaN(d)||Se(d),J(V),(y=r.onYTickScaleCommit)==null||y.call(r)},onKeyDown:i=>{i.key==="Enter"?i.currentTarget.blur():i.key==="Escape"&&(i.currentTarget.dataset.escaping="1",i.currentTarget.blur())},onChange:i=>{const d=i.target.value;J(d);const y=d.trim(),v=Number(y);y!==""&&!Number.isNaN(v)&&Se(v)}})}),n.jsx(Ye,{gap:"xs",style:{position:"absolute",bottom:10,right:10},children:n.jsxs(it,{children:[n.jsx(se,{onClick:()=>{var i;return(i=j.current)==null?void 0:i.play()},size:"xs",children:n.jsx(ht,{})}),n.jsx(se,{size:"xs",onClick:()=>ie(M-.05,{x:.5,y:.5}),disabled:M<=k,children:n.jsx(yt,{})}),n.jsx(se,{size:"xs",onClick:()=>ie(M+.05,{x:.5,y:.5}),disabled:M>=C,children:n.jsx(ft,{})}),n.jsx(se,{size:"xs",onClick:()=>{R(L),X(N)},disabled:M===L,children:n.jsx(ut,{})})]})})]}),asChild:!0,children:n.jsx(ct,{name:"Delete Keyframe",disabled:H.length<=1,onSelect:()=>oe.current&&Ce(oe.current)})})}const Qt=w.forwardRef(Jt),Ke=b("path",{fill:"none",stroke:"$grayA8",strokeWidth:"1.5px",transition:"stroke .2s ease-in-out, stroke-width .2s ease-in-out"}),en=b("svg",{width:"100%",height:"100%",overflow:"hidden","&:hover":{[`& ${Ke}`]:{stroke:"$orange10",strokeWidth:"2px"}}}),tn=[[{x:0,y:0},{x:.2,y:.8},{x:.8,y:.2},{x:1,y:1}],[{x:0,y:0},{x:.25,y:.75},{x:.75,y:.75},{x:1,y:0}],[{x:0,y:0},{x:.7,y:0},{x:1,y:.5},{x:1,y:1}],[{x:0,y:0},{x:.42,y:0},{x:.58,y:1},{x:1,y:1}]],nn=b("div",{width:"100%",display:"grid",padding:"$1 0",gridTemplateColumns:"repeat(5, 1fr)",alignItems:"center",gap:"$2"}),on=b("button",{all:"unset",position:"absolute",right:0,top:0,borderRadius:"$round",color:"$gray9",transform:"translate(50%, -50%)","&:hover":{color:"$red10"}}),We=b("div",{position:"relative",display:"flex",justifyContent:"center",alignItems:"center",height:"$8",borderRadius:"$2",color:"$grayA9",cursor:"pointer",backgroundColor:"$appBackground",border:"1px solid $grayA3",transition:"color .2s ease-in-out","&:hover":{color:"$orange10"}});function Ne(r){const{points:o,width:t=74,height:e=34,deletable:l=!1,onDelete:a,...x}=r,s=u=>{if(u.length<4)return"";let f=`M${u[0].x*t} ${-u[0].y*e}`;for(let c=1;c<u.length;c+=3)f+=` C${u[c].x*t} ${-u[c].y*e}, ${u[c+1].x*t} ${-u[c+1].y*e}, ${u[c+2].x*t} ${-u[c+2].y*e}`;return f};return n.jsxs(We,{...x,children:[n.jsx(en,{width:t,height:e,viewBox:`0 -${e} ${t} ${e}`,children:n.jsx(Ke,{d:s(o)})}),l&&n.jsx(on,{children:n.jsx(xt,{size:"14px",onClick:a})})]})}function rn(r){const{presets:o=[],onApplyPreset:t,onAddPreset:e,onDeletePreset:l}=r,[a,x]=S.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsxs(Ye,{align:"v",justifyContent:"between",css:{fontSize:"$1",marginTop:"$7",color:"$gray11",userSelect:"none"},children:["Presets",o.length>0&&n.jsx(st,{variant:"subtle",onClick:()=>x(!a),children:a?"Done":"Edit"})]}),n.jsxs(nn,{children:[tn.map((s,u)=>n.jsx(Ne,{points:s,onClick:()=>t&&t(s)},u)),o.map((s,u)=>n.jsx(Ne,{deletable:a,points:s,onDelete:()=>l(u),onClick:()=>t&&t(s)},u)),n.jsx(We,{onClick:e,children:n.jsx(dt,{size:"16px"})})]})]})}const sn=b("div",{display:"flex",height:"$6",width:"100%",background:"$grayA3",borderRadius:"$2",overflow:"hidden",fontSize:"$1",cursor:"pointer","& > svg":{stroke:"$orange9",fill:"none"}}),an=[{x:0,y:0},{x:.25,y:.25},{x:.75,y:.75},{x:1,y:1}],ln=S.forwardRef(function(o,t){const{points:e,algo:l,...a}=o,x=S.useRef(null),[s,u]=S.useState({width:0,height:0});S.useLayoutEffect(()=>{x.current&&u(x.current.getBoundingClientRect())},[]);let f="";if(s.width!==0&&e.length){const c=ye(fe(e,s.width,s.height),l);f=(l==="bezier"?Be:Ge)(c,1,0,s.width)}return n.jsx(sn,{ref:Oe([x,t]),...a,children:!!s.width&&n.jsx("svg",{width:s.width,height:s.height,viewBox:`0 -${s.height} ${s.width} ${s.height}`,children:n.jsx("path",{d:f})})})}),cn=b("div",{borderRadius:"$3",backgroundColor:"$gray1",padding:"$2"}),he="_bezier_curve_presets",xn=function(o){const{onChange:t,value:e,defaultValue:l,algo:a="bezier",axisLabel:x,yTickScale:s=1,yRangeMode:u="symmetric",onYTickScaleChange:f,onYTickScaleCommit:c,yTickScaleMin:g=.01,yTickScaleMax:$}=o,A=x??"time",[E,I]=S.useState([]),[m,h]=De({prop:e,defaultProp:l||an,onChange:t});S.useEffect(()=>{const C=localStorage.getItem(he);C&&I(JSON.parse(C))},[]);function P(C){h(C)}function p(){const C=[...E,m];I(C),localStorage.setItem(he,JSON.stringify(C))}function k(C){I(L=>{const N=[...L];return N.splice(C,1),localStorage.setItem(he,JSON.stringify(N)),N})}return n.jsx(at,{trigger:n.jsx(ln,{points:m,algo:a}),sideOffset:2,compact:!0,onOpenAutoFocus:C=>C.preventDefault(),children:n.jsxs(cn,{children:[n.jsx(Qt,{algo:a,width:400,height:220,points:m,yTickScale:s,yRangeMode:u,onYTickScaleChange:f,onYTickScaleCommit:c,yTickScaleMin:g,yTickScaleMax:$,axisLabel:A,onPointsChange:h}),n.jsx(rn,{presets:E,onApplyPreset:P,onAddPreset:p,onDeletePreset:k})]})})};export{xn as B};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var se=Object.defineProperty;var re=(t,e,n)=>e in t?se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var k=(t,e,n)=>(re(t,typeof e!="symbol"?e+"":e,n),n);import{dm as ie,dn as oe,dp as ae,dq as M,dr as le}from"./index-aec7e708.js";import{T as fe}from"./TaskQueue-05c94a4d.js";class ce{constructor(e=4,n){k(this,"_taskQueue",[]);k(this,"_workerStatus",0);k(this,"_workerItems");this.limitedCount=e,this._workerCreator=n,this._workerItems=new Array(e)}prepareWorker(){const e=this.limitedCount,n=new Array(e);for(let r=0;r<e;r++)n.push(this._initWorker(r));return Promise.all(n)}postMessage(e){return new Promise((n,r)=>{const s=this._getIdleWorkerId();if(this._workerStatus|=1<<s,s!==-1){const u=this._workerItems;Promise.resolve(u[s]??this._initWorker(s)).then(()=>{const a=u[s];a.resolve=n,a.reject=r,a.worker.postMessage(e)}).catch(a=>{this._workerStatus^=1<<s,r(a)})}else this._taskQueue.push({resolve:n,reject:r,message:e})})}destroy(){const e=this._workerItems;for(let n=0,r=e.length;n<r;n++){const s=e[n];s.worker.terminate(),s.reject=null,s.resolve=null}e.length=0,this._taskQueue.length=0,this._workerStatus=0}_initWorker(e){return Promise.resolve(this._workerCreator()).then(n=>{const r=s=>{const u=this._workerItems[e];u!=null&&u.reject&&(u.reject(s.error||new Error("Worker error")),this._nextTask(e))};return n.addEventListener("message",this._onMessage.bind(this,e)),n.addEventListener("error",r),n.onerror=r,this._workerItems[e]={worker:n,resolve:null,reject:null},n})}_getIdleWorkerId(){for(let e=0,n=this.limitedCount;e<n;e++)if(!(this._workerStatus&1<<e))return e;return-1}_onMessage(e,n){n.data.error?this._workerItems[e].reject(n.data.error):this._workerItems[e].resolve(n),this._nextTask(e)}_nextTask(e){if(this._taskQueue.length){const n=this._taskQueue.shift(),r=this._workerItems[e];r.resolve=n.resolve,r.reject=n.reject,r.worker.postMessage(n.message)}else this._workerStatus^=1<<e}}const G=0,Q=0,ue=0,he=2,_e=0,de=0,ge=2,ye=1,q=64,Ue=0;class pe{constructor(){this.vkFormat=Ue,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=G,this.levels=[],this.dataFormatDescriptor=[{vendorId:ue,descriptorType:Q,descriptorBlockSize:0,versionNumber:he,colorModel:_e,colorPrimaries:ye,transferFunction:ge,flags:de,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class L{constructor(e,n,r,s){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+n,r),this._littleEndian=s,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian),n=this._dataView.getUint32(this._offset+4,this._littleEndian),r=e+2**32*n;return this._offset+=8,r}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const n=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,n}_skip(e){return this._offset+=e,this}_scan(e,n=0){const r=this._offset;let s=0;for(;this._dataView.getUint8(this._offset)!==n&&s<e;)s++,this._offset++;return s<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,s)}}const xe="KTX-Parse v0.7.1",H=new Uint8Array([0]),_=[171,75,84,88,32,50,48,187,13,10,26,10],K=68;function W(t){return new TextEncoder().encode(t)}function N(t){return new TextDecoder().decode(t)}function A(t){let e=0;for(const s of t)e+=s.byteLength;const n=new Uint8Array(e);let r=0;for(const s of t)n.set(new Uint8Array(s),r),r+=s.byteLength;return n}function me(t,e){const n=Math.max(t,e),r=Math.min(t,e);let s=n;for(;s%r!==0;)s+=n;return s}function j(t,e=4){return Math.ceil(t/e)*e-t}function we(t){return t.levels[0].levelData.byteLength/De(t,0)}function De(t,e){let n=1;const r=[t.pixelWidth,t.pixelHeight,t.pixelDepth],s=ke(t);for(let u=0;u<3;u++)if(r[u]>0){const a=Math.ceil(Math.floor(r[u]*Math.pow(2,-e))/s[u]);n*=Math.max(1,a)}return t.layerCount>0&&(n*=t.layerCount),t.faceCount>0&&(n*=t.faceCount),n}function ke(t){const[e,n,r]=t.dataFormatDescriptor[0].texelBlockDimension;return[e+1,n+1,r+1]}function be(t){const e=new Uint8Array(t.buffer,t.byteOffset,_.length);if(e[0]!==_[0]||e[1]!==_[1]||e[2]!==_[2]||e[3]!==_[3]||e[4]!==_[4]||e[5]!==_[5]||e[6]!==_[6]||e[7]!==_[7]||e[8]!==_[8]||e[9]!==_[9]||e[10]!==_[10]||e[11]!==_[11])throw new Error("Missing KTX 2.0 identifier.");const n=new pe,r=17*Uint32Array.BYTES_PER_ELEMENT,s=new L(t,_.length,r,!0);n.vkFormat=s._nextUint32(),n.typeSize=s._nextUint32(),n.pixelWidth=s._nextUint32(),n.pixelHeight=s._nextUint32(),n.pixelDepth=s._nextUint32(),n.layerCount=s._nextUint32(),n.faceCount=s._nextUint32();const u=s._nextUint32();n.supercompressionScheme=s._nextUint32();const a=s._nextUint32(),y=s._nextUint32(),c=s._nextUint32(),S=s._nextUint32(),b=s._nextUint64(),x=s._nextUint64(),U=u*3*8,m=new L(t,_.length+r,U,!0);for(let d=0;d<u;d++)n.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+m._nextUint64(),m._nextUint64()),uncompressedByteLength:m._nextUint64()});const l=new L(t,a,y,!0),D={vendorId:l._skip(4)._nextUint16(),descriptorType:l._nextUint16(),versionNumber:l._nextUint16(),descriptorBlockSize:l._nextUint16(),colorModel:l._nextUint8(),colorPrimaries:l._nextUint8(),transferFunction:l._nextUint8(),flags:l._nextUint8(),texelBlockDimension:[l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8()],bytesPlane:[l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8()],samples:[]},B=6,w=4,T=(D.descriptorBlockSize/4-B)/w;for(let d=0;d<T;d++){const p={bitOffset:l._nextUint16(),bitLength:l._nextUint8(),channelType:l._nextUint8(),samplePosition:[l._nextUint8(),l._nextUint8(),l._nextUint8(),l._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};p.channelType&q?(p.sampleLower=l._nextInt32(),p.sampleUpper=l._nextInt32()):(p.sampleLower=l._nextUint32(),p.sampleUpper=l._nextUint32()),D.samples[d]=p}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(D);const h=new L(t,c,S,!0);for(;h._offset<S;){const d=h._nextUint32(),p=h._scan(d),I=N(p);if(n.keyValue[I]=h._nextUint8Array(d-p.byteLength-1),I.match(/^ktx/i)){const C=N(n.keyValue[I]);n.keyValue[I]=C.substring(0,C.lastIndexOf("\0"))}const ne=d%4?4-d%4:0;h._skip(ne)}if(x<=0)return n;const i=new L(t,b,x,!0),o=i._nextUint16(),f=i._nextUint16(),g=i._nextUint32(),v=i._nextUint32(),O=i._nextUint32(),Y=i._nextUint32(),P=[];for(let d=0;d<u;d++)P.push({imageFlags:i._nextUint32(),rgbSliceByteOffset:i._nextUint32(),rgbSliceByteLength:i._nextUint32(),alphaSliceByteOffset:i._nextUint32(),alphaSliceByteLength:i._nextUint32()});const R=b+i._offset,V=R+g,F=V+v,$=F+O,J=new Uint8Array(t.buffer,t.byteOffset+R,g),Z=new Uint8Array(t.buffer,t.byteOffset+V,v),ee=new Uint8Array(t.buffer,t.byteOffset+F,O),te=new Uint8Array(t.buffer,t.byteOffset+$,Y);return n.globalData={endpointCount:o,selectorCount:f,imageDescs:P,endpointsData:J,selectorsData:Z,tablesData:ee,extendedData:te},n}function E(){return E=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},E.apply(this,arguments)}const Be={keepWriter:!1};function ve(t,e={}){e=E({},Be,e);let n=new ArrayBuffer(0);if(t.globalData){const i=new ArrayBuffer(20+t.globalData.imageDescs.length*5*4),o=new DataView(i);o.setUint16(0,t.globalData.endpointCount,!0),o.setUint16(2,t.globalData.selectorCount,!0),o.setUint32(4,t.globalData.endpointsData.byteLength,!0),o.setUint32(8,t.globalData.selectorsData.byteLength,!0),o.setUint32(12,t.globalData.tablesData.byteLength,!0),o.setUint32(16,t.globalData.extendedData.byteLength,!0);for(let f=0;f<t.globalData.imageDescs.length;f++){const g=t.globalData.imageDescs[f];o.setUint32(20+f*5*4+0,g.imageFlags,!0),o.setUint32(20+f*5*4+4,g.rgbSliceByteOffset,!0),o.setUint32(20+f*5*4+8,g.rgbSliceByteLength,!0),o.setUint32(20+f*5*4+12,g.alphaSliceByteOffset,!0),o.setUint32(20+f*5*4+16,g.alphaSliceByteLength,!0)}n=A([i,t.globalData.endpointsData,t.globalData.selectorsData,t.globalData.tablesData,t.globalData.extendedData])}const r=[];let s=t.keyValue;e.keepWriter||(s=E({},t.keyValue,{KTXwriter:xe}));for(const i in s){const o=s[i],f=W(i),g=typeof o=="string"?A([W(o),H]):o,v=f.byteLength+1+g.byteLength,O=j(v,4);r.push(A([new Uint32Array([v]),f,H,g,new Uint8Array(O).fill(0)]))}const u=A(r);if(t.dataFormatDescriptor.length!==1||t.dataFormatDescriptor[0].descriptorType!==Q)throw new Error("Only BASICFORMAT Data Format Descriptor output supported.");const a=t.dataFormatDescriptor[0],y=new ArrayBuffer(28+a.samples.length*16),c=new DataView(y),S=24+a.samples.length*16;if(c.setUint32(0,y.byteLength,!0),c.setUint16(4,a.vendorId,!0),c.setUint16(6,a.descriptorType,!0),c.setUint16(8,a.versionNumber,!0),c.setUint16(10,S,!0),c.setUint8(12,a.colorModel),c.setUint8(13,a.colorPrimaries),c.setUint8(14,a.transferFunction),c.setUint8(15,a.flags),!Array.isArray(a.texelBlockDimension))throw new Error("texelBlockDimension is now an array. For dimensionality `d`, set `d - 1`.");c.setUint8(16,a.texelBlockDimension[0]),c.setUint8(17,a.texelBlockDimension[1]),c.setUint8(18,a.texelBlockDimension[2]),c.setUint8(19,a.texelBlockDimension[3]);for(let i=0;i<8;i++)c.setUint8(20+i,a.bytesPlane[i]);for(let i=0;i<a.samples.length;i++){const o=a.samples[i],f=28+i*16;if(o.channelID)throw new Error("channelID has been renamed to channelType.");c.setUint16(f+0,o.bitOffset,!0),c.setUint8(f+2,o.bitLength),c.setUint8(f+3,o.channelType),c.setUint8(f+4,o.samplePosition[0]),c.setUint8(f+5,o.samplePosition[1]),c.setUint8(f+6,o.samplePosition[2]),c.setUint8(f+7,o.samplePosition[3]),o.channelType&q?(c.setInt32(f+8,o.sampleLower,!0),c.setInt32(f+12,o.sampleUpper,!0)):(c.setUint32(f+8,o.sampleLower,!0),c.setUint32(f+12,o.sampleUpper,!0))}const b=_.length+K+t.levels.length*3*8,x=b+y.byteLength;let U=n.byteLength>0?x+u.byteLength:0;U%8&&(U+=8-U%8);const m=[],l=new DataView(new ArrayBuffer(t.levels.length*3*8)),D=new Uint32Array(t.levels.length);let B=0;t.supercompressionScheme===G&&(B=me(we(t),4));let w=(U||x+u.byteLength)+n.byteLength;for(let i=t.levels.length-1;i>=0;i--){if(w%B){const f=j(w,B);m.push(new Uint8Array(f)),w+=f}const o=t.levels[i];m.push(o.levelData),D[i]=w,w+=o.levelData.byteLength}for(let i=0;i<t.levels.length;i++){const o=t.levels[i];l.setBigUint64(i*24+0,BigInt(D[i]),!0),l.setBigUint64(i*24+8,BigInt(o.levelData.byteLength),!0),l.setBigUint64(i*24+16,BigInt(o.uncompressedByteLength),!0)}const T=new ArrayBuffer(K),h=new DataView(T);return h.setUint32(0,t.vkFormat,!0),h.setUint32(4,t.typeSize,!0),h.setUint32(8,t.pixelWidth,!0),h.setUint32(12,t.pixelHeight,!0),h.setUint32(16,t.pixelDepth,!0),h.setUint32(20,t.layerCount,!0),h.setUint32(24,t.faceCount,!0),h.setUint32(28,t.levels.length,!0),h.setUint32(32,t.supercompressionScheme,!0),h.setUint32(36,b,!0),h.setUint32(40,y.byteLength,!0),h.setUint32(44,x,!0),h.setUint32(48,u.byteLength,!0),h.setBigUint64(52,BigInt(n.byteLength>0?U:0),!0),h.setBigUint64(60,BigInt(n.byteLength),!0),new Uint8Array(A([new Uint8Array(_).buffer,T,l.buffer,y,u,U>0?new ArrayBuffer(U-(x+u.byteLength)):new ArrayBuffer(0),n,...m]))}function Le(t,e){const n=be(t);return n.keyValue.GalaceanTextureParams=new Uint8Array([e.wrapModeU,e.wrapModeV,e.filterMode,e.anisoLevel]),ve(n)}const Ae=new fe,X=ie("ktx2","upload-cache");class Se{get(e){return Ae.enqueue(()=>oe(e,X))}set(e,n){return ae(e,n,X)}}const z=new Se,Te=le("ktx2");class Oe{constructor(){k(this,"encoderWorkerPool");k(this,"initPromise");this.encoderWorkerPool=new ce(4,()=>new Worker(new URL("/_static/ktx2-worker-a04f41ea.js",self.location),{type:"module"})),this.initPromise=this.encoderWorkerPool.prepareWorker()}async encode(e,n={isUASTC:!1,enableDebug:!1,qualityLevel:255,generateMipmap:!0,isSetKTX2SRGBTransferFunc:!1}){let r;const s=M.create();if(Array.isArray(e)&&Array.isArray(e[0])){for(const a of e)for(const y of a)s.update(y);r=s.hex()}else if(Array.isArray(e)){for(const a of e)s.update(a);r=s.hex()}else r=M(e);const u=r+JSON.stringify(n);try{const a=await z.get(u);if(a)return a}catch(a){console.error(a)}return this._encode(u,e,n)}setTextureParams(e,n){return Le(e,n)}async _encode(e,n,r={isUASTC:!1,enableDebug:!1,qualityLevel:255,generateMipmap:!0,isSetKTX2SRGBTransferFunc:!1}){Te.info(`cannot find cache, use worker encoder for ${e}`),await this.initPromise;const{data:s}=await this.encoderWorkerPool.postMessage({buffer:n,options:r});return z.set(e,s),s}}const Re=new Oe;export{Re as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{W as de,as as he,at as me,au as pe,av as ve,I as Se,H as v,a5 as ue,aw as we,X as ke,ax as q,ay as U,b as j,az as Q,aA as be,aB as ye}from"./index-0a8702e2.js";function ce(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ce=function(){return!!e})()}function V(e,r){return V=Object.setPrototypeOf||function(n,t){return n.__proto__=t,n},V(e,r)}function R(e,r,a){return ce()?R=Reflect.construct:R=function(t,i,s){var o=[null];o.push.apply(o,i);var h=Function.bind.apply(t,o),u=new h;return s&&V(u,s.prototype),u},R.apply(null,arguments)}function X(e,r){for(var a=0;a<r.length;a++){var n=r[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function A(e,r,a){return r&&X(e.prototype,r),a&&X(e,a),e}function p(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&V(e,r)}function ee(e,r){return r!=null&&typeof Symbol<"u"&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}var M=function(e){return e[e.Controller=0]="Controller",e[e.LeftController=1]="LeftController",e[e.RightController=2]="RightController",e[e.Camera=3]="Camera",e[e.LeftCamera=4]="LeftCamera",e[e.RightCamera=5]="RightCamera",e[e.LeftHand=6]="LeftHand",e[e.RightHand=7]="RightHand",e}({}),k=function(e){return e[e.None=0]="None",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized",e[e.Running=3]="Running",e[e.Paused=4]="Paused",e}({}),Me=function(){function e(a){this._xrManager=a}var r=e.prototype;return r.attachCamera=function(n,t){var i=this._xrManager.inputManager.getTrackedDevice(n),s=i._camera;if(s!==t){switch(s&&(s._cameraType=q.Normal),n){case M.Camera:t._cameraType=q.XRCenterCamera;break;case M.LeftCamera:t._cameraType=q.XRLeftCamera;break;case M.RightCamera:t._cameraType=q.XRRightCamera;break}i._camera=t}},r.detachCamera=function(n){var t=this._xrManager.inputManager.getTrackedDevice(n),i=t._camera;return i&&(i._cameraType=q.Normal),t._camera=null,i},r._onSessionStart=function(){},r._onUpdate=function(){for(var n=this._xrManager.inputManager._cameras,t=this._xrManager.sessionManager._platformSession,i=0,s=n.length;i<s;i++){var o=n[i],h=o._camera;if(h){var u=h.entity.transform,c=o.pose;u.position=c.position,u.rotationQuaternion=c.rotation;var f=h.viewport,_=o.viewport,l=_.x,g=_.y,d=_.width,m=_.height;l===f.x&&g===f.y&&d===f.z&&m===f.w||(h.viewport=f.set(l,g,d,m)),U.equals(h.projectionMatrix,o.projectionMatrix)||(h.projectionMatrix=o.projectionMatrix),h.renderTarget||h._adjustPixelViewport(t.framebufferWidth,t.framebufferHeight)}}},r._onSessionExit=function(){for(var n=this._xrManager.inputManager._cameras,t=0,i=n.length;t<i;t++){var s;(s=n[t]._camera)==null||s._updatePixelViewport()}},r._getIgnoreClearFlags=function(n){return n===q.XRCenterCamera?this._xrManager.sessionManager.state===k.Running?j.Color:j.None:j.None},r._onDestroy=function(){},A(e,[{key:"fixedFoveation",get:function(){var n=this._xrManager.sessionManager,t=n._platformSession;if(t)return t.getFixedFoveation();throw new Error("XR session is not available.")},set:function(n){var t=this._xrManager.sessionManager,i=t._platformSession;if(i)i.setFixedFoveation(n);else throw new Error("XR session is not available.")}}]),e}(),O=function(){this.position=new v,this.rotation=new ye,this.matrix=new U,this.inverseMatrix=new U},w=function(e){return e[e.NotTracking=0]="NotTracking",e[e.Tracking=1]="Tracking",e[e.TrackingLost=2]="TrackingLost",e}({}),fe=function(r){this.type=r,this.trackingState=w.NotTracking},xe=function(e){p(r,e);function r(){var a;return a=e.apply(this,arguments)||this,a.pose=new O,a.viewport=new be,a.projectionMatrix=new U,a}return r}(fe),b=function(e){return e[e.None=0]="None",e[e.Select=1]="Select",e[e.Trigger=1]="Trigger",e[e.Squeeze=2]="Squeeze",e[e.TouchPad=4]="TouchPad",e[e.AButton=8]="AButton",e[e.BButton=16]="BButton",e}({}),Ce=function(e){p(r,e);function r(){var n;return n=e.apply(this,arguments)||this,n.gripPose=new O,n.targetRayPose=new O,n.pressedButtons=b.None,n.down=b.None,n.up=b.None,n}var a=r.prototype;return a.isButtonDown=function(t){return(this.down&t)!==0},a.isButtonUp=function(t){return(this.up&t)!==0},a.isButtonHeldDown=function(t){return(this.pressedButtons&t)!==0},r}(fe),P=function(e){return e[e.SelectStart=0]="SelectStart",e[e.Select=1]="Select",e[e.SelectEnd=2]="SelectEnd",e[e.SqueezeStart=3]="SqueezeStart",e[e.Squeeze=4]="Squeeze",e[e.SqueezeEnd=5]="SqueezeEnd",e}({}),te=function(e){return e[e.Gaze=0]="Gaze",e[e.TrackedPointer=1]="TrackedPointer",e[e.Screen=2]="Screen",e}({}),Ee=function(){function e(a,n){this._xrManager=a,this._engine=n,this.onTrackedDeviceChanged=new Q,this._cameras=[],this._controllers=[],this._added=[],this._removed=[],this._trackedDevices=[],this._statusSnapshot=[];for(var t=this,i=t._trackedDevices,s=t._controllers,o=t._cameras,h=0;h<6;h++)switch(h){case M.Camera:case M.LeftCamera:case M.RightCamera:o.push(i[h]=new xe(h));break;case M.Controller:case M.LeftController:case M.RightController:s.push(i[h]=new Ce(h));break}this._statusSnapshot.fill(w.NotTracking,0,i.length)}var r=e.prototype;return r.getTrackedDevice=function(n){return this._trackedDevices[n]},r._onUpdate=function(){var n=this,t=n._added,i=n._removed,s=n._statusSnapshot,o=this,h=o._trackedDevices,u=o._controllers;t.length=i.length=0;for(var c=0,f=u.length;c<f;c++){var _=u[c];_.down=_.up=0}for(var l=this._xrManager.sessionManager,g=l._platformSession,d=g.events,m=0,S=d.length;m<S;m++)this._handleEvent(d[m]);g.resetEvents(),g.frame.updateInputs(h);for(var x=0,z=h.length;x<z;x++){var F=h[x];if(F){var E=F.trackingState;s[x]===w.Tracking?E!==w.Tracking&&i.push(F):E===w.Tracking&&t.push(F),s[x]=E}}(t.length>0||i.length>0)&&this.onTrackedDeviceChanged.invoke(t,i)},r._onDestroy=function(){this.onTrackedDeviceChanged.removeAll()},r._handleEvent=function(n){var t=this._trackedDevices[n.input];switch(n.targetRayMode){case te.TrackedPointer:switch(n.type){case P.SelectStart:t.down|=b.Select,t.pressedButtons|=b.Select;break;case P.SelectEnd:t.up|=b.Select,t.pressedButtons&=~b.Select;break;case P.SqueezeStart:t.down|=b.Squeeze,t.pressedButtons|=b.Squeeze;break;case P.SqueezeEnd:t.up|=b.Squeeze,t.pressedButtons&=~b.Squeeze;break}break;case te.Screen:var i=this,s=i._engine,o=s.inputManager._pointerManager._target,h=s.canvas._webCanvas,u=h.clientWidth,c=h.clientHeight,f=u*(n.x+1)*.5,_=c*(n.y+1)*.5;switch(n.type){case P.SelectStart:o.dispatchEvent(this._makeUpPointerEvent("pointerdown",n.id,f,_));break;case P.Select:o.dispatchEvent(this._makeUpPointerEvent("pointermove",n.id,f,_));break;case P.SelectEnd:o.dispatchEvent(this._makeUpPointerEvent("pointerup",n.id,f,_)),o.dispatchEvent(this._makeUpPointerEvent("pointerleave",n.id,f,_));break}break}},r._makeUpPointerEvent=function(n,t,i,s){var o={pointerId:t,clientX:i,clientY:s};switch(n){case"pointerdown":o.button=0,o.buttons=1;break;case"pointermove":o.button=-1,o.buttons=1;break;case"pointerup":o.button=0,o.buttons=0;break;case"pointerleave":o.button=0,o.buttons=0;break}return new PointerEvent(n,o)},r.addTrackedDeviceChangedListener=function(n){this.onTrackedDeviceChanged.on(n)},r.removeTrackedDeviceChangedListener=function(n){this.onTrackedDeviceChanged.off(n)},e}(),_e=function(e){return e[e.None=0]="None",e[e.AR=1]="AR",e[e.VR=2]="VR",e}({}),Pe=function(){function e(a,n){this._xrManager=a,this._engine=n,this.onStateChanged=new Q,this._mode=_e.None,this._state=k.None,this._rhi=n._hardwareRenderer,this._raf=requestAnimationFrame.bind(window),this._caf=cancelAnimationFrame.bind(window),this._onSessionExit=this._onSessionExit.bind(this)}var r=e.prototype;return r.isSupportedMode=function(n){return this._xrManager._platformDevice.isSupportedSessionMode(n)},r.run=function(){var n=this,t=n._platformSession,i=n._engine;if(!t)throw new Error("Without session to run.");t.start(),this._setState(k.Running),this._xrManager._onSessionStart(),i.isPaused||(i.pause(),i.resume())},r.stop=function(){var n=this,t=n._platformSession,i=n._engine,s=n._rhi;if(!t)throw new Error("Without session to stop.");if(this._state!==k.Running)throw new Error("Session is not running.");s._mainFrameBuffer=null,s._mainFrameWidth=s._mainFrameHeight=0,t.stop(),this._setState(k.Paused),this._xrManager._onSessionStop(),i.isPaused||(i.pause(),i.resume())},r._setState=function(n){this._state=n,this.onStateChanged.invoke(n)},r._initialize=function(n,t){var i=this;return new Promise(function(s,o){for(var h=i._xrManager,u=[],c=0,f=t.length;c<f;c++){var _=t[c],l=_._platformFeature;l&&u.push(l)}h._platformDevice.requestSession(i._rhi,n,u).then(function(g){i._mode=n,i._platformSession=g,i._setState(k.Initialized),g.setSessionExitCallBack(i._onSessionExit),g.addEventListener(),h._onSessionInit(),s()},o)})},r._onUpdate=function(){var n=this,t=n._rhi,i=n._platformSession;t._mainFrameBuffer=i.framebuffer,t._mainFrameWidth=i.framebufferWidth,t._mainFrameHeight=i.framebufferHeight},r._getRequestAnimationFrame=function(){return this._state===k.Running?this._platformSession.requestAnimationFrame:this._raf},r._getCancelAnimationFrame=function(){return this._state===k.Running?this._platformSession.cancelAnimationFrame:this._caf},r._exit=function(){var n=this,t=n._platformSession;return t?t.end():Promise.reject("Without session to stop.")},r._onSessionExit=function(){var n=this,t=n._rhi,i=n._platformSession,s=n._engine;t._mainFrameBuffer=null,t._mainFrameWidth=t._mainFrameHeight=0,i.removeEventListener(),this._platformSession=null,this._setState(k.None),this._xrManager._onSessionExit(),s.isPaused||(s.pause(),s.resume())},r._onDestroy=function(){this.onStateChanged.removeAll(),this._raf=this._caf=null},r.addStateChangedListener=function(n){this.onStateChanged.on(n)},r.removeStateChangedListener=function(n){this.onStateChanged.off(n)},A(e,[{key:"mode",get:function(){return this._mode}},{key:"state",get:function(){return this._state}},{key:"supportedFrameRate",get:function(){return this._platformSession.supportedFrameRates}},{key:"frameRate",get:function(){return this._platformSession.frameRate}}]),e}(),J=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}var a=r.prototype;return a.isSupportedFeature=function(t){return this._platformDevice.isSupportedFeature(r._featureMap.get(t))},a.addFeature=function(t){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];if(this.sessionManager._platformSession)throw new Error("Cannot add feature when the session is initialized.");if(!this._platformDevice.isSupportedFeature(r._featureMap.get(t)))throw new Error("The feature is not supported");for(var h=this.features,u=0,c=h.length;u<c;u++)if(ee(h[u],t))throw new Error("The feature has been added");var f=R(t,[].concat([this],s));return h.push(f),f},a.getFeature=function(t){for(var i=this.features,s=0,o=i.length;s<o;s++){var h=i[s];if(ee(h,t))return h}},a.enterXR=function(t,i){var s=this;i===void 0&&(i=!0);var o=this.sessionManager;if(o._platformSession)throw new Error("Please exit XR immersive mode first.");if(!this._origin)throw new Error("Please set origin before enter XR.");return new Promise(function(h,u){o.isSupportedMode(t).then(function(){o._setState(k.Initializing),o._initialize(t,s.features).then(function(){i&&o.run(),h()},u)},u)})},a.exitXR=function(){var t=this;return new Promise(function(i,s){t.sessionManager._exit().then(function(){i()},s)})},a._initialize=function(t,i){this._features=[],this._platformDevice=i,this.sessionManager=new Pe(this,t),this.inputManager=new Ee(this,t),this.cameraManager=new Me(this)},a._update=function(){var t=this.sessionManager;if(t.state===k.Running){t._onUpdate(),this.inputManager._onUpdate(),this.cameraManager._onUpdate();for(var i=this.features,s=0,o=i.length;s<o;s++){var h=i[s];h.enabled&&h._onUpdate()}}},a._destroy=function(){var t=this;this.sessionManager._platformSession?this.exitXR().then(function(){t.sessionManager._onDestroy(),t.inputManager._onDestroy(),t.cameraManager._onDestroy()}):(this.sessionManager._onDestroy(),this.inputManager._onDestroy(),this.cameraManager._onDestroy())},a._getRequestAnimationFrame=function(){return this.sessionManager._getRequestAnimationFrame()},a._getCancelAnimationFrame=function(){return this.sessionManager._getCancelAnimationFrame()},a._getCameraIgnoreClearFlags=function(t){return this.cameraManager._getIgnoreClearFlags(t)},a._onSessionStop=function(){for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionStop()}},a._onSessionInit=function(){for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionInit()}},a._onSessionStart=function(){this.cameraManager._onSessionStart();for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionStart()}},a._onSessionExit=function(){this.cameraManager._onSessionExit();for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionExit(),o._onDestroy()}t.length=0},A(r,[{key:"features",get:function(){return this._features}},{key:"origin",get:function(){return this._origin},set:function(t){if(this.sessionManager._platformSession)throw new Error("Cannot set origin when the session is initialized.");this._origin=t}}]),r}(he);J._featureMap=new Map;function W(e){return function(r){J._featureMap.set(r,e)}}function Te(e,r){r.forEach(function(a){Object.getOwnPropertyNames(a.prototype).forEach(function(n){Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(a.prototype,n)||Object.create(null))})})}Te(he,[J]);var le=function(){function e(a,n){for(var t=arguments.length,i=new Array(t>2?t-2:0),s=2;s<t;s++)i[s-2]=arguments[s];var o;this._xrManager=a,this._type=n,this._enabled=!0,this._platformFeature=(o=a._platformDevice).createPlatformFeature.apply(o,[].concat([n],i)),this._onEnable()}var r=e.prototype;return r._onEnable=function(){},r._onDisable=function(){},r._onUpdate=function(){},r._onSessionInit=function(){},r._onSessionStart=function(){},r._onSessionStop=function(){},r._onSessionExit=function(){},r._onDestroy=function(){},A(e,[{key:"enabled",get:function(){return this._enabled},set:function(n){this.enabled!==n&&(this._enabled=n,n?this._onEnable():this._onDisable())}}]),e}(),y=function(e){return e[e.AnchorTracking=0]="AnchorTracking",e[e.ImageTracking=1]="ImageTracking",e[e.PlaneTracking=2]="PlaneTracking",e[e.HitTest=3]="HitTest",e}({}),H=function(e){return e[e.None=0]="None",e[e.Submitted=1]="Submitted",e[e.Resolved=2]="Resolved",e[e.Rejected=3]="Rejected",e[e.Destroyed=4]="Destroyed",e[e.WaitingDestroy=5]="WaitingDestroy",e}({}),T=function(e){p(r,e);function r(){var n;return n=e.apply(this,arguments)||this,n.onChanged=new Q,n._requestTrackings=[],n._tracked=[],n._added=[],n._updated=[],n._removed=[],n._statusSnapshot={},n}var a=r.prototype;return a._onUpdate=function(){var t=this._xrManager.sessionManager,i=t._platformSession,s=i.frame,o=this,h=o._platformFeature,u=o._requestTrackings,c=o._statusSnapshot,f=o._tracked,_=o._added,l=o._updated,g=o._removed;if(!(!s||!u.length)&&h.checkAvailable(i,s,u)){_.length=l.length=g.length=0,h.getTrackedResult(i,s,u,this._generateTracked);for(var d=0,m=u.length;d<m;d++){var S=u[d];switch(S.state){case H.Destroyed:for(var x=S.tracked,z=0,F=x.length;z<F;z++){var E=x[z],$=E.id;c[$]===w.Tracking&&(g.push(E),f.splice(f.indexOf(E),1)),c[$]=w.NotTracking}break;case H.Resolved:for(var Y=S.tracked,B=0,ge=Y.length;B<ge;B++){var C=Y[B],L=C.id;C.state===w.Tracking?c[L]===w.Tracking?l.push(C):(_.push(C),c[L]=w.Tracking,f.push(C)):(c[L]===w.Tracking&&(g.push(C),f.splice(f.indexOf(C),1)),c[L]=C.state)}break}}for(var N=u.length-1;N>=0;N--)u[N].state===H.Destroyed&&u.splice(N,1);(_.length>0||l.length>0||g.length>0)&&this.onChanged.invoke(_,l,g)}},a._onSessionStop=function(){this._added.length=this._updated.length=this._removed.length=0},a._onSessionExit=function(){this._requestTrackings.length=this._tracked.length=this._added.length=this._updated.length=this._removed.length=0,this.onChanged.removeAll()},a._addRequestTracking=function(t){var i=this,s=i._platformFeature;if(this._xrManager.sessionManager._platformSession&&!s.canModifyRequestTrackingAfterInit)throw new Error(y[this._type]+" request tracking cannot be modified after initialization.");this._requestTrackings.push(t),s.onAddRequestTracking(t)},a._removeRequestTracking=function(t){var i=this,s=i._platformFeature;if(this._xrManager.sessionManager._platformSession&&!s.canModifyRequestTrackingAfterInit)throw new Error(y[this._type]+" request tracking cannot be modified after initialization.");s.onDelRequestTracking(t)},a._removeAllRequestTrackings=function(){var t=this,i=t._platformFeature;if(this._xrManager.sessionManager._platformSession&&!i.canModifyRequestTrackingAfterInit)throw new Error(y[this._type]+" request tracking cannot be modified after initialization.");for(var s=this,o=s._requestTrackings,h=0,u=o.length;h<u;h++)i.onDelRequestTracking(o[h])},a.addChangedListener=function(t){this.onChanged.on(t)},a.removeChangedListener=function(t){this.onChanged.off(t)},r}(le);T._uuid=0;var K=function(){this.pose=new O,this.state=w.NotTracking},ne=function(e){return e[e.Plane=1]="Plane",e[e.All=1]="All",e}({}),Ae=function(){this.point=new v,this.normal=new v};function D(e,r,a,n){var t=arguments.length,i=t<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,a):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,r,a,n);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(i=(t<3?s(i):t>3?s(r,a,i):s(r,a))||i);return t>3&&i&&Object.defineProperty(r,a,i),i}var Fe=function(e){return e[e.None=0]="None",e[e.Horizontal=1]="Horizontal",e[e.Vertical=2]="Vertical",e[e.EveryThing=3]="EveryThing",e}({}),Z=function(){this.state=H.None,this.tracked=[]},qe=function(e){p(r,e);function r(a){var n;return n=e.call(this)||this,n.detectionMode=a,n}return r}(Z),De=function(e){p(r,e);function r(){var a;return a=e.apply(this,arguments)||this,a.polygon=[],a.attributesDirty=!1,a}return r}(K),I=function(e){p(r,e);function r(n,t){t===void 0&&(t=Fe.EveryThing);var i;return i=e.call(this,n,y.PlaneTracking,t)||this,i._addRequestTracking(new qe(t)),i}var a=r.prototype;return a._generateTracked=function(){var t=new De;return t.id=T._uuid++,t},A(r,[{key:"detectionMode",get:function(){return this._requestTrackings[0].detectionMode}},{key:"trackedPlanes",get:function(){return this._tracked}}]),r}(T);I=D([W(y.PlaneTracking)],I);var re=function(e){p(r,e);function r(n){var t;return t=e.call(this,n,y.HitTest)||this,t._tempRay=new pe,t._tempPlane=new ve,t._tempVec2=new Se,t._tempVec30=new v,t._tempVec31=new v,t._tempVec32=new v,t._tempVec33=new v,t._tempVec34=new v,t._tempVec35=new v,t}var a=r.prototype;return a.hitTest=function(t,i){var s=[];return i&ne.Plane&&this._hitTestPlane(t,s),s},a.screenHitTest=function(t,i,s){var o=this,h=o._xrManager;if(h.sessionManager.mode!==_e.AR)throw new Error("Only AR mode supports using screen ray hit test.");var u=h.inputManager.getTrackedDevice(M.Camera),c=u._camera;if(!c)throw new Error("No camera available.");var f=c.screenPointToRay(this._tempVec2.set(t,i),this._tempRay);return this.hitTest(f,s)},a._hitTestPlane=function(t,i){var s=this._xrManager.getFeature(I);if(!s||!s.enabled)throw new Error("The plane estimation function needs to be turned on for plane hit test.");for(var o=this,h=o._tempPlane,u=o._tempVec30,c=o._tempVec31,f=o._tempVec32,_=s.trackedPlanes,l=0,g=_.length;l<g;l++){var d=_[l];u.set(0,1,0).transformNormal(d.pose.matrix),h.normal.copyFrom(u),h.distance=-v.dot(u,d.pose.position);var m=t.intersectPlane(h);if(m>=0&&(t.getPoint(m,c),v.transformToVec3(c,d.pose.inverseMatrix,f),this._checkPointerWithinPlane(f,d))){var S=new Ae;S.point.copyFrom(c),S.normal.copyFrom(u),S.distance=m,S.trackedObject=d,S.trackableType=ne.Plane,i.push(S)}}},a._checkPointerWithinPlane=function(t,i){for(var s=this,o=s._tempVec33,h=s._tempVec34,u=s._tempVec35,c=i.polygon,f=c.length,_=c[f-1],l=0,g=0;g<f;g++){var d=c[g];v.subtract(d,_,o),v.subtract(t,_,h),v.cross(o,h,u);var m=u.y;if(l===0)m>0?l=1:m<0&&(l=-1);else if(m>0&&l<0||m<0&&l>0)return!1;_=d}return!0},r}(le);re=D([W(y.HitTest)],re);var ze=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}return r}(K),Le=function(e){p(r,e);function r(a,n){var t;return t=e.call(this)||this,t.position=a,t.rotation=n,t}return r}(Z),ae=function(e){p(r,e);function r(n){var t;return t=e.call(this,n,y.AnchorTracking)||this,t._anchors=[],t}var a=r.prototype;return a.addAnchor=function(t,i){if(!this._enabled)throw new Error("Cannot add an anchor from a disabled anchor manager.");var s=this,o=s._anchors,h=new Le(t,i),u=this._generateTracked();return h.tracked[0]=u,this._addRequestTracking(h),o.push(u),u},a.removeAnchor=function(t){if(!this._enabled)throw new Error("Cannot remove an anchor from a disabled anchor manager.");for(var i=this,s=i._requestTrackings,o=i._anchors,h=0,u=s.length;h<u;h++){var c=s[h];if(c.tracked[0]===t){this._removeRequestTracking(c);break}}o.splice(o.indexOf(t),1)},a.clearAnchors=function(){if(!this._enabled)throw new Error("Cannot remove anchors from a disabled anchor manager.");this._removeAllRequestTrackings()},a._generateTracked=function(){var t=new ze;return t.id=T._uuid++,t},A(r,[{key:"trackingAnchors",get:function(){return this._anchors}},{key:"trackedAnchors",get:function(){return this._tracked}}]),r}(T);ae=D([W(y.AnchorTracking)],ae);var Ne=function(e){p(r,e);function r(a){var n;return n=e.call(this)||this,n.image=a,n}return r}(Z),Re=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}return r}(K),ie=function(e){p(r,e);function r(n,t){var i;i=e.call(this,n,y.ImageTracking,t)||this,i._trackingImages=t;var s=t?t.length:0;if(s>0)for(var o=0,h=t.length;o<h;o++)i._addRequestTracking(new Ne(t[o]));else console.warn("No image to be tracked.");return i}var a=r.prototype;return a._generateTracked=function(){var t=new Re;return t.id=T._uuid++,t},A(r,[{key:"trackingImages",get:function(){return this._trackingImages}},{key:"trackedImages",get:function(){return this._tracked}}]),r}(T);ie=D([W(y.ImageTracking)],ie);var He=function(r,a,n){this.name=r,this.imageSource=a,this.physicalWidth=n},oe=function(){function e(){}return e.decode=function(a,n){return new ue(function(t,i){var s=n.nextFloat32();n.nextUint8();var o=new Image;o.onload=function(){t(new He("",o,s))},o.src=URL.createObjectURL(new window.Blob([n.nextImagesData(1)[0]]))})},e}();oe=D([me("XRReferenceImage")],oe);function G(){return G=Object.assign||function(r){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},G.apply(this,arguments)}var se=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}var a=r.prototype;return a.load=function(t,i){return new ue(function(s,o){i._request(t.url,G({},t,{type:"arraybuffer"})).then(function(h){we(h,i.engine).then(function(u){s(u)})}).catch(o)})},r}(ke);se=D([de("XRReferenceImage",[])],se);export{He as X,_e as a,M as b,k as c,ae as d,ie as e,I as f,Fe as g};
|
|
1
|
+
import{W as de,as as he,at as me,au as pe,av as ve,N as Se,K as v,a5 as ue,aw as we,X as ke,ax as q,ay as H,b as j,az as Q,aA as be,aB as ye}from"./index-aec7e708.js";function ce(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ce=function(){return!!e})()}function V(e,r){return V=Object.setPrototypeOf||function(n,t){return n.__proto__=t,n},V(e,r)}function R(e,r,a){return ce()?R=Reflect.construct:R=function(t,i,s){var o=[null];o.push.apply(o,i);var h=Function.bind.apply(t,o),u=new h;return s&&V(u,s.prototype),u},R.apply(null,arguments)}function X(e,r){for(var a=0;a<r.length;a++){var n=r[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function A(e,r,a){return r&&X(e.prototype,r),a&&X(e,a),e}function p(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&V(e,r)}function ee(e,r){return r!=null&&typeof Symbol<"u"&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}var M=function(e){return e[e.Controller=0]="Controller",e[e.LeftController=1]="LeftController",e[e.RightController=2]="RightController",e[e.Camera=3]="Camera",e[e.LeftCamera=4]="LeftCamera",e[e.RightCamera=5]="RightCamera",e[e.LeftHand=6]="LeftHand",e[e.RightHand=7]="RightHand",e}({}),k=function(e){return e[e.None=0]="None",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized",e[e.Running=3]="Running",e[e.Paused=4]="Paused",e}({}),Me=function(){function e(a){this._xrManager=a}var r=e.prototype;return r.attachCamera=function(n,t){var i=this._xrManager.inputManager.getTrackedDevice(n),s=i._camera;if(s!==t){switch(s&&(s._cameraType=q.Normal),n){case M.Camera:t._cameraType=q.XRCenterCamera;break;case M.LeftCamera:t._cameraType=q.XRLeftCamera;break;case M.RightCamera:t._cameraType=q.XRRightCamera;break}i._camera=t}},r.detachCamera=function(n){var t=this._xrManager.inputManager.getTrackedDevice(n),i=t._camera;return i&&(i._cameraType=q.Normal),t._camera=null,i},r._onSessionStart=function(){},r._onUpdate=function(){for(var n=this._xrManager.inputManager._cameras,t=this._xrManager.sessionManager._platformSession,i=0,s=n.length;i<s;i++){var o=n[i],h=o._camera;if(h){var u=h.entity.transform,c=o.pose;u.position=c.position,u.rotationQuaternion=c.rotation;var f=h.viewport,_=o.viewport,l=_.x,g=_.y,d=_.width,m=_.height;l===f.x&&g===f.y&&d===f.z&&m===f.w||(h.viewport=f.set(l,g,d,m)),H.equals(h.projectionMatrix,o.projectionMatrix)||(h.projectionMatrix=o.projectionMatrix),h.renderTarget||h._adjustPixelViewport(t.framebufferWidth,t.framebufferHeight)}}},r._onSessionExit=function(){for(var n=this._xrManager.inputManager._cameras,t=0,i=n.length;t<i;t++){var s;(s=n[t]._camera)==null||s._updatePixelViewport()}},r._getIgnoreClearFlags=function(n){return n===q.XRCenterCamera?this._xrManager.sessionManager.state===k.Running?j.Color:j.None:j.None},r._onDestroy=function(){},A(e,[{key:"fixedFoveation",get:function(){var n=this._xrManager.sessionManager,t=n._platformSession;if(t)return t.getFixedFoveation();throw new Error("XR session is not available.")},set:function(n){var t=this._xrManager.sessionManager,i=t._platformSession;if(i)i.setFixedFoveation(n);else throw new Error("XR session is not available.")}}]),e}(),O=function(){this.position=new v,this.rotation=new ye,this.matrix=new H,this.inverseMatrix=new H},w=function(e){return e[e.NotTracking=0]="NotTracking",e[e.Tracking=1]="Tracking",e[e.TrackingLost=2]="TrackingLost",e}({}),fe=function(r){this.type=r,this.trackingState=w.NotTracking},xe=function(e){p(r,e);function r(){var a;return a=e.apply(this,arguments)||this,a.pose=new O,a.viewport=new be,a.projectionMatrix=new H,a}return r}(fe),b=function(e){return e[e.None=0]="None",e[e.Select=1]="Select",e[e.Trigger=1]="Trigger",e[e.Squeeze=2]="Squeeze",e[e.TouchPad=4]="TouchPad",e[e.AButton=8]="AButton",e[e.BButton=16]="BButton",e}({}),Ce=function(e){p(r,e);function r(){var n;return n=e.apply(this,arguments)||this,n.gripPose=new O,n.targetRayPose=new O,n.pressedButtons=b.None,n.down=b.None,n.up=b.None,n}var a=r.prototype;return a.isButtonDown=function(t){return(this.down&t)!==0},a.isButtonUp=function(t){return(this.up&t)!==0},a.isButtonHeldDown=function(t){return(this.pressedButtons&t)!==0},r}(fe),P=function(e){return e[e.SelectStart=0]="SelectStart",e[e.Select=1]="Select",e[e.SelectEnd=2]="SelectEnd",e[e.SqueezeStart=3]="SqueezeStart",e[e.Squeeze=4]="Squeeze",e[e.SqueezeEnd=5]="SqueezeEnd",e}({}),te=function(e){return e[e.Gaze=0]="Gaze",e[e.TrackedPointer=1]="TrackedPointer",e[e.Screen=2]="Screen",e}({}),Ee=function(){function e(a,n){this._xrManager=a,this._engine=n,this.onTrackedDeviceChanged=new Q,this._cameras=[],this._controllers=[],this._added=[],this._removed=[],this._trackedDevices=[],this._statusSnapshot=[];for(var t=this,i=t._trackedDevices,s=t._controllers,o=t._cameras,h=0;h<6;h++)switch(h){case M.Camera:case M.LeftCamera:case M.RightCamera:o.push(i[h]=new xe(h));break;case M.Controller:case M.LeftController:case M.RightController:s.push(i[h]=new Ce(h));break}this._statusSnapshot.fill(w.NotTracking,0,i.length)}var r=e.prototype;return r.getTrackedDevice=function(n){return this._trackedDevices[n]},r._onUpdate=function(){var n=this,t=n._added,i=n._removed,s=n._statusSnapshot,o=this,h=o._trackedDevices,u=o._controllers;t.length=i.length=0;for(var c=0,f=u.length;c<f;c++){var _=u[c];_.down=_.up=0}for(var l=this._xrManager.sessionManager,g=l._platformSession,d=g.events,m=0,S=d.length;m<S;m++)this._handleEvent(d[m]);g.resetEvents(),g.frame.updateInputs(h);for(var x=0,z=h.length;x<z;x++){var F=h[x];if(F){var E=F.trackingState;s[x]===w.Tracking?E!==w.Tracking&&i.push(F):E===w.Tracking&&t.push(F),s[x]=E}}(t.length>0||i.length>0)&&this.onTrackedDeviceChanged.invoke(t,i)},r._onDestroy=function(){this.onTrackedDeviceChanged.removeAll()},r._handleEvent=function(n){var t=this._trackedDevices[n.input];switch(n.targetRayMode){case te.TrackedPointer:switch(n.type){case P.SelectStart:t.down|=b.Select,t.pressedButtons|=b.Select;break;case P.SelectEnd:t.up|=b.Select,t.pressedButtons&=~b.Select;break;case P.SqueezeStart:t.down|=b.Squeeze,t.pressedButtons|=b.Squeeze;break;case P.SqueezeEnd:t.up|=b.Squeeze,t.pressedButtons&=~b.Squeeze;break}break;case te.Screen:var i=this,s=i._engine,o=s.inputManager._pointerManager._target,h=s.canvas._webCanvas,u=h.clientWidth,c=h.clientHeight,f=u*(n.x+1)*.5,_=c*(n.y+1)*.5;switch(n.type){case P.SelectStart:o.dispatchEvent(this._makeUpPointerEvent("pointerdown",n.id,f,_));break;case P.Select:o.dispatchEvent(this._makeUpPointerEvent("pointermove",n.id,f,_));break;case P.SelectEnd:o.dispatchEvent(this._makeUpPointerEvent("pointerup",n.id,f,_)),o.dispatchEvent(this._makeUpPointerEvent("pointerleave",n.id,f,_));break}break}},r._makeUpPointerEvent=function(n,t,i,s){var o={pointerId:t,clientX:i,clientY:s};switch(n){case"pointerdown":o.button=0,o.buttons=1;break;case"pointermove":o.button=-1,o.buttons=1;break;case"pointerup":o.button=0,o.buttons=0;break;case"pointerleave":o.button=0,o.buttons=0;break}return new PointerEvent(n,o)},r.addTrackedDeviceChangedListener=function(n){this.onTrackedDeviceChanged.on(n)},r.removeTrackedDeviceChangedListener=function(n){this.onTrackedDeviceChanged.off(n)},e}(),_e=function(e){return e[e.None=0]="None",e[e.AR=1]="AR",e[e.VR=2]="VR",e}({}),Pe=function(){function e(a,n){this._xrManager=a,this._engine=n,this.onStateChanged=new Q,this._mode=_e.None,this._state=k.None,this._rhi=n._hardwareRenderer,this._raf=requestAnimationFrame.bind(window),this._caf=cancelAnimationFrame.bind(window),this._onSessionExit=this._onSessionExit.bind(this)}var r=e.prototype;return r.isSupportedMode=function(n){return this._xrManager._platformDevice.isSupportedSessionMode(n)},r.run=function(){var n=this,t=n._platformSession,i=n._engine;if(!t)throw new Error("Without session to run.");t.start(),this._setState(k.Running),this._xrManager._onSessionStart(),i.isPaused||(i.pause(),i.resume())},r.stop=function(){var n=this,t=n._platformSession,i=n._engine,s=n._rhi;if(!t)throw new Error("Without session to stop.");if(this._state!==k.Running)throw new Error("Session is not running.");s._mainFrameBuffer=null,s._mainFrameWidth=s._mainFrameHeight=0,t.stop(),this._setState(k.Paused),this._xrManager._onSessionStop(),i.isPaused||(i.pause(),i.resume())},r._setState=function(n){this._state=n,this.onStateChanged.invoke(n)},r._initialize=function(n,t){var i=this;return new Promise(function(s,o){for(var h=i._xrManager,u=[],c=0,f=t.length;c<f;c++){var _=t[c],l=_._platformFeature;l&&u.push(l)}h._platformDevice.requestSession(i._rhi,n,u).then(function(g){i._mode=n,i._platformSession=g,i._setState(k.Initialized),g.setSessionExitCallBack(i._onSessionExit),g.addEventListener(),h._onSessionInit(),s()},o)})},r._onUpdate=function(){var n=this,t=n._rhi,i=n._platformSession;t._mainFrameBuffer=i.framebuffer,t._mainFrameWidth=i.framebufferWidth,t._mainFrameHeight=i.framebufferHeight},r._getRequestAnimationFrame=function(){return this._state===k.Running?this._platformSession.requestAnimationFrame:this._raf},r._getCancelAnimationFrame=function(){return this._state===k.Running?this._platformSession.cancelAnimationFrame:this._caf},r._exit=function(){var n=this,t=n._platformSession;return t?t.end():Promise.reject("Without session to stop.")},r._onSessionExit=function(){var n=this,t=n._rhi,i=n._platformSession,s=n._engine;t._mainFrameBuffer=null,t._mainFrameWidth=t._mainFrameHeight=0,i.removeEventListener(),this._platformSession=null,this._setState(k.None),this._xrManager._onSessionExit(),s.isPaused||(s.pause(),s.resume())},r._onDestroy=function(){this.onStateChanged.removeAll(),this._raf=this._caf=null},r.addStateChangedListener=function(n){this.onStateChanged.on(n)},r.removeStateChangedListener=function(n){this.onStateChanged.off(n)},A(e,[{key:"mode",get:function(){return this._mode}},{key:"state",get:function(){return this._state}},{key:"supportedFrameRate",get:function(){return this._platformSession.supportedFrameRates}},{key:"frameRate",get:function(){return this._platformSession.frameRate}}]),e}(),K=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}var a=r.prototype;return a.isSupportedFeature=function(t){return this._platformDevice.isSupportedFeature(r._featureMap.get(t))},a.addFeature=function(t){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];if(this.sessionManager._platformSession)throw new Error("Cannot add feature when the session is initialized.");if(!this._platformDevice.isSupportedFeature(r._featureMap.get(t)))throw new Error("The feature is not supported");for(var h=this.features,u=0,c=h.length;u<c;u++)if(ee(h[u],t))throw new Error("The feature has been added");var f=R(t,[].concat([this],s));return h.push(f),f},a.getFeature=function(t){for(var i=this.features,s=0,o=i.length;s<o;s++){var h=i[s];if(ee(h,t))return h}},a.enterXR=function(t,i){var s=this;i===void 0&&(i=!0);var o=this.sessionManager;if(o._platformSession)throw new Error("Please exit XR immersive mode first.");if(!this._origin)throw new Error("Please set origin before enter XR.");return new Promise(function(h,u){o.isSupportedMode(t).then(function(){o._setState(k.Initializing),o._initialize(t,s.features).then(function(){i&&o.run(),h()},u)},u)})},a.exitXR=function(){var t=this;return new Promise(function(i,s){t.sessionManager._exit().then(function(){i()},s)})},a._initialize=function(t,i){this._features=[],this._platformDevice=i,this.sessionManager=new Pe(this,t),this.inputManager=new Ee(this,t),this.cameraManager=new Me(this)},a._update=function(){var t=this.sessionManager;if(t.state===k.Running){t._onUpdate(),this.inputManager._onUpdate(),this.cameraManager._onUpdate();for(var i=this.features,s=0,o=i.length;s<o;s++){var h=i[s];h.enabled&&h._onUpdate()}}},a._destroy=function(){var t=this;this.sessionManager._platformSession?this.exitXR().then(function(){t.sessionManager._onDestroy(),t.inputManager._onDestroy(),t.cameraManager._onDestroy()}):(this.sessionManager._onDestroy(),this.inputManager._onDestroy(),this.cameraManager._onDestroy())},a._getRequestAnimationFrame=function(){return this.sessionManager._getRequestAnimationFrame()},a._getCancelAnimationFrame=function(){return this.sessionManager._getCancelAnimationFrame()},a._getCameraIgnoreClearFlags=function(t){return this.cameraManager._getIgnoreClearFlags(t)},a._onSessionStop=function(){for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionStop()}},a._onSessionInit=function(){for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionInit()}},a._onSessionStart=function(){this.cameraManager._onSessionStart();for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionStart()}},a._onSessionExit=function(){this.cameraManager._onSessionExit();for(var t=this.features,i=0,s=t.length;i<s;i++){var o=t[i];o.enabled&&o._onSessionExit(),o._onDestroy()}t.length=0},A(r,[{key:"features",get:function(){return this._features}},{key:"origin",get:function(){return this._origin},set:function(t){if(this.sessionManager._platformSession)throw new Error("Cannot set origin when the session is initialized.");this._origin=t}}]),r}(he);K._featureMap=new Map;function W(e){return function(r){K._featureMap.set(r,e)}}function Te(e,r){r.forEach(function(a){Object.getOwnPropertyNames(a.prototype).forEach(function(n){Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(a.prototype,n)||Object.create(null))})})}Te(he,[K]);var le=function(){function e(a,n){for(var t=arguments.length,i=new Array(t>2?t-2:0),s=2;s<t;s++)i[s-2]=arguments[s];var o;this._xrManager=a,this._type=n,this._enabled=!0,this._platformFeature=(o=a._platformDevice).createPlatformFeature.apply(o,[].concat([n],i)),this._onEnable()}var r=e.prototype;return r._onEnable=function(){},r._onDisable=function(){},r._onUpdate=function(){},r._onSessionInit=function(){},r._onSessionStart=function(){},r._onSessionStop=function(){},r._onSessionExit=function(){},r._onDestroy=function(){},A(e,[{key:"enabled",get:function(){return this._enabled},set:function(n){this.enabled!==n&&(this._enabled=n,n?this._onEnable():this._onDisable())}}]),e}(),y=function(e){return e[e.AnchorTracking=0]="AnchorTracking",e[e.ImageTracking=1]="ImageTracking",e[e.PlaneTracking=2]="PlaneTracking",e[e.HitTest=3]="HitTest",e}({}),U=function(e){return e[e.None=0]="None",e[e.Submitted=1]="Submitted",e[e.Resolved=2]="Resolved",e[e.Rejected=3]="Rejected",e[e.Destroyed=4]="Destroyed",e[e.WaitingDestroy=5]="WaitingDestroy",e}({}),T=function(e){p(r,e);function r(){var n;return n=e.apply(this,arguments)||this,n.onChanged=new Q,n._requestTrackings=[],n._tracked=[],n._added=[],n._updated=[],n._removed=[],n._statusSnapshot={},n}var a=r.prototype;return a._onUpdate=function(){var t=this._xrManager.sessionManager,i=t._platformSession,s=i.frame,o=this,h=o._platformFeature,u=o._requestTrackings,c=o._statusSnapshot,f=o._tracked,_=o._added,l=o._updated,g=o._removed;if(!(!s||!u.length)&&h.checkAvailable(i,s,u)){_.length=l.length=g.length=0,h.getTrackedResult(i,s,u,this._generateTracked);for(var d=0,m=u.length;d<m;d++){var S=u[d];switch(S.state){case U.Destroyed:for(var x=S.tracked,z=0,F=x.length;z<F;z++){var E=x[z],$=E.id;c[$]===w.Tracking&&(g.push(E),f.splice(f.indexOf(E),1)),c[$]=w.NotTracking}break;case U.Resolved:for(var Y=S.tracked,B=0,ge=Y.length;B<ge;B++){var C=Y[B],L=C.id;C.state===w.Tracking?c[L]===w.Tracking?l.push(C):(_.push(C),c[L]=w.Tracking,f.push(C)):(c[L]===w.Tracking&&(g.push(C),f.splice(f.indexOf(C),1)),c[L]=C.state)}break}}for(var N=u.length-1;N>=0;N--)u[N].state===U.Destroyed&&u.splice(N,1);(_.length>0||l.length>0||g.length>0)&&this.onChanged.invoke(_,l,g)}},a._onSessionStop=function(){this._added.length=this._updated.length=this._removed.length=0},a._onSessionExit=function(){this._requestTrackings.length=this._tracked.length=this._added.length=this._updated.length=this._removed.length=0,this.onChanged.removeAll()},a._addRequestTracking=function(t){var i=this,s=i._platformFeature;if(this._xrManager.sessionManager._platformSession&&!s.canModifyRequestTrackingAfterInit)throw new Error(y[this._type]+" request tracking cannot be modified after initialization.");this._requestTrackings.push(t),s.onAddRequestTracking(t)},a._removeRequestTracking=function(t){var i=this,s=i._platformFeature;if(this._xrManager.sessionManager._platformSession&&!s.canModifyRequestTrackingAfterInit)throw new Error(y[this._type]+" request tracking cannot be modified after initialization.");s.onDelRequestTracking(t)},a._removeAllRequestTrackings=function(){var t=this,i=t._platformFeature;if(this._xrManager.sessionManager._platformSession&&!i.canModifyRequestTrackingAfterInit)throw new Error(y[this._type]+" request tracking cannot be modified after initialization.");for(var s=this,o=s._requestTrackings,h=0,u=o.length;h<u;h++)i.onDelRequestTracking(o[h])},a.addChangedListener=function(t){this.onChanged.on(t)},a.removeChangedListener=function(t){this.onChanged.off(t)},r}(le);T._uuid=0;var J=function(){this.pose=new O,this.state=w.NotTracking},ne=function(e){return e[e.Plane=1]="Plane",e[e.All=1]="All",e}({}),Ae=function(){this.point=new v,this.normal=new v};function D(e,r,a,n){var t=arguments.length,i=t<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,a):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,r,a,n);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(i=(t<3?s(i):t>3?s(r,a,i):s(r,a))||i);return t>3&&i&&Object.defineProperty(r,a,i),i}var Fe=function(e){return e[e.None=0]="None",e[e.Horizontal=1]="Horizontal",e[e.Vertical=2]="Vertical",e[e.EveryThing=3]="EveryThing",e}({}),Z=function(){this.state=U.None,this.tracked=[]},qe=function(e){p(r,e);function r(a){var n;return n=e.call(this)||this,n.detectionMode=a,n}return r}(Z),De=function(e){p(r,e);function r(){var a;return a=e.apply(this,arguments)||this,a.polygon=[],a.attributesDirty=!1,a}return r}(J),I=function(e){p(r,e);function r(n,t){t===void 0&&(t=Fe.EveryThing);var i;return i=e.call(this,n,y.PlaneTracking,t)||this,i._addRequestTracking(new qe(t)),i}var a=r.prototype;return a._generateTracked=function(){var t=new De;return t.id=T._uuid++,t},A(r,[{key:"detectionMode",get:function(){return this._requestTrackings[0].detectionMode}},{key:"trackedPlanes",get:function(){return this._tracked}}]),r}(T);I=D([W(y.PlaneTracking)],I);var re=function(e){p(r,e);function r(n){var t;return t=e.call(this,n,y.HitTest)||this,t._tempRay=new pe,t._tempPlane=new ve,t._tempVec2=new Se,t._tempVec30=new v,t._tempVec31=new v,t._tempVec32=new v,t._tempVec33=new v,t._tempVec34=new v,t._tempVec35=new v,t}var a=r.prototype;return a.hitTest=function(t,i){var s=[];return i&ne.Plane&&this._hitTestPlane(t,s),s},a.screenHitTest=function(t,i,s){var o=this,h=o._xrManager;if(h.sessionManager.mode!==_e.AR)throw new Error("Only AR mode supports using screen ray hit test.");var u=h.inputManager.getTrackedDevice(M.Camera),c=u._camera;if(!c)throw new Error("No camera available.");var f=c.screenPointToRay(this._tempVec2.set(t,i),this._tempRay);return this.hitTest(f,s)},a._hitTestPlane=function(t,i){var s=this._xrManager.getFeature(I);if(!s||!s.enabled)throw new Error("The plane estimation function needs to be turned on for plane hit test.");for(var o=this,h=o._tempPlane,u=o._tempVec30,c=o._tempVec31,f=o._tempVec32,_=s.trackedPlanes,l=0,g=_.length;l<g;l++){var d=_[l];u.set(0,1,0).transformNormal(d.pose.matrix),h.normal.copyFrom(u),h.distance=-v.dot(u,d.pose.position);var m=t.intersectPlane(h);if(m>=0&&(t.getPoint(m,c),v.transformToVec3(c,d.pose.inverseMatrix,f),this._checkPointerWithinPlane(f,d))){var S=new Ae;S.point.copyFrom(c),S.normal.copyFrom(u),S.distance=m,S.trackedObject=d,S.trackableType=ne.Plane,i.push(S)}}},a._checkPointerWithinPlane=function(t,i){for(var s=this,o=s._tempVec33,h=s._tempVec34,u=s._tempVec35,c=i.polygon,f=c.length,_=c[f-1],l=0,g=0;g<f;g++){var d=c[g];v.subtract(d,_,o),v.subtract(t,_,h),v.cross(o,h,u);var m=u.y;if(l===0)m>0?l=1:m<0&&(l=-1);else if(m>0&&l<0||m<0&&l>0)return!1;_=d}return!0},r}(le);re=D([W(y.HitTest)],re);var ze=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}return r}(J),Le=function(e){p(r,e);function r(a,n){var t;return t=e.call(this)||this,t.position=a,t.rotation=n,t}return r}(Z),ae=function(e){p(r,e);function r(n){var t;return t=e.call(this,n,y.AnchorTracking)||this,t._anchors=[],t}var a=r.prototype;return a.addAnchor=function(t,i){if(!this._enabled)throw new Error("Cannot add an anchor from a disabled anchor manager.");var s=this,o=s._anchors,h=new Le(t,i),u=this._generateTracked();return h.tracked[0]=u,this._addRequestTracking(h),o.push(u),u},a.removeAnchor=function(t){if(!this._enabled)throw new Error("Cannot remove an anchor from a disabled anchor manager.");for(var i=this,s=i._requestTrackings,o=i._anchors,h=0,u=s.length;h<u;h++){var c=s[h];if(c.tracked[0]===t){this._removeRequestTracking(c);break}}o.splice(o.indexOf(t),1)},a.clearAnchors=function(){if(!this._enabled)throw new Error("Cannot remove anchors from a disabled anchor manager.");this._removeAllRequestTrackings()},a._generateTracked=function(){var t=new ze;return t.id=T._uuid++,t},A(r,[{key:"trackingAnchors",get:function(){return this._anchors}},{key:"trackedAnchors",get:function(){return this._tracked}}]),r}(T);ae=D([W(y.AnchorTracking)],ae);var Ne=function(e){p(r,e);function r(a){var n;return n=e.call(this)||this,n.image=a,n}return r}(Z),Re=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}return r}(J),ie=function(e){p(r,e);function r(n,t){var i;i=e.call(this,n,y.ImageTracking,t)||this,i._trackingImages=t;var s=t?t.length:0;if(s>0)for(var o=0,h=t.length;o<h;o++)i._addRequestTracking(new Ne(t[o]));else console.warn("No image to be tracked.");return i}var a=r.prototype;return a._generateTracked=function(){var t=new Re;return t.id=T._uuid++,t},A(r,[{key:"trackingImages",get:function(){return this._trackingImages}},{key:"trackedImages",get:function(){return this._tracked}}]),r}(T);ie=D([W(y.ImageTracking)],ie);var Ue=function(r,a,n){this.name=r,this.imageSource=a,this.physicalWidth=n},oe=function(){function e(){}return e.decode=function(a,n){return new ue(function(t,i){var s=n.nextFloat32();n.nextUint8();var o=new Image;o.onload=function(){t(new Ue("",o,s))},o.src=URL.createObjectURL(new window.Blob([n.nextImagesData(1)[0]]))})},e}();oe=D([me("XRReferenceImage")],oe);function G(){return G=Object.assign||function(r){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},G.apply(this,arguments)}var se=function(e){p(r,e);function r(){return e.apply(this,arguments)||this}var a=r.prototype;return a.load=function(t,i){return new ue(function(s,o){i._request(t.url,G({},t,{type:"arraybuffer"})).then(function(h){we(h,i.engine).then(function(u){s(u)})}).catch(o)})},r}(ke);se=D([de("XRReferenceImage",[])],se);export{Ue as X,_e as a,M as b,k as c,ae as d,ie as e,I as f,Fe as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as wt,W as ct,X as tt,Y as bt,Z as F,_ as q,$ as it,a0 as xt,a1 as Pt,a2 as St,a3 as nt,a4 as zt,a as At,S as Lt,a5 as W,a6 as st,a7 as et,a8 as Tt,a9 as Mt}from"./index-0a8702e2.js";function ot(a,n){for(var i=0;i<n.length;i++){var t=n[i];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(a,t.key,t)}}function Rt(a,n,i){return n&&ot(a.prototype,n),i&&ot(a,i),a}function Y(a,n){return Y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Y(a,n)}function A(a,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(n&&n.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),n&&Y(a,n)}function O(a,n,i,t){var e=arguments.length,r=e<3?n:t===null?t=Object.getOwnPropertyDescriptor(n,i):t,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(a,n,i,t);else for(var o=a.length-1;o>=0;o--)(s=a[o])&&(r=(e<3?s(r):e>3?s(n,i,r):s(n,i))||r);return e>3&&r&&Object.defineProperty(n,i,r),r}var Ot=4,It=.001,Ct=1e-7,Vt=10,D=11,N=1/(D-1),Ft=typeof Float32Array=="function";function _t(a,n){return 1-3*n+3*a}function dt(a,n){return 3*n-6*a}function yt(a){return 3*a}function G(a,n,i){return((_t(n,i)*a+dt(n,i))*a+yt(n))*a}function gt(a,n,i){return 3*_t(n,i)*a*a+2*dt(n,i)*a+yt(n)}function Ut(a,n,i,t,e){var r,s,o=0;do s=n+(i-n)/2,r=G(s,t,e)-a,r>0?i=s:n=s;while(Math.abs(r)>Ct&&++o<Vt);return s}function Bt(a,n,i,t){for(var e=0;e<Ot;++e){var r=gt(n,i,t);if(r===0)return n;var s=G(n,i,t)-a;n-=s/r}return n}function jt(a){return a}var Dt=function(n,i,t,e){if(!(0<=n&&n<=1&&0<=t&&t<=1))throw new Error("bezier x values must be in [0, 1] range");if(n===i&&t===e)return jt;for(var r=Ft?new Float32Array(D):new Array(D),s=0;s<D;++s)r[s]=G(s*N,n,t);function o(u){for(var h=0,f=1,l=D-1;f!==l&&r[f]<=u;++f)h+=N;--f;var p=(u-r[f])/(r[f+1]-r[f]),c=h+p*N,v=gt(c,n,t);return v>=It?Bt(u,c,n,t):v===0?c:Ut(u,h,h+N,n,t)}return function(h){return h===0?0:h===1?1:G(o(h),i,e)}},at=200,ht={};function qt(a,n,i,t,e){var r=e||("bez_"+a+"_"+n+"_"+i+"_"+t).replace(/\./g,"p"),s=ht[r];return s||(s=Dt(a,n,i,t),ht[r]=s,s)}var J={};function Nt(a,n,i,t,e){var r=e?Math.min(e,at):at,s=(a[0]+"_"+a[1]+"_"+n[0]+"_"+n[1]+"_"+i[0]+"_"+i[1]+"_"+t[0]+"_"+t[1]+"_"+r).replace(/\./g,"p");if(!J[s]){for(var o=0,u,h=[],f=0;f<r;f++){for(var l=i.length,p=new Array(l),c=f/(r-1),v=0,_=0;_<l;_+=1){var d=Math.pow(1-c,3)*a[_]+3*Math.pow(1-c,2)*c*(a[_]+i[_])+3*(1-c)*Math.pow(c,2)*(n[_]+t[_])+Math.pow(c,3)*n[_];p[_]=d,u&&(v+=Math.pow(p[_]-u[_],2))}v=Math.sqrt(v),o+=v,h.push({partialLength:v,point:p}),u=p}J[s]={segmentLength:o,points:h}}return J[s]}var K={buildBezierData:Nt,getBezierEasing:qt},L={euclideanModulo:function(n,i){return(n%i+i)%i},codomainBounce:function(n,i,t){return n<i?2*i-n:n>t?2*t-n:n},clamp:function(n,i,t){return n<i?i:n>t?t:n}},mt=/(loopIn|loopOut)\(([^)]+)/,Wt=/["']\w+["']/,ut=function(){function a(i,t,e){this.begin=t,this.end=e,this.total=this.end-this.begin,this.type=i}var n=a.prototype;return n.update=function(t){if(this.type==="in")return t>=this.begin?t:this.end-L.euclideanModulo(this.begin-t,this.total);if(this.type==="out")return t<=this.end?t:this.begin+L.euclideanModulo(t-this.end,this.total)},a}(),lt=function(){function a(i,t,e){this.begin=t,this.end=e,this.total=this.end-this.begin,this.type=i}var n=a.prototype;return n.update=function(t){if(this.type==="in"&&t<this.begin||this.type==="out"&&t>this.end){var e=t-this.end;return this.pingpong(e)}return t},n.pingpong=function(t){var e=Math.floor(t/this.total)%2;return e?this.begin+L.euclideanModulo(t,this.total):this.end-L.euclideanModulo(t,this.total)},a}(),ft={loopIn:function(n,i,t){var e=n[0].t,r=n.length-1,s=Math.min(r,t),o=n[s].t;switch(i){case"cycle":return new ut("in",e,o);case"pingpong":return new lt("in",e,o)}return null},loopOut:function(n,i,t){var e=n.length-1,r=Math.max(0,e-t),s=n[r].t,o=n[e].t;switch(i){case"cycle":return new ut("out",s,o);case"pingpong":return new lt("out",s,o)}return null}};function Gt(a){var n=a.split(/\s*,\s*/);return n.map(function(i){return Wt.test(i)?i.replace(/"|'/g,""):parseInt(i)})}function Kt(a){var n=a.match(mt),i=Gt(n[2]);return{name:n[1],mode:i[0],offset:i[1]}}function Zt(a){return a.x&&mt.test(a.x)}function $t(a){var n=Kt(a.x),i=n.name,t=n.mode,e=n.offset,r=e===void 0?0:e,s=r===0?a.k.length-1:r;return ft[i]&&ft[i](a.k,t,s)}var Z={hasSupportExpression:Zt,getExpression:$t},k=function(){function a(i,t){this.mult=t||1,this.value=i.k,this.animated=i.a,Z.hasSupportExpression(i)&&(this.expression=Z.getExpression(i))}var n=a.prototype;return n.getValue=function(t,e,r,s){var o,u=r.t,h=s.t,f=r.s[e],l=(s.s||r.e)[e];if(r.h===1)return f;if(t>=h)o=1;else if(t<u)o=0;else{var p=r.beziers[e];p||(typeof r.o.x=="number"?p=K.getBezierEasing(r.o.x,r.o.y,r.i.x,r.i.y):p=K.getBezierEasing(r.o.x[e],r.o.y[e],r.i.x[e],r.i.y[e]),r.beziers[e]=p),o=p((t-u)/(h-u))}return f+(l-f)*o},n.reset=function(){},a}(),kt=function(a){A(n,a);function n(t,e){e===void 0&&(e=1);var r;return r=a.call(this,t,e)||this,r.v=e?r.value*e:r.value,r}var i=n.prototype;return i.update=function(){this.v=this.value*this.mult},n}(k),Ht=function(a){A(n,a);function n(t,e){e===void 0&&(e=1);var r;r=a.call(this,t,e)||this;var s=r.value.length;r.v=new Float32Array(s),r.newValue=new Float32Array(s);for(var o=0;o<s;o+=1)r.v[o]=r.value[o]*r.mult;return r}var i=n.prototype;return i.update=function(){var e;e=this.value;for(var r=0,s=this.v.length;r<s;r++)this.v[r]=e[r]*this.mult},n}(k),Jt=function(a){A(n,a);function n(t,e){e===void 0&&(e=1);var r;return r=a.call(this,t,e)||this,r._value=0,r.v=0,Z.hasSupportExpression(t)&&(r.expression=Z.getExpression(t)),r}var i=n.prototype;return i.reset=function(){this._value=0},i.update=function(e){this.expression&&(e=this.expression.update(e));for(var r=this.value,s,o,u=0,h=r.length-1;u<h&&(s=r[u],o=r[u+1],!(o.t>e));u++);s.beziers||(s.beziers=[]),this.v=this.getValue(e,0,s,o)*this.mult},n}(k),Qt=function(a){A(n,a);function n(t,e,r){e===void 0&&(e=1);var s;s=a.call(this,t,e)||this,s._lastPoint=0,s._addedLength=0;var o=s.value[0].s.length;return r&&(s._frames=r>>0),s.newValue=new Float32Array(o),s.v=new Float32Array(o),s}var i=n.prototype;return i.update=function(e){this.expression&&(e=this.expression.update(e));for(var r=this.value,s=this.newValue,o,u,h=0,f=r.length-1;h<f;h++)if(o=r[h],u=r[h+1],u.t>e){this._lastPoint=0,this._addedLength=0;break}if(e>u.t){for(var l=0,p=this.v.length;l<p;l++)this.v[l]=this.getValue(e,l,o,u)*this.mult;return}if(o.to){var c=u.t,v=o.t;o.bezierData||(o.bezierData=K.buildBezierData(o.s,u.s||o.e,o.to,o.ti,this._frames));var _=o.bezierData,d=_.points,m=_.segmentLength,y=o.timeBezier;y||(y=K.getBezierEasing(o.o.x,o.o.y,o.i.x,o.i.y,o.n),o.timeBezier=y);var b=0;c>=0&&(b=(e-v)/(c-v),b=Math.min(Math.max(0,b),1));for(var g=y(b),x=m*g,E=this._addedLength,P=this._lastPoint,w=P,T=d.length;w<T;w++){if(w===T-1){P=0,E=0;break}P=w;var M=d[w],R=d[w+1],I=R.partialLength;if(x>=E&&x<E+I){for(var U=(x-E)/I,S=0,B=M.point.length;S<B;S+=1)s[S]=M.point[S]+(R.point[S]-M.point[S])*U;break}E+=I}this._lastPoint=P,this._addedLength=E}else{o.beziers||(o.beziers=[]);for(var C=0,j=o.s.length;C<j;C++)s[C]=this.getValue(e,C,o,u)}for(var V=0,H=this.v.length;V<H;V++)this.v[V]=s[V]*this.mult},n}(k),Yt=function(){function a(i){this.properties=[],this.autoOrient=!1;var t=a.create;i.p.k?(this.p=t(i.p,1),this.properties.push(this.p)):(i.p.x&&(this.x=t(i.p.x,1),this.properties.push(this.x)),i.p.y&&(this.y=t(i.p.y,1),this.properties.push(this.y)),i.p.z&&(this.z=t(i.p.z,1),this.properties.push(this.z))),this.a=t(i.a,1),this.properties.push(this.a),this.s=t(i.s,1,.01),this.properties.push(this.s),this.o=t(i.o,0,.01),this.properties.push(this.o),i.r?(this.r=t(i.r,0),this.properties.push(this.r)):i.rx||i.ry||i.rz?(i.rx&&(this.rx=t(i.rx,0),this.properties.push(this.rx)),i.ry&&(this.ry=t(i.ry,0),this.properties.push(this.ry)),i.rz&&(this.rz=t(i.rz,0),this.properties.push(this.rz))):i.or&&(this.or=t(i.or,1),this.properties.push(this.or)),this.properties.length||this.update()}var n=a.prototype;return n.reset=function(){for(var t=0,e=this.properties.length;t<e;t++)this.properties[t].reset()},n.update=function(t){t===void 0&&(t=0);for(var e=this.properties.length,r=0;r<e;r++)this.properties[r].update(t);this.autoOrient},a.create=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t.k.length?typeof t.k[0]=="number"?new Ht(t,r):e?new Qt(t,r,t.k[t.k.length-1].t-t.k[0].t):new Jt(t,r):new kt(t,r)},a}(),rt=function(){function a(i){this.stretch=1,this.parent=null,this.visible=!0,this.startTime=0,this.treeIndex=[],this.childLayers=[],this.is3D=!!i.ddd,this.name=i.nm||"",this.index=i.index,this.timeRemapping=i.tm,this.width=i.w,this.height=i.h,this.inPoint=i.ip,this.outPoint=i.op,i.st&&(this.startTime=i.st),this.stretch=i.stretch||1,this.offsetTime=i.offsetTime||0,i.ks&&(this.transform=new Yt(i.ks))}var n=a.prototype;return n.reset=function(){this.transform&&this.transform.reset();for(var t=0;t<this.childLayers.length;t++)this.childLayers[t].reset()},n.update=function(t,e){t===void 0&&(t=0);var r=(t-this.offsetTime)/this.stretch;e===!0?this.visible=this.inPoint<=r&&this.outPoint>=r:e===!1&&(this.visible=!1),this.transform&&this.visible&&this.transform.update(r);for(var s=0;s<this.childLayers.length;s++)this.childLayers[s].update(t,this.visible)},n.addChild=function(t){t.parent=this,t.entity.parent=this.entity,this.childLayers.push(t)},n.destroy=function(){this.entity.parent=null,this.entity.destroy(),this.entity=null,this.transform=null,this.parent=null},a}(),Q=function(a){A(n,a);function n(t,e,r,s){var o;if(o=a.call(this,t)||this,o.layers=t.layers,o.comps=t.comps,r)o.entity=r,s&&(o.entity.name=s);else{var u=new q(e,s);o.entity=u}return o}var i=n.prototype;return i.destroy=function(){a.prototype.destroy.call(this),this.layers=null,this.comps=null},n}(rt),Xt=function(a){A(n,a);function n(t,e,r,s){var o;o=a.call(this,t)||this;var u;if(t.refId){if(s)o.entity=s,u=s.getComponent(it),o.sprite=u.sprite;else{o.sprite=e.getSprite(t.refId);var h=new q(r.engine,t.nm);u=h.addComponent(it),u.sprite=o.sprite,o.entity=h}var f=o.sprite,l=f.atlasRegion,p=f.texture;p.wrapModeU=p.wrapModeV=xt.Clamp,o.spriteRenderer=u,u.priority=(Number.MAX_SAFE_INTEGER-o.index*1e6)/Number.MAX_SAFE_INTEGER,o.width=l.width*p.width,o.height=l.height*p.height}return o}var i=n.prototype;return i.destroy=function(){a.prototype.destroy.call(this),this.sprite=null,this.spriteRenderer=null},n}(rt),te=function(a){A(n,a);function n(i,t,e,r){var s,o,u,h;s=a.call(this,i)||this,e?(s.entity=e,r&&(s.entity.name=r)):s.entity=new q(t,i.nm);var f=s.entity.addComponent(Pt),l=(h=i)==null||(u=h.t)==null||(o=u.d)==null?void 0:o.k;if(l.length===1){var p,c,v=(c=l)==null||(p=c[0])==null?void 0:p.s;if(v){var _=v.t,d=v.f,m=v.s,y=v.fc,b=v.lh;f.font=St.createFromOS(t,d),f.text=_,f.fontSize=m,f.color.set(y[0],y[1],y[2],1),f.lineSpacing=b}else nt.warn("TextLottieElement: "+r+", No corresponding text data found.")}else nt.warn("TextLottieElement: multi keyframes feature is not supported in this version.");return f.priority=(Number.MAX_SAFE_INTEGER-s.index*1e6)/Number.MAX_SAFE_INTEGER,s}return n}(rt),z=function(a){A(n,a);function n(){var t;return t=a.apply(this,arguments)||this,t.repeats=0,t.isLooping=!1,t.isAlternate=!1,t.direction=1,t.speed=1,t.pixelsPerUnit=zt._pixelsPerUnit,t._alpha=1,t._priority=0,t._priorityDirty=!0,t._layer=At.Layer0,t._layerDirty=!0,t._autoPlay=!1,t._clipEndCallbacks={},t._isPlaying=!1,t._curFrame=0,t._frame=0,t._root=null,t}var i=n.prototype;return i.play=function(e){var r=this;if(e){var s=this.resource.clips[e];this._clip=s}else this._clip=null;return this._isPlaying=!0,this._frame=this._curFrame,new Promise(function(o){e?r._clipEndCallbacks[e]=o:r._clipEndCallbacks.ALL=o})},i.pause=function(){this._isPlaying=!1,this._curFrame=this._frame},i.stop=function(){this._isPlaying=!1,this._curFrame=0,this._frame=0},i._setLayer=function(e,r){r||(r=this.entity),r.layer=e;for(var s=r.children,o=s.length-1;o>=0;o--){var u=s[o];u.layer=e,this._setLayer(e,u)}},i._createLayerElements=function(e,r,s,o){if(e)for(var u=0,h=e.length;u<h;u++){var f=e[u],l=null;if(f.td===void 0){var p=s.treeIndex.concat(u),c=o&&this._findEntityInTree(p);switch(f.ty){case 0:l=new Q(f,this.engine,c,f.id);break;case 2:l=new Xt(f,this._resource.atlas,this.entity,c);break;case 3:var v,_,d;((d=f)==null||(_=d.ks)==null||(v=_.o)==null?void 0:v.k)===0&&(f.ks.o.k=100),l=new Q(f,this.engine,c,f.id);break;case 5:l=new te(f,this.engine,c,f.id);break}l&&(l.treeIndex=p,r.push(l),s.addChild(l),f.layers&&this._createLayerElements(f.layers,r,l,o))}}},i._findEntityInTree=function(e){for(var r,s=0,o=e.length;s<o;s++){var u=e[s];r?r=r.children[u]:r=this.entity.children[u]}return r},i._createElements=function(e,r){var s=new Q(e,this.engine,this.entity);this._root=s;var o=s.layers,u=[];this._createLayerElements(o,u,s,r),this._elements=u},i._updateElements=function(e){this._root.update(e);for(var r=this._elements,s=0,o=r.length;s<o;s++){var u=r[s];this._updateElement(u)}},i._updateElement=function(e){var r,s,o,u,h=e.transform,f=e.entity,l=e.sprite,p=e.spriteRenderer,c=e.parent,v=e.width,_=e.height,d=f.transform,m=h.a.v,y=h.s.v,b=h.o.v,g=this.pixelsPerUnit,x=0,E=0,P=0;if(h.p){var w=h.p.v,T;x=(T=w[0])!=null?T:0;var M;E=(M=w[1])!=null?M:0;var R;P=(R=w[2])!=null?R:0}else h.x&&(x=h.x.v),h.y&&(E=h.y.v),h.z&&(P=h.z.v);var I=0,U=0,S=0;if(!e.visible){f.isActive=e.visible;return}if(h.r)S=h.r.v;else if(h.rx||h.ry||h.rz)I=h.rx?h.rx.v:0,U=h.ry?h.ry.v:0,S=h.rz?h.rz.v:0;else if(h.or){var B=h.or.v;I=B[0],U=B[1],S=B[2]}if(!((s=c)==null||(r=s.transform)==null)&&r.o){var C;b*=(C=c)==null?void 0:C.transform.o.v}if(l){var j=p.color,V=j.r,H=j.g,Et=j.b;p.color.set(V,H,Et,b*this._alpha),l.pixelsPerUnit=g,l.pivot=n._pivotVector.set(m[0]/v,(_-m[1])/_)}f.isActive=e.visible,d.setScale(y[0],y[1],y[2]),d.setRotation(I,U,-S),!((u=c)==null||(o=u.transform)==null)&&o.a?d.setPosition((x-c.transform.a.v[0])/g,(-E+c.transform.a.v[1])/g,P/g):d.setPosition((x-this._width/2)/g,(-E+this._height/2)/g,P/g)},i._resetElements=function(){for(var e=this._elements,r=0,s=e.length;r<s;r++)e[r].reset()},i.onUpdate=function(e){if(!this._isPlaying||!this._resource)return null;if(this._priorityDirty){this._priorityDirty=!1;var r=n._tempRenderers;r.length=0,this.entity.getComponentsIncludeChildren(bt,r);for(var s=0,o=0,u=r.length;o<u;++o){var h=r[o];o===0&&(s=this._priority-Math.floor(h.priority)),h.priority=h.priority+s}}this._layerDirty&&(this._layerDirty=!1,this._setLayer(this.layer,this.entity));var f=this.direction*this.speed*e*1e3;this._frame+=f/this._resource.timePerFrame;var l=this._clip;if(this._spill()){var p=this._resource.duration;if(this._resetElements(),this.repeats>0||this.isLooping)this.repeats>0&&--this.repeats,this.isAlternate?(this.direction*=-1,l?this._frame=L.codomainBounce(this._frame,0,l.end-l.start):this._frame=L.codomainBounce(this._frame,0,p)):(this.direction=1,l?this._frame=L.euclideanModulo(this._frame,l.end-l.start):this._frame=L.euclideanModulo(this._frame,p));else if(l){if(this._frame>=l.end-l.start){var c=this._clipEndCallbacks[l.name];c&&c(l)}this._frame=L.clamp(this._frame,0,l.end-l.start)}else{if(this._frame>=p){var v=this._clipEndCallbacks.ALL;v&&v()}this._frame=L.clamp(this._frame,0,p)}}l?this._updateElements(this._resource.inPoint+this._frame+l.start):this._updateElements(this._resource.inPoint+this._frame)},i._spill=function(){var e;if(this._clip){var r=this._clip;e=r.end-r.start}else e=this._resource.duration;var s=this._frame<=0&&this.direction===-1,o=this._frame>=e&&this.direction===1;return s||o},i._cloneTo=function(e){e._createElements(this._resource,!0)},i._destroy=function(){var e=this._elements;if(e)for(var r=0,s=e.length;r<s;r++)e[r].destroy()},i.onDestroy=function(){this._destroy()},Rt(n,[{key:"resource",get:function(){return this._resource},set:function(e){this._resource!==e&&(this._resource&&(this.pause(),this._destroy(),this._resource.refCount--,this._resource.refCount<=0&&this._resource.destroy()),this._resource=e,e&&(e.refCount++,this._width=e.width,this._height=e.height,this._createElements(e),this._priorityDirty=!0,this._layerDirty=!0),this._curFrame=0,this.play(),this.onUpdate(0),this.autoPlay||this.pause())}},{key:"priority",get:function(){return this._priority},set:function(e){this._priority!==e&&(this._priority=e,this._priorityDirty=!0)}},{key:"layer",get:function(){return this._layer},set:function(e){this._layer!==e&&(this._layer=e,this._layerDirty=!0)}},{key:"alpha",get:function(){return this._alpha},set:function(e){this._alpha!==e&&(this._alpha=e,this.isPlaying||(this.play(),this.onUpdate(0),this.pause()))}},{key:"autoPlay",get:function(){return this._autoPlay},set:function(e){this._autoPlay=e,e&&this.play()}},{key:"frame",get:function(){return this._frame}},{key:"isPlaying",get:function(){return this._isPlaying}}]),n}(Lt);(function(){z._pivotVector=new wt})();(function(){z._tempRenderers=[]})();O([F],z.prototype,"_clipEndCallbacks",void 0);O([F],z.prototype,"_isPlaying",void 0);O([F],z.prototype,"_curFrame",void 0);O([F],z.prototype,"_frame",void 0);O([F],z.prototype,"_root",void 0);O([F],z.prototype,"_elements",void 0);function ee(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function $(){return $=Object.assign||function(n){for(var i=1;i<arguments.length;i++){var t=arguments[i];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])}return n},$.apply(this,arguments)}function re(a){"@swc/helpers - typeof";return a&&typeof Symbol<"u"&&a.constructor===Symbol?"symbol":typeof a}var X=function(a){A(n,a);function n(t,e,r){var s;s=a.call(this,t)||this,s.refCount=0,s.timePerFrame=1e3/e.fr,s.duration=Math.floor(e.op-e.ip),s.width=e.w,s.height=e.h,s.inPoint=e.ip,s.outPoint=e.op,s.atlas=r,s.layers=e.layers,s.comps=e.assets,s.name=e.nm,s.clips={};var o={},u=ee(s).comps;if(u)for(var h=0,f=u.length;h<f;h++){var l=u[h];l.id&&(o[l.id]=l)}return s._buildTree(s.layers,o),e.lolitaAnimations&&s._parseAnimations(e.lolitaAnimations),s}var i=n.prototype;return i.setClips=function(e){this.clips={},this._parseAnimations(e)},i._parseAnimations=function(e){var r=this;e.forEach(function(s){r.clips[s.name]=$({},s)})},i._buildTree=function(e,r,s,o,u,h){s===void 0&&(s=0),o===void 0&&(o=1),u===void 0&&(u=0),h===void 0&&(h=1);for(var f={},l=0,p=e.length;l<p;l++){var c=e[l],v;f[(v=c.ind)!=null?v:l]=c}for(var _=e.length-1;_>=0;_--){var d=e[_],m=d.refId,y=d.parent;d.offsetTime=s,d.stretch=o;var b;if(d.index=((b=d.ind)!=null?b:_)*h+u,y&&(f[y].layers||(f[y].layers=[]),f[y].layers.push(d),e.splice(_,1)),m&&r[m]){for(var g=[],x=0;x<r[m].layers.length;x++)g.push(this._deepClone(r[m].layers[x]));var E=(d.offsetTime||0)+(d.st||0),P=(d.stretch||1)*(d.sr||1),w=g.length-1,T,M=h/(((T=g[w].ind)!=null?T:w)+1)*h;if(this._buildTree(g,r,E,P,d.index,M),d.layers){var R;(R=d.layers).push.apply(R,[].concat(g))}else d.layers=[].concat(g)}}},i._deepClone=function(e){var r=this,s=Array.isArray(e)?[].concat(e):$({},e);return Reflect.ownKeys(s).map(function(o){s[o]=r._isObject(e[o])?r._deepClone(e[o]):e[o]}),s},i._isObject=function(e){return(typeof e=="object"||typeof e=="function")&&(typeof e>"u"?"undefined":re(e))!==null},i.destroy=function(){var e,r;(e=(r=this.atlas).destroy)==null||e.call(r),this.atlas=null,this.layers=null,this.clips=null,this.comps=null,a.prototype.destroy.call(this)},n}(Tt),pt=function(a){A(n,a);function n(){return a.apply(this,arguments)}var i=n.prototype;return i.load=function(e,r){return new W(function(s,o){var u=e.url;r._request(u,{type:"json"}).then(function(h){var f=h.jsonUrl,l=h.atlasUrl,p=r._request(st.resolveAbsoluteUrl(u,f),r),c=r.load({url:st.resolveAbsoluteUrl(u,l),type:et.SpriteAtlas});W.all([p,c]).then(function(v){var _=v[0],d=v[1],m=r.engine,y=new X(m,_,d);s(y)}).catch(o)}).catch(o)})},n}(tt);pt=O([ct("EditorLottie",["json"])],pt);var ie=function(){function a(i,t){var e=this;this.sprites={},this.assetsPromises=[],this.assetsPromises=i.map(function(r){return t.resourceManager.load({url:r.p,type:et.Texture2D}).then(function(s){var o=new Mt(t);o.texture=s,e.sprites[r.id]=o})})}var n=a.prototype;return n.request=function(){return Promise.all(this.assetsPromises)},n.getSprite=function(t){return this.sprites[t]},a}(),vt=function(a){A(n,a);function n(){return a.apply(this,arguments)}var i=n.prototype;return i.load=function(e,r){var s=e.urls,o=r._request(s[0],{type:"json"});if(s[1]){var u=r.load({url:s[1],type:et.SpriteAtlas});return W.all([o,u]).then(function(h){var f=h[0],l=h[1],p=r.engine,c=new X(p,f,l),v=new q(p),_=v.addComponent(z);return _.resource=c,v})}else return W.all([o]).then(function(h){var f=h[0],l=r.engine,p=f.assets.filter(function(v){return v.p});f.assets=f.assets.filter(function(v){return!v.p});var c=new ie(p,l);return c.request().then(function(){var v=new X(l,f,c),_=new q(l),d=_.addComponent(z);return d.resource=v,_})})},n}(tt);vt=O([ct("lottie",["json"])],vt);tt.registerClass("LottieAnimation",z);export{z as L};
|
|
1
|
+
import{N as wt,W as ct,X as tt,Y as bt,Z as F,_ as q,$ as it,a0 as xt,a1 as Pt,a2 as St,a3 as nt,a4 as zt,a as At,S as Lt,a5 as W,a6 as st,a7 as et,a8 as Tt,a9 as Mt}from"./index-aec7e708.js";function ot(a,n){for(var i=0;i<n.length;i++){var t=n[i];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(a,t.key,t)}}function Rt(a,n,i){return n&&ot(a.prototype,n),i&&ot(a,i),a}function Y(a,n){return Y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Y(a,n)}function A(a,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(n&&n.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),n&&Y(a,n)}function O(a,n,i,t){var e=arguments.length,r=e<3?n:t===null?t=Object.getOwnPropertyDescriptor(n,i):t,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(a,n,i,t);else for(var o=a.length-1;o>=0;o--)(s=a[o])&&(r=(e<3?s(r):e>3?s(n,i,r):s(n,i))||r);return e>3&&r&&Object.defineProperty(n,i,r),r}var Ot=4,It=.001,Ct=1e-7,Vt=10,D=11,N=1/(D-1),Ft=typeof Float32Array=="function";function _t(a,n){return 1-3*n+3*a}function dt(a,n){return 3*n-6*a}function yt(a){return 3*a}function G(a,n,i){return((_t(n,i)*a+dt(n,i))*a+yt(n))*a}function gt(a,n,i){return 3*_t(n,i)*a*a+2*dt(n,i)*a+yt(n)}function Ut(a,n,i,t,e){var r,s,o=0;do s=n+(i-n)/2,r=G(s,t,e)-a,r>0?i=s:n=s;while(Math.abs(r)>Ct&&++o<Vt);return s}function Bt(a,n,i,t){for(var e=0;e<Ot;++e){var r=gt(n,i,t);if(r===0)return n;var s=G(n,i,t)-a;n-=s/r}return n}function jt(a){return a}var Dt=function(n,i,t,e){if(!(0<=n&&n<=1&&0<=t&&t<=1))throw new Error("bezier x values must be in [0, 1] range");if(n===i&&t===e)return jt;for(var r=Ft?new Float32Array(D):new Array(D),s=0;s<D;++s)r[s]=G(s*N,n,t);function o(u){for(var h=0,f=1,l=D-1;f!==l&&r[f]<=u;++f)h+=N;--f;var p=(u-r[f])/(r[f+1]-r[f]),c=h+p*N,v=gt(c,n,t);return v>=It?Bt(u,c,n,t):v===0?c:Ut(u,h,h+N,n,t)}return function(h){return h===0?0:h===1?1:G(o(h),i,e)}},at=200,ht={};function qt(a,n,i,t,e){var r=e||("bez_"+a+"_"+n+"_"+i+"_"+t).replace(/\./g,"p"),s=ht[r];return s||(s=Dt(a,n,i,t),ht[r]=s,s)}var J={};function Nt(a,n,i,t,e){var r=e?Math.min(e,at):at,s=(a[0]+"_"+a[1]+"_"+n[0]+"_"+n[1]+"_"+i[0]+"_"+i[1]+"_"+t[0]+"_"+t[1]+"_"+r).replace(/\./g,"p");if(!J[s]){for(var o=0,u,h=[],f=0;f<r;f++){for(var l=i.length,p=new Array(l),c=f/(r-1),v=0,_=0;_<l;_+=1){var d=Math.pow(1-c,3)*a[_]+3*Math.pow(1-c,2)*c*(a[_]+i[_])+3*(1-c)*Math.pow(c,2)*(n[_]+t[_])+Math.pow(c,3)*n[_];p[_]=d,u&&(v+=Math.pow(p[_]-u[_],2))}v=Math.sqrt(v),o+=v,h.push({partialLength:v,point:p}),u=p}J[s]={segmentLength:o,points:h}}return J[s]}var K={buildBezierData:Nt,getBezierEasing:qt},L={euclideanModulo:function(n,i){return(n%i+i)%i},codomainBounce:function(n,i,t){return n<i?2*i-n:n>t?2*t-n:n},clamp:function(n,i,t){return n<i?i:n>t?t:n}},mt=/(loopIn|loopOut)\(([^)]+)/,Wt=/["']\w+["']/,ut=function(){function a(i,t,e){this.begin=t,this.end=e,this.total=this.end-this.begin,this.type=i}var n=a.prototype;return n.update=function(t){if(this.type==="in")return t>=this.begin?t:this.end-L.euclideanModulo(this.begin-t,this.total);if(this.type==="out")return t<=this.end?t:this.begin+L.euclideanModulo(t-this.end,this.total)},a}(),lt=function(){function a(i,t,e){this.begin=t,this.end=e,this.total=this.end-this.begin,this.type=i}var n=a.prototype;return n.update=function(t){if(this.type==="in"&&t<this.begin||this.type==="out"&&t>this.end){var e=t-this.end;return this.pingpong(e)}return t},n.pingpong=function(t){var e=Math.floor(t/this.total)%2;return e?this.begin+L.euclideanModulo(t,this.total):this.end-L.euclideanModulo(t,this.total)},a}(),ft={loopIn:function(n,i,t){var e=n[0].t,r=n.length-1,s=Math.min(r,t),o=n[s].t;switch(i){case"cycle":return new ut("in",e,o);case"pingpong":return new lt("in",e,o)}return null},loopOut:function(n,i,t){var e=n.length-1,r=Math.max(0,e-t),s=n[r].t,o=n[e].t;switch(i){case"cycle":return new ut("out",s,o);case"pingpong":return new lt("out",s,o)}return null}};function Gt(a){var n=a.split(/\s*,\s*/);return n.map(function(i){return Wt.test(i)?i.replace(/"|'/g,""):parseInt(i)})}function Kt(a){var n=a.match(mt),i=Gt(n[2]);return{name:n[1],mode:i[0],offset:i[1]}}function Zt(a){return a.x&&mt.test(a.x)}function $t(a){var n=Kt(a.x),i=n.name,t=n.mode,e=n.offset,r=e===void 0?0:e,s=r===0?a.k.length-1:r;return ft[i]&&ft[i](a.k,t,s)}var Z={hasSupportExpression:Zt,getExpression:$t},k=function(){function a(i,t){this.mult=t||1,this.value=i.k,this.animated=i.a,Z.hasSupportExpression(i)&&(this.expression=Z.getExpression(i))}var n=a.prototype;return n.getValue=function(t,e,r,s){var o,u=r.t,h=s.t,f=r.s[e],l=(s.s||r.e)[e];if(r.h===1)return f;if(t>=h)o=1;else if(t<u)o=0;else{var p=r.beziers[e];p||(typeof r.o.x=="number"?p=K.getBezierEasing(r.o.x,r.o.y,r.i.x,r.i.y):p=K.getBezierEasing(r.o.x[e],r.o.y[e],r.i.x[e],r.i.y[e]),r.beziers[e]=p),o=p((t-u)/(h-u))}return f+(l-f)*o},n.reset=function(){},a}(),kt=function(a){A(n,a);function n(t,e){e===void 0&&(e=1);var r;return r=a.call(this,t,e)||this,r.v=e?r.value*e:r.value,r}var i=n.prototype;return i.update=function(){this.v=this.value*this.mult},n}(k),Ht=function(a){A(n,a);function n(t,e){e===void 0&&(e=1);var r;r=a.call(this,t,e)||this;var s=r.value.length;r.v=new Float32Array(s),r.newValue=new Float32Array(s);for(var o=0;o<s;o+=1)r.v[o]=r.value[o]*r.mult;return r}var i=n.prototype;return i.update=function(){var e;e=this.value;for(var r=0,s=this.v.length;r<s;r++)this.v[r]=e[r]*this.mult},n}(k),Jt=function(a){A(n,a);function n(t,e){e===void 0&&(e=1);var r;return r=a.call(this,t,e)||this,r._value=0,r.v=0,Z.hasSupportExpression(t)&&(r.expression=Z.getExpression(t)),r}var i=n.prototype;return i.reset=function(){this._value=0},i.update=function(e){this.expression&&(e=this.expression.update(e));for(var r=this.value,s,o,u=0,h=r.length-1;u<h&&(s=r[u],o=r[u+1],!(o.t>e));u++);s.beziers||(s.beziers=[]),this.v=this.getValue(e,0,s,o)*this.mult},n}(k),Qt=function(a){A(n,a);function n(t,e,r){e===void 0&&(e=1);var s;s=a.call(this,t,e)||this,s._lastPoint=0,s._addedLength=0;var o=s.value[0].s.length;return r&&(s._frames=r>>0),s.newValue=new Float32Array(o),s.v=new Float32Array(o),s}var i=n.prototype;return i.update=function(e){this.expression&&(e=this.expression.update(e));for(var r=this.value,s=this.newValue,o,u,h=0,f=r.length-1;h<f;h++)if(o=r[h],u=r[h+1],u.t>e){this._lastPoint=0,this._addedLength=0;break}if(e>u.t){for(var l=0,p=this.v.length;l<p;l++)this.v[l]=this.getValue(e,l,o,u)*this.mult;return}if(o.to){var c=u.t,v=o.t;o.bezierData||(o.bezierData=K.buildBezierData(o.s,u.s||o.e,o.to,o.ti,this._frames));var _=o.bezierData,d=_.points,m=_.segmentLength,y=o.timeBezier;y||(y=K.getBezierEasing(o.o.x,o.o.y,o.i.x,o.i.y,o.n),o.timeBezier=y);var b=0;c>=0&&(b=(e-v)/(c-v),b=Math.min(Math.max(0,b),1));for(var g=y(b),x=m*g,E=this._addedLength,P=this._lastPoint,w=P,T=d.length;w<T;w++){if(w===T-1){P=0,E=0;break}P=w;var M=d[w],R=d[w+1],I=R.partialLength;if(x>=E&&x<E+I){for(var U=(x-E)/I,S=0,B=M.point.length;S<B;S+=1)s[S]=M.point[S]+(R.point[S]-M.point[S])*U;break}E+=I}this._lastPoint=P,this._addedLength=E}else{o.beziers||(o.beziers=[]);for(var C=0,j=o.s.length;C<j;C++)s[C]=this.getValue(e,C,o,u)}for(var V=0,H=this.v.length;V<H;V++)this.v[V]=s[V]*this.mult},n}(k),Yt=function(){function a(i){this.properties=[],this.autoOrient=!1;var t=a.create;i.p.k?(this.p=t(i.p,1),this.properties.push(this.p)):(i.p.x&&(this.x=t(i.p.x,1),this.properties.push(this.x)),i.p.y&&(this.y=t(i.p.y,1),this.properties.push(this.y)),i.p.z&&(this.z=t(i.p.z,1),this.properties.push(this.z))),this.a=t(i.a,1),this.properties.push(this.a),this.s=t(i.s,1,.01),this.properties.push(this.s),this.o=t(i.o,0,.01),this.properties.push(this.o),i.r?(this.r=t(i.r,0),this.properties.push(this.r)):i.rx||i.ry||i.rz?(i.rx&&(this.rx=t(i.rx,0),this.properties.push(this.rx)),i.ry&&(this.ry=t(i.ry,0),this.properties.push(this.ry)),i.rz&&(this.rz=t(i.rz,0),this.properties.push(this.rz))):i.or&&(this.or=t(i.or,1),this.properties.push(this.or)),this.properties.length||this.update()}var n=a.prototype;return n.reset=function(){for(var t=0,e=this.properties.length;t<e;t++)this.properties[t].reset()},n.update=function(t){t===void 0&&(t=0);for(var e=this.properties.length,r=0;r<e;r++)this.properties[r].update(t);this.autoOrient},a.create=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t.k.length?typeof t.k[0]=="number"?new Ht(t,r):e?new Qt(t,r,t.k[t.k.length-1].t-t.k[0].t):new Jt(t,r):new kt(t,r)},a}(),rt=function(){function a(i){this.stretch=1,this.parent=null,this.visible=!0,this.startTime=0,this.treeIndex=[],this.childLayers=[],this.is3D=!!i.ddd,this.name=i.nm||"",this.index=i.index,this.timeRemapping=i.tm,this.width=i.w,this.height=i.h,this.inPoint=i.ip,this.outPoint=i.op,i.st&&(this.startTime=i.st),this.stretch=i.stretch||1,this.offsetTime=i.offsetTime||0,i.ks&&(this.transform=new Yt(i.ks))}var n=a.prototype;return n.reset=function(){this.transform&&this.transform.reset();for(var t=0;t<this.childLayers.length;t++)this.childLayers[t].reset()},n.update=function(t,e){t===void 0&&(t=0);var r=(t-this.offsetTime)/this.stretch;e===!0?this.visible=this.inPoint<=r&&this.outPoint>=r:e===!1&&(this.visible=!1),this.transform&&this.visible&&this.transform.update(r);for(var s=0;s<this.childLayers.length;s++)this.childLayers[s].update(t,this.visible)},n.addChild=function(t){t.parent=this,t.entity.parent=this.entity,this.childLayers.push(t)},n.destroy=function(){this.entity.parent=null,this.entity.destroy(),this.entity=null,this.transform=null,this.parent=null},a}(),Q=function(a){A(n,a);function n(t,e,r,s){var o;if(o=a.call(this,t)||this,o.layers=t.layers,o.comps=t.comps,r)o.entity=r,s&&(o.entity.name=s);else{var u=new q(e,s);o.entity=u}return o}var i=n.prototype;return i.destroy=function(){a.prototype.destroy.call(this),this.layers=null,this.comps=null},n}(rt),Xt=function(a){A(n,a);function n(t,e,r,s){var o;o=a.call(this,t)||this;var u;if(t.refId){if(s)o.entity=s,u=s.getComponent(it),o.sprite=u.sprite;else{o.sprite=e.getSprite(t.refId);var h=new q(r.engine,t.nm);u=h.addComponent(it),u.sprite=o.sprite,o.entity=h}var f=o.sprite,l=f.atlasRegion,p=f.texture;p.wrapModeU=p.wrapModeV=xt.Clamp,o.spriteRenderer=u,u.priority=(Number.MAX_SAFE_INTEGER-o.index*1e6)/Number.MAX_SAFE_INTEGER,o.width=l.width*p.width,o.height=l.height*p.height}return o}var i=n.prototype;return i.destroy=function(){a.prototype.destroy.call(this),this.sprite=null,this.spriteRenderer=null},n}(rt),te=function(a){A(n,a);function n(i,t,e,r){var s,o,u,h;s=a.call(this,i)||this,e?(s.entity=e,r&&(s.entity.name=r)):s.entity=new q(t,i.nm);var f=s.entity.addComponent(Pt),l=(h=i)==null||(u=h.t)==null||(o=u.d)==null?void 0:o.k;if(l.length===1){var p,c,v=(c=l)==null||(p=c[0])==null?void 0:p.s;if(v){var _=v.t,d=v.f,m=v.s,y=v.fc,b=v.lh;f.font=St.createFromOS(t,d),f.text=_,f.fontSize=m,f.color.set(y[0],y[1],y[2],1),f.lineSpacing=b}else nt.warn("TextLottieElement: "+r+", No corresponding text data found.")}else nt.warn("TextLottieElement: multi keyframes feature is not supported in this version.");return f.priority=(Number.MAX_SAFE_INTEGER-s.index*1e6)/Number.MAX_SAFE_INTEGER,s}return n}(rt),z=function(a){A(n,a);function n(){var t;return t=a.apply(this,arguments)||this,t.repeats=0,t.isLooping=!1,t.isAlternate=!1,t.direction=1,t.speed=1,t.pixelsPerUnit=zt._pixelsPerUnit,t._alpha=1,t._priority=0,t._priorityDirty=!0,t._layer=At.Layer0,t._layerDirty=!0,t._autoPlay=!1,t._clipEndCallbacks={},t._isPlaying=!1,t._curFrame=0,t._frame=0,t._root=null,t}var i=n.prototype;return i.play=function(e){var r=this;if(e){var s=this.resource.clips[e];this._clip=s}else this._clip=null;return this._isPlaying=!0,this._frame=this._curFrame,new Promise(function(o){e?r._clipEndCallbacks[e]=o:r._clipEndCallbacks.ALL=o})},i.pause=function(){this._isPlaying=!1,this._curFrame=this._frame},i.stop=function(){this._isPlaying=!1,this._curFrame=0,this._frame=0},i._setLayer=function(e,r){r||(r=this.entity),r.layer=e;for(var s=r.children,o=s.length-1;o>=0;o--){var u=s[o];u.layer=e,this._setLayer(e,u)}},i._createLayerElements=function(e,r,s,o){if(e)for(var u=0,h=e.length;u<h;u++){var f=e[u],l=null;if(f.td===void 0){var p=s.treeIndex.concat(u),c=o&&this._findEntityInTree(p);switch(f.ty){case 0:l=new Q(f,this.engine,c,f.id);break;case 2:l=new Xt(f,this._resource.atlas,this.entity,c);break;case 3:var v,_,d;((d=f)==null||(_=d.ks)==null||(v=_.o)==null?void 0:v.k)===0&&(f.ks.o.k=100),l=new Q(f,this.engine,c,f.id);break;case 5:l=new te(f,this.engine,c,f.id);break}l&&(l.treeIndex=p,r.push(l),s.addChild(l),f.layers&&this._createLayerElements(f.layers,r,l,o))}}},i._findEntityInTree=function(e){for(var r,s=0,o=e.length;s<o;s++){var u=e[s];r?r=r.children[u]:r=this.entity.children[u]}return r},i._createElements=function(e,r){var s=new Q(e,this.engine,this.entity);this._root=s;var o=s.layers,u=[];this._createLayerElements(o,u,s,r),this._elements=u},i._updateElements=function(e){this._root.update(e);for(var r=this._elements,s=0,o=r.length;s<o;s++){var u=r[s];this._updateElement(u)}},i._updateElement=function(e){var r,s,o,u,h=e.transform,f=e.entity,l=e.sprite,p=e.spriteRenderer,c=e.parent,v=e.width,_=e.height,d=f.transform,m=h.a.v,y=h.s.v,b=h.o.v,g=this.pixelsPerUnit,x=0,E=0,P=0;if(h.p){var w=h.p.v,T;x=(T=w[0])!=null?T:0;var M;E=(M=w[1])!=null?M:0;var R;P=(R=w[2])!=null?R:0}else h.x&&(x=h.x.v),h.y&&(E=h.y.v),h.z&&(P=h.z.v);var I=0,U=0,S=0;if(!e.visible){f.isActive=e.visible;return}if(h.r)S=h.r.v;else if(h.rx||h.ry||h.rz)I=h.rx?h.rx.v:0,U=h.ry?h.ry.v:0,S=h.rz?h.rz.v:0;else if(h.or){var B=h.or.v;I=B[0],U=B[1],S=B[2]}if(!((s=c)==null||(r=s.transform)==null)&&r.o){var C;b*=(C=c)==null?void 0:C.transform.o.v}if(l){var j=p.color,V=j.r,H=j.g,Et=j.b;p.color.set(V,H,Et,b*this._alpha),l.pixelsPerUnit=g,l.pivot=n._pivotVector.set(m[0]/v,(_-m[1])/_)}f.isActive=e.visible,d.setScale(y[0],y[1],y[2]),d.setRotation(I,U,-S),!((u=c)==null||(o=u.transform)==null)&&o.a?d.setPosition((x-c.transform.a.v[0])/g,(-E+c.transform.a.v[1])/g,P/g):d.setPosition((x-this._width/2)/g,(-E+this._height/2)/g,P/g)},i._resetElements=function(){for(var e=this._elements,r=0,s=e.length;r<s;r++)e[r].reset()},i.onUpdate=function(e){if(!this._isPlaying||!this._resource)return null;if(this._priorityDirty){this._priorityDirty=!1;var r=n._tempRenderers;r.length=0,this.entity.getComponentsIncludeChildren(bt,r);for(var s=0,o=0,u=r.length;o<u;++o){var h=r[o];o===0&&(s=this._priority-Math.floor(h.priority)),h.priority=h.priority+s}}this._layerDirty&&(this._layerDirty=!1,this._setLayer(this.layer,this.entity));var f=this.direction*this.speed*e*1e3;this._frame+=f/this._resource.timePerFrame;var l=this._clip;if(this._spill()){var p=this._resource.duration;if(this._resetElements(),this.repeats>0||this.isLooping)this.repeats>0&&--this.repeats,this.isAlternate?(this.direction*=-1,l?this._frame=L.codomainBounce(this._frame,0,l.end-l.start):this._frame=L.codomainBounce(this._frame,0,p)):(this.direction=1,l?this._frame=L.euclideanModulo(this._frame,l.end-l.start):this._frame=L.euclideanModulo(this._frame,p));else if(l){if(this._frame>=l.end-l.start){var c=this._clipEndCallbacks[l.name];c&&c(l)}this._frame=L.clamp(this._frame,0,l.end-l.start)}else{if(this._frame>=p){var v=this._clipEndCallbacks.ALL;v&&v()}this._frame=L.clamp(this._frame,0,p)}}l?this._updateElements(this._resource.inPoint+this._frame+l.start):this._updateElements(this._resource.inPoint+this._frame)},i._spill=function(){var e;if(this._clip){var r=this._clip;e=r.end-r.start}else e=this._resource.duration;var s=this._frame<=0&&this.direction===-1,o=this._frame>=e&&this.direction===1;return s||o},i._cloneTo=function(e){e._createElements(this._resource,!0)},i._destroy=function(){var e=this._elements;if(e)for(var r=0,s=e.length;r<s;r++)e[r].destroy()},i.onDestroy=function(){this._destroy()},Rt(n,[{key:"resource",get:function(){return this._resource},set:function(e){this._resource!==e&&(this._resource&&(this.pause(),this._destroy(),this._resource.refCount--,this._resource.refCount<=0&&this._resource.destroy()),this._resource=e,e&&(e.refCount++,this._width=e.width,this._height=e.height,this._createElements(e),this._priorityDirty=!0,this._layerDirty=!0),this._curFrame=0,this.play(),this.onUpdate(0),this.autoPlay||this.pause())}},{key:"priority",get:function(){return this._priority},set:function(e){this._priority!==e&&(this._priority=e,this._priorityDirty=!0)}},{key:"layer",get:function(){return this._layer},set:function(e){this._layer!==e&&(this._layer=e,this._layerDirty=!0)}},{key:"alpha",get:function(){return this._alpha},set:function(e){this._alpha!==e&&(this._alpha=e,this.isPlaying||(this.play(),this.onUpdate(0),this.pause()))}},{key:"autoPlay",get:function(){return this._autoPlay},set:function(e){this._autoPlay=e,e&&this.play()}},{key:"frame",get:function(){return this._frame}},{key:"isPlaying",get:function(){return this._isPlaying}}]),n}(Lt);(function(){z._pivotVector=new wt})();(function(){z._tempRenderers=[]})();O([F],z.prototype,"_clipEndCallbacks",void 0);O([F],z.prototype,"_isPlaying",void 0);O([F],z.prototype,"_curFrame",void 0);O([F],z.prototype,"_frame",void 0);O([F],z.prototype,"_root",void 0);O([F],z.prototype,"_elements",void 0);function ee(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function $(){return $=Object.assign||function(n){for(var i=1;i<arguments.length;i++){var t=arguments[i];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])}return n},$.apply(this,arguments)}function re(a){"@swc/helpers - typeof";return a&&typeof Symbol<"u"&&a.constructor===Symbol?"symbol":typeof a}var X=function(a){A(n,a);function n(t,e,r){var s;s=a.call(this,t)||this,s.refCount=0,s.timePerFrame=1e3/e.fr,s.duration=Math.floor(e.op-e.ip),s.width=e.w,s.height=e.h,s.inPoint=e.ip,s.outPoint=e.op,s.atlas=r,s.layers=e.layers,s.comps=e.assets,s.name=e.nm,s.clips={};var o={},u=ee(s).comps;if(u)for(var h=0,f=u.length;h<f;h++){var l=u[h];l.id&&(o[l.id]=l)}return s._buildTree(s.layers,o),e.lolitaAnimations&&s._parseAnimations(e.lolitaAnimations),s}var i=n.prototype;return i.setClips=function(e){this.clips={},this._parseAnimations(e)},i._parseAnimations=function(e){var r=this;e.forEach(function(s){r.clips[s.name]=$({},s)})},i._buildTree=function(e,r,s,o,u,h){s===void 0&&(s=0),o===void 0&&(o=1),u===void 0&&(u=0),h===void 0&&(h=1);for(var f={},l=0,p=e.length;l<p;l++){var c=e[l],v;f[(v=c.ind)!=null?v:l]=c}for(var _=e.length-1;_>=0;_--){var d=e[_],m=d.refId,y=d.parent;d.offsetTime=s,d.stretch=o;var b;if(d.index=((b=d.ind)!=null?b:_)*h+u,y&&(f[y].layers||(f[y].layers=[]),f[y].layers.push(d),e.splice(_,1)),m&&r[m]){for(var g=[],x=0;x<r[m].layers.length;x++)g.push(this._deepClone(r[m].layers[x]));var E=(d.offsetTime||0)+(d.st||0),P=(d.stretch||1)*(d.sr||1),w=g.length-1,T,M=h/(((T=g[w].ind)!=null?T:w)+1)*h;if(this._buildTree(g,r,E,P,d.index,M),d.layers){var R;(R=d.layers).push.apply(R,[].concat(g))}else d.layers=[].concat(g)}}},i._deepClone=function(e){var r=this,s=Array.isArray(e)?[].concat(e):$({},e);return Reflect.ownKeys(s).map(function(o){s[o]=r._isObject(e[o])?r._deepClone(e[o]):e[o]}),s},i._isObject=function(e){return(typeof e=="object"||typeof e=="function")&&(typeof e>"u"?"undefined":re(e))!==null},i.destroy=function(){var e,r;(e=(r=this.atlas).destroy)==null||e.call(r),this.atlas=null,this.layers=null,this.clips=null,this.comps=null,a.prototype.destroy.call(this)},n}(Tt),pt=function(a){A(n,a);function n(){return a.apply(this,arguments)}var i=n.prototype;return i.load=function(e,r){return new W(function(s,o){var u=e.url;r._request(u,{type:"json"}).then(function(h){var f=h.jsonUrl,l=h.atlasUrl,p=r._request(st.resolveAbsoluteUrl(u,f),r),c=r.load({url:st.resolveAbsoluteUrl(u,l),type:et.SpriteAtlas});W.all([p,c]).then(function(v){var _=v[0],d=v[1],m=r.engine,y=new X(m,_,d);s(y)}).catch(o)}).catch(o)})},n}(tt);pt=O([ct("EditorLottie",["json"])],pt);var ie=function(){function a(i,t){var e=this;this.sprites={},this.assetsPromises=[],this.assetsPromises=i.map(function(r){return t.resourceManager.load({url:r.p,type:et.Texture2D}).then(function(s){var o=new Mt(t);o.texture=s,e.sprites[r.id]=o})})}var n=a.prototype;return n.request=function(){return Promise.all(this.assetsPromises)},n.getSprite=function(t){return this.sprites[t]},a}(),vt=function(a){A(n,a);function n(){return a.apply(this,arguments)}var i=n.prototype;return i.load=function(e,r){var s=e.urls,o=r._request(s[0],{type:"json"});if(s[1]){var u=r.load({url:s[1],type:et.SpriteAtlas});return W.all([o,u]).then(function(h){var f=h[0],l=h[1],p=r.engine,c=new X(p,f,l),v=new q(p),_=v.addComponent(z);return _.resource=c,v})}else return W.all([o]).then(function(h){var f=h[0],l=r.engine,p=f.assets.filter(function(v){return v.p});f.assets=f.assets.filter(function(v){return!v.p});var c=new ie(p,l);return c.request().then(function(){var v=new X(l,f,c),_=new q(l),d=_.addComponent(z);return d.resource=v,_})})},n}(tt);vt=O([ct("lottie",["json"])],vt);tt.registerClass("LottieAnimation",z);export{z as L};
|