@galacean/cli 2.0.0-alpha.26 → 2.0.0-alpha.27

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.
Files changed (91) hide show
  1. package/dist/cli.bundle.cjs +671 -777
  2. package/dist/preview-client/_static/{Accordion-2cd014f1.js → Accordion-4afac60c.js} +1 -1
  3. package/dist/preview-client/_static/{AmbientLightAsset-be9e872c.js → AmbientLightAsset-3825f3bf.js} +2 -2
  4. package/dist/preview-client/_static/{AnimationClipAsset-d7b37af0.js → AnimationClipAsset-660ecb36.js} +1 -1
  5. package/dist/preview-client/_static/{AnimatorControllerAsset-2716497a.js → AnimatorControllerAsset-dcf11a9d.js} +1 -1
  6. package/dist/preview-client/_static/{AnimatorStore-883a28ad.js → AnimatorStore-aa58d85c.js} +1 -1
  7. package/dist/preview-client/_static/{AssetViewer-3847c058.js → AssetViewer-8338dfe1.js} +1 -1
  8. package/dist/preview-client/_static/{AudioAsset-c28f33ab.js → AudioAsset-6e607154.js} +1 -1
  9. package/dist/preview-client/_static/{AudioComponent-3d6c73ce.js → AudioComponent-b70cc31e.js} +1 -1
  10. package/dist/preview-client/_static/{Callout-e2a89f6f.js → Callout-155c30df.js} +1 -1
  11. package/dist/preview-client/_static/{CameraComponent-3dc63451.js → CameraComponent-76bc9102.js} +1 -1
  12. package/dist/preview-client/_static/{Component-0f881fc1.js → Component-398551a0.js} +1 -1
  13. package/dist/preview-client/_static/{DirectLight-96dbba47.js → DirectLight-50653e81.js} +1 -1
  14. package/dist/preview-client/_static/{FontAsset-d34b5378.js → FontAsset-dc385d41.js} +1 -1
  15. package/dist/preview-client/_static/{FormItemArray-b8cda1d2.js → FormItemArray-9ca61884.js} +1 -1
  16. package/dist/preview-client/_static/{GlTFAsset-5970e707.js → GlTFAsset-d2ee4f95.js} +1 -1
  17. package/dist/preview-client/_static/{IconPlus-def01e2b.js → IconPlus-b3ed4c04.js} +1 -1
  18. package/dist/preview-client/_static/{IconPointFilled-62d3c3b2.js → IconPointFilled-3ba6d082.js} +1 -1
  19. package/dist/preview-client/_static/{LightBaseComponent-d651a276.js → LightBaseComponent-4cfc9f48.js} +1 -1
  20. package/dist/preview-client/_static/{LottieAnimationComponent-f10dc558.js → LottieAnimationComponent-aeb555ea.js} +1 -1
  21. package/dist/preview-client/_static/{MarkdownAsset-b2a3fad5.js → MarkdownAsset-02477e7c.js} +1 -1
  22. package/dist/preview-client/_static/{MaterialAsset-5353c4cb.js → MaterialAsset-8f3b3302.js} +1 -1
  23. package/dist/preview-client/_static/{MaterialInspector-8d466d59.js → MaterialInspector-3fb471d9.js} +1 -1
  24. package/dist/preview-client/_static/{Menu-c8e6194b.js → Menu-36c201c0.js} +1 -1
  25. package/dist/preview-client/_static/{MeshAsset-c2bf60c5.js → MeshAsset-3ddf1ac6.js} +1 -1
  26. package/dist/preview-client/_static/{MeshRendererBaseComponent-fde6b6a5.js → MeshRendererBaseComponent-cd8b743b.js} +1 -1
  27. package/dist/preview-client/_static/{MeshRendererComponent-430774ef.js → MeshRendererComponent-17a7fc72.js} +1 -1
  28. package/dist/preview-client/_static/{MeshThumbnail-07ffa076.js → MeshThumbnail-8c20ee92.js} +1 -1
  29. package/dist/preview-client/_static/{ParticleRendererComponent-e106bd8c.js → ParticleRendererComponent-1834a159.js} +3 -3
  30. package/dist/preview-client/_static/{PhysicsMaterialAsset-a2f73b5c.js → PhysicsMaterialAsset-e0491877.js} +1 -1
  31. package/dist/preview-client/_static/{PhysicsStore-818c2f61.js → PhysicsStore-ab32886e.js} +1 -1
  32. package/dist/preview-client/_static/{PointLight-add790ea.js → PointLight-97975350.js} +1 -1
  33. package/dist/preview-client/_static/{PostProcessComponent-af270a77.js → PostProcessComponent-9590ec29.js} +1 -1
  34. package/dist/preview-client/_static/PrefabAsset-2f94de73.js +1 -0
  35. package/dist/preview-client/_static/{PrimitiveMesh-075dda8a.js → PrimitiveMesh-0492d482.js} +1 -1
  36. package/dist/preview-client/_static/{ReferencedMaterial-d11151b5.js → ReferencedMaterial-49a7cbcc.js} +1 -1
  37. package/dist/preview-client/_static/{RenderTargetAsset-b3cd1c49.js → RenderTargetAsset-dc1f9494.js} +1 -1
  38. package/dist/preview-client/_static/{SceneAsset-08752701.js → SceneAsset-c3bb667f.js} +1 -1
  39. package/dist/preview-client/_static/{ShaderAsset-a9d667f5.js → ShaderAsset-f4eead79.js} +12 -12
  40. package/dist/preview-client/_static/{ShaderChunkAsset-e43dde8a.js → ShaderChunkAsset-4bea2733.js} +2 -2
  41. package/dist/preview-client/_static/{ShaderUIScriptAsset-e1cd0b8b.js → ShaderUIScriptAsset-3c731f3b.js} +2 -2
  42. package/dist/preview-client/_static/{SkinnedMeshRendererComponent-9756bd5f.js → SkinnedMeshRendererComponent-e0f9b133.js} +1 -1
  43. package/dist/preview-client/_static/{SpineAnimationComponent-f3e0ff44.js → SpineAnimationComponent-1e1655fd.js} +1 -1
  44. package/dist/preview-client/_static/{SpineSkeletonDataAsset-43b731f1.js → SpineSkeletonDataAsset-afb4afae.js} +1 -1
  45. package/dist/preview-client/_static/{SpotLight-649b0e21.js → SpotLight-69f361c9.js} +1 -1
  46. package/dist/preview-client/_static/{SpriteBaseComponent-d2a7ab4c.js → SpriteBaseComponent-2c2454ea.js} +1 -1
  47. package/dist/preview-client/_static/{SpriteMaskComponent-2c1cef5e.js → SpriteMaskComponent-a7ebcc50.js} +1 -1
  48. package/dist/preview-client/_static/{SpriteRendererComponent-33b71997.js → SpriteRendererComponent-f7604c68.js} +1 -1
  49. package/dist/preview-client/_static/{TextBaseComponent-9310e0c6.js → TextBaseComponent-cd7ad9f7.js} +1 -1
  50. package/dist/preview-client/_static/{TextRendererComponent-8dc0d7fb.js → TextRendererComponent-a5357d52.js} +1 -1
  51. package/dist/preview-client/_static/{TextureAsset-a7ff39b1.js → TextureAsset-ff089b5a.js} +1 -1
  52. package/dist/preview-client/_static/{Tooltip-b5be390f.js → Tooltip-1bcb87b5.js} +1 -1
  53. package/dist/preview-client/_static/{TrailRendererComponent-c4635fab.js → TrailRendererComponent-cdefa368.js} +1 -1
  54. package/dist/preview-client/_static/{TransformBaseComponent-1473deaa.js → TransformBaseComponent-d26ff236.js} +1 -1
  55. package/dist/preview-client/_static/{TransformComponent-e544f7ac.js → TransformComponent-4ec4b7b5.js} +1 -1
  56. package/dist/preview-client/_static/{XRReferenceImageAsset-96f516ba.js → XRReferenceImageAsset-ff82ab30.js} +1 -1
  57. package/dist/preview-client/_static/{audio-b5fbde34.js → audio-0a013eb6.js} +1 -1
  58. package/dist/preview-client/_static/{createOnModelChange-370b83da.js → createOnModelChange-89f572a6.js} +1 -1
  59. package/dist/preview-client/_static/{createReactComponent-58d9f0dd.js → createReactComponent-baa41397.js} +1 -1
  60. package/dist/preview-client/_static/index-0086cabc.js +1 -0
  61. package/dist/preview-client/_static/index-253f9e13.js +1 -0
  62. package/dist/preview-client/_static/{index-da16047f.js → index-29916a80.js} +1 -1
  63. package/dist/preview-client/_static/{index-ab8556cb.js → index-4845b67c.js} +3 -3
  64. package/dist/preview-client/_static/{index-dd0763bf.js → index-5e4dedda.js} +1 -1
  65. package/dist/preview-client/_static/{index-0dd5bb36.js → index-70967035.js} +1 -1
  66. package/dist/preview-client/_static/index-8234e4e2.js +1 -0
  67. package/dist/preview-client/_static/{index-88650db7.js → index-8784a43a.js} +1 -1
  68. package/dist/preview-client/_static/index-94594d06.js +1 -0
  69. package/dist/preview-client/_static/{index-74bcfad9.js → index-a0afef01.js} +1 -1
  70. package/dist/preview-client/_static/index-ad57c6c8.js +1 -0
  71. package/dist/preview-client/_static/{index-c3dec278.js → index-b126bb6b.js} +72 -72
  72. package/dist/preview-client/_static/{index-cdbb2f4d.js → index-c8ed2a45.js} +1 -1
  73. package/dist/preview-client/_static/{index-05b76766.js → index-cd09e78a.js} +1 -1
  74. package/dist/preview-client/_static/index-d1484803.js +1 -0
  75. package/dist/preview-client/_static/index-f7fcda86.js +1 -0
  76. package/dist/preview-client/_static/{ktx2-encoder-db93524f.js → ktx2-encoder-8498815e.js} +1 -1
  77. package/dist/preview-client/_static/{module-ada3dced.js → module-113ac03a.js} +1 -1
  78. package/dist/preview-client/_static/{module-ec094ef6.js → module-83a57161.js} +1 -1
  79. package/dist/preview-client/_static/{module-de7ee724.js → module-8efda49c.js} +1 -1
  80. package/dist/preview-client/_static/{postmen-2853c0e6.js → postmen-3b48c572.js} +2 -2
  81. package/dist/preview-client/_static/{shader-data-utils-f0e4f5a3.js → shader-data-utils-c90e48b8.js} +1 -1
  82. package/dist/preview-client/index.html +1 -1
  83. package/package.json +29 -24
  84. package/dist/preview-client/_static/PrefabAsset-59743dbb.js +0 -1
  85. package/dist/preview-client/_static/index-29c59aff.js +0 -1
  86. package/dist/preview-client/_static/index-3680d0e0.js +0 -1
  87. package/dist/preview-client/_static/index-42aa3a49.js +0 -1
  88. package/dist/preview-client/_static/index-496f331d.js +0 -1
  89. package/dist/preview-client/_static/index-9f0122f0.js +0 -1
  90. package/dist/preview-client/_static/index-c6b7045c.js +0 -1
  91. package/dist/preview-client/_static/index-dddcae01.js +0 -1
