@planara/core 1.5.0 → 1.6.0

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 (70) hide show
  1. package/dist/core/editor-renderer.d.ts +26 -39
  2. package/dist/core/editor-renderer.d.ts.map +1 -1
  3. package/dist/core/preview-renderer.d.ts +1 -1
  4. package/dist/core/preview-renderer.d.ts.map +1 -1
  5. package/dist/core/renderer.d.ts +38 -2
  6. package/dist/core/renderer.d.ts.map +1 -1
  7. package/dist/events/editor-events.d.ts +18 -0
  8. package/dist/events/editor-events.d.ts.map +1 -0
  9. package/dist/events/event-bus.d.ts +17 -0
  10. package/dist/events/event-bus.d.ts.map +1 -0
  11. package/dist/events/event-topics.d.ts +12 -0
  12. package/dist/events/event-topics.d.ts.map +1 -0
  13. package/dist/extensions/mesh-extension.d.ts +12 -0
  14. package/dist/extensions/mesh-extension.d.ts.map +1 -0
  15. package/dist/extensions/orbit-extension.d.ts +1 -1
  16. package/dist/extensions/orbit-extension.d.ts.map +1 -1
  17. package/dist/handlers/display/wireframe-handler.d.ts +6 -6
  18. package/dist/handlers/display/wireframe-handler.d.ts.map +1 -1
  19. package/dist/handlers/select/mesh-select-handler.d.ts +25 -0
  20. package/dist/handlers/select/mesh-select-handler.d.ts.map +1 -0
  21. package/dist/hub/app-hub.d.ts +1 -2
  22. package/dist/hub/app-hub.d.ts.map +1 -1
  23. package/dist/hub/editor-hub.d.ts +12 -4
  24. package/dist/hub/editor-hub.d.ts.map +1 -1
  25. package/dist/index.cjs.js +26 -9
  26. package/dist/index.d.ts +8 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.es.js +1448 -1061
  29. package/dist/index.full.d.ts +150 -51
  30. package/dist/index.public.d.ts +114 -28
  31. package/dist/index.umd.js +26 -9
  32. package/dist/interfaces/{mesh-api.d.ts → api/mesh-api.d.ts} +1 -0
  33. package/dist/interfaces/api/mesh-api.d.ts.map +1 -0
  34. package/dist/interfaces/api/renderer-api.d.ts +27 -0
  35. package/dist/interfaces/api/renderer-api.d.ts.map +1 -0
  36. package/dist/interfaces/{display-handler.d.ts → handler/display-handler.d.ts} +1 -0
  37. package/dist/interfaces/handler/display-handler.d.ts.map +1 -0
  38. package/dist/interfaces/{handler.d.ts → handler/handler.d.ts} +2 -1
  39. package/dist/interfaces/handler/handler.d.ts.map +1 -0
  40. package/dist/interfaces/handler/select-handler.d.ts +13 -0
  41. package/dist/interfaces/handler/select-handler.d.ts.map +1 -0
  42. package/dist/interfaces/manager/display-manager.d.ts +8 -0
  43. package/dist/interfaces/manager/display-manager.d.ts.map +1 -0
  44. package/dist/interfaces/{manager.d.ts → manager/manager.d.ts} +0 -6
  45. package/dist/interfaces/manager/manager.d.ts.map +1 -0
  46. package/dist/interfaces/manager/select-manager.d.ts +8 -0
  47. package/dist/interfaces/manager/select-manager.d.ts.map +1 -0
  48. package/dist/ioc/container.d.ts +3 -2
  49. package/dist/ioc/container.d.ts.map +1 -1
  50. package/dist/loaders/obj-loader.d.ts +6 -6
  51. package/dist/loaders/obj-loader.d.ts.map +1 -1
  52. package/dist/managers/{display-manager.d.ts → display/display-manager.d.ts} +4 -4
  53. package/dist/managers/display/display-manager.d.ts.map +1 -0
  54. package/dist/managers/select/select-manager.d.ts +19 -0
  55. package/dist/managers/select/select-manager.d.ts.map +1 -0
  56. package/dist/types/camera/camera-position.d.ts +10 -0
  57. package/dist/types/camera/camera-position.d.ts.map +1 -0
  58. package/dist/types/event/select-event-type.d.ts +6 -0
  59. package/dist/types/event/select-event-type.d.ts.map +1 -0
  60. package/dist/utils/program-settings.d.ts.map +1 -1
  61. package/dist/utils/renderer-api.d.ts +7 -5
  62. package/dist/utils/renderer-api.d.ts.map +1 -1
  63. package/package.json +3 -2
  64. package/dist/interfaces/display-handler.d.ts.map +0 -1
  65. package/dist/interfaces/handler.d.ts.map +0 -1
  66. package/dist/interfaces/manager.d.ts.map +0 -1
  67. package/dist/interfaces/mesh-api.d.ts.map +0 -1
  68. package/dist/interfaces/renderer-api.d.ts +0 -14
  69. package/dist/interfaces/renderer-api.d.ts.map +0 -1
  70. package/dist/managers/display-manager.d.ts.map +0 -1
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("ogl");var Ce=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Te={};/*! *****************************************************************************
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("ogl");var Je=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ye={};/*! *****************************************************************************
2
2
  Copyright (C) Microsoft. All rights reserved.
3
3
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
4
  this file except in compliance with the License. You may obtain a copy of the
@@ -11,7 +11,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
11
11
 
12
12
  See the Apache Version 2.0 License for specific language governing permissions
13
13
  and limitations under the License.
14
- ***************************************************************************** */var Ae;function ft(){if(Ae)return Te;Ae=1;var t;return(function(e){(function(r){var i=typeof globalThis=="object"?globalThis:typeof Ce=="object"?Ce:typeof self=="object"?self:typeof this=="object"?this:w(),a=o(e);typeof i.Reflect<"u"&&(a=o(i.Reflect,a)),r(a,i),typeof i.Reflect>"u"&&(i.Reflect=e);function o(v,b){return function(T,N){Object.defineProperty(v,T,{configurable:!0,writable:!0,value:N}),b&&b(T,N)}}function f(){try{return Function("return this;")()}catch{}}function m(){try{return(0,eval)("(function() { return this; })()")}catch{}}function w(){return f()||m()}})(function(r,i){var a=Object.prototype.hasOwnProperty,o=typeof Symbol=="function",f=o&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",m=o&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",w=typeof Object.create=="function",v={__proto__:[]}instanceof Array,b=!w&&!v,T={create:w?function(){return ee(Object.create(null))}:v?function(){return ee({__proto__:null})}:function(){return ee({})},has:b?function(n,s){return a.call(n,s)}:function(n,s){return s in n},get:b?function(n,s){return a.call(n,s)?n[s]:void 0}:function(n,s){return n[s]}},N=Object.getPrototypeOf(Function),F=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:st(),J=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:at(),Y=typeof WeakMap=="function"?WeakMap:ot(),k=o?Symbol.for("@reflect-metadata:registry"):void 0,W=rt(),he=nt(W);function Fe(n,s,u,l){if(g(u)){if(!_e(n))throw new TypeError;if(!be(s))throw new TypeError;return Ze(n,s)}else{if(!_e(n))throw new TypeError;if(!E(s))throw new TypeError;if(!E(l)&&!g(l)&&!j(l))throw new TypeError;return j(l)&&(l=void 0),u=x(u),Je(n,s,u,l)}}r("decorate",Fe);function Le(n,s){function u(l,y){if(!E(l))throw new TypeError;if(!g(y)&&!et(y))throw new TypeError;ye(n,s,l,y)}return u}r("metadata",Le);function Ge(n,s,u,l){if(!E(u))throw new TypeError;return g(l)||(l=x(l)),ye(n,s,u,l)}r("defineMetadata",Ge);function Ve(n,s,u){if(!E(s))throw new TypeError;return g(u)||(u=x(u)),de(n,s,u)}r("hasMetadata",Ve);function We(n,s,u){if(!E(s))throw new TypeError;return g(u)||(u=x(u)),Q(n,s,u)}r("hasOwnMetadata",We);function ze(n,s,u){if(!E(s))throw new TypeError;return g(u)||(u=x(u)),pe(n,s,u)}r("getMetadata",ze);function Ue(n,s,u){if(!E(s))throw new TypeError;return g(u)||(u=x(u)),ve(n,s,u)}r("getOwnMetadata",Ue);function $e(n,s){if(!E(n))throw new TypeError;return g(s)||(s=x(s)),ge(n,s)}r("getMetadataKeys",$e);function qe(n,s){if(!E(n))throw new TypeError;return g(s)||(s=x(s)),me(n,s)}r("getOwnMetadataKeys",qe);function Be(n,s,u){if(!E(s))throw new TypeError;if(g(u)||(u=x(u)),!E(s))throw new TypeError;g(u)||(u=x(u));var l=L(s,u,!1);return g(l)?!1:l.OrdinaryDeleteMetadata(n,s,u)}r("deleteMetadata",Be);function Ze(n,s){for(var u=n.length-1;u>=0;--u){var l=n[u],y=l(s);if(!g(y)&&!j(y)){if(!be(y))throw new TypeError;s=y}}return s}function Je(n,s,u,l){for(var y=n.length-1;y>=0;--y){var O=n[y],S=O(s,u,l);if(!g(S)&&!j(S)){if(!E(S))throw new TypeError;l=S}}return l}function de(n,s,u){var l=Q(n,s,u);if(l)return!0;var y=K(s);return j(y)?!1:de(n,y,u)}function Q(n,s,u){var l=L(s,u,!1);return g(l)?!1:Me(l.OrdinaryHasOwnMetadata(n,s,u))}function pe(n,s,u){var l=Q(n,s,u);if(l)return ve(n,s,u);var y=K(s);if(!j(y))return pe(n,y,u)}function ve(n,s,u){var l=L(s,u,!1);if(!g(l))return l.OrdinaryGetOwnMetadata(n,s,u)}function ye(n,s,u,l){var y=L(u,l,!0);y.OrdinaryDefineOwnMetadata(n,s,u,l)}function ge(n,s){var u=me(n,s),l=K(n);if(l===null)return u;var y=ge(l,s);if(y.length<=0)return u;if(u.length<=0)return y;for(var O=new J,S=[],M=0,c=u;M<c.length;M++){var h=c[M],d=O.has(h);d||(O.add(h),S.push(h))}for(var p=0,_=y;p<_.length;p++){var h=_[p],d=O.has(h);d||(O.add(h),S.push(h))}return S}function me(n,s){var u=L(n,s,!1);return u?u.OrdinaryOwnMetadataKeys(n,s):[]}function we(n){if(n===null)return 1;switch(typeof n){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return n===null?1:6;default:return 6}}function g(n){return n===void 0}function j(n){return n===null}function Ye(n){return typeof n=="symbol"}function E(n){return typeof n=="object"?n!==null:typeof n=="function"}function Qe(n,s){switch(we(n)){case 0:return n;case 1:return n;case 2:return n;case 3:return n;case 4:return n;case 5:return n}var u="string",l=Re(n,f);if(l!==void 0){var y=l.call(n,u);if(E(y))throw new TypeError;return y}return Xe(n)}function Xe(n,s){var u,l,y;{var O=n.toString;if(z(O)){var l=O.call(n);if(!E(l))return l}var u=n.valueOf;if(z(u)){var l=u.call(n);if(!E(l))return l}}throw new TypeError}function Me(n){return!!n}function Ke(n){return""+n}function x(n){var s=Qe(n);return Ye(s)?s:Ke(s)}function _e(n){return Array.isArray?Array.isArray(n):n instanceof Object?n instanceof Array:Object.prototype.toString.call(n)==="[object Array]"}function z(n){return typeof n=="function"}function be(n){return typeof n=="function"}function et(n){switch(we(n)){case 3:return!0;case 4:return!0;default:return!1}}function X(n,s){return n===s||n!==n&&s!==s}function Re(n,s){var u=n[s];if(u!=null){if(!z(u))throw new TypeError;return u}}function Oe(n){var s=Re(n,m);if(!z(s))throw new TypeError;var u=s.call(n);if(!E(u))throw new TypeError;return u}function Pe(n){return n.value}function Ee(n){var s=n.next();return s.done?!1:s}function Se(n){var s=n.return;s&&s.call(n)}function K(n){var s=Object.getPrototypeOf(n);if(typeof n!="function"||n===N||s!==N)return s;var u=n.prototype,l=u&&Object.getPrototypeOf(u);if(l==null||l===Object.prototype)return s;var y=l.constructor;return typeof y!="function"||y===n?s:y}function tt(){var n;!g(k)&&typeof i.Reflect<"u"&&!(k in i.Reflect)&&typeof i.Reflect.defineMetadata=="function"&&(n=it(i.Reflect));var s,u,l,y=new Y,O={registerProvider:S,getProvider:c,setProvider:d};return O;function S(p){if(!Object.isExtensible(O))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case n===p:break;case g(s):s=p;break;case s===p:break;case g(u):u=p;break;case u===p:break;default:l===void 0&&(l=new J),l.add(p);break}}function M(p,_){if(!g(s)){if(s.isProviderFor(p,_))return s;if(!g(u)){if(u.isProviderFor(p,_))return s;if(!g(l))for(var R=Oe(l);;){var P=Ee(R);if(!P)return;var A=Pe(P);if(A.isProviderFor(p,_))return Se(R),A}}}if(!g(n)&&n.isProviderFor(p,_))return n}function c(p,_){var R=y.get(p),P;return g(R)||(P=R.get(_)),g(P)&&(P=M(p,_),g(P)||(g(R)&&(R=new F,y.set(p,R)),R.set(_,P))),P}function h(p){if(g(p))throw new TypeError;return s===p||u===p||!g(l)&&l.has(p)}function d(p,_,R){if(!h(R))throw new Error("Metadata provider not registered.");var P=c(p,_);if(P!==R){if(!g(P))return!1;var A=y.get(p);g(A)&&(A=new F,y.set(p,A)),A.set(_,R)}return!0}}function rt(){var n;return!g(k)&&E(i.Reflect)&&Object.isExtensible(i.Reflect)&&(n=i.Reflect[k]),g(n)&&(n=tt()),!g(k)&&E(i.Reflect)&&Object.isExtensible(i.Reflect)&&Object.defineProperty(i.Reflect,k,{enumerable:!1,configurable:!1,writable:!1,value:n}),n}function nt(n){var s=new Y,u={isProviderFor:function(h,d){var p=s.get(h);return g(p)?!1:p.has(d)},OrdinaryDefineOwnMetadata:S,OrdinaryHasOwnMetadata:y,OrdinaryGetOwnMetadata:O,OrdinaryOwnMetadataKeys:M,OrdinaryDeleteMetadata:c};return W.registerProvider(u),u;function l(h,d,p){var _=s.get(h),R=!1;if(g(_)){if(!p)return;_=new F,s.set(h,_),R=!0}var P=_.get(d);if(g(P)){if(!p)return;if(P=new F,_.set(d,P),!n.setProvider(h,d,u))throw _.delete(d),R&&s.delete(h),new Error("Wrong provider for target.")}return P}function y(h,d,p){var _=l(d,p,!1);return g(_)?!1:Me(_.has(h))}function O(h,d,p){var _=l(d,p,!1);if(!g(_))return _.get(h)}function S(h,d,p,_){var R=l(p,_,!0);R.set(h,d)}function M(h,d){var p=[],_=l(h,d,!1);if(g(_))return p;for(var R=_.keys(),P=Oe(R),A=0;;){var Ie=Ee(P);if(!Ie)return p.length=A,p;var ut=Pe(Ie);try{p[A]=ut}catch(lt){try{Se(P)}finally{throw lt}}A++}}function c(h,d,p){var _=l(d,p,!1);if(g(_)||!_.delete(h))return!1;if(_.size===0){var R=s.get(d);g(R)||(R.delete(p),R.size===0&&s.delete(R))}return!0}}function it(n){var s=n.defineMetadata,u=n.hasOwnMetadata,l=n.getOwnMetadata,y=n.getOwnMetadataKeys,O=n.deleteMetadata,S=new Y,M={isProviderFor:function(c,h){var d=S.get(c);return!g(d)&&d.has(h)?!0:y(c,h).length?(g(d)&&(d=new J,S.set(c,d)),d.add(h),!0):!1},OrdinaryDefineOwnMetadata:s,OrdinaryHasOwnMetadata:u,OrdinaryGetOwnMetadata:l,OrdinaryOwnMetadataKeys:y,OrdinaryDeleteMetadata:O};return M}function L(n,s,u){var l=W.getProvider(n,s);if(!g(l))return l;if(u){if(W.setProvider(n,s,he))return he;throw new Error("Illegal state.")}}function st(){var n={},s=[],u=(function(){function M(c,h,d){this._index=0,this._keys=c,this._values=h,this._selector=d}return M.prototype["@@iterator"]=function(){return this},M.prototype[m]=function(){return this},M.prototype.next=function(){var c=this._index;if(c>=0&&c<this._keys.length){var h=this._selector(this._keys[c],this._values[c]);return c+1>=this._keys.length?(this._index=-1,this._keys=s,this._values=s):this._index++,{value:h,done:!1}}return{value:void 0,done:!0}},M.prototype.throw=function(c){throw this._index>=0&&(this._index=-1,this._keys=s,this._values=s),c},M.prototype.return=function(c){return this._index>=0&&(this._index=-1,this._keys=s,this._values=s),{value:c,done:!0}},M})(),l=(function(){function M(){this._keys=[],this._values=[],this._cacheKey=n,this._cacheIndex=-2}return Object.defineProperty(M.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),M.prototype.has=function(c){return this._find(c,!1)>=0},M.prototype.get=function(c){var h=this._find(c,!1);return h>=0?this._values[h]:void 0},M.prototype.set=function(c,h){var d=this._find(c,!0);return this._values[d]=h,this},M.prototype.delete=function(c){var h=this._find(c,!1);if(h>=0){for(var d=this._keys.length,p=h+1;p<d;p++)this._keys[p-1]=this._keys[p],this._values[p-1]=this._values[p];return this._keys.length--,this._values.length--,X(c,this._cacheKey)&&(this._cacheKey=n,this._cacheIndex=-2),!0}return!1},M.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=n,this._cacheIndex=-2},M.prototype.keys=function(){return new u(this._keys,this._values,y)},M.prototype.values=function(){return new u(this._keys,this._values,O)},M.prototype.entries=function(){return new u(this._keys,this._values,S)},M.prototype["@@iterator"]=function(){return this.entries()},M.prototype[m]=function(){return this.entries()},M.prototype._find=function(c,h){if(!X(this._cacheKey,c)){this._cacheIndex=-1;for(var d=0;d<this._keys.length;d++)if(X(this._keys[d],c)){this._cacheIndex=d;break}}return this._cacheIndex<0&&h&&(this._cacheIndex=this._keys.length,this._keys.push(c),this._values.push(void 0)),this._cacheIndex},M})();return l;function y(M,c){return M}function O(M,c){return c}function S(M,c){return[M,c]}}function at(){var n=(function(){function s(){this._map=new F}return Object.defineProperty(s.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),s.prototype.has=function(u){return this._map.has(u)},s.prototype.add=function(u){return this._map.set(u,u),this},s.prototype.delete=function(u){return this._map.delete(u)},s.prototype.clear=function(){this._map.clear()},s.prototype.keys=function(){return this._map.keys()},s.prototype.values=function(){return this._map.keys()},s.prototype.entries=function(){return this._map.entries()},s.prototype["@@iterator"]=function(){return this.keys()},s.prototype[m]=function(){return this.keys()},s})();return n}function ot(){var n=16,s=T.create(),u=l();return(function(){function c(){this._key=l()}return c.prototype.has=function(h){var d=y(h,!1);return d!==void 0?T.has(d,this._key):!1},c.prototype.get=function(h){var d=y(h,!1);return d!==void 0?T.get(d,this._key):void 0},c.prototype.set=function(h,d){var p=y(h,!0);return p[this._key]=d,this},c.prototype.delete=function(h){var d=y(h,!1);return d!==void 0?delete d[this._key]:!1},c.prototype.clear=function(){this._key=l()},c})();function l(){var c;do c="@@WeakMap@@"+M();while(T.has(s,c));return s[c]=!0,c}function y(c,h){if(!a.call(c,u)){if(!h)return;Object.defineProperty(c,u,{value:T.create()})}return c[u]}function O(c,h){for(var d=0;d<h;++d)c[d]=Math.random()*255|0;return c}function S(c){if(typeof Uint8Array=="function"){var h=new Uint8Array(c);return typeof crypto<"u"?crypto.getRandomValues(h):typeof msCrypto<"u"?msCrypto.getRandomValues(h):O(h,c),h}return O(new Array(c),c)}function M(){var c=S(n);c[6]=c[6]&79|64,c[8]=c[8]&191|128;for(var h="",d=0;d<n;++d){var p=c[d];(d===4||d===6||d===8)&&(h+="-"),p<16&&(h+="0"),h+=p.toString(16).toLowerCase()}return h}}function ee(n){return n.__=void 0,delete n.__,n}})})(t||(t={})),Te}ft();function ct(t){const e=`
14
+ ***************************************************************************** */var Qe;function Et(){if(Qe)return Ye;Qe=1;var t;return(function(e){(function(r){var i=typeof globalThis=="object"?globalThis:typeof Je=="object"?Je:typeof self=="object"?self:typeof this=="object"?this:E(),o=n(e);typeof i.Reflect<"u"&&(o=n(i.Reflect,o)),r(o,i),typeof i.Reflect>"u"&&(i.Reflect=e);function n(_,S){return function(j,G){Object.defineProperty(_,j,{configurable:!0,writable:!0,value:G}),S&&S(j,G)}}function l(){try{return Function("return this;")()}catch{}}function w(){try{return(0,eval)("(function() { return this; })()")}catch{}}function E(){return l()||w()}})(function(r,i){var o=Object.prototype.hasOwnProperty,n=typeof Symbol=="function",l=n&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",w=n&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",E=typeof Object.create=="function",_={__proto__:[]}instanceof Array,S=!E&&!_,j={create:E?function(){return me(Object.create(null))}:_?function(){return me({__proto__:null})}:function(){return me({})},has:S?function(s,a){return o.call(s,a)}:function(s,a){return a in s},get:S?function(s,a){return o.call(s,a)?s[a]:void 0}:function(s,a){return s[a]}},G=Object.getPrototypeOf(Function),V=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:mt(),Y=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:wt(),ee=typeof WeakMap=="function"?WeakMap:Mt(),z=n?Symbol.for("@reflect-metadata:registry"):void 0,Q=yt(),ne=_t(Q);function ie(s,a,u,h){if(b(u)){if(!$e(s))throw new TypeError;if(!We(a))throw new TypeError;return se(s,a)}else{if(!$e(s))throw new TypeError;if(!A(a))throw new TypeError;if(!A(h)&&!b(h)&&!X(h))throw new TypeError;return X(h)&&(h=void 0),u=$(u),pe(s,a,u,h)}}r("decorate",ie);function c(s,a){function u(h,M){if(!A(h))throw new TypeError;if(!b(M)&&!vt(M))throw new TypeError;De(s,a,h,M)}return u}r("metadata",c);function f(s,a,u,h){if(!A(u))throw new TypeError;return b(h)||(h=$(h)),De(s,a,u,h)}r("defineMetadata",f);function d(s,a,u){if(!A(a))throw new TypeError;return b(u)||(u=$(u)),Ae(s,a,u)}r("hasMetadata",d);function m(s,a,u){if(!A(a))throw new TypeError;return b(u)||(u=$(u)),ye(s,a,u)}r("hasOwnMetadata",m);function O(s,a,u){if(!A(a))throw new TypeError;return b(u)||(u=$(u)),ke(s,a,u)}r("getMetadata",O);function x(s,a,u){if(!A(a))throw new TypeError;return b(u)||(u=$(u)),je(s,a,u)}r("getOwnMetadata",x);function R(s,a){if(!A(s))throw new TypeError;return b(a)||(a=$(a)),He(s,a)}r("getMetadataKeys",R);function N(s,a){if(!A(s))throw new TypeError;return b(a)||(a=$(a)),Ne(s,a)}r("getOwnMetadataKeys",N);function q(s,a,u){if(!A(a))throw new TypeError;if(b(u)||(u=$(u)),!A(a))throw new TypeError;b(u)||(u=$(u));var h=te(a,u,!1);return b(h)?!1:h.OrdinaryDeleteMetadata(s,a,u)}r("deleteMetadata",q);function se(s,a){for(var u=s.length-1;u>=0;--u){var h=s[u],M=h(a);if(!b(M)&&!X(M)){if(!We(M))throw new TypeError;a=M}}return a}function pe(s,a,u,h){for(var M=s.length-1;M>=0;--M){var L=s[M],k=L(a,u,h);if(!b(k)&&!X(k)){if(!A(k))throw new TypeError;h=k}}return h}function Ae(s,a,u){var h=ye(s,a,u);if(h)return!0;var M=ge(a);return X(M)?!1:Ae(s,M,u)}function ye(s,a,u){var h=te(a,u,!1);return b(h)?!1:Be(h.OrdinaryHasOwnMetadata(s,a,u))}function ke(s,a,u){var h=ye(s,a,u);if(h)return je(s,a,u);var M=ge(a);if(!X(M))return ke(s,M,u)}function je(s,a,u){var h=te(a,u,!1);if(!b(h))return h.OrdinaryGetOwnMetadata(s,a,u)}function De(s,a,u,h){var M=te(u,h,!0);M.OrdinaryDefineOwnMetadata(s,a,u,h)}function He(s,a){var u=Ne(s,a),h=ge(s);if(h===null)return u;var M=He(h,a);if(M.length<=0)return u;if(u.length<=0)return M;for(var L=new Y,k=[],P=0,v=u;P<v.length;P++){var p=v[P],y=L.has(p);y||(L.add(p),k.push(p))}for(var g=0,C=M;g<C.length;g++){var p=C[g],y=L.has(p);y||(L.add(p),k.push(p))}return k}function Ne(s,a){var u=te(s,a,!1);return u?u.OrdinaryOwnMetadataKeys(s,a):[]}function Fe(s){if(s===null)return 1;switch(typeof s){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return s===null?1:6;default:return 6}}function b(s){return s===void 0}function X(s){return s===null}function ft(s){return typeof s=="symbol"}function A(s){return typeof s=="object"?s!==null:typeof s=="function"}function ct(s,a){switch(Fe(s)){case 0:return s;case 1:return s;case 2:return s;case 3:return s;case 4:return s;case 5:return s}var u="string",h=Ge(s,l);if(h!==void 0){var M=h.call(s,u);if(A(M))throw new TypeError;return M}return ht(s)}function ht(s,a){var u,h,M;{var L=s.toString;if(oe(L)){var h=L.call(s);if(!A(h))return h}var u=s.valueOf;if(oe(u)){var h=u.call(s);if(!A(h))return h}}throw new TypeError}function Be(s){return!!s}function dt(s){return""+s}function $(s){var a=ct(s);return ft(a)?a:dt(a)}function $e(s){return Array.isArray?Array.isArray(s):s instanceof Object?s instanceof Array:Object.prototype.toString.call(s)==="[object Array]"}function oe(s){return typeof s=="function"}function We(s){return typeof s=="function"}function vt(s){switch(Fe(s)){case 3:return!0;case 4:return!0;default:return!1}}function _e(s,a){return s===a||s!==s&&a!==a}function Ge(s,a){var u=s[a];if(u!=null){if(!oe(u))throw new TypeError;return u}}function Ve(s){var a=Ge(s,w);if(!oe(a))throw new TypeError;var u=a.call(s);if(!A(u))throw new TypeError;return u}function ze(s){return s.value}function Ue(s){var a=s.next();return a.done?!1:a}function qe(s){var a=s.return;a&&a.call(s)}function ge(s){var a=Object.getPrototypeOf(s);if(typeof s!="function"||s===G||a!==G)return a;var u=s.prototype,h=u&&Object.getPrototypeOf(u);if(h==null||h===Object.prototype)return a;var M=h.constructor;return typeof M!="function"||M===s?a:M}function pt(){var s;!b(z)&&typeof i.Reflect<"u"&&!(z in i.Reflect)&&typeof i.Reflect.defineMetadata=="function"&&(s=gt(i.Reflect));var a,u,h,M=new ee,L={registerProvider:k,getProvider:v,setProvider:y};return L;function k(g){if(!Object.isExtensible(L))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case s===g:break;case b(a):a=g;break;case a===g:break;case b(u):u=g;break;case u===g:break;default:h===void 0&&(h=new Y),h.add(g);break}}function P(g,C){if(!b(a)){if(a.isProviderFor(g,C))return a;if(!b(u)){if(u.isProviderFor(g,C))return a;if(!b(h))for(var I=Ve(h);;){var T=Ue(I);if(!T)return;var F=ze(T);if(F.isProviderFor(g,C))return qe(I),F}}}if(!b(s)&&s.isProviderFor(g,C))return s}function v(g,C){var I=M.get(g),T;return b(I)||(T=I.get(C)),b(T)&&(T=P(g,C),b(T)||(b(I)&&(I=new V,M.set(g,I)),I.set(C,T))),T}function p(g){if(b(g))throw new TypeError;return a===g||u===g||!b(h)&&h.has(g)}function y(g,C,I){if(!p(I))throw new Error("Metadata provider not registered.");var T=v(g,C);if(T!==I){if(!b(T))return!1;var F=M.get(g);b(F)&&(F=new V,M.set(g,F)),F.set(C,I)}return!0}}function yt(){var s;return!b(z)&&A(i.Reflect)&&Object.isExtensible(i.Reflect)&&(s=i.Reflect[z]),b(s)&&(s=pt()),!b(z)&&A(i.Reflect)&&Object.isExtensible(i.Reflect)&&Object.defineProperty(i.Reflect,z,{enumerable:!1,configurable:!1,writable:!1,value:s}),s}function _t(s){var a=new ee,u={isProviderFor:function(p,y){var g=a.get(p);return b(g)?!1:g.has(y)},OrdinaryDefineOwnMetadata:k,OrdinaryHasOwnMetadata:M,OrdinaryGetOwnMetadata:L,OrdinaryOwnMetadataKeys:P,OrdinaryDeleteMetadata:v};return Q.registerProvider(u),u;function h(p,y,g){var C=a.get(p),I=!1;if(b(C)){if(!g)return;C=new V,a.set(p,C),I=!0}var T=C.get(y);if(b(T)){if(!g)return;if(T=new V,C.set(y,T),!s.setProvider(p,y,u))throw C.delete(y),I&&a.delete(p),new Error("Wrong provider for target.")}return T}function M(p,y,g){var C=h(y,g,!1);return b(C)?!1:Be(C.has(p))}function L(p,y,g){var C=h(y,g,!1);if(!b(C))return C.get(p)}function k(p,y,g,C){var I=h(g,C,!0);I.set(p,y)}function P(p,y){var g=[],C=h(p,y,!1);if(b(C))return g;for(var I=C.keys(),T=Ve(I),F=0;;){var Ze=Ue(T);if(!Ze)return g.length=F,g;var bt=ze(Ze);try{g[F]=bt}catch(Ot){try{qe(T)}finally{throw Ot}}F++}}function v(p,y,g){var C=h(y,g,!1);if(b(C)||!C.delete(p))return!1;if(C.size===0){var I=a.get(y);b(I)||(I.delete(g),I.size===0&&a.delete(I))}return!0}}function gt(s){var a=s.defineMetadata,u=s.hasOwnMetadata,h=s.getOwnMetadata,M=s.getOwnMetadataKeys,L=s.deleteMetadata,k=new ee,P={isProviderFor:function(v,p){var y=k.get(v);return!b(y)&&y.has(p)?!0:M(v,p).length?(b(y)&&(y=new Y,k.set(v,y)),y.add(p),!0):!1},OrdinaryDefineOwnMetadata:a,OrdinaryHasOwnMetadata:u,OrdinaryGetOwnMetadata:h,OrdinaryOwnMetadataKeys:M,OrdinaryDeleteMetadata:L};return P}function te(s,a,u){var h=Q.getProvider(s,a);if(!b(h))return h;if(u){if(Q.setProvider(s,a,ne))return ne;throw new Error("Illegal state.")}}function mt(){var s={},a=[],u=(function(){function P(v,p,y){this._index=0,this._keys=v,this._values=p,this._selector=y}return P.prototype["@@iterator"]=function(){return this},P.prototype[w]=function(){return this},P.prototype.next=function(){var v=this._index;if(v>=0&&v<this._keys.length){var p=this._selector(this._keys[v],this._values[v]);return v+1>=this._keys.length?(this._index=-1,this._keys=a,this._values=a):this._index++,{value:p,done:!1}}return{value:void 0,done:!0}},P.prototype.throw=function(v){throw this._index>=0&&(this._index=-1,this._keys=a,this._values=a),v},P.prototype.return=function(v){return this._index>=0&&(this._index=-1,this._keys=a,this._values=a),{value:v,done:!0}},P})(),h=(function(){function P(){this._keys=[],this._values=[],this._cacheKey=s,this._cacheIndex=-2}return Object.defineProperty(P.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),P.prototype.has=function(v){return this._find(v,!1)>=0},P.prototype.get=function(v){var p=this._find(v,!1);return p>=0?this._values[p]:void 0},P.prototype.set=function(v,p){var y=this._find(v,!0);return this._values[y]=p,this},P.prototype.delete=function(v){var p=this._find(v,!1);if(p>=0){for(var y=this._keys.length,g=p+1;g<y;g++)this._keys[g-1]=this._keys[g],this._values[g-1]=this._values[g];return this._keys.length--,this._values.length--,_e(v,this._cacheKey)&&(this._cacheKey=s,this._cacheIndex=-2),!0}return!1},P.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=s,this._cacheIndex=-2},P.prototype.keys=function(){return new u(this._keys,this._values,M)},P.prototype.values=function(){return new u(this._keys,this._values,L)},P.prototype.entries=function(){return new u(this._keys,this._values,k)},P.prototype["@@iterator"]=function(){return this.entries()},P.prototype[w]=function(){return this.entries()},P.prototype._find=function(v,p){if(!_e(this._cacheKey,v)){this._cacheIndex=-1;for(var y=0;y<this._keys.length;y++)if(_e(this._keys[y],v)){this._cacheIndex=y;break}}return this._cacheIndex<0&&p&&(this._cacheIndex=this._keys.length,this._keys.push(v),this._values.push(void 0)),this._cacheIndex},P})();return h;function M(P,v){return P}function L(P,v){return v}function k(P,v){return[P,v]}}function wt(){var s=(function(){function a(){this._map=new V}return Object.defineProperty(a.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),a.prototype.has=function(u){return this._map.has(u)},a.prototype.add=function(u){return this._map.set(u,u),this},a.prototype.delete=function(u){return this._map.delete(u)},a.prototype.clear=function(){this._map.clear()},a.prototype.keys=function(){return this._map.keys()},a.prototype.values=function(){return this._map.keys()},a.prototype.entries=function(){return this._map.entries()},a.prototype["@@iterator"]=function(){return this.keys()},a.prototype[w]=function(){return this.keys()},a})();return s}function Mt(){var s=16,a=j.create(),u=h();return(function(){function v(){this._key=h()}return v.prototype.has=function(p){var y=M(p,!1);return y!==void 0?j.has(y,this._key):!1},v.prototype.get=function(p){var y=M(p,!1);return y!==void 0?j.get(y,this._key):void 0},v.prototype.set=function(p,y){var g=M(p,!0);return g[this._key]=y,this},v.prototype.delete=function(p){var y=M(p,!1);return y!==void 0?delete y[this._key]:!1},v.prototype.clear=function(){this._key=h()},v})();function h(){var v;do v="@@WeakMap@@"+P();while(j.has(a,v));return a[v]=!0,v}function M(v,p){if(!o.call(v,u)){if(!p)return;Object.defineProperty(v,u,{value:j.create()})}return v[u]}function L(v,p){for(var y=0;y<p;++y)v[y]=Math.random()*255|0;return v}function k(v){if(typeof Uint8Array=="function"){var p=new Uint8Array(v);return typeof crypto<"u"?crypto.getRandomValues(p):typeof msCrypto<"u"?msCrypto.getRandomValues(p):L(p,v),p}return L(new Array(v),v)}function P(){var v=k(s);v[6]=v[6]&79|64,v[8]=v[8]&191|128;for(var p="",y=0;y<s;++y){var g=v[y];(y===4||y===6||y===8)&&(p+="-"),g<16&&(p+="0"),p+=g.toString(16).toLowerCase()}return p}}function me(s){return s.__=void 0,delete s.__,s}})})(t||(t={})),Ye}Et();function Rt(t){const e=`
15
15
  attribute vec3 position;
16
16
  attribute vec3 normal;
17
17
 
@@ -29,17 +29,34 @@ and limitations under the License.
29
29
  precision highp float;
30
30
 
31
31
  uniform float uHit;
32
+ uniform float uSelected;
32
33
 
33
34
  varying vec3 vNormal;
34
35
 
35
36
  void main() {
36
37
  vec3 normal = normalize(vNormal);
37
38
  float lighting = dot(normal, normalize(vec3(-0.3, 0.8, 0.6)));
38
- vec3 color = mix(vec3(0.2, 0.8, 1.0), vec3(1.0, 0.2, 0.8), uHit);
39
- gl_FragColor.rgb = color + lighting * 0.1;
40
- gl_FragColor.a = 1.0;
39
+
40
+ // Базовый цвет меша
41
+ vec3 baseColor = vec3(0.2, 0.8, 1.0);
42
+
43
+ // Цвет при наведении (hover)
44
+ vec3 hoverColor = vec3(1.0, 1.0, 0.1);
45
+
46
+ // Цвет при клике (selected)
47
+ vec3 selectedColor = vec3(1.0, 0.3, 0.3);
48
+
49
+ // Применяем логику подсветки:
50
+ // приоритет: выделение > hover > обычный цвет
51
+ vec3 color = mix(baseColor, hoverColor, uHit);
52
+ color = mix(color, selectedColor, uSelected);
53
+
54
+ // Немного света для объема
55
+ color += lighting * 0.1;
56
+
57
+ gl_FragColor = vec4(color, 1.0);
41
58
  }
42
- `;return new I.Program(t,{vertex:e,fragment:r,cullFace:!1,uniforms:{uHit:{value:0}}})}class ue{gl;scene;camera;canvas;program;meshes;constructor(e){this.canvas=e,this.gl=new I.Renderer({canvas:e,dpr:2}),this.gl.setSize(e.clientWidth,e.clientHeight),this.gl.gl.clearColor(.1,.1,.1,1),this.scene=new I.Transform,this.camera=new I.Camera(this.gl.gl,{fov:45}),this.camera.position.set(1,1,7),this.camera.lookAt([0,0,0]),this.program=ct(this.gl.gl),this.meshes=[]}resize(){this.gl.setSize(this.canvas.width,this.canvas.height),this.camera.perspective({aspect:this.canvas.width/this.canvas.height})}render(){this.gl.render({scene:this.scene,camera:this.camera})}update(){}loop(){this.update(),this.render(),requestAnimationFrame(this.loop.bind(this))}addFigure(e){const r=new I.Geometry(this.gl.gl,{position:{size:3,data:new Float32Array(e.position)},normal:{size:3,data:new Float32Array(e.normal??[])},uv:{size:2,data:new Float32Array(e.uv??[])}}),i=new I.Mesh(this.gl.gl,{geometry:r,program:this.program});return i.setParent(this.scene),this.meshes.push(i),i}destroy(){this.meshes&&(this.meshes.length=0,this.meshes=[]),this.scene=null,this.camera=null,this.program=null,this.gl=null,this.canvas=null}}class ht extends I.Orbit{isInteracting=!1;element;constructor(e,r={}){super(e,r),this.element=r.element||document,this.element.addEventListener("mousedown",()=>this.isInteracting=!0),this.element.addEventListener("mouseup",()=>this.isInteracting=!1),this.element.addEventListener("touchstart",()=>this.isInteracting=!0),this.element.addEventListener("touchend",()=>this.isInteracting=!1)}destroy(){this.element.removeEventListener("mousedown",()=>this.isInteracting=!0),this.element.removeEventListener("mouseup",()=>this.isInteracting=!1),this.element.removeEventListener("touchstart",()=>this.isInteracting=!0),this.element.removeEventListener("touchend",()=>this.isInteracting=!1)}}var te;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(te||(te={}));const C=te;/*! *****************************************************************************
59
+ `;return new D.Program(t,{vertex:e,fragment:r,cullFace:!1,uniforms:{uHit:{value:0},uSelected:{value:0}}})}class nt extends D.Mesh{isHit;constructor(e,r){super(e,r),this.isHit=!1}}class Ie{gl;scene;camera;canvas;program;meshes;constructor(e){this.canvas=e,this.gl=new D.Renderer({canvas:e,dpr:2}),this.gl.setSize(e.clientWidth,e.clientHeight),this.gl.gl.clearColor(.1,.1,.1,1),this.scene=new D.Transform,this.camera=new D.Camera(this.gl.gl,{fov:45}),this.camera.position.set(1,1,7),this.camera.lookAt([0,0,0]),this.program=Rt(this.gl.gl),this.meshes=[]}resize(){this.gl.setSize(this.canvas.width,this.canvas.height),this.camera.perspective({aspect:this.canvas.width/this.canvas.height})}render(){this.gl.render({scene:this.scene,camera:this.camera})}update(){}loop(){this.update(),this.render(),requestAnimationFrame(this.loop.bind(this))}addFigure(e){const r=new D.Geometry(this.gl.gl,{position:{size:3,data:new Float32Array(e.position)},normal:{size:3,data:new Float32Array(e.normal??[])},uv:{size:2,data:new Float32Array(e.uv??[])}}),i=new nt(this.gl.gl,{geometry:r,program:this.program});return i.setParent(this.scene),this.meshes.push(i),i}addMesh(e){this.scene.addChild(e)}getContext(){return this.gl.gl}removeMesh(e){this.scene.removeChild(e)}getMeshes(){return this.meshes}getProgram(){return this.program}destroy(){this.meshes&&(this.meshes.length=0,this.meshes=[]),this.scene=null,this.camera=null,this.program=null,this.gl=null,this.canvas=null}}class Pt extends D.Orbit{isInteracting=!1;_element;constructor(e,r={}){super(e,r),this._element=r.element||document,this._element.addEventListener("mousedown",()=>this.isInteracting=!0),this._element.addEventListener("mouseup",()=>this.isInteracting=!1),this._element.addEventListener("touchstart",()=>this.isInteracting=!0),this._element.addEventListener("touchend",()=>this.isInteracting=!1)}destroy(){this._element.removeEventListener("mousedown",()=>this.isInteracting=!0),this._element.removeEventListener("mouseup",()=>this.isInteracting=!1),this._element.removeEventListener("touchstart",()=>this.isInteracting=!0),this._element.removeEventListener("touchend",()=>this.isInteracting=!1)}}var Me;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(Me||(Me={}));const H=Me;/*! *****************************************************************************
43
60
  Copyright (c) Microsoft Corporation.
44
61
 
45
62
  Permission to use, copy, modify, and/or distribute this software for any
@@ -52,7 +69,7 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
52
69
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
53
70
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
54
71
  PERFORMANCE OF THIS SOFTWARE.
55
- ***************************************************************************** */var re=function(t,e){return re=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)i.hasOwnProperty(a)&&(r[a]=i[a])},re(t,e)};function le(t,e){re(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function dt(t,e,r,i){function a(o){return o instanceof r?o:new r(function(f){f(o)})}return new(r||(r=Promise))(function(o,f){function m(b){try{v(i.next(b))}catch(T){f(T)}}function w(b){try{v(i.throw(b))}catch(T){f(T)}}function v(b){b.done?o(b.value):a(b.value).then(m,w)}v((i=i.apply(t,[])).next())})}function pt(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,a,o,f;return f={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function m(v){return function(b){return w([v,b])}}function w(v){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,a&&(o=v[0]&2?a.return:v[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,v[1])).done)return o;switch(a=0,o&&(v=[v[0]&2,o.value]),v[0]){case 0:case 1:o=v;break;case 4:return r.label++,{value:v[1],done:!1};case 5:r.label++,a=v[1],v=[0];continue;case 7:v=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(v[0]===6||v[0]===2)){r=0;continue}if(v[0]===3&&(!o||v[1]>o[0]&&v[1]<o[3])){r.label=v[1];break}if(v[0]===6&&r.label<o[1]){r.label=o[1],o=v;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(v);break}o[2]&&r.ops.pop(),r.trys.pop();continue}v=e.call(t,r)}catch(b){v=[6,b],a=0}finally{i=o=0}if(v[0]&5)throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}}function U(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Z(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),a,o=[],f;try{for(;(e===void 0||e-- >0)&&!(a=i.next()).done;)o.push(a.value)}catch(m){f={error:m}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(f)throw f.error}}return o}function D(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Z(arguments[e]));return t}var ne="injectionTokens";function vt(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],r=Reflect.getOwnMetadata(ne,t)||{};return Object.keys(r).forEach(function(i){e[+i]=r[i]}),e}function De(t,e){return function(r,i,a){var o=Reflect.getOwnMetadata(ne,r)||{};o[a]=t,Reflect.defineMetadata(ne,o,r)}}function ke(t){return!!t.useClass}function ie(t){return!!t.useFactory}var je=(function(){function t(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return t.prototype.createProxy=function(e){var r=this,i={},a=!1,o,f=function(){return a||(o=e(r.wrap()),a=!0),o};return new Proxy(i,this.createHandler(f))},t.prototype.createHandler=function(e){var r={},i=function(a){r[a]=function(){for(var o=[],f=0;f<arguments.length;f++)o[f]=arguments[f];o[0]=e();var m=Reflect[a];return m.apply(void 0,D(o))}};return this.reflectMethods.forEach(i),r},t})();function H(t){return typeof t=="string"||typeof t=="symbol"}function yt(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function xe(t){return typeof t=="object"&&"token"in t&&"transform"in t}function gt(t){return typeof t=="function"||t instanceof je}function q(t){return!!t.useToken}function B(t){return t.useValue!=null}function mt(t){return ke(t)||B(t)||q(t)||ie(t)}var fe=(function(){function t(){this._registryMap=new Map}return t.prototype.entries=function(){return this._registryMap.entries()},t.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},t.prototype.get=function(e){this.ensure(e);var r=this._registryMap.get(e);return r[r.length-1]||null},t.prototype.set=function(e,r){this.ensure(e),this._registryMap.get(e).push(r)},t.prototype.setAll=function(e,r){this._registryMap.set(e,r)},t.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},t})(),wt=(function(t){le(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(fe),$=(function(){function t(){this.scopedResolutions=new Map}return t})();function Mt(t,e){if(t===null)return"at position #"+e;var r=t.split(",")[e].trim();return'"'+r+'" at position #'+e}function _t(t,e,r){return r===void 0&&(r=" "),D([t],e.message.split(`
72
+ ***************************************************************************** */var be=function(t,e){return be=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},be(t,e)};function Le(t,e){be(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Ct(t,e,r,i){function o(n){return n instanceof r?n:new r(function(l){l(n)})}return new(r||(r=Promise))(function(n,l){function w(S){try{_(i.next(S))}catch(j){l(j)}}function E(S){try{_(i.throw(S))}catch(j){l(j)}}function _(S){S.done?n(S.value):o(S.value).then(w,E)}_((i=i.apply(t,[])).next())})}function St(t,e){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,o,n,l;return l={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function w(_){return function(S){return E([_,S])}}function E(_){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,o&&(n=_[0]&2?o.return:_[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,_[1])).done)return n;switch(o=0,n&&(_=[_[0]&2,n.value]),_[0]){case 0:case 1:n=_;break;case 4:return r.label++,{value:_[1],done:!1};case 5:r.label++,o=_[1],_=[0];continue;case 7:_=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n=n.length>0&&n[n.length-1])&&(_[0]===6||_[0]===2)){r=0;continue}if(_[0]===3&&(!n||_[1]>n[0]&&_[1]<n[3])){r.label=_[1];break}if(_[0]===6&&r.label<n[1]){r.label=n[1],n=_;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(_);break}n[2]&&r.ops.pop(),r.trys.pop();continue}_=e.call(t,r)}catch(S){_=[6,S],o=0}finally{i=n=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}}function ae(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function he(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),o,n=[],l;try{for(;(e===void 0||e-- >0)&&!(o=i.next()).done;)n.push(o.value)}catch(w){l={error:w}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(l)throw l.error}}return n}function Z(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(he(arguments[e]));return t}var Oe="injectionTokens";function xt(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],r=Reflect.getOwnMetadata(Oe,t)||{};return Object.keys(r).forEach(function(i){e[+i]=r[i]}),e}function it(t,e){return function(r,i,o){var n=Reflect.getOwnMetadata(Oe,r)||{};n[o]=t,Reflect.defineMetadata(Oe,n,r)}}function st(t){return!!t.useClass}function Ee(t){return!!t.useFactory}var ot=(function(){function t(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return t.prototype.createProxy=function(e){var r=this,i={},o=!1,n,l=function(){return o||(n=e(r.wrap()),o=!0),n};return new Proxy(i,this.createHandler(l))},t.prototype.createHandler=function(e){var r={},i=function(o){r[o]=function(){for(var n=[],l=0;l<arguments.length;l++)n[l]=arguments[l];n[0]=e();var w=Reflect[o];return w.apply(void 0,Z(n))}};return this.reflectMethods.forEach(i),r},t})();function K(t){return typeof t=="string"||typeof t=="symbol"}function It(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function Xe(t){return typeof t=="object"&&"token"in t&&"transform"in t}function Lt(t){return typeof t=="function"||t instanceof ot}function fe(t){return!!t.useToken}function ce(t){return t.useValue!=null}function Tt(t){return st(t)||ce(t)||fe(t)||Ee(t)}var Te=(function(){function t(){this._registryMap=new Map}return t.prototype.entries=function(){return this._registryMap.entries()},t.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},t.prototype.get=function(e){this.ensure(e);var r=this._registryMap.get(e);return r[r.length-1]||null},t.prototype.set=function(e,r){this.ensure(e),this._registryMap.get(e).push(r)},t.prototype.setAll=function(e,r){this._registryMap.set(e,r)},t.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},t})(),At=(function(t){Le(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(Te),ue=(function(){function t(){this.scopedResolutions=new Map}return t})();function kt(t,e){if(t===null)return"at position #"+e;var r=t.split(",")[e].trim();return'"'+r+'" at position #'+e}function jt(t,e,r){return r===void 0&&(r=" "),Z([t],e.message.split(`
56
73
  `).map(function(i){return r+i})).join(`
57
- `)}function bt(t,e,r){var i=Z(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),a=i[1],o=a===void 0?null:a,f=Mt(o,e);return _t("Cannot inject the dependency "+f+' of "'+t.name+'" constructor. Reason:',r)}function Rt(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Ot=(function(t){le(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(fe),Pt=(function(t){le(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(fe),Et=(function(){function t(){this.preResolution=new Ot,this.postResolution=new Pt}return t})(),He=new Map,St=(function(){function t(e){this.parent=e,this._registry=new wt,this.interceptors=new Et,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,r,i){i===void 0&&(i={lifecycle:C.Transient}),this.ensureNotDisposed();var a;if(mt(r)?a=r:a={useClass:r},q(a))for(var o=[e],f=a;f!=null;){var m=f.useToken;if(o.includes(m))throw new Error("Token registration cycle detected! "+D(o,[m]).join(" -> "));o.push(m);var w=this._registry.get(m);w&&q(w.provider)?f=w.provider:f=null}if((i.lifecycle===C.Singleton||i.lifecycle==C.ContainerScoped||i.lifecycle==C.ResolutionScoped)&&(B(a)||ie(a)))throw new Error('Cannot use lifecycle "'+C[i.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:a,options:i}),this},t.prototype.registerType=function(e,r){return this.ensureNotDisposed(),H(r)?this.register(e,{useToken:r}):this.register(e,{useClass:r})},t.prototype.registerInstance=function(e,r){return this.ensureNotDisposed(),this.register(e,{useValue:r})},t.prototype.registerSingleton=function(e,r){if(this.ensureNotDisposed(),H(e)){if(H(r))return this.register(e,{useToken:r},{lifecycle:C.Singleton});if(r)return this.register(e,{useClass:r},{lifecycle:C.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var i=e;return r&&!H(r)&&(i=r),this.register(e,{useClass:i},{lifecycle:C.Singleton})},t.prototype.resolve=function(e,r,i){r===void 0&&(r=new $),i===void 0&&(i=!1),this.ensureNotDisposed();var a=this.getRegistration(e);if(!a&&H(e)){if(i)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),a){var o=this.resolveRegistration(a,r);return this.executePostResolutionInterceptor(e,o,"Single"),o}if(gt(e)){var o=this.construct(e,r);return this.executePostResolutionInterceptor(e,o,"Single"),o}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,r){var i,a;if(this.interceptors.preResolution.has(e)){var o=[];try{for(var f=U(this.interceptors.preResolution.getAll(e)),m=f.next();!m.done;m=f.next()){var w=m.value;w.options.frequency!="Once"&&o.push(w),w.callback(e,r)}}catch(v){i={error:v}}finally{try{m&&!m.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}this.interceptors.preResolution.setAll(e,o)}},t.prototype.executePostResolutionInterceptor=function(e,r,i){var a,o;if(this.interceptors.postResolution.has(e)){var f=[];try{for(var m=U(this.interceptors.postResolution.getAll(e)),w=m.next();!w.done;w=m.next()){var v=w.value;v.options.frequency!="Once"&&f.push(v),v.callback(e,r,i)}}catch(b){a={error:b}}finally{try{w&&!w.done&&(o=m.return)&&o.call(m)}finally{if(a)throw a.error}}this.interceptors.postResolution.setAll(e,f)}},t.prototype.resolveRegistration=function(e,r){if(this.ensureNotDisposed(),e.options.lifecycle===C.ResolutionScoped&&r.scopedResolutions.has(e))return r.scopedResolutions.get(e);var i=e.options.lifecycle===C.Singleton,a=e.options.lifecycle===C.ContainerScoped,o=i||a,f;return B(e.provider)?f=e.provider.useValue:q(e.provider)?f=o?e.instance||(e.instance=this.resolve(e.provider.useToken,r)):this.resolve(e.provider.useToken,r):ke(e.provider)?f=o?e.instance||(e.instance=this.construct(e.provider.useClass,r)):this.construct(e.provider.useClass,r):ie(e.provider)?f=e.provider.useFactory(this):f=this.construct(e.provider,r),e.options.lifecycle===C.ResolutionScoped&&r.scopedResolutions.set(e,f),f},t.prototype.resolveAll=function(e,r,i){var a=this;r===void 0&&(r=new $),i===void 0&&(i=!1),this.ensureNotDisposed();var o=this.getAllRegistrations(e);if(!o&&H(e)){if(i)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),o){var f=o.map(function(w){return a.resolveRegistration(w,r)});return this.executePostResolutionInterceptor(e,f,"All"),f}var m=[this.construct(e,r)];return this.executePostResolutionInterceptor(e,m,"All"),m},t.prototype.isRegistered=function(e,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(e)||r&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,r;this.ensureNotDisposed();try{for(var i=U(this._registry.entries()),a=i.next();!a.done;a=i.next()){var o=Z(a.value,2),f=o[0],m=o[1];this._registry.setAll(f,m.filter(function(w){return!B(w.provider)}).map(function(w){return w.instance=void 0,w}))}}catch(w){e={error:w}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,r;this.ensureNotDisposed();var i=new t(this);try{for(var a=U(this._registry.entries()),o=a.next();!o.done;o=a.next()){var f=Z(o.value,2),m=f[0],w=f[1];w.some(function(v){var b=v.options;return b.lifecycle===C.ContainerScoped})&&i._registry.setAll(m,w.map(function(v){return v.options.lifecycle===C.ContainerScoped?{provider:v.provider,options:v.options}:v}))}}catch(v){e={error:v}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return i},t.prototype.beforeResolution=function(e,r,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:r,options:i})},t.prototype.afterResolution=function(e,r,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:r,options:i})},t.prototype.dispose=function(){return dt(this,void 0,void 0,function(){var e;return pt(this,function(r){switch(r.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(i){var a=i.dispose();a&&e.push(a)}),[4,Promise.all(e)];case 1:return r.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,r){var i=this;if(e instanceof je)return e.createProxy(function(o){return i.resolve(o,r)});var a=(function(){var o=He.get(e);if(!o||o.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var f=o.map(i.resolveParams(r,e));return new(e.bind.apply(e,D([void 0],f)))})();return Rt(a)&&this.disposables.add(a),a},t.prototype.resolveParams=function(e,r){var i=this;return function(a,o){var f,m,w;try{return yt(a)?xe(a)?a.multiple?(f=i.resolve(a.transform)).transform.apply(f,D([i.resolveAll(a.token,new $,a.isOptional)],a.transformArgs)):(m=i.resolve(a.transform)).transform.apply(m,D([i.resolve(a.token,e,a.isOptional)],a.transformArgs)):a.multiple?i.resolveAll(a.token,new $,a.isOptional):i.resolve(a.token,e,a.isOptional):xe(a)?(w=i.resolve(a.transform,e)).transform.apply(w,D([i.resolve(a.token,e)],a.transformArgs)):i.resolve(a,e)}catch(v){throw new Error(bt(r,o,v))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t})(),It=new St;function ce(t,e){var r={token:t,multiple:!1,isOptional:e};return De(r)}function V(t){return function(e){He.set(e,vt(e))}}function Ct(t,e){var r={token:t,multiple:!0,isOptional:e};return De(r)}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var Tt=Object.getOwnPropertyDescriptor,At=(t,e,r,i)=>{for(var a=i>1?void 0:i?Tt(e,r):e,o=t.length-1,f;o>=0;o--)(f=t[o])&&(a=f(a)||a);return a};exports.EditorRenderer=class extends ue{orbit;raycast;mouse;isEventListenersAdded;constructor(e){super(e);const r=new I.GridHelper(this.gl.gl,{size:10,divisions:10});r.position.y=-.001,r.setParent(this.scene),new I.AxesHelper(this.gl.gl,{size:6,symmetric:!0}).setParent(this.scene),this.orbit=new ht(this.camera,{element:this.canvas}),this.raycast=new I.Raycast,this.mouse=new I.Vec2,this.isEventListenersAdded=!1}addMesh(e){this.scene.addChild(e)}getContext(){return this.gl.gl}removeMesh(e){this.scene.removeChild(e)}getMeshes(){return this.meshes}update(){this.orbit?.update()}addFigure(e){const r=super.addFigure(e);if(r.geometry){const i=r.geometry.constructor.name;r.geometry.raycast=i.includes("Sphere")?"sphere":"box"}return r.isHit=!1,r.onBeforeRender(({mesh:i})=>{this.updateHitUniform(i)}),this.isEventListenersAdded||this.initMouseListeners(),r}updateHitUniform(e){this.program.uniforms.uHit.value=e.isHit?1:0}initMouseListeners(){document.addEventListener("mousemove",this.handleMouseMove,!1),this.isEventListenersAdded=!0}handleMouseMove=e=>{if(this.orbit.isInteracting)return;this.mouse.set(2*(e.x/this.gl.width)-1,2*(1-e.y/this.gl.height)-1),this.raycast.castMouse(this.camera,this.mouse),this.meshes.forEach(i=>i.isHit=!1),this.raycast.intersectBounds(this.meshes).forEach(i=>i.isHit=!0)};destroy(){this.isEventListenersAdded&&(window.removeEventListener("mousemove",this.handleMouseMove,!1),this.isEventListenersAdded=!1),this.orbit=null,this.raycast=null,this.mouse=null,super.destroy()}};exports.EditorRenderer=At([V()],exports.EditorRenderer);class xt extends ue{orbit;constructor(e){super(e),this.orbit=new I.Orbit(this.camera,{element:this.canvas,target:new I.Vec3(0,0,0),minPolarAngle:Math.PI/2,maxPolarAngle:Math.PI/2,enableRotate:!0,enableZoom:!1,enablePan:!1})}update(){this.orbit?.update()}}class Dt{type;position;normal;uv;material;constructor(e){this.type=e.type,this.position=e.position,this.normal=e.normal??[],this.uv=e.uv??[],this.material=e.material}}var Ne=(t=>(t[t.Cube=0]="Cube",t[t.Sphere=1]="Sphere",t[t.Plane=2]="Plane",t[t.Cylinder=3]="Cylinder",t[t.Custom=4]="Custom",t))(Ne||{}),G=(t=>(t.Plane="plane",t.Wireframe="wireframe",t.Texture="texture",t))(G||{});class kt{positions=[];normals=[];uvs=[];tmpPositions=[];tmpNormals=[];tmpUVs=[];load(e){const r=e.split(`
58
- `);for(const a of r){if(!a.trim()||a.startsWith("#"))continue;const o=a.trim().split(/\s+/);switch(o[0]){case"v":this.tmpPositions.push(o.slice(1).map(Number));break;case"vn":this.tmpNormals.push(o.slice(1).map(Number));break;case"vt":this.tmpUVs.push(o.slice(1).map(Number));break;case"f":this.processFaceLine(o);break}}const i={type:Ne.Custom,position:this.positions,...this.normals.length>0&&{normal:this.normals},...this.uvs.length>0&&{uv:this.uvs}};return new Dt(i)}processFaceLine(e){for(let r=1;r<e.length;r++){const i=e[r];if(!i)continue;const[a,o,f]=i.split("/"),m=a?parseInt(a,10):void 0,w=o?parseInt(o,10):void 0,v=f?parseInt(f,10):void 0;if(m!==void 0){const b=this.tmpPositions[m-1];b&&this.positions.push(...b)}if(w!==void 0){const b=this.tmpUVs[w-1];b&&this.uvs.push(...b)}if(v!==void 0){const b=this.tmpNormals[v-1];b&&this.normals.push(...b)}}}}var jt=Object.getOwnPropertyDescriptor,Ht=(t,e,r,i)=>{for(var a=i>1?void 0:i?jt(e,r):e,o=t.length-1,f;o>=0;o--)(f=t[o])&&(a=f(a)||a);return a},Nt=(t,e)=>(r,i)=>e(r,i,t);let se=class{currentMode=G.Plane;handlers;constructor(t){this.handlers=new Map(t.map(e=>[e.mode,e]))}manage(t){t!==this.currentMode&&(this.handlers.get(this.currentMode)?.rollback(),t!==G.Plane&&this.handlers.get(t)?.handle(),this.currentMode=t)}destroy(){this.handlers&&this.handlers.clear(),this.currentMode=G.Plane}};se=Ht([V(),Nt(0,Ct("IDisplayHandler"))],se);var Ft=Object.getOwnPropertyDescriptor,Lt=(t,e,r,i)=>{for(var a=i>1?void 0:i?Ft(e,r):e,o=t.length-1,f;o>=0;o--)(f=t[o])&&(a=f(a)||a);return a},Gt=(t,e)=>(r,i)=>e(r,i,t);let ae=class{constructor(t){this.api=t,this.wireMeshes=[],this.context=this.api.getContext(),this.wireMeshProgram=new I.NormalProgram(this.context)}mode=G.Wireframe;wireMeshes;wireMeshProgram;context;handle(){const t=this.api.getMeshes();this.createWireMeshes(t),this.api.removeMeshes(t),this.api.addMeshes(this.wireMeshes)}rollback(){const t=this.api.getMeshes();this.api.removeMeshes(this.wireMeshes),this.api.addMeshes(t)}destroy(){this.wireMeshes&&(this.wireMeshes.length=0,this.wireMeshes=[])}createWireMeshes(t){for(const e of t){const r=new I.WireMesh(this.context,{geometry:e.geometry,program:this.wireMeshProgram});this.wireMeshes.push(r)}}};ae=Lt([V(),Gt(0,ce("RendererApi"))],ae);var Vt=Object.getOwnPropertyDescriptor,Wt=(t,e,r,i)=>{for(var a=i>1?void 0:i?Vt(e,r):e,o=t.length-1,f;o>=0;o--)(f=t[o])&&(a=f(a)||a);return a},zt=(t,e)=>(r,i)=>e(r,i,t);let oe=class{constructor(t){this.renderer=t}addMesh(t){this.renderer.addMesh(t)}addMeshes(t){for(const e of t)this.renderer.addMesh(e)}removeMesh(t){this.renderer.removeMesh(t)}removeMeshes(t){for(const e of t)this.renderer.removeMesh(e)}getMeshes(){return this.renderer.getMeshes()}getContext(){return this.renderer.getContext()}};oe=Wt([V(),zt(0,ce("EditorRenderer"))],oe);var Ut=Object.getOwnPropertyDescriptor,$t=(t,e,r,i)=>{for(var a=i>1?void 0:i?Ut(e,r):e,o=t.length-1,f;o>=0;o--)(f=t[o])&&(a=f(a)||a);return a},qt=(t,e)=>(r,i)=>e(r,i,t);exports.EditorHub=class{constructor(e){this.displayManager=e}setDisplayMode(e){this.displayManager.manage(e)}destroy(){this.displayManager.destroy()}};exports.EditorHub=$t([V(),qt(0,ce("IDisplayManager"))],exports.EditorHub);function Bt(t){const e=It.createChildContainer();return e.registerInstance("EditorRenderer",t),e.registerSingleton("RendererApi",oe),e.registerSingleton("IDisplayHandler",ae),e.registerSingleton("IDisplayManager",se),e.registerSingleton("EditorHub",exports.EditorHub),e}function Zt(t){return Bt(t).resolve("EditorHub")}exports.ObjLoader=kt;exports.PreviewRenderer=xt;exports.Renderer=ue;exports.createAppHub=Zt;
74
+ `)}function Dt(t,e,r){var i=he(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),o=i[1],n=o===void 0?null:o,l=kt(n,e);return jt("Cannot inject the dependency "+l+' of "'+t.name+'" constructor. Reason:',r)}function Ht(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Nt=(function(t){Le(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(Te),Ft=(function(t){Le(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(Te),Bt=(function(){function t(){this.preResolution=new Nt,this.postResolution=new Ft}return t})(),at=new Map,$t=(function(){function t(e){this.parent=e,this._registry=new At,this.interceptors=new Bt,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,r,i){i===void 0&&(i={lifecycle:H.Transient}),this.ensureNotDisposed();var o;if(Tt(r)?o=r:o={useClass:r},fe(o))for(var n=[e],l=o;l!=null;){var w=l.useToken;if(n.includes(w))throw new Error("Token registration cycle detected! "+Z(n,[w]).join(" -> "));n.push(w);var E=this._registry.get(w);E&&fe(E.provider)?l=E.provider:l=null}if((i.lifecycle===H.Singleton||i.lifecycle==H.ContainerScoped||i.lifecycle==H.ResolutionScoped)&&(ce(o)||Ee(o)))throw new Error('Cannot use lifecycle "'+H[i.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:o,options:i}),this},t.prototype.registerType=function(e,r){return this.ensureNotDisposed(),K(r)?this.register(e,{useToken:r}):this.register(e,{useClass:r})},t.prototype.registerInstance=function(e,r){return this.ensureNotDisposed(),this.register(e,{useValue:r})},t.prototype.registerSingleton=function(e,r){if(this.ensureNotDisposed(),K(e)){if(K(r))return this.register(e,{useToken:r},{lifecycle:H.Singleton});if(r)return this.register(e,{useClass:r},{lifecycle:H.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var i=e;return r&&!K(r)&&(i=r),this.register(e,{useClass:i},{lifecycle:H.Singleton})},t.prototype.resolve=function(e,r,i){r===void 0&&(r=new ue),i===void 0&&(i=!1),this.ensureNotDisposed();var o=this.getRegistration(e);if(!o&&K(e)){if(i)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),o){var n=this.resolveRegistration(o,r);return this.executePostResolutionInterceptor(e,n,"Single"),n}if(Lt(e)){var n=this.construct(e,r);return this.executePostResolutionInterceptor(e,n,"Single"),n}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,r){var i,o;if(this.interceptors.preResolution.has(e)){var n=[];try{for(var l=ae(this.interceptors.preResolution.getAll(e)),w=l.next();!w.done;w=l.next()){var E=w.value;E.options.frequency!="Once"&&n.push(E),E.callback(e,r)}}catch(_){i={error:_}}finally{try{w&&!w.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}this.interceptors.preResolution.setAll(e,n)}},t.prototype.executePostResolutionInterceptor=function(e,r,i){var o,n;if(this.interceptors.postResolution.has(e)){var l=[];try{for(var w=ae(this.interceptors.postResolution.getAll(e)),E=w.next();!E.done;E=w.next()){var _=E.value;_.options.frequency!="Once"&&l.push(_),_.callback(e,r,i)}}catch(S){o={error:S}}finally{try{E&&!E.done&&(n=w.return)&&n.call(w)}finally{if(o)throw o.error}}this.interceptors.postResolution.setAll(e,l)}},t.prototype.resolveRegistration=function(e,r){if(this.ensureNotDisposed(),e.options.lifecycle===H.ResolutionScoped&&r.scopedResolutions.has(e))return r.scopedResolutions.get(e);var i=e.options.lifecycle===H.Singleton,o=e.options.lifecycle===H.ContainerScoped,n=i||o,l;return ce(e.provider)?l=e.provider.useValue:fe(e.provider)?l=n?e.instance||(e.instance=this.resolve(e.provider.useToken,r)):this.resolve(e.provider.useToken,r):st(e.provider)?l=n?e.instance||(e.instance=this.construct(e.provider.useClass,r)):this.construct(e.provider.useClass,r):Ee(e.provider)?l=e.provider.useFactory(this):l=this.construct(e.provider,r),e.options.lifecycle===H.ResolutionScoped&&r.scopedResolutions.set(e,l),l},t.prototype.resolveAll=function(e,r,i){var o=this;r===void 0&&(r=new ue),i===void 0&&(i=!1),this.ensureNotDisposed();var n=this.getAllRegistrations(e);if(!n&&K(e)){if(i)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),n){var l=n.map(function(E){return o.resolveRegistration(E,r)});return this.executePostResolutionInterceptor(e,l,"All"),l}var w=[this.construct(e,r)];return this.executePostResolutionInterceptor(e,w,"All"),w},t.prototype.isRegistered=function(e,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(e)||r&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,r;this.ensureNotDisposed();try{for(var i=ae(this._registry.entries()),o=i.next();!o.done;o=i.next()){var n=he(o.value,2),l=n[0],w=n[1];this._registry.setAll(l,w.filter(function(E){return!ce(E.provider)}).map(function(E){return E.instance=void 0,E}))}}catch(E){e={error:E}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,r;this.ensureNotDisposed();var i=new t(this);try{for(var o=ae(this._registry.entries()),n=o.next();!n.done;n=o.next()){var l=he(n.value,2),w=l[0],E=l[1];E.some(function(_){var S=_.options;return S.lifecycle===H.ContainerScoped})&&i._registry.setAll(w,E.map(function(_){return _.options.lifecycle===H.ContainerScoped?{provider:_.provider,options:_.options}:_}))}}catch(_){e={error:_}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return i},t.prototype.beforeResolution=function(e,r,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:r,options:i})},t.prototype.afterResolution=function(e,r,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:r,options:i})},t.prototype.dispose=function(){return Ct(this,void 0,void 0,function(){var e;return St(this,function(r){switch(r.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(i){var o=i.dispose();o&&e.push(o)}),[4,Promise.all(e)];case 1:return r.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,r){var i=this;if(e instanceof ot)return e.createProxy(function(n){return i.resolve(n,r)});var o=(function(){var n=at.get(e);if(!n||n.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var l=n.map(i.resolveParams(r,e));return new(e.bind.apply(e,Z([void 0],l)))})();return Ht(o)&&this.disposables.add(o),o},t.prototype.resolveParams=function(e,r){var i=this;return function(o,n){var l,w,E;try{return It(o)?Xe(o)?o.multiple?(l=i.resolve(o.transform)).transform.apply(l,Z([i.resolveAll(o.token,new ue,o.isOptional)],o.transformArgs)):(w=i.resolve(o.transform)).transform.apply(w,Z([i.resolve(o.token,e,o.isOptional)],o.transformArgs)):o.multiple?i.resolveAll(o.token,new ue,o.isOptional):i.resolve(o.token,e,o.isOptional):Xe(o)?(E=i.resolve(o.transform,e)).transform.apply(E,Z([i.resolve(o.token,e)],o.transformArgs)):i.resolve(o,e)}catch(_){throw new Error(Dt(r,n,_))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t})(),Wt=new $t;function W(t,e){var r={token:t,multiple:!1,isOptional:e};return it(r)}function U(t){return function(e){at.set(e,xt(e))}}function ut(t,e){var r={token:t,multiple:!0,isOptional:e};return it(r)}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var le={exports:{}},Ke;function Gt(){if(Ke)return le.exports;Ke=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(f,d,m){return Function.prototype.apply.call(f,d,m)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(f){return Object.getOwnPropertyNames(f).concat(Object.getOwnPropertySymbols(f))}:r=function(f){return Object.getOwnPropertyNames(f)};function i(c){console&&console.warn&&console.warn(c)}var o=Number.isNaN||function(f){return f!==f};function n(){n.init.call(this)}le.exports=n,le.exports.once=Q,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var l=10;function w(c){if(typeof c!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof c)}Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(c){if(typeof c!="number"||c<0||o(c))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+c+".");l=c}}),n.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},n.prototype.setMaxListeners=function(f){if(typeof f!="number"||f<0||o(f))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+f+".");return this._maxListeners=f,this};function E(c){return c._maxListeners===void 0?n.defaultMaxListeners:c._maxListeners}n.prototype.getMaxListeners=function(){return E(this)},n.prototype.emit=function(f){for(var d=[],m=1;m<arguments.length;m++)d.push(arguments[m]);var O=f==="error",x=this._events;if(x!==void 0)O=O&&x.error===void 0;else if(!O)return!1;if(O){var R;if(d.length>0&&(R=d[0]),R instanceof Error)throw R;var N=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw N.context=R,N}var q=x[f];if(q===void 0)return!1;if(typeof q=="function")e(q,this,d);else for(var se=q.length,pe=Y(q,se),m=0;m<se;++m)e(pe[m],this,d);return!0};function _(c,f,d,m){var O,x,R;if(w(d),x=c._events,x===void 0?(x=c._events=Object.create(null),c._eventsCount=0):(x.newListener!==void 0&&(c.emit("newListener",f,d.listener?d.listener:d),x=c._events),R=x[f]),R===void 0)R=x[f]=d,++c._eventsCount;else if(typeof R=="function"?R=x[f]=m?[d,R]:[R,d]:m?R.unshift(d):R.push(d),O=E(c),O>0&&R.length>O&&!R.warned){R.warned=!0;var N=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(f)+" listeners added. Use emitter.setMaxListeners() to increase limit");N.name="MaxListenersExceededWarning",N.emitter=c,N.type=f,N.count=R.length,i(N)}return c}n.prototype.addListener=function(f,d){return _(this,f,d,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(f,d){return _(this,f,d,!0)};function S(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function j(c,f,d){var m={fired:!1,wrapFn:void 0,target:c,type:f,listener:d},O=S.bind(m);return O.listener=d,m.wrapFn=O,O}n.prototype.once=function(f,d){return w(d),this.on(f,j(this,f,d)),this},n.prototype.prependOnceListener=function(f,d){return w(d),this.prependListener(f,j(this,f,d)),this},n.prototype.removeListener=function(f,d){var m,O,x,R,N;if(w(d),O=this._events,O===void 0)return this;if(m=O[f],m===void 0)return this;if(m===d||m.listener===d)--this._eventsCount===0?this._events=Object.create(null):(delete O[f],O.removeListener&&this.emit("removeListener",f,m.listener||d));else if(typeof m!="function"){for(x=-1,R=m.length-1;R>=0;R--)if(m[R]===d||m[R].listener===d){N=m[R].listener,x=R;break}if(x<0)return this;x===0?m.shift():ee(m,x),m.length===1&&(O[f]=m[0]),O.removeListener!==void 0&&this.emit("removeListener",f,N||d)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(f){var d,m,O;if(m=this._events,m===void 0)return this;if(m.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):m[f]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete m[f]),this;if(arguments.length===0){var x=Object.keys(m),R;for(O=0;O<x.length;++O)R=x[O],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(d=m[f],typeof d=="function")this.removeListener(f,d);else if(d!==void 0)for(O=d.length-1;O>=0;O--)this.removeListener(f,d[O]);return this};function G(c,f,d){var m=c._events;if(m===void 0)return[];var O=m[f];return O===void 0?[]:typeof O=="function"?d?[O.listener||O]:[O]:d?z(O):Y(O,O.length)}n.prototype.listeners=function(f){return G(this,f,!0)},n.prototype.rawListeners=function(f){return G(this,f,!1)},n.listenerCount=function(c,f){return typeof c.listenerCount=="function"?c.listenerCount(f):V.call(c,f)},n.prototype.listenerCount=V;function V(c){var f=this._events;if(f!==void 0){var d=f[c];if(typeof d=="function")return 1;if(d!==void 0)return d.length}return 0}n.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function Y(c,f){for(var d=new Array(f),m=0;m<f;++m)d[m]=c[m];return d}function ee(c,f){for(;f+1<c.length;f++)c[f]=c[f+1];c.pop()}function z(c){for(var f=new Array(c.length),d=0;d<f.length;++d)f[d]=c[d].listener||c[d];return f}function Q(c,f){return new Promise(function(d,m){function O(R){c.removeListener(f,x),m(R)}function x(){typeof c.removeListener=="function"&&c.removeListener("error",O),d([].slice.call(arguments))}ie(c,f,x,{once:!0}),f!=="error"&&ne(c,O,{once:!0})})}function ne(c,f,d){typeof c.on=="function"&&ie(c,"error",f,d)}function ie(c,f,d,m){if(typeof c.on=="function")m.once?c.once(f,d):c.on(f,d);else if(typeof c.addEventListener=="function")c.addEventListener(f,function O(x){m.once&&c.removeEventListener(f,O),d(x)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof c)}return le.exports}var Vt=Gt(),zt=Object.getOwnPropertyDescriptor,Ut=(t,e,r,i)=>{for(var o=i>1?void 0:i?zt(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o};exports.EventBus=class{_emitter;constructor(){this._emitter=new Vt.EventEmitter}emit(e,r){this._emitter.emit(e,r)}on(e,r){this._emitter.on(e,r)}off(e,r){this._emitter.off(e,r)}};exports.EventBus=Ut([U()],exports.EventBus);var J=(t=>(t.SelectHover="select.hover",t.SelectClick="select.click",t))(J||{}),qt=Object.getOwnPropertyDescriptor,Zt=(t,e,r,i)=>{for(var o=i>1?void 0:i?qt(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},et=(t,e)=>(r,i)=>e(r,i,t);exports.EditorRenderer=class extends Ie{constructor(e,r){super(e),this._canvas=e,this._bus=r;const i=new D.GridHelper(this.gl.gl,{size:10,divisions:10});i.position.y=-.001,i.setParent(this.scene),new D.AxesHelper(this.gl.gl,{size:6,symmetric:!0}).setParent(this.scene),this._orbit=new Pt(this.camera,{element:this.canvas}),this._raycast=new D.Raycast,this._mouse=new D.Vec2,this._isEventListenersAdded=!1}_orbit;_raycast;_mouse;_isEventListenersAdded;update(){this._orbit?.update()}addFigure(e){const r=super.addFigure(e);if(r.geometry){const i=r.geometry.constructor.name;r.geometry.raycast=i.includes("Sphere")?"sphere":"box"}return this._isEventListenersAdded||this.initMouseListeners(),r}setMeshBeforeRender(e,r){e.onBeforeRender(r)}initMouseListeners(){document.addEventListener("mousemove",this._handleMouseMove,!1),document.addEventListener("click",this._handleMouseClick,!1),this._isEventListenersAdded=!0}_handleMouseMove=e=>{this._processRaycastEvent(e,J.SelectHover,!0)};_handleMouseClick=e=>{this._processRaycastEvent(e,J.SelectClick,!1)};_processRaycastEvent(e,r,i){if(this._orbit.isInteracting)return;this._mouse.set(2*(e.x/this.gl.width)-1,2*(1-e.y/this.gl.height)-1),this._raycast.castMouse(this.camera,this._mouse),i&&this.meshes.forEach(l=>l.isHit=!1);const o=this._raycast.intersectBounds(this.meshes),n=o.length?o[0]:null;this._bus.emit(r,n?{mesh:n}:null),i&&o.forEach(l=>l.isHit=!0)}destroy(){this._isEventListenersAdded&&(document.removeEventListener("mousemove",this._handleMouseMove,!1),document.removeEventListener("click",this._handleMouseClick,!1),this._isEventListenersAdded=!1),this._orbit.destroy(),this._orbit=null,this._raycast=null,this._mouse=null,super.destroy()}};exports.EditorRenderer=Zt([U(),et(0,W("Canvas")),et(1,W("EventBus"))],exports.EditorRenderer);class Jt extends Ie{_orbit;constructor(e){super(e),this._orbit=new D.Orbit(this.camera,{element:this.canvas,target:new D.Vec3(0,0,0),minPolarAngle:Math.PI/2,maxPolarAngle:Math.PI/2,enableRotate:!0,enableZoom:!1,enablePan:!1})}update(){this._orbit?.update()}}class Yt{type;position;normal;uv;material;constructor(e){this.type=e.type,this.position=e.position,this.normal=e.normal??[],this.uv=e.uv??[],this.material=e.material}}var lt=(t=>(t[t.Cube=0]="Cube",t[t.Sphere=1]="Sphere",t[t.Plane=2]="Plane",t[t.Cylinder=3]="Cylinder",t[t.Custom=4]="Custom",t))(lt||{}),re=(t=>(t.Plane="plane",t.Wireframe="wireframe",t.Texture="texture",t))(re||{}),ve=(t=>(t.Mesh="mesh",t.Face="face",t.Edge="edge",t.Vertex="vertex",t))(ve||{});class Qt{_positions=[];_normals=[];_uvs=[];_tmpPositions=[];_tmpNormals=[];_tmpUVs=[];load(e){const r=e.split(`
75
+ `);for(const o of r){if(!o.trim()||o.startsWith("#"))continue;const n=o.trim().split(/\s+/);switch(n[0]){case"v":this._tmpPositions.push(n.slice(1).map(Number));break;case"vn":this._tmpNormals.push(n.slice(1).map(Number));break;case"vt":this._tmpUVs.push(n.slice(1).map(Number));break;case"f":this.processFaceLine(n);break}}const i={type:lt.Custom,position:this._positions,...this._normals.length>0&&{normal:this._normals},...this._uvs.length>0&&{uv:this._uvs}};return new Yt(i)}processFaceLine(e){for(let r=1;r<e.length;r++){const i=e[r];if(!i)continue;const[o,n,l]=i.split("/"),w=o?parseInt(o,10):void 0,E=n?parseInt(n,10):void 0,_=l?parseInt(l,10):void 0;if(w!==void 0){const S=this._tmpPositions[w-1];S&&this._positions.push(...S)}if(E!==void 0){const S=this._tmpUVs[E-1];S&&this._uvs.push(...S)}if(_!==void 0){const S=this._tmpNormals[_-1];S&&this._normals.push(...S)}}}}var Xt=Object.getOwnPropertyDescriptor,Kt=(t,e,r,i)=>{for(var o=i>1?void 0:i?Xt(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},er=(t,e)=>(r,i)=>e(r,i,t);let Re=class{_currentMode=re.Plane;_handlers;constructor(t){this._handlers=new Map(t.map(e=>[e.mode,e]))}manage(t){t!==this._currentMode&&(this._handlers.get(this._currentMode)?.rollback(),t!==re.Plane&&this._handlers.get(t)?.handle(),this._currentMode=t)}destroy(){this._handlers&&this._handlers.clear(),this._currentMode=re.Plane}};Re=Kt([U(),er(0,ut("IDisplayHandler"))],Re);var de=(t=>(t.Hover="hover",t.Click="click",t))(de||{}),tr=Object.getOwnPropertyDescriptor,rr=(t,e,r,i)=>{for(var o=i>1?void 0:i?tr(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},tt=(t,e)=>(r,i)=>e(r,i,t);let Pe=class{constructor(t,e){this._eventBus=t,this._handlers=new Map(e.map(r=>[r.mode,r])),this._eventBus.on(J.SelectHover,this._onHover),this._eventBus.on(J.SelectClick,this._onClick)}_currentMode=ve.Mesh;_handlers;manage(t){t!==this._currentMode&&(this._handlers.get(this._currentMode)?.rollback(),this._currentMode=t)}_onHover=t=>{if(!t)return;this._handlers.get(this._currentMode)?.handle(t,de.Hover)};_onClick=t=>{if(!t)return;this._handlers.get(this._currentMode)?.handle(t,de.Click)};destroy(){this._eventBus.off(J.SelectHover,this._onHover)}};Pe=rr([U(),tt(0,W("EventBus")),tt(1,ut("ISelectHandler"))],Pe);var nr=Object.getOwnPropertyDescriptor,ir=(t,e,r,i)=>{for(var o=i>1?void 0:i?nr(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},sr=(t,e)=>(r,i)=>e(r,i,t);let Ce=class{constructor(t){this._api=t,this._wireMeshes=[],this._context=this._api.getContext(),this._wireMeshProgram=new D.NormalProgram(this._context)}mode=re.Wireframe;_wireMeshes;_wireMeshProgram;_context;handle(){const t=this._api.getMeshes();this.createWireMeshes(t),this._api.removeMeshes(t),this._api.addMeshes(this._wireMeshes)}rollback(){const t=this._api.getMeshes();this._api.removeMeshes(this._wireMeshes),this._api.addMeshes(t)}destroy(){this._wireMeshes&&(this._wireMeshes.length=0,this._wireMeshes=[])}createWireMeshes(t){for(const e of t){const r=new D.WireMesh(this._context,{geometry:e.geometry,program:this._wireMeshProgram});this._wireMeshes.push(r)}}};Ce=ir([U(),sr(0,W("RendererApi"))],Ce);var or=Object.getOwnPropertyDescriptor,ar=(t,e,r,i)=>{for(var o=i>1?void 0:i?or(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},ur=(t,e)=>(r,i)=>e(r,i,t);let Se=class{constructor(t){this._api=t,this._program=t.getProgram(),this._selectedMesh=null}mode=ve.Mesh;_program;_selectedMesh;handle(t,e){if(!t)return;const{mesh:r}=t;e===de.Hover?this._api.setMeshBeforeRender(r,()=>this._onHover(r)):this._api.setMeshBeforeRender(r,()=>this._onClick(r))}_onHover=t=>{t.program.uniforms.uHit.value=t.isHit?1:0};_onClick=t=>{this._selectedMesh&&this._selectedMesh.program?.uniforms.uSelected&&(this._selectedMesh.program.uniforms.uSelected.value=0),this._selectedMesh=t,t.program?.uniforms.uSelected&&(t.program.uniforms.uSelected.value=1),console.log(`Selected mesh: ${t.id}`)};rollback(){this._program.uniforms.uHit.value=0}destroy(){this.rollback()}};Se=ar([U(),ur(0,W("RendererApi"))],Se);var lr=Object.getOwnPropertyDescriptor,fr=(t,e,r,i)=>{for(var o=i>1?void 0:i?lr(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},cr=(t,e)=>(r,i)=>e(r,i,t);let xe=class{constructor(t){this._renderer=t}addMesh(t){this._renderer.addMesh(t)}addMeshes(t){for(const e of t)this._renderer.addMesh(e)}removeMesh(t){this._renderer.removeMesh(t)}removeMeshes(t){for(const e of t)this._renderer.removeMesh(e)}getMeshes(){return this._renderer.getMeshes()}getContext(){return this._renderer.getContext()}getProgram(){return this._renderer.getProgram()}setMeshBeforeRender(t,e){this._renderer.setMeshBeforeRender(t,e)}};xe=fr([U(),cr(0,W("EditorRenderer"))],xe);var hr=Object.getOwnPropertyDescriptor,dr=(t,e,r,i)=>{for(var o=i>1?void 0:i?hr(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},we=(t,e)=>(r,i)=>e(r,i,t);exports.EditorHub=class{constructor(e,r,i){this._displayManager=e,this._selectManager=r,this._renderer=i,r.manage(ve.Mesh)}setDisplayMode(e){this._displayManager.manage(e)}setSelectMode(e){this._selectManager.manage(e)}resizeRenderer(){this._renderer.resize()}updateRenderer(){this._renderer.loop()}addFigure(e){this._renderer.addFigure(e)}destroy(){this._displayManager.destroy(),this._selectManager.destroy(),this._renderer.destroy()}};exports.EditorHub=dr([U(),we(0,W("IDisplayManager")),we(1,W("ISelectManager")),we(2,W("EditorRenderer"))],exports.EditorHub);let rt=!1;const B=Wt.createChildContainer();function vr(t){return rt||(B.registerInstance("Canvas",t),B.registerSingleton("EventBus",exports.EventBus),B.registerSingleton("EditorRenderer",exports.EditorRenderer),B.registerSingleton("RendererApi",xe),B.registerSingleton("IDisplayHandler",Ce),B.registerSingleton("ISelectHandler",Se),B.registerSingleton("IDisplayManager",Re),B.registerSingleton("ISelectManager",Pe),B.registerSingleton("EditorHub",exports.EditorHub),rt=!0),B}function pr(t){return vr(t).resolve("EditorHub")}exports.EditorMesh=nt;exports.EventTopics=J;exports.ObjLoader=Qt;exports.PreviewRenderer=Jt;exports.Renderer=Ie;exports.createAppHub=pr;
package/dist/index.d.ts CHANGED
@@ -4,5 +4,12 @@ export * from './core/preview-renderer';
4
4
  export * from './loaders/obj-loader';
5
5
  export * from './hub/app-hub';
6
6
  export * from './hub/editor-hub';
7
- export * from './interfaces/manager';
7
+ export * from './interfaces/manager/manager';
8
+ export * from './interfaces/manager/display-manager';
9
+ export * from './interfaces/manager/select-manager';
10
+ export * from './events/event-bus';
11
+ export * from './extensions/mesh-extension';
12
+ export * from './events/editor-events';
13
+ export * from './events/event-topics';
14
+ export * from './types/camera/camera-position';
8
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAG1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AAExC,cAAc,sBAAsB,CAAC;AAErC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAG1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AAExC,cAAc,sBAAsB,CAAC;AAErC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AAEpD,cAAc,oBAAoB,CAAC;AAEnC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC"}