@@ -1 +1 @@
1
- import{F as wt,G as ct,H as tt,I as bt,J as V,K as q,N as it,T as xt,O as Pt,Q as St,U as nt,W as zt,a as At,S as Lt,X as W,Y as st,Z as et,_ as Tt,$ as Mt}from"./index-c3dec278.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,Ft=10,D=11,N=1/(D-1),Vt=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<Ft);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=Vt?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 $={};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(!$[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}$[s]={segmentLength:o,points:h}}return $[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 Ht(a){return a.x&&mt.test(a.x)}function Jt(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 H={hasSupportExpression:Ht,getExpression:Jt},Q=function(){function a(i,t){this.mult=t||1,this.value=i.k,this.animated=i.a,H.hasSupportExpression(i)&&(this.expression=H.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}(),Qt=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}(Q),Zt=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}(Q),$t=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,H.hasSupportExpression(t)&&(r.expression=H.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}(Q),kt=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 F=0,Z=this.v.length;F<Z;F++)this.v[F]=s[F]*this.mult},n}(Q),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 Zt(t,r):e?new kt(t,r,t.k[t.k.length-1].t-t.k[0].t):new $t(t,r):new Qt(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}(),k=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 k(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 k(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 k(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,F=j.r,Z=j.g,Et=j.b;p.color.set(F,Z,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([V],z.prototype,"_clipEndCallbacks",void 0);O([V],z.prototype,"_isPlaying",void 0);O([V],z.prototype,"_curFrame",void 0);O([V],z.prototype,"_frame",void 0);O([V],z.prototype,"_root",void 0);O([V],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 J(){return J=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},J.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]=J({},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):J({},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{F as wt,G as ct,H as tt,I as bt,J as V,K as q,N as it,T as xt,O as Pt,Q as St,U as nt,W as zt,a as At,S as Lt,X as W,Y as st,Z as et,_ as Tt,$ as Mt}from"./index-b126bb6b.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,Ft=10,D=11,N=1/(D-1),Vt=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<Ft);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=Vt?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 $={};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(!$[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}$[s]={segmentLength:o,points:h}}return $[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 Ht(a){return a.x&&mt.test(a.x)}function Jt(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 H={hasSupportExpression:Ht,getExpression:Jt},Q=function(){function a(i,t){this.mult=t||1,this.value=i.k,this.animated=i.a,H.hasSupportExpression(i)&&(this.expression=H.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}(),Qt=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}(Q),Zt=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}(Q),$t=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,H.hasSupportExpression(t)&&(r.expression=H.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}(Q),kt=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 F=0,Z=this.v.length;F<Z;F++)this.v[F]=s[F]*this.mult},n}(Q),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 Zt(t,r):e?new kt(t,r,t.k[t.k.length-1].t-t.k[0].t):new $t(t,r):new Qt(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}(),k=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 k(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 k(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 k(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,F=j.r,Z=j.g,Et=j.b;p.color.set(F,Z,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([V],z.prototype,"_clipEndCallbacks",void 0);O([V],z.prototype,"_isPlaying",void 0);O([V],z.prototype,"_curFrame",void 0);O([V],z.prototype,"_frame",void 0);O([V],z.prototype,"_root",void 0);O([V],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 J(){return J=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},J.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]=J({},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):J({},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 +1 @@
1
- import{G as de,al as he,am as me,an as pe,ao as ve,F as Se,ai as v,X as ue,ap as we,H as ke,aq as q,ar as U,b as B,as as Q,at as be,au as ye}from"./index-c3dec278.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?B.Color:B.None:B.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,j=0,ge=Y.length;j<ge;j++){var C=Y[j],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{G as de,al as he,am as me,an as pe,ao as ve,F as Se,ai as v,X as ue,ap as we,H as ke,aq as q,ar as U,b as B,as as Q,at as be,au as ye}from"./index-b126bb6b.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?B.Color:B.None:B.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,j=0,ge=Y.length;j<ge;j++){var C=Y[j],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,2 +1,2 @@
1
- import{fq as rr}from"./index-c3dec278.js";import"./index-cdbb2f4d.js";var Ie={exports:{}},$e=function(r,n){return function(){for(var t=new Array(arguments.length),a=0;a<t.length;a++)t[a]=arguments[a];return r.apply(n,t)}},tr=$e,w=Object.prototype.toString;function ae(e){return Array.isArray(e)}function te(e){return typeof e>"u"}function nr(e){return e!==null&&!te(e)&&e.constructor!==null&&!te(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function _e(e){return w.call(e)==="[object ArrayBuffer]"}function ir(e){return w.call(e)==="[object FormData]"}function ar(e){var r;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?r=ArrayBuffer.isView(e):r=e&&e.buffer&&_e(e.buffer),r}function sr(e){return typeof e=="string"}function or(e){return typeof e=="number"}function Fe(e){return e!==null&&typeof e=="object"}function N(e){if(w.call(e)!=="[object Object]")return!1;var r=Object.getPrototypeOf(e);return r===null||r===Object.prototype}function ur(e){return w.call(e)==="[object Date]"}function fr(e){return w.call(e)==="[object File]"}function cr(e){return w.call(e)==="[object Blob]"}function ke(e){return w.call(e)==="[object Function]"}function lr(e){return Fe(e)&&ke(e.pipe)}function dr(e){return w.call(e)==="[object URLSearchParams]"}function hr(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function pr(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function se(e,r){if(!(e===null||typeof e>"u"))if(typeof e!="object"&&(e=[e]),ae(e))for(var n=0,i=e.length;n<i;n++)r.call(null,e[n],n,e);else for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.call(null,e[t],t,e)}function ne(){var e={};function r(t,a){N(e[a])&&N(t)?e[a]=ne(e[a],t):N(t)?e[a]=ne({},t):ae(t)?e[a]=t.slice():e[a]=t}for(var n=0,i=arguments.length;n<i;n++)se(arguments[n],r);return e}function mr(e,r,n){return se(r,function(t,a){n&&typeof t=="function"?e[a]=tr(t,n):e[a]=t}),e}function vr(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}var p={isArray:ae,isArrayBuffer:_e,isBuffer:nr,isFormData:ir,isArrayBufferView:ar,isString:sr,isNumber:or,isObject:Fe,isPlainObject:N,isUndefined:te,isDate:ur,isFile:fr,isBlob:cr,isFunction:ke,isStream:lr,isURLSearchParams:dr,isStandardBrowserEnv:pr,forEach:se,merge:ne,extend:mr,trim:hr,stripBOM:vr},O=p;function he(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var He=function(r,n,i){if(!n)return r;var t;if(i)t=i(n);else if(O.isURLSearchParams(n))t=n.toString();else{var a=[];O.forEach(n,function(c,d){c===null||typeof c>"u"||(O.isArray(c)?d=d+"[]":c=[c],O.forEach(c,function(u){O.isDate(u)?u=u.toISOString():O.isObject(u)&&(u=JSON.stringify(u)),a.push(he(d)+"="+he(u))}))}),t=a.join("&")}if(t){var s=r.indexOf("#");s!==-1&&(r=r.slice(0,s)),r+=(r.indexOf("?")===-1?"?":"&")+t}return r},br=p;function L(){this.handlers=[]}L.prototype.use=function(r,n,i){return this.handlers.push({fulfilled:r,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1};L.prototype.eject=function(r){this.handlers[r]&&(this.handlers[r]=null)};L.prototype.forEach=function(r){br.forEach(this.handlers,function(i){i!==null&&r(i)})};var Er=L,yr=p,wr=function(r,n){yr.forEach(r,function(t,a){a!==n&&a.toUpperCase()===n.toUpperCase()&&(r[n]=t,delete r[a])})},Me=function(r,n,i,t,a){return r.config=n,i&&(r.code=i),r.request=t,r.response=a,r.isAxiosError=!0,r.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},r},Je={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_,pe;function ze(){if(pe)return _;pe=1;var e=Me;return _=function(n,i,t,a,s){var o=new Error(n);return e(o,i,t,a,s)},_}var F,me;function Rr(){if(me)return F;me=1;var e=ze();return F=function(n,i,t){var a=t.config.validateStatus;!t.status||!a||a(t.status)?n(t):i(e("Request failed with status code "+t.status,t.config,null,t.request,t))},F}var k,ve;function Cr(){if(ve)return k;ve=1;var e=p;return k=e.isStandardBrowserEnv()?function(){return{write:function(i,t,a,s,o,c){var d=[];d.push(i+"="+encodeURIComponent(t)),e.isNumber(a)&&d.push("expires="+new Date(a).toGMTString()),e.isString(s)&&d.push("path="+s),e.isString(o)&&d.push("domain="+o),c===!0&&d.push("secure"),document.cookie=d.join("; ")},read:function(i){var t=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(i){this.write(i,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),k}var H,be;function Sr(){return be||(be=1,H=function(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}),H}var M,Ee;function Or(){return Ee||(Ee=1,M=function(r,n){return n?r.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):r}),M}var J,ye;function xr(){if(ye)return J;ye=1;var e=Sr(),r=Or();return J=function(i,t){return i&&!e(t)?r(i,t):t},J}var z,we;function qr(){if(we)return z;we=1;var e=p,r=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return z=function(i){var t={},a,s,o;return i&&e.forEach(i.split(`
2
- `),function(d){if(o=d.indexOf(":"),a=e.trim(d.substr(0,o)).toLowerCase(),s=e.trim(d.substr(o+1)),a){if(t[a]&&r.indexOf(a)>=0)return;a==="set-cookie"?t[a]=(t[a]?t[a]:[]).concat([s]):t[a]=t[a]?t[a]+", "+s:s}}),t},z}var V,Re;function gr(){if(Re)return V;Re=1;var e=p;return V=e.isStandardBrowserEnv()?function(){var n=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a"),t;function a(s){var o=s;return n&&(i.setAttribute("href",o),o=i.href),i.setAttribute("href",o),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}return t=a(window.location.href),function(o){var c=e.isString(o)?a(o):o;return c.protocol===t.protocol&&c.host===t.host}}():function(){return function(){return!0}}(),V}var X,Ce;function j(){if(Ce)return X;Ce=1;function e(r){this.message=r}return e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,X=e,X}var W,Se;function Oe(){if(Se)return W;Se=1;var e=p,r=Rr(),n=Cr(),i=He,t=xr(),a=qr(),s=gr(),o=ze(),c=Je,d=j();return W=function(u){return new Promise(function(m,q){var g=u.data,A=u.headers,U=u.responseType,C;function fe(){u.cancelToken&&u.cancelToken.unsubscribe(C),u.signal&&u.signal.removeEventListener("abort",C)}e.isFormData(g)&&delete A["Content-Type"];var f=new XMLHttpRequest;if(u.auth){var Qe=u.auth.username||"",Ze=u.auth.password?unescape(encodeURIComponent(u.auth.password)):"";A.Authorization="Basic "+btoa(Qe+":"+Ze)}var ce=t(u.baseURL,u.url);f.open(u.method.toUpperCase(),i(ce,u.params,u.paramsSerializer),!0),f.timeout=u.timeout;function le(){if(f){var b="getAllResponseHeaders"in f?a(f.getAllResponseHeaders()):null,S=!U||U==="text"||U==="json"?f.responseText:f.response,R={data:S,status:f.status,statusText:f.statusText,headers:b,config:u,request:f};r(function($){m($),fe()},function($){q($),fe()},R),f=null}}if("onloadend"in f?f.onloadend=le:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(le)},f.onabort=function(){f&&(q(o("Request aborted",u,"ECONNABORTED",f)),f=null)},f.onerror=function(){q(o("Network Error",u,null,f)),f=null},f.ontimeout=function(){var S=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded",R=u.transitional||c;u.timeoutErrorMessage&&(S=u.timeoutErrorMessage),q(o(S,u,R.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},e.isStandardBrowserEnv()){var de=(u.withCredentials||s(ce))&&u.xsrfCookieName?n.read(u.xsrfCookieName):void 0;de&&(A[u.xsrfHeaderName]=de)}"setRequestHeader"in f&&e.forEach(A,function(S,R){typeof g>"u"&&R.toLowerCase()==="content-type"?delete A[R]:f.setRequestHeader(R,S)}),e.isUndefined(u.withCredentials)||(f.withCredentials=!!u.withCredentials),U&&U!=="json"&&(f.responseType=u.responseType),typeof u.onDownloadProgress=="function"&&f.addEventListener("progress",u.onDownloadProgress),typeof u.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",u.onUploadProgress),(u.cancelToken||u.signal)&&(C=function(b){f&&(q(!b||b&&b.type?new d("canceled"):b),f.abort(),f=null)},u.cancelToken&&u.cancelToken.subscribe(C),u.signal&&(u.signal.aborted?C():u.signal.addEventListener("abort",C))),g||(g=null),f.send(g)})},W}var h=p,xe=wr,Ar=Me,Ur=Je,Tr={"Content-Type":"application/x-www-form-urlencoded"};function qe(e,r){!h.isUndefined(e)&&h.isUndefined(e["Content-Type"])&&(e["Content-Type"]=r)}function Pr(){var e;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(e=Oe()),e}function Nr(e,r,n){if(h.isString(e))try{return(r||JSON.parse)(e),h.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(e)}var D={transitional:Ur,adapter:Pr(),transformRequest:[function(r,n){return xe(n,"Accept"),xe(n,"Content-Type"),h.isFormData(r)||h.isArrayBuffer(r)||h.isBuffer(r)||h.isStream(r)||h.isFile(r)||h.isBlob(r)?r:h.isArrayBufferView(r)?r.buffer:h.isURLSearchParams(r)?(qe(n,"application/x-www-form-urlencoded;charset=utf-8"),r.toString()):h.isObject(r)||n&&n["Content-Type"]==="application/json"?(qe(n,"application/json"),Nr(r)):r}],transformResponse:[function(r){var n=this.transitional||D.transitional,i=n&&n.silentJSONParsing,t=n&&n.forcedJSONParsing,a=!i&&this.responseType==="json";if(a||t&&h.isString(r)&&r.length)try{return JSON.parse(r)}catch(s){if(a)throw s.name==="SyntaxError"?Ar(s,this,"E_JSON_PARSE"):s}return r}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(r){return r>=200&&r<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};h.forEach(["delete","get","head"],function(r){D.headers[r]={}});h.forEach(["post","put","patch"],function(r){D.headers[r]=h.merge(Tr)});var oe=D,Br=p,Lr=oe,jr=function(r,n,i){var t=this||Lr;return Br.forEach(i,function(s){r=s.call(t,r,n)}),r},G,ge;function Ve(){return ge||(ge=1,G=function(r){return!!(r&&r.__CANCEL__)}),G}var Ae=p,K=jr,Dr=Ve(),Ir=oe,$r=j();function Y(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new $r("canceled")}var _r=function(r){Y(r),r.headers=r.headers||{},r.data=K.call(r,r.data,r.headers,r.transformRequest),r.headers=Ae.merge(r.headers.common||{},r.headers[r.method]||{},r.headers),Ae.forEach(["delete","get","head","post","put","patch","common"],function(t){delete r.headers[t]});var n=r.adapter||Ir.adapter;return n(r).then(function(t){return Y(r),t.data=K.call(r,t.data,t.headers,r.transformResponse),t},function(t){return Dr(t)||(Y(r),t&&t.response&&(t.response.data=K.call(r,t.response.data,t.response.headers,r.transformResponse))),Promise.reject(t)})},v=p,Xe=function(r,n){n=n||{};var i={};function t(l,u){return v.isPlainObject(l)&&v.isPlainObject(u)?v.merge(l,u):v.isPlainObject(u)?v.merge({},u):v.isArray(u)?u.slice():u}function a(l){if(v.isUndefined(n[l])){if(!v.isUndefined(r[l]))return t(void 0,r[l])}else return t(r[l],n[l])}function s(l){if(!v.isUndefined(n[l]))return t(void 0,n[l])}function o(l){if(v.isUndefined(n[l])){if(!v.isUndefined(r[l]))return t(void 0,r[l])}else return t(void 0,n[l])}function c(l){if(l in n)return t(r[l],n[l]);if(l in r)return t(void 0,r[l])}var d={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c};return v.forEach(Object.keys(r).concat(Object.keys(n)),function(u){var y=d[u]||a,m=y(u);v.isUndefined(m)&&y!==c||(i[u]=m)}),i},Q,Ue;function We(){return Ue||(Ue=1,Q={version:"0.26.1"}),Q}var Fr=We().version,ue={};["object","boolean","number","function","string","symbol"].forEach(function(e,r){ue[e]=function(i){return typeof i===e||"a"+(r<1?"n ":" ")+e}});var Te={};ue.transitional=function(r,n,i){function t(a,s){return"[Axios v"+Fr+"] Transitional option '"+a+"'"+s+(i?". "+i:"")}return function(a,s,o){if(r===!1)throw new Error(t(s," has been removed"+(n?" in "+n:"")));return n&&!Te[s]&&(Te[s]=!0,console.warn(t(s," has been deprecated since v"+n+" and will be removed in the near future"))),r?r(a,s,o):!0}};function kr(e,r,n){if(typeof e!="object")throw new TypeError("options must be an object");for(var i=Object.keys(e),t=i.length;t-- >0;){var a=i[t],s=r[a];if(s){var o=e[a],c=o===void 0||s(o,a,e);if(c!==!0)throw new TypeError("option "+a+" must be "+c);continue}if(n!==!0)throw Error("Unknown option "+a)}}var Hr={assertOptions:kr,validators:ue},Ge=p,Mr=He,Pe=Er,Ne=_r,I=Xe,Ke=Hr,x=Ke.validators;function T(e){this.defaults=e,this.interceptors={request:new Pe,response:new Pe}}T.prototype.request=function(r,n){typeof r=="string"?(n=n||{},n.url=r):n=r||{},n=I(this.defaults,n),n.method?n.method=n.method.toLowerCase():this.defaults.method?n.method=this.defaults.method.toLowerCase():n.method="get";var i=n.transitional;i!==void 0&&Ke.assertOptions(i,{silentJSONParsing:x.transitional(x.boolean),forcedJSONParsing:x.transitional(x.boolean),clarifyTimeoutError:x.transitional(x.boolean)},!1);var t=[],a=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(a=a&&m.synchronous,t.unshift(m.fulfilled,m.rejected))});var s=[];this.interceptors.response.forEach(function(m){s.push(m.fulfilled,m.rejected)});var o;if(!a){var c=[Ne,void 0];for(Array.prototype.unshift.apply(c,t),c=c.concat(s),o=Promise.resolve(n);c.length;)o=o.then(c.shift(),c.shift());return o}for(var d=n;t.length;){var l=t.shift(),u=t.shift();try{d=l(d)}catch(y){u(y);break}}try{o=Ne(d)}catch(y){return Promise.reject(y)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};T.prototype.getUri=function(r){return r=I(this.defaults,r),Mr(r.url,r.params,r.paramsSerializer).replace(/^\?/,"")};Ge.forEach(["delete","get","head","options"],function(r){T.prototype[r]=function(n,i){return this.request(I(i||{},{method:r,url:n,data:(i||{}).data}))}});Ge.forEach(["post","put","patch"],function(r){T.prototype[r]=function(n,i,t){return this.request(I(t||{},{method:r,url:n,data:i}))}});var Jr=T,Z,Be;function zr(){if(Be)return Z;Be=1;var e=j();function r(n){if(typeof n!="function")throw new TypeError("executor must be a function.");var i;this.promise=new Promise(function(s){i=s});var t=this;this.promise.then(function(a){if(t._listeners){var s,o=t._listeners.length;for(s=0;s<o;s++)t._listeners[s](a);t._listeners=null}}),this.promise.then=function(a){var s,o=new Promise(function(c){t.subscribe(c),s=c}).then(a);return o.cancel=function(){t.unsubscribe(s)},o},n(function(s){t.reason||(t.reason=new e(s),i(t.reason))})}return r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.prototype.subscribe=function(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]},r.prototype.unsubscribe=function(i){if(this._listeners){var t=this._listeners.indexOf(i);t!==-1&&this._listeners.splice(t,1)}},r.source=function(){var i,t=new r(function(s){i=s});return{token:t,cancel:i}},Z=r,Z}var ee,Le;function Vr(){return Le||(Le=1,ee=function(r){return function(i){return r.apply(null,i)}}),ee}var re,je;function Xr(){if(je)return re;je=1;var e=p;return re=function(n){return e.isObject(n)&&n.isAxiosError===!0},re}var De=p,Wr=$e,B=Jr,Gr=Xe,Kr=oe;function Ye(e){var r=new B(e),n=Wr(B.prototype.request,r);return De.extend(n,B.prototype,r),De.extend(n,r),n.create=function(t){return Ye(Gr(e,t))},n}var E=Ye(Kr);E.Axios=B;E.Cancel=j();E.CancelToken=zr();E.isCancel=Ve();E.VERSION=We().version;E.all=function(r){return Promise.all(r)};E.spread=Vr();E.isAxiosError=Xr();Ie.exports=E;Ie.exports.default=E;/*! js-cookie v3.0.1 | MIT */function P(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var i in n)e[i]=n[i]}return e}var Yr={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function ie(e,r){function n(t,a,s){if(!(typeof document>"u")){s=P({},r,s),typeof s.expires=="number"&&(s.expires=new Date(Date.now()+s.expires*864e5)),s.expires&&(s.expires=s.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var c in s)s[c]&&(o+="; "+c,s[c]!==!0&&(o+="="+s[c].split(";")[0]));return document.cookie=t+"="+e.write(a,t)+o}}function i(t){if(!(typeof document>"u"||arguments.length&&!t)){for(var a=document.cookie?document.cookie.split("; "):[],s={},o=0;o<a.length;o++){var c=a[o].split("="),d=c.slice(1).join("=");try{var l=decodeURIComponent(c[0]);if(s[l]=e.read(d,l),t===l)break}catch{}}return t?s[t]:s}}return Object.create({set:n,get:i,remove:function(t,a){n(t,"",P({},a,{expires:-1}))},withAttributes:function(t){return ie(this.converter,P({},this.attributes,t))},withConverter:function(t){return ie(P({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(e)}})}ie(Yr,{path:"/"});rr.createPublisher();
1
+ import{fs as rr}from"./index-b126bb6b.js";import"./index-c8ed2a45.js";var Ie={exports:{}},$e=function(r,n){return function(){for(var t=new Array(arguments.length),a=0;a<t.length;a++)t[a]=arguments[a];return r.apply(n,t)}},tr=$e,w=Object.prototype.toString;function ae(e){return Array.isArray(e)}function te(e){return typeof e>"u"}function nr(e){return e!==null&&!te(e)&&e.constructor!==null&&!te(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function _e(e){return w.call(e)==="[object ArrayBuffer]"}function ir(e){return w.call(e)==="[object FormData]"}function ar(e){var r;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?r=ArrayBuffer.isView(e):r=e&&e.buffer&&_e(e.buffer),r}function sr(e){return typeof e=="string"}function or(e){return typeof e=="number"}function Fe(e){return e!==null&&typeof e=="object"}function N(e){if(w.call(e)!=="[object Object]")return!1;var r=Object.getPrototypeOf(e);return r===null||r===Object.prototype}function ur(e){return w.call(e)==="[object Date]"}function fr(e){return w.call(e)==="[object File]"}function cr(e){return w.call(e)==="[object Blob]"}function ke(e){return w.call(e)==="[object Function]"}function lr(e){return Fe(e)&&ke(e.pipe)}function dr(e){return w.call(e)==="[object URLSearchParams]"}function hr(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function pr(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function se(e,r){if(!(e===null||typeof e>"u"))if(typeof e!="object"&&(e=[e]),ae(e))for(var n=0,i=e.length;n<i;n++)r.call(null,e[n],n,e);else for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.call(null,e[t],t,e)}function ne(){var e={};function r(t,a){N(e[a])&&N(t)?e[a]=ne(e[a],t):N(t)?e[a]=ne({},t):ae(t)?e[a]=t.slice():e[a]=t}for(var n=0,i=arguments.length;n<i;n++)se(arguments[n],r);return e}function mr(e,r,n){return se(r,function(t,a){n&&typeof t=="function"?e[a]=tr(t,n):e[a]=t}),e}function vr(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}var p={isArray:ae,isArrayBuffer:_e,isBuffer:nr,isFormData:ir,isArrayBufferView:ar,isString:sr,isNumber:or,isObject:Fe,isPlainObject:N,isUndefined:te,isDate:ur,isFile:fr,isBlob:cr,isFunction:ke,isStream:lr,isURLSearchParams:dr,isStandardBrowserEnv:pr,forEach:se,merge:ne,extend:mr,trim:hr,stripBOM:vr},O=p;function he(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var He=function(r,n,i){if(!n)return r;var t;if(i)t=i(n);else if(O.isURLSearchParams(n))t=n.toString();else{var a=[];O.forEach(n,function(c,d){c===null||typeof c>"u"||(O.isArray(c)?d=d+"[]":c=[c],O.forEach(c,function(u){O.isDate(u)?u=u.toISOString():O.isObject(u)&&(u=JSON.stringify(u)),a.push(he(d)+"="+he(u))}))}),t=a.join("&")}if(t){var s=r.indexOf("#");s!==-1&&(r=r.slice(0,s)),r+=(r.indexOf("?")===-1?"?":"&")+t}return r},br=p;function L(){this.handlers=[]}L.prototype.use=function(r,n,i){return this.handlers.push({fulfilled:r,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1};L.prototype.eject=function(r){this.handlers[r]&&(this.handlers[r]=null)};L.prototype.forEach=function(r){br.forEach(this.handlers,function(i){i!==null&&r(i)})};var Er=L,yr=p,wr=function(r,n){yr.forEach(r,function(t,a){a!==n&&a.toUpperCase()===n.toUpperCase()&&(r[n]=t,delete r[a])})},Me=function(r,n,i,t,a){return r.config=n,i&&(r.code=i),r.request=t,r.response=a,r.isAxiosError=!0,r.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},r},Je={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_,pe;function ze(){if(pe)return _;pe=1;var e=Me;return _=function(n,i,t,a,s){var o=new Error(n);return e(o,i,t,a,s)},_}var F,me;function Rr(){if(me)return F;me=1;var e=ze();return F=function(n,i,t){var a=t.config.validateStatus;!t.status||!a||a(t.status)?n(t):i(e("Request failed with status code "+t.status,t.config,null,t.request,t))},F}var k,ve;function Cr(){if(ve)return k;ve=1;var e=p;return k=e.isStandardBrowserEnv()?function(){return{write:function(i,t,a,s,o,c){var d=[];d.push(i+"="+encodeURIComponent(t)),e.isNumber(a)&&d.push("expires="+new Date(a).toGMTString()),e.isString(s)&&d.push("path="+s),e.isString(o)&&d.push("domain="+o),c===!0&&d.push("secure"),document.cookie=d.join("; ")},read:function(i){var t=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(i){this.write(i,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),k}var H,be;function Sr(){return be||(be=1,H=function(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}),H}var M,Ee;function Or(){return Ee||(Ee=1,M=function(r,n){return n?r.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):r}),M}var J,ye;function xr(){if(ye)return J;ye=1;var e=Sr(),r=Or();return J=function(i,t){return i&&!e(t)?r(i,t):t},J}var z,we;function gr(){if(we)return z;we=1;var e=p,r=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return z=function(i){var t={},a,s,o;return i&&e.forEach(i.split(`
2
+ `),function(d){if(o=d.indexOf(":"),a=e.trim(d.substr(0,o)).toLowerCase(),s=e.trim(d.substr(o+1)),a){if(t[a]&&r.indexOf(a)>=0)return;a==="set-cookie"?t[a]=(t[a]?t[a]:[]).concat([s]):t[a]=t[a]?t[a]+", "+s:s}}),t},z}var V,Re;function qr(){if(Re)return V;Re=1;var e=p;return V=e.isStandardBrowserEnv()?function(){var n=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a"),t;function a(s){var o=s;return n&&(i.setAttribute("href",o),o=i.href),i.setAttribute("href",o),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}return t=a(window.location.href),function(o){var c=e.isString(o)?a(o):o;return c.protocol===t.protocol&&c.host===t.host}}():function(){return function(){return!0}}(),V}var X,Ce;function j(){if(Ce)return X;Ce=1;function e(r){this.message=r}return e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,X=e,X}var W,Se;function Oe(){if(Se)return W;Se=1;var e=p,r=Rr(),n=Cr(),i=He,t=xr(),a=gr(),s=qr(),o=ze(),c=Je,d=j();return W=function(u){return new Promise(function(m,g){var q=u.data,A=u.headers,U=u.responseType,C;function fe(){u.cancelToken&&u.cancelToken.unsubscribe(C),u.signal&&u.signal.removeEventListener("abort",C)}e.isFormData(q)&&delete A["Content-Type"];var f=new XMLHttpRequest;if(u.auth){var Qe=u.auth.username||"",Ze=u.auth.password?unescape(encodeURIComponent(u.auth.password)):"";A.Authorization="Basic "+btoa(Qe+":"+Ze)}var ce=t(u.baseURL,u.url);f.open(u.method.toUpperCase(),i(ce,u.params,u.paramsSerializer),!0),f.timeout=u.timeout;function le(){if(f){var b="getAllResponseHeaders"in f?a(f.getAllResponseHeaders()):null,S=!U||U==="text"||U==="json"?f.responseText:f.response,R={data:S,status:f.status,statusText:f.statusText,headers:b,config:u,request:f};r(function($){m($),fe()},function($){g($),fe()},R),f=null}}if("onloadend"in f?f.onloadend=le:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(le)},f.onabort=function(){f&&(g(o("Request aborted",u,"ECONNABORTED",f)),f=null)},f.onerror=function(){g(o("Network Error",u,null,f)),f=null},f.ontimeout=function(){var S=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded",R=u.transitional||c;u.timeoutErrorMessage&&(S=u.timeoutErrorMessage),g(o(S,u,R.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},e.isStandardBrowserEnv()){var de=(u.withCredentials||s(ce))&&u.xsrfCookieName?n.read(u.xsrfCookieName):void 0;de&&(A[u.xsrfHeaderName]=de)}"setRequestHeader"in f&&e.forEach(A,function(S,R){typeof q>"u"&&R.toLowerCase()==="content-type"?delete A[R]:f.setRequestHeader(R,S)}),e.isUndefined(u.withCredentials)||(f.withCredentials=!!u.withCredentials),U&&U!=="json"&&(f.responseType=u.responseType),typeof u.onDownloadProgress=="function"&&f.addEventListener("progress",u.onDownloadProgress),typeof u.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",u.onUploadProgress),(u.cancelToken||u.signal)&&(C=function(b){f&&(g(!b||b&&b.type?new d("canceled"):b),f.abort(),f=null)},u.cancelToken&&u.cancelToken.subscribe(C),u.signal&&(u.signal.aborted?C():u.signal.addEventListener("abort",C))),q||(q=null),f.send(q)})},W}var h=p,xe=wr,Ar=Me,Ur=Je,Tr={"Content-Type":"application/x-www-form-urlencoded"};function ge(e,r){!h.isUndefined(e)&&h.isUndefined(e["Content-Type"])&&(e["Content-Type"]=r)}function Pr(){var e;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(e=Oe()),e}function Nr(e,r,n){if(h.isString(e))try{return(r||JSON.parse)(e),h.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(e)}var D={transitional:Ur,adapter:Pr(),transformRequest:[function(r,n){return xe(n,"Accept"),xe(n,"Content-Type"),h.isFormData(r)||h.isArrayBuffer(r)||h.isBuffer(r)||h.isStream(r)||h.isFile(r)||h.isBlob(r)?r:h.isArrayBufferView(r)?r.buffer:h.isURLSearchParams(r)?(ge(n,"application/x-www-form-urlencoded;charset=utf-8"),r.toString()):h.isObject(r)||n&&n["Content-Type"]==="application/json"?(ge(n,"application/json"),Nr(r)):r}],transformResponse:[function(r){var n=this.transitional||D.transitional,i=n&&n.silentJSONParsing,t=n&&n.forcedJSONParsing,a=!i&&this.responseType==="json";if(a||t&&h.isString(r)&&r.length)try{return JSON.parse(r)}catch(s){if(a)throw s.name==="SyntaxError"?Ar(s,this,"E_JSON_PARSE"):s}return r}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(r){return r>=200&&r<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};h.forEach(["delete","get","head"],function(r){D.headers[r]={}});h.forEach(["post","put","patch"],function(r){D.headers[r]=h.merge(Tr)});var oe=D,Br=p,Lr=oe,jr=function(r,n,i){var t=this||Lr;return Br.forEach(i,function(s){r=s.call(t,r,n)}),r},G,qe;function Ve(){return qe||(qe=1,G=function(r){return!!(r&&r.__CANCEL__)}),G}var Ae=p,K=jr,Dr=Ve(),Ir=oe,$r=j();function Y(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new $r("canceled")}var _r=function(r){Y(r),r.headers=r.headers||{},r.data=K.call(r,r.data,r.headers,r.transformRequest),r.headers=Ae.merge(r.headers.common||{},r.headers[r.method]||{},r.headers),Ae.forEach(["delete","get","head","post","put","patch","common"],function(t){delete r.headers[t]});var n=r.adapter||Ir.adapter;return n(r).then(function(t){return Y(r),t.data=K.call(r,t.data,t.headers,r.transformResponse),t},function(t){return Dr(t)||(Y(r),t&&t.response&&(t.response.data=K.call(r,t.response.data,t.response.headers,r.transformResponse))),Promise.reject(t)})},v=p,Xe=function(r,n){n=n||{};var i={};function t(l,u){return v.isPlainObject(l)&&v.isPlainObject(u)?v.merge(l,u):v.isPlainObject(u)?v.merge({},u):v.isArray(u)?u.slice():u}function a(l){if(v.isUndefined(n[l])){if(!v.isUndefined(r[l]))return t(void 0,r[l])}else return t(r[l],n[l])}function s(l){if(!v.isUndefined(n[l]))return t(void 0,n[l])}function o(l){if(v.isUndefined(n[l])){if(!v.isUndefined(r[l]))return t(void 0,r[l])}else return t(void 0,n[l])}function c(l){if(l in n)return t(r[l],n[l]);if(l in r)return t(void 0,r[l])}var d={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c};return v.forEach(Object.keys(r).concat(Object.keys(n)),function(u){var y=d[u]||a,m=y(u);v.isUndefined(m)&&y!==c||(i[u]=m)}),i},Q,Ue;function We(){return Ue||(Ue=1,Q={version:"0.26.1"}),Q}var Fr=We().version,ue={};["object","boolean","number","function","string","symbol"].forEach(function(e,r){ue[e]=function(i){return typeof i===e||"a"+(r<1?"n ":" ")+e}});var Te={};ue.transitional=function(r,n,i){function t(a,s){return"[Axios v"+Fr+"] Transitional option '"+a+"'"+s+(i?". "+i:"")}return function(a,s,o){if(r===!1)throw new Error(t(s," has been removed"+(n?" in "+n:"")));return n&&!Te[s]&&(Te[s]=!0,console.warn(t(s," has been deprecated since v"+n+" and will be removed in the near future"))),r?r(a,s,o):!0}};function kr(e,r,n){if(typeof e!="object")throw new TypeError("options must be an object");for(var i=Object.keys(e),t=i.length;t-- >0;){var a=i[t],s=r[a];if(s){var o=e[a],c=o===void 0||s(o,a,e);if(c!==!0)throw new TypeError("option "+a+" must be "+c);continue}if(n!==!0)throw Error("Unknown option "+a)}}var Hr={assertOptions:kr,validators:ue},Ge=p,Mr=He,Pe=Er,Ne=_r,I=Xe,Ke=Hr,x=Ke.validators;function T(e){this.defaults=e,this.interceptors={request:new Pe,response:new Pe}}T.prototype.request=function(r,n){typeof r=="string"?(n=n||{},n.url=r):n=r||{},n=I(this.defaults,n),n.method?n.method=n.method.toLowerCase():this.defaults.method?n.method=this.defaults.method.toLowerCase():n.method="get";var i=n.transitional;i!==void 0&&Ke.assertOptions(i,{silentJSONParsing:x.transitional(x.boolean),forcedJSONParsing:x.transitional(x.boolean),clarifyTimeoutError:x.transitional(x.boolean)},!1);var t=[],a=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(a=a&&m.synchronous,t.unshift(m.fulfilled,m.rejected))});var s=[];this.interceptors.response.forEach(function(m){s.push(m.fulfilled,m.rejected)});var o;if(!a){var c=[Ne,void 0];for(Array.prototype.unshift.apply(c,t),c=c.concat(s),o=Promise.resolve(n);c.length;)o=o.then(c.shift(),c.shift());return o}for(var d=n;t.length;){var l=t.shift(),u=t.shift();try{d=l(d)}catch(y){u(y);break}}try{o=Ne(d)}catch(y){return Promise.reject(y)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};T.prototype.getUri=function(r){return r=I(this.defaults,r),Mr(r.url,r.params,r.paramsSerializer).replace(/^\?/,"")};Ge.forEach(["delete","get","head","options"],function(r){T.prototype[r]=function(n,i){return this.request(I(i||{},{method:r,url:n,data:(i||{}).data}))}});Ge.forEach(["post","put","patch"],function(r){T.prototype[r]=function(n,i,t){return this.request(I(t||{},{method:r,url:n,data:i}))}});var Jr=T,Z,Be;function zr(){if(Be)return Z;Be=1;var e=j();function r(n){if(typeof n!="function")throw new TypeError("executor must be a function.");var i;this.promise=new Promise(function(s){i=s});var t=this;this.promise.then(function(a){if(t._listeners){var s,o=t._listeners.length;for(s=0;s<o;s++)t._listeners[s](a);t._listeners=null}}),this.promise.then=function(a){var s,o=new Promise(function(c){t.subscribe(c),s=c}).then(a);return o.cancel=function(){t.unsubscribe(s)},o},n(function(s){t.reason||(t.reason=new e(s),i(t.reason))})}return r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.prototype.subscribe=function(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]},r.prototype.unsubscribe=function(i){if(this._listeners){var t=this._listeners.indexOf(i);t!==-1&&this._listeners.splice(t,1)}},r.source=function(){var i,t=new r(function(s){i=s});return{token:t,cancel:i}},Z=r,Z}var ee,Le;function Vr(){return Le||(Le=1,ee=function(r){return function(i){return r.apply(null,i)}}),ee}var re,je;function Xr(){if(je)return re;je=1;var e=p;return re=function(n){return e.isObject(n)&&n.isAxiosError===!0},re}var De=p,Wr=$e,B=Jr,Gr=Xe,Kr=oe;function Ye(e){var r=new B(e),n=Wr(B.prototype.request,r);return De.extend(n,B.prototype,r),De.extend(n,r),n.create=function(t){return Ye(Gr(e,t))},n}var E=Ye(Kr);E.Axios=B;E.Cancel=j();E.CancelToken=zr();E.isCancel=Ve();E.VERSION=We().version;E.all=function(r){return Promise.all(r)};E.spread=Vr();E.isAxiosError=Xr();Ie.exports=E;Ie.exports.default=E;/*! js-cookie v3.0.1 | MIT */function P(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var i in n)e[i]=n[i]}return e}var Yr={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function ie(e,r){function n(t,a,s){if(!(typeof document>"u")){s=P({},r,s),typeof s.expires=="number"&&(s.expires=new Date(Date.now()+s.expires*864e5)),s.expires&&(s.expires=s.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var c in s)s[c]&&(o+="; "+c,s[c]!==!0&&(o+="="+s[c].split(";")[0]));return document.cookie=t+"="+e.write(a,t)+o}}function i(t){if(!(typeof document>"u"||arguments.length&&!t)){for(var a=document.cookie?document.cookie.split("; "):[],s={},o=0;o<a.length;o++){var c=a[o].split("="),d=c.slice(1).join("=");try{var l=decodeURIComponent(c[0]);if(s[l]=e.read(d,l),t===l)break}catch{}}return t?s[t]:s}}return Object.create({set:n,get:i,remove:function(t,a){n(t,"",P({},a,{expires:-1}))},withAttributes:function(t){return ie(this.converter,P({},this.attributes,t))},withConverter:function(t){return ie(P({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(e)}})}ie(Yr,{path:"/"});rr.createPublisher();
@@ -1 +1 @@
1
- import{b1 as C,b2 as w,C as c,b3 as k,V as d,ai as F,F as I}from"./index-c3dec278.js";var a=(t=>(t.Vector2="Vector2",t.Vector3="Vector3",t.Vector4="Vector4",t.Color="Color",t.Float="Float",t.Texture="Texture",t.Boolean="Boolean",t.Integer="Integer",t))(a||{});async function B(t,V,e,n,i){var S;const s=t.engineObject.shaderData;let r;const o=V.toString(),h=C.getByName(o).type;switch(h===w.Float?(n===a.Integer||n===c.Toggle||n===c.Boolean||n===c.Select)&&(n=a.Float):h===w.Int&&(n===a.Float||n===c.Slider||n===c.Number)&&(n=a.Integer),n){case c.Slider:case c.Number:case a.Float:s.setFloat(o,e);break;case c.Toggle:case c.Boolean:case c.Select:case a.Integer:s.setInt(o,Number(e));break;case c.AssetPicker:case a.Texture:if(e){const l=await t.root.assetStore.getAssetByRef(e);if(l){const b=l.engineObject;s.setTexture(o,b),i&&x(i,t,"enable")}else s.setTexture(o,null),i&&x(i,t,"disable"),console.error(`${o} in ${t.name} is missing.`)}else s.setTexture(o,null),i&&x(i,t,"disable");break;case c.Vector2:case a.Vector2:r=s.getVector2(o),e==null?s.setVector2(o,e):r?(r.x=e.x,r.y=e.y):s.setVector2(o,new I(e.x,e.y));break;case c.Vector3:case a.Vector3:r=s.getVector3(o),e==null?s.setVector3(o,e):r?(r.x=e.x,r.y=e.y,r.z=e.z):s.setVector3(o,new F(e.x,e.y,e.z));break;case c.Vector4:case a.Vector4:r=s.getVector4(o),e==null?s.setVector4(o,e):r?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w):s.setVector4(o,new d(e.x,e.y,e.z,e.w));break;case c.Color:case a.Color:{if(e==null){s.setColor(o,null);break}let{r:l,g:b,b:f}=e;const{a:m,intensity:g=1}=e;l*=g,b*=g,f*=g,r=s.getColor(o),r?(r.r=l,r.g=b,r.b=f,r.a=m):s.setColor(o,new k(l,b,f,m));break}}(S=t.updateThumbnail)==null||S.call(t)}function x(t,V,e){const n=V.engineObject.shaderData;e==="enable"?n.enableMacro(t):n.disableMacro(t)}export{a as E,B as s};
1
+ import{b1 as C,b2 as w,C as c,b3 as k,V as d,ai as F,F as I}from"./index-b126bb6b.js";var a=(t=>(t.Vector2="Vector2",t.Vector3="Vector3",t.Vector4="Vector4",t.Color="Color",t.Float="Float",t.Texture="Texture",t.Boolean="Boolean",t.Integer="Integer",t))(a||{});async function B(t,V,e,n,i){var S;const s=t.engineObject.shaderData;let r;const o=V.toString(),h=C.getByName(o).type;switch(h===w.Float?(n===a.Integer||n===c.Toggle||n===c.Boolean||n===c.Select)&&(n=a.Float):h===w.Int&&(n===a.Float||n===c.Slider||n===c.Number)&&(n=a.Integer),n){case c.Slider:case c.Number:case a.Float:s.setFloat(o,e);break;case c.Toggle:case c.Boolean:case c.Select:case a.Integer:s.setInt(o,Number(e));break;case c.AssetPicker:case a.Texture:if(e){const l=await t.root.assetStore.getAssetByRef(e);if(l){const b=l.engineObject;s.setTexture(o,b),i&&x(i,t,"enable")}else s.setTexture(o,null),i&&x(i,t,"disable"),console.error(`${o} in ${t.name} is missing.`)}else s.setTexture(o,null),i&&x(i,t,"disable");break;case c.Vector2:case a.Vector2:r=s.getVector2(o),e==null?s.setVector2(o,e):r?(r.x=e.x,r.y=e.y):s.setVector2(o,new I(e.x,e.y));break;case c.Vector3:case a.Vector3:r=s.getVector3(o),e==null?s.setVector3(o,e):r?(r.x=e.x,r.y=e.y,r.z=e.z):s.setVector3(o,new F(e.x,e.y,e.z));break;case c.Vector4:case a.Vector4:r=s.getVector4(o),e==null?s.setVector4(o,e):r?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w):s.setVector4(o,new d(e.x,e.y,e.z,e.w));break;case c.Color:case a.Color:{if(e==null){s.setColor(o,null);break}let{r:l,g:b,b:f}=e;const{a:m,intensity:g=1}=e;l*=g,b*=g,f*=g,r=s.getColor(o),r?(r.r=l,r.g=b,r.b=f,r.a=m):s.setColor(o,new k(l,b,f,m));break}}(S=t.updateThumbnail)==null||S.call(t)}function x(t,V,e){const n=V.engineObject.shaderData;e==="enable"?n.enableMacro(t):n.disableMacro(t)}export{a as E,B as s};
@@ -10,7 +10,7 @@
10
10
  #status { position: fixed; left: 8px; top: 8px; background: rgba(0,0,0,0.6); color: #fff; padding: 6px 8px; font: 12px/1.4 monospace; z-index: 10; opacity: 1; transition: opacity 0.5s ease; pointer-events: none; }
11
11
  #status[data-state="idle"] { opacity: 0; transition: opacity 0.8s ease 1.5s; }
12
12
  </style>
13
- <script type="module" crossorigin src="/_static/index-c3dec278.js"></script>
13
+ <script type="module" crossorigin src="/_static/index-b126bb6b.js"></script>
14
14
  </head>
15
15
  <body>
16
16
  <div id="app">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/cli",
3
- "version": "2.0.0-alpha.26",
3
+ "version": "2.0.0-alpha.27",
4
4
  "main": "dist/cli.bundle.cjs",
5
5
  "bin": {
6
6
  "galacean": "bin/galacean.js"
@@ -16,7 +16,19 @@
16
16
  "README.md"
17
17
  ],
18
18
  "publishConfig": {
19
- "registry": "https://registry.npmjs.org/"
19
+ "registry": "https://registry.npmjs.org/",
20
+ "main": "dist/cli.bundle.cjs",
21
+ "bin": {
22
+ "galacean": "bin/galacean.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "build": "node build.mjs",
27
+ "build:tsc": "tsc -p tsconfig.build.json",
28
+ "prepublishOnly": "node build.mjs",
29
+ "update:basis-assets": "node scripts/update-basis-assets.mjs",
30
+ "test": "vitest run",
31
+ "test:watch": "vitest"
20
32
  },
21
33
  "dependencies": {
22
34
  "chokidar": "^4.0.3",
@@ -25,32 +37,25 @@
25
37
  "sharp": "^0.33.0"
26
38
  },
27
39
  "devDependencies": {
40
+ "@editor/ai": "workspace:^",
41
+ "@editor/asset-bundle-utils": "workspace:*",
42
+ "@editor/builder": "workspace:*",
43
+ "@editor/cli-preview": "workspace:*",
44
+ "@editor/constants": "workspace:*",
45
+ "@editor/editor-api": "workspace:*",
46
+ "@editor/model": "workspace:*",
47
+ "@editor/storage": "workspace:*",
48
+ "@editor/vfs": "workspace:*",
28
49
  "@galacean/engine": "2.0.0-alpha.33",
29
50
  "@galacean/engine-shader": "2.0.0-alpha.33",
30
51
  "@galacean/engine-shader-compiler": "2.0.0-alpha.33",
52
+ "@galacean/tools-color-dilation": "workspace:*",
53
+ "@galacean/tools-ktx2-encoder": "workspace:*",
31
54
  "@gltf-transform/core": "^4.1.0",
32
55
  "@gltf-transform/extensions": "^4.1.0",
33
56
  "@types/node": "^22.10.2",
34
- "vitest": "^3.1.0",
35
- "@editor/ai": "^1.0.0",
36
- "@editor/cli-preview": "0.0.0",
37
- "@editor/constants": "2.0.3",
38
- "@editor/model": "2.0.3",
39
- "@editor/storage": "0.0.1",
40
- "@galacean/tools-color-dilation": "1.5.0-alpha.0",
41
- "@editor/vfs": "1.0.0",
42
- "@editor/asset-bundle-utils": "1.0.0",
43
- "@editor/builder": "1.0.0",
44
- "@editor/editor-api": "1.0.0",
45
- "@galacean/tools-ktx2-encoder": "1.5.0-alpha.0",
46
- "config": "1.0.1",
47
- "tsconfig": "1.0.1"
48
- },
49
- "scripts": {
50
- "build": "node build.mjs",
51
- "build:tsc": "tsc -p tsconfig.build.json",
52
- "update:basis-assets": "node scripts/update-basis-assets.mjs",
53
- "test": "vitest run",
54
- "test:watch": "vitest"
57
+ "config": "workspace:*",
58
+ "tsconfig": "workspace:*",
59
+ "vitest": "^3.1.0"
55
60
  }
56
- }
61
+ }
@@ -1 +0,0 @@
1
- var Le=Object.defineProperty;var qe=(o,e,t)=>e in o?Le(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var C=(o,e,t)=>(qe(o,typeof e!="symbol"?e+"":e,t),t);import{d_ as Ue,d$ as be,e0 as Je,aJ as Ie,aK as Ge,av as M,bA as We,q as he,aN as Qe,aw as He,e1 as Xe,C as Ye,bE as Ze,e2 as ge,e3 as W,e4 as et,e5 as tt,bX as nt,e as J,e6 as Ee,e7 as st,e8 as rt,e9 as ot,ea as it,eb as ct,ec as at,ed as dt,ee as ut,ef as ft,eg as lt,eh as ht,ei as pt,ej as mt,ek as we,el as yt,bV as Pe,em as ne,en as _e,eo as St,ep as bt,eq as It,er as gt,K as Ce,m as Et,aT as wt,x as Pt,aC as ke,n as _t,dL as Ct,es as Rt}from"./index-c3dec278.js";import{T as $t}from"./TaskQueue-05c94a4d.js";import{u as Re,I as vt}from"./index-cdbb2f4d.js";import"./postmen-2853c0e6.js";import{A as At}from"./AssetViewer-3847c058.js";function Tt(o,e,t){const n=[];function s(r){if(!(r==null||typeof r!="object")){if(Array.isArray(r)){for(const i of r)s(i);return}for(const i of Object.keys(r)){const c=r[i];if(e.includes(i)&&typeof c=="string"&&n.push(c),t){const a=t(i,c);a!==null&&n.push(a)}s(c)}}}return s(o),n}function A(o){return structuredClone(o)}function Q(o,e){const t=o.entities.findIndex(n=>n.id===e);if(t<0)throw new Error(`Prefab source entity "${e}" not found`);return t}function je(o,e){const t=o.components.findIndex(n=>n.id===e);if(t<0)throw new Error(`Prefab source component "${e}" not found`);return t}function oe(o,e,t){if(!t)return;const n=e==="scale"?[1,1,1]:[0,0,0],s=o[e]??n;o[e]=[t.x??s[0],t.y??s[1],t.z??s[2]]}function $e(o,e,t){const n=new Set(e),s=new Set;for(const r of t){if(s.has(r))throw new Error(`Prefab source ${o} id "${r}" is duplicated in the added source tree`);if(n.has(r))throw new Error(`Prefab source ${o} id "${r}" already exists`);s.add(r)}}function xt(o){return o.entities.map(e=>e.id)}function Be(o){return o.components.map(e=>e.id)}function Mt(o){const e=new Set(o.entityIds),t=new Set(o.componentIds);return o.entities.map((n,s)=>{var c,a;const r=o.entityIds[s],i=structuredClone(n);return i.id=r,(c=i.children)!=null&&c.length&&(i.children=i.children.map(d=>{const u=typeof d=="number"?o.entityIds[d]:d;if(!e.has(u))throw new Error(`Prefab added source entity "${r}" child "${String(d)}" is outside added entity tree`);return u})),(a=i.components)!=null&&a.length&&(i.components=i.components.map(d=>{const u=typeof d=="number"?o.componentIds[d]:d;if(!t.has(u))throw new Error(`Prefab added source entity "${r}" component "${String(d)}" is outside added component list`);return u})),i})}function Ot(o){return o.components.map((e,t)=>({...structuredClone(e),id:o.componentIds[t]}))}function Dt(o,e){const t=new Map(o.entities.map(r=>[r.id,r])),n=new Set,s=r=>{if(n.has(r))return;n.add(r);const i=t.get(r);for(const c of(i==null?void 0:i.children)??[])s(c)};return s(e),n}function Ft(o,e,t){var r,i,c;if(!t)return A(o);const n=A(o),s=n.entities[Q(n,e)];return t.name!==void 0&&(s.name=t.name),t.isActive!==void 0&&(t.isActive?delete s.isActive:s.isActive=!1),t.layer!==void 0&&(t.layer===0?delete s.layer:s.layer=t.layer),t.isLocked!==void 0&&(t.isLocked?s.isLocked=!0:delete s.isLocked),oe(s,"position",(r=t.transform)==null?void 0:r.position),oe(s,"rotation",(i=t.transform)==null?void 0:i.rotation),oe(s,"scale",(c=t.transform)==null?void 0:c.scale),n}function kt(o,e,t){if(!t||Object.keys(t).length===0)return A(o);const n=A(o),s=n.components[je(n,e)];return s.props=Ue(s.props??{},t),n}function jt(o,e){if(e.entities.length===0||e.entities.length!==e.entityIds.length)throw new Error("Prefab added entity tree must include matching entities and entityIds");if(e.components.length!==e.componentIds.length)throw new Error("Prefab added entity tree must include matching components and componentIds");$e("entity",xt(o),e.entityIds),$e("component",Be(o),e.componentIds);const t=A(o),n=t.entities[Q(t,e.parentSourceEntityId)],s=Mt(e),r=Ot(e),i=e.entityIds[0];t.entities.push(...s),t.components.push(...r);const c=[...n.children??[]],a=Math.min(Math.max(e.index,0),c.length);return c.splice(a,0,i),n.children=c,t}function Bt(o,e){var p;const t=A(o),n=t.entities[Q(t,e.instanceSourceEntityId)];if(!n.instance)throw new Error(`Prefab source entity "${e.instanceSourceEntityId}" is not an instance entity`);const s=(p=n.instance).overrides??(p.overrides={}),r=[...s.addedEntities??[]],i=Math.max(0,e.index);let c=0,a=r.length;for(let y=0;y<r.length;y+=1)if(r[y].parent===e.parentSourceEntityId){if(c===i){a=y;break}c+=1,a=y+1}const d=structuredClone(e.entity),u=d.id??`${e.instanceSourceEntityId}:added:${r.length}`;return d.id=u,r.splice(a,0,{id:u,parent:e.parentSourceEntityId,entity:d}),s.addedEntities=r,t}function zt(o,e){if(o.root===e)throw new Error("Cannot remove prefab root entity from source");Q(o,e);const t=Dt(o,e),n=new Set;for(const r of o.entities)if(t.has(r.id))for(const i of r.components??[])n.add(i);const s=A(o);return s.entities=s.entities.filter(r=>!t.has(r.id)).map(r=>{const i=structuredClone(r),c=(i.children??[]).filter(d=>!t.has(d)),a=(i.components??[]).filter(d=>!n.has(d));return c.length?i.children=c:delete i.children,a.length?i.components=a:delete i.components,i}),s.components=s.components.filter(r=>!n.has(r.id)),s}function Nt(o,e,t,n){if(Be(o).includes(t))throw new Error(`Prefab source component id "${t}" already exists`);const s=A(o),r=s.entities[Q(s,e)];return s.components.push({...structuredClone(n),id:t}),r.components=[...r.components??[],t],s}function Vt(o,e){je(o,e);const t=A(o);return t.components=t.components.filter(n=>n.id!==e),t.entities=t.entities.map(n=>{const s=structuredClone(n),r=(s.components??[]).filter(i=>i!==e);return r.length?s.components=r:delete s.components,s}),t}function Kt(o){switch(o.kind){case"add-source-entity":if(o.sourceEntityIds.length===0)throw new Error("Prefab source edit add-source-entity requires at least one source entity id");return;case"remove-source-entity":if(!o.sourceEntityId)throw new Error("Prefab source edit remove-source-entity requires a source entity id");return;case"add-source-component":if(!o.sourceComponentId)throw new Error("Prefab source edit add-source-component requires a source component id");return;case"remove-source-component":if(!o.sourceComponentId)throw new Error("Prefab source edit remove-source-component requires a source component id");return;case"add-nested-instance-entity":if(!o.instanceSourceEntityId)throw new Error("Prefab source edit add-nested-instance-entity requires an instance source entity id");if(!o.parentSourceEntityId)throw new Error("Prefab source edit add-nested-instance-entity requires a parent source entity id");return}}function ve(o,e){return o.length===e.length&&o.every((t,n)=>t===e[n])}function G(o,e,t){const n=new Set(e);for(const s of t)if(!n.has(s))throw new Error(`Prefab source edit expected ${o} id "${s}" to exist`)}function se(o,e,t){const n=new Set(e);for(const s of t)if(n.has(s))throw new Error(`Prefab source edit expected ${o} id "${s}" to be removed`)}function D(o){return o.entities.map(e=>e.id)}function z(o){return o.components.map(e=>e.id)}function ze(o,e){const t=o.entities.findIndex(n=>n.id===e);if(t<0)throw new Error(`Prefab source edit expected entity id "${e}" to exist`);return t}function Lt(o,e){var n;const t=ze(o,e);if(!((n=o.entities[t])!=null&&n.instance))throw new Error(`Prefab source edit expected entity id "${e}" to be an instance entity`)}function Ae(o,e,t){var s,r,i;const n=ze(o,e);return(((i=(r=(s=o.entities[n])==null?void 0:s.instance)==null?void 0:r.overrides)==null?void 0:i.addedEntities)??[]).filter(c=>c.parent===t).length}function F(o,e,t,n,s){if(o!=null){if(Array.isArray(o)){o.forEach((r,i)=>F(r,e,t,`${n}[${i}]`,s));return}if(Je(o)){o.$component===e&&s.push({entityId:t,propPath:n});for(const[r,i]of Object.entries(o))F(i,e,t,`${n}.${r}`,s)}}}function Ne(o,e,t,n,s){var r;F(o.props,e,t,`${n}.props`,s),(r=o.calls)==null||r.forEach((i,c)=>F(i,e,t,`${n}.calls[${c}]`,s))}function Ve(o,e,t,n,s){var r,i,c;(r=o.components)==null||r.forEach((a,d)=>Ne(a,e,t,`${n}.components[${d}]`,s)),(i=o.children)==null||i.forEach((a,d)=>Ve(a,e,t,`${n}.children[${d}]`,s)),Ke((c=o.instance)==null?void 0:c.overrides,e,t,`${n}.instance.overrides`,s)}function Ke(o,e,t,n,s){var r,i,c;(r=o==null?void 0:o.componentProps)==null||r.forEach((a,d)=>F(a.props,e,t,`${n}.componentProps[${d}].props`,s)),(i=o==null?void 0:o.addedComponents)==null||i.forEach((a,d)=>Ne(a.component,e,t,`${n}.addedComponents[${d}].component`,s)),(c=o==null?void 0:o.addedEntities)==null||c.forEach((a,d)=>Ve(a.entity,e,t,`${n}.addedEntities[${d}].entity`,s))}function qt(o,e){var s,r;const t=[],n=new Map;for(const i of o.entities)for(const c of i.components??[])n.set(c,i.id);for(const i of o.components){if(i.id===e)continue;const c=n.get(i.id)??"<unowned>";F(i.props,e,c,`components.${i.id}.props`,t),(s=i.calls)==null||s.forEach((a,d)=>F(a,e,c,`components.${i.id}.calls[${d}]`,t))}for(const i of o.entities)Ke((r=i.instance)==null?void 0:r.overrides,e,i.id,`entities.${i.id}.instance.overrides`,t);return t}function Ut(o,e){const t=qt(o,e);if(t.length!==0)throw new Error(`Cannot remove component "${e}": it is referenced by $component bindings in ${t.map(n=>`entity "${n.entityId}" prop "${n.propPath}"`).join(", ")}. Remove the bindings first.`)}function Jt(o,e){switch(e.kind){case"add-source-entity":se("entity",D(o),e.sourceEntityIds);return;case"remove-source-entity":G("entity",D(o),[e.sourceEntityId]);return;case"add-source-component":se("component",z(o),[e.sourceComponentId]);return;case"remove-source-component":G("component",z(o),[e.sourceComponentId]),Ut(o,e.sourceComponentId);return;case"add-nested-instance-entity":G("entity",D(o),[e.instanceSourceEntityId]),Lt(o,e.instanceSourceEntityId);return}}function Gt(o,e,t){switch(t.kind){case"add-source-entity":G("entity",D(e),t.sourceEntityIds);return;case"remove-source-entity":se("entity",D(e),[t.sourceEntityId]);return;case"add-source-component":G("component",z(e),[t.sourceComponentId]);return;case"remove-source-component":se("component",z(e),[t.sourceComponentId]);return;case"add-nested-instance-entity":{if(!ve(D(o),D(e))||!ve(z(o),z(e)))throw new Error("Prefab source edit add-nested-instance-entity must not change source entity or component ids");const n=Ae(o,t.instanceSourceEntityId,t.parentSourceEntityId);if(Ae(e,t.instanceSourceEntityId,t.parentSourceEntityId)!==n+1)throw new Error(`Prefab source edit expected nested added entity count under "${t.parentSourceEntityId}" to increase by 1`);return}}}function H(o){Kt(o.intent),be(o.prefabFile),Jt(o.prefabFile,o.intent);const e=o.mutation(o.prefabFile);return be(e),Gt(o.prefabFile,e,o.intent),e}function Wt(o,e){return H({prefabFile:o,intent:{kind:"add-source-entity",sourceEntityIds:e.entityIds},mutation:t=>jt(t,e)})}function Qt(o,e){return H({prefabFile:o,intent:{kind:"add-nested-instance-entity",instanceSourceEntityId:e.instanceSourceEntityId,parentSourceEntityId:e.parentSourceEntityId},mutation:t=>Bt(t,e)})}function Ht(o,e){return H({prefabFile:o,intent:{kind:"remove-source-entity",sourceEntityId:e},mutation:t=>zt(t,e)})}function Xt(o,e){return H({prefabFile:o,intent:{kind:"add-source-component",sourceComponentId:e.sourceComponentId},mutation:t=>Nt(t,e.sourceEntityId,e.sourceComponentId,e.component)})}function Yt(o,e){return H({prefabFile:o,intent:{kind:"remove-source-component",sourceComponentId:e},mutation:t=>Vt(t,e)})}class ae{static update(e,t){!this.entity&&(this.entity=e.createChild("prefab"));const n=this.tempCloneEntity=t.instantiateEngineObject();this.entity.addChild(n)}static clear(){var e;(e=this.entity)==null||e.clearChildren(),this.tempCloneEntity&&this.tempCloneEntity.destroy(),this.tempCloneEntity=null}}C(ae,"entity"),C(ae,"tempCloneEntity");const Zt=Ie(({asset:o})=>{const{dependentAssets:e}=o,{configDataStore:t}=Re(),{t:n}=Ge(),s=Ie(({dependentAssetInfo:r})=>{const{assetStore:i}=Re(),c=Object.values(i.assets).filter(u=>{const p=u.getMetaConfig().type,y=u.id===r.id,l=u.id===o.id,f=!y&&!l&&!u.isSubAsset;return r.type==="glTF"||r.type==="Prefab"?p==="glTF"||p==="Prefab"&&f:u.getMetaConfig().type===r.type&&f}),a=i.assets[r.id],d=a==null?void 0:a.name;return M.jsx(We,{dropLayer:he.Asset,placeholder:n("prefab.inspector.missed"),assets:c,onSelect:u=>{o.replaceDependentAsset(r,u)},onLocate:()=>{i.selectAsset(r.id)},value:d,asset:a})});return M.jsxs(M.Fragment,{children:[M.jsx(Qe,{title:n("prefab.inspector.basic-info"),defaultOpen:!0,children:t.isBuc&&M.jsx(He,{label:n("prefab.inspector.url")})}),M.jsx(Xe,{label:n("prefab.inspector.dependent-assets"),children:e.map((r,i)=>M.jsx(s,{dependentAssetInfo:r},`${r.id}-${i}`))})]})}),en={asset:{version:"2.0"},root:"defaultPrefab",entities:[{id:"defaultPrefab",name:"prefab"}],components:[]};class tn extends At{constructor(){super(...arguments);C(this,"_animators",[]);C(this,"_particles",[])}setViewAsset(t,n){const s=t.entityManager.rootEntities[0];this._entity=s.engineObject,n.addChild(this._entity),s.getComponentsIncludeChildren("Animator",this._animators).forEach(c=>{c.applyBoundPathChange("enabled",Ye.Toggle,c.enabled)}),this._entity.getComponentsIncludeChildren(Ze,this._particles).forEach(c=>{c.generator.stop(!1,ge.StopEmittingAndClear),c.generator.main.simulationSpeed=1,c.generator.play()})}stopViewAsset(){super.stopViewAsset(),this._particles.forEach(t=>{t.generator.stop(!1,ge.StopEmittingAndClear)})}}function de(o,e,t){if(Array.isArray(o))return o.map(r=>de(r,e,t));if(!o||typeof o!="object")return o;const n=o,s={};for(const[r,i]of Object.entries(n))s[r]=r==="$ref"&&i===e?t:de(i,e,t);return s}function Te(o,e,t){return de(o,e,t)}function nn(o,e,t,n){const s=e.ref??n(e.id);if(typeof s!="string"||s.length===0)throw new Error(`[SceneV2] Unable to replace prefab asset ref "${e.id}": missing old virtualPath`);const r=n(t);if(typeof r!="string"||r.length===0)throw new Error(`[SceneV2] Unable to replace prefab asset ref "${t}": missing new virtualPath`);let i=Te(o,s,r);return s!==e.id&&(i=Te(i,e.id,r)),i}function sn(o,e){const t=e.entities.findIndex(n=>n.id===e.root);if(!e.entities[t])throw new Error(`Prefab asset "${o}" source root "${e.root}" was not found.`);return t}function k(o,e,t){const n=e.entities[t];if(!n)throw new Error(`Prefab asset "${o}" source entity at index "${t}" was not found.`);return n}function N(o,e,t){var s;const n=(s=e.entities[t])==null?void 0:s.id;if(!n)throw new Error(`Prefab asset "${o}" source entity at index "${t}" is missing a stable source id.`);return n}function rn(o,e,t){var s;const n=(s=e.components[t])==null?void 0:s.id;if(!n)throw new Error(`Prefab asset "${o}" source component at index "${t}" is missing a stable source id.`);return n}function xe(o,e,t){const n=k(o,e,t);if(W(n))return[];const s=(n.children??[]).map(r=>e.entities.findIndex(i=>i.id===r));for(const r of s)if(!e.entities[r])throw new Error(`Prefab asset "${o}" source child index "${r}" on entity "${t}" was not found.`);return s}function Me(o,e,t){const n=k(o,e,t);return W(n)?[]:(n.components??[]).map(s=>{const r=e.components.findIndex(c=>c.id===s),i=e.components[r];if(!i)throw new Error(`Prefab asset "${o}" source component "${s}" was not found.`);return{key:rn(o,e,r),type:i.type,schema:i}})}function Oe(o,e,t,n,s){var a,d;const r=N(o,e,t),i=n.find(u=>u.id===r&&!s.has(u.id));if(i)return i;const c=k(o,e,t);if(!W(c)&&!((d=(a=c.instance)==null?void 0:a.asset)!=null&&d.$ref))throw new Error(`Prefab source child "${r}" cannot be matched to a loaded source entity.`)}function on(o,e,t,n){const s=r=>!t.type||r.type===t.type;if(n){const r=o.find(i=>i.key===n&&!e.has(i.key)&&s(i));if(r)return r}if(t.id){const r=o.find(i=>i.key===t.id&&!e.has(i.key)&&s(i));if(r)return r}}function cn(o,e,t,n){const s=(e==null?void 0:e.components)??[],r=t==null?void 0:t.get(o.key);if(r){const c=s.find(a=>(a==null?void 0:a.id)===r&&!a.ignoreToJSON);if(c)return c}const i=s.find(c=>{var d;return!(c!=null&&c.id)||n.has(c.id)||c.ignoreToJSON||((d=c.instance)==null?void 0:d.sourceComponentKey)!==o.key?!1:!c.type||c.type===o.type});if(i)return i}function an(o){var a,d,u,p,y,l,f,h;const e=k(o.assetId,o.prefabFile,o.sourceIndex),t=N(o.assetId,o.prefabFile,o.sourceIndex),n=(d=(a=e==null?void 0:e.instance)==null?void 0:a.asset)==null?void 0:d.$ref;if(!n||!W(e))return!1;const s=((y=(p=(u=o.normalized)==null?void 0:u.entities)==null?void 0:p[o.sceneChild.id])==null?void 0:y.instance)??o.sceneChild.instance,r=s==null?void 0:s.bindingId,i=r?(h=(f=(l=o.normalized)==null?void 0:l.prefab)==null?void 0:f.bindings)==null?void 0:h[r]:void 0,c=o.resolveInstanceAsset(n,t);return c?i?i.instanceRootEntityId===o.sceneChild.id&&i.assetId===c.id&&i.assetKind===c.kind:(s==null?void 0:s.assetId)===c.id&&(s==null?void 0:s.assetKind)===c.kind&&(!(s!=null&&s.role)||s.role==="root"):!1}function dn(o){var s,r;const t=(r=(s=k(o.assetId,o.prefabFile,o.sourceIndex).instance)==null?void 0:s.asset)==null?void 0:r.$ref;if(typeof t!="string")return;const n=o.resolveInstanceAsset(t,o.sourceEntityId);if(!n)throw new Error(`Prefab source entity "${o.sourceEntityId}" references missing instance asset "${t}".`);if(n.kind!=="Prefab"&&n.kind!=="glTF")throw new Error(`Prefab source entity "${o.sourceEntityId}" references unsupported instance asset "${t}" of type "${String(n.kind)}".`);return n}function un(o,e){var r,i,c,a;if(!(o!=null&&o.id))return;const t=((i=(r=e==null?void 0:e.entities)==null?void 0:r[o.id])==null?void 0:i.instance)??o.instance,n=t==null?void 0:t.bindingId,s=n?(a=(c=e==null?void 0:e.prefab)==null?void 0:c.bindings)==null?void 0:a[n]:void 0;return typeof(s==null?void 0:s.sourceRootEntityId)=="string"?s.sourceRootEntityId:void 0}function ie(o,e){return{x:Number((o==null?void 0:o.x)??e.x),y:Number((o==null?void 0:o.y)??e.y),z:Number((o==null?void 0:o.z)??e.z)}}function fn(o,e){const t=o==null?void 0:o.transform;return{position:t!=null&&t.position?ie(t.position,{x:0,y:0,z:0}):e.position,rotation:t!=null&&t.rotation?ie(t.rotation,{x:0,y:0,z:0}):e.rotation,scale:t!=null&&t.scale?ie(t.scale,{x:1,y:1,z:1}):e.scale}}function ln(o,e,t){const n=o==null?void 0:o.layer;return Array.isArray(n)?t?t(n):e:typeof n=="number"?n:e}function hn(o){var c,a,d,u,p,y,l;const e=(c=o.normalized)==null?void 0:c.components,t=(o.sceneComponentId?e==null?void 0:e[o.sceneComponentId]:void 0)??((a=o.component)!=null&&a.id?e==null?void 0:e[o.component.id]:void 0),n={},s=(t==null?void 0:t.refId)??(typeof((d=o.schema.script)==null?void 0:d.$ref)=="string"?o.resolveSourceAssetRefToDomainId(o.schema.script.$ref,`component "${((u=o.component)==null?void 0:u.id)??o.schema.type}" script`):void 0);s&&(n.refId=s);const r=(t==null?void 0:t.scriptKey)??((p=o.schema.script)==null?void 0:p.key);r&&(n.scriptKey=r);const i=(y=t==null?void 0:t.calls)!=null&&y.length?structuredClone(t.calls):(l=o.schema.calls)!=null&&l.length?o.convertSourceRefsToDomainRefs(structuredClone(o.schema.calls)):void 0;return i!=null&&i.length&&(n.calls=i),n}function pn(o){var e,t;return o.sceneEntityIdBySource.has(o.sourceEntityId)?((t=(e=o.allowMissingSceneComponentSourceKeys)==null?void 0:e.get(o.sourceEntityId))==null?void 0:t.has(o.sourceComponentKey))===!0:!0}function mn(o){const{assetId:e,prefabFile:t,sourceRoot:n,sceneRoot:s,normalized:r}=o,i=[],c=[],a=new Map,d=new Map,u=sn(e,t),p=h=>{var E,P;const m=((P=(E=r==null?void 0:r.entities)==null?void 0:E[h.id])==null?void 0:P.instance)??h.instance;return(m==null?void 0:m.role)==="added"},y=(h,m,E,P)=>{var q,ee,te,U;if(p(E))return;const _=N(e,t,h),g=k(e,t,h),T=W(g);i.push({sceneEntityId:E.id,sourceEntityId:_,role:P}),a.set(_,E.id);const V=Me(e,t,h),Y=E.components??[],R=new Set;for(const b of Y){if(!(b!=null&&b.id)||b.ignoreToJSON)continue;const S=((ee=(q=r==null?void 0:r.components)==null?void 0:q[b.id])==null?void 0:ee.instance)??b.instance;if((S==null?void 0:S.role)==="added")continue;const w=((te=o.sceneSourceComponentKeys)==null?void 0:te.get(b.id))??(S==null?void 0:S.sourceComponentKey),I=on(V,R,b,w);if(!I){if(!T)throw new Error(`Prefab asset "${e}" live scene component "${b.id}" on source entity "${_}" cannot be matched to a prefab source component.`);continue}R.add(I.key),c.push({sceneEntityId:E.id,sceneComponentId:b.id,sourceComponentKey:I.key});const $=d.get(_)??new Map;$.set(I.key,b.id),d.set(_,$)}const B=xe(e,t,h),Z=(m==null?void 0:m.children)??[],x=E.children??[],K=new Set,L=new Set;for(let b=0;b<B.length;b++){const S=B[b],w=N(e,t,S),I=Oe(e,t,S,Z,K);I!=null&&I.id&&K.add(I.id);const $=x.find(v=>{var me,ye,Se;if(L.has(v.id)||p(v))return!1;if(v.id===w||I!=null&&I.id&&v.id===I.id||an({assetId:e,prefabFile:t,sourceIndex:S,sceneChild:v,normalized:r,resolveInstanceAsset:o.resolveInstanceAsset}))return!0;const re=((ye=(me=r==null?void 0:r.entities)==null?void 0:me[v.id])==null?void 0:ye.instance)??v.instance,pe=((Se=o.sceneSourceEntityIds)==null?void 0:Se.get(v.id))??(re==null?void 0:re.sourceEntityId)??v.instanceSourceEntityId;return pe===w||(I==null?void 0:I.id)&&pe===I.id});if(!$){if((U=o.allowMissingSceneChildSourceIds)!=null&&U.has(w))continue;throw new Error(`Prefab asset "${e}" source child "${w}" cannot be matched to live scene child under source entity "${_}".`)}L.add($.id),y(S,I,$,"linked")}},l={},f=(h,m,E,P)=>{const _=k(e,t,h),g=N(e,t,h),T={},V=Me(e,t,h),Y=new Set;V.forEach(b=>{var $;const S=cn(b,m,d.get(g),Y);if(S!=null&&S.ignoreToJSON)return;S!=null&&S.id&&Y.add(S.id);const w=typeof(S==null?void 0:S.toJSON)=="function"?S.toJSON():b.schema,I=($=d.get(g))==null?void 0:$.get(b.key);if(!I&&!pn({sourceEntityId:g,sourceComponentKey:b.key,sceneEntityIdBySource:a,allowMissingSceneComponentSourceKeys:o.allowMissingSceneComponentSourceKeys}))throw new Error(`Prefab asset "${e}" source component "${b.key}" on source entity "${g}" cannot be matched to live scene component.`);T[b.key]={sceneComponentId:I,type:w.type??(S==null?void 0:S.type),...hn({component:S,schema:w,sceneComponentId:I,normalized:r,resolveSourceAssetRefToDomainId:o.resolveSourceAssetRefToDomainId,convertSourceRefsToDomainRefs:o.convertSourceRefsToDomainRefs}),props:o.collectComponentProps(S,w)}});const R=dn({assetId:e,prefabFile:t,sourceIndex:h,sourceEntityId:g,resolveInstanceAsset:o.resolveInstanceAsset}),B=R==null?void 0:R.kind,Z=et({sourceEntity:_,fallbackSourceEntityId:g,instanceAssetKind:B,bindingSourceRootEntityId:un(m,r)??(R==null?void 0:R.sourceRootEntityId)}),x=tt(_,g,{...typeof Z=="string"?{rootOverrideTarget:Z}:{}}),K=ln(m,x.layer,o.combineLayers),L=(m==null?void 0:m.isLocked)??x.isLocked,q=xe(e,t,h),ee=q.map(b=>N(e,t,b));l[g]={sceneEntityId:a.get(g),parentSourceEntityId:E,childSourceEntityIds:ee,childIndex:P,...B?{instanceAssetKind:B}:{},name:(m==null?void 0:m.name)??x.name,isActive:(m==null?void 0:m.isActive)??x.isActive,...K!==void 0?{layer:K}:{},...L!==void 0?{isLocked:L}:{},transform:fn(m,x.transform),components:T};const te=(m==null?void 0:m.children)??[],U=new Set;q.forEach((b,S)=>{const w=Oe(e,t,b,te,U);w!=null&&w.id&&U.add(w.id),f(b,w,g,S)})};return y(u,n,s,"root"),f(u,n,null,0),{entityMappings:i,componentMappings:c,sourceEntitySnapshots:l}}class yn{constructor(e){this.host=e}async apply(e,t){const n=this.host.readSourceFile(),s=e(n);try{if(this.host.writeSourceFile(s),this.host.syncDependentAssets(),this.host.updateCreateByAddResumeSnapshot(),(t==null?void 0:t.refresh)===!1)return;await this.host.refreshContent((t==null?void 0:t.structuralDeltaMode)==="domain-source-replace"?{structuralDeltaMode:"domain-source-replace"}:void 0)}catch(r){throw this.host.writeSourceFile(n),this.host.syncDependentAssets(),this.host.updateCreateByAddResumeSnapshot(),r}}}var Sn=Object.defineProperty,bn=Object.getOwnPropertyDescriptor,X=(o,e,t,n)=>{for(var s=n>1?void 0:n?bn(e,t):e,r=o.length-1,i;r>=0;r--)(i=o[r])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&Sn(e,t,s),s};const O=Ct("PrefabAsset"),De=new Rt("PrefabAsset"),ue=[0,0,0],fe=[0,0,0],le=[1,1,1];function Fe(o){const e=new Map;for(const[t,n]of o)e.set(n,t);return e}function ce(o,e,t){const n=o??e;return[(t==null?void 0:t.x)??n[0],(t==null?void 0:t.y)??n[1],(t==null?void 0:t.z)??n[2]]}function In(o,e){e&&Object.assign(o,{...e.position?{position:ce(o.position,ue,e.position)}:{},...e.rotation?{rotation:ce(o.rotation,fe,e.rotation)}:{},...e.scale?{scale:ce(o.scale,le,e.scale)}:{}})}let j=class extends vt{constructor(e){super(e);C(this,"acceptDragLayer",he.Entity);C(this,"_entityManager");C(this,"_contentQueue",new $t);C(this,"prefabFile",null);C(this,"dependentAssets",[]);C(this,"_skipInitUpdateContent",!1);this._entityManager=new ot(e)}static async createByEntity(e){var t,n,s;if(e.isPrefabSubEntity||e.isGLTFSubEntity){nt.error(J("prefab.error.create-from-sub"));return}Ee()&&st();try{De.info("createByEntity START",{entityName:e.name,entityId:e.id,isGLTFWrap:e.isGLTFWrapEntity,childCount:(t=e.children)==null?void 0:t.length,childNames:(n=e.children)==null?void 0:n.map(i=>i.name),hasGLTFChild:(s=e.children)==null?void 0:s.some(i=>i.isGLTFRefEntity)});const{assetFacade:r}=e.root;await e.root.runInUndoGroup("asset.create",async()=>{const i=await r.createAssetByAdd({assetType:"Prefab",name:e.name});await i.updateByEntity(e,!1,{undoable:!0,replaceInstances:!1}),i.addInstance(e,{undoable:!0}),i._bindInstantiatedEntity(e,{undoable:!0})})}finally{Ee()&&rt()}}get entityManager(){return this._entityManager}get entities(){var e;return((e=this.prefabFile)==null?void 0:e.entities)??[]}async initByMain(e,t){const{dependentAssets:n}=this.meta;if(this.url=t,this.prefabFile=it(await e.text()),this.dependentAssets=n,this._skipInitUpdateContent){this._skipInitUpdateContent=!1;return}await this._updateContent()}async initByCreation(){return this.prefabFile=en,this._skipInitUpdateContent=!0,this.getMainData()}getMainData(){return ct(this._requirePrefabSourceFile("serializing prefab main data"))}async updateByEntity(e,t=!1,n){De.info("updateByEntity START",{entityName:e.name,entityId:e.id,isGLTFWrap:e.isGLTFWrapEntity,updateInstanceFrom:t});const s=this._serializeRootEntityTreeForSource(e),r=s.entities;if(r[0]){delete r[0].position;const i=r[0].instance?this._resolveNestedInstanceRootOverrideTarget(e):void 0;at(r[0],i)}this.prefabFile={asset:{version:"2.0"},root:s.entityIds[0],entities:r,components:s.components},this._syncDependentAssetsFromPrefabFile(),this._updateCreateByAddResumeSnapshot(),t&&this.addInstance(e),await this._updateContent({...n!=null&&n.undoable?{undoable:!0}:{},...(n==null?void 0:n.replaceInstances)===!1?{replaceInstances:!1}:{}})}async refreshFromData(e){await this._updateContent(e)}async _editPrefabSource(e,t){await new yn({readSourceFile:()=>this.prefabFile,writeSourceFile:n=>{this.prefabFile=n},syncDependentAssets:()=>this._syncDependentAssetsFromPrefabFile(),updateCreateByAddResumeSnapshot:()=>this._updateCreateByAddResumeSnapshot(),refreshContent:n=>this._updateContent(n)}).apply(e,t)}async applyEntityPropsOverride(e,t,n){await this._editPrefabSource(s=>Ft(s,e,t),n)}async applyComponentPropsOverride(e,t,n){const s=t?this._componentPropsOverrideToSourcePatch(e,t):void 0;await this._editPrefabSource(r=>kt(r,e,s),n)}async applyAddedEntityOverride(e,t,n,s){const r=this._serializeEntityTreeForSource(n),i=this._resolveSourceChildInsertionIndex(e,t,n);await this._editPrefabSource(c=>Wt(c,{parentSourceEntityId:e,index:i,entities:r.entities,entityIds:r.entityIds,components:r.components,componentIds:r.componentIds}),{...s,structuralDeltaMode:"domain-source-replace"})}async applyNestedInstanceAddedEntityOverride(e,t,n,s,r){const i=this._serializeEntityInlineForSource(s);await this._editPrefabSource(c=>Qt(c,{instanceSourceEntityId:e,parentSourceEntityId:t,index:n,entity:i}),{...r,structuralDeltaMode:"domain-source-replace"})}async applyRemovedEntityOverride(e,t){await this._editPrefabSource(n=>Ht(n,e),{...t,structuralDeltaMode:"domain-source-replace"})}async applyAddedComponentOverride(e,t,n,s){await this._editPrefabSource(r=>Xt(r,{sourceEntityId:e,sourceComponentId:t,component:this._componentSchemaToSourceRefs(n)}),{...s,structuralDeltaMode:"domain-source-replace"})}async applyRemovedComponentOverride(e,t){await this._editPrefabSource(n=>Yt(n,e),{...t,structuralDeltaMode:"domain-source-replace"})}replaceDependentAsset(e,t){const n=this.root.assetStore;this.prefabFile=nn(this.prefabFile,e,t.id,s=>{var r;return(r=n.getAssetVirtualPath)==null?void 0:r.call(n,s)}),e.id=t.id,e.name=t.name,e.type=t.getMetaConfig().type,e.ref=this._createSourceRefCodec().domainToSource(t.id,"replace prefab asset"),this._updateContent()}_createSourceSerializeContext(e=[]){var s,r;const t=this.root.assetStore,n=(r=(s=this.root.domainStore)==null?void 0:s.getNormalizedState)==null?void 0:r.call(s);return new dt(e,i=>{var c;return(c=t.getAssetVirtualPath)==null?void 0:c.call(t,i)},i=>{var a;const c=(a=n==null?void 0:n.components)==null?void 0:a[i];if(c)return{refId:c.refId,scriptKey:c.scriptKey,calls:c.calls}})}_createSourceRefCodec(){const e=this.root.assetStore;return ut({resolveAssetRef:t=>{var n;return(n=e.getAssetVirtualPath)==null?void 0:n.call(e,t)},resolveSourceRef:t=>{var n,s;return(s=(n=e.getAssetByVirtualPath)==null?void 0:n.call(e,t))==null?void 0:s.id},resolveAssetKind:t=>{var s,r,i,c;const n=(c=(i=(r=(s=e.getAssetByVirtualPath)==null?void 0:s.call(e,t))==null?void 0:r.getMetaConfig)==null?void 0:i.call(r))==null?void 0:c.type;return n==="Prefab"||n==="glTF"?n:void 0}})}_convertDomainRefsToSourceRefs(e){return this._createSourceSerializeContext().convertRefs(e)}_convertSourceRefsToDomainRefs(e){const t=this._createSourceRefCodec();return ft(e,n=>t.sourceToDomain(n,"prefab source"))}_componentSchemaToSourceRefs(e){var s,r;const t=this._createSourceSerializeContext(),n=structuredClone(e);return(s=n.script)!=null&&s.$ref&&(n.script={$ref:this._componentScriptRefToSourceRef(n.script.$ref),...n.script.key?{key:n.script.key}:{}}),n.props&&(n.props=t.convertRefs(n.props)),(r=n.calls)!=null&&r.length&&(n.calls=t.convertRefs(n.calls)),n}_componentScriptRefToSourceRef(e){var n,s,r;const t=this._createSourceRefCodec();return(r=(s=(n=this.root.assetStore).getAssetByVirtualPath)==null?void 0:s.call(n,e))!=null&&r.id?(lt(e,"prefab script"),e):t.domainToSource(e,"prefab script")}_findSourceComponentModel(e){var n,s;const t=[...((n=this._entityManager)==null?void 0:n.rootEntities)??[]];for(;t.length>0;){const r=t.pop(),i=(s=r==null?void 0:r.components)==null?void 0:s.find(c=>(c==null?void 0:c.id)===e);if(i)return i;t.push(...(r==null?void 0:r.children)??[])}}_componentPropsOverrideToSourcePatch(e,t){const n=this._findSourceComponentModel(e);if(!n||typeof n.toJSON!="function")return this._convertDomainRefsToSourceRefs(t);const s=c=>this._componentSchemaToSourceRefs(c.toJSON()),r=ht(n,s),i=pt(n,t,s);return mt(r,i)}_serializeEntityTreeForSource(e,t={}){const n=t.materializeRootPrefabInstance?null:this._serializeNestedInstanceRootEntityForSource(e);if(n)return{entities:[n],entityIds:[e.id],components:[],componentIds:[]};const s=this._collectEntitySubtree(e,{materializeRootPrefabInstance:t.materializeRootPrefabInstance}),r=s.map(c=>c.id),i=this._createSourceSerializeContext(r);return{entities:s.map((c,a)=>a===0&&t.materializeRootPrefabInstance?c.toV2(i,!0):this._serializeNestedInstanceRootEntityForSource(c)??c.toV2(i,!0)),entityIds:i.entityIds,components:i.components,componentIds:i.componentIds}}_serializeRootEntityTreeForSource(e){const t=this._serializeNestedInstanceRootInlineForSource(e);return t?{entities:[t],entityIds:[e.id],components:[],componentIds:[]}:this._serializeEntityTreeForSource(e)}_sourceEntityTreeToInlineEntity(e,t=0){const n=e.entities[t];if(!n)throw new Error(`Prefab source added entity tree is missing entity index ${t}`);const{children:s,components:r,...i}=n,c=structuredClone(i),a=new Map(e.components.map(u=>[u.id,u]));r!=null&&r.length&&(c.components=r.map(u=>{const p=a.get(u);if(!p)throw new Error(`Prefab source added entity tree is missing component "${String(u)}"`);return structuredClone(p)}));const d=new Map(e.entities.map((u,p)=>[u.id,p]));return s!=null&&s.length&&(c.children=s.map(u=>{const p=d.get(u);if(p===void 0)throw new Error(`Prefab source added entity tree is missing child "${String(u)}"`);return this._sourceEntityTreeToInlineEntity(e,p)})),c}_serializeEntityInlineForSource(e){const t=this._serializeNestedInstanceRootInlineForSource(e);return t||this._sourceEntityTreeToInlineEntity(this._serializeEntityTreeForSource(e))}_serializeNestedInstanceRootEntityForSource(e){const t=this._resolveNestedInstanceAssetRef(e);if(!t)return null;const n=this._serializeNestedInstanceRootFromEntityModel(e,t);if(n)return n;const s={id:e.id,instance:{asset:t}};return this._mergeEntitySourcePropsIntoInstanceOverrides(s,e),s}_serializeNestedInstanceRootInlineForSource(e){const t=this._serializeNestedInstanceRootEntityForSource(e);if(!t)return null;const{children:n,components:s,...r}=t;return r}_serializeNestedInstanceRootFromEntityModel(e,t){if(typeof e.toV2!="function")return null;const n=this._createSourceSerializeContext([e.id]),s=e.toV2(n,!1);if(!s.instance)return null;const{children:r,components:i,...c}=structuredClone(s);return c.instance={...c.instance,asset:{...c.instance.asset??{},$ref:t.$ref}},this._mergeEntitySourcePropsIntoInstanceOverrides(c,e),c}_mergeEntitySourcePropsIntoInstanceOverrides(e,t){if(!e.instance)return;const n={};if(this._writeEntitySourceProps(n,t),Object.keys(n).length===0)return;const s=e.instance.overrides??{},r=[...s.entityProps??[]],i=this._resolveNestedInstanceRootOverrideTarget(t),c=r.findIndex(a=>a.target===i);if(c>=0){const a=r[c];r[c]={...n,...a,target:i}}else r.unshift({target:i,...n});e.instance.overrides={...s,entityProps:r}}_resolveNestedInstanceRootOverrideTarget(e){var s,r;const t=this._findInstanceRootBinding(e.id);if(t!=null&&t.sourceRootEntityId)return t.sourceRootEntityId;if(((t==null?void 0:t.assetKind)??((r=(s=this._resolveNestedInstanceAsset(e))==null?void 0:s.getMetaConfig)==null?void 0:r.call(s).type))==="glTF")return"root";throw new Error(`Cannot serialize nested instance "${e.id}": missing source root entity id for instance overrides.`)}_resolveNestedInstanceAssetRef(e){var r;if(!this._isNestedInstanceRootForSource(e))return null;const t=this._resolveNestedInstanceAsset(e);if(!t)throw new Error(`Cannot serialize nested instance "${e.id}": source asset is not registered.`);const n=(r=t.getMetaConfig)==null?void 0:r.call(t).type;if(n!=="Prefab"&&n!=="glTF")throw new Error(`Cannot serialize nested instance "${e.id}": asset "${t.id}" is type "${n}".`);return{$ref:this._createSourceRefCodec().domainToSource(t.id,`nested instance "${e.id}"`)}}_isNestedInstanceRootForSource(e){var n;const t=this._findInstanceRootBinding(e.id);return(t==null?void 0:t.assetKind)==="Prefab"||(t==null?void 0:t.assetKind)==="glTF"?!0:!!(e.isGLTFRefEntity&&!((n=e.parentEntity)!=null&&n.isGLTFRefEntity))}_findInstanceRootBinding(e){var t,n,s;return Object.values(((s=(n=(t=this.root.domainStore)==null?void 0:t.state)==null?void 0:n.prefab)==null?void 0:s.bindings)??{}).find(r=>r.instanceRootEntityId===e)}_resolveNestedInstanceAsset(e){var s,r;const t=this._findInstanceRootBinding(e.id);if((t==null?void 0:t.assetKind)==="Prefab"||(t==null?void 0:t.assetKind)==="glTF")return(s=this.root.assetStore.assets)==null?void 0:s[t.assetId];const n=(r=e.engineObject)==null?void 0:r._templateResource;if(n)return this.root.assetStore.engineObjectToAssetMap.get(n)}_writeEntitySourceProps(e,t){t.name&&(e.name=t.name),t.isActive===!1&&(e.isActive=!1),t.isLocked&&(e.isLocked=!0);const n=t.layer,s=Array.isArray(n)?we(n):typeof n=="number"?n:0;s!==0&&(e.layer=s),this._writeEntityTransformTuples(e,t)}_writeEntityTransformTuples(e,t){const n=t.transform;if(!n)return;const s=(d,u)=>[Number((d==null?void 0:d.x)??u[0]),Number((d==null?void 0:d.y)??u[1]),Number((d==null?void 0:d.z)??u[2])],r=(d,u)=>d[0]===u[0]&&d[1]===u[1]&&d[2]===u[2],i=s(n.position,ue);r(i,ue)||(e.position=i);const c=s(n.rotation,fe);r(c,fe)||(e.rotation=c);const a=s(n.scale,le);r(a,le)||(e.scale=a)}destroy(){super.destroy(),this.engineObject&&(this.engineObject._root.destroy(),this.engineObject.destroy())}unpackAllInstances(){var n;const e=this.root.sceneStore,t=this._queryInstanceEntityIdsFromDomain();for(const s of t){const r=(n=e.getEntityModel)==null?void 0:n.call(e,s);r==null||r.unpackPrefab()}super.unpackAllInstances()}async instantiate(e,t,n){var l;const s=structuredClone(this.prefabFile),r=yt(s);if(typeof s.root!="string")throw new Error(`Prefab asset "${this.id}" source root must be a stable source entity id.`);const i=r.entityIndexById.get(s.root);if(i===void 0)throw new Error(`Prefab asset "${this.id}" source root "${s.root}" was not indexed.`);const c=s.entities[i];c&&In(c,t);const a=this._assignSceneInstanceIds(s,i,n==null?void 0:n.expectedRootId),d=f=>{var h,m;return(m=(h=this.root.assetStore).getAssetByVirtualPath)==null?void 0:m.call(h,f)},u=await e.hydrateSourceV2LocalEntities(s,{resolveSourceRef:f=>{var m;const h=(m=d(f))==null?void 0:m.id;if(typeof h!="string"||h.length===0)throw new Error(`[SceneV2] Unable to resolve asset ref "${f}" while instantiating prefab "${this.id}". Source-v2 $ref must be a virtualPath, not an editor asset id.`);return h},resolveAssetKind:f=>{var m,E,P;const h=(P=(E=(m=d(f))==null?void 0:m.getMetaConfig)==null?void 0:E.call(m))==null?void 0:P.type;return h==="Prefab"||h==="glTF"?h:void 0},resolvePrefabSourceFile:f=>{var m,E,P,_;const h=(E=(m=this.root.assetStore).getAsset)==null?void 0:E.call(m,f);return((_=(P=h==null?void 0:h.getMetaConfig)==null?void 0:P.call(h))==null?void 0:_.type)==="Prefab"?h.prefabFile:void 0},clearExisting:!1,registerDomain:(n==null?void 0:n.deferDomainBinding)!==!0,deferredInstanceBindings:(n==null?void 0:n.deferredInstanceBindings)??[]}),p=(l=s.entities[i])==null?void 0:l.id,y=(p?e.entities.get(p):void 0)??u[0];if(await this._ensureSourceEntityManagerReady(),y.convertToPrefabRefEntity(),(n==null?void 0:n.deferDomainBinding)!==!0&&e.isDomainScoped&&!this.root.domainStore.state.entities[y.id]&&e.registerEntityTreeInDomain(y,null),this.addInstance(y,n),n!=null&&n.deferDomainBinding){if(!n.deferredInstanceBindings)throw new Error(`PrefabAsset "${this.id}" cannot defer domain binding without a deferred binding queue.`);return n.deferredInstanceBindings.push(()=>this._bindInstantiatedEntity(y,{...n,...a})),y}return this._bindInstantiatedEntity(y,{...n,...a}),y}_assignSceneInstanceIds(e,t,n){const s=new Map;e.entities.forEach((i,c)=>{s.set(i.id,n&&c===t?n:Pe())});const r=new Map;return e.components.forEach(i=>{r.set(i.id,Pe())}),this._remapLocalHydrationIds(e,s,r),{sourceEntityIdBySceneId:Fe(s),sourceComponentKeyBySceneComponentId:Fe(r)}}_remapLocalHydrationIds(e,t,n){const s=r=>{if(Array.isArray(r))return r.map(a=>s(a));if(!r||typeof r!="object")return r;const i=r;if(typeof i.$entity=="string")return{$entity:t.get(i.$entity)??i.$entity};if(typeof i.$component=="string")return{$component:n.get(i.$component)??i.$component};const c={};for(const[a,d]of Object.entries(i))c[a]=s(d);return c};e.root=t.get(e.root)??e.root,e.entities=e.entities.map(r=>{var a,d;const i=r.id,c=structuredClone(r);return c.id=t.get(i)??i,(a=c.children)!=null&&a.length&&(c.children=c.children.map(u=>t.get(u)??u)),(d=c.components)!=null&&d.length&&(c.components=c.components.map(u=>n.get(u)??u)),c}),e.components=e.components.map(r=>{var c;const i=structuredClone(r);return i.id=n.get(r.id)??r.id,i.props&&(i.props=s(i.props)),(c=i.calls)!=null&&c.length&&(i.calls=s(i.calls)),i})}async _ensureSourceEntityManagerReady(){if(!this._entityManager.rootEntities[0]&&(await this._entityManager.init(this),!this._entityManager.rootEntities[0]))throw new Error(`PrefabAsset "${this.id}" has no source root entity after source initialization.`)}_updateCreateByAddResumeSnapshot(){const e=this.getMainData(),t=this.getMetaData(),n=this.name??"Prefab";if(typeof e!="string"||e.length===0)throw new Error(`[PrefabAsset] ${n} (${this.id}) cannot update create-by-add resume snapshot without serialized main data.`);const s=new Blob([e],{type:"application/json"});this.root.assetStore.updateCreateByAddResumeSnapshot(this.id,{assetName:n,serializedMeta:JSON.stringify(t),mainBlob:s})}_bindInstantiatedEntity(e,t){if(e.entityManager&&!e.entityManager.isDomainScoped)return;const n=this._entityManager.rootEntities[0];if(!n)return;const{prefab:s}=this.root.domainStore.state,r=s.byAssetId[this.id]??[],i=r.map(l=>s.bindings[l]).find(l=>(l==null?void 0:l.instanceRootEntityId)===e.id||(t==null?void 0:t.expectedBindingId)===(l==null?void 0:l.id)),c=i?new Set(Object.keys(i.overrides.removedEntities??{})):void 0,a=i?new Map(Object.entries(i.overrides.removedComponents??{}).map(([l,f])=>[l,new Set(Object.keys(f??{}))])):void 0,{entityMappings:d,componentMappings:u,sourceEntitySnapshots:p}=this._collectInstanceMappings(n,e,c!=null&&c.size||a!=null&&a.size?{...t,...c!=null&&c.size?{allowMissingSceneChildSourceIds:c}:{},...a!=null&&a.size?{allowMissingSceneComponentSourceKeys:a}:{}}:t);if(!d.length)return;for(const l of r){const f=s.bindings[l];if((f==null?void 0:f.instanceRootEntityId)===e.id||(t==null?void 0:t.expectedBindingId)===l){t!=null&&t.syncPreservedInstanceState&&this._syncPreservedInstanceStateFromSource(f,p),this.root.prefabFacade.updateBindingSourceBaseline({assetId:this.id,bindingId:l,instanceRootEntityId:e.id,sourceRevision:f.sourceRevision,entityMappings:d,componentMappings:u,sourceEntitySnapshots:p});return}}let y=1;for(const l of r){const f=s.bindings[l];f&&f.sourceRevision>y&&(y=f.sourceRevision)}this.root.prefabFacade.bindExistingInstance({assetId:this.id,instanceRootEntityId:e.id,sourceRevision:y,entityMappings:d,componentMappings:u,sourceEntitySnapshots:p,undoable:(t==null?void 0:t.undoable)===!0})}_syncPreservedInstanceStateFromSource(e,t){const n=this.root.domainStore.getNormalizedState(),s=[];for(const[r,i]of Object.entries(t)){const c=i.sceneEntityId??e.sourceToSceneEntity[r];if(!c)continue;const a=n.entities[c];if(!a)continue;const d=`/entities/${ne(c)}`,u=e.overrides.entityProps[r];(u==null?void 0:u.name)===void 0&&i.name!==void 0&&a.name!==i.name&&s.push({op:"replace",path:`${d}/name`,value:i.name}),(u==null?void 0:u.isActive)===void 0&&i.isActive!==void 0&&a.isActive!==i.isActive&&s.push({op:"replace",path:`${d}/isActive`,value:i.isActive}),(u==null?void 0:u.layer)===void 0&&(i.layer===void 0?a.layer!==void 0&&s.push({op:"remove",path:`${d}/layer`}):a.layer!==i.layer&&s.push({op:a.layer===void 0?"add":"replace",path:`${d}/layer`,value:i.layer}));const p=u==null?void 0:u.transform;for(const l of["position","rotation","scale"]){if((p==null?void 0:p[l])!==void 0)continue;const f=i.transform[l];_e(a.transform[l],f)||s.push({op:"replace",path:`${d}/transform/${l}`,value:f})}const y=e.overrides.componentProps[r]??{};for(const[l,f]of Object.entries(i.components)){const h=f.sceneComponentId;if(!h)continue;const m=n.components[h];if(!m)continue;const E=`${d}/components/${ne(h)}`,P=y[l]??{},_=f.props??{};for(const[g,T]of Object.entries(_)){if(Object.prototype.hasOwnProperty.call(P,g))continue;const V=`${E}/props/${ne(g)}`;_e(m.props[g],T)||s.push({op:Object.prototype.hasOwnProperty.call(m.props,g)?"replace":"add",path:V,value:T})}for(const g of Object.keys(m.props))Object.prototype.hasOwnProperty.call(_,g)||Object.prototype.hasOwnProperty.call(P,g)||s.push({op:"remove",path:`${E}/props/${ne(g)}`})}}this.root.domainStore.applySystem(s)}_collectInstanceMappings(e,t,n){var s,r,i;return mn({assetId:this.id,prefabFile:this._requirePrefabSourceFile(),sourceRoot:e,sceneRoot:t,normalized:(i=(r=(s=this.root)==null?void 0:s.domainStore)==null?void 0:r.getNormalizedState)==null?void 0:i.call(r),sceneSourceEntityIds:n==null?void 0:n.sourceEntityIdBySceneId,sceneSourceComponentKeys:n==null?void 0:n.sourceComponentKeyBySceneComponentId,allowMissingSceneChildSourceIds:n==null?void 0:n.allowMissingSceneChildSourceIds,allowMissingSceneComponentSourceKeys:n==null?void 0:n.allowMissingSceneComponentSourceKeys,resolveInstanceAsset:(c,a)=>{var y,l,f,h;const d=(l=(y=this.root.assetStore).getAssetByVirtualPath)==null?void 0:l.call(y,c);if(!d)throw new Error(`Prefab source entity "${a}" references missing instance asset "${c}".`);const u=(h=(f=d.getMetaConfig)==null?void 0:f.call(d))==null?void 0:h.type;if(u!=="Prefab"&&u!=="glTF")throw new Error(`Prefab source entity "${a}" references unsupported instance asset "${c}" of type "${String(u)}".`);const p=d.prefabFile;return{id:d.id,kind:u,...u==="Prefab"&&typeof(p==null?void 0:p.root)=="string"?{sourceRootEntityId:p.root}:{}}},resolveSourceAssetRefToDomainId:(c,a)=>this._createSourceRefCodec().sourceToDomain(c,a),convertSourceRefsToDomainRefs:c=>this._convertSourceRefsToDomainRefs(c),collectComponentProps:(c,a)=>this._collectSnapshotComponentProps(c,a),combineLayers:c=>we(c)})}_requirePrefabSourceFile(e="using prefab source file"){const t=this.prefabFile;if(!t)throw new Error(`Prefab asset "${this.id}" has no source file while ${e}.`);if(!Array.isArray(t.entities))throw new Error(`Prefab asset "${this.id}" source file is missing entity anchors.`);return t}_resolveSourceChildInsertionIndex(e,t,n){var p,y,l;const s=this._requirePrefabSourceFile(),r=s.entities.findIndex(f=>f.id===e);if(r<0)return t;const i=new Set(((p=s.entities[r])==null?void 0:p.children)??[]);if(i.size===0)return 0;const c=((y=n.parentEntity)==null?void 0:y.children)??[],a=c.findIndex(f=>f.id===n.id),d=a>=0?a:Math.min(Math.max(t,0),c.length);let u=0;for(let f=0;f<d;f+=1){const h=(l=c[f])==null?void 0:l.instanceSourceEntityId;h&&i.has(h)&&(u+=1)}return Math.min(Math.max(u,0),i.size)}_collectSnapshotComponentProps(e,t){return e&&Reflect.ownKeys(St(e)).length>0?this._convertSourceRefsToDomainRefs(bt(e)):this._convertSourceRefsToDomainRefs(structuredClone(t.props??{}))}async replaceInstance(e,t,n){var d,u,p;const s=t.entities.get(e);if(!s)return null;const r=(d=s==null?void 0:s.engineObject)==null?void 0:d.transform,i=r?{position:{x:r.position.x,y:r.position.y,z:r.position.z},rotation:{x:r.rotation.x,y:r.rotation.y,z:r.rotation.z},scale:{x:r.scale.x,y:r.scale.y,z:r.scale.z}}:void 0,c=(p=(u=s.root.domainStore.getNormalizedState().entities[e])==null?void 0:u.instance)==null?void 0:p.bindingId,a=await this.instantiate(t,n!=null&&n.resetRootTransform?void 0:i,{...n!=null&&n.undoable?{undoable:!0}:{},expectedBindingId:c});return a.convertToPrefabRefEntity(),n!=null&&n.structuralDeltaMode?t.replaceEntity(e,a,{structuralDeltaMode:n.structuralDeltaMode}):t.replaceEntity(e,a),a}_refreshTrackedInstanceBindings(e){var s;const t=this.root.sceneStore,n=this._queryInstanceEntityIdsFromDomain();for(const r of n){const i=(s=t.getEntityModel)==null?void 0:s.call(t,r);i&&this._bindInstantiatedEntity(i,e)}}_instantiateEngineObject(){return this.engineObject.instantiate()}_onDrop(e,t){if(!t||t.id===this.id)return;this.dropping=!1;const{sceneStore:n,sceneUIStore:s}=this.root,r=Array.from(s.selectedKeys);if(r.length>1)for(let i=0;i<r.length;i++)j.createByEntity(n.getEntityModel(r[i]));else It({title:J("prefab.replace.title").toString(),description:J("prefab.replace.description",{name:this.name}).toString(),confirmText:J("prefab.replace.confirm").toString(),onConfirm:()=>{const i=n.getEntityModel(r[0]);this.updateByEntity(i,!0)}})}_rebaseInstanceRevisions(){const{prefabFacade:e,domainStore:t}=this.root,n=t.state.prefab.byAssetId[this.id];if(!n||n.length===0)return;let s=0;for(const r of n){const i=t.state.prefab.bindings[r];i&&i.sourceRevision>s&&(s=i.sourceRevision)}e.updatePrefabContent(this.id,s+1)}_collectEntitySubtree(e,t={}){const n=[],s=(r,i=!1)=>{if(n.push(r),!(this._isNestedInstanceRootForSource(r)&&!(i&&t.materializeRootPrefabInstance)))for(const a of r.children)a.prefabEntityRemoved||s(a)};return s(e,!0),n}_collectDependentAssetsFromPrefabFile(){var n;const e=new Set,t=this.root.assetStore;for(const s of Tt(this.prefabFile,["$ref"])){if(typeof s!="string"||s===this.id)continue;const r=(n=t.getAssetByVirtualPath)==null?void 0:n.call(t,s);if(!r)throw new Error(`[SceneV2] Unable to resolve prefab asset ref "${s}" while collecting dependencies`);r.id!==this.id&&e.add(r)}return e}_syncDependentAssetsFromPrefabFile(){const e=this.root.assetStore;this.dependentAssets=Array.from(this._collectDependentAssetsFromPrefabFile(),t=>({id:t.id,name:t.name,type:t.getMetaConfig().type,ref:(()=>{var s;const n=(s=e.getAssetVirtualPath)==null?void 0:s.call(e,t.id);if(typeof n!="string"||n.length===0)throw new Error(`[SceneV2] Unable to serialize prefab dependency ref "${t.id}": missing virtualPath`);return n})()}))}_updateContent(e){return this._contentQueue.enqueue(async()=>{try{await this._updateContentInternal(e)}catch(t){if(t instanceof Error&&t.message==="cancelled")return;throw O.error("_updateContent failed:",t),t}})}async _updateContentInternal(e){const{url:t,dependentAssets:n}=this,s=(e==null?void 0:e.persist)!==!1;await Promise.all(n.map(a=>this.root.assetStore.getAssetByRef({refId:a.id}))),await this._entityManager.init(this);const r=this.engineObject;if(r){this.root.assetStore.engineObjectToAssetMap.delete(r);try{r.destroy()}catch(a){O.warn("failed to destroy oldEngineObject:",a)}}const i=new gt(this.engine,t);this.bindEngineObject(i),this.root.assetStore.engineObjectToAssetMap.set(i,this);let c=this._entityManager.rootEntities[0];if(c||(c=this._entityManager.createEntity("prefab","defaultPrefab"),c.bindEngineObject(new Ce(this.engine,"prefab")),O.error(`The prefab which id is ${this.id} is broken, use default prefab instead.`)),c.engineObject||(O.warn("rootEntity engineObject is null, binding new Entity"),c.bindEngineObject(new Ce(this.engine,"prefab"))),this._markAsTemplate(c),i._root=c.engineObject,c.once("delete",()=>{O.error(`The prefab which id is ${this.id} is broken.`),this._updateContent().catch(a=>{O.error(`Failed to rebuild broken prefab which id is ${this.id}.`,a)})}),this._updateDragTempEntity(),this.updateThumbnail(),s&&(this.root.assetFacade.persistAssetMeta(this.id),this.root.assetFacade.persistAssetMain(this.id)),(e==null?void 0:e.replaceInstances)!==!1){const a=new Set((e==null?void 0:e.resetRootTransformBindingIds)??[]),d=e!=null&&e.undoable?{undoable:!0}:void 0,u=this.root.sceneStore,p=this._queryInstanceEntityIdsFromDomain();await Promise.all(p.map(y=>{var f,h;const l=(h=(f=this.root.domainStore.getNormalizedState().entities[y])==null?void 0:f.instance)==null?void 0:h.bindingId;return this.replaceInstance(y,u,{...d??{},resetRootTransform:l!==void 0&&a.has(l),...e!=null&&e.structuralDeltaMode?{structuralDeltaMode:e.structuralDeltaMode}:{}})}))}else{const a={...e!=null&&e.undoable?{undoable:!0}:{},syncPreservedInstanceState:!0};this._refreshTrackedInstanceBindings(a)}this._rebaseInstanceRevisions()}_markAsTemplate(e){const t=e.engineObject;if(!t){O.warn("_markAsTemplate: engineObject is null",{prefabId:this.id,entityModelId:e.id});return}const n=t;n._templateResource||n._markAsTemplate(this.engineObject),e.selfChildren.forEach(s=>{this._markAsTemplate(s)})}};X([Et()],j.prototype,"prefabFile",2);X([wt(),Pt],j.prototype,"dependentAssets",2);X([ke],j.prototype,"replaceDependentAsset",1);X([ke],j.prototype,"_onDrop",1);j=X([_t({type:"Prefab",label:J("asset.prefab.title"),extname:"prefab",dragLayer:he.Prefab,customInspector:Zt,viewer:tn,thumbnail:ae,async bundle(o){return{content:new Blob([o.content],{type:"application/json"})}}})],j);export{j as PrefabAsset};
@@ -1 +0,0 @@
1
- var E=Object.defineProperty;var O=(r,t,e)=>t in r?E(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var m=(r,t,e)=>(O(r,typeof t!="symbol"?t+"":t,e),e);import{aJ as v,aK as x,aM as _,av as y,c4 as V,aO as j,E as I,C as h,c5 as S,c6 as B,x as C,p as b,e as w,bM as R,c7 as T}from"./index-c3dec278.js";import{r as g}from"./index-cdbb2f4d.js";import{c as A}from"./Component-0f881fc1.js";import"./postmen-2853c0e6.js";import{c as F}from"./create-script-property-context-model-0fe0258f.js";import"./TextureAsset-a7ff39b1.js";import"./GlTFAsset-5970e707.js";import"./MaterialAsset-5353c4cb.js";import"./MeshAsset-c2bf60c5.js";import"./AnimatorControllerAsset-2716497a.js";import"./AnimationClipAsset-d7b37af0.js";import"./ShaderChunkAsset-e43dde8a.js";import"./AmbientLightAsset-be9e872c.js";import"./SpineSkeletonDataAsset-43b731f1.js";import"./FontAsset-d34b5378.js";import"./SceneAsset-08752701.js";import"./ShaderAsset-a9d667f5.js";import"./PrimitiveMesh-075dda8a.js";import"./XRReferenceImageAsset-96f516ba.js";import"./PrefabAsset-59743dbb.js";import"./PhysicsMaterialAsset-a2f73b5c.js";import"./RenderTargetAsset-b3cd1c49.js";import"./AudioAsset-c28f33ab.js";import"./index-da16047f.js";import"./MarkdownAsset-b2a3fad5.js";import{E as k}from"./ShaderUIScriptAsset-e1cd0b8b.js";import"./ktx2-encoder-db93524f.js";import"./TaskQueue-05c94a4d.js";import"./ktx-parse.modern-6c9f771f.js";import"./encode-ac4bb64e.js";import"./meshopt_simplifier.module-cd99529d.js";import"./Tooltip-b5be390f.js";import"./createReactComponent-58d9f0dd.js";import"./AssetViewer-3847c058.js";import"./glTFIO-45ff9a17.js";import"./MaterialInspector-8d466d59.js";import"./IconPointFilled-62d3c3b2.js";import"./shader-data-utils-f0e4f5a3.js";import"./index-05b76766.js";import"./MeshThumbnail-07ffa076.js";import"./bundlers-9b0d37fc.js";import"./module-ec094ef6.js";import"./module-ada3dced.js";import"./IconPlus-def01e2b.js";import"./FormItemArray-b8cda1d2.js";import"./Accordion-2cd014f1.js";import"./module-de7ee724.js";const $=["Input","Boolean","Switch","Toggle","Slider","Number","Vector2","Vector3","Vector4","Rect","Color","Select","AssetPicker","Textarea","SegmentControl"];function N(r){r=r.replace(/\/\/.*$/gm,"").replace(/,\s*}/gm,"}");const t=/@inspect\(['"](\w+)['"],?\s?(\{[\s\S]*?\})?\)\s*(?:public|private|static)?\s*(\w+)[:\s\w]+?\s*=\s*(?:['"]([^'"]*?)['"]|(-?[\w.]+));?/g,e=[];let p;for(;(p=t.exec(r))!==null;){let[,o,s,i,a,c]=p,l=a??c;if($.indexOf(o)===-1){console.warn(`Unsupported property type: ${o}`);continue}let n={property:i.toString(),label:i.toString(),type:o};if(s){s=s.trim().replace(/\s+/g," ").replace(/'/g,'"').replace(/(\w+):/g,'"$1":');try{n=JSON.parse(s),n.type=o,n.label=n.label||i,n.property=n.property||i}catch{console.warn(`Failed to parse property options: ${s}`)}}["Number","Slider"].includes(o)&&(l=parseFloat(l)),e.push({propertyType:o,propertyOptions:n,propertyName:i,propertyValue:l})}return e}async function P(r){const t=N(r.code),e={success:!1,model:{},config:[]};for(let p=0;p<t.length;p++){const o=t[p];e.model[o.propertyName]=o.propertyValue,e.config.push(o.propertyOptions)}return e.success=!0,e}function M(r){return r!=null&&r.$ref?{refId:r.$ref,...r.key?{key:r.key}:{}}:null}function J(r,t){if(!r)return;const e=t(r.refId);if(typeof e!="string"||e.length===0)throw new Error(`[SceneV2] Unable to serialize script asset ref "${r.refId}": missing virtualPath`);return{$ref:e,...r.key?{key:r.key}:{}}}var z=Object.defineProperty,D=Object.getOwnPropertyDescriptor,u=(r,t,e,p)=>{for(var o=p>1?void 0:p?D(t,e):t,s=r.length-1,i;s>=0;s--)(i=r[s])&&(o=(p?i(t,e,o):i(o))||o);return p&&o&&z(t,e,o),o};const q=new BroadcastChannel("Galacean_Editor_Channel"),L=v(function(t){const{model:e}=t,{t:p}=x(),o=F(e.properties,e.root),s=a=>{Object.keys(a.properties).forEach(c=>{R(a,c,{getActualEditorValue:()=>S(a.properties[c]),setActualEditorValue:(l,n,d)=>{l.properties[n]=d}})})};async function i(){e.parsed=!1;const a=e.root.assetStore.getAsset(e.script.refId),c=await T.assets.getAssetInfo(a.serverId),l=await fetch(c.data.url).then(d=>d.text());await g.assetFacade.applyRemoteCodeChange(a.id,l,c.data.url);const n=await P(a);n.success&&(e.parsed=!0,e.propertiesConfig=n.config,e.properties=n.model,s(e))}return _.useEffect(()=>{e!=null&&e.properties&&s(e)},[e.properties]),e.script?y.jsxs(y.Fragment,{children:[y.jsx(V,{label:" ",async:i,children:p("component.script.parse-properties")}),e.parsed&&e.properties&&y.jsx(j.List,{model:o,configs:e.propertiesConfig,onModelChange:(a,c)=>{q.postMessage({type:"script-inspector-value-change",payload:{instanceId:e.id,property:a,value:c}}),g.inspectorFacade.componentChange(e.id,a,c)}})]}):null});let f=class extends I{constructor(){super(...arguments);m(this,"parsed",!1);m(this,"propertiesConfig",[]);m(this,"isScript",!0);m(this,"script",null);m(this,"properties",{})}onInitComplete(){this._attachEditorScriptBridge()}async _attachEditorScriptBridge(){if(this.script)try{const t=await this.root.assetStore.getAssetByRef(this.script);if(!t)throw new Error(`Cannot find file ${JSON.stringify(this.script)}`);await this.applyBoundPathChange("_scriptRef",h.AssetPicker,this.script);const e=await P(t);this.propertiesConfig=e.config;for(const[p,o]of Object.entries(e.model))this.properties[p]=this.properties[p]??o;this.parsed=!0}catch(t){console.warn(t)}}rebindEngineObject(t){super.rebindEngineObject(t),this._attachEditorScriptBridge()}async applyBoundPathChange(t,e,p){if(t==="_scriptRef"){this.setBoundPathValue(t,h.Input,p);return}await super.applyBoundPathChange(t,e,p)}deserialize(t){if(super.deserialize(t),this.script=M(t.script),t.props)for(const[e,p]of Object.entries(t.props))e!=="enabled"&&(this.properties[e]=p)}toJSON(){const t=super.toJSON();if(delete t.props.script,this.properties){const p=S(this.properties);for(const[o,s]of Object.entries(p)){if(o==="root")continue;const i=B(s);i!==void 0&&(t.props[o]=i)}}const e=J(this.script,p=>{var o,s;return(s=(o=this.root.assetStore).getAssetVirtualPath)==null?void 0:s.call(o,p)});return e&&(t.script=e),t}};u([C],f.prototype,"parsed",2);u([C.ref],f.prototype,"propertiesConfig",2);u([b({label:w("component.script.script-label"),type:h.AssetPicker,assetType:"script",bindPath:"_scriptRef",customFilter:r=>r.subType===k.Default,onLocate:r=>{r.onDoubleClick()}})],f.prototype,"script",2);u([b({label:w("component.script.properties-label"),customComponent:L})],f.prototype,"properties",2);f=u([A({type:"Script",componentsMenu:{label:"component.script.title"}})],f);export{f as ScriptComponent};
@@ -1 +0,0 @@
1
- import{P as a}from"./PostProcessComponent-af270a77.js";import"./index-c3dec278.js";import"./index-cdbb2f4d.js";import"./Component-0f881fc1.js";import"./postmen-2853c0e6.js";import"./IconPlus-def01e2b.js";import"./createReactComponent-58d9f0dd.js";import"./Menu-c8e6194b.js";import"./Accordion-2cd014f1.js";export{a as PostProcessComponent};
@@ -1 +0,0 @@
1
- import{K as E,b as w,T as I,a as R}from"./TextureAsset-a7ff39b1.js";import{G as F,a as G}from"./GlTFAsset-5970e707.js";import{M as U,a as V}from"./MaterialAsset-5353c4cb.js";import{MeshAsset as X}from"./MeshAsset-c2bf60c5.js";import{AnimatorControllerAsset as D}from"./AnimatorControllerAsset-2716497a.js";import{A as j,a as q,b as z}from"./AnimationClipAsset-d7b37af0.js";import{L as H,c as J,b as N,S as Q,a as W}from"./ShaderChunkAsset-e43dde8a.js";import{AmbientLightAsset as Z}from"./AmbientLightAsset-be9e872c.js";import{S as $}from"./SpineSkeletonDataAsset-43b731f1.js";import{FontAsset as te}from"./FontAsset-d34b5378.js";import{SceneAsset as se}from"./SceneAsset-08752701.js";import{E as pe,c as ae,b as ie,a as me,S as Ae}from"./ShaderAsset-a9d667f5.js";import{E as fe,a as ne,S as xe,b as he,t as le}from"./ShaderUIScriptAsset-e1cd0b8b.js";import{PrimitiveMesh as ce}from"./PrimitiveMesh-075dda8a.js";import{XRReferenceImageAsset as ye}from"./XRReferenceImageAsset-96f516ba.js";import{PrefabAsset as Me}from"./PrefabAsset-59743dbb.js";import{PhysicsMaterialAsset as Ce}from"./PhysicsMaterialAsset-a2f73b5c.js";import{RenderTargetAsset as ge}from"./RenderTargetAsset-b3cd1c49.js";import{AudioAsset as we}from"./AudioAsset-c28f33ab.js";import{StateMachineScript as Re}from"./index-da16047f.js";import{MarkdownAsset as Fe}from"./MarkdownAsset-b2a3fad5.js";import"./index-c3dec278.js";import"./ktx2-encoder-db93524f.js";import"./TaskQueue-05c94a4d.js";import"./ktx-parse.modern-6c9f771f.js";import"./index-cdbb2f4d.js";import"./postmen-2853c0e6.js";import"./encode-ac4bb64e.js";import"./meshopt_simplifier.module-cd99529d.js";import"./Tooltip-b5be390f.js";import"./createReactComponent-58d9f0dd.js";import"./AssetViewer-3847c058.js";import"./glTFIO-45ff9a17.js";import"./MaterialInspector-8d466d59.js";import"./IconPointFilled-62d3c3b2.js";import"./shader-data-utils-f0e4f5a3.js";import"./index-05b76766.js";import"./MeshThumbnail-07ffa076.js";import"./bundlers-9b0d37fc.js";import"./module-ec094ef6.js";import"./module-ada3dced.js";import"./IconPlus-def01e2b.js";import"./FormItemArray-b8cda1d2.js";import"./Accordion-2cd014f1.js";import"./module-de7ee724.js";export{Z as AmbientLightAsset,j as AnimationClipAsset,q as AnimationClipInspector,z as AnimationClipViewer,D as AnimatorControllerAsset,we as AudioAsset,fe as EScriptSubType,pe as EShaderPropertyType,te as FontAsset,F as GlTFAsset,G as GlTFViewer,E as KTX2Options,H as LottieAsset,Fe as MarkdownAsset,U as MaterialAsset,V as MaterialViewer,X as MeshAsset,Ce as PhysicsMaterialAsset,Me as PrefabAsset,ce as PrimitiveMesh,ge as RenderTargetAsset,se as SceneAsset,ne as ScriptAsset,ae as ShaderAsset,J as ShaderChunkAsset,ie as ShaderPropertyEnumType,me as ShaderPropertyRangeType,Ae as ShaderTemplateConfigs,xe as ShaderUIScript,he as ShaderUIScriptAsset,N as SpineAtlasAsset,$ as SpineSkeletonDataAsset,Q as SpriteAsset,W as SpriteAtlasAsset,Re as StateMachineScript,w as TextureAsset,I as TextureShape,R as TextureUseType,ye as XRReferenceImageAsset,le as scriptTemplates};
@@ -1 +0,0 @@
1
- import{A as a,a as n}from"./AnimatorStore-883a28ad.js";import"./index-c3dec278.js";import"./index-cdbb2f4d.js";import"./Component-0f881fc1.js";import"./postmen-2853c0e6.js";export{a as AnimatorComponent,n as AnimatorStore};
@@ -1 +0,0 @@
1
- import{A,a as l,b as C}from"./AnimationClipAsset-d7b37af0.js";import"./index-c3dec278.js";import"./index-cdbb2f4d.js";import"./postmen-2853c0e6.js";import"./AssetViewer-3847c058.js";import"./encode-ac4bb64e.js";import"./meshopt_simplifier.module-cd99529d.js";import"./module-ec094ef6.js";import"./module-ada3dced.js";export{A as AnimationClipAsset,l as AnimationClipInspector,C as AnimationClipViewer};