'; !function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="/",t(0)}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var n=t.slice(1),r=e[t[0]];return function(e,t,i){r.apply(this,[e,t,i].concat(n))}}(e[t]);break;default:e[t]=e[e[t]]}return e}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n1){for(var v=Array(m),g=0;g1){for(var b=Array(y),_=0;_8&&w<=11),E=32,S=String.fromCharCode(E),T={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["topCompositionEnd","topKeyPress","topTextInput","topPaste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:["topBlur","topCompositionEnd","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:["topBlur","topCompositionStart","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:["topBlur","topCompositionUpdate","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]}},P=!1,C=null,L={eventTypes:T,extractEvents:function(e,t,n,r){return[l(e,t,n,r),p(e,t,n,r)]}};e.exports=L},function(e,t,n){"use strict";function r(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return g(e,r)}function i(e,t,n){ var i=r(e,n,t);i&&(n._dispatchListeners=m(n._dispatchListeners,i),n._dispatchInstances=m(n._dispatchInstances,e))}function a(e){e&&e.dispatchConfig.phasedRegistrationNames&&f.traverseTwoPhase(e._targetInst,i,e)}function o(e){if(e&&e.dispatchConfig.phasedRegistrationNames){var t=e._targetInst,n=t?f.getParentInstance(t):null;f.traverseTwoPhase(n,i,e)}}function s(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,i=g(e,r);i&&(n._dispatchListeners=m(n._dispatchListeners,i),n._dispatchInstances=m(n._dispatchInstances,e))}}function c(e){e&&e.dispatchConfig.registrationName&&s(e._targetInst,null,e)}function l(e){v(e,a)}function u(e){v(e,o)}function h(e,t,n,r){f.traverseEnterLeave(n,r,s,e,t)}function p(e){v(e,c)}var d=n(42),f=n(44),m=n(46),v=n(47),g=(n(8),d.getListener),y={accumulateTwoPhaseDispatches:l,accumulateTwoPhaseDispatchesSkipTarget:u,accumulateDirectDispatches:p,accumulateEnterLeaveDispatches:h};e.exports=y},function(e,t,n){"use strict";function r(e){return"button"===e||"input"===e||"select"===e||"textarea"===e}function i(e,t,n){switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":return!(!n.disabled||!r(t));default:return!1}}var a=n(35),o=n(43),s=n(44),c=n(45),l=n(46),u=n(47),h=(n(12),{}),p=null,d=function(e,t){e&&(s.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},f=function(e){return d(e,!0)},m=function(e){return d(e,!1)},v=function(e){return"."+e._rootNodeID},g={injection:{injectEventPluginOrder:o.injectEventPluginOrder,injectEventPluginsByName:o.injectEventPluginsByName},putListener:function(e,t,n){"function"!=typeof n?a("94",t,typeof n):void 0;var r=v(e),i=h[t]||(h[t]={});i[r]=n;var s=o.registrationNameModules[t];s&&s.didPutListener&&s.didPutListener(e,t,n)},getListener:function(e,t){var n=h[t];if(i(t,e._currentElement.type,e._currentElement.props))return null;var r=v(e);return n&&n[r]},deleteListener:function(e,t){var n=o.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var r=h[t];if(r){var i=v(e);delete r[i]}},deleteAllListeners:function(e){var t=v(e);for(var n in h)if(h.hasOwnProperty(n)&&h[n][t]){var r=o.registrationNameModules[n];r&&r.willDeleteListener&&r.willDeleteListener(e,n),delete h[n][t]}},extractEvents:function(e,t,n,r){for(var i,a=o.plugins,s=0;s-1?void 0:o("96",e),!l.plugins[n]){t.extractEvents?void 0:o("97",e),l.plugins[n]=t;var r=t.eventTypes;for(var a in r)i(r[a],t,a)?void 0:o("98",a,e)}}}function i(e,t,n){l.eventNameDispatchConfigs.hasOwnProperty(n)?o("99",n):void 0,l.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];a(s,t,n)}return!0}return!!e.registrationName&&(a(e.registrationName,t,n),!0)}function a(e,t,n){l.registrationNameModules[e]?o("100",e):void 0,l.registrationNameModules[e]=t,l.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var o=n(35),s=(n(12),null),c={},l={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},possibleRegistrationNames:null,injectEventPluginOrder:function(e){s?o("101"):void 0,s=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];c.hasOwnProperty(n)&&c[n]===i||(c[n]?o("102",n):void 0,c[n]=i,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return l.registrationNameModules[t.registrationName]||null;if(void 0!==t.phasedRegistrationNames){var n=t.phasedRegistrationNames;for(var r in n)if(n.hasOwnProperty(r)){var i=l.registrationNameModules[n[r]];if(i)return i}}return null},_resetEventPlugins:function(){s=null;for(var e in c)c.hasOwnProperty(e)&&delete c[e];l.plugins.length=0;var t=l.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=l.registrationNameModules;for(var i in r)r.hasOwnProperty(i)&&delete r[i]}};e.exports=l},function(e,t,n){"use strict";function r(e){return"topMouseUp"===e||"topTouchEnd"===e||"topTouchCancel"===e}function i(e){return"topMouseMove"===e||"topTouchMove"===e}function a(e){return"topMouseDown"===e||"topTouchStart"===e}function o(e,t,n,r){var i=e.type||"unknown-event";e.currentTarget=g.getNodeFromInstance(r),t?m.invokeGuardedCallbackWithCatch(i,n,e):m.invokeGuardedCallback(i,n,e),e.currentTarget=null}function s(e,t){var n=e._dispatchListeners,r=e._dispatchInstances;if(Array.isArray(n))for(var i=0;i1?1-t:void 0;return this._fallbackText=i.slice(e,s),this._fallbackText}}),a.addPoolingTo(r),e.exports=r},[244,35],function(e,t,n){"use strict";function r(){return!a&&i.canUseDOM&&(a="textContent"in document.documentElement?"textContent":"innerText"),a}var i=n(48),a=null;e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return i.call(this,e,t,n,r)}var i=n(53),a={data:null};i.augmentClass(r,a),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var i=this.constructor.Interface;for(var a in i)if(i.hasOwnProperty(a)){var s=i[a];s?this[a]=s(n):"target"===a?this.target=r:this[a]=n[a]}var c=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;return c?this.isDefaultPrevented=o.thatReturnsTrue:this.isDefaultPrevented=o.thatReturnsFalse,this.isPropagationStopped=o.thatReturnsFalse,this}var i=n(4),a=n(50),o=n(9),s=(n(8),"function"==typeof Proxy,["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),c={type:null,target:null,currentTarget:o.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};i(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=o.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=o.thatReturnsTrue)},persist:function(){this.isPersistent=o.thatReturnsTrue},isPersistent:o.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n8));var I=!1;M.canUseDOM&&(I=L("input")&&(!document.documentMode||document.documentMode>9));var N={eventTypes:k,_allowSimulatedPassThrough:!0,_isInputEventSupported:I,extractEvents:function(e,t,n,a){var o,s,c=t?E.getNodeFromInstance(t):window;if(i(c)?R?o=u:s=h:A(c)?I?o=b:(o=v,s=m):g(c)&&(o=y),o){var l=o(e,t,n);if(l){var p=r(l,n,a);return p}}s&&s(e,c,t),"topBlur"===e&&_(t,c)}};e.exports=N},function(e,t,n){"use strict";function r(){C.ReactReconcileTransaction&&x?void 0:u("123")}function i(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=p.getPooled(),this.reconcileTransaction=C.ReactReconcileTransaction.getPooled(!0)}function a(e,t,n,i,a,o){return r(),x.batchedUpdates(e,t,n,i,a,o)}function o(e,t){return e._mountOrder-t._mountOrder}function s(e){var t=e.dirtyComponentsLength;t!==y.length?u("124",t,y.length):void 0,y.sort(o),b++;for(var n=0;n]/,c=n(80),l=c(function(e,t){if(e.namespaceURI!==a.svg||"innerHTML"in e)e.innerHTML=t;else{r=r||document.createElement("div"),r.innerHTML=""+t+"";for(var n=r.firstChild;n.firstChild;)e.appendChild(n.firstChild)}});if(i.canUseDOM){var u=document.createElement("div");u.innerHTML=" ",""===u.innerHTML&&(l=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),o.test(t)||"<"===t[0]&&s.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t}),u=null}e.exports=l},function(e,t){"use strict";var n=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e};e.exports=n},function(e,t,n){"use strict";var r=n(48),i=n(82),a=n(79),o=function(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(o=function(e,t){return 3===e.nodeType?void(e.nodeValue=t):void a(e,i(t))})),e.exports=o},function(e,t){"use strict";function n(e){var t=""+e,n=i.exec(t);if(!n)return t;var r,a="",o=0,s=0;for(o=n.index;o]/;e.exports=r},function(e,t,n){"use strict";var r=n(35),i=n(77),a=n(48),o=n(84),s=n(9),c=(n(12),{dangerouslyReplaceNodeWithMarkup:function(e,t){if(a.canUseDOM?void 0:r("56"),t?void 0:r("57"),"HTML"===e.nodeName?r("58"):void 0,"string"==typeof t){var n=o(t,s)[0];e.parentNode.replaceChild(n,e)}else i.replaceChildWithTree(e,t)}});e.exports=c},function(e,t,n){"use strict";function r(e){var t=e.match(u);return t&&t[1].toLowerCase()}function i(e,t){var n=l;l?void 0:c(!1);var i=r(e),a=i&&s(i);if(a){n.innerHTML=a[1]+e+a[2];for(var u=a[0];u--;)n=n.lastChild}else n.innerHTML=e;var h=n.getElementsByTagName("script");h.length&&(t?void 0:c(!1),o(h).forEach(t));for(var p=Array.from(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return p}var a=n(48),o=n(85),s=n(86),c=n(12),l=a.canUseDOM?document.createElement("div"):null,u=/^\s*<(\w+)/;e.exports=i},function(e,t,n){"use strict";function r(e){var t=e.length;if(Array.isArray(e)||"object"!=typeof e&&"function"!=typeof e?o(!1):void 0,"number"!=typeof t?o(!1):void 0,0===t||t-1 in e?void 0:o(!1),"function"==typeof e.callee?o(!1):void 0,e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(e){}for(var n=Array(t),r=0;r":o.innerHTML="<"+e+">",s[e]=!o.firstChild),s[e]?p[e]:null}var i=n(48),a=n(12),o=i.canUseDOM?document.createElement("div"):null,s={},c=[1,'"],l=[1,"","
"],u=[3,"","
"],h=[1,'',""],p={ "*":[1,"?
","
"],area:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],param:[1,"",""],tr:[2,"","
"],optgroup:c,option:c,caption:l,colgroup:l,tbody:l,tfoot:l,thead:l,td:u,th:u},d=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];d.forEach(function(e){p[e]=h,s[e]=!0}),e.exports=r},function(e,t,n){"use strict";var r=n(76),i=n(34),a={dangerouslyProcessChildrenUpdates:function(e,t){var n=i.getNodeFromInstance(e);r.processUpdates(n,t)}};e.exports=a},function(e,t,n){"use strict";function r(e){if(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" This DOM node was rendered by `"+n+"`."}}return""}function i(e,t){t&&(J[e._tag]&&(null!=t.children||null!=t.dangerouslySetInnerHTML?v("137",e._tag,e._currentElement._owner?" Check the render method of "+e._currentElement._owner.getName()+".":""):void 0),null!=t.dangerouslySetInnerHTML&&(null!=t.children?v("60"):void 0,"object"==typeof t.dangerouslySetInnerHTML&&G in t.dangerouslySetInnerHTML?void 0:v("61")),null!=t.style&&"object"!=typeof t.style?v("62",r(e)):void 0)}function a(e,t,n,r){if(!(r instanceof R)){var i=e._hostContainerInfo,a=i._node&&i._node.nodeType===q,s=a?i._node:i._ownerDocument;j(t,s),r.getReactMountReady().enqueue(o,{inst:e,registrationName:t,listener:n})}}function o(){var e=this;E.putListener(e.inst,e.registrationName,e.listener)}function s(){var e=this;L.postMountWrapper(e)}function c(){var e=this;O.postMountWrapper(e)}function l(){var e=this;A.postMountWrapper(e)}function u(){N.track(this)}function h(){var e=this;e._rootNodeID?void 0:v("63");var t=F(e);switch(t?void 0:v("64"),e._tag){case"iframe":case"object":e._wrapperState.listeners=[T.trapBubbledEvent("topLoad","load",t)];break;case"video":case"audio":e._wrapperState.listeners=[];for(var n in Y)Y.hasOwnProperty(n)&&e._wrapperState.listeners.push(T.trapBubbledEvent(n,Y[n],t));break;case"source":e._wrapperState.listeners=[T.trapBubbledEvent("topError","error",t)];break;case"img":e._wrapperState.listeners=[T.trapBubbledEvent("topError","error",t),T.trapBubbledEvent("topLoad","load",t)];break;case"form":e._wrapperState.listeners=[T.trapBubbledEvent("topReset","reset",t),T.trapBubbledEvent("topSubmit","submit",t)];break;case"input":case"select":case"textarea":e._wrapperState.listeners=[T.trapBubbledEvent("topInvalid","invalid",t)]}}function p(){k.postUpdateWrapper(this)}function d(e){Q.call($,e)||(K.test(e)?void 0:v("65",e),$[e]=!0)}function f(e,t){return e.indexOf("-")>=0||null!=t.is}function m(e){var t=e.type;d(t),this._currentElement=e,this._tag=t.toLowerCase(),this._namespaceURI=null,this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._hostNode=null,this._hostParent=null,this._rootNodeID=0,this._domID=0,this._hostContainerInfo=null,this._wrapperState=null,this._topLevelWrapper=null,this._flags=0}var v=n(35),g=n(4),y=n(89),b=n(91),_=n(77),w=n(78),x=n(36),M=n(99),E=n(42),S=n(43),T=n(101),P=n(37),C=n(34),L=n(104),A=n(107),k=n(108),O=n(109),D=(n(62),n(110)),R=n(129),I=(n(9),n(82)),N=(n(12),n(66),n(118),n(64)),B=(n(132),n(8),P),U=E.deleteListener,F=C.getNodeFromInstance,j=T.listenTo,z=S.registrationNameModules,V={string:!0,number:!0},H="style",G="__html",W={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null},q=11,Y={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},X={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Z={listing:!0,pre:!0,textarea:!0},J=g({menuitem:!0},X),K=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,$={},Q={}.hasOwnProperty,ee=1;m.displayName="ReactDOMComponent",m.Mixin={mountComponent:function(e,t,n,r){this._rootNodeID=ee++,this._domID=n._idCounter++,this._hostParent=t,this._hostContainerInfo=n;var a=this._currentElement.props;switch(this._tag){case"audio":case"form":case"iframe":case"img":case"link":case"object":case"source":case"video":this._wrapperState={listeners:null},e.getReactMountReady().enqueue(h,this);break;case"input":L.mountWrapper(this,a,t),a=L.getHostProps(this,a),e.getReactMountReady().enqueue(u,this),e.getReactMountReady().enqueue(h,this);break;case"option":A.mountWrapper(this,a,t),a=A.getHostProps(this,a);break;case"select":k.mountWrapper(this,a,t),a=k.getHostProps(this,a),e.getReactMountReady().enqueue(h,this);break;case"textarea":O.mountWrapper(this,a,t),a=O.getHostProps(this,a),e.getReactMountReady().enqueue(u,this),e.getReactMountReady().enqueue(h,this)}i(this,a);var o,p;null!=t?(o=t._namespaceURI,p=t._tag):n._tag&&(o=n._namespaceURI,p=n._tag),(null==o||o===w.svg&&"foreignobject"===p)&&(o=w.html),o===w.html&&("svg"===this._tag?o=w.svg:"math"===this._tag&&(o=w.mathml)),this._namespaceURI=o;var d;if(e.useCreateElement){var f,m=n._ownerDocument;if(o===w.html)if("script"===this._tag){var v=m.createElement("div"),g=this._currentElement.type;v.innerHTML="<"+g+">",f=v.removeChild(v.firstChild)}else f=a.is?m.createElement(this._currentElement.type,a.is):m.createElement(this._currentElement.type);else f=m.createElementNS(o,this._currentElement.type);C.precacheNode(this,f),this._flags|=B.hasCachedChildNodes,this._hostParent||M.setAttributeForRoot(f),this._updateDOMProperties(null,a,e);var b=_(f);this._createInitialChildren(e,a,r,b),d=b}else{var x=this._createOpenTagMarkupAndPutListeners(e,a),E=this._createContentMarkup(e,a,r);d=!E&&X[this._tag]?x+"/>":x+">"+E+""}switch(this._tag){case"input":e.getReactMountReady().enqueue(s,this),a.autoFocus&&e.getReactMountReady().enqueue(y.focusDOMComponent,this);break;case"textarea":e.getReactMountReady().enqueue(c,this),a.autoFocus&&e.getReactMountReady().enqueue(y.focusDOMComponent,this);break;case"select":a.autoFocus&&e.getReactMountReady().enqueue(y.focusDOMComponent,this);break;case"button":a.autoFocus&&e.getReactMountReady().enqueue(y.focusDOMComponent,this);break;case"option":e.getReactMountReady().enqueue(l,this)}return d},_createOpenTagMarkupAndPutListeners:function(e,t){var n="<"+this._currentElement.type;for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];if(null!=i)if(z.hasOwnProperty(r))i&&a(this,r,i,e);else{r===H&&(i&&(i=this._previousStyleCopy=g({},t.style)),i=b.createMarkupForStyles(i,this));var o=null;null!=this._tag&&f(this._tag,t)?W.hasOwnProperty(r)||(o=M.createMarkupForCustomAttribute(r,i)):o=M.createMarkupForProperty(r,i),o&&(n+=" "+o)}}return e.renderToStaticMarkup?n:(this._hostParent||(n+=" "+M.createMarkupForRoot()),n+=" "+M.createMarkupForID(this._domID))},_createContentMarkup:function(e,t,n){var r="",i=t.dangerouslySetInnerHTML;if(null!=i)null!=i.__html&&(r=i.__html);else{var a=V[typeof t.children]?t.children:null,o=null!=a?null:t.children;if(null!=a)r=I(a);else if(null!=o){var s=this.mountChildren(o,e,n);r=s.join("")}}return Z[this._tag]&&"\n"===r.charAt(0)?"\n"+r:r},_createInitialChildren:function(e,t,n,r){var i=t.dangerouslySetInnerHTML;if(null!=i)null!=i.__html&&_.queueHTML(r,i.__html);else{var a=V[typeof t.children]?t.children:null,o=null!=a?null:t.children;if(null!=a)""!==a&&_.queueText(r,a);else if(null!=o)for(var s=this.mountChildren(o,e,n),c=0;c1)for(var n=1;n0&&r.length<20?n+" (keys: "+r.join(", ")+")":n}function a(e,t){var n=s.get(e);if(!n){return null}return n}var o=n(35),s=(n(17),n(112)),c=(n(62),n(56)),l=(n(12),n(8),{isMounted:function(e){var t=s.get(e);return!!t&&!!t._renderedComponent},enqueueCallback:function(e,t,n){l.validateCallback(t,n);var i=a(e);return i?(i._pendingCallbacks?i._pendingCallbacks.push(t):i._pendingCallbacks=[t],void r(i)):null},enqueueCallbackInternal:function(e,t){e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],r(e)},enqueueForceUpdate:function(e){var t=a(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,r(t))},enqueueReplaceState:function(e,t,n){var i=a(e,"replaceState");i&&(i._pendingStateQueue=[t],i._pendingReplaceState=!0,void 0!==n&&null!==n&&(l.validateCallback(n,"replaceState"),i._pendingCallbacks?i._pendingCallbacks.push(n):i._pendingCallbacks=[n]),r(i))},enqueueSetState:function(e,t){var n=a(e,"setState");if(n){var i=n._pendingStateQueue||(n._pendingStateQueue=[]);i.push(t),r(n)}},enqueueElementInternal:function(e,t,n){e._pendingElement=t,e._context=n,r(e)},validateCallback:function(e,t){e&&"function"!=typeof e?o("122",t,i(e)):void 0}});e.exports=l},function(e,t,n){"use strict";var r=(n(4),n(9)),i=(n(8),r);e.exports=i},function(e,t,n){"use strict";var r=n(4),i=n(77),a=n(34),o=function(e){this._currentElement=null,this._hostNode=null,this._hostParent=null,this._hostContainerInfo=null,this._domID=0};r(o.prototype,{mountComponent:function(e,t,n,r){var o=n._idCounter++;this._domID=o,this._hostParent=t,this._hostContainerInfo=n;var s=" react-empty: "+this._domID+" ";if(e.useCreateElement){var c=n._ownerDocument,l=c.createComment(s);return a.precacheNode(this,l),i(l)}return e.renderToStaticMarkup?"":""},receiveComponent:function(){},getHostNode:function(){return a.getNodeFromInstance(this)},unmountComponent:function(){a.uncacheNode(this)}}),e.exports=o},function(e,t,n){"use strict";function r(e,t){"_hostNode"in e?void 0:c("33"),"_hostNode"in t?void 0:c("33");for(var n=0,r=e;r;r=r._hostParent)n++;for(var i=0,a=t;a;a=a._hostParent)i++;for(;n-i>0;)e=e._hostParent,n--;for(;i-n>0;)t=t._hostParent,i--;for(var o=n;o--;){if(e===t)return e;e=e._hostParent,t=t._hostParent}return null}function i(e,t){"_hostNode"in e?void 0:c("35"),"_hostNode"in t?void 0:c("35");for(;t;){if(t===e)return!0;t=t._hostParent}return!1}function a(e){return"_hostNode"in e?void 0:c("36"),e._hostParent}function o(e,t,n){for(var r=[];e;)r.push(e),e=e._hostParent;var i;for(i=r.length;i-- >0;)t(r[i],"captured",n);for(i=0;i0;)n(c[l],"captured",a)}var c=n(35);n(12);e.exports={isAncestor:i,getLowestCommonAncestor:r,getParentInstance:a,traverseTwoPhase:o,traverseEnterLeave:s}},function(e,t,n){"use strict";var r=n(35),i=n(4),a=n(76),o=n(77),s=n(34),c=n(82),l=(n(12),n(132),function(e){this._currentElement=e,this._stringText=""+e,this._hostNode=null,this._hostParent=null,this._domID=0,this._mountIndex=0,this._closingComment=null,this._commentNodes=null});i(l.prototype,{mountComponent:function(e,t,n,r){var i=n._idCounter++,a=" react-text: "+i+" ",l=" /react-text ";if(this._domID=i,this._hostParent=t,e.useCreateElement){var u=n._ownerDocument,h=u.createComment(a),p=u.createComment(l),d=o(u.createDocumentFragment());return o.queueChild(d,o(h)),this._stringText&&o.queueChild(d,o(u.createTextNode(this._stringText))),o.queueChild(d,o(p)),s.precacheNode(this,h),this._closingComment=p,d}var f=c(this._stringText);return e.renderToStaticMarkup?f:""+f+""},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var r=this.getHostNode();a.replaceDelimitedText(r[0],r[1],n)}}},getHostNode:function(){var e=this._commentNodes;if(e)return e;if(!this._closingComment)for(var t=s.getNodeFromInstance(this),n=t.nextSibling;;){if(null==n?r("67",this._domID):void 0,8===n.nodeType&&" /react-text "===n.nodeValue){this._closingComment=n;break}n=n.nextSibling}return e=[this._hostNode,this._closingComment],this._commentNodes=e,e},unmountComponent:function(){this._closingComment=null,this._commentNodes=null,s.uncacheNode(this)}}),e.exports=l},function(e,t,n){"use strict";function r(){this.reinitializeTransaction()}var i=n(4),a=n(56),o=n(63),s=n(9),c={initialize:s,close:function(){p.isBatchingUpdates=!1}},l={initialize:s,close:a.flushBatchedUpdates.bind(a)},u=[l,c];i(r.prototype,o,{getTransactionWrappers:function(){return u}});var h=new r,p={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,i,a){var o=p.isBatchingUpdates;return p.isBatchingUpdates=!0,o?e(t,n,r,i,a):h.perform(e,null,t,n,r,i,a)}};e.exports=p},function(e,t,n){"use strict";function r(e){for(;e._hostParent;)e=e._hostParent;var t=h.getNodeFromInstance(e),n=t.parentNode;return h.getClosestInstanceFromNode(n)}function i(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function a(e){var t=d(e.nativeEvent),n=h.getClosestInstanceFromNode(t),i=n;do e.ancestors.push(i),i=i&&r(i);while(i);for(var a=0;at.end?(n=t.end,r=t.start):(n=t.start,r=t.end),i.moveToElementText(e),i.moveStart("character",n),i.setEndPoint("EndToStart",i),i.moveEnd("character",r-n),i.select()}function s(e,t){if(window.getSelection){var n=window.getSelection(),r=e[u()].length,i=Math.min(t.start,r),a=void 0===t.end?i:Math.min(t.end,r);if(!n.extend&&i>a){var o=a;a=i,i=o}var s=l(e,i),c=l(e,a);if(s&&c){var h=document.createRange();h.setStart(s.node,s.offset),n.removeAllRanges(),i>a?(n.addRange(h),n.extend(c.node,c.offset)):(h.setEnd(c.node,c.offset),n.addRange(h))}}}var c=n(48),l=n(144),u=n(51),h=c.canUseDOM&&"selection"in document&&!("getSelection"in window),p={getOffsets:h?i:a,setOffsets:h?o:s};e.exports=p},function(e,t){"use strict";function n(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function r(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function i(e,t){for(var i=n(e),a=0,o=0;i;){if(3===i.nodeType){if(o=a+i.textContent.length,a<=t&&o>=t)return{node:i,offset:t-a};a=o}i=n(r(i))}}e.exports=i},function(e,t,n){"use strict";function r(e,t){return!(!e||!t)&&(e===t||!i(e)&&(i(t)?r(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}var i=n(146);e.exports=r},function(e,t,n){"use strict";function r(e){return i(e)&&3==e.nodeType}var i=n(147);e.exports=r},function(e,t){"use strict";function n(e){var t=e?e.ownerDocument||e:document,n=t.defaultView||window;return!(!e||!("function"==typeof n.Node?e instanceof n.Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}e.exports=n},function(e,t){"use strict";function n(e){if(e=e||("undefined"!=typeof document?document:void 0),"undefined"==typeof e)return null;try{return e.activeElement||e.body}catch(t){return e.body}}e.exports=n},function(e,t){"use strict";var n={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},r={accentHeight:"accent-height",accumulate:0,additive:0,alignmentBaseline:"alignment-baseline",allowReorder:"allowReorder",alphabetic:0,amplitude:0,arabicForm:"arabic-form",ascent:0,attributeName:"attributeName",attributeType:"attributeType",autoReverse:"autoReverse",azimuth:0,baseFrequency:"baseFrequency",baseProfile:"baseProfile",baselineShift:"baseline-shift",bbox:0,begin:0,bias:0,by:0,calcMode:"calcMode",capHeight:"cap-height",clip:0,clipPath:"clip-path",clipRule:"clip-rule", clipPathUnits:"clipPathUnits",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",contentScriptType:"contentScriptType",contentStyleType:"contentStyleType",cursor:0,cx:0,cy:0,d:0,decelerate:0,descent:0,diffuseConstant:"diffuseConstant",direction:0,display:0,divisor:0,dominantBaseline:"dominant-baseline",dur:0,dx:0,dy:0,edgeMode:"edgeMode",elevation:0,enableBackground:"enable-background",end:0,exponent:0,externalResourcesRequired:"externalResourcesRequired",fill:0,fillOpacity:"fill-opacity",fillRule:"fill-rule",filter:0,filterRes:"filterRes",filterUnits:"filterUnits",floodColor:"flood-color",floodOpacity:"flood-opacity",focusable:0,fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",glyphRef:"glyphRef",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",hanging:0,horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",ideographic:0,imageRendering:"image-rendering",in:0,in2:0,intercept:0,k:0,k1:0,k2:0,k3:0,k4:0,kernelMatrix:"kernelMatrix",kernelUnitLength:"kernelUnitLength",kerning:0,keyPoints:"keyPoints",keySplines:"keySplines",keyTimes:"keyTimes",lengthAdjust:"lengthAdjust",letterSpacing:"letter-spacing",lightingColor:"lighting-color",limitingConeAngle:"limitingConeAngle",local:0,markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",markerHeight:"markerHeight",markerUnits:"markerUnits",markerWidth:"markerWidth",mask:0,maskContentUnits:"maskContentUnits",maskUnits:"maskUnits",mathematical:0,mode:0,numOctaves:"numOctaves",offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pathLength:"pathLength",patternContentUnits:"patternContentUnits",patternTransform:"patternTransform",patternUnits:"patternUnits",pointerEvents:"pointer-events",points:0,pointsAtX:"pointsAtX",pointsAtY:"pointsAtY",pointsAtZ:"pointsAtZ",preserveAlpha:"preserveAlpha",preserveAspectRatio:"preserveAspectRatio",primitiveUnits:"primitiveUnits",r:0,radius:0,refX:"refX",refY:"refY",renderingIntent:"rendering-intent",repeatCount:"repeatCount",repeatDur:"repeatDur",requiredExtensions:"requiredExtensions",requiredFeatures:"requiredFeatures",restart:0,result:0,rotate:0,rx:0,ry:0,scale:0,seed:0,shapeRendering:"shape-rendering",slope:0,spacing:0,specularConstant:"specularConstant",specularExponent:"specularExponent",speed:0,spreadMethod:"spreadMethod",startOffset:"startOffset",stdDeviation:"stdDeviation",stemh:0,stemv:0,stitchTiles:"stitchTiles",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",string:0,stroke:0,strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",surfaceScale:"surfaceScale",systemLanguage:"systemLanguage",tableValues:"tableValues",targetX:"targetX",targetY:"targetY",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",textLength:"textLength",to:0,transform:0,u1:0,u2:0,underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicode:0,unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",values:0,vectorEffect:"vector-effect",version:0,vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",viewBox:"viewBox",viewTarget:"viewTarget",visibility:0,widths:0,wordSpacing:"word-spacing",writingMode:"writing-mode",x:0,xHeight:"x-height",x1:0,x2:0,xChannelSelector:"xChannelSelector",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlns:0,xmlnsXlink:"xmlns:xlink",xmlLang:"xml:lang",xmlSpace:"xml:space",y:0,y1:0,y2:0,yChannelSelector:"yChannelSelector",z:0,zoomAndPan:"zoomAndPan"},i={Properties:{},DOMAttributeNamespaces:{xlinkActuate:n.xlink,xlinkArcrole:n.xlink,xlinkHref:n.xlink,xlinkRole:n.xlink,xlinkShow:n.xlink,xlinkTitle:n.xlink,xlinkType:n.xlink,xmlBase:n.xml,xmlLang:n.xml,xmlSpace:n.xml},DOMAttributeNames:{}};Object.keys(r).forEach(function(e){i.Properties[e]=0,r[e]&&(i.DOMAttributeNames[e]=r[e])}),e.exports=i},function(e,t,n){"use strict";function r(e){if("selectionStart"in e&&c.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function i(e,t){if(y||null==m||m!==u())return null;var n=r(m);if(!g||!p(g,n)){g=n;var i=l.getPooled(f.select,v,e,t);return i.type="select",i.target=m,a.accumulateTwoPhaseDispatches(i),i}return null}var a=n(41),o=n(48),s=n(34),c=n(142),l=n(53),u=n(148),h=n(67),p=n(118),d=o.canUseDOM&&"documentMode"in document&&document.documentMode<=11,f={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:["topBlur","topContextMenu","topFocus","topKeyDown","topKeyUp","topMouseDown","topMouseUp","topSelectionChange"]}},m=null,v=null,g=null,y=!1,b=!1,_={eventTypes:f,extractEvents:function(e,t,n,r){if(!b)return null;var a=t?s.getNodeFromInstance(t):window;switch(e){case"topFocus":(h(a)||"true"===a.contentEditable)&&(m=a,v=t,g=null);break;case"topBlur":m=null,v=null,g=null;break;case"topMouseDown":y=!0;break;case"topContextMenu":case"topMouseUp":return y=!1,i(n,r);case"topSelectionChange":if(d)break;case"topKeyDown":case"topKeyUp":return i(n,r)}return null},didPutListener:function(e,t,n){"onSelect"===t&&(b=!0)}};e.exports=_},function(e,t,n){"use strict";function r(e){return"."+e._rootNodeID}function i(e){return"button"===e||"input"===e||"select"===e||"textarea"===e}var a=n(35),o=n(138),s=n(41),c=n(34),l=n(152),u=n(153),h=n(53),p=n(154),d=n(155),f=n(70),m=n(158),v=n(159),g=n(160),y=n(71),b=n(161),_=n(9),w=n(156),x=(n(12),{}),M={};["abort","animationEnd","animationIteration","animationStart","blur","canPlay","canPlayThrough","click","contextMenu","copy","cut","doubleClick","drag","dragEnd","dragEnter","dragExit","dragLeave","dragOver","dragStart","drop","durationChange","emptied","encrypted","ended","error","focus","input","invalid","keyDown","keyPress","keyUp","load","loadedData","loadedMetadata","loadStart","mouseDown","mouseMove","mouseOut","mouseOver","mouseUp","paste","pause","play","playing","progress","rateChange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeUpdate","touchCancel","touchEnd","touchMove","touchStart","transitionEnd","volumeChange","waiting","wheel"].forEach(function(e){var t=e[0].toUpperCase()+e.slice(1),n="on"+t,r="top"+t,i={phasedRegistrationNames:{bubbled:n,captured:n+"Capture"},dependencies:[r]};x[e]=i,M[r]=i});var E={},S={eventTypes:x,extractEvents:function(e,t,n,r){var i=M[e];if(!i)return null;var o;switch(e){case"topAbort":case"topCanPlay":case"topCanPlayThrough":case"topDurationChange":case"topEmptied":case"topEncrypted":case"topEnded":case"topError":case"topInput":case"topInvalid":case"topLoad":case"topLoadedData":case"topLoadedMetadata":case"topLoadStart":case"topPause":case"topPlay":case"topPlaying":case"topProgress":case"topRateChange":case"topReset":case"topSeeked":case"topSeeking":case"topStalled":case"topSubmit":case"topSuspend":case"topTimeUpdate":case"topVolumeChange":case"topWaiting":o=h;break;case"topKeyPress":if(0===w(n))return null;case"topKeyDown":case"topKeyUp":o=d;break;case"topBlur":case"topFocus":o=p;break;case"topClick":if(2===n.button)return null;case"topDoubleClick":case"topMouseDown":case"topMouseMove":case"topMouseUp":case"topMouseOut":case"topMouseOver":case"topContextMenu":o=f;break;case"topDrag":case"topDragEnd":case"topDragEnter":case"topDragExit":case"topDragLeave":case"topDragOver":case"topDragStart":case"topDrop":o=m;break;case"topTouchCancel":case"topTouchEnd":case"topTouchMove":case"topTouchStart":o=v;break;case"topAnimationEnd":case"topAnimationIteration":case"topAnimationStart":o=l;break;case"topTransitionEnd":o=g;break;case"topScroll":o=y;break;case"topWheel":o=b;break;case"topCopy":case"topCut":case"topPaste":o=u}o?void 0:a("86",e);var c=o.getPooled(i,t,n,r);return s.accumulateTwoPhaseDispatches(c),c},didPutListener:function(e,t,n){if("onClick"===t&&!i(e._tag)){var a=r(e),s=c.getNodeFromInstance(e);E[a]||(E[a]=o.listen(s,"click",_))}},willDeleteListener:function(e,t){if("onClick"===t&&!i(e._tag)){var n=r(e);E[n].remove(),delete E[n]}}};e.exports=S},function(e,t,n){"use strict";function r(e,t,n,r){return i.call(this,e,t,n,r)}var i=n(53),a={animationName:null,elapsedTime:null,pseudoElement:null};i.augmentClass(r,a),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return i.call(this,e,t,n,r)}var i=n(53),a={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};i.augmentClass(r,a),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return i.call(this,e,t,n,r)}var i=n(71),a={relatedTarget:null};i.augmentClass(r,a),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return i.call(this,e,t,n,r)}var i=n(71),a=n(156),o=n(157),s=n(73),c={key:o,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:s,charCode:function(e){return"keypress"===e.type?a(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?a(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};i.augmentClass(r,c),e.exports=r},function(e,t){"use strict";function n(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}e.exports=n},function(e,t,n){"use strict";function r(e){if(e.key){var t=a[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=i(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?o[e.keyCode]||"Unidentified":""}var i=n(156),a={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},o={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return i.call(this,e,t,n,r)}var i=n(70),a={dataTransfer:null};i.augmentClass(r,a),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return i.call(this,e,t,n,r)}var i=n(71),a=n(73),o={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:a};i.augmentClass(r,o),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return i.call(this,e,t,n,r)}var i=n(53),a={propertyName:null,elapsedTime:null,pseudoElement:null};i.augmentClass(r,a),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return i.call(this,e,t,n,r)}var i=n(70),a={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};i.augmentClass(r,a),e.exports=r},function(e,t,n){"use strict";function r(e,t){for(var n=Math.min(e.length,t.length),r=0;r.":"function"==typeof t?" Instead of passing a class like Foo, pass React.createElement(Foo) or .":null!=t&&void 0!==t.props?" This may be caused by unintentionally loading two independent copies of React.":"");var o,s=v.createElement(U,{child:t});if(e){var c=x.get(e);o=c._processChildContext(c._context)}else o=P;var u=p(n);if(u){var h=u._currentElement,f=h.props.child;if(A(f,t)){var m=u._renderedComponent.getPublicInstance(),g=r&&function(){r.call(m)};return F._updateRootComponent(u,s,o,n,g),m}F.unmountComponentAtNode(n)}var y=i(n),b=y&&!!a(y),_=l(n),w=b&&!u&&!_,M=F._renderNewRootComponent(s,n,w,o)._renderedComponent.getPublicInstance();return r&&r.call(M),M},render:function(e,t,n){return F._renderSubtreeIntoContainer(null,e,t,n)},unmountComponentAtNode:function(e){u(e)?void 0:d("40");var t=p(e);if(!t){l(e),1===e.nodeType&&e.hasAttribute(O);return!1}return delete N[t._instance.rootID],T.batchedUpdates(c,t,e,!1),!0},_mountImageIntoNode:function(e,t,n,a,o){if(u(t)?void 0:d("41"),a){var s=i(t);if(M.canReuseMarkup(e,s))return void y.precacheNode(n,s);var c=s.getAttribute(M.CHECKSUM_ATTR_NAME);s.removeAttribute(M.CHECKSUM_ATTR_NAME);var l=s.outerHTML;s.setAttribute(M.CHECKSUM_ATTR_NAME,c);var h=e,p=r(h,l),m=" (client) "+h.substring(p-20,p+20)+"\n (server) "+l.substring(p-20,p+20);t.nodeType===R?d("42",m):void 0}if(t.nodeType===R?d("43"):void 0,o.useCreateElement){for(;t.lastChild;)t.removeChild(t.lastChild);f.insertTreeBefore(t,e,null)}else L(t,e),y.precacheNode(n,t.firstChild)}};e.exports=F},function(e,t,n){"use strict";function r(e,t){var n={_topLevelWrapper:e,_idCounter:1,_ownerDocument:t?t.nodeType===i?t:t.ownerDocument:null,_node:t,_tag:t?t.nodeName.toLowerCase():null,_namespaceURI:t?t.namespaceURI:null};return n}var i=(n(132),9);e.exports=r},function(e,t){"use strict";var n={useCreateElement:!0,useFiber:!1};e.exports=n},function(e,t,n){"use strict";var r=n(166),i=/\/?>/,a=/^<\!\-\-/,o={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return a.test(e)?e:e.replace(i," "+o.CHECKSUM_ATTR_NAME+'="'+t+'"$&')},canReuseMarkup:function(e,t){var n=t.getAttribute(o.CHECKSUM_ATTR_NAME);n=n&&parseInt(n,10);var i=r(e);return i===n}};e.exports=o},function(e,t){"use strict";function n(e){for(var t=1,n=0,i=0,a=e.length,o=a&-4;in?r.splice(n,r.length-n,i):r.push(i),t({action:"PUSH",location:i,index:n,entries:r})}})},replace:function(e,r){var i="REPLACE",a=p(e,r,n(),_.location);v.confirmTransitionTo(a,i,o,function(e){e&&(_.entries[_.index]=a,t({action:i,location:a}))})},go:r,goBack:function(){r(-1)},goForward:function(){r(1)},canGo:function(e){var t=_.index+e;return 0<=t&&t<_.entries.length},block:function(e){return void 0===e&&(e=!1),v.setPrompt(e)},listen:function(e){return v.appendListener(e)}};return _}Object.defineProperty(t,"__esModule",{value:!0});var L=r(n(180)),A=r(n(182));n(184);var k=r(n(185)),O=!("undefined"==typeof window||!window.document||!window.document.createElement),D="popstate",R="hashchange",I="hashchange",N={hashbang:{encodePath:function(e){return"!"===e.charAt(0)?e:"!/"+o(e)},decodePath:function(e){return"!"===e.charAt(0)?e.substr(1):e}},noslash:{encodePath:o,decodePath:a},slash:{encodePath:a,decodePath:a}};t.createBrowserHistory=w,t.createHashHistory=T,t.createMemoryHistory=C,t.createLocation=p,t.locationsAreEqual=d,t.parsePath=u,t.createPath=h},function(e,t,n){"use strict";e.exports=n(181)},function(e,t){"use strict";function n(e){return"/"===e.charAt(0)}function r(e,t){for(var n=t,r=n+1,i=e.length;r>4,r=(15&o)<<4|s>>2,i=(3&s)<<6|c,l+=String.fromCharCode(n),64!=s&&(l+=String.fromCharCode(r)),64!=c&&(l+=String.fromCharCode(i));return l=t._utf8_decode(l)},_utf8_decode:function(e){for(var t="",n=0,r=0,i=0,a=0;n191&&r<224?(i=e.charCodeAt(n+1),t+=String.fromCharCode((31&r)<<6|63&i),n+=2):(i=e.charCodeAt(n+1),a=e.charCodeAt(n+2),t+=String.fromCharCode((15&r)<<12|(63&i)<<6|63&a),n+=3);return t}};return t.decode(e)}},{key:"setClipState",value:function(){this.refs.editor.closeClipState()}},{key:"closeOp",value:function(){this.refs.editor.closeOp()}},{key:"lockOp",value:function(e){this.refs.editor.lockOp(e)}},{key:"openProperList",value:function(e){this.refs.editor.openPropertyList(e)}},{key:"getProperListState",value:function(){return this.refs.editor.state.fold}},{key:"addDimSelListenter",value:function(){var e=this,t=0,n=0,r=0,i=e.MdlStore.viewer,a=document.getElementById("dim-list");a.addEventListener("mousedown",function(t){e.pageX=t.pageX,e.pageY=t.pageY},!0);var o=function t(n){var r=n.target;"p"==r.tagName.toLowerCase()&&r.parentNode&&r.parentNode.getAttribute("data-path")||(i.tglCtrlEnable(!0),e.refs.menu.show(!1),e.refs.sider.clearHiObj(),i.clearHiObj(),i.tglEventEnable(!0),document.removeEventListener("mouseup",t,!1),document.removeEventListener("touchend",t,!1))},s=function(t){if(e.dimSel&&e.pageX==t.pageX&&e.pageY==t.pageY){var n=[];if(n="p"==t.target.tagName.toLowerCase()?[].concat(t.target.parentNode.getAttribute("data-path").split(",")):[].concat(t.target.getAttribute("data-path").split(",")),2==t.button||0==t.button){i.signals.siderPick.dispatch(n,null,"label");var r=document.getElementById("compTree");e.refs.sider.clearHiObj();var a=r.querySelector('li[data-path="'+n.join(",")+'"]');a.style.backgroundColor="#42A5DB",t.preventDefault()}2==t.button&&(e.refs.menu.show(t,n),i.tglEventEnable(!1),e.refs.editor.lockCxt()),setTimeout(function(){document.addEventListener("mouseup",o,!1)},1)}};a.addEventListener("mouseup",s),a.addEventListener("touchstart",function(e){t=0,r=setTimeout(function(){t=1},300);var i=e.touches[0];n=i.clientY}),a.addEventListener("touchmove",function(e){clearTimeout(r),r=0;var t=e.touches[0];Math.abs(t.clientY-n)<10&&e.preventDefault()}),a.addEventListener("touchend",function(n){clearTimeout(r);var a=[];if(a="p"==n.target.tagName.toLowerCase()?[].concat(n.target.parentNode.getAttribute("data-path").split(",")):[].concat(n.target.getAttribute("data-path").split(",")),0!=r&&1==t&&(e.refs.menu.show(n,a),i.tglEventEnable(!1)),a.length){i.signals.siderPick.dispatch(a);var s=document.getElementById("compTree");e.refs.sider.clearHiObj();var c=s.querySelector('li[data-path="'+a.join(",")+'"]');c.style.backgroundColor="#42A5DB",setTimeout(function(){document.addEventListener("touchend",o,!1)},1)}return n.preventDefault(),!1})}},{key:"setDimSel",value:function(e){this.dimSel=e}},{key:"clearHiObj",value:function(){_.opt.tree&&this.refs.sider.clearHiObj()}},{key:"render",value:function(){var tt=this;var e=this.MdlStore.viewer;return this.state.show?u.default.createElement("div",{className:"ZwViewerStudio"},u.default.createElement("div",{className:"sli-tgl-box",onClick:this.tglSlider},u.default.createElement("div",{className:"sliderTgl"})),u.default.createElement("div",{className:"slider hide box-shadow",ref:"slider"},u.default.createElement("div",{className:"desc-list",ref:"mdltree"},u.default.createElement(m.default,{mdlStore:this.MdlStore,setClipState:this.setClipState,closeOp:this.closeOp,lockOp:this.lockOp,openProperList:this.openProperList,getProperListState:this.getProperListState,ref:"sider"}))),u.default.createElement(b.default,{viewer:e,ref:"menu"}),u.default.createElement(g.default,{className:"editor",viewer:e,ref:"editor",setDimSel:this.setDimSel,clearHiObj:this.clearHiObj})):u.default.createElement("div",{className:"pwd-container"},u.default.createElement("input",{className:"pwd",autoFocus:!0,type:"password",ref:"key"}),u.default.createElement("input",{className:"btn",type:"button",value:"OK",onClick:function(){tt.checkPwd();}}))}}]),t}(l.Component))||s;t.default=w},function(e,t,n){!function(t,r){e.exports=r(n(201),n(2),n(32))}(this,function(e,t,n){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.reactiveComponent=t.PropTypes=t.propTypes=t.inject=t.Provider=t.useStaticRendering=t.trackComponents=t.componentByNodeRegistery=t.renderReporter=t.observer=void 0;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=arguments,s=n(1);Object.defineProperty(t,"observer",{enumerable:!0,get:function(){return s.observer}}),Object.defineProperty(t,"renderReporter",{enumerable:!0,get:function(){return s.renderReporter}}),Object.defineProperty(t,"componentByNodeRegistery",{enumerable:!0,get:function(){return s.componentByNodeRegistery}}),Object.defineProperty(t,"trackComponents",{enumerable:!0,get:function(){return s.trackComponents}}),Object.defineProperty(t,"useStaticRendering",{enumerable:!0,get:function(){return s.useStaticRendering}});var c=n(9);Object.defineProperty(t,"Provider",{enumerable:!0,get:function(){return i(c).default}});var l=n(6);Object.defineProperty(t,"inject",{enumerable:!0,get:function(){return i(l).default}});var u=n(2),h=i(u),p=n(3),d=i(p),f=n(10),m=r(f),v=void 0;if(v="mobx-react",!h.default)throw new Error(v+" requires the MobX package");if(!d.default)throw new Error(v+" requires React to be available");t.propTypes=m,t.PropTypes=m,t.default=e.exports;t.reactiveComponent=function(){return console.warn("[mobx-react] `reactiveComponent` has been renamed to `observer` and will be removed in 1.1."),observer.apply(null,o)};"object"===("undefined"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__?"undefined":a(__MOBX_DEVTOOLS_GLOBAL_HOOK__))&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobxReact(e.exports,h.default)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){return v.default?v.default.findDOMNode(e):null}function a(e){var t=i(e);t&&M&&M.set(t,e),E.emit({event:"render",renderTime:e.__$mobRenderEnd-e.__$mobRenderStart,totalTime:Date.now()-e.__$mobRenderStart,component:e,node:t})}function o(){if("undefined"==typeof WeakMap)throw new Error("[mobx-react] tracking components is not supported in this browser.");w||(w=!0)}function s(e){x=e}function c(e,t){var n=e[t],r=S[t];n?e[t]=function(){n.apply(this,arguments),r.apply(this,arguments)}:e[t]=r}function l(e,t){if("string"==typeof e)throw new Error("Store names should be provided as array");if(Array.isArray(e))return t?_.default.apply(null,e)(l(t)):function(t){return l(e,t)};var n=e;if(void 0!==n.isInjector&&n.isInjector&&console.warn("Mobx Observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"),!("function"!=typeof n||n.prototype&&n.prototype.render||n.isReactClass||f.default.Component.isPrototypeOf(n)))return l(f.default.createClass({displayName:n.displayName||n.name,propTypes:n.propTypes,contextTypes:n.contextTypes,getDefaultProps:function(){return n.defaultProps},render:function(){return n.call(this,this.props,this.context)}}));if(!n)throw new Error("Please pass a valid component to 'observer'");var r=n.prototype||n;return["componentWillMount","componentWillUnmount","componentDidMount","componentDidUpdate"].forEach(function(e){c(r,e)}),r.shouldComponentUpdate||(r.shouldComponentUpdate=S.shouldComponentUpdate),n.isMobXReactObserver=!0,n}Object.defineProperty(t,"__esModule",{value:!0}),t.renderReporter=t.componentByNodeRegistery=void 0;var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};t.trackComponents=o,t.useStaticRendering=s,t.observer=l;var h=n(2),p=r(h),d=n(3),f=r(d),m=n(4),v=r(m),g=n(5),y=r(g),b=n(6),_=r(b),w=!1,x=!1,M=t.componentByNodeRegistery="undefined"!=typeof WeakMap?new WeakMap:void 0,E=t.renderReporter=new y.default,S={componentWillMount:function(){var e=this;if(x!==!0){var t=this.displayName||this.name||this.constructor&&(this.constructor.displayName||this.constructor.name)||"",n=this._reactInternalInstance&&this._reactInternalInstance._rootNodeID,r=this.render.bind(this),i=null,a=!1,o=function(){return i=new p.default.Reaction(t+"#"+n+".render()",function(){if(!a&&(a=!0,"function"==typeof e.componentWillReact&&e.componentWillReact(),e.__$mobxIsUnmounted!==!0)){var t=!0;try{f.default.Component.prototype.forceUpdate.call(e),t=!1}finally{t&&i.dispose()}}}),s.$mobx=i,e.render=s,s()},s=function(){a=!1;var t=void 0;return i.track(function(){w&&(e.__$mobRenderStart=Date.now()),t=p.default.extras.allowStateChanges(!1,r),w&&(e.__$mobRenderEnd=Date.now())}),t};this.render=o}},componentWillUnmount:function(){if(x!==!0&&(this.render.$mobx&&this.render.$mobx.dispose(),this.__$mobxIsUnmounted=!0,w)){var e=i(this);e&&M&&M.delete(e),E.emit({event:"destroy",component:this,node:e})}},componentDidMount:function(){w&&a(this)},componentDidUpdate:function(){w&&a(this)},shouldComponentUpdate:function(e,t){if(x&&console.warn("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side."),this.state!==t)return!0;var n=Object.keys(this.props);if(n.length!==Object.keys(e).length)return!0;for(var r=void 0,i=n.length-1;r=n[i];i--){var a=e[r];if(a!==this.props[r])return!0;if(a&&"object"===("undefined"==typeof a?"undefined":u(a))&&!p.default.isObservable(a))return!0}return!1}}},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n1)for(var r=1;r6?s-6:0),l=6;l>",o=o||r,null==n[r]){if(t){var s=null===n[r]?"null":"undefined";return new Error("The "+a+" `"+o+"` is marked as required in `"+i+"`, but its value is `"+s+"`.")}return null}return e.apply(void 0,[n,r,i,a,o].concat(c))})}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function i(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function a(e){var t="undefined"==typeof e?"undefined":l(e);return Array.isArray(e)?"array":e instanceof RegExp?"object":i(t,e)?"symbol":t}function o(e){var t=a(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function s(e,t){return r(function(n,r,i,s,c){return(0,u.untracked)(function(){if(e&&a(n[r])===t.toLowerCase())return null;var s=void 0;switch(t){case"Array":s=u.isObservableArray;break;case"Object":s=u.isObservableObject;break;case"Map":s=u.isObservableMap;break;default:throw new Error("Unexpected mobxType: "+t)}var l=n[r];if(!s(l)){var h=o(l),p=e?" or javascript `"+t.toLowerCase()+"`":"";return new Error("Invalid prop `"+c+"` of type `"+h+"` supplied to `"+i+"`, expected `mobx.Observable"+t+"`"+p+".")}return null})})}function c(e,t){return r(function(n,r,i,a,o){for(var c=arguments.length,l=Array(c>5?c-5:0),h=5;h",e):2===arguments.length&&"function"==typeof t?F(e,t):1===arguments.length&&"string"==typeof e?i(e):i(t).apply(null,arguments)}function i(e){return function(t,n,r){return r&&"function"==typeof r.value?(r.value=F(e,r.value),r.enumerable=!1,r.configurable=!0,r):Ft(e).apply(this,arguments)}}function a(e,t,n){var r="string"==typeof e?e:e.name||"",i="function"==typeof e?e:t,a="function"==typeof e?t:n;return bt("function"==typeof i,"`runInAction` expects a function"),bt(0===i.length,"`runInAction` expects a function without arguments"),bt("string"==typeof r&&r.length>0,"actions should have valid names, got: '"+r+"'"),j(r,i,a,void 0)}function o(e){return"function"==typeof e&&e.isMobxAction===!0}function s(e,t,n){function r(){a(c)}var i,a,s;"string"==typeof e?(i=e,a=t,s=n):"function"==typeof e&&(i=e.name||"Autorun@"+yt(),a=e,s=t),Ge(a,"autorun methods cannot have modifiers"),bt("function"==typeof a,"autorun expects a function"),bt(o(a)===!1,"Warning: attempted to pass an action to autorun. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action."),s&&(a=a.bind(s));var c=new $t(i,function(){this.track(r)});return c.schedule(),c.getDisposer()}function c(e,t,n,r){var i,a,o,c;"string"==typeof e?(i=e,a=t,o=n,c=r):"function"==typeof e&&(i="When@"+yt(),a=e,o=t,c=n);var l=s(i,function(e){if(a.call(c)){e.dispose();var t=ee();o.call(c),te(t)}});return l}function l(e,t,n){return _t("`autorunUntil` is deprecated, please use `when`."),c.apply(null,arguments)}function u(e,t,n,r){function i(){s(h)}var a,s,c,l;"string"==typeof e?(a=e,s=t,c=n,l=r):"function"==typeof e&&(a=e.name||"AutorunAsync@"+yt(),s=e,c=t,l=n),bt(o(s)===!1,"Warning: attempted to pass an action to autorunAsync. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action."),void 0===c&&(c=1),l&&(s=s.bind(l));var u=!1,h=new $t(a,function(){u||(u=!0,setTimeout(function(){u=!1,h.isDisposed||h.track(i)},c))});return h.schedule(),h.getDisposer()}function h(e,t,n,i,a,o){function s(){if(!w.isDisposed){var e=!1;w.track(function(){var t=v(w);e=Pt(g,_,t),_=t}),y&&h&&u(_,w),y||e!==!0||u(_,w),y&&(y=!1)}}var c,l,u,h,p,d;"string"==typeof e?(c=e,l=t,u=n,h=i,p=a,d=o):(c=e.name||t.name||"Reaction@"+yt(),l=e,u=t,h=n,p=i,d=a),void 0===h&&(h=!1),void 0===p&&(p=0);var f=je(l,rn.Reference),m=f[0],v=f[1],g=m===rn.Structure;d&&(v=v.bind(d),u=r(c,u.bind(d)));var y=!0,b=!1,_=void 0,w=new $t(c,function(){p<1?s():b||(b=!0,setTimeout(function(){b=!1,s()},p))});return w.schedule(),w.getDisposer()}function p(e,t,n,r){return("function"==typeof e||Ve(e))&&arguments.length<3?"function"==typeof t?d(e,t,void 0):d(e,void 0,t):jt.apply(null,arguments)}function d(e,t,n){var r=je(e,rn.Recursive),i=r[0],a=r[1];return new Yt(a,n,i===rn.Structure,a.name,t)}function f(e,t){bt("function"==typeof e&&1===e.length,"createTransformer expects a function that accepts one argument");var n={},r=Kt.resetId,i=function(r){function i(t,n){r.call(this,function(){return e(n)},null,!1,"Transformer-"+e.name+"-"+t,void 0),this.sourceIdentifier=t,this.sourceObject=n}return Ut(i,r),i.prototype.onBecomeUnobserved=function(){var e=this.value;r.prototype.onBecomeUnobserved.call(this),delete n[this.sourceIdentifier],t&&t(e,this.sourceObject)},i}(Yt);return function(e){r!==Kt.resetId&&(n={},r=Kt.resetId);var t=m(e),a=n[t];return a?a.get():(a=n[t]=new i(t,e),a.get())}}function m(e){if(null===e||"object"!=typeof e)throw new Error("[mobx] transform expected some kind of object, got: "+e);var t=e.$transformId;return void 0===t&&(t=yt(),At(e,"$transformId",t)),t}function v(e,t){return Y()||console.warn("[mobx.expr] 'expr' should only be used inside other reactive functions."),p(e,t).get()}function g(e){for(var t=[],n=1;n=2,"extendObservable expected 2 or more arguments"),bt("object"==typeof e,"extendObservable expects an object as first argument"),bt(!fn(e),"extendObservable should not be used on maps, use map.merge instead"),t.forEach(function(t){bt("object"==typeof t,"all arguments of extendObservable should be objects"),bt(!P(t),"extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540"),y(e,t,rn.Recursive,null)}),e}function y(e,t,n,r){var i=Qe(e,r,n);for(var a in t)if(Ct(t,a)){if(e===t&&!Ot(e,a))continue;var o=Object.getOwnPropertyDescriptor(t,a);tt(i,a,o)}return e}function b(e,t){return _(ct(e,t))}function _(e){var t={name:e.name};return e.observing&&e.observing.length>0&&(t.dependencies=xt(e.observing).map(_)),t}function w(e,t){return x(ct(e,t))}function x(e){var t={name:e.name};return ae(e)&&(t.observers=oe(e).map(x)),t}function M(e,t,n){return"function"==typeof n?S(e,t,n):E(e,t)}function E(e,t){return St(e)&&!st(e)?(_t("Passing plain objects to intercept / observe is deprecated and will be removed in 3.0"),lt(L(e)).intercept(t)):lt(e).intercept(t)}function S(e,t,n){return St(e)&&!st(e)?(_t("Passing plain objects to intercept / observe is deprecated and will be removed in 3.0"),g(e,{property:e[t]}),S(e,t,n)):lt(e,t).intercept(n)}function T(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(st(e)===!1)return!1;var n=ct(e,t);return Xt(n)}return Xt(e)}function P(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(Ke(e)||fn(e))throw new Error("[mobx.isObservable] isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");if(st(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return st(e)||!!e.$mobx||qt(e)||tn(e)||Xt(e)}function C(e,t,n){return bt(arguments.length>=2&&arguments.length<=3,"Illegal decorator config",t),Dt(e,t),bt(!n||!n.get,"@observable can not be used on getters, use @computed instead"),zt.apply(null,arguments)}function L(e,t){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return C.apply(null,arguments);if(bt(arguments.length<3,"observable expects zero, one or two arguments"),P(e))return e;var n=je(e,rn.Recursive),r=n[0],i=n[1],a=r===rn.Reference?Vt.Reference:A(i);switch(a){case Vt.Array:case Vt.PlainObject:return He(i,r);case Vt.Reference:case Vt.ComplexObject:return new wn(i,r);case Vt.ComplexFunction:throw new Error("[mobx.observable] To be able to make a function reactive it should not have arguments. If you need an observable reference to a function, use `observable(asReference(f))`");case Vt.ViewFunction:return _t("Use `computed(expr)` instead of `observable(expr)`"),p(e,t)}bt(!1,"Illegal State")}function A(e){return null===e||void 0===e?Vt.Reference:"function"==typeof e?e.length?Vt.ComplexFunction:Vt.ViewFunction:Bt(e)?Vt.Array:"object"==typeof e?St(e)?Vt.PlainObject:Vt.ComplexObject:Vt.Reference}function k(e,t,n,r){return"function"==typeof n?D(e,t,n,r):O(e,t,n)}function O(e,t,n){return St(e)&&!st(e)?(_t("Passing plain objects to intercept / observe is deprecated and will be removed in 3.0"),lt(L(e)).observe(t,n)):lt(e).observe(t,n)}function D(e,t,n,r){return St(e)&&!st(e)?(_t("Passing plain objects to intercept / observe is deprecated and will be removed in 3.0"),g(e,{property:e[t]}),D(e,t,n,r)):lt(e,t).observe(n,r)}function R(e,t,n){function r(r){return t&&n.push([e,r]),r}if(void 0===t&&(t=!0),void 0===n&&(n=null),P(e)){if(t&&null===n&&(n=[]),t&&null!==e&&"object"==typeof e)for(var i=0,a=n.length;i0,"actions should have valid names, got: '"+e+"'");var n=function(){return j(e,t,this,arguments)};return n.isMobxAction=!0,n}function j(e,t,n,r){bt(!Xt(Kt.trackingDerivation),"Computed values or transformers should not invoke actions or trigger other side effects");var i,a=be();if(a){i=Date.now();var o=r&&r.length||0,s=new Array(o);if(o>0)for(var c=0;c0}function oe(e){return e.observers}function se(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function ce(e,t){if(1===e.observers.length)e.observers.length=0,le(e);else{var n=e.observers,r=e.observersIndexes,i=n.pop();if(i!==t){var a=r[t.__mapid]||0;a?r[i.__mapid]=a:delete r[i.__mapid],n[a]=i}delete r[t.__mapid]}}function le(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,Kt.pendingUnobservations.push(e))}function ue(){Kt.inBatch++}function he(){if(1===Kt.inBatch){for(var e=Kt.pendingUnobservations,t=0;t0||en(ge)}function ge(){Kt.isRunningReactions=!0;for(var e=Kt.pendingReactions,t=0;e.length>0;){if(++t===Qt)throw ie(),new Error("Reaction doesn't converge to a stable state after "+Qt+" iterations. Probably there is a cycle in the reactive function: "+e[0]);for(var n=e.splice(0),r=0,i=n.length;r0}function Le(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),wt(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function Ae(e,t){var n=ee();try{for(var r=e.interceptors,i=0,a=r.length;i0}function Oe(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),wt(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function De(e,t){var n=ee(),r=e.changeListeners;if(r){r=r.slice();for(var i=0,a=r.length;i=this.length,value:tt?" (... and "+(e.length-t)+"more)":"")}function Et(e){return null!==e&&"object"==typeof e}function St(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Tt(){for(var e=arguments[0],t=1,n=arguments.length;t=0;r--)if(!It(e[r],t[r]))return!1;return!0}if("object"==typeof e&&"object"==typeof t){if(null===e||null===t)return!1;if(Rt(e).length!==Rt(t).length)return!1;for(var i in e){if(!(i in t))return!1;if(!It(e[i],t[i]))return!1}return!0}return e===t}function Nt(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return Et(e)&&e[n]===!0}}function Bt(e){return Array.isArray(e)||Ke(e)}var Ut=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)};re(),t.extras={allowStateChanges:H, getAtom:ct,getDebugName:ut,getDependencyTree:b,getObserverTree:w,isComputingDerivation:Y,isSpyEnabled:be,resetGlobalState:ie,spyReport:_e,spyReportEnd:xe,spyReportStart:we,trackTransitions:Ee,setReactionScheduler:ye},t._={getAdministration:lt,resetGlobalState:ie},"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx(e.exports);var Ft=ht(function(e,t,n,i,a){var o=i&&1===i.length?i[0]:n.name||t||"",s=r(o,n);At(e,t,s)},function(e){return this[e]},function(){bt(!1,"It is not allowed to assign new values to @action fields")},!1,!0);t.action=r,t.runInAction=a,t.isAction=o,t.autorun=s,t.when=c,t.autorunUntil=l,t.autorunAsync=u,t.reaction=h;var jt=ht(function(e,t,n,r,i){bt("undefined"!=typeof i,"@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'. It looks like it was used on a property.");var a=i.get,o=i.set;bt("function"==typeof a,"@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'");var s=!1;r&&1===r.length&&r[0].asStructure===!0&&(s=!0);var c=Qe(e,void 0,rn.Recursive);nt(c,t,s?Be(a):a,!1,o)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){this.$mobx.values[e].set(t)},!1,!0);t.computed=p,t.createTransformer=f,t.expr=v,t.extendObservable=g,t.intercept=M,t.isComputed=T,t.isObservable=P;var zt=ht(function(e,t,n){var r=G(!0);"function"==typeof n&&(n=Ne(n));var i=Qe(e,void 0,rn.Recursive);nt(i,t,n,!0,void 0),W(r)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){at(this,e,t)},!0,!1);t.observable=L;var Vt;!function(e){e[e.Reference=0]="Reference",e[e.PlainObject=1]="PlainObject",e[e.ComplexObject=2]="ComplexObject",e[e.Array=3]="Array",e[e.ViewFunction=4]="ViewFunction",e[e.ComplexFunction=5]="ComplexFunction"}(Vt||(Vt={})),t.observe=k,t.toJS=R,t.toJSlegacy=I,t.toJSON=N,t.whyRun=U,t.useStrict=z,t.isStrictModeEnabled=V;var Ht=function(){function e(e){void 0===e&&(e="Atom@"+yt()),this.name=e,this.isPendingUnobservation=!0,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=Wt.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.reportObserved=function(){pe(this)},e.prototype.reportChanged=function(){Te("propagatingAtomChange",null,!1),de(this),Pe(!1)},e.prototype.toString=function(){return this.name},e}();t.BaseAtom=Ht;var Gt=function(e){function t(t,n,r){void 0===t&&(t="Atom@"+yt()),void 0===n&&(n=Pn),void 0===r&&(r=Pn),e.call(this,t),this.name=t,this.onBecomeObservedHandler=n,this.onBecomeUnobservedHandler=r,this.isPendingUnobservation=!1,this.isBeingTracked=!1}return Ut(t,e),t.prototype.reportObserved=function(){return ue(),e.prototype.reportObserved.call(this),this.isBeingTracked||(this.isBeingTracked=!0,this.onBecomeObservedHandler()),he(),!!Kt.trackingDerivation},t.prototype.onBecomeUnobserved=function(){this.isBeingTracked=!1,this.onBecomeUnobservedHandler()},t}(Ht);t.Atom=Gt;var Wt,qt=Nt("Atom",Ht),Yt=function(){function e(e,t,n,r,i){this.derivation=e,this.scope=t,this.compareStructural=n,this.dependenciesState=Wt.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isPendingUnobservation=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=Wt.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+yt(),this.value=void 0,this.isComputing=!1,this.isRunningSetter=!1,this.name=r||"ComputedValue@"+yt(),i&&(this.setter=F(r+"-setter",i))}return e.prototype.peek=function(){this.isComputing=!0;var e=G(!1),t=this.derivation.call(this.scope);return W(e),this.isComputing=!1,t},e.prototype.peekUntracked=function(){var e=!0;try{var t=this.peek();return e=!1,t}finally{e&&J(this)}},e.prototype.onBecomeStale=function(){me(this)},e.prototype.onBecomeUnobserved=function(){bt(this.dependenciesState!==Wt.NOT_TRACKING,"INTERNAL ERROR only onBecomeUnobserved shouldn't be called twice in a row"),$(this),this.value=void 0},e.prototype.get=function(){bt(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),ue(),1===Kt.inBatch?q(this)&&(this.value=this.peekUntracked()):(pe(this),q(this)&&this.trackAndCompute()&&fe(this));var e=this.value;return he(),e},e.prototype.recoverFromError=function(){this.isComputing=!1},e.prototype.set=function(e){if(this.setter){bt(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else bt(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},e.prototype.trackAndCompute=function(){be()&&_e({object:this,type:"compute",fn:this.derivation,target:this.scope});var e=this.value,t=this.value=Z(this,this.peek);return Pt(this.compareStructural,t,e)},e.prototype.observe=function(e,t){var n=this,r=!0,i=void 0;return s(function(){var a=n.get();if(!r||t){var o=ee();e(a,i),te(o)}r=!1,i=a})},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.whyRun=function(){var e=Boolean(Kt.trackingDerivation),t=xt(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),n=xt(oe(this).map(function(e){return e.name}));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(e?"[active] the value of this computation is needed by a reaction":this.isComputing?"[get] The value of this computed was requested outside a reaction":"[idle] not running at the moment")+"\n"+(this.dependenciesState===Wt.NOT_TRACKING?" * This computation is suspended (not in use by any reaction) and won't run automatically.\n\tDidn't expect this computation to be suspended at this point?\n\t 1. Make sure this computation is used by a reaction (reaction, autorun, observer).\n\t 2. Check whether you are using this computation synchronously (in the same stack as they reaction that needs it).\n":" * This computation will re-run if any of the following observables changes:\n "+Mt(t)+"\n "+(this.isComputing&&e?" (... or any observable accessed during the remainder of the current run)":"")+"\n\tMissing items in this list?\n\t 1. Check whether all used values are properly marked as observable (use isObservable to verify)\n\t 2. Make sure you didn't dereference values too early. MobX observes props, not primitives. E.g: use 'person.name' instead of 'name' in your computation.\n * If the outcome of this computation changes, the following observers will be re-run:\n "+Mt(n)+"\n")},e}(),Xt=Nt("ComputedValue",Yt);!function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(Wt||(Wt={})),t.IDerivationState=Wt,t.untracked=Q;var Zt=["mobxGuid","resetId","spyListeners","strictMode","runId"],Jt=function(){function e(){this.version=4,this.trackingDerivation=null,this.runId=0,this.mobxGuid=0,this.inTransaction=0,this.isRunningReactions=!1,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.allowStateChanges=!0,this.strictMode=!1,this.resetId=0,this.spyListeners=[]}return e}(),Kt=function(){var e=new Jt;if(n.__mobservableTrackingStack||n.__mobservableViewStack)throw new Error("[mobx] An incompatible version of mobservable is already loaded.");if(n.__mobxGlobal&&n.__mobxGlobal.version!==e.version)throw new Error("[mobx] An incompatible version of mobx is already loaded.");return n.__mobxGlobal?n.__mobxGlobal:n.__mobxGlobal=e}(),$t=function(){function e(e,t){void 0===e&&(e="Reaction@"+yt()),this.name=e,this.onInvalidate=t,this.observing=[],this.newObserving=[],this.dependenciesState=Wt.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+yt(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,Kt.pendingReactions.push(this),ue(),ve(),he())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){this.isDisposed||(this._isScheduled=!1,q(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&be()&&_e({object:this,type:"scheduled-reaction"})))},e.prototype.track=function(e){ue();var t,n=be();n&&(t=Date.now(),we({object:this,type:"reaction",fn:e})),this._isRunning=!0,Z(this,e),this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&$(this),n&&xe({time:Date.now()-t}),he()},e.prototype.recoverFromError=function(){this._isRunning=!1,this._isTrackPending=!1},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(ue(),$(this),he()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.whyRun=function(){var e=xt(this._isRunning?this.newObserving:this.observing).map(function(e){return e.name});return"\nWhyRun? reaction '"+this.name+"':\n * Status: ["+(this.isDisposed?"stopped":this._isRunning?"running":this.isScheduled()?"scheduled":"idle")+"]\n * This reaction will re-run if any of the following observables changes:\n "+Mt(e)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\tMissing items in this list?\n\t 1. Check whether all used values are properly marked as observable (use isObservable to verify)\n\t 2. Make sure you didn't dereference values too early. MobX observes props, not primitives. E.g: use 'person.name' instead of 'name' in your computation.\n"},e}();t.Reaction=$t;var Qt=100,en=function(e){return e()},tn=Nt("Reaction",$t),nn={spyReportEnd:!0};t.spy=Me,t.transaction=Se;var rn;!function(e){e[e.Recursive=0]="Recursive",e[e.Reference=1]="Reference",e[e.Structure=2]="Structure",e[e.Flat=3]="Flat"}(rn||(rn={})),t.ValueMode=rn,t.asReference=Ne,Ne.mobxModifier=rn.Reference,t.asStructure=Be,Be.mobxModifier=rn.Structure,t.asFlat=Ue,Ue.mobxModifier=rn.Flat,t.asMap=Fe;var an=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),on=0,sn=function(){function e(){}return e}();sn.prototype=[];var cn=function(){function e(e,t,n,r){this.mode=t,this.array=n,this.owned=r,this.lastKnownLength=0,this.interceptors=null,this.changeListeners=null,this.atom=new Ht(e||"ObservableArray@"+yt())}return e.prototype.makeReactiveArrayItem=function(e){return Ge(e,"Array values cannot have modifiers"),this.mode===rn.Flat||this.mode===rn.Reference?e:He(e,this.mode,this.atom.name+"[..]")},e.prototype.intercept=function(e){return Le(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),Oe(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;e!==t&&(e>t?this.spliceWithArray(t,0,new Array(e-t)):this.spliceWithArray(e,t-e))},e.prototype.updateArrayLength=function(e,t){if(e!==this.lastKnownLength)throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed. Did you use peek() to change it?");this.lastKnownLength+=t,t>0&&e+t+1>on&&Xe(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){X();var r=this.values.length;if(void 0===e?e=0:e>r?e=r:e<0&&(e=Math.max(0,r+e)),t=1===arguments.length?r-e:void 0===t||null===t?0:Math.max(0,Math.min(t,r-e)),void 0===n&&(n=[]),Ce(this)){var i=Ae(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!i)return Sn;t=i.removedCount,n=i.added}n=n.map(this.makeReactiveArrayItem,this);var a=n.length-t;this.updateArrayLength(r,a);var o=(s=this.values).splice.apply(s,[e,t].concat(n));return 0===t&&0===n.length||this.notifyArraySplice(e,n,o),o;var s},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&be(),i=ke(this),a=i||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&we(a),this.atom.reportChanged(),i&&De(this,a),r&&xe()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&be(),i=ke(this),a=i||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&we(a),this.atom.reportChanged(),i&&De(this,a),r&&xe()},e}(),ln=function(e){function t(t,n,r,i){void 0===i&&(i=!1),e.call(this);var a=new cn(r,n,this,i);kt(this,"$mobx",a),t&&t.length?(a.updateArrayLength(0,t.length),a.values=t.map(a.makeReactiveArrayItem,a),a.notifyArraySplice(0,a.values.slice(),Sn)):a.values=[],an&&Object.defineProperty(a.array,"0",un)}return Ut(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var r,i=this.$mobx.values;r=e0&&void 0!==arguments[0]&&arguments[0];this.isUpdTree=e;var t=[],n=[],r=[],i=[];e||(this.viewer.getCompNameTree(t),this.viewer.getDimNameTree(n),this.viewer.getAnimNameTree(r),this.viewer.getExpViewNameTree(i),this.compsData=t,this.dimsData=this.settleDimData(n),this.animsData=r,this.expviewsData=i);var a=[];this.viewer.getToolsDimTree(a),this.toolsDimsData=this.settleDimData(a),this.isUpdTree=!0}},{key:"getType",value:function(e){switch(e){case 2:case 3:case 4:case 6:case 7:case 8:case 10:case 11:case 12:case 14:case 15:case 16:case 18:case 19:case 20:case 22:case 23:case 24:case 26:case 91:return 0;case 49:case 50:case 51:case 53:case 54:case 55:case 57:case 58:case 59:case 61:case 62:case 63:case 75:return 1;case 45:case 46:case 47:return 2;case 32:case 33:case 34:case 36:case 37:case 38:case 40:case 41:case 42:case 44:return 3;case 92:return 4;case 65:return 5;default:return 6}}},{key:"settleDimData",value:function(e){var t=[];t[0]=e[0];var n=[].concat(t[0].children),r=n.length;t[0].children=[];for(var i=0;i0&&(re=!0),e.indexOf("iPhone")>0&&(ne=!0),e.indexOf("Mobile")>0&&(te=!1)}function g(e){e>se&&(se=e)}function y(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;r0){c._prePickObj=n.pickList[0];var e=c._pickPnt.clone().sub(c._prePickObj.point);c._pntPicker&&e.length()<1e-4?(c._pickPnt=c._prePickObj.point.clone(),c._viewer.signals.prePntPick.dispatch(c._pickPnt,1)):c._prePickObj=null}else c._prePickObj=null;c._viewer.signals.prePick.dispatch(c._prePickObj)},10);else if(c._movePart||c._restorePart){var o=new he,s=new pe,u=a(o,s,e);if(u==-1)return;s.pickList.length?c._viewer.signals.pick.dispatch(s.pickList,!0,!0):c._viewer.signals.pick.dispatch(s.pickList)}c._filter==J&&c._viewer.signals.dimPinPick.dispatch(n)}}function r(e){if((0==e.button||2==e.button||"touchstart"==e.type||"touchend"==e.type)&&!("touchstart"==e.type&&e.changedTouches.length>1||"touchend"==e.type&&e.moved))if(c._filter==(X|Z)){c._pntPicker&&te&&c._pickPnt&&c._viewer.signals.pntPick.dispatch(c._pickPnt);var t=te?e.pageX:e.changedTouches[0].pageX,n=te?e.pageY:e.changedTouches[0].pageY,r=new pe;if(r.mouse.x=t/c._viewer._renderer.domElement.offsetWidth*2-1,r.mouse.y=2*-(n/c._viewer._renderer.domElement.offsetHeight)+1,r.camera=c._viewer._actCamera, r.raycaster.setFromCamera(r.mouse,r.camera),r.filter=c._filter,r.pickTarg=c._pickTarg,r.halfWidth=c._viewer._renderer.domElement.offsetWidth/2,r.halfHeight=c._viewer._renderer.domElement.offsetHeight/2,c._dbMgr.pick(r),c._pickObjList=[],te){if(r.pickList.length>0){var o=r.pickList[0].point.clone().sub(c._pickPnt);o.length()<1e-4&&c._pickObjList.push(r.pickList[0])}}else if(r.pickList.length>0){var s=i(e),u=c._viewer._scene.children;l=u.slice("DimGroup"==u[3].type?4:3);var h=s.raycaster.intersectObjects(l,!0);h.length&&(c._pickPnt=h[0].point.clone());var p=r.pickList[0].point.clone().sub(c._pickPnt);p.length()<1e-4&&(c._viewer.signals.pntPick.dispatch(c._pickPnt),c._pickObjList.push(r.pickList[0]))}c._viewer.signals.pick.dispatch(c._pickObjList),c._filter==J&&c._viewer.signals.dimPinPick.dispatch(r)}else if(c._filter==q){var d=new he,f=new pe,m=a(d,f,e);if(m==-1)return;if(e.moved||(f.pickList.length?c._viewer.signals.pick.dispatch(f.pickList,!0,!0):c._viewer.signals.pick.dispatch(f.pickList)),2==e.button){if(f.pickList.length&&"label"==f.pickList[0].type)return;c._viewer.signals.oncontextmenu.dispatch(e,f.pickList.length)}else e.button==j.MOUSE.LEFT?c._restorePart?c._viewer.signals.restore.dispatch(f.pickList):c._viewer.signals.oncontextmenu.dispatch(!1):"touchstart"==e.type?(f.pickList.length&&(c._movePart?c._viewer.signals.touchDrag.dispatch(f.pickList):c._restorePart&&c._viewer.signals.restore.dispatch(f.pickList)),c._viewer.signals.oncontextmenu.dispatch(!1)):"touchend"==e.type&&(e.longTouch?c._viewer.signals.oncontextmenu.dispatch(e,f.pickList.length):c._viewer.signals.oncontextmenu.dispatch(!1))}else if(c._filter==J){var v=i(e);c._viewer.signals.dimPinPick.dispatch(v),c._viewer.signals.clearTmpObj.dispatch()}}function i(e){var t=new pe,n=te?e.pageX:e.changedTouches[0].pageX,r=te?e.pageY:e.changedTouches[0].pageY;return t.mouse.x=n/c._viewer._renderer.domElement.offsetWidth*2-1,t.mouse.y=2*-(r/c._viewer._renderer.domElement.offsetHeight)+1,t.camera=c._viewer._actCamera,t.raycaster.setFromCamera(t.mouse,t.camera),t.filter=c._filter,t.pickTarg=c._pickTarg,t.pickNum=1,t.halfWidth=c._viewer._renderer.domElement.offsetWidth/2,t.halfHeight=c._viewer._renderer.domElement.offsetHeight/2,t}function a(e,t,n){c._pickObjList=[];var r=c._viewer._scene.children;if(l=r.slice(3),n instanceof MouseEvent)t.mouse.x=n.pageX/c._viewer._renderer.domElement.offsetWidth*2-1,t.mouse.y=2*-(n.pageY/c._viewer._renderer.domElement.offsetHeight)+1;else{var i=n.changedTouches[0];t.mouse.x=i.clientX/c._viewer._renderer.domElement.offsetWidth*2-1,t.mouse.y=2*-(i.clientY/c._viewer._renderer.domElement.offsetHeight)+1}t.camera=c._viewer._actCamera,t.raycaster.setFromCamera(t.mouse,t.camera),t.filter=c._filter,t.pickTarg=c._pickTarg,t.pickNum=1,t.halfWidth=c._viewer._renderer.domElement.offsetWidth/2,t.halfHeight=c._viewer._renderer.domElement.offsetHeight/2;var a=t.raycaster.intersectObjects(l,!0);if(a.length){e.depth=a[0].distance,e.point=a[0].point;for(var o=a[0].object;!o.path;)if(o=o.parent,!o)return-1;return e.path=o.path.slice(),"label"!=o.name?(1!=e.path.length&&e.path.pop(),e.obj=o):e.type="label",t.pickList.push(e),o}}function o(e){if(e.button==j.MOUSE.LEFT){if(!c._movePart)return;var t=new he,n=new pe,r=a(t,n,e);"label"!=t.type&&(t.obj=r,n.pickList.length&&c._viewer.signals.drag.dispatch(n.pickList)),c._movePick=!1}else e.button==j.MOUSE.RIGHT&&(c._startZoomOrRotate=!0)}function s(e){e.button==j.MOUSE.LEFT?(c._movePick=!0,c._filter==J&&c._viewer.signals.clearTmpObj.dispatch()):e.button==j.MOUSE.RIGHT&&(c._startZoomOrRotate=!1)}var c=this;this._viewer=e,this._dbMgr=t,this._filter=W,this._pntPicker=!1,this._pickTarg=!1,this._prePickObj,this._pickObjList=[],this._pickPnt=null,this._startZoomOrRotate=!1,this._timeoutHandle;var l=[];this._movePart=!1,this._restorePart=!1,this._movePick=!0,te&&(this._viewer.signals.mouseMove.add(n),this._viewer.signals.mouseDown.add(o),this._viewer.signals.click.add(r)),this._viewer.signals.touchEnd.add(r),this._viewer.signals.mouseUp.add(s)}function C(){this.defines={PERSPECTIVE_CAMERA:1,KERNEL_SIZE:32},this.uniforms={tDiffuse:{value:null},tNormal:{value:null},tDepth:{value:null},tNoise:{value:null},kernel:{value:null},cameraNear:{value:null},cameraFar:{value:null},resolution:{value:new j.Vector2},cameraProjectionMatrix:{value:new j.Matrix4},cameraInverseProjectionMatrix:{value:new j.Matrix4},kernelRadius:{value:32},minDistance:{value:.001},maxDistance:{value:.3}},this.vertexShader=["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),this.fragmentShader=["uniform sampler2D tDiffuse;","uniform sampler2D tNormal;","uniform sampler2D tDepth;","uniform sampler2D tNoise;","uniform vec3 kernel[ KERNEL_SIZE ];","uniform vec2 resolution;","uniform float cameraNear;","uniform float cameraFar;","uniform mat4 cameraProjectionMatrix;","uniform mat4 cameraInverseProjectionMatrix;","uniform float kernelRadius;","uniform float minDistance;","uniform float maxDistance;","varying vec2 vUv;","#include ","float getDepth( const in vec2 screenPosition ) {","\treturn texture2D( tDepth, screenPosition ).x;","}","float getLinearDepth( const in vec2 screenPosition ) {","\t#if PERSPECTIVE_CAMERA == 1","\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;","\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );","\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );","\t#else","\t\treturn texture2D( depthSampler, coord ).x;","\t#endif","}","float getViewZ( const in float depth ) {","\t#if PERSPECTIVE_CAMERA == 1","\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );","\t#else","\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );","\t#endif","}","vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {","\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];","\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );","\tclipPosition *= clipW; // unprojection.","\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;","}","vec3 getViewNormal( const in vec2 screenPosition ) {","\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );","}","void main() {","\tfloat depth = getDepth( vUv );","\tfloat viewZ = getViewZ( depth );","\tvec3 viewPosition = getViewPosition( vUv, depth, viewZ );","\tvec3 viewNormal = getViewNormal( vUv );"," vec2 noiseScale = vec2( resolution.x / 4.0, resolution.y / 4.0 );","\tvec3 random = texture2D( tNoise, vUv * noiseScale ).xyz;","\tvec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) );","\tvec3 bitangent = cross( viewNormal, tangent );","\tmat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );"," float occlusion = 0.0;"," for ( int i = 0; i < KERNEL_SIZE; i ++ ) {","\t\tvec3 sampleVector = kernelMatrix * kernel[ i ];","\t\tvec3 samplePoint = viewPosition + ( sampleVector * kernelRadius );","\t\tvec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 );","\t\tsamplePointNDC /= samplePointNDC.w;","\t\tvec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5;","\t\tfloat realDepth = getLinearDepth( samplePointUv );","\t\tfloat sampleDepth = viewZToOrthographicDepth( samplePoint.z, cameraNear, cameraFar );","\t\tfloat delta = sampleDepth - realDepth;","\t\tif ( delta > minDistance && delta < maxDistance ) {","\t\t\tocclusion += 1.0;","\t\t}","\t}","\tocclusion = clamp( occlusion / float( KERNEL_SIZE ), 0.0, 1.0 );","\tgl_FragColor = vec4( vec3( 1.0 - occlusion ), 1.0 );","}"].join("\n")}function L(){this.defines={PERSPECTIVE_CAMERA:1},this.uniforms={tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},this.vertexShader=["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),this.fragmentShader=["uniform sampler2D tDepth;","uniform float cameraNear;","uniform float cameraFar;","varying vec2 vUv;","#include ","float getLinearDepth( const in vec2 screenPosition ) {","\t#if PERSPECTIVE_CAMERA == 1","\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;","\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );","\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );","\t#else","\t\treturn texture2D( depthSampler, coord ).x;","\t#endif","}","void main() {","\tfloat depth = getLinearDepth( vUv );","\tgl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 );","}"].join("\n")}function A(){this.uniforms={tDiffuse:{value:null},resolution:{value:new j.Vector2}},this.vertexShader=["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),this.fragmentShader=["uniform sampler2D tDiffuse;","uniform vec2 resolution;","varying vec2 vUv;","void main() {","\tvec2 texelSize = ( 1.0 / resolution );","\tfloat result = 0.0;","\tfor ( int i = - 2; i <= 2; i ++ ) {","\t\tfor ( int j = - 2; j <= 2; j ++ ) {","\t\t\tvec2 offset = ( vec2( float( i ), float( j ) ) ) * texelSize;","\t\t\tresult += texture2D( tDiffuse, vUv + offset ).r;","\t\t}","\t}","\tgl_FragColor = vec4( vec3( result / ( 5.0 * 5.0 ) ), 1.0 );","}"].join("\n")}function k(e,t,n,r){E.call(this),this.width=void 0!==n?n:512,this.height=void 0!==r?r:512,this.clear=!0,this.camera=t,this.scene=e,this.kernelRadius=8,this.kernelSize=32,this.kernel=[],this.noiseTexture=null,this.output=0,this.minDistance=.005,this.maxDistance=.1,this.generateSampleKernel(),this.generateRandomKernelRotations();var i=new j.DepthTexture;i.type=j.UnsignedShortType,i.minFilter=j.NearestFilter,i.maxFilter=j.NearestFilter,this.beautyRenderTarget=new j.WebGLRenderTarget(this.width,this.height,{minFilter:j.LinearFilter,magFilter:j.LinearFilter,format:j.RGBAFormat,depthTexture:i,depthBuffer:!0}),this.normalRenderTarget=new j.WebGLRenderTarget(this.width,this.height,{minFilter:j.NearestFilter,magFilter:j.NearestFilter,format:j.RGBAFormat}),this.ssaoRenderTarget=new j.WebGLRenderTarget(this.width,this.height,{minFilter:j.LinearFilter,magFilter:j.LinearFilter,format:j.RGBAFormat}),this.blurRenderTarget=this.ssaoRenderTarget.clone(),this.ZwSSAOShader=new C,void 0===this.ZwSSAOShader&&console.error("ZwSSAOPass: The pass relies on ZwSSAOShader."),this.ssaoMaterial=new j.ShaderMaterial({defines:Object.assign({},this.ZwSSAOShader.defines),uniforms:j.UniformsUtils.clone(this.ZwSSAOShader.uniforms),vertexShader:this.ZwSSAOShader.vertexShader,fragmentShader:this.ZwSSAOShader.fragmentShader,blending:j.NoBlending}),this.ssaoMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.ssaoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.ssaoMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.ssaoMaterial.uniforms.tNoise.value=this.noiseTexture,this.ssaoMaterial.uniforms.kernel.value=this.kernel,this.ssaoMaterial.uniforms.cameraNear.value=this.camera.near,this.ssaoMaterial.uniforms.cameraFar.value=this.camera.far,this.ssaoMaterial.uniforms.resolution.value.set(this.width,this.height),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.getInverse(this.camera.projectionMatrix),this.normalMaterial=new j.MeshNormalMaterial,this.normalMaterial.blending=j.NoBlending,this.ZwSSAOBlurShader=new A,this.blurMaterial=new j.ShaderMaterial({defines:Object.assign({},this.ZwSSAOBlurShader.defines),uniforms:j.UniformsUtils.clone(this.ZwSSAOBlurShader.uniforms),vertexShader:this.ZwSSAOBlurShader.vertexShader,fragmentShader:this.ZwSSAOBlurShader.fragmentShader}),this.blurMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.blurMaterial.uniforms.resolution.value.set(this.width,this.height),this.ZwSSAODepthShader=new L,this.depthRenderMaterial=new j.ShaderMaterial({defines:Object.assign({},this.ZwSSAODepthShader.defines),uniforms:j.UniformsUtils.clone(this.ZwSSAODepthShader.uniforms),vertexShader:this.ZwSSAODepthShader.vertexShader,fragmentShader:this.ZwSSAODepthShader.fragmentShader,blending:j.NoBlending}),this.depthRenderMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far;var a=new w;this.copyMaterial=new j.ShaderMaterial({uniforms:j.UniformsUtils.clone(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:j.DstColorFactor,blendDst:j.ZeroFactor,blendEquation:j.AddEquation,blendSrcAlpha:j.DstAlphaFactor,blendDstAlpha:j.ZeroFactor,blendEquationAlpha:j.AddEquation}),this.quadCamera=new j.OrthographicCamera(-1,1,1,-1,0,1),this.quadScene=new j.Scene,this.quad=new j.Mesh(new j.PlaneBufferGeometry(2,2),null),this.quadScene.add(this.quad),this.originalClearColor=new j.Color}function O(e,t,n){function r(e,t,n){for(var r=0;r1?n.normalize():n.z=Math.sqrt(1-r*r),this._viewer._userRotateCenter){var i=new j.Vector3;i=this._viewer.getRotateCenter(),_.copy(f.object.position).sub(i)}else _.copy(f.object.position).sub(f.target);var a=f.object.up.clone().setLength(n.y);return a.add(f.object.up.clone().cross(_).setLength(n.x)),a.add(_.setLength(n.z)),a},this.rotateCamera=function(){var e=Math.acos(w.dot(x)/w.length()/x.length());if(e){var t=(new j.Vector3).crossVectors(w,x).normalize(),n=new j.Quaternion;e*=f.rotateSpeed,n.setFromAxisAngle(t,-e),_.applyQuaternion(n),f.object.up.applyQuaternion(n),f._viewer._scene.children[1].position.copy(f.object.position),f._viewer._scene.children[2].position.copy(f.object.position),x.applyQuaternion(n),f.staticMoving?w.copy(x):(n.setFromAxisAngle(t,e*(f.dynamicDampingFactor-1)),w.applyQuaternion(n)),C=!0}},this.rotateCameraAxisAngle=function(e,t){if(e&&t){var n=new j.Quaternion;n.setFromAxisAngle(e,-t),_.copy(f.object.position).sub(f.target),_.applyQuaternion(n),f.object.up.applyQuaternion(n),f.object.position.addVectors(f.target,_),f.checkDistances(),f.object.lookAt(f.target)}},this.zoomCamera=function(){if(y===m.TOUCH_ZOOM){var e=S/T;if(S=T,1!=e&&this.resetStaticObjs(),Math.abs(e-1)<1e-6)return;f.object instanceof j.OrthographicCamera?(P*=e,f.object.left=P*f.left0+(1-P)*f.center0.x,f.object.right=P*f.right0+(1-P)*f.center0.x,f.object.top=P*f.top0+(1-P)*f.center0.y,f.object.bottom=P*f.bottom0+(1-P)*f.center0.y):f.object.fov*e<120?f.object.fov*=e:f.object.fov=120,f.object.updateProjectionMatrix(),f.object.updateMatrixWorld(),C=!0}else{var t=1+(E.y-M.y)*f.zoomSpeed;1!=t&&this.resetStaticObjs(),Math.abs(t-1)>1e-6&&t>0&&(f.object instanceof j.OrthographicCamera?(P*=t,f.object.left=P*f.left0+(1-P)*f.center0.x,f.object.right=P*f.right0+(1-P)*f.center0.x,f.object.top=P*f.top0+(1-P)*f.center0.y,f.object.bottom=P*f.bottom0+(1-P)*f.center0.y):(f.object.fov*t<120?f.object.fov*=t:f.object.fov=120,p(ae*f.object.fov/30)),f.object.updateProjectionMatrix(),f.object.updateMatrixWorld(),f.staticMoving?M.copy(E):M.y+=(E.y-M.y)*this.dynamicDampingFactor,C=!0)}},this.zoomCamera2=function(e){1!==e&&e>0&&(1!=e&&this.resetStaticObjs(),this.object instanceof j.OrthographicCamera?(P*=e,this.object.left=P*this.left0+(1-P)*this.center0.x,this.object.right=P*this.right0+(1-P)*this.center0.x,this.object.top=P*this.top0+(1-P)*this.center0.y,this.object.bottom=P*this.bottom0+(1-P)*this.center0.y):(_.multiplyScalar(e),f.object.fov*e<120?f.object.fov*=e:f.object.fov=120),this.object.updateProjectionMatrix(),f.object.updateMatrixWorld())},this.panCamera=function(){if(y===m.TOUCH_ZOOM_AND_PAN||y===m.TOUCH_PAN||y===m.PAN){var e=A.clone().sub(L);if(e.lengthSq()){var t=void 0,n=void 0,r=void 0;this.object instanceof j.OrthographicCamera?(t=(this.object.right-this.object.left)*e.x,n=(this.object.top-this.object.bottom)*e.y):(e.multiplyScalar(_.length()*Math.tan(this.object.fov/2*j.Math.DEG2RAD)*this.panSpeed),t=e.x,n=e.y),r=_.clone().cross(this.object.up).setLength(t),r.add(this.object.up.clone().setLength(n)),this.target.add(r),this.staticMoving?L.copy(A):L.add(e.subVectors(A,L).multiplyScalar(this.dynamicDampingFactor)),C=!0}}},this.checkDistances=function(){if(!f.noZoom||!f.noPan)if(f.object instanceof j.OrthographicCamera){f.object.right-f.object.left,f.object.top-f.object.bottom}else _.lengthSq()>f.maxDistance*f.maxDistance&&f.object.position.addVectors(f.target,_.setLength(f.maxDistance)),_.lengthSq()0)&&(f.dispatchEvent(k),g.copy(f.object.position));var e=C;C=!1,e&&f._viewer.render()},this.reset=function(){y=m.NONE,P=1,b=m.NONE,w=new j.Vector3,x=new j.Vector3,M=new j.Vector2,E=new j.Vector2,L=new j.Vector2,A=new j.Vector2,S=0,T=0,f.object instanceof j.OrthographicCamera&&(f.left0=f.object.left,f.right0=f.object.right,f.top0=f.object.top,f.bottom0=f.object.bottom),s()},this.resetStaticObjs=function(){var e=[];e=f._viewer._scene.children;var t=e.length,n=void 0;if(this.object instanceof j.OrthographicCamera)n=.0015*this.object.right;else{var i=f._viewer._actCamera.fov,a=f._viewer._actCamera.far,o=a*Math.tan(.5*i*j.Math.DEG2RAD);n=7e-4*o}r(e,t,n),e=f._viewer._pickScene.children,t=e.length,r(e,t,n)},this.setTarget=function(e){this.target.copy(e)},this.buildConnect=function(){this._viewer.signals.mouseDown.add(a),this._viewer.signals.mouseWheel.add(l),this._viewer.signals.windowResize.add(s),this._viewer.signals.touchStart.add(u),this._viewer.signals.touchMove.add(h),this._viewer.signals.touchEnd.add(d)},this.dispose=function(){this._viewer.signals.mouseDown.remove(a),this._viewer.signals.mouseWheel.remove(l),this._viewer.signals.windowResize.remove(s),this._viewer.signals.touchStart.remove(u),this._viewer.signals.touchMove.remove(h),this._viewer.signals.touchEnd.remove(d),document.removeEventListener("mousemove",o,!1),document.removeEventListener("mouseup",c,!1)},this.disTouchEvent=function(){this._viewer.signals.touchStart.remove(u),this._viewer.signals.touchMove.remove(h),this._viewer.signals.touchEnd.remove(d)},this.buildTouchEvent=function(){this._viewer.signals.touchStart.add(u),this._viewer.signals.touchMove.add(h),this._viewer.signals.touchEnd.add(d)},s()}function D(e,t){function n(e){0!=f.enabled&&(f.start_position.set(e.clientX,e.clientY),f._viewer.signals.mouseDown.dispatch(e))}function r(e){0!=f.enabled&&(e.button>0||e.buttons,f.end_position.set(e.clientX,e.clientY),f._viewer.signals.mouseMove.dispatch(e))}function i(e){f.end_position.set(e.clientX,e.clientY),f._viewer.signals.mouseUp.dispatch(e),2==e.button&&f.end_position.equals(f.start_position)&&f._viewer.signals.click.dispatch(e)}function a(e){0!=f.enabled&&f._viewer.signals.mouseWheel.dispatch(e)}function o(e){0!=f.enabled&&(1==e.touches.length?(_=!1,y=new Date):_=!0,f._movePart||f._restorePart?f._viewer.signals.touchEnd.dispatch(e):f._viewer.signals.touchStart.dispatch(e))}function s(e){0!=f.enabled&&(b=!0,e.touches.length>1&&(_=!0),f._viewer.signals.touchMove.dispatch(e))}function c(e){if(0!=f.enabled){if(new Date-g<500)return f._viewer.signals.dblclick.dispatch(e),void(g=0);if(g=new Date,0==b&&new Date-y>700&&!_)return e.longTouch=!0,y=0,void f._viewer.signals.touchEnd.dispatch(e);e.moved=b,f._viewer.signals.touchEnd.dispatch(e),b=!1}}function l(e){"CANVAS"==e.target.tagName.toUpperCase()&&0!=f.enabled&&(f.start_position.set(e.clientX,e.clientY),f.end_position.set(e.clientX,e.clientY),f._viewer.signals.click.dispatch(e))}function u(){0!=f.enabled&&(f.start_position.set(event.clientX,event.clientY),f.end_position.set(event.clientX,event.clientY),f._viewer.signals.dblclick.dispatch(event))}function h(){f._viewer.signals.contextmenu.dispatch(event)}function p(e){f._viewer.signals.windowResize.dispatch(e)}function d(e){f._viewer.signals.keyDown.dispatch(e)}var f=this;this._container=void 0!=t?t:document,this._viewer=e,this._container.addEventListener("mousedown",n,!1),te&&(this._container.addEventListener("mouseup",i,!1),this._container.addEventListener("mousemove",r,!1)),this._container.addEventListener("click",l,!1),this._container.addEventListener("dblclick",u,!1),this._container.addEventListener("mousewheel",a,!1);var m=navigator.userAgent,v=m.indexOf("Firefox")>-1;v&&this._container.addEventListener("DOMMouseScroll",a,!1),this._container.addEventListener("touchstart",o,!1),this._container.addEventListener("touchend",c,!1),this._container.addEventListener("touchmove",s,!1),window.addEventListener("keydown",d,!1),ne||window.addEventListener("resize",p,!1),window.addEventListener("contextmenu",h,!1),this.enabled=!0,this.start_position=new j.Vector2,this.end_position=new j.Vector2;var g,y,b=!1,_=!1;this._movePart=!1,this._restorePart=!1,this.disConnectKeyEvent=function(){window.removeEventListener("keydown",d,!1)},this.reConnectKeyEvent=function(){window.addEventListener("keydown",d,!1)}}function R(e,t){function n(){var e=b(r._container),t=_(event,e),n=new j.Vector2;n.x=event.clientX/window.innerWidth*2-1,n.y=2*-(event.clientY/window.innerHeight)+1;var i,a,o=new j.Vector3;return o.copy(t),o=o.unproject(r._camera),i=new j.Raycaster(r._camera.position,o.sub(r._camera.position).normalize()),a=i.intersectObjects(r._intersectsFace)}var r=this,i=new j.Vector3;this._container=e,this._scene,this._renderer=null,this._mouse=new j.Vector2,this._INTERSECTED=void 0,this._viewer=t,this._gridMeshes=[],this._intersectsFace=[],this._cubeBuffer=[];var a=r._container.getBoundingClientRect();this._width=a.width,this._height=a.height,this._accentFaceMat={};var o=500;this._camera=new j.PerspectiveCamera(45,1,1,2e3),this._camera.position.z=o;var s=new j.Vector3(0,0,0);this._camera.lookAt(s);var c=["top,back","right,back","back,left","bottom,back","top,front","front,right","left,front","bottom,front","top,left","top,right","bottom,right","bottom,left"],l=["back,top,right","back,bottom,right","back,top,left","back,bottom,left","front,top,right","front,bottom,right","front,top,left","front,bottom,left"],u=function(){r._scene=new j.Scene,r._scene.add(new j.AmbientLight(15790320)),r._scene.add(r._camera);var t=new j.DirectionalLight(16777215);t.position.set(0,0,1).normalize(),r._scene.add(t),h(),r._renderer=new j.WebGLRenderer({alpha:!0}),r._renderer.antialias=!0,r._renderer.setSize(r._width,r._height),r._renderer.setClearColor(0,0);var n=window.devicePixelRatio<1.5?1.5:window.devicePixelRatio;r._renderer.setPixelRatio(n),e.appendChild(r._renderer.domElement),v()};this.setSize=function(t,n){if(r._width=t,r._height=n,e.children.length>1)for(var i=1;i3&&void 0!==arguments[3]?arguments[3]:0,o=40,s=60,c=o+s,l=new j.Geometry,u=new j.Vector3(0,0,0),h=new j.Vector3(s,-s,c),p=new j.Vector3(s,s,c),d=new j.Vector3(-s,s,c),f=new j.Vector3(-s,-s,c);l.vertices.push(u),l.vertices.push(h),l.vertices.push(p),l.vertices.push(d),l.vertices.push(f),l.faces.push(new j.Face3(1,2,3)),l.faces.push(new j.Face3(1,3,4)),r(l),l.computeFaceNormals(),l.computeVertexNormals(),l.applyMatrix((new j.Matrix4).makeRotationX(e)),l.applyMatrix((new j.Matrix4).makeRotationY(t));var v=m(n,a);i=new j.MeshBasicMaterial({map:v,side:j.DoubleSide});var g=new j.Mesh(l,i);return g.name=n,g.isFace=1, g},d=function(e,t,n){var r,i,a=40,o=60,s=a+o,c=new j.Geometry,l=new j.Vector3(o,s,s),u=new j.Vector3(-o,s,s),h=new j.Vector3(-o,o,s),p=new j.Vector3(o,o,s),d=new j.Vector3(o,s,o),f=new j.Vector3(-o,s,o),m=new j.Vector3(-o,s,s),v=new j.Vector3(o,s,s);return c.vertices.push(l),c.vertices.push(u),c.vertices.push(h),c.vertices.push(p),c.vertices.push(d),c.vertices.push(f),c.vertices.push(m),c.vertices.push(v),c.faces.push(new j.Face3(0,1,2)),c.faces.push(new j.Face3(0,2,3)),c.faces.push(new j.Face3(4,5,6)),c.faces.push(new j.Face3(4,6,7)),c.applyMatrix((new j.Matrix4).makeRotationX(e)),c.applyMatrix((new j.Matrix4).makeRotationY(t)),c.applyMatrix((new j.Matrix4).makeRotationZ(n)),c.computeFaceNormals(),c.computeVertexNormals(),r=new j.MeshBasicMaterial({opacity:1,color:at,transparent:!0}),i=new j.Mesh(c,r)},f=function(e,t){var n,r,i=40,a=60,o=i+a,s=new j.Geometry,c=new j.Vector3(o,o,o),l=new j.Vector3(a,o,o),u=new j.Vector3(a,a,o),h=new j.Vector3(o,a,o),p=new j.Vector3(o,o,a),d=new j.Vector3(o,o,o),f=new j.Vector3(o,a,o),m=new j.Vector3(o,a,a),v=new j.Vector3(o,o,o),g=new j.Vector3(o,o,a),y=new j.Vector3(a,o,a),b=new j.Vector3(a,o,o);return s.vertices.push(c),s.vertices.push(l),s.vertices.push(u),s.vertices.push(h),s.vertices.push(p),s.vertices.push(d),s.vertices.push(f),s.vertices.push(m),s.vertices.push(v),s.vertices.push(g),s.vertices.push(y),s.vertices.push(b),s.faces.push(new j.Face3(0,1,2)),s.faces.push(new j.Face3(0,2,3)),s.faces.push(new j.Face3(4,5,6)),s.faces.push(new j.Face3(4,6,7)),s.faces.push(new j.Face3(8,9,10)),s.faces.push(new j.Face3(8,10,11)),s.applyMatrix((new j.Matrix4).makeRotationX(e)),s.applyMatrix((new j.Matrix4).makeRotationY(t)),s.computeFaceNormals(),s.computeVertexNormals(),n=new j.MeshBasicMaterial({opacity:1,color:at,transparent:!0}),r=new j.Mesh(s,n)};this.setCenter=function(e){i=e},this.render=function(){r._renderer&&r._renderer.render(r._scene,r._camera)};var m=function(e,t,n){var r=it[e],i=document.createElement("canvas"),a=i.getContext("2d");i.width=i.height=200,a.fillStyle=n||ot,a.font=rt,a.fillRect(0,0,200,200);var o=a.measureText(r),s=o.width;a.fillStyle="rgba(0,0,0,1)",a.translate(100,100),a.rotate(t),a.fillText(r,-s/2,28);var c=new j.Texture(i);return c.needsUpdate=!0,c.minFilter=j.LinearFilter,c},v=function(){r._container.addEventListener("click",g),r._container.addEventListener("mousemove",y),r._container.addEventListener("mouseup",y)},g=function(e){var t=n(e);t.length>0&&(r._INTERSECTED=t[0].object,r._viewer.setStandView(r._INTERSECTED.name))},y=function(e){for(var t=n(e),i=0;i0&&(r._INTERSECTED=t[0].object,r._INTERSECTED.isFace?r._INTERSECTED.material=r._accentFaceMat[r._INTERSECTED.name]:r._INTERSECTED.material.color.setHex(st)),r.render()},b=function(e){var t=e.getBoundingClientRect();return{x:t.left,y:t.top,w:t.width,h:t.height}},_=function(e,t){var n=e.clientX-t.x,r=e.clientY-t.y;return n=n/t.w*2-1,r=(t.h-r)/t.h*2-1,new j.Vector3(n,r,.5)};this._viewer.signals.cameraChange.add(function(){r._camera.up=r._viewer._actCamera.up.clone();var e=r._viewer._actCamera.position.clone();e.sub(i);var t=e.length();e.x=e.x/t*o,e.y=e.y/t*o,e.z=e.z/t*o,r._camera.position.copy(e);var n=new j.Vector3(0,0,0);r._camera.lookAt(n),r._camera.updateProjectionMatrix()}),u()}function I(e,t,n,r){function i(){E.signals.mouseMove.add(s),E.signals.drag.add(c),E.signals.restore.add(l),document.addEventListener("mouseup",u,!1),document.addEventListener("mouseleave",u,!1),E.signals.touchMove.add(h),E.signals.touchDrag.add(p),E.signals.touchEnd.add(d)}function a(){E.signals.mouseMove.remove(s),E.signals.drag.remove(c),document.removeEventListener("mouseup",u,!1),document.removeEventListener("mouseleave",u,!1),E.signals.touchMove.remove(h),E.signals.touchDrag.remove(p),E.signals.touchEnd.remove(d)}function o(){a()}function s(t){if(t.preventDefault(),v.x=t.pageX/E._renderer.domElement.offsetWidth*2-1,v.y=2*-(t.pageY/E._renderer.domElement.offsetHeight)+1,m.setFromCamera(v,S.camera),w&&S.enabled){if(m.ray.intersectPlane(f,y)){var r=y.sub(g).applyMatrix4(_);w.drag=!0,w.dtPos||(w.dtPos=new j.Vector3),w.dtPos.add(r.clone().sub(w.position)),w.position.copy(r),w.updateMatrix()}return S.dispatchEvent({type:"drag",object:w}),void E.render()}m.setFromCamera(v,S.camera);var i=m.intersectObjects(e,!0);if(i.length>0){var a=i[0].object;f.setFromNormalAndCoplanarPoint(S.camera.getWorldDirection(f.normal),b.setFromMatrixPosition(a.matrixWorld)),x!==a&&(S.dispatchEvent({type:"hoveron",object:a}),n.style.cursor="pointer",x=a)}else null!==x&&(S.dispatchEvent({type:"hoveroff",object:x}),n.style.cursor="auto",x=null)}function c(e){e.length>0&&(w=e[0].obj,m.ray.intersectPlane(f,y)&&(_.getInverse(w.parent.matrixWorld),g.copy(y).applyMatrix4(_).sub(w.position)),n.style.cursor="move",S.dispatchEvent({type:"dragstart",object:w}))}function l(e){e.length>0&&(M=e[0].obj,1==M.drag&&(M.drag=!1,M.position.sub(M.dtPos),M.dtPos=null,M.updateMatrix(),E.clearHiObj(),E.render(),M=null))}function u(e){e.preventDefault(),w&&(S.dispatchEvent({type:"dragend",object:w}),w=null),n.style.cursor=x?"pointer":"auto"}function h(e){if(e.preventDefault(),!(e.changedTouches.length>1)&&(e=e.changedTouches[0],v.x=e.clientX/E._renderer.domElement.offsetWidth*2-1,v.y=2*-(e.clientY/E._renderer.domElement.offsetHeight)+1,m.setFromCamera(v,S.camera),w&&S.enabled)){if(m.ray.intersectPlane(f,y)){var t=y.sub(g).applyMatrix4(_);w.drag=!0,w.dtPos||(w.dtPos=new j.Vector3),w.dtPos.add(t.clone().sub(w.position)),w.position.copy(t),w.updateMatrix()}return S.dispatchEvent({type:"drag",object:w}),void E.render()}}function p(e){if(r._control.setEnabled(!1),event.preventDefault(),!(event.changedTouches.length>1)){var t=event.changedTouches[0];v.x=t.clientX/E._renderer.domElement.offsetWidth*2-1,v.y=2*-(t.clientY/E._renderer.domElement.offsetHeight)+1,m.setFromCamera(v,S.camera),e.length>0&&(w=e[0].obj,f.setFromNormalAndCoplanarPoint(S.camera.getWorldDirection(f.normal),b.setFromMatrixPosition(w.matrixWorld)),m.ray.intersectPlane(f,y)&&(_.getInverse(w.parent.matrixWorld),g.copy(y).applyMatrix4(_).sub(w.position)),n.style.cursor="move",S.dispatchEvent({type:"dragstart",object:w}))}}function d(e){e.moved&&(r._control.setEnabled(!0),e.preventDefault(),w&&(r.clearHiObj(),S.dispatchEvent({type:"dragend",object:w}),w=null),n.style.cursor="auto")}var f=new j.Plane,m=new j.Raycaster,v=new j.Vector2,g=new j.Vector3,y=new j.Vector3,b=new j.Vector3,_=new j.Matrix4,w=null,x=null,M=null,E=r,S=this;this.camera=t,this.enabled=!0,this.activate=i,this.deactivate=a,this.dispose=o}function N(){function e(){var e=y._scene.children.slice(4);return e}function t(e,n){for(var r=0==e||3==e,i=0==e||1==e,a=0;a1?f.d=s.top:f.d=s.right:f.fov=s.fov,o&&(l=o.min.distanceTo(o.max),l<1e-5&&(l=500),o.getCenter(a)),s.far=10*l,s.near=.1;var v=y._theta*l;if(s instanceof j.OrthographicCamera){var g=s.position.distanceTo(a);m.d=Math.tan(15*j.Math.DEG2RAD)*g}else m.fov=30;new j.Vector3(0,0,1);if("Isometric"===e||void 0===e)h.x=v/Math.sqrt(3),h.y=-v/Math.sqrt(3),h.z=v/Math.sqrt(3),u.crossVectors(new j.Vector3(v,-v,v),new j.Vector3(v,v,0)).normalize(),h.add(a),y._control.resetStaticObjs();else{u.set(0,0,1);var b=e.replace(/,/g,""),_=e.length-b.length;e=e.toLowerCase(),e.indexOf("top")!=-1?0==_?(h.z=v,u.set(0,1,0)):1==_?e.indexOf("back")!=-1?(h.y=v/Math.sqrt(2),h.z=v/Math.sqrt(2)):e.indexOf("front")!=-1?(h.y=-v/Math.sqrt(2),h.z=v/Math.sqrt(2)):e.indexOf("right")!=-1?(h.x=v/Math.sqrt(2),h.z=v/Math.sqrt(2)):e.indexOf("left")!=-1&&(h.x=-v/Math.sqrt(2),h.z=v/Math.sqrt(2)):2==_&&(e.indexOf("back")!=-1?e.indexOf("left")!=-1?(h.x=-v/Math.sqrt(3),h.y=v/Math.sqrt(3),h.z=v/Math.sqrt(3)):(h.x=v/Math.sqrt(3),h.y=v/Math.sqrt(3),h.z=v/Math.sqrt(3)):e.indexOf("front")!=-1&&(e.indexOf("left")!=-1?(h.x=-v/Math.sqrt(3),h.y=-v/Math.sqrt(3),h.z=v/Math.sqrt(3)):(h.x=v/Math.sqrt(3),h.y=-v/Math.sqrt(3),h.z=v/Math.sqrt(3)))):e.toLowerCase().indexOf("bottom")!=-1?0==_?(h.z=-v,u.set(0,-1,0)):1==_?e.indexOf("back")!=-1?(h.y=v/Math.sqrt(2),h.z=-v/Math.sqrt(2)):e.indexOf("front")!=-1?(h.y=-v/Math.sqrt(2),h.z=-v/Math.sqrt(2)):e.indexOf("right")!=-1?(h.x=v/Math.sqrt(2),h.z=-v/Math.sqrt(2)):e.indexOf("left")!=-1&&(h.x=-v/Math.sqrt(2),h.z=-v/Math.sqrt(2)):2==_&&(e.indexOf("back")!=-1?e.indexOf("left")!=-1?(h.x=-v/Math.sqrt(3),h.y=v/Math.sqrt(3),h.z=-v/Math.sqrt(3)):(h.x=v/Math.sqrt(3),h.y=v/Math.sqrt(3),h.z=-v/Math.sqrt(3)):e.indexOf("front")!=-1&&(e.indexOf("left")!=-1?(h.x=-v/Math.sqrt(3),h.y=-v/Math.sqrt(3),h.z=-v/Math.sqrt(3)):(h.x=v/Math.sqrt(3),h.y=-v/Math.sqrt(3),h.z=-v/Math.sqrt(3)))):e.toLowerCase().indexOf("left")!=-1?0==_?h.x=-v:1==_&&(e.indexOf("back")!=-1?(h.x=-v/Math.sqrt(2),h.y=v/Math.sqrt(2)):e.indexOf("front")!=-1&&(h.x=-v/Math.sqrt(2),h.y=-v/Math.sqrt(2))):e.toLowerCase().indexOf("right")!=-1?0==_?h.x=v:1==_&&(e.indexOf("back")!=-1?(h.x=v/Math.sqrt(2),h.y=v/Math.sqrt(2)):e.indexOf("front")!=-1&&(h.x=v/Math.sqrt(2),h.y=-v/Math.sqrt(2))):e.toLowerCase().indexOf("front")!=-1?0==_&&(h.y=-v):e.toLowerCase().indexOf("back")!=-1&&0==_&&(h.y=v),h.add(a)}m.p=h.clone(),m.up=u.clone(),m.c=a.clone(),i(f,m,t)}function i(e,t,n,r){function i(e,t,n,r){var i=y._actCamera;if(i.position.copy(e),i.up.copy(t),i.lookAt(n),y._dirLight.position.copy(e),y._dirLight2.position.copy(e),i.updateProjectionMatrix(),i.updateMatrixWorld(!0),i instanceof j.PerspectiveCamera)i.fov=r.fov;else if(i.aspect>1){var a=i.aspect;i.left=-r.d*a,i.right=r.d*a,i.top=r.d,i.bottom=-r.d}else{var o=i.aspect;i.left=-r.d,i.right=r.d,i.top=r.d/o,i.bottom=-r.d/o}y._control.setTarget(n),y._control.reset(),y._control.resetStaticObjs(),y.signals.cameraChange.dispatch(),y.render()}if(n)i(t.p,t.up,t.c,{fov:t.fov,d:t.d});else{var a=function e(t){L=!0;var n=C(e),r=ft.update(t);r||(L=!1,cancelAnimationFrame(n))},o=function(e){var t={},n=Math.sqrt(e.x*e.x+e.y*e.y);return t.x=Math.acos(e.x/n)||0,e.y<0&&(t.x=2*Math.PI-t.x),t.z=Math.acos(e.z/e.length()),t},s=e.p.clone();s.sub(e.c);var c=t.p.clone();c.sub(t.c);var l=o(s),u=o(c),h=e.up.angleTo(t.up),p=new j.Vector3;p.crossVectors(e.up,t.up).normalize();var d=s.clone().normalize(),f=c.clone().normalize(),m=new j.Vector3,v=d.angleTo(f),g=!0;if(Math.abs(u.z-l.z)<=.001)g=!1;else{m.crossVectors(d,f).normalize();var b=d.clone().cross(e.up).normalize().add(f.clone().cross(t.up).normalize()).length();b<.1&&(m.addVectors(d,f).divideScalar(2),v=Math.PI)}var _={angX:l.x,angZ:l.z,length:s.length(),angUp:0,angP:0,cx:e.c.x,cy:e.c.y,cz:e.c.z,fov:e.fov,d:e.d},w={angX:u.x,angZ:u.z,length:c.length(),angUp:h,angP:v,cx:t.c.x,cy:t.c.y,cz:t.c.z,fov:t.fov,d:t.d};w.angX-_.angX>Math.PI?w.angX-=2*Math.PI:w.angX-_.angX<-Math.PI&&(w.angX+=2*Math.PI);var x=new ft.Tween(_).to({angX:w.angX,angZ:w.angZ,length:w.length,angP:w.angP,angUp:w.angUp,cx:w.cx,cy:w.cy,cz:w.cz,fov:w.fov,d:w.d},500).easing(ft.Easing.Cubic.InOut).onUpdate(function(){var t=new j.Vector3(_.cx,_.cy,_.cz),n=new j.Vector3;g?(n=s.clone().normalize(),n.applyAxisAngle(m,_.angP).normalize().multiplyScalar(_.length)):n.set(_.length*Math.sin(_.angZ)*Math.cos(_.angX),_.length*Math.sin(_.angZ)*Math.sin(_.angX),_.length*Math.cos(_.angZ)),n.add(t);var r=e.up.clone();r.applyAxisAngle(p,_.angUp),i(n,r,t,{fov:_.fov,d:_.d})}).onComplete(function(){r&&r()});x.start(),a()}}function a(){y._backStencil.traverse(function(e){(e.isMesh||e.isLine)&&(e.geometry.dispose(),e.material.dispose())}),y._frontStencil.traverse(function(e){(e.isMesh||e.isLine)&&(e.geometry.dispose(),e.material.dispose())});for(var e=0;e1?o.d=a.top:o.d=a.right,f=Math.tan(15*j.Math.DEG2RAD)*d*s/l):(o.fov=a.fov,h=2*Math.atan(Math.tan(15*j.Math.DEG2RAD)*p/d*s/l)/j.Math.DEG2RAD);var m={p:a.position.clone(),up:a.up.clone(),c:e.clone(),fov:h,d:f};i(o,m)}function v(e,t,n){for(var r=t?null:Me,i=t?null:ye,a=0;a1?s.d=o.top:s.d=o.right:s.fov=o.fov;var c=r.camera,l={p:new j.Vector3(c.p.x,c.p.y,c.p.z),up:new j.Vector3(c.up.x,c.up.y,c.up.z),c:new j.Vector3(c.c.x,c.c.y,c.c.z),d:c.d,fov:c.fov},u=function(){y._postal.showPostal(r.type,r.points,c.asp)};i(s,l,0,u)}}),y._postal=new pt("#"+e,SVG,y),y.signals.removeSVG.add(function(){A&&(A.removeText(),A=null,document.getElementsByTagName("svg")[0].innerHTML="")})},ue=function(){re&&(window.ImageBitmap=Image)},pe=function(e,t){var n=document.createElement("canvas"),r=e.char,i=void 0,a=void 0;e.row?(i=window.innerHeight/e.row,a=window.innerWidth/e.column):(a=window.innerWidth,i=window.innerHeight),n.width=a,n.height=i;var o=n.getContext("2d");"bg"==t&&(o.fillStyle="rgba(238,238,238,1)",o.fillRect(0,0,a,i)),o.translate(n.width/2,n.height/2);var s=e.deg?e.deg/180*Math.PI:0,c=e.color?e.color:"rgba(17, 17, 17, 0.50)",l=e.font?e.font:"bold 16px 思源黑体";return o.rotate(s),o.font=l,o.fillStyle=c,o.textAlign="center",o.textBaseline="Middle",o.fillText(r,0,0),n.toDataURL("image/png")},de=function(e){ht.setBackground&&ht.setBackground(function(e){y._renderer.setClearAlpha(0);var t=e.ele,n=void 0;if(e){if(e.img)switch(n=e.img,t.style.backgroundImage="url("+n+")",e.size){case"cover":t.style.backgroundSize="cover";break;case"contain":t.style.backgroundSize="contain";break;case"stretch":t.style.backgroundSize=window.innerWidth+"px "+window.innerHeight+"px";break;case"repeat":t.style.backgroundRepeat="repeat";break;case"center":}else n=pe(e,"bg"),t.style.background="url("+n+")";setTimeout(function(){y.render()},10)}})},ve=function(){if(y.markups.length){for(var e=0;e-1?1:e.indexOf("Presto")>-1?2:e.indexOf("AppleWebKit")>-1?0:!(e.indexOf("Gecko")>-1&&e.indexOf("KHTML")==-1)||3},be=function(){function e(e){t++;var i=new j.SpriteMaterial({map:e});i.opacity=r;var a=i.map.image.width,o=i.map.image.height,s=new j.Sprite(i);s.center.set(.5,.5),s.scale.set(a,o,1),y.sceneOrtho.add(s),y.markups.push(s),t==n&&ve()}var t=0,n=0,r=1,i=function(e){var t=e.width,n=e.height,r=document.createElement("canvas");r.width=t,r.height=n;var i=r.getContext("2d");i.scale(1,-1),i.translate(0,-n),i.drawImage(e,0,0);var a=r.toDataURL();return a},a=function(t){if(t){n=t.length;for(var a=new j.TextureLoader,o=function(o){var s=t[o];c=new Image,c.setAttribute("crossOrigin","anonymous");var l=function(){if(ge()||c.width>0&&0==(c.width&c.width-1)&&c.height>0&&0==(c.height&c.height-1))a.load(c.src,e);else{var t=i(c);a.load(t,e)}};s.img?c.src=s.img:c.src=pe(s),r=s.opacity||1,c.onload=function(){if(s.row){n=s.row*s.column;for(var e=0;e0||(N&&y.signals.stopPostal.dispatch(),y._startPoint&&(y._pickScene.remove(y._startPoint),y._startPoint=null),y._endPoint&&(y._pickScene.remove(y._endPoint),y._endPoint=null),y.angleCenter=null,y.finish&&(y.finish(),y.finish=null),y.clearHiObj(),y._calDist?(y._isDimming&&(y._scene.remove(y._calDistPlane),y._tmpLabel.removeFromScene(y._scene),y._tmpLabel=null,y.render()),y._calDistPlane=null,y._pickList=[],y._calDist=!1,y._isDimming=!1):y._inqEntity&&(y._isDimming&&(y._scene.remove(y._calDistPlane),y._tmpLabel.removeFromScene(y._scene),y._tmpLabel=null,y.render()),y._calDistPlane=null,y._pickList=[],y._isDimming=!1,y._inqEntity=!1),e!=-1&&y.setFilter(q),l(),this._factor&&this.createExp(this._factor),y.distType="",y._renderer.domElement.style.cursor="auto",y.render())},this.isCreatClipCurve=function(){fe.crtCurve=!fe.crtCurve},this.render=function(){var e=new Date;if(y._simplifyPartList.length>0){for(var t in y._simplifyPartList)y._simplifyPartList[t].visible=!0;y._simplifyPartList=[]}if(y._simplifyLevel>0){var n=new j.Box3;y._scene.traverse(function(e){if("Part"==e.type&&!e.userData.isComp&&e.visible&&e.userData.box){n.set(e.userData.box.min,e.userData.box.max);var t=y._viewWin.offsetWidth/2,r=y._viewWin.offsetHeight/2,i=n.min.clone().project(y._actCamera),a=n.max.clone().project(y._actCamera),o=Math.abs((i.x-a.x)*t*((i.y-a.y)*r));ol){var h=c/l;y._actCamera.left=-u*h,y._actCamera.right=u*h,y._actCamera.top=u,y._actCamera.bottom=-u}else{var p=l/c;y._actCamera.left=-u,y._actCamera.right=u,y._actCamera.top=u*p,y._actCamera.bottom=-u*p}}this._actCamera.up.copy(i),this._actCamera.position.copy(a),this._actCamera.near=o,this._actCamera.far=s,this._actCamera.updateProjectionMatrix(),this._control.object=this._actCamera,this._control.reset(),this._dbMgr.camera=this._actCamera,this.dragControls.camera=this._actCamera,y._renderer.clearDepth(),this.signals.cameraChange.dispatch(),this._control.update(),this.render()},this.filter=function(){return y._picker._filter},this.setFilter=function(e){y._picker._filter=e},this.setPntPicker=function(e){y._prePickPnt&&(y._pickScene.remove(y._prePickPnt),y._prePickPnt=null),y._picker._pntPicker=e,y.render()},this.pickTarg=function(){return y._picker._pickTarg},this.setPickTarg=function(e){y._picker._pickTarg=e},this.setAutoClearHi=function(e){this._autoClearHiObj=e},this.setAutoUpdDimTree=function(e){this.isUpdDimTree=e};var xe=function(){for(var e=0;e0?this.tglToolsDimText(!1):(this.setFilter(q),this.tglToolsDimText(!0)),this.clearHiObj();var a=void 0,o=new j.Vector3;if(t)a=t;else{if(!this._scene.children[5])return;a=this._scene.children[5].children}var s=void 0;if(r)o=r.clone();else if(s=this._dbMgr.getBoundingBox(),s.getCenter(o),!U){for(var c=s.max.distanceTo(s.min)/2,u=0;u=i/se)){var v=a[p].children;this.createExp(e,v,i+1,m)}d=o.distanceTo(m);var g=(.1-5/U)/(d/Te-.9)+50/U/3;f.subVectors(m,o).normalize(),f.multiplyScalar(d*(e-(i-1)/se*100)/(U*g));var y=a[p].position.clone();y.add(f),a[p].position.copy(y),a[p].updateMatrix()}}},this.toggleMovePart=function(e){y._picker._movePart=e,y._eventMgr._movePart=e,e&&y.setFilter(q)},this.toggleRestore=function(e){y._picker._restorePart=e,y._eventMgr._restorePart=e,e&&y.setFilter(q)},this.toggleDragActivate=function(e){e?y.dragControls.activate():y.dragControls.deactivate()},this.clearScene=function(){var e=document.getElementById("dim-list");e.innerHTML="",this._scene.traverse(function(e){(e.isMesh||e.isLine)&&(e.geometry.dispose(),e.material.dispose())});for(var t=0;ts&&(e.getWorldDirection(a),a.multiplyScalar(-1*c),a.add(i),e.position.copy(a),e.updateMatrixWorld()),e.far=o+a.distanceTo(i),e.far<1e-5&&(e.far=1e3),e.updateProjectionMatrix()}}},this._createFloor=function(){this._floor&&(this._scene.remove(this._floor),this._floor=null);var e=1e3,t=1e3,n=void 0,r=this._dbMgr.getBoundingBox();r&&(e=Math.abs(r.max.x-r.min.x),t=Math.abs(r.max.y-r.min.y),e=Math.max(e,t),t=e);var i=0,a=0;e*=2,t=e;for(var o=e/20;i0?r.min.z>0?.9*r.min.z:1.1*r.min.z:-.1,l.receiveShadow=!0,l.castShadow=!1,this._floor.add(l),c=new j.Geometry,s=new j.LineBasicMaterial({vertexColors:j.VertexColors});for(var u=new j.Color(12303291),h=new j.Color(12303291),p=e/2,d=-p;d<=p+1;d+=o){c.vertices.push(new j.Vector3(-p,d,0),new j.Vector3(p,d,0),new j.Vector3(d,-p,0),new j.Vector3(d,p,0));var f=0===d?u:h;c.colors.push(f,f,f,f)}var m=new j.LineSegments(c,s);m.name="floorGrid",m.pickable=!1,this._floor.add(m),this._floor.position.set(r.min.x+(r.max.x-r.min.x)/2,r.min.y+(r.max.y-r.min.y)/2,n),this._scene.add(this._floor)},this._getSceneBoundingBox=function(){return this._scene?(this._sceneBoundingBox=new j.Box3,this._sceneBoundingBox.setFromObject(this._scene),this._sceneBoundingBox):null},this.configMouseOptions=function(e){e&&(this._mouseOptions={},this._mouseOptions[0]=e.lb,this._mouseOptions[1]=e.mb,this._mouseOptions[2]=e.rb)},this.getMouseMotionMask=function(e){if(this._mouseOptions)return this._mouseOptions[e]},this.simplifyDisp=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e){if(y._simplifyLevel=0,0==y._simplifyEdgeList.length)return;for(var t in y._simplifyEdgeList)y._simplifyEdgeList[t].visible=!0;y._simplifyEdgeList=[]}else{if(y._simplifyEdgeList.length>0||y._preFps>20)return;y._simplifyLevel=1,y._scene.traverse(function(e){e.isLine&&e.visible&&(e.visible=!1,y._simplifyEdgeList.push(e))})}},this.calDistBetLines=function(e,t,n,r,i,a,o){return y._tmpLabel&&(y._tmpLabel.removeFromScene(y._scene),y._tmpLabel=null),this.dispDis=e,this.dispSPoint=t,this.dispEPoint=n,this.dispFstEty=r,this.dispSecEty=i,this.redo=a,this.finish=o,e?(l(null,!0),this.setAutoClearHi(!1),this._calDist=!0,this.distType="dl",this.clearHiObj(),setTimeout(function(){y.setPntPicker(!0)},1),this.setFilter(X|Z),this._renderer.domElement.style.cursor="crosshair",void this.render()):(this.setAutoClearHi(!0),this._calDist=!1,this.distType="",void this.setPntPicker(!1))},this.beginInqEnt=function(e,t,n,r){return y._tmpLabel&&(y._tmpLabel.removeFromScene(y._scene),y._tmpLabel=null,y.render()),e?(l(null,!0),y.setPntPicker(!0),this.clearHiObj(),this.setAutoClearHi(!0),this.inqEntCbk=e,this.redo=t,this.finish=n,this.dOrRCbk=r,this._inqEntity=!0,this.setFilter(X|Z),this._renderer.domElement.style.cursor="crosshair",void this.render()):void y.setPntPicker(!1)},this.inqEntFunc=function(e){this.setFilter(q),this.setPntPicker(!1);var t=this._dbMgr.getPickDataInfo(e);if(this.inqEntCbk(t),this._renderer.domElement.style.cursor="auto",this.isAddDim)switch(y._pickList[0].type=t.type,this.setFilter(J),t.type){case"Line":this.distType="l";break;case"3d arc":y._pickList[0].endpnt=t.endpnt;case"3d circle":y._pickList[0].center=t.center,y._pickList[0].radius=t.radius,y._pickList[0].dimMatrix=t.matrix,this.distType="d",this.dOrRCbk&&this.dOrRCbk(!0);break;default:this.setFilter(q)}else this._inqEntity=!1},this.setDimMode=function(e){this.dimMode=e},this.setIsAddDim=function(e){this.isAddDim=e},this.calPointDist=function(e,t){this.setPntPicker(!1);var n=e.distanceTo(t);this._tmpDist=n,this.dispDis&&this.dispDis(n,"dist"),this.distType="dp"},this.calDistBetLP=function(e,t,n){this.setPntPicker(!1);var r=De.distPtoLine(e,t,n);this.dispDis&&this.dispDis(r,"dist"),this._tmpDist=r,this.distType="pl"},this.calLinesMeasure=function(){this.setPntPicker(!1),this.isAddDim?this.setFilter(J):this.setFilter(q);var e=this._pickList[0],t=this._pickList[1],n=void 0,r=[],i=[],a=[],o=!1,s=!1;if("Line"==e.type&&(n=e.dispData[0].geometry.attributes.position.array,r[0]=new j.Vector3(n[0],n[1],n[2]),r[1]=new j.Vector3(n[3],n[4],n[5]),i[0]=r[0].clone().applyMatrix4(e.dispData[0].matrix),i[1]=r[1].clone().applyMatrix4(e.dispData[0].matrix),o=!0),"Line"==t.type&&(n=t.dispData[0].geometry.attributes.position.array,r[0]=new j.Vector3(n[0],n[1],n[2]),r[1]=new j.Vector3(n[3],n[4],n[5]),a[0]=r[0].clone().applyMatrix4(t.dispData[0].matrix),a[1]=r[1].clone().applyMatrix4(t.dispData[0].matrix),s=!0),o&&s)if(e.path.join(",")==t.path.join(","))this.calPointDist(this._startPoint.position,this._endPoint.position);else if(De.isLineParallel(i[0],i[1],a[0],a[1]))this._tmpDist=De.distPtoLine(i[0],a[0],a[1]),this.dispDis&&this.dispDis(this._tmpDist,"dist");else{var c=new j.Vector3,l=new j.Vector3;if(c.subVectors(i[1],i[0]),l.subVectors(a[1],a[0]),!De.isLineCollinear(i,a)&&De.isSamePlane(i[0],c,a[0],l)){var u=De.calcIsectLineLine(i[0],c,a[0],l);this.angleCenter=u,this._tmpDist=De.calcAngle(this.angleCenter,this._startPoint.position,this._endPoint.position)/j.Math.DEG2RAD,this.setFilter(J),this.dispDis&&this.dispDis(this._tmpDist,"ang")}else this.calPointDist(this._startPoint.position,this._endPoint.position)}else o?De.isSameVector(this._endPoint.position,i[0])||De.isSameVector(this._endPoint.position,i[1])?this.calPointDist(this._startPoint.position,this._endPoint.position):this.calDistBetLP(this._endPoint.position,i[0],i[1]):s?De.isSameVector(this._startPoint.position,a[0])||De.isSameVector(this._startPoint.position,a[1])?this.calPointDist(this._startPoint.position,this._endPoint.position):this.calDistBetLP(this._startPoint.position,a[0],a[1]):this.calPointDist(this._startPoint.position,this._endPoint.position);this._renderer.domElement.style.cursor="auto"},this.signals.windowResize.add(function(){var e=y._viewWin.offsetWidth,t=y._viewWin.offsetHeight;if(y._actCamera instanceof j.OrthographicCamera){var n=Math.abs(y._actCamera.right-y._actCamera.left),r=Math.abs(y._actCamera.top-y._actCamera.bottom),i=Math.min(n,r);if(e>t){var a=e/t;y._actCamera.left=-i/2*a,y._actCamera.right=i/2*a,y._actCamera.top=i/2,y._actCamera.bottom=-i/2}else{var o=t/e;y._actCamera.left=-i/2,y._actCamera.right=i/2,y._actCamera.top=i/2*o,y._actCamera.bottom=-i/2*o}}else y._actCamera.aspect=e/t;y._actCamera.updateProjectionMatrix(),y._markupCamera.left=-e/2,y._markupCamera.right=e/2,y._markupCamera.top=t/2,y._markupCamera.bottom=-t/2,y._markupCamera.updateProjectionMatrix(),ve(),y._renderer.setSize(e,t),y.signals.removeSVG.dispatch(),de(),y.render()}),this.signals.contextmenu.add(function(e){e.preventDefault(),e.stopPropagation()}),this.signals.postCmd.add(function(e){void 0!=y._commondList[e]&&y._commondList[e]()}),this.signals.siderPick.add(function(e,t,n){t&&t(),y.setAutoClearHi(!0),y._inqEntity=!1,y._calDist=!1;var r=new he;r.path=e.slice(0),r.type=n,r.matrix=y._dbMgr.getMatrixByPath(e).clone();var i=[];i.push(r),y.signals.pick.dispatch(i,!0)}),this.signals.prePick.add(function(e){if(!e){if(y._prePickObj)for(var t in y._prePickObj.dispData)y._pickScene.remove(y._prePickObj.dispData[t]),y._prePickObj.dispData[t].geometry.dispose(),y._prePickObj.dispData[t].material.dispose(),y.render();return void(y._prePickObj=null)}if(y._prePickObj){if(!y._prePickObj.compare(e)){for(var t in y._prePickObj.dispData)y._pickScene.remove(y._prePickObj.dispData[t]),y._prePickObj.dispData[t].geometry.dispose(),y._prePickObj.dispData[t].material.dispose();if(y._prePickObj=e,y._dbMgr.getHiDispData(y._prePickObj),y._prePickObj.dispData.length>0)for(var t in y._prePickObj.dispData)y._pickScene.add(y._prePickObj.dispData[t])}}else if(y._prePickObj=e,y._dbMgr.getHiDispData(y._prePickObj),y._prePickObj.dispData.length>0)for(var t in y._prePickObj.dispData)y._pickScene.add(y._prePickObj.dispData[t]);y.render()}),this.signals.pick.add(function(t,n,r){if(y._prePickObj)for(var i in y._prePickObj.dispData)y._pickScene.remove(y._prePickObj.dispData[i]),y._prePickObj.dispData[i].geometry.dispose(),y._prePickObj.dispData[i].material.dispose();if(y._autoClearHiObj&&(xe(),Se()),(y._calDist||y._inqEntity)&&0==t.length)return void y.redo();t&&0!=t.length||y.signals.highLightTree.dispatch();for(var a in t){var o=!0,s=t[a];if("dl"!=y.distType)for(var c in y._pickList){var l=y._pickList[c];if(s.compare(l)){o=!1;break}}if(o)if(n&&"label"!=s.type){var u=e(),p=[];y._pickList.push(s),h(p,u,s.path),v(p),r&&y.signals.highLightTree.dispatch(s.path);for(var d in p)y._pickScene.add(p[d])}else{if(y._dbMgr.getHiDispData(s,!0,y._factor),"label"==s.type&&y.signals.highLightTree.dispatch(s.path),s.dispData.length>0)for(var f in s.dispData)y._pickScene.add(s.dispData[f]);"dl"==y.distType?y._pickList.hasCaughtPnt?(y._pickList.push(s),y._pickList.hasCaughtPnt=!1):y.redo():(y._pickList.push(s),n||y.filter()!=q||y.signals.highLightTree.dispatch(s.path));var m=[],g=[];if(y._inqEntity)y.inqEntFunc(s);else if(y._calDist&&y._pickList.length>0){var b=y._dbMgr.getPickDataInfo(s);if(y._pickList[y._pickList.length-1].type=b.type,"Line"==b.type){var _=s.dispData[0].geometry.attributes.position.array;g[0]=new j.Vector3(_[0],_[1],_[2]),g[1]=new j.Vector3(_[3],_[4],_[5]),m[0]=g[0].clone().applyMatrix4(s.dispData[0].matrix),m[1]=g[1].clone().applyMatrix4(s.dispData[0].matrix)}if(1==y._pickList.length)m.length>0?y.dispFstEty(m):y.dispFstEty([s.point]);else if(2==y._pickList.length){if(De.isSameVector(y._pickList[0].point,y._pickList[1].point))return void y.redo();m.length>0?y.dispSecEty(m):y.dispSecEty([s.point]),y.setAutoClearHi(!0),y.calLinesMeasure()}}}}y.render()}),this.signals.prePntPick.add(function(e,t){y._prePickPnt||(y._prePickPnt=Ze.clone(),y._pickScene.add(y._prePickPnt)),t?y._prePickPnt.visible=!0:y._prePickPnt.visible=!1,0==y._pickList.length&&y.dispSPoint?y.dispSPoint(e):1==y._pickList.length&&y.dispEPoint&&(y._endPoint=Ze.clone(),y._endPoint.position.copy(y._prePickPnt.position),y.dispEPoint(e)),e&&y._prePickPnt.position.copy(e);var n=y._actCamera.fov,r=y._actCamera.far,i=r*Math.tan(.5*n*j.Math.DEG2RAD),a=7e-4*i;y._prePickPnt.scale.set(a,a,a),y.render()}),this.signals.pntPick.add(function(e){if(y._prePickPnt&&(y._pickScene.remove(y._prePickPnt),y._prePickPnt=null),y._pickList.hasCaughtPnt=!0,y._calDist){var t=y._actCamera.fov,n=y._actCamera.far,r=n*Math.tan(.5*t*j.Math.DEG2RAD),i=7e-4*r;0==y._pickList.length?(y._startPoint=Ze.clone(),y._startPoint.position.copy(e),y._startPoint.scale.set(i,i,i),y._pickScene.add(y._startPoint)):1==y._pickList.length&&(y._endPoint=Ze.clone(),y._endPoint.position.copy(e),y._endPoint.scale.set(i,i,i),y._pickScene.add(y._endPoint))}y.render()}),this.signals.dimPinPick.add(function(e){if(!y._isTpl){var t=new j.Vector3(0,0,1),n=new j.Vector3,r=new j.Vector3,i=void 0,a=[],o=[],s=[],c=y._dbMgr.getBoundingBox();if(c.getCenter(n),y._calDistPlane&&"l"!=y.distType||("Line"==y._pickList[0].type&&(i=y._pickList[0].dispData[0].geometry.attributes.position.array,a[0]=new j.Vector3(i[0],i[1],i[2]),a[1]=new j.Vector3(i[3],i[4],i[5]),o[0]=a[0].clone().applyMatrix4(y._pickList[0].dispData[0].matrix),o[1]=a[1].clone().applyMatrix4(y._pickList[0].dispData[0].matrix)),2==y._pickList.length&&"Line"==y._pickList[1].type&&(i=y._pickList[1].dispData[0].geometry.attributes.position.array,a[0]=new j.Vector3(i[0],i[1],i[2]),a[1]=new j.Vector3(i[3],i[4],i[5]),s[0]=a[0].clone().applyMatrix4(y._pickList[1].dispData[0].matrix),s[1]=a[1].clone().applyMatrix4(y._pickList[1].dispData[0].matrix))),"dp"==y.distType||"l"==y.distType){var l=new j.Vector3,u=void 0,h=void 0;"dp"==y.distType?(u=y._startPoint.position,h=y._endPoint.position):(u=o[0],h=o[1],y._tmpDist=u.distanceTo(h)),l.subVectors(u,h);var p=new j.Vector3;y._actCamera.getWorldDirection(p);var d=new j.Vector3;if(l.angleTo(p)<=1e-5&&l.angleTo(p)>=-1e-5||l.angleTo(p)<=Math.PI&&l.angleTo(p)>=Math.PI-1e-5)d=y._actCamera.up.clone();else{d.crossVectors(l,p),t.crossVectors(d,l).normalize(),y._calDistPlane?(r.addVectors(h,t),y._calDistPlane.lookAt(r)):(y.createDimWithPlane(t,9,h),y._tmpLabel.points.push(u,h,h));var f=e.raycaster.intersectObjects([y._calDistPlane],!0);f.length>=1&&(y._tmpLabel.points[2]=f[0].point,y._isDimming?y._tmpLabel.modifyFromScene(y._scene):(y._isDimming=!0,y._dbMgr.buildLabelDisp(y._tmpLabel)),y._tmpLabel.updateScreenPosition(y._actCamera,y._viewWin,n),y._control.resetStaticObjs(),y.render())}}else if("dl"==y.distType){if(!y._calDistPlane){var m=y._endPoint.position;if((De.isSameVector(o[0],m)||De.isSameVector(o[1],m))&&(m=s[0],(De.isSameVector(o[0],s[0])||De.isSameVector(o[1],s[0]))&&(m=s[1])),t=De.calPlane(o[0],o[1],m),y.createDimWithPlane(t),y.angleCenter){y._tmpLabel.type=48;var v=De.calcMatrix(o[0],o[1],m,t);y._tmpLabel.matrix=v,y.tMatrix=new j.Matrix4,y.tMatrix.getInverse(v),y._tmpLabel.points.push(o[0].clone().applyMatrix4(y.tMatrix),o[1].clone().applyMatrix4(y.tMatrix),y._startPoint.position.clone().applyMatrix4(y.tMatrix),s[0].clone().applyMatrix4(y.tMatrix),s[1].clone().applyMatrix4(y.tMatrix),y._endPoint.position.clone().applyMatrix4(y.tMatrix))}else y._tmpLabel.type=21,y._tmpLabel.points.push(o[0].clone(),o[1].clone(),s[0].clone(),s[1].clone(),y._endPoint.position)}var g=e.raycaster.intersectObjects([y._calDistPlane],!0);g.length>=1&&(y.angleCenter?(y._tmpLabel.dimVar=[],y._tmpLabel.points[6]=g[0].point.clone().applyMatrix4(y.tMatrix)):y._tmpLabel.points[4]=g[0].point,y._isDimming?y._tmpLabel.modifyFromScene(y._scene):(y._isDimming=!0,y._dbMgr.buildLabelDisp(y._tmpLabel)),y._tmpLabel.updateScreenPosition(y._actCamera,y._viewWin,n),y._control.resetStaticObjs(),y.render())}else if("pl"==y.distType){if(!y._calDistPlane){var b=[],_=void 0;o.length>0?(b=o,_=y._endPoint.position.clone()):(b=s,_=y._startPoint.position.clone()),t=De.calPlane(b[0],b[1],_),y.createDimWithPlane(t,25),y._tmpLabel.points.push(b[0].clone(),b[1].clone(),_)}var w=e.raycaster.intersectObjects([y._calDistPlane],!0);w.length>=1&&(y._tmpLabel.points[3]=w[0].point,y._isDimming?y._tmpLabel.modifyFromScene(y._scene):(y._isDimming=!0,y._dbMgr.buildLabelDisp(y._tmpLabel)),y._tmpLabel.updateScreenPosition(y._actCamera,y._viewWin,n),y._control.resetStaticObjs(),y.render())}else if("d"==y.distType){var x=y._pickList[0];if(!y._calDistPlane){var M=(new j.Matrix4,x.dispData[0].geometry.attributes.position.array),E=new j.Vector3(M[0],M[1],M[2]),S=new j.Vector3(M[3],M[4],M[5]);if(E.applyMatrix4(x.dimMatrix),S.applyMatrix4(x.dimMatrix),t=De.calPlane(E,S,x.center),y.createDimWithPlane(t,44,x.center),y._tmpLabel.matrix=x.matrix,y.tMatrix=new j.Matrix4,y.tMatrix.getInverse(x.matrix),y._tmpLabel.points.push(x.center.clone().applyMatrix4(y.tMatrix)),y._tmpLabel.val=2*x.radius,"3d arc"==x.type){var T=De.calcMatrix(x.center,x.endpnt[0],null,t);y._tmpLabel.matrix=T,y.tMatrix.getInverse(T),y._tmpLabel.points[0]=x.center.clone().applyMatrix4(y.tMatrix),y._tmpLabel.endpnt=[x.endpnt[0].applyMatrix4(y.tMatrix),x.endpnt[1].applyMatrix4(y.tMatrix)]}}var P=e.raycaster.intersectObjects([y._calDistPlane],!0);0==y.dimMode?(y._tmpLabel.type=44,y._tmpLabel.val=2*x.radius):(y._tmpLabel.type=31,y._tmpLabel.val=x.radius),P.length>=1&&(y._tmpLabel.points[1]=P[0].point.clone().applyMatrix4(y.tMatrix)),y._isDimming?y._tmpLabel.modifyFromScene(y._scene):(y._isDimming=!0,y._dbMgr.buildLabelDisp(y._tmpLabel)),y._tmpLabel.updateScreenPosition(y._actCamera,y._viewWin,n),y._control.resetStaticObjs(),y.render()}}}),this.signals.clearTmpObj.add(function(){if(y._autoClearHiObj){for(var e in y._pickList){var t=y._pickList[e];for(var n in t.dispData)y._pickScene.remove(t.dispData[n]),t.dispData[n].geometry.dispose(),t.dispData[n].material.dispose()}y._pickList=[]}if(y._isTpl||(y._startPoint&&(y._pickScene.remove(y._startPoint),y._startPoint=null),y._endPoint&&(y._pickScene.remove(y._endPoint),y._endPoint=null)),y._scene.remove(y._calDistPlane),y._calDistPlane=null,y.distType="",y._calDist=!1,y._inqEntity=!1,y._isDimming=!1,y.setFilter(q),y.isUpdDimTree){var r=y._dbMgr.actPart.toolsDims;y._tmpLabel.dispData.path=[y._dbMgr.actPart.id,"tmp"+y.tmpDimIdx],r.push(y._tmpLabel),y.signals.dataChange.dispatch(!0),y._tmpLabel.removeFromScene(y._scene),y._tmpLabel=null,y.tmpDimIdx++}y.dispDis=null,y.dispSPoint=null,y.dispEPoint=null,y.finish&&y.finish(),l(),y.rebuildDims(),y.render()}),this.signals.dblclick.add(function(){y.focusOn()});var Oe=function(e,t){var n=y._dbMgr.getBoundingBox(),r=n.min.distanceTo(n.max),i=t||y._endPoint.position,a=new j.PlaneGeometry(1e4*r,1e4*r,10,10);y._calDistPlane=new j.Mesh(a,new j.MeshBasicMaterial({color:16776960,side:j.DoubleSide,visible:!1})),y._calDistPlane.position.set(i.x,i.y,i.z);var o=new j.Vector3;o.addVectors(i,e),y._calDistPlane.lookAt(o),y._scene.add(y._calDistPlane),y.render()};this.createDimWithPlane=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments[2];Oe(e,n),y._tmpLabel=new Ye(j.Math.generateUUID(),"tmp"+y.tmpDimIdx);var r=new j.Matrix4;y._tmpLabel.matrix=r,y._tmpLabel.type=t,y._tmpLabel.val=y._tmpDist,y._tmpLabel.points.type="vectors"},this.createExplodedView=function(e){this.createExp(e),this.render()},this.crtAnimByProportion=function(e,t,n){y.reBuildScene(),y.playAnim(e,t,n),y.animPause(),y.render()},this.playAnim=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;cancelAnimationFrame(b),y.setFilter(G),y.abort(),y.clearScene(),y.clock||(y.clock=new j.Clock);var r=[],i=y._dbMgr.getKF(r,t,e,n);if(null==i)throw y.reBuildScene(),e+" is not found.";n!=-1?(x=!1,w=n):(x=!0,w=-1,E=i.time);var a=new j.AnimationClip(e,i.time,i.kf),o=new j.Group,s=!0,c=!1,l=void 0;try{for(var u,h=r[Symbol.iterator]();!(s=(u=h.next()).done);s=!0)for(var p=u.value,d=0;d0?this.path[this.path.length-1]:-1}}]),e}(),pe=function(){function e(){s(this,e),this.startMouse=new j.Vector2,this.mouse=new j.Vector2,this.camera=null,this.raycaster=new j.Raycaster,this.raycaster.linePrecision=ie,this.matrix=new j.Matrix4,this.filter=0,this.path=[],this.pickTarg=0,this.pickList=[],this.pickNum=1,this.obj=null}return U(e,[{key:"add",value:function(e){for(var t in this.pickList)if(this.pathCompare(this.pickList[t].path,e.path))return this.pickList[t].depth>e.depth?(this.pickList[t].depth=e.depth,void(this.pickList[t].point=e.point)):void 0;this.pickList.push(e)}},{key:"sort",value:function(){this.bubbleSort(this.pickList)}},{key:"bubbleSort",value:function(e){for(var t=!0,n=e.length,r=0;rt.depth?-1:0}},{key:"pathCompare",value:function(e,t){if(e.length==t.length){for(var n=0;n0){var i=new he;i.depth=r.pickList[0].depth,i.point=r.pickList[0].point;for(var a in r.path)i.path.push(r.path[a]);i.matrix=r.matrix.clone(),e.add(i),e.sort()}}}else e.matrix.multiply(this.matrix),this.part.pick(e),e.matrix=t}e.path.pop()}}},{key:"pickPnt",value:function(e){if(e.path.push(this.id),!this.isHide(e.path)){if(this.part){var t=e.matrix.clone();e.matrix.multiply(this.matrix),this.part.pickPnt(e),e.matrix=t}e.path.pop()}}},{key:"getHiDispData",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=[];if(null==this.part)return i;var a=e.shift();if(a==this.id){var o=void 0;o=0!=r?r.clone():new j.Matrix4;var s=o.multiply(this.matrix);0==e.length?this.part.getHiCompDispData(i,s,n,t):i=this.part.getHiDispData(e,t,n,s)}return e.unshift(a),i}},{key:"getPickDataInfo",value:function(e,t){var n=null;if(null==this.part)return n;var r=e.shift();if(r==this.id){if(0==e.length)return n={type:"component"};n=this.part.getPickDataInfo(e,t)}return e.unshift(r),n}},{key:"getHiCompDispData",value:function(e,t,n,r){r.push(this.id);var i=t.clone();i.multiply(this.matrix),this.part&&this.part.getHiCompDispData(e,i,n,r),r.pop()}},{key:"updData",value:function(e){this.matrix=e}},{key:"modifyFromScene",value:function(e,t,n){n.push(this.id);var r=t.clone();r.multiply(this.matrix),this.part&&this.part.modifyFromScene(e,r,n),n.pop()}},{key:"getCompNameTree",value:function(e,t){t.push(this.id);var n=t.slice(),r={label:this.compName,path:n,children:[]};this.part&&this.part.getCompNameTree(r.children,t),e.push(r),t.pop()}},{key:"getMatrixByPath",value:function(e,t,n){e.push(this.id);var r=n.clone();return r.multiply(this.matrix),this.pathCompare1(e,t)?(n.copy(r),!0):null!=this.part&&this.part.getMatrixByPath(e,t,r)?(n.copy(r),!0):(e.pop(),!1)}},{key:"setCompInitState",value:function(e,t,n){this.part.setState(e,t,this.id,n)}},{key:"updBoundingBox",value:function(e,t){var n=t.clone();n.multiply(this.matrix),null!=this.part&&this.part.updBoundingBox(e,n)}}]),t}(ue),fe={crtCurve:!1};j.Vector2.prototype.setFromEvent=function(e){return this.x=void 0!==e.clientX?e.clientX:e.touches&&e.touches[0].clientX,this.y=void 0!==e.clientY?e.clientY:e.touches&&e.touches[0].clientY,this},j.Vector2.prototype.setToNormalizedDeviceCoordinates=function(e,t){if(void 0!=e.layerX)this.x=e.layerX/t.offsetWidth*2-1,this.y=2*-(e.layerY/t.offsetHeight)+1;else{if(e.longTouch)return;this.x=e.touches[0].clientX/t.offsetWidth*2-1,this.y=2*-(e.touches[0].clientY/t.offsetHeight)+1}return this},fe.SHADER={vertex:"\t\t\tuniform vec3 color;\t\t\tvarying vec3 pixelNormal;\t\t\t\t\t\tvoid main() {\t\t\t\t\t\t\t\tpixelNormal = normal;\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\t\t\t\t\t\t\t}",vertexLineClipping:"\t\t\tuniform vec3 color;\t\t\tuniform vec3 clipLow;\t\t\tuniform vec3 clipHigh;\t\t\tuniform mat4 clipMat;\t\t\t\t\t\tvarying vec3 pixelNormal;\t\t\tvarying vec4 worldPosition;\t\t\tvarying vec4 camPosition;\t\t\t\t\t\tvoid main() {\t\t\t\t\t\t\t\tpixelNormal = normal;\t\t\t\tworldPosition = modelMatrix * vec4( position, 1.0 );\t\t\t\tworldPosition = clipMat * worldPosition;\t\t\t\tcamPosition = clipMat * vec4(cameraPosition, 1.0);\t\t\t\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\t\t\t\t\t\t\t}",vertexClipping:"\t\t\t#define PHYSICAL\n\t\t\tvarying vec3 vViewPosition;\n\t\t\t#ifndef FLAT_SHADED\n\t\t\t\tvarying vec3 vNormal;\n\t\t\t#endif\n\t\t\t\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\tuniform vec3 color;\t\t\tuniform vec3 clipLow;\t\t\tuniform vec3 clipHigh;\t\t\tuniform mat4 clipMat;\t\t\t\t\t\tvarying vec3 pixelNormal;\t\t\tvarying vec4 worldPosition;\t\t\tvarying vec4 camPosition;\t\t\t\t\t\tvoid main() {\t\t\t\t\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t\n\t\t\t\t#ifndef FLAT_SHADED\n\t\t\t\t\tvNormal = normalize( transformedNormal );\n\t\t\t\t#endif\n\t\t\t\t\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t\n\t\t\t\tvViewPosition = - mvPosition.xyz;\t\t\t\t\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t\n\t\t\t\tpixelNormal = normal;\t\t\t\tworldPosition = modelMatrix * vec4( position, 1.0 );\t\t\t\tworldPosition = clipMat * worldPosition;\t\t\t\tcamPosition = clipMat * vec4(cameraPosition, 1.0);\t\t\t\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\t\t\t\t\t\t\t}",fragment:"\t\t\tuniform vec3 color;\t\t\tvarying vec3 pixelNormal;\t\t\t\t\t\tvoid main( void ) {\t\t\t\t\t\t\t\tgl_FragColor = vec4( color, 1.0 );\t\t\t\t\t\t\t}",fragmentLineClipping:"\t\t\tuniform vec3 color;\t\t\tuniform vec3 clipLow;\t\t\tuniform vec3 clipHigh;\t\t\tuniform mat4 clipMat;\t\t\t\t\t\tvarying vec3 pixelNormal;\t\t\tvarying vec4 worldPosition;\t\t\t\t\t\tvoid main( void ) {\t\t\t\t\t\t\t\tif (\t\t\t\t\tworldPosition.x < clipLow.x\t\t\t\t\t|| worldPosition.x > clipHigh.x\t\t\t\t\t|| worldPosition.y < clipLow.y\t\t\t\t\t|| worldPosition.y > clipHigh.y\t\t\t\t\t|| worldPosition.z < clipLow.z\t\t\t\t\t|| worldPosition.z > clipHigh.z\t\t\t\t) {\t\t\t\t\t\t\t\t\t\tdiscard;\t\t\t\t\t\t\t\t\t} else {\t\t\t\t\t\t\t\t\t\tgl_FragColor = vec4( color, 1.0 );\t\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t}",fragmentClipping:"\t\t\t#define PHYSICAL\t\t\t\n\t\t\tuniform vec3 diffuse;\t\t\tuniform vec3 emissive;\t\t\tuniform float roughness;\t\t\tuniform float metalness;\t\t\tuniform float opacity;\t\t\t\n\t\t\t#ifndef STANDARD\n\t\t\t\n\t\t\t\tuniform float clearCoat;\n\t\t\t\tuniform float clearCoatRoughness;\n\t\t\t\n\t\t\t#endif\n\t\t\t\n\t\t\tvarying vec3 vViewPosition;\t\t\t\n\t\t\t#ifndef FLAT_SHADED\n\t\t\t\n\t\t\t\tvarying vec3 vNormal;\n\t\t\t\n\t\t\t#endif\n\t\t\t\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t\n\t\t\tuniform vec3 color;\t\t\tuniform vec3 clipLow;\t\t\tuniform vec3 clipHigh;\t\t\tuniform mat4 clipMat;\t\t\t\t\t\tvarying vec3 pixelNormal;\t\t\tvarying vec4 worldPosition;\t\t\t\t\t\tvoid main( void ) {\t\t\t\t\n\t\t\t\t#include \n\t\t\t\t\n\t\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\t\t\t\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\t\t\t\tvec3 totalEmissiveRadiance = emissive;\t\t\t\t\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t\n\t\t\t\t#include \n\t\t\t\t\n\t\t\t\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\t\t\t\t\n\t\t\t\tif (\t\t\t\t\t\tworldPosition.x < clipLow.x\t\t\t\t\t|| worldPosition.x > clipHigh.x\t\t\t\t\t|| worldPosition.y < clipLow.y\t\t\t\t\t|| worldPosition.y > clipHigh.y\t\t\t\t\t|| worldPosition.z < clipLow.z\t\t\t\t\t|| worldPosition.z > clipHigh.z\t\t\t\t) {\t\t\t\t\t\t\t\t\t\tdiscard;\t\t\t\t\t\t\t\t\t} else {\t\t\t\t\t\t\t\t\t\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\t\t\t\t\t\t\t\t\t}\t\t\t\t\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t\n\t\t\t}",fragmentClippingFront:"\t\t\tuniform vec3 color;\t\t\tuniform vec3 clipLow;\t\t\tuniform vec3 clipHigh;\t\t\tuniform mat4 clipMat;\t\t\t\t\t\tvarying vec3 pixelNormal;\t\t\tvarying vec4 worldPosition;\t\t\tvarying vec4 camPosition;\t\t\t\t\t\tvoid main( void ) {\t\t\t\t\t\t\t\tfloat shade = (\t\t\t\t\t3.0 * pow ( abs ( pixelNormal.y ), 2.0 )\t\t\t\t\t+ 2.0 * pow ( abs ( pixelNormal.z ), 2.0 )\t\t\t\t\t+ 1.0 * pow ( abs ( pixelNormal.x ), 2.0 )\t\t\t\t) / 3.0;\t\t\t\t\t\t\t\tif (\t\t\t\t\tworldPosition.x < clipLow.x && camPosition.x < clipLow.x\t\t\t\t\t|| worldPosition.x > clipHigh.x && camPosition.x > clipHigh.x\t\t\t\t\t|| worldPosition.y < clipLow.y && camPosition.y < clipLow.y\t\t\t\t\t|| worldPosition.y > clipHigh.y && camPosition.y > clipHigh.y\t\t\t\t\t|| worldPosition.z < clipLow.z && camPosition.z < clipLow.z\t\t\t\t\t|| worldPosition.z > clipHigh.z && camPosition.z > clipHigh.z\t\t\t\t) {\t\t\t\t\t\t\t\t\t\tdiscard;\t\t\t\t\t\t\t\t\t} else {\t\t\t\t\t\t\t\t\t\tgl_FragColor = vec4( color * shade, 1.0 );\t\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t}",invisibleVertexShader:"\t\t\tvoid main() {\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\t\t\t\tgl_Position = projectionMatrix * mvPosition;\t\t\t}",invisibleFragmentShader:"\t\t\tvoid main( void ) {\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\t\t\t\tdiscard;\t\t\t}"},fe.UNIFORMS={newClipping:function(e){var t=j.UniformsUtils.merge([j.ShaderLib.phong.uniforms,{clipLow:{type:"v3",value:new j.Vector3(-(1/0),-(1/0),-(1/0))},clipHigh:{type:"v3",value:new j.Vector3(1/0,1/0,1/0)},clipMat:{type:"m4",value:new j.Matrix4}}]);"MeshPhongMaterial"==e.type&&(t.diffuse.value=e.color,t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),t.opacity.value=e.opacity),this[e.userData.index]=t},newLine:function(e){var t=j.UniformsUtils.clone(fe.UNIFORMS.line);t.color.value=e.color,this[e.userData.index]=t},line:{color:{type:"c",value:new j.Color(0)},clipLow:{type:"v3",value:new j.Vector3(-(1/0),-(1/0),-(1/0))},clipHigh:{type:"v3",value:new j.Vector3(1/0,1/0,1/0)},clipMat:{type:"m4",value:new j.Matrix4}},clipLine:{color:{type:"c",value:new j.Color(255)},clipLow:{type:"v3",value:new j.Vector3(-(1/0),-(1/0),-(1/0))},clipHigh:{type:"v3",value:new j.Vector3(1/0,1/0,1/0)},clipMat:{type:"m4",value:new j.Matrix4}},preHiLine:{color:{type:"c",value:new j.Color(16776960)},clipLow:{type:"v3",value:new j.Vector3(-(1/0),-(1/0),-(1/0))},clipHigh:{type:"v3",value:new j.Vector3(1/0,1/0,1/0)},clipMat:{type:"m4",value:new j.Matrix4}},hiLine:{color:{type:"c",value:new j.Color(15641870)},clipLow:{type:"v3",value:new j.Vector3(-(1/0),-(1/0),-(1/0))},clipHigh:{type:"v3",value:new j.Vector3(1/0,1/0,1/0)},clipMat:{type:"m4",value:new j.Matrix4}},clipping:j.UniformsUtils.merge([j.ShaderLib.phong.uniforms,{clipLow:{type:"v3",value:new j.Vector3(-(1/0),-(1/0),-(1/0))},clipHigh:{type:"v3",value:new j.Vector3(1/0,1/0,1/0)},clipMat:{type:"m4",value:new j.Matrix4}}]),caps:{color:{type:"c",value:new j.Color(10395294)}}},fe.MATERIAL={meshMaterial:{},lineMaterial:{},backMaterial:null,frontMaterial:null,generateMaterial:function(e){if(e.children.length)for(var t=0;t2&&void 0!==arguments[2]?arguments[2]:1,r=.1*(t.x-e.x),i=.1*(t.y-e.y),a=.1*(t.z-e.z);this.lowest={x:e.x-r,y:e.y-i,z:e.z-a},this.highest={x:t.x+r,y:t.y+i,z:t.z+a},this.limitLow=Object.assign({},this.lowest),this.limitHigh=Object.assign({},this.highest),this.matrix=new j.Matrix4;var o=new j.Vector3(0,0,1),s=new j.Vector3(0,1,0),c=new j.Matrix4,l=new j.Matrix4;c.makeRotationAxis(o,Math.PI/8),l.makeRotationAxis(s,Math.PI/4),this.box=new j.BoxGeometry(1,1,1),this.boxMesh=new j.Object3D,this.vertices=[new j.Vector3,new j.Vector3,new j.Vector3,new j.Vector3,new j.Vector3,new j.Vector3,new j.Vector3,new j.Vector3];var u=this.vertices;this.touchMeshes=new j.Object3D,this.displayMeshes=new j.Object3D,this.displayMeshes.name="labelPnt",this.meshGeometries=[],this.lineGeometries=[],this.selectables=[],this.pntList=[];for(var h in this.vertices){var p=Ze.clone();p.position.copy(this.vertices[h]),this.pntList.push(p),p.scale.set(n,n,n),this.displayMeshes.add(p)}this.updateVertices(),this.faces=[];var d=this.faces;this.faces.push(new fe.SelectionBoxFace("y1",u[0],u[1],u[5],u[4],this)),this.faces.push(new fe.SelectionBoxFace("z1",u[0],u[2],u[3],u[1],this)),this.faces.push(new fe.SelectionBoxFace("x1",u[0],u[4],u[6],u[2],this)),this.faces.push(new fe.SelectionBoxFace("x2",u[7],u[5],u[1],u[3],this)),this.faces.push(new fe.SelectionBoxFace("y2",u[7],u[3],u[2],u[6],this)),this.faces.push(new fe.SelectionBoxFace("z2",u[7],u[6],u[4],u[5],this));new fe.SelectionBoxLine(u[0],u[1],d[0],d[1],this),new fe.SelectionBoxLine(u[0],u[2],d[1],d[2],this),new fe.SelectionBoxLine(u[0],u[4],d[0],d[2],this),new fe.SelectionBoxLine(u[1],u[3],d[1],d[3],this),new fe.SelectionBoxLine(u[1],u[5],d[0],d[3],this),new fe.SelectionBoxLine(u[2],u[3],d[1],d[4],this),new fe.SelectionBoxLine(u[2],u[6],d[2],d[4],this),new fe.SelectionBoxLine(u[3],u[7],d[3],d[4],this),new fe.SelectionBoxLine(u[4],u[5],d[0],d[5],this),new fe.SelectionBoxLine(u[4],u[6],d[2],d[5],this),new fe.SelectionBoxLine(u[5],u[7],d[3],d[5],this),new fe.SelectionBoxLine(u[6],u[7],d[4],d[5],this);this.setUniforms()},fe.Selection.prototype={constructor:fe.Selection,updateVertices:function(){this.vertices[0].set(this.limitLow.x,this.limitLow.y,this.limitLow.z),this.vertices[1].set(this.limitHigh.x,this.limitLow.y,this.limitLow.z),this.vertices[2].set(this.limitLow.x,this.limitHigh.y,this.limitLow.z),this.vertices[3].set(this.limitHigh.x,this.limitHigh.y,this.limitLow.z),this.vertices[4].set(this.limitLow.x,this.limitLow.y,this.limitHigh.z),this.vertices[5].set(this.limitHigh.x,this.limitLow.y,this.limitHigh.z),this.vertices[6].set(this.limitLow.x,this.limitHigh.y,this.limitHigh.z),this.vertices[7].set(this.limitHigh.x,this.limitHigh.y,this.limitHigh.z);for(var e=(new j.Matrix4).getInverse(this.matrix),t=0;t<8;t++)this.vertices[t].applyMatrix4(e),this.pntList[t].position.copy(this.vertices[t])},updateGeometries:function(){for(var e=0;e1&&void 0!==arguments[1])||arguments[1],n=this;if(t){e.selection.reset(!0);var r={DRAG:0},i=null,a=new j.Vector2,o=new j.Raycaster,s={x1:new j.Vector3(-1,0,0),x2:new j.Vector3(1,0,0),y1:new j.Vector3(0,-1,0),y2:new j.Vector3(0,1,0),z1:new j.Vector3(0,0,-1),z2:new j.Vector3(0,0,1)},c=e._getSceneBoundingBox(),l=c.max,u=c.min,h=120*Math.max(l.x-u.x,l.y-u.y,l.z-u.z);n.plane=new j.Mesh(new j.PlaneGeometry(h,h,4,4),new j.MeshBasicMaterial({color:16776960,side:j.DoubleSide,visible:!1})),e._scene.add(n.plane),e.throttledRender(),n.targeting=function(t){if(!("touchmove"==t.type&&t.touches.length>1)){a.setToNormalizedDeviceCoordinates(t,e._renderer.domElement),o.setFromCamera(a,e._actCamera);var n=o.intersectObjects(e.selection.selectables);if(n.length>0){var r=n[0].object;i!==r&&(null!==i&&i.guardian.rayOut(),r.guardian.rayOver(),i=r,e._renderer.domElement.style.cursor="pointer",e.throttledRender())}else null!==i&&(i.guardian.rayOut(),i=null,e._renderer.domElement.style.cursor="auto",e.throttledRender())}},n.beginDrag=function(t){if(!t.button||t.button==r.DRAG){a.setToNormalizedDeviceCoordinates(t,e._renderer.domElement),o.setFromCamera(a,e._actCamera);var i=o.intersectObjects(e.selection.selectables);if(i.length>0){t.preventDefault(),t.stopPropagation(),e._control.setEnabled(!1);var c=i[0].point,l=i[0].object.axis;"x1"===l||"x2"===l?c.setX(0):"y1"===l||"y2"===l?c.setY(0):"z1"!==l&&"z2"!==l||c.setZ(0),n.plane.position.copy(c);var u=e._actCamera.position.clone().sub(e._actCamera.position.clone().projectOnVector(s[l]));n.plane.lookAt(u.sub(c)),e._renderer.domElement.style.cursor="move",e.throttledRender();var h=function(t){if("touchmove"==t.type&&t.touches.length>1)t.touches.length>1&&e._control.setEnabled(!0);else{t.stopPropagation(),e._control.setEnabled(!1),a.setToNormalizedDeviceCoordinates(t,e._renderer.domElement), o.setFromCamera(a,e._actCamera);var r,i=o.intersectObject(n.plane);i.length>0&&("x1"===l||"x2"===l?r=i[0].point.x:"y1"===l||"y2"===l?r=i[0].point.y:"z1"!==l&&"z2"!==l||(r=i[0].point.z),e.removeClipCurves(),e.selection.setValue(l,r),e.throttledRender())}},p=function t(n){fe.crtCurve&&e.createClipCurves(),e._control.setEnabled(!0),e._renderer.domElement.style.cursor="pointer",document.removeEventListener("mousemove",h,!0),e.signals.touchMove.remove(h),document.removeEventListener("mouseup",t,!1),document.removeEventListener("touchend",t,!1),document.removeEventListener("touchcancel",t,!1),document.removeEventListener("touchleave",t,!1),e.throttledRender()};document.addEventListener("mousemove",h,!0),e.signals.touchMove.add(h),document.addEventListener("mouseup",p,!1),document.addEventListener("touchend",p,!1),document.addEventListener("touchcancel",p,!1),document.addEventListener("touchleave",p,!1)}}},e._renderer.domElement.addEventListener("mousemove",n.targeting,!0),e.signals.touchMove.add(n.targeting),e._renderer.domElement.addEventListener("mousedown",n.beginDrag,!1),e.signals.touchStart.add(n.beginDrag)}else e.selection.reset(t),e._scene.remove(n.plane),e._renderer.domElement.removeEventListener("mousemove",n.targeting,!0),e._renderer.domElement.removeEventListener("touchmove",n.targeting,!0),e._renderer.domElement.removeEventListener("mousedown",n.beginDrag,!1),e.signals.touchStart.remove(n.beginDrag)};var me=function(){function e(t,n,r,i){s(this,e),this.viewer=t,this.scene=n,this.backStencil=r,this.frontStencil=i,this.parts=[],this.actPart=null,this.pin=null,this.hiObj=[],this.box=null,this.boxFlag=!1}return U(e,[{key:"checkPart",value:function(e){for(var t in this.parts){var n=this.parts[t].compare(e);if(null!=n)return!0}return!1}},{key:"checkPartUuid",value:function(e){for(var t in this.parts)if(this.parts[t].fileuuid==e)return!0;return!1}},{key:"getKF",value:function(e,t,n,r){for(var i in this.parts)return this.parts[i].getKF(e,t,n,r)}},{key:"addPart",value:function(e){e.parent=this,e.active&&this.actPart!=e&&(this.actPart=e);for(var t in this.parts)if(this.parts[t].partName==e.partName){if(this.parts[t].fileuuid==e.fileuuid)return;e.partName=e.partName+"_"+Math.random().toString(36).slice(-4);break}this.updComps(e),e.updDispData(),this.parts.push(e)}},{key:"updComps",value:function(e){for(var t in this.parts)this.parts[t].updComp(e),e.updComp(this.parts[t])}},{key:"setActPart",value:function(e){this.actPart!=e&&(this.actPart=e)}},{key:"buildDisp",value:function(e,t,n,r){if(null!=this.actPart){var i=new j.Matrix4,a=[];if(this.actPart==e)e.addToScene(this.scene,i,a,t,n,r);else{var o=[],s=[];if(this.actPart.getMatrix(e,i,o),this.actPart.getPath(e,a,s),o.length>0)for(var c in o){var l=o[c];a=s[c],e.addToScene(this.scene,l,a,t,n,r)}}}}},{key:"buildLabelDisp",value:function(e){var t=[];e.addToScene(this.scene,t)}},{key:"rebuildDims",value:function(){this.actPart.rebuildDims(this.scene)}},{key:"reBuildScene",value:function(e,t){if(this.actPart){var n=this.getBoundingBox(),r=new j.Vector3;n.getCenter(r);var i=new j.Matrix4,a=[];this.actPart.reBuildScene(this.scene,this.backStencil,this.frontStencil,r,i,e,a,t)}}},{key:"pick",value:function(e){this.actPart&&this.actPart.pick(e)}},{key:"pickPnt",value:function(e){this.actPart&&this.actPart.pickPnt(e)}},{key:"drawHiLight",value:function(){if(null!=this.pin){for(var e in this.hiObj)this.scene.remove(this.hiObj[e]),this.hiObj[e].geometry.dispose();if(this.hiObj=[],this.pin.pickList.length>0){var t=this.actPart.getHiDispData(this.pin.pickList[0].path,this.pin.pickList[0].path.slice(0),!0);if(0!=t.length)for(var n in t)t[n].matrixAutoUpdate=!1,t[n].applyMatrix(this.pin.pickList[0].matrix),this.scene.add(t[n]),this.hiObj.push(t[n])}}}},{key:"getHiDispData",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(this.actPart){var r=this.actPart.getHiDispData(e.path,e.path.slice(0),t),i=new j.Vector3;if(this.box.getCenter(i),0!=r.length)for(var a in r){r[a].matrixAutoUpdate=!1;var o=new j.Vector3;if(r[a].hasOwnProperty("boundingBox")){if(r[a].boundingBox.getCenter(o),o.applyMatrix4(r[a].matrix),0!=n){var s=i.distanceTo(o);if(s>.001){var c=new j.Vector3;c.subVectors(o,i).normalize(),c.multiplyScalar(s*n/50);var l=r[a].position.clone();l.add(c),r[a].position.copy(l)}}}else r[a].applyMatrix(e.matrix),1==t?r[a].material=fe.MATERIAL.getHiMateral():r[a].material=fe.MATERIAL.getPreHiMateral();r[a].updateMatrix()}e.dispData=r}}},{key:"getPickDataInfo",value:function(e){if(this.actPart){var t=null;return t=this.actPart.getPickDataInfo(e.path,e.matrix)}}},{key:"updBoundingBox",value:function(){if(this.box=new j.Box3,this.actPart){var e=new j.Matrix4;this.actPart.updBoundingBox(this.box,e)}}},{key:"getBoundingBox",value:function(){return this.box||this.updBoundingBox(),this.box}},{key:"setBoundingBox",value:function(e){this.box=e,this.boxFlag=!0}},{key:"amendBoundingBox",value:function(){for(var e=0;e>2&1,Le.pmi=!1,Le.meas=Ce>>6&1,Le.ani=Ce>>8&1;var Ae=CreateDracoModule({}),ke=function(){function e(t,n){s(this,e),this.manager=void 0!==n?n:j.DefaultLoadingManager,this.texturePath="",this.partManager=t,this.onLoad=null,this.onProgress=null,this.onError=null,this.labelOnLoad=null,this.url=null,this.version=1,this.imageMap={},this.dracodataMap={},this.fileuuidMap={},this.decoder=new Ae.Decoder,this.partCnt=1,this.ipart=0}return U(e,[{key:"load",value:function(e,t,n,r,i){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var a=this,o=(e.substr(e.length-3),new Date);this.onLoad=n;var s=new j.FileLoader(a.manager);s.setWithCredentials(!0),s.setRequestHeader({Authorization:localStorage.getItem("auth-token"),"c-cadbro-frontend":"web"}),/z3ds/i.test(e)?(s.setResponseType("arraybuffer"),s.load(e,function(e){var t=512,n=z.Buffer.from(e),r=n.toString();if(/^{.+}$/.test(r)){var i=JSON.parse(r);return console.log(i.code),void alert(i.msg)}/DOCTYPE/.test(r)&&parent.location.reload(),r=null,e=null;for(var s=z.Buffer.from(n.subarray(0,t),"ascii"),c="",l=0;l<128;l++)c+=String.fromCharCode(n[l]);var u=s.indexOf(","),h=null;if(u!=-1){var p=c.indexOf(",",u+1);p>0&&(h=c.slice(u+1,p).toString())}for(var d="",f=128;f<256;f++)d+=String.fromCharCode(n[f]);var m=d.indexOf(","),v=1*parseFloat(d.slice(0,m).toString());console.log(s.toString());var g=null;if(v>=3)for(var y=t;y=1.2){var C=S.images;for(var L in C){var A=a.parseImage(C[L]);a.imageMap[A.uuid]=A}}void 0!=P&&"part"==P&&a.parsePart(S,S.parts.length?-1:1)}S=null;var k=new Date;console.log("load time:"+(k.getTime()-o.getTime())+"ms")},r,i)):/z3dl/i.test(e)&&s.load(e,function(e){var t=JSON.parse(e);e=null;var n=t.metadata;if(void 0!=n){var r=n.type;if(a.version=n.version,a.version>=1.2){var i=t.images;for(var s in i){var c=a.parseImage(i[s]);a.imageMap[c.uuid]=c}}void 0!=r&&"part"==r&&a.parsePart(t,t.parts.length?-1:1)}t=null;var l=new Date;console.log("load time:"+(l.getTime()-o.getTime())+"ms")},r,i)}},{key:"loadStr",value:function(e,t,n){var r=this;this.onLoad=n;var i=z.Buffer.from(e,"base64");e=null;var a=H.default.inflate(i,{to:"string"});i=null;var o=JSON.parse(a);a=null;var s=o.metadata;if(void 0!=s){var c=s.type;if(r.version=s.version,r.version>=1.2){var l=o.images;for(var u in l){var h=r.parseImage(l[u]);r.imageMap[h.uuid]=h}}void 0!=c&&"part"==c&&r.parsePart(o,o.parts.length?-1:1)}o=null}},{key:"loadMulti",value:function(e,t,n,r,i,a){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,s=this;this.onLoad=t,this.onProgress=n,this.onError=r;var c=new j.FileLoader(s.manager);c.setWithCredentials(!0),c.setRequestHeader({Authorization:localStorage.getItem("auth-token"),"c-cadbro-frontend":"web"}),c.setResponseType("arraybuffer"),c.load(e,function(t){var r=512,c=z.Buffer.from(t);t=null;for(var l=z.Buffer.from(c.subarray(0,r),"ascii"),u="",h=0;h<128;h++)u+=String.fromCharCode(c[h]);var p=l.indexOf(","),d=null;if(p!=-1){var f=u.indexOf(",",p+1);f>0&&(d=u.slice(p+1,f).toString())}for(var m="",v=128;v<256;v++)m+=String.fromCharCode(c[v]);var g=m.indexOf(","),y=1*parseFloat(m.slice(0,g).toString());s.version=y;var b=null,_=null,w=null,x=a,M=!1;if(y>=3)for(var E=r;E=3&&this.dracodataMap.hasOwnProperty(o)){var f=this.dracodataMap[o],m=new Ae.DecoderBuffer;m.Init(f,f.byteLength);var v=new Ae.Mesh,g=this.decoder.DecodeBufferToMesh(m,v);if(Ae.destroy(m),!g.ok())return void console.error(g.error_msg());var y=v.num_faces(),b=v.num_points(),_={POSITION:3,NORMAL:3,TEX_COORD:2};Object.keys(_).forEach(function(e){var t=_[e],n=b*t,r=Ae[e],a=i.decoder.GetAttributeId(v,r);if(!(a<0)){var o=i.decoder.GetAttribute(v,a),s=new Ae.DracoFloat32Array;i.decoder.GetAttributeFloatForAllPoints(v,o,s);for(var c=new Float32Array(n),l=0;l=3?this.parseShapeV3(R[I],l.materials,u,h,p,d,l):this.parseShape(R[I],l.materials,l);l.shapes.push(N)}u=null,h=null,p=null,d=null;var B=e.edges;for(var U in B){var F=this.parseEdge(B[U],l);F&&l.edges.push(F)}var z=e.wires;for(var V in z){var H=this.parseWire(z[V],l.materials,l);l.wires.push(H)}var G=e.dims;for(var W in G){var q=this.parseDim(G[W],l.materials,l);l.dims.push(q)}if(!this.partManager.viewer._isTpl&&Le.ani){var Y=e.expViews;for(var X in Y){var Z=this.parseExpView(Y[X],l);l.expViews.push(Z)}var J=e.animations;if(J)for(var K in J){var $=this.parseAnim(J[K],l);l.anims.push($)}}var Q=e.lim;if(Q){var ee=this.parseLim(Q);l.active&&this.partManager.setBoundingBox(ee)}var te=e.toolsdims;for(var ne in te)if([1,5,9,13,21,25,31,44,48,64].indexOf(te[ne].type)!=-1){var re=this.parseLabel(te[ne],parent);l.toolsDims.push(re)}this.partManager.addPart(l);var ie=this;new Promise(function(e){ie.onLoad(l,t),e()});var ae=e.parts;ae&&this.parseParts(e.parts)}},{key:"parsePartMulti",value:function(e,t,n){var r=this,i=e.vsuid?e.vsuid.join("-"):j.Math.generateUUID(),a=Math.floor(1e7*Math.random())+0;t.id=a,t.uuid=i;var o=void 0,s=void 0,c=void 0,l={};if(n){var u=new Ae.DecoderBuffer;u.Init(n,n.byteLength);var h=new Ae.Mesh,p=this.decoder.DecodeBufferToMesh(u,h);if(Ae.destroy(u),!p.ok())return void console.error(p.error_msg());var d=h.num_faces(),f=h.num_points(),m={POSITION:3,NORMAL:3,TEX_COORD:2};Object.keys(m).forEach(function(e){var t=m[e],n=f*t,i=Ae[e],a=r.decoder.GetAttributeId(h,i);if(!(a<0)){var l=r.decoder.GetAttribute(h,a),u=new Ae.DracoFloat32Array;r.decoder.GetAttributeFloatForAllPoints(h,l,u);for(var p=new Float32Array(n),d=0;d=1.2&&(r.size=e.size,r.type=e.type,r.trans=e.trans/100,r.image=void 0==this.imageMap[e.tex]?null:this.imageMap[e.tex]),r}},{key:"parseShape",value:function(e,t,n){var r=e.vsuid?e.vsuid.join("-"):j.Math.generateUUID(),i=e.id,a=new Ne(r,i,n),o=e.faces;for(var s in o){var c=this.parseFace(o[s],t,a);a.faces.push(c)}var l=e.edges;for(var u in l){var h=this.parseEdge(l[u],n);h&&n.edges.push(h)}return a}},{key:"parseShapeV3",value:function(e,t,n,r,i,a,o){var s=e.vsuid?e.vsuid.join("-"):j.Math.generateUUID(),c=e.id,l=new Ne(s,c,o),u=e.faces;for(var h in u){var p=this.parseFaceV3(u[h],t,n,r,i,a,l);l.faces.push(p)}var d=e.edges;for(var f in d){var m=this.parseEdge(d[f],o);m&&o.edges.push(m)}return l}},{key:"parseFace",value:function(e,t,n){var r=e.vsuid?e.vsuid.join("-"):j.Math.generateUUID(),i=e.id,a=t[e.material],o=e.v,s=e.u,c=e.n,l=e.t,u=new Te(r,i,n);if(u.material=a,u.vertices=o,s.length>0)for(var h=0;h0&&h.normals.push(r[3*p[f]+g]);i&&i.length>0&&h.uvs.push(new j.Vector2(i[2*p[f]],i[2*p[f]+1])),h.tris.push(v)}else if(e.v){var y=e.v,b=e.u,_=e.n,w=e.t;if(h.vertices=y,b.length>0)for(var x=0;x1&&void 0!==arguments[1]?arguments[1]:{},n=e.id,r=e.vsuid?e.vsuid.join("-"):j.Math.generateUUID(),i=new Ye(r,n,t);i.type=e.type,i.leaderTyp=e.leaderTyp,i.text=e.strElem,e.strElem&&e.strElem.indexOf("[Val]")!=-1&&(i.isBox=!0),i.val=e.val,i.dimVar=e.dimVar;var a=(new j.Matrix4).fromArray(e.matrix);i.matrix=a;for(var o in e.ptsElem)i.points.push(e.ptsElem[o]);return i}},{key:"parseGeom",value:function(e,t,n,r,i,a){var o=null;if("Ncurve"==n){o=new Re(e,t,a),o.degree=r.d;for(var s=0;s0){var n=0;this.parsePartFunc(e,n,t)}}},{key:"parsePartFunc",value:function(e,t,n){var r=this,i=0;t==n-1?i=1:(t<2||t%10==1)&&(i=-1),t=n[r])return r-1;if(t<=n[e])return e;for(var i=e,a=r,o=Math.floor((i+a)/2);t=n[o+1];)t=S&&(M[x][0]=M[w][0]/l[C+1][P],T=M[x][0]*l[P][C]);for(var L=P>=-1?1:-P,A=_-1<=C?S-1:n-_,k=L;k<=A;++k)M[x][k]=(M[w][k]-M[w][k-1])/l[C+1][P+k],T+=M[x][k]*l[P+k][C];_<=C&&(M[x][S]=-M[w][S-1]/l[C+1][_],T+=M[x][S]*l[_][C]),s[S][_]=T;var O=w;w=x,x=O}}for(var D=n,R=1;R<=r;++R){for(var I=0;I<=n;++I)s[R][I]*=D;D*=n-R}return s},calcBSplineDerivatives:function(e,t,n,r,i){for(var a=ii||!this.threePointsAreFlat(n,s,r,i)){var u=e+.5*(t-e),h=this.rationalCurveAdaptiveSampleRange(e,u,n,s,i),p=this.rationalCurveAdaptiveSampleRange(u,t,s,r,i);return h.slice(0,-1).concat(p)}return[n,r]},rationalCurveAdaptiveSample:function(e,t,n,r,i){for(var a=n,o=new j.Vector3,s=r,c=[[e,t,a,s]],l=[],u=new j.Vector3,h=new j.Vector3;c.length>0;){var p=c.pop(),d=p[0],f=p[1],m=d+(f-d)*(.5+.2*Math.random());if(a=p[2],o=this.getPoint(m),s=p[3],u.subVectors(a,s),h.subVectors(a,o),u.dot(u)i||!this.threePointsAreFlat(a,o,s,i)){var v=d+.5*(f-d),g=this.getPoint(v);c.push([v,f,g,s]),c.push([d,v,a,g])}else l=0==l.length?[a,s]:l.slice(0,-1).concat([a,s])}return l},threePointsAreFlat:function(e,t,n,r){var i=(new j.Vector3).subVectors(t,e),a=(new j.Vector3).subVectors(n,e),o=(new j.Vector3).crossVectors(i,a),s=o.dot(o);return s2&&void 0!==arguments[2]?arguments[2]:.5,r=new j.Vector3;return r.x=e.x+n*(t.x-e.x),r.y=e.y+n*(t.y-e.y),r.z=e.z+n*(t.z-e.z),r}},{key:"calcIsectLineLine",value:function(e,t,n,r){var i=new j.Vector3;i.subVectors(n,e);var a=new j.Vector3;a.crossVectors(t,r);var o=new j.Vector3;o.crossVectors(i,r);var s=o.dot(a)/a.lengthSq(),c=new j.Vector3,l=t.clone();return c.addVectors(e,l.multiplyScalar(s)),c}},{key:"calcMatrix",value:function(e,t,n,r){var i,a;i=(new j.Vector3).subVectors(t,e).normalize(),a=(new j.Vector3).crossVectors(r,i).normalize();var o=new j.Matrix4;return o.set(i.x,a.x,r.x,e.x,i.y,a.y,r.y,e.y,i.z,a.z,r.z,e.z,0,0,0,1),o}},{key:"calcAngle",value:function(e,t,n){var r=new j.Vector3,i=new j.Vector3;r.subVectors(t,e).normalize(),i.subVectors(n,e).normalize();var a=r.dot(i),o=Math.acos(a);return o}},{key:"calPlane",value:function(e,t,n){var r=new j.Vector3,i=new j.Vector3,a=new j.Vector3;return r.subVectors(e,t),i.subVectors(n,t),a.crossVectors(r,i).normalize(),a}},{key:"distPtoLine",value:function(e,t,n){var r=0,i=new j.Vector3,a=new j.Vector3,o=new j.Vector3;return i.subVectors(e,t),a.subVectors(n,t),o.crossVectors(i,a),r=Math.abs(o.length()/a.length())}},{key:"isSameVector",value:function(e,t){var n=new j.Vector3;return n.subVectors(e,t),n.length()<1e-5}},{key:"isLineParallel",value:function(e,t,n,r){var i=new j.Vector3,a=new j.Vector3,o=new j.Vector3;i.subVectors(e,t).normalize(),a.subVectors(n,r).normalize(),o.subVectors(e,n).normalize();var s=o.dot(i);return!(s-1>-1e-5&&s-1<1e-5||s+1>-1e-5&&s+1<1e-5||0==o.length())&&(s=i.dot(a),s-1>-1e-5&&s-1<1e-5||s+1>-1e-5&&s+1<1e-5)}},{key:"isPointsCollinear",value:function(e,t,n){var r=new j.Vector3,i=new j.Vector3;return r.subVectors(e,t).normalize(),i.subVectors(e,n).normalize(),i.length()<1e-5&&i.length()>-1e-5&&i.subVectors(t,n).normalize(),!(!this.isSameVector(r,i)&&!this.isSameVector(r,i.clone().multiplyScalar(-1)))}},{key:"isLineCollinear",value:function(e,t){return!(!this.isPointsCollinear(e[0],e[1],t[0])||!this.isPointsCollinear(e[0],e[1],t[1]))}},{key:"isSamePlane",value:function(e,t,n,r){var i=new j.Vector3;i.subVectors(n,e);var a=new j.Vector3;a.crossVectors(t,r);var o=i.dot(a);return!(o>=1e-5||o<=-1e-5)}},{key:"getAngleFromX",value:function(e){var t=new j.Vector3(1,0,0),n=e.angleTo(t);return e.y<-1e-5&&(n=2*Math.PI-n),n}}]),e}(),De=new Oe,Re=function(e){function t(e,n,r){s(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return i.degree=3,i.controlPoints=[],i.knots=[],i.material=null,i.dispData=null,i.cloneMap={},i.dispPoints=[],i}return o(t,e),U(t,[{key:"merge",value:function(e,t,n){var r=t.length;if(this.dispPoints.length<=0){var i=new b(this.degree,this.knots,this.controlPoints);this.knots[this.knots.length-1]>1?this.dispPoints=i.getPoints(5*this.controlPoints.length):this.dispPoints=i.getPoints2(.1),i=null}for(var a=e.length/3,o=0;o0&&void 0!==arguments[0]?arguments[0]:5,t=new b(this.degree,this.knots,this.controlPoints),n=t.getPoints(this.controlPoints.length*e);return t=null,n}},{key:"getPtsAndLen",value:function(e){for(var t=this.getPoints(100),n=0,r=0;r1?this.dispPoints=e.getPoints(5*this.controlPoints.length):this.dispPoints=e.getPoints2(.1),e=null}}]),t}(ue),Ie=function(e){function t(e,n,r,i){s(this,t);var o=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return o.fileName=r,o.partName=i,o.comps=[],o.shapes=[],o.edges=[],o.seemEdges=[],o.materials={},o.active=!1,o.box=new j.Box3,o.faceDispDatas=[],o.edgeDispData=null,o.edgeMapId={},o.wireDispDatas=[],o.wireCloneMap={},o.wireMapId={},o.bboxDispData=null,o.wires=[],o.dims=[],o.expViews=[],o.anims=[],o.toolsDims=[],o.factor=0,o.group=new j.Group,o.toolsDimsGroup=new j.Group,o.boundingFlag=!1,o.compUid2Id=new Map,o.tmp=null,o.fileuuid=null,o}return o(t,e),U(t,[{key:"updComp",value:function(e){for(var t in this.comps)this.comps[t].updComp(e)}},{key:"compare",value:function(e){return this.partName==e?this:null}},{key:"compareUuid",value:function(e){return this.fileuuid==e?this:null}},{key:"updDispData",value:function(){this.group=new j.Group,this.group.type="Part";var e={};for(var t in this.shapes)this.shapes[t].updDispData(this.group,e);for(var n in e){var r=e[n],i=new j.BufferGeometry,a=r.material.getFaceMat();i.setIndex(r.tris),i.addAttribute("position",new j.Float32BufferAttribute(r.vertices,3)),i.addAttribute("normal",new j.Float32BufferAttribute(r.normals,3)),r.uvs.length>0&&i.addAttribute("uv",new j.Float32BufferAttribute(r.uvs,2)),i.computeBoundingSphere();var o=new j.Mesh(i,a);this.faceDispDatas.push(o),this.group.add(o),l(r.vertices.length),c(o.geometry.getIndex().count/3)}if(this.active){this.updWire(this.group);for(var s in this.dims)this.dims[s].updDispData(this.group);for(var u in this.toolsDims)this.toolsDims[u].updDispData(this.toolsDimsGroup,[this.id])}this.updEdge(this.group),this.box.setFromObject(this.group),this.group.userData.isComp=this.comps.length>0}},{key:"updateGroup",value:function(e,t){if(this.group=new j.Group,this.group.userData.isComp=this.comps.length>0,this.toolsDimsGroup=new j.Group,this.toolsDimsGroup.type="DimGroup",this.group.type="Part",3!=t)for(var n in this.faceDispDatas)this.group.add(this.faceDispDatas[n]);if(!e||0==e.length){for(var r in this.wireDispDatas)this.group.add(this.wireDispDatas[r]);for(var i in this.dims)this.dims[i].updateGroup(this.group,e,t);for(var a in this.toolsDims)this.toolsDims[a].updateGroup(this.toolsDimsGroup)}1!=t&&2!=t&&this.edgeDispData&&this.group.add(this.edgeDispData)}},{key:"updateDimGroup",value:function(){this.toolsDimsGroup=new j.Group,this.toolsDimsGroup.type="DimGroup";for(var e in this.toolsDims)this.toolsDims[e].updateGroup(this.toolsDimsGroup)}},{key:"updWire",value:function(e){if(0!=this.wires.length){var t=[],n=[],r={};for(var i in this.wires){var a=this.wires[i].material.uuid;if(void 0==r[a]){var o=[],s=[];this.wireMapId[a]={},r[a]=[o,s,this.wires[i].material],this.wires[i].merge(o,s,this.wireMapId[a])}else{var c=r[a][0],l=r[a][1];this.wires[i].merge(c,l,this.wireMapId[a])}}for(var u in r){t=r[u][0],n=r[u][1];var h=r[u][2],p=new j.BufferGeometry;p.addAttribute("position",new j.Float32BufferAttribute(t,3)),p.setIndex(n);var d=new j.LineSegments(p,h.getLineMat());d.type="Wire",this.wireDispDatas[u]=d,this.wireDispDatas.length++,e.add(d)}}}},{key:"updEdge",value:function(e){if(0!=this.edges.length){var t=new j.BufferGeometry,n=[],r=[];this.edgeMapId={};for(var i in this.edges)this.edges[i].merge(n,r,this.edgeMapId);t.addAttribute("position",new j.Float32BufferAttribute(n,3)),t.setIndex(r),this.edgeDispData=new j.LineSegments(t,we),this.edgeDispData.type="Edge",e.add(this.edgeDispData)}}},{key:"addToScene",value:function(e,t,n,r,i,a,o){if(!this.hideFlag){n.push(this.id),g((n.length-1)/2),this.updateGroup(r,i,a);var s=this.group.clone();s.type="Part",s.name=this.partName,s.matrixAutoUpdate=!1,s.applyMatrix(t),s.path=n.slice(),fe.MATERIAL.generateMaterial(s);var c=this.box.clone();c.applyMatrix4(t),s.userData.box=c,s.updateMatrix(),this.toolsDimsGroup.children.length>0&&(this.toolsDimsGroup.type="DimGroup",e.add(this.toolsDimsGroup)),e.add(s),o&&o();for(var l in this.comps)this.comps[l].addToScene(e,t,n,r,i,a);n.pop()}}},{key:"rebuildDims",value:function(e){this.toolsDimsGroup=new j.Group,this.toolsDimsGroup.type="DimGroup";for(var t in this.toolsDims)this.toolsDims[t].updateGroup(this.toolsDimsGroup);e.children[3]=this.toolsDimsGroup}},{key:"setPartCenter",value:function(e,t){this.boundingBox||(this.boundingBox=new j.Box3,this.boundingBox.setFromObject(e));var n=new j.Vector3,r=this.boundingBox.clone();return r.getCenter(n),n.applyMatrix4(t),n}},{key:"reBuildScene",value:function(e,t,n,r,i,a,o,s){o.push(this.id),this.updateGroup(a,s);var c=this.group.clone();c.matrixAutoUpdate=!1,c.applyMatrix(i),c.type="Part",c.name="Part",c.path=o.slice();var l=this.box.clone();if(l.applyMatrix4(i),c.userData.box=l,c.updateMatrix(),0!=this.group.children.length&&(c.partCenter=this.setPartCenter(this.group,i)),"Scene"==e.type){var u=this.toolsDimsGroup;e.add(u)}if(e.add(c),this.comps.length){var h=new j.Group;h.type="Group",h.name="Group",e.add(h);for(var p in this.comps)this.comps[p].reBuildScene(h,t,n,r,i,a,o,s);0==this.group.children.length&&(c.partCenter=this.setPartCenter(h,i))}c.partCenter||(c.partCenter=this.setPartCenter(this.group,i)),o.pop()}},{key:"getMatrix",value:function(e,t,n){for(var r in this.comps)this.comps[r].getMatrix(e,t,n)}},{key:"getPath",value:function(e,t,n){t.push(this.id);for(var r in this.comps)this.comps[r].getPath(e,t,n);t.pop()}},{key:"pick",value:function(e){if(!this.hideFlag){e.path.push(this.id);var t=e.raycaster;if(this.faceDispDatas.length>0&&e.filter&q)for(var n in this.faceDispDatas){var r=this.faceDispDatas[n].clone();r.matrixAutoUpdate=!1,r.applyMatrix(e.matrix),r.updateMatrixWorld(!0);var i=t.intersectObject(r,!0);if(i.length>0){var a=new he;a.depth=i[0].distance,a.point=i[0].point,a.path=[].concat(e.path),a.path.pop(),a.matrix=e.matrix.clone(),e.add(a),e.sort()}}if(this.dims&&e.filter&q)for(var o in this.dims)this.dims[o].pick(e);if(this.toolsDims&&e.filter&q)for(var o in this.toolsDims)this.toolsDims[o].pick(e);if(!e.pickTarg)for(var o in this.comps)this.comps[o].pick(e);if(this.edgeDispData&&e.filter&X){var s=this.edgeDispData.clone();s.matrixAutoUpdate=!1,s.applyMatrix(e.matrix),s.updateMatrixWorld(!0);var c=t.intersectObject(s,!0);if(c.length>0){var l=c[0].index,u=this.edgeMapId;for(var h in u)if(u[h][0]<=l&&u[h][1]>=l){var p=Number(h),d=[];for(var f in e.path)d.push(e.path[f]);d.push(p);var m=new he;m.depth=c[0].distance,m.point=c[0].point,m.path=d,m.matrix=e.matrix.clone(),e.add(m),e.sort()}}}if(this.wireDispDatas.length>0&&e.filter&Z)for(var v in this.wireDispDatas){var g=this.wireDispDatas[v].clone();g.matrixAutoUpdate=!1,g.applyMatrix(e.matrix),g.updateMatrixWorld(!0);var y=t.intersectObject(g,!0);if(y.length>0){var b=y[0].index,_=this.wireMapId[v];for(var w in _)if(_[w][0]<=b&&_[w][1]>=b){var x=Number(w),M=[];for(var E in e.path)M.push(e.path[E]);M.push(x);var S=new he;S.depth=y[0].distance,S.point=y[0].point,S.path=M,S.matrix=e.matrix.clone(),e.add(S),e.sort()}}}e.path.pop()}}},{key:"pickPnt",value:function(e){if(!this.hideFlag){e.path.push(this.id);var t=e.raycaster;if(this.edgeDispData){var n=this.edgeDispData.clone();n.matrixAutoUpdate=!1,n.applyMatrix(e.matrix),n.updateMatrixWorld(!0);var r=t.intersectObject(n,!0);if(r.length>0){var i=r[0].index,a=this.edgeMapId;for(var o in a)if(a[o][0]<=i&&a[o][1]>=i){var s=Number(o),c=[];for(var l in e.path)c.push(e.path[l]);c.push(s);var u=new he;u.depth=r[0].distance;var h=this.getEndPntById(e.matrix,s);u.point=this.catchPoint(r[0].point,h,e),te&&c.join(",")!=ee||(u.path=c,u.matrix=e.matrix.clone(),e.add(u),e.sort())}}}for(var p in this.wireDispDatas){var d=this.wireDispDatas[p].clone();d.matrixAutoUpdate=!1,d.applyMatrix(e.matrix),d.updateMatrixWorld(!0);var f=t.intersectObject(d,!0);if(f.length>0){var m=f[0].index,v=this.wireMapId[p];for(var g in v)if(v[g][0]<=m&&v[g][1]>=m){var y=Number(g),b=[];for(var _ in e.path)b.push(e.path[_]);b.push(y);var w=new he;w.depth=f[0].distance,w.point=f[0].point,w.path=b,w.matrix=e.matrix.clone(),e.add(w),e.sort()}}}for(var x in this.comps)this.comps[x].pickPnt(e);e.path.pop()}}},{key:"getHiDispData",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=[],a=e.shift(),o=function(){e.unshift(a),h(e.join(","))};if(e.length>0&&a==this.id){for(var s in this.edges)if(i=this.edges[s].getHiDispData(e,n),0!=i.length)return o(),i;for(var c in this.shapes)if(i=this.shapes[c].getHiDispData(e,n),0!=i.length)return o(),i;for(var l in this.comps)if(i=this.comps[l].getHiDispData(e,t,n,r),0!=i.length)return o(),i;for(var u in this.wires)if(i=this.wires[u].getHiDispData(e,n),0!=i.length)return o(),i;for(var p in this.dims)if(i=this.dims[p].getHiDispData(e,n),0!=i.length)return o(),i;for(var d in this.toolsDims)if(i=this.toolsDims[d].getHiDispData(e,n),0!=i.length)return o(),i}return o(),i}},{key:"getPickDataInfo",value:function(e,t){var n=null,r=e.shift();if(e.length>0&&r==this.id){for(var i in this.edges)if(n=this.edges[i].getPickDataInfo(e,t))return e.unshift(r),n;for(var a in this.shapes)if(n=this.shapes[a].getPickDataInfo(e,t))return e.unshift(r),n;for(var o in this.comps)if(n=this.comps[o].getPickDataInfo(e,t))return e.unshift(r),n;for(var s in this.wires)if(n=this.wires[s].getPickDataInfo(e,t))return e.unshift(r),n;for(var c in this.dims)if(n=this.dims[c].getPickDataInfo(e,t))return e.unshift(r),n}return e.unshift(r),n}},{key:"getHiCompDispData",value:function(e,t,n,r){for(var i in this.shapes)this.shapes[i].getHiCompDispData(e,t,n);if(null!=this.edgeDispData){var a=this.edgeDispData.clone();a.boundingBox=this.boundingBox.clone(),n?a.material=Me:a.material=xe;var o=t.clone();o.multiply(this.group.matrix),a.applyMatrix(o),e.push(a)}r.push(this.id);for(var s in this.comps)this.comps[s].getHiCompDispData(e,t,n,r);r.pop()}},{key:"addComp",value:function(e){this.comps.push(e),e.setParent(this)}},{key:"updMaterials",value:function(e){for(var t in e){var n=e[t];void 0==this.materials[n.uuid]&&(this.materials[n.uuid]=n)}return this.materials}},{key:"addShape",value:function(e){this.shapes.push(e),e.setParent(this)}},{key:"addEdge",value:function(e){this.edges.push(e),e.setParent(this)}},{key:"addFace",value:function(e,t){for(var n in this.shapes){var r=this.shapes[n];if(r.getId()==e){r.addFace(t);break}}}},{key:"addWire",value:function(e){this.wires.push(e),e.setParent(this)}},{key:"addDim",value:function(e){this.dims.push(e),e.setParent(this)}},{key:"addExpView",value:function(e){this.expViews.push(e),e.setParent(this)}},{key:"addAnim",value:function(e){this.anims.push(e),e.setParent(this)}},{key:"getCompNameTree",value:function(e,t){var n=e;t.push(this.id);var r=t.slice();this.active&&(e.push({label:this.partName,path:r,children:[]}),n=e[0].children);for(var i in this.comps)this.comps[i].getCompNameTree(n,t);t.pop()}},{key:"getAnimNameTree",value:function(e){if(this.active){var t=!0,n=!1,r=void 0;try{for(var i,a=this.anims[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var o=i.value;e.push({label:o.name,type:"anim"})}}catch(e){n=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw r}}}}},{key:"getExpViewNameTree",value:function(e){if(this.active&&this.expViews.length){var t=!0,n=!1,r=void 0;try{for(var i,a=this.expViews[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var o=i.value;e.push({label:o.name,type:"expview"})}}catch(e){n=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw r}}}}},{key:"getDimNameTree",value:function(e,t){var n=e;t.push(this.id);var r=t.slice();this.active&&(e.push({type:null,label:this.partName,path:r,children:[]}),n=e[0].children);for(var i in this.dims)this.dims[i].getDimNameTree(n,t)}},{key:"getToolsDimTree",value:function(e,t){var n=e;t.push(this.id);var r=t.slice();this.active&&(e.push({type:null,label:this.partName,path:r,children:[]}),n=e[0].children);for(var i in this.toolsDims)this.toolsDims[i].getToolsDimTree(n,t)}},{key:"getMatrixByPath",value:function(e,t,n){if(e.push(this.id),this.pathCompare1(e,t))return!0;for(var r in this.comps)if(this.comps[r].getMatrixByPath(e,t,n))return!0;return e.pop(),!1}},{key:"clear",value:function(e){for(var t in this.faceDispDatas)this.faceDispDatas[t].geometry.dispose(),this.faceDispDatas[t].material.dispose(),this.faceDispDatas[t]=null;this.faceDispDatas=[],this.edgeDispData&&(this.edgeDispData.geometry.dispose(),this.edgeDispData.material.dispose(),this.edgeDispData=null);for(var n in this.wireDispDatas)this.wireDispDatas[n].geometry.dispose(),this.wireDispDatas[n].material.dispose(),this.wireDispDatas[n]=null;this.wireDispDatas=[];for(var r in this.dims)this.dims[r].clear(e)}},{key:"focusOn",value:function(e){if(1==e.length&&e[0]==this.id)return this.boundingBox.clone();if(e[0]==this.id)for(var t in this.comps){var n=e.slice(1),r=this.comps[t].focusOn(n);if(r)return r}}},{key:"setObjVisiable",value:function(e,t,n){if(1==e.length&&e[0]==this.id)return this.hideFlag=!n,!0;for(var r in this.comps){var i=e.slice(1);if(this.comps[r].setObjVisiable(i,t,n))return!0}return!1}},{key:"setDimsVisiable",value:function(e,t){if(1==e.length&&e[0]==this.id)return this.hideFlag=!t,!0;for(var n in this.dims){var r=e.slice(1);if(this.dims[n].setObjVisiable(r,t))return!0}for(var i in this.toolsDims){var a=e.slice(1);if(this.toolsDims[i].setObjVisiable(a,t))return!0}return!1}},{key:"removeDim",value:function(e){for(var t in this.toolsDims){var n=e.slice(1);if(n[0]==this.toolsDims[t].id)return this.toolsDims.splice(t,1),!0}return!1}},{key:"getEndPntById",value:function(e,t){for(var n in this.edges){var r=this.edges[n];if(r.getId()==t)return r.getEndPnt(e)}for(var i in this.wires){var a=this.wires[i];if(a.getId()==t)return a.getEndPnt(e)}return[]}},{key:"catchPoint",value:function(e,t,n){for(var r=0,i=1/0,a=-1,o=0;o0){var i=[];for(var a in e.path)i.push(e.path[a]);i.push(this.id);var o=new he;o.depth=r[0].distance,o.point=r[0].point,o.path=i,o.matrix=e.matrix.clone(),e.add(o),e.sort()}}},{key:"updDispData",value:function(e){var t=this.geom.getGeometry(),n=this.material.getLineMat();this.dispData=new j.Line(t,n),this.dispData.type="Wire",e.add(this.dispData)}},{key:"updateGroup",value:function(e,t,n){1!=n&&e.add(this.dispData)}},{key:"getHiDispData",value:function(e,t){var n=e[0],r=[];if(this.id==n){var i=[],a=[],o={};this.merge(i,a,o); var s=new Float32Array(i.length),c=new Uint32Array(a.length),l=t?this.material.getLineHiMat():this.material.getLinePreHiMat();for(var u in i)s[u]=i[u];for(var h in a)c[h]=a[h];var p=new j.BufferGeometry;p.addAttribute("position",new j.BufferAttribute(s,3)),p.setIndex(new j.BufferAttribute(c,1));var d=new j.LineSegments(p,l);d.type="Wire",r.push(d)}return r}},{key:"clear",value:function(e){}},{key:"getEndPnt",value:function(e){var t=[];return this.geom?this.geom.getEndPnt(e):t}}]),t}(ue),Ve=function(e){function t(e,n,r){s(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return i.val=0,i.matrix=new j.Matrix4,i.geoms=[],i.material=null,i.dispData,i.cloneMap={},i.type=-1,i.hideFlag=!1,i}return o(t,e),U(t,[{key:"updData",value:function(e){for(var t in this.geoms)delete this.geoms[t];for(var n in e)e[n].setParent(this);this.geoms=e}},{key:"addToScene",value:function(e,t,n){n.push(this.id);var r=this.dispData.clone();r.matrixAutoUpdate=!1,r.applyMatrix(t),r.type="Dim",e.add(r),this.cloneMap[r.uuid]={obj:r,path:n.slice()},n.pop()}},{key:"setObjVisiable",value:function(e,t){return 1==e.length&&e[0]==this.id&&(this.hideFlag=!t,!0)}},{key:"pick",value:function(e){var t=this.dispData.clone();t.matrixAutoUpdate=!1,t.applyMatrix(e.matrix),t.updateMatrixWorld(!0);var n=e.raycaster,r=n.intersectObject(t,!0);if(r.length>0){var i=[];for(var a in e.path)i.push(e.path[a]);i.push(this.id);var o=new he;o.depth=r[0].distance,o.point=r[0].point,o.path=i,o.matrix=e.matrix.clone(),e.add(o),e.sort()}}},{key:"updDispData",value:function(e){var t=new j.BufferGeometry,n=[],r=[];for(var i in this.geoms)var a=this.geoms[i].merge(n,r);var o=new Float32Array(n.length),s=new Uint32Array(r.length);for(var c in n)o[c]=n[c];for(var l in r)s[l]=r[l];t.addAttribute("position",new j.BufferAttribute(o,3)),t.setIndex(new j.BufferAttribute(s,1)),this.dispData=new j.LineSegments(t,we),this.dispData.type="Dim",e.add(this.dispData)}},{key:"updateGroup",value:function(e,t,n){this.hideFlag||e.add(this.dispData)}},{key:"getHiDispData",value:function(e,t){var n=e[0],r=[];if(this.id==n){var i=this.dispData.clone(),a=t?this.material.getLineHiMat():this.material.getLinePreHiMat();i.material=a,r.push(i)}return r}},{key:"removeFromScene",value:function(e,t){t.push(this.id);for(var n in this.cloneMap){var r=this.cloneMap[n].path,i=this.cloneMap[n].obj;this.pathCompare2(r,t)&&(e.remove(i),delete this.cloneMap[n])}t.pop()}},{key:"modifyFromScene",value:function(e,t,n){n.push(this.id);for(var r in this.cloneMap){var i=this.cloneMap[r].path,a=this.cloneMap[r].obj;if(this.pathCompare2(i,n)){var o=new j.Matrix4;o.getInverse(a.matrix),o.multiply(t),a.applyMatrix(o)}}n.pop()}},{key:"getDimNameTree",value:function(e,t){t.push(this.id);var n=t.slice(),r={type:this.type,label:this.id,path:n,children:[]};e.push(r),t.pop()}},{key:"clear",value:function(e){for(var t in this.cloneMap){var n=this.cloneMap[t].obj;e.remove(n)}this.dispData.geometry.dispose(),this.dispData.material.dispose()}}]),t}(ue),He={pm:Math.pow(10,-9),nm:Math.pow(10,-6),um:Math.pow(10,-3),mm:1,cm:Math.pow(10,1),dm:Math.pow(10,2),m:Math.pow(10,3),dam:Math.pow(10,4),hm:Math.pow(10,5),km:Math.pow(10,6),nmi:1852e3,in:25.4,ft:304.8,yd:914.4,mi:1609344},Ge="mm",We=1,qe=function(){function e(t,n,r,i){s(this,e),this.text=t,this.val=n||null,this.userect=r,this.textContainer=null,this.color="#000000",this.borderColor="#000000",this.path=i}return U(e,[{key:"drawText",value:function(){var e=document.getElementById("dim-list"),t=document.createElement("div");if(this.userect?t.className="annotation border":t.className="annotation",t.style.borderColor=this.borderColor,null!=this.val&&(this.val=parseFloat(this.val).toFixed(2)),this.text)if(Array.isArray(this.text))for(var n=0;no;this.textContainer.style.opacity=c?.25:1}}]),e}(),Ye=function(e){function t(e,n,r){s(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return i.type="",i.leaderTyp=0,i.text="",i.matrix=new j.Matrix4,i.userect=!0,i.points=[],i.center=new j.Vector3,i.dispData,i.textContainer=null,i.hideFlag=!1,i.dimVar=[],i.endpnt=[],i.isBox=void 0,i}return o(t,e),U(t,[{key:"getLine",value:function(e,t){var n=new Pe;n.points.push(e,t);var r=n.getGeometry(),i=new j.Line(r,we);return i}},{key:"getArrow",value:function(e,t){var n=new j.ConeBufferGeometry(2,8,32);n.rotateX(.5*-Math.PI);var r=new j.Mesh(n,we),i=new j.Vector3;i.subVectors(e,t).normalize();var a=new j.Vector3;a.subVectors(t,i.clone().multiplyScalar(-4)),r.position.set(a.x,a.y,a.z),r.bsPos=a.clone(),r.dt=i.clone().negate().normalize();var o=new j.Vector3;return o.addVectors(t,i.clone().multiplyScalar(5)),r.lookAt(o),r.name="arrow",r}},{key:"getLeadLine",value:function(e,t,n){var r=new Pe,i=new j.Vector3,a=n.clone();i.addVectors(e,a.multiplyScalar(oe+t)),r.points.push(e,i);var o=r.getGeometry(),s=new j.Line(o,we);return s.name="leadline",s}},{key:"updtLineDim",value:function(e,t,n,r,i,a,o){var s=new j.Vector3,c=new j.Vector3,l=new j.Vector3;s.crossVectors(a,i),c=De.calcIsectLineLine(t,a,r,s),l=De.calcIsectLineLine(n,a,r,s);var u=c.distanceTo(t),h=l.distanceTo(n);e.add(this.getLine(c,r)),e.add(this.getLine(l,r)),e.add(this.getArrow(c,l)),e.add(this.getArrow(l,c)),e.add(this.getLeadLine(t,u,a)),e.add(this.getLeadLine(n,h,o))}},{key:"getArc",value:function(e,t,n,r,i,a){var o=new j.Vector3;o.subVectors(r,n).normalize();var s=new j.Vector3;s.subVectors(a,i).normalize();var c=De.calcIsectLineLine(n,o,i,s);o.subVectors(r,c).normalize(),o.length()>-1e-5&&o.length()<1e-5&&o.subVectors(n,c).normalize(),s.subVectors(a,c).normalize(),s.length()>-1e-5&&s.length()<1e-5&&s.subVectors(i,c).normalize(),0==this.dimVar.length&&this.calcVarDim(c,t,o,s),1==this.dimVar[0]&&o.multiplyScalar(-1),1==this.dimVar[1]&&s.multiplyScalar(-1);var l=new Be;l.center=c,l.radius=c.distanceTo(t);var u=De.getAngleFromX(o),h=De.getAngleFromX(s);l.s_ang=u,l.e_ang=h;var p=1,d=function(){var e=l.s_ang;l.s_ang=l.e_ang,l.e_ang=e,p=-p};l.s_ang>l.e_ang&&d(),l.e_ang-l.s_ang>Math.PI&&(l.s_ang+=2*Math.PI,d());var f=l.getGeometry(),m=new j.Line(f,we),v=this.getLeadLine(c,l.radius,o),g=this.getLeadLine(c,l.radius,s),y=this.getLine(c,r),b=this.getLine(c,a),_=c.clone(),w=c.clone();_.add(o.multiplyScalar(l.radius)),w.add(s.multiplyScalar(l.radius));var x=new j.Vector3,M=new j.Vector3;x.addVectors(_,new j.Vector3(100*-p*Math.sin(u),100*p*Math.cos(u),0)),M.addVectors(w,new j.Vector3(100*p*Math.sin(h),-100*p*Math.cos(h),0));var E=this.getArrow(x,_),S=this.getArrow(M,w);e.add(m,v,g,y,b,E,S)}},{key:"getExtAct",value:function(e,t,n,r,i){for(var a=[],o=0;oMath.PI&&(c=2*Math.PI-c),this.val=c/Math.PI*180;var l=i+c-a;l<=-2*Math.PI?l+=2*Math.PI:l>=2*Math.PI&&(l-=2*Math.PI);var u=void 0,h=void 0,p=void 0;l>0?(u=a,h=i,p=1):(u=i,h=a,p=0);var d=2*Math.PI-u;s+=d,s<=-2*Math.PI?s+=2*Math.PI:s>=2*Math.PI&&(s-=2*Math.PI);var f=h+d;if(f<=-2*Math.PI?f+=2*Math.PI:f>=2*Math.PI&&(f-=2*Math.PI),s>=0&&s<=f&&f=0&&s>f&&f>Math.PI)this.dimVar=[0,0,0];else{var m=f+Math.PI;m<=-2*Math.PI?m+=2*Math.PI:m>=2*Math.PI&&(m-=2*Math.PI),f=Math.PI&&sMath.PI&&s<=m||sm?this.dimVar=[1,1,0]:(s>m&&s<2*Math.PI||s0?1:-1,h=o.clone().multiplyScalar(u),u=c.dot(o)>0?1:-1,p=o.clone().multiplyScalar(u),l.crossVectors(s,o).normalize(),this.updtLineDim(e,t[0],t[2],t[4],l,h,p);break;case 25:this.center=t[3].clone().applyMatrix4(this.matrix),s.subVectors(t[3],t[0]),c.subVectors(t[3],t[2]),o.subVectors(t[1],t[0]).normalize(),u=s.dot(o)>0?1:-1,h=o.clone().multiplyScalar(u),u=c.dot(o)>0?1:-1,p=o.clone().multiplyScalar(u),l.crossVectors(s,o).normalize(),this.updtLineDim(e,t[0],t[2],t[3],l,h,p);break;case 48:this.center=t[6].clone().applyMatrix4(this.matrix);var g=t[0];De.isSameVector(g,t[2])&&(g=t[1]);var y=t[3];De.isSameVector(y,t[5])&&(y=t[4]),this.getArc(e,t[6],g,t[2],y,t[5]),this.text=this.val.toFixed(2)+"°";break;case 44:this.text="∅"+(this.val/We).toFixed(2)+Ge,this.center=t[1].clone().applyMatrix4(this.matrix);var b=new j.Vector3,_=new j.Vector3,w=new j.Vector3;w.subVectors(t[1],t[0]).normalize();var x=parseFloat(this.val/2);b.addVectors(t[0],w.multiplyScalar(x)),_.addVectors(t[0],w.multiplyScalar(-1)),n.points.push(t[1],b,_);var M=new j.Line(n.getGeometry(),we);e.add(M),this.endpnt.length&&this.getExtAct(e,t[0],[b,_],this.endpnt,this.val/2),e.add(this.getArrow(b,_)),e.add(this.getArrow(_,b));break;case 31:this.text="R"+(this.val/We).toFixed(2)+Ge,this.center=t[1].clone().applyMatrix4(this.matrix);var E=new j.Vector3,S=new j.Vector3;S.subVectors(t[1],t[0]).normalize();var T=parseFloat(this.val);E.addVectors(t[0],S.multiplyScalar(T));var P=new Pe;P.points=[t[0],E,t[1]];var C=new j.Line(P.getGeometry(),we);e.add(C),this.endpnt.length&&this.getExtAct(e,t[0],[E],this.endpnt,this.val),e.add(this.getArrow(t[0],E))}return e}},{key:"getToolsDimTree",value:function(e,t){t.push(this.id);var n=t.slice(),r={type:this.type,label:this.id,path:n};this.path=n,this.label.path=n,this.label.updPath(n),e.push(r),t.pop()}},{key:"setObjVisiable",value:function(e,t){return 1==e.length&&e[0]==this.id&&(this.hideFlag=!t,!0)}},{key:"updDispData",value:function(e,t){t.push(this.id),this.dispData=this.upData(),this.dispData.name="label",this.dispData.path=t.slice(),this.dispData.matrixAutoUpdate=!1,this.dispData.applyMatrix(this.matrix),e.add(this.dispData),t.pop()}},{key:"updateGroup",value:function(e){if(!this.hideFlag){e.add(this.dispData);var t=[];if(this.points.type){if("vectors"==this.points.type)for(var n=0;n0){var i=[];for(var a in e.path)i.push(e.path[a]);i.push(this.id);var o=new he;o.depth=r[0].distance,o.point=r[0].point,o.path=i,o.matrix=e.matrix.clone(),e.add(o),e.sort()}}}]),t}(ue),Xe=new j.SphereGeometry(3,32,32),Ze=new j.Mesh(Xe,be);Ze.name="labelPnt";var Je=new j.Geometry,Ke=(new j.Line(Je,xe),{center:new j.Vector2(0,0),left:new j.Vector2(1,0),topLeft:new j.Vector2(1,-1),topRight:new j.Vector2(-1,-1),right:new j.Vector2(-1,0),bottomLeft:new j.Vector2(1,1),bottomRight:new j.Vector2(-1,1)},function(){function e(t,n){s(this,e),this.uuid=void 0!=t?t:j.Math.generateUUID(),this.dataUrl=void 0==n?"":n}return U(e,[{key:"getDataUrl",value:function(){return this.dataUrl}}]),e}()),$e=function(e){function t(e,n,r){s(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return i.name="",i.steps=[],i.keyframes=null,i.startMat=null,i.lastFactor,i}return o(t,e),U(t,[{key:"initState",value:function(e,t){if(null==this.startMat)throw"Expview data may be empty.";this.parent.setCompInitState2(e,this.startMat,t)}},{key:"getEndPoint",value:function(e){var t=[e[12],e[13],e[14]];return t}},{key:"getQuaternion4",value:function(e){var t=e[0],n=e[1],r=e[2],i=e[4],a=e[5],o=e[6],s=e[8],c=e[9],l=e[10],u=t+a+l,h=t-a-l,p=a-t-l,d=l-t-a,f=0,m=u;h>m&&(m=h,f=1),p>m&&(m=p,f=2),d>m&&(m=d,f=3);var v=.5*Math.sqrt(m+1),g=.25/v,y=void 0,b=void 0,_=void 0,w=void 0;switch(f){case 0:w=v,y=(o-c)*g,b=(s-r)*g,_=(n-i)*g;break;case 1:y=v,w=(o-c)*g,b=(n+i)*g,_=(s+r)*g;break;case 2:b=v,w=(s-r)*g,y=(n+i)*g,_=(o+c)*g;break;case 3:_=v,w=(n-i)*g,y=(s+r)*g,b=(o+c)*g}return[y,b,_,w]}},{key:"mkKeyFrames",value:function(e,t){if(null==this.keyframes||t!=-1||this.lastFactor!=t){this.lastFactor=t;var n=1e3,r=0,i=this.steps.length,a=[],o=[],s=new Map,c=new Map,l=0;if(t>0&&t<=n&&(r=Math.floor(this.steps.length*t/n)),t==-1||0==t){var u=!0,h=!1,p=void 0;try{for(var d,f=this.startMat[Symbol.iterator]();!(u=(d=f.next()).done);u=!0){var m=B(d.value,2),v=m[0],g=m[1];s.set(v,l),c.set(l,v),l+=1,a.push(this.getEndPoint(g.elements)),a.push(this.getQuaternion4(g.elements)),o.push([0])}}catch(e){h=!0,p=e}finally{try{!u&&f.return&&f.return()}finally{if(h)throw p}}}else if(t>0&&t0?this.steps[r-1]:this.startMat,b=this.steps[r],_=!0,w=!1,x=void 0;try{for(var M,E=y[Symbol.iterator]();!(_=(M=E.next()).done);_=!0){var S=B(M.value,2),T=S[0],P=S[1],C=P.elements,L=b.get(T).elements;s.set(T,l),c.set(l,T),l+=1,o.push([0]);var A=[0,0,0],k=[0,0,0,0],O=t*this.steps.length/n-Math.floor(t*this.steps.length/n);this.PosLinear(this.getEndPoint(C),this.getEndPoint(L),A,O),this.QuaSlerp(this.getQuaternion4(C),this.getQuaternion4(L),k,O),a.push(A),a.push(k)}}catch(e){w=!0,x=e}finally{try{!_&&E.return&&E.return()}finally{if(w)throw x}}}else if(t==n){var D=!0,R=!1,I=void 0;try{for(var N,U=this.steps[this.steps.length-1][Symbol.iterator]();!(D=(N=U.next()).done);D=!0){var F=B(N.value,2),T=F[0],P=F[1],z=P.elements;s.set(T,l),c.set(l,T),l+=1,o.push([0]),a.push(this.getEndPoint(z)),a.push(this.getQuaternion4(z))}}catch(e){R=!0,I=e}finally{try{!D&&U.return&&U.return()}finally{if(R)throw I}}}for(var V=r;V.9995)a=1-r,o=r;else{var s=Math.sqrt(1-i*i),c=Math.atan2(s,i);a=Math.sin((1-r)*c)/s,o=Math.sin(r*c)/s}n[0]=e[0]*a+t[0]*o,n[1]=e[1]*a+t[1]*o,n[2]=e[2]*a+t[2]*o,n[3]=e[3]*a+t[3]*o}},{key:"PosLinear",value:function(e,t,n,r){for(var i=0;i<3;++i)n[i]=e[i]+(t[i]-e[i])*r}}]),t}(ue),Qe=function(e){function t(e,n,r){s(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return i.name="",i.keyframes=null,i.startMat=null,i.steps=[],i.lastFactor,i}return o(t,e),U(t,[{key:"initState",value:function(e,t){if(null==this.startMat)throw"Anim data may be empty.";var n=this.startMat.keys(),r=!0,i=!1,a=void 0;try{for(var o,s=n[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value;this.parent.setCompInitState(e,c,this.startMat.get(c),t)}}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}}},{key:"getEndPoint",value:function(e){var t=[e[12],e[13],e[14]];return t}},{key:"getQuaternion4",value:function(e){var t=e[0],n=e[1],r=e[2],i=e[4],a=e[5],o=e[6],s=e[8],c=e[9],l=e[10],u=t+a+l,h=t-a-l,p=a-t-l,d=l-t-a,f=0,m=u;h>m&&(m=h,f=1),p>m&&(m=p,f=2),d>m&&(m=d,f=3);var v=.5*Math.sqrt(m+1),g=.25/v,y=void 0,b=void 0,_=void 0,w=void 0;switch(f){case 0:w=v,y=(o-c)*g,b=(s-r)*g,_=(n-i)*g;break;case 1:y=v,w=(o-c)*g,b=(n+i)*g,_=(s+r)*g;break;case 2:b=v,w=(s-r)*g,y=(n+i)*g,_=(o+c)*g;break;case 3:_=v,w=(n-i)*g,y=(s+r)*g,b=(o+c)*g}return[y,b,_,w]}},{key:"mkKeyFrames",value:function(e,t){if(null==this.keyframes||t!=-1||this.lastFactor!=t){this.lastFactor=t;var n=1e3,r=0,i=this.steps.length/30,a=[],o=new Map,s=new Map,c=0,l=[0];if(t>0&&t<=n&&(r=Math.floor(this.steps.length*t/n)),t==-1||0==t||0==r){var u=!0,h=!1,p=void 0;try{for(var d,f=this.startMat[Symbol.iterator]();!(u=(d=f.next()).done);u=!0){var m=B(d.value,2),v=m[0],g=m[1];o.set(v,c),s.set(c,v),c+=1,a.push(this.getEndPoint(g.elements)),a.push(this.getQuaternion4(g.elements))}}catch(e){h=!0,p=e}finally{try{!u&&f.return&&f.return()}finally{if(h)throw p}}}else if(t>0&&t<=n){i=(this.steps.length-r)/30;var y=this.steps[r-1],b=!0,_=!1,w=void 0;try{for(var x,M=y[Symbol.iterator]();!(b=(x=M.next()).done);b=!0){var E=x.value,S=E.compId,T=E.Mat.elements;o.set(S,c),s.set(c,S),c+=1,a.push(this.getEndPoint(T)),a.push(this.getQuaternion4(T))}}catch(e){_=!0,w=e}finally{try{!b&&M.return&&M.return()}finally{if(_)throw w}}}for(var P=r;Pv?(a=1,o=0):(a=0,o=1);var g=m-a+h,y=v-o+h,b=m-1+2*h,_=v-1+2*h,w=255&l,x=255&u,M=this.perm[w+this.perm[x]]%12,E=this.perm[w+a+this.perm[x+o]]%12,S=this.perm[w+1+this.perm[x+1]]%12,T=.5-m*m-v*v;T<0?n=0:(T*=T,n=T*T*this.dot(this.grad3[M],m,v));var P=.5-g*g-y*y;P<0?r=0:(P*=P,r=P*P*this.dot(this.grad3[E],g,y));var C=.5-b*b-_*_;return C<0?i=0:(C*=C,i=C*C*this.dot(this.grad3[S],b,_)),70*(n+r+i)},et.prototype.noise3d=function(e,t,n){var r,i,a,o,s,c,l,u,h,p,d=1/3,f=(e+t+n)*d,m=Math.floor(e+f),v=Math.floor(t+f),g=Math.floor(n+f),y=1/6,b=(m+v+g)*y,_=m-b,w=v-b,x=g-b,M=e-_,E=t-w,S=n-x;M>=E?E>=S?(s=1,c=0,l=0,u=1,h=1,p=0):M>=S?(s=1,c=0,l=0,u=1,h=0,p=1):(s=0,c=0,l=1,u=1,h=0,p=1):EB?32:0,z=N>U?16:0,V=B>U?8:0,H=N>F?4:0,G=B>F?2:0,W=U>F?1:0,q=j+z+V+H+G+W;l=x[q][0]>=3?1:0,u=x[q][1]>=3?1:0,h=x[q][2]>=3?1:0,p=x[q][3]>=3?1:0,d=x[q][0]>=2?1:0,f=x[q][1]>=2?1:0,m=x[q][2]>=2?1:0,v=x[q][3]>=2?1:0,g=x[q][0]>=1?1:0,y=x[q][1]>=1?1:0,b=x[q][2]>=1?1:0,_=x[q][3]>=1?1:0;var Y=N-l+S,X=B-u+S,Z=U-h+S,J=F-p+S,K=N-d+2*S,$=B-f+2*S,Q=U-m+2*S,ee=F-v+2*S,te=N-g+3*S,ne=B-y+3*S,re=U-b+3*S,ie=F-_+3*S,ae=N-1+4*S,oe=B-1+4*S,se=U-1+4*S,ce=F-1+4*S,le=255&P,ue=255&C,he=255&L,pe=255&A,de=M[le+M[ue+M[he+M[pe]]]]%32,fe=M[le+l+M[ue+u+M[he+h+M[pe+p]]]]%32,me=M[le+d+M[ue+f+M[he+m+M[pe+v]]]]%32,ve=M[le+g+M[ue+y+M[he+b+M[pe+_]]]]%32,ge=M[le+1+M[ue+1+M[he+1+M[pe+1]]]]%32,ye=.6-N*N-B*B-U*U-F*F;ye<0?i=0:(ye*=ye,i=ye*ye*this.dot4(w[de],N,B,U,F));var be=.6-Y*Y-X*X-Z*Z-J*J;be<0?a=0:(be*=be,a=be*be*this.dot4(w[fe],Y,X,Z,J));var _e=.6-K*K-$*$-Q*Q-ee*ee;_e<0?o=0:(_e*=_e,o=_e*_e*this.dot4(w[me],K,$,Q,ee));var we=.6-te*te-ne*ne-re*re-ie*ie;we<0?s=0:(we*=we,s=we*we*this.dot4(w[ve],te,ne,re,ie));var xe=.6-ae*ae-oe*oe-se*se-ce*ce;return xe<0?c=0:(xe*=xe,c=xe*xe*this.dot4(w[ge],ae,oe,se,ce)),27*(i+a+o+s+c)},C.prototype={constructor:C},L.prototype={constructor:L},A.prototype={constructor:A},k.prototype=Object.create(E.prototype),k.prototype={constructor:k,dispose:function(){this.beautyRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.ssaoRenderTarget.dispose(),this.blurRenderTarget.dispose(),this.quad.geometry.dispose(),this.normalMaterial.dispose(),this.blurMaterial.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose()},render:function(e,t){switch(e.setRenderTarget(this.beautyRenderTarget),e.clear(),e.render(this.scene,this.camera),this.renderOverride(e,this.normalMaterial,this.normalRenderTarget,7829503,1),this.ssaoMaterial.uniforms.kernelRadius.value=this.kernelRadius,this.ssaoMaterial.uniforms.minDistance.value=this.minDistance,this.ssaoMaterial.uniforms.maxDistance.value=this.maxDistance,this.renderPass(e,this.ssaoMaterial,this.ssaoRenderTarget),this.renderPass(e,this.blurMaterial,this.blurRenderTarget),this.output){case k.OUTPUT.SSAO:this.copyMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.copyMaterial.blending=j.NoBlending,this.renderPass(e,this.copyMaterial,null);break;case k.OUTPUT.Blur:this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=j.NoBlending,this.renderPass(e,this.copyMaterial,null);break;case k.OUTPUT.Beauty:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=j.NoBlending,this.renderPass(e,this.copyMaterial,null);break;case k.OUTPUT.Depth:break;case k.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=j.NoBlending,this.renderPass(e,this.copyMaterial,null);break;case k.OUTPUT.Default:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=j.NoBlending,this.renderPass(e,this.copyMaterial,null),this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=j.CustomBlending,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;default:console.warn("ZwSSAOPass: Unknown output type.")}},renderPass:function(e,t,n,r,i){this.originalClearColor.copy(e.getClearColor());var a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(n),e.autoClear=!1,void 0!==r&&null!==r&&(e.setClearColor(r),e.setClearAlpha(i||0),e.clear()),this.quad.material=t,e.render(this.quadScene,this.quadCamera),e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(a)},renderOverride:function(e,t,n,r,i){this.originalClearColor.copy(e.getClearColor());var a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(n),e.autoClear=!1,r=t.clearColor||r,i=t.clearAlpha||i,void 0!==r&&null!==r&&(e.setClearColor(r),e.setClearAlpha(i||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(a)},setSize:function(e,t){this.width=e,this.height=t, this.beautyRenderTarget.setSize(e,t),this.ssaoRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.blurRenderTarget.setSize(e,t),this.ssaoMaterial.uniforms.resolution.value.set(e,t),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.getInverse(this.camera.projectionMatrix)},generateSampleKernel:function(){for(var e=this.kernelSize,t=this.kernel,n=0;n0}},{key:"moveFunc",value:function(e){var t=e.clientX,n=e.clientY,r=void 0,i=void 0;switch(this.type){case"rect":this.str="M"+this.start.x+" "+this.start.y+" V"+n+" H"+t+" V"+this.start.y+" z";break;case"circle":var a=(this.start.y+n)/2;r=Math.abs(t-this.start.x)/2,i=Math.abs(n-this.start.y)/2,this.str="M"+this.start.x+" "+a+" A "+r+" "+i+" 0 1 1 "+t+" "+a+" A "+r+" "+i+" 0 1 1 "+this.start.x+" "+a;break;case"line":this.str="M"+this.start.x+" "+this.start.y+" L"+t+" "+n;break;case"cloud":var o=this.pList.length,s=this.pList[o-1],c=Math.sqrt(Math.pow(t-s.x,2)+Math.pow(n-s.y,2));if(c<20)return;this.pList.push({x:t,y:n});for(var l=this.isClockwise(this.pList)?"1 1":"1 0",u=0;u1?t.top:t.right):i=t.fov,this.camera={type:"p",p:t.position.clone(),up:t.up.clone(),c:n,fov:i,d:r,asp:t.aspect},this.saveInfo()}},{key:"addText",value:function(){var e=document.getElementById("pin-list"),t=document.createElement("div");t.className="annotation border";var n=document.createElement("p");n.innerHTML=this.text,t.appendChild(n),this.textContainer=t,e.appendChild(t)}},{key:"setPath",value:function(e,t,n){this.points=e,this.type=t,this.pos=n}},{key:"saveInfo",value:function(){var e={pos:this.pos,text:this.text,type:this.type,points:this.points,camera:{p:{x:this.camera.p.x,y:this.camera.p.y,z:this.camera.p.z},up:{x:this.camera.up.x,y:this.camera.up.y,z:this.camera.up.z},c:{x:this.camera.c.x,y:this.camera.c.y,z:this.camera.c.z},fov:this.camera.fov,d:this.camera.d,asp:this.camera.asp}},t=JSON.parse(localStorage.getItem("pinJson"))||{},n=JSON.stringify(e);t[this.id]=n,localStorage.setItem("pinJson",JSON.stringify(t)),ht.uploadCmt&&ht.uploadCmt(this.id,e)}},{key:"updateScreenPosition",value:function(e,t){var n=this.pos.clone();n.project(e),n.x=Math.round((.5+n.x/2)*t.offsetWidth),n.y=Math.round((.5-n.y/2)*t.offsetHeight),this.dom.style.top=n.y-20+"px",this.dom.style.left=n.x-10+"px",this.textContainer&&(this.textContainer.style.top=n.y+"px",this.textContainer.style.left=n.x+"px")}}]),e}(),ft=n(227);N.prototype.constructor=N,t.ZwViewer=N},function(e,t,n){var r;!function(i){function a(e,t,n,r,i){this._listener=t,this._isOnce=n,this.context=r,this._signal=e,this._priority=i||0}function o(e,t){if("function"!=typeof e)throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",t))}function s(){this._bindings=[],this._prevParams=null;var e=this;this.dispatch=function(){s.prototype.dispatch.apply(e,arguments)}}a.prototype={active:!0,params:null,execute:function(e){var t,n;return this.active&&this._listener&&(n=this.params?this.params.concat(e):e,t=this._listener.apply(this.context,n),this._isOnce&&this.detach()),t},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},s.prototype={VERSION:"1.0.0",memorize:!1,_shouldPropagate:!0,active:!0,_registerListener:function(e,t,n,r){var i,o=this._indexOfListener(e,n);if(o!==-1){if(i=this._bindings[o],i.isOnce()!==t)throw new Error("You cannot add"+(t?"":"Once")+"() then add"+(t?"Once":"")+"() the same listener without removing the relationship first.")}else i=new a(this,e,t,n,r),this._addBinding(i);return this.memorize&&this._prevParams&&i.execute(this._prevParams),i},_addBinding:function(e){var t=this._bindings.length;do--t;while(this._bindings[t]&&e._priority<=this._bindings[t]._priority);this._bindings.splice(t+1,0,e)},_indexOfListener:function(e,t){for(var n,r=this._bindings.length;r--;)if(n=this._bindings[r],n._listener===e&&n.context===t)return r;return-1},has:function(e,t){return this._indexOfListener(e,t)!==-1},add:function(e,t,n){return o(e,"add"),this._registerListener(e,!1,t,n)},addOnce:function(e,t,n){return o(e,"addOnce"),this._registerListener(e,!0,t,n)},remove:function(e,t){o(e,"remove");var n=this._indexOfListener(e,t);return n!==-1&&(this._bindings[n]._destroy(),this._bindings.splice(n,1)),e},removeAll:function(){for(var e=this._bindings.length;e--;)this._bindings[e]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(e){if(this.active){var t,n=Array.prototype.slice.call(arguments),r=this._bindings.length;if(this.memorize&&(this._prevParams=n),r){t=this._bindings.slice(),this._shouldPropagate=!0;do r--;while(t[r]&&this._shouldPropagate&&t[r].execute(n)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),delete this._bindings,delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};var c=s;c.Signal=s,r=function(){return c}.call(t,n,t,e),!(void 0!==r&&(e.exports=r))}(this)},function(e,t,n){!function(e,n){n(t)}(this,function(e){"use strict";function t(){}function n(e,t){this.x=e||0,this.y=t||0}function r(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function i(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==r?r:1}function a(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function o(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function s(e,t,r,i,a,c,l,u,h,p){Object.defineProperty(this,"id",{value:Xc++}),this.uuid=Wc.generateUUID(),this.name="",this.image=void 0!==e?e:s.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:s.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:Ms,this.wrapT=void 0!==i?i:Ms,this.magFilter=void 0!==a?a:Cs,this.minFilter=void 0!==c?c:As,this.anisotropy=void 0!==h?h:1,this.format=void 0!==l?l:Ws,this.type=void 0!==u?u:ks,this.offset=new n(0,0),this.repeat=new n(1,1),this.center=new n(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new o,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==p?p:Dc,this.version=0,this.onUpdate=null}function c(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==r?r:1}function l(e,t,n){this.width=e,this.height=t,this.scissor=new c(0,0,e,t),this.scissorTest=!1,this.viewport=new c(0,0,e,t),n=n||{},this.texture=new s(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:Cs,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function u(e,t,n){l.call(this,e,t,n),this.samples=4}function h(e,t,n){l.call(this,e,t,n)}function p(e,t,n,r,i,a,o,c,l,u,h,p){s.call(this,null,a,o,c,l,u,r,i,h,p),this.image={data:e,width:t,height:n},this.magFilter=void 0!==l?l:Ss,this.minFilter=void 0!==u?u:Ss,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function d(e,t){this.min=void 0!==e?e:new a(+(1/0),+(1/0),+(1/0)),this.max=void 0!==t?t:new a(-(1/0),-(1/0),-(1/0))}function f(e,t){this.center=void 0!==e?e:new a,this.radius=void 0!==t?t:0}function m(e,t){this.normal=void 0!==e?e:new a(1,0,0),this.constant=void 0!==t?t:0}function v(e,t,n,r,i,a){this.planes=[void 0!==e?e:new m,void 0!==t?t:new m,void 0!==n?n:new m,void 0!==r?r:new m,void 0!==i?i:new m,void 0!==a?a:new m]}function g(e){var t={};for(var n in e){t[n]={};for(var r in e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}}return t}function y(e){for(var t={},n=0;nt&&(t=e[n]);return t}function F(){Object.defineProperty(this,"id",{value:dh+=2}),this.uuid=Wc.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function j(e,t,n,r,i,a){T.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new z(e,t,n,r,i,a)),this.mergeVertices()}function z(e,t,n,r,i,o){function s(e,t,n,r,i,o,s,m,v,g,y){var b,_,w=o/v,x=s/g,M=o/2,E=s/2,S=m/2,T=v+1,P=g+1,C=0,L=0,A=new a;for(_=0;_0?1:-1,h.push(A.x,A.y,A.z),p.push(b/v),p.push(1-_/g),C+=1}}for(_=0;_0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a,o="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext,s=void 0!==n.precision?n.precision:"highp",c=i(s);c!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",c,"instead."),s=c);var l=n.logarithmicDepthBuffer===!0,u=e.getParameter(34930),h=e.getParameter(35660),p=e.getParameter(3379),d=e.getParameter(34076),f=e.getParameter(34921),m=e.getParameter(36347),v=e.getParameter(36348),g=e.getParameter(36349),y=h>0,b=o||!!t.get("OES_texture_float"),_=y&&b,w=o?e.getParameter(36183):0;return{isWebGL2:o,getMaxAnisotropy:r,getMaxPrecision:i,precision:s,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:h,maxTextureSize:p,maxCubemapSize:d,maxAttributes:f,maxVertexUniforms:m,maxVaryings:v,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:b,floatVertexTextures:_,maxSamples:w}}function Q(){function e(){u.value!==r&&(u.value=r,u.needsUpdate=i>0),n.numPlanes=i,n.numIntersection=0}function t(e,t,r,i){var a=null!==e?e.length:0,o=null;if(0!==a){if(o=u.value,i!==!0||null===o){var s=r+4*a,h=t.matrixWorldInverse;l.getNormalMatrix(h),(null===o||o.length65535?R:O)(r,1),t.update(n,34963),c[e.id]=n,n}var s={},c={};return{get:i,update:a,getWireframeAttribute:o}}function ne(e,t,n,r){function i(e){c=e}function a(e){l=e.type,u=e.bytesPerElement}function o(t,r){e.drawElements(c,r,l,t*u),n.update(r,c)}function s(i,a,o){var s;if(r.isWebGL2)s=e;else{var s=t.get("ANGLE_instanced_arrays");if(null===s)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}s[r.isWebGL2?"drawElementsInstanced":"drawElementsInstancedANGLE"](c,o,l,a*u,i.maxInstancedCount),n.update(o,c,i.maxInstancedCount)}var c,l,u;this.setMode=i,this.setIndex=a,this.render=o,this.renderInstances=s}function re(e){function t(e,t,n){switch(n=n||1,i.calls++,t){case 4:i.triangles+=n*(e/3);break;case 5:case 6:i.triangles+=n*(e-2);break;case 1:i.lines+=n*(e/2);break;case 3:i.lines+=n*(e-1);break;case 2:i.lines+=n*e;break;case 0:i.points+=n*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",t)}}function n(){i.frame++,i.calls=0,i.triangles=0,i.points=0,i.lines=0}var r={geometries:0,textures:0},i={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:r,render:i,programs:null,autoReset:!0,reset:n,update:t}}function ie(e,t){return Math.abs(t[1])-Math.abs(e[1])}function ae(e){function t(t,i,a,o){var s=t.morphTargetInfluences,c=s.length,l=n[i.id];if(void 0===l){l=[];for(var u=0;u0)return e;var i=t*n,a=_h[i];if(void 0===a&&(a=new Float32Array(i),_h[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function he(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n");return it(n)}var n=/^[ \t]*#include +<([\w\d.\/]+)>/gm;return e.replace(n,t)}function at(e){function t(e,t,n,r){for(var i="",a=parseInt(t);a0?e.gammaFactor:1,y=o.isWebGL2?"":$e(r.extensions,a,t),b=Qe(c),_=s.createProgram();if(r.isRawShaderMaterial?(m=[b].filter(tt).join("\n"),m.length>0&&(m+="\n"),v=[y,b].filter(tt).join("\n"),v.length>0&&(v+="\n")):(m=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+i.name,b,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+g,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+d:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&a.flatShading===!1?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+h:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(tt).join("\n"),v=[y,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+i.name,b,a.alphaTest?"#define ALPHATEST "+a.alphaTest+(a.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+g,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.matcap?"#define USE_MATCAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+p:"",a.envMap?"#define "+d:"",a.envMap?"#define "+f:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+h:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&(o.isWebGL2||t.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",a.toneMapping!==cs?"#define TONE_MAPPING":"",a.toneMapping!==cs?oh.tonemapping_pars_fragment:"",a.toneMapping!==cs?Ke("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.matcapEncoding||a.envMapEncoding||a.emissiveMapEncoding?oh.encodings_pars_fragment:"",a.mapEncoding?Ze("mapTexelToLinear",a.mapEncoding):"",a.matcapEncoding?Ze("matcapTexelToLinear",a.matcapEncoding):"",a.envMapEncoding?Ze("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?Ze("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?Je("linearToOutputTexel",a.outputEncoding):"",a.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(tt).join("\n")),l=it(l),l=nt(l,a),l=rt(l,a),u=it(u),u=nt(u,a),u=rt(u,a),l=at(l),u=at(u),o.isWebGL2&&!r.isRawShaderMaterial){var w=!1,x=/^\s*#version\s+300\s+es\s*\n/;r.isShaderMaterial&&null!==l.match(x)&&null!==u.match(x)&&(w=!0,l=l.replace(x,""),u=u.replace(x,"")),m=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,v=["#version 300 es\n","#define varying in",w?"":"out highp vec4 pc_fragColor;",w?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+v}var M=m+l,E=v+u,S=Ye(s,35633,M),T=Ye(s,35632,E);s.attachShader(_,S),s.attachShader(_,T),void 0!==r.index0AttributeName?s.bindAttribLocation(_,0,r.index0AttributeName):a.morphTargets===!0&&s.bindAttribLocation(_,0,"position"),s.linkProgram(_);var P=s.getProgramInfoLog(_).trim(),C=s.getShaderInfoLog(S).trim(),L=s.getShaderInfoLog(T).trim(),A=!0,k=!0;s.getProgramParameter(_,35714)===!1?(A=!1,console.error("THREE.WebGLProgram: shader error: ",s.getError(),"35715",s.getProgramParameter(_,35715),"gl.getProgramInfoLog",P,C,L)):""!==P?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",P):""!==C&&""!==L||(k=!1),k&&(this.diagnostics={runnable:A,material:r,programLog:P,vertexShader:{log:C,prefix:m},fragmentShader:{log:L,prefix:v}}),s.deleteShader(S),s.deleteShader(T);var O;this.getUniforms=function(){return void 0===O&&(O=new We(s,_,e)),O};var D;return this.getAttributes=function(){return void 0===D&&(D=et(s,_)),D},this.destroy=function(){s.deleteProgram(_),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.name=i.name,this.id=Th++,this.code=n,this.usedTimes=1,this.program=_,this.vertexShader=S,this.fragmentShader=T,this}function st(e,t,n){function r(e){var t=e.skeleton,r=t.bones;if(n.floatVertexTextures)return 1024;var i=n.maxVertexUniforms,a=Math.floor((i-20)/4),o=Math.min(a,r.length);return o0,maxBones:d,useVertexTexture:n.floatVertexTextures,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numClippingPlanes:l,numClipIntersection:u,dithering:t.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.receiveShadow&&s.length>0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:t.side===Mo,flipSided:t.side===xo,depthPacking:void 0!==t.depthPacking&&t.depthPacking};return v},this.getProgramCode=function(t,n){var r=[];if(n.shaderID?r.push(n.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)r.push(i),r.push(t.defines[i]);for(var a=0;a1&&s.sort(lt),c.length>1&&c.sort(ut)}var a=[],o=0,s=[],c=[];return{opaque:s,transparent:c,init:e,push:n,unshift:r,sort:i}}function pt(){function e(t){var n=t.target;n.removeEventListener("dispose",e),delete r[n.id]}function t(t,n){var i,a=r[t.id];return void 0===a?(i=new ht,r[t.id]={},r[t.id][n.id]=i,t.addEventListener("dispose",e)):(i=a[n.id],void 0===i&&(i=new ht,a[n.id]=i)),i}function n(){r={}}var r={};return{get:t,dispose:n}}function dt(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var r;switch(t.type){case"DirectionalLight":r={direction:new a,color:new b,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new n};break;case"SpotLight":r={position:new a,direction:new a,color:new b,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new n};break;case"PointLight":r={position:new a,color:new b,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new n,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":r={direction:new a,skyColor:new b,groundColor:new b};break;case"RectAreaLight":r={color:new b,position:new a,halfWidth:new a,halfHeight:new a}}return e[t.id]=r,r}}}function ft(){function e(e,r,a){for(var c=0,l=0,u=0,h=0,p=0,d=0,f=0,m=0,v=a.matrixWorldInverse,g=0,y=e.length;g0:s&&s.isGeometry&&(h=s.morphTargets&&s.morphTargets.length>0)),t.isSkinnedMesh&&n.skinning===!1&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t);var p=t.isSkinnedMesh&&n.skinning,d=0;h&&(d|=g),p&&(d|=y),c=l[d]}if(e.localClippingEnabled&&n.clipShadows===!0&&0!==n.clippingPlanes.length){var f=c.uuid,m=n.uuid,v=x[f];void 0===v&&(v={},x[f]=v);var b=v[m];void 0===b&&(b=c.clone(),v[m]=b),c=b}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=null!=n.shadowSide?n.shadowSide:M[n.side],c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,r&&c.isMeshDistanceMaterial&&(c.referencePosition.copy(i),c.nearDistance=a,c.farDistance=o),c}function s(n,r,i,a){if(n.visible!==!1){var c=n.layers.test(r.layers);if(c&&(n.isMesh||n.isLine||n.isPoints)&&n.castShadow&&(!n.frustumCulled||u.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,n.matrixWorld);var l=t.update(n),h=n.material;if(Array.isArray(h))for(var p=l.groups,d=0,f=p.length;d=1):ae.indexOf("OpenGL ES")!==-1&&(ie=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(ae)[1]),re=ie>=2);var oe=null,se={},ce=new c,le=new c,ue={};return ue[3553]=s(3553,3553,1),ue[34067]=s(34067,34069,6),O.setClear(0,0,0,1),D.setClear(1),R.setClear(0),d(2929),D.setFunc(es),b(!1),_(po),d(2884),g(Lo),{buffers:{color:O,depth:D,stencil:R},initAttributes:l,enableAttribute:u,enableAttributeAndDivisor:h,disableUnusedAttributes:p,enable:d,disable:f,getCompressedTextureFormats:m,useProgram:v,setBlending:g,setMaterial:y,setFlipSided:b,setCullFace:_,setLineWidth:w,setPolygonOffset:x,setScissorTest:M,activeTexture:E,bindTexture:S,compressedTexImage2D:T,texImage2D:P,texImage3D:C,scissor:L,viewport:A,reset:k}}function wt(e,t,n,r,i,a,o){function s(e,t){return B?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function c(e,t,n,r){var i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||t===!0){if(e instanceof ImageBitmap||e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var a=t?Wc.floorPowerOfTwo:Math.floor,o=a(i*e.width),c=a(i*e.height);void 0===I&&(I=s(o,c));var l=n?s(o,c):I;l.width=o,l.height=c;var u=l.getContext("2d");return u.drawImage(e,0,0,o,c),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+c+")."),B?l.transferToImageBitmap():l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function l(e){return Wc.isPowerOfTwo(e.width)&&Wc.isPowerOfTwo(e.height)}function u(e){return!i.isWebGL2&&(e.wrapS!==Ms||e.wrapT!==Ms||e.minFilter!==Ss&&e.minFilter!==Cs)}function h(e,t){return e.generateMipmaps&&t&&e.minFilter!==Ss&&e.minFilter!==Cs}function p(t,n,i,a){e.generateMipmap(t);var o=r.get(n);o.__maxMipLevel=Math.log(Math.max(i,a))*Math.LOG2E}function d(e,n){if(!i.isWebGL2)return e;var r=e;return 6403===e&&(5126===n&&(r=33326),5131===n&&(r=33325),5121===n&&(r=33321)),6407===e&&(5126===n&&(r=34837),5131===n&&(r=34843),5121===n&&(r=32849)),6408===e&&(5126===n&&(r=34836),5131===n&&(r=34842),5121===n&&(r=32856)),33325===r||33326===r||34842===r||34836===r?t.get("EXT_color_buffer_float"):34843!==r&&34837!==r||console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),r}function f(e){return e===Ss||e===Ts||e===Ps?9728:9729}function m(e){var t=e.target;t.removeEventListener("dispose",m),g(t),t.isVideoTexture&&delete N[t.id],o.memory.textures--}function v(e){var t=e.target;t.removeEventListener("dispose",v),y(t),o.memory.textures--}function g(t){var n=r.get(t);void 0!==n.__webglInit&&(e.deleteTexture(n.__webglTexture),r.remove(t))}function y(t){var n=r.get(t),i=r.get(t.texture);if(t){if(void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLRenderTargetCube)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer);r.remove(t.texture),r.remove(t)}}function b(e,t){var i=r.get(e);if(e.isVideoTexture&&R(e),e.version>0&&i.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(a.complete!==!1)return void S(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}function _(e,t){var i=r.get(e);return e.version>0&&i.__version!==e.version?void S(i,e,t):(n.activeTexture(33984+t),void n.bindTexture(32879,i.__webglTexture))}function w(t,o){var s=r.get(t);if(6===t.image.length)if(t.version>0&&s.__version!==t.version){E(s,t),n.activeTexture(33984+o),n.bindTexture(34067,s.__webglTexture),e.pixelStorei(37440,t.flipY);for(var u=t&&t.isCompressedTexture,f=t.image[0]&&t.image[0].isDataTexture,m=[],v=0;v<6;v++)u||f?m[v]=f?t.image[v].image:t.image[v]:m[v]=c(t.image[v],!1,!0,i.maxCubemapSize);var g=m[0],y=l(g)||i.isWebGL2,b=a.convert(t.format),_=a.convert(t.type),w=d(b,_);M(34067,t,y);for(var v=0;v<6;v++)if(u)for(var x,S=m[v].mipmaps,T=0,P=S.length;T-1?n.compressedTexImage2D(34069+v,T,w,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+v,T,w,x.width,x.height,0,b,_,x.data);else f?n.texImage2D(34069+v,0,w,m[v].width,m[v].height,0,b,_,m[v].data):n.texImage2D(34069+v,0,w,b,_,m[v]);u?s.__maxMipLevel=S.length-1:s.__maxMipLevel=0,h(t,y)&&p(34067,t,g.width,g.height),s.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+o),n.bindTexture(34067,s.__webglTexture)}function x(e,t){n.activeTexture(33984+t),n.bindTexture(34067,r.get(e).__webglTexture)}function M(n,o,s){var c;if(s?(e.texParameteri(n,10242,a.convert(o.wrapS)),e.texParameteri(n,10243,a.convert(o.wrapT)),32879===n&&e.texParameteri(n,32882,a.convert(o.wrapR)),e.texParameteri(n,10240,a.convert(o.magFilter)),e.texParameteri(n,10241,a.convert(o.minFilter))):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879===n&&e.texParameteri(n,32882,33071),o.wrapS===Ms&&o.wrapT===Ms||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,f(o.magFilter)),e.texParameteri(n,10241,f(o.minFilter)),o.minFilter!==Ss&&o.minFilter!==Cs&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),c=t.get("EXT_texture_filter_anisotropic")){if(o.type===Bs&&null===t.get("OES_texture_float_linear"))return;if(o.type===Us&&null===(i.isWebGL2||t.get("OES_texture_half_float_linear")))return;(o.anisotropy>1||r.get(o).__currentAnisotropy)&&(e.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,i.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy)}}function E(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",m),t.__webglTexture=e.createTexture(),o.memory.textures++)}function S(t,r,o){var s=r.isDataTexture3D?32879:3553;E(t,r),n.activeTexture(33984+o),n.bindTexture(s,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment);var f=u(r)&&l(r.image)===!1,m=c(r.image,f,!1,i.maxTextureSize),v=l(m)||i.isWebGL2,g=a.convert(r.format),y=a.convert(r.type),b=d(g,y);M(s,r,v);var _,w=r.mipmaps;if(r.isDepthTexture){if(b=6402,r.type===Bs){if(!i.isWebGL2)throw new Error("Float Depth Texture only supported in WebGL2.0");b=36012}else i.isWebGL2&&(b=33189);r.format===Zs&&6402===b&&r.type!==Rs&&r.type!==Ns&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Rs,y=a.convert(r.type)),r.format===Js&&(b=34041,r.type!==Vs&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Vs,y=a.convert(r.type))),n.texImage2D(3553,0,b,m.width,m.height,0,g,y,null)}else if(r.isDataTexture)if(w.length>0&&v){for(var x=0,S=w.length;x-1?n.compressedTexImage2D(3553,x,b,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,x,b,_.width,_.height,0,g,y,_.data);t.__maxMipLevel=w.length-1}else if(r.isDataTexture3D)n.texImage3D(32879,0,b,m.width,m.height,m.depth,0,g,y,m.data),t.__maxMipLevel=0;else if(w.length>0&&v){for(var x=0,S=w.length;x=0){var c=r[o];if(void 0!==c){var l=c.normalized,u=c.itemSize,h=Ve.get(c);if(void 0===h)continue;var p=h.buffer,d=h.type,f=h.bytesPerElement;if(c.isInterleavedBufferAttribute){var m=c.data,v=m.stride,g=c.offset;m&&m.isInstancedInterleavedBuffer?(Ue.enableAttributeAndDivisor(s,m.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=m.meshPerAttribute*m.count)):Ue.enableAttribute(s), le.bindBuffer(34962,p),le.vertexAttribPointer(s,u,d,l,v*f,g*f)}else c.isInstancedBufferAttribute?(Ue.enableAttributeAndDivisor(s,c.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=c.meshPerAttribute*c.count)):Ue.enableAttribute(s),le.bindBuffer(34962,p),le.vertexAttribPointer(s,u,d,l,0,0)}else if(void 0!==a){var y=a[o];if(void 0!==y)switch(y.length){case 2:le.vertexAttrib2fv(s,y);break;case 3:le.vertexAttrib3fv(s,y);break;case 4:le.vertexAttrib4fv(s,y);break;default:le.vertexAttrib1fv(s,y)}}}}Ue.disableUnusedAttributes()}function m(e){et.isPresenting()||nt&&nt(e)}function y(e,t,n,r){if(e.visible!==!1){var i=e.layers.test(t.layers);if(i)if(e.isGroup)n=e.renderOrder;else if(e.isLight)ce.pushLight(e),e.castShadow&&ce.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||Le.intersectsSprite(e)){r&&Re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(De);var a=Ge.update(e),o=e.material;se.push(e,a,o,n,Re.z,null)}}else if(e.isImmediateRenderObject)r&&Re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(De),se.push(e,null,e.material,n,Re.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.update(),!e.frustumCulled||Le.intersectsObject(e))){r&&Re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(De);var a=Ge.update(e),o=e.material;if(Array.isArray(o))for(var s=a.groups,c=0,l=s.length;c=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var v=0;v=0&&e.numSupportedMorphNormals++}var y=r.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&e.clipping!==!0||(r.numClippingPlanes=Ae.numPlanes,r.numIntersection=Ae.numIntersection,y.clippingPlanes=Ae.uniform),r.fog=t,void 0===o&&(r.lightsHash=o={}),o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,e.lights&&(y.ambientLightColor.value=i.state.ambient,y.directionalLights.value=i.state.directional,y.spotLights.value=i.state.spot,y.rectAreaLights.value=i.state.rectArea,y.pointLights.value=i.state.point,y.hemisphereLights.value=i.state.hemi,y.directionalShadowMap.value=i.state.directionalShadowMap,y.directionalShadowMatrix.value=i.state.directionalShadowMatrix,y.spotShadowMap.value=i.state.spotShadowMap,y.spotShadowMatrix.value=i.state.spotShadowMatrix,y.pointShadowMap.value=i.state.pointShadowMap,y.pointShadowMatrix.value=i.state.pointShadowMatrix);var b=r.program.getUniforms(),_=We.seqWithValue(b.seq,y);r.uniformsList=_}function E(e,t,n,r){xe=0;var i=je.get(n),a=ce.state.lights,o=i.lightsHash,s=a.state.hash;if(ke&&(Oe||e!==ge)){var c=e===ge&&n.id===me;Ae.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,i,c)}n.needsUpdate===!1&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==t?n.needsUpdate=!0:!n.lights||o.stateID===s.stateID&&o.directionalLength===s.directionalLength&&o.pointLength===s.pointLength&&o.spotLength===s.spotLength&&o.rectAreaLength===s.rectAreaLength&&o.hemiLength===s.hemiLength&&o.shadowsLength===s.shadowsLength?void 0===i.numClippingPlanes||i.numClippingPlanes===Ae.numPlanes&&i.numIntersection===Ae.numIntersection||(n.needsUpdate=!0):n.needsUpdate=!0),n.needsUpdate&&(M(n,t,r),n.needsUpdate=!1);var l=!1,u=!1,h=!1,d=i.program,f=d.getUniforms(),m=i.shader.uniforms;if(Ue.useProgram(d.program)&&(l=!0,u=!0,h=!0),n.id!==me&&(me=n.id,u=!0),l||ge!==e){if(f.setValue(le,"projectionMatrix",e.projectionMatrix),Be.logarithmicDepthBuffer&&f.setValue(le,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),ge!==e&&(ge=e,u=!0,h=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var v=f.map.cameraPosition;void 0!==v&&v.setValue(le,Re.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&f.setValue(le,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){f.setOptional(le,r,"bindMatrix"),f.setOptional(le,r,"bindMatrixInverse");var g=r.skeleton;if(g){var y=g.bones;if(Be.floatVertexTextures){if(void 0===g.boneTexture){var b=Math.sqrt(4*y.length);b=Wc.ceilPowerOfTwo(b),b=Math.max(b,4);var _=new Float32Array(b*b*4);_.set(g.boneMatrices);var w=new p(_,b,b,Ws,Bs);w.needsUpdate=!0,g.boneMatrices=_,g.boneTexture=w,g.boneTextureSize=b}f.setValue(le,"boneTexture",g.boneTexture),f.setValue(le,"boneTextureSize",g.boneTextureSize)}else f.setOptional(le,g,"boneMatrices")}}return u&&(f.setValue(le,"toneMappingExposure",ue.toneMappingExposure),f.setValue(le,"toneMappingWhitePoint",ue.toneMappingWhitePoint),n.lights&&j(m,h),t&&n.fog&&A(m,t),n.isMeshBasicMaterial?S(m,n):n.isMeshLambertMaterial?(S(m,n),k(m,n)):n.isMeshPhongMaterial?(S(m,n),n.isMeshToonMaterial?D(m,n):O(m,n)):n.isMeshStandardMaterial?(S(m,n),n.isMeshPhysicalMaterial?I(m,n):R(m,n)):n.isMeshMatcapMaterial?(S(m,n),N(m,n)):n.isMeshDepthMaterial?(S(m,n),B(m,n)):n.isMeshDistanceMaterial?(S(m,n),U(m,n)):n.isMeshNormalMaterial?(S(m,n),F(m,n)):n.isLineBasicMaterial?(T(m,n),n.isLineDashedMaterial&&P(m,n)):n.isPointsMaterial?C(m,n):n.isSpriteMaterial?L(m,n):n.isShadowMaterial&&(m.color.value=n.color,m.opacity.value=n.opacity),void 0!==m.ltc_1&&(m.ltc_1.value=lh.LTC_1),void 0!==m.ltc_2&&(m.ltc_2.value=lh.LTC_2),We.upload(le,i.uniformsList,m,ue)),n.isShaderMaterial&&n.uniformsNeedUpdate===!0&&(We.upload(le,i.uniformsList,m,ue),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&f.setValue(le,"center",r.center),f.setValue(le,"modelViewMatrix",r.modelViewMatrix),f.setValue(le,"normalMatrix",r.normalMatrix),f.setValue(le,"modelMatrix",r.matrixWorld),d}function S(e,t){e.opacity.value=t.opacity,t.color&&(e.diffuse.value=t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=je.get(t.envMap).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var n;t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),n.matrixAutoUpdate===!0&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function T(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function P(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function C(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*Se,e.scale.value=.5*Ee,e.map.value=t.map,null!==t.map&&(t.map.matrixAutoUpdate===!0&&t.map.updateMatrix(),e.uvTransform.value.copy(t.map.matrix))}function L(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity,e.rotation.value=t.rotation,e.map.value=t.map,null!==t.map&&(t.map.matrixAutoUpdate===!0&&t.map.updateMatrix(),e.uvTransform.value.copy(t.map.matrix))}function A(e,t){e.fogColor.value=t.color,t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}function k(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function O(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===xo&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===xo&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function D(e,t){O(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function R(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===xo&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===xo&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function I(e,t){R(e,t),e.reflectivity.value=t.reflectivity,e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness}function N(e,t){t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===xo&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===xo&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function B(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function U(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}function F(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===xo&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===xo&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function j(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLights.needsUpdate=t,e.pointLights.needsUpdate=t,e.spotLights.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function z(){var e=xe;return e>=Be.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+e+" texture units while this GPU supports only "+Be.maxTextures),xe+=1,e}console.log("THREE.WebGLRenderer",lo),e=e||{};var V=void 0!==e.canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),H=void 0!==e.context?e.context:null,G=void 0!==e.alpha&&e.alpha,W=void 0===e.depth||e.depth,q=void 0===e.stencil||e.stencil,Y=void 0!==e.antialias&&e.antialias,X=void 0===e.premultipliedAlpha||e.premultipliedAlpha,Z=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,ie=void 0!==e.powerPreference?e.powerPreference:"default",se=null,ce=null;this.domElement=V,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=ls,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var le,ue=this,he=!1,pe=null,de=null,fe=null,me=-1,ve={geometry:null,program:null,wireframe:!1},ge=null,ye=null,be=new c,_e=new c,we=null,xe=0,Me=V.width,Ee=V.height,Se=1,Te=new c(0,0,Me,Ee),Pe=new c(0,0,Me,Ee),Ce=!1,Le=new v,Ae=new Q,ke=!1,Oe=!1,De=new r,Re=new a;try{var Ie={alpha:G,depth:W,stencil:q,antialias:Y,premultipliedAlpha:X,preserveDrawingBuffer:Z,powerPreference:ie};if(V.addEventListener("webglcontextlost",o,!1),V.addEventListener("webglcontextrestored",s,!1),le=H||V.getContext("webgl",Ie)||V.getContext("experimental-webgl",Ie),null===le)throw null!==V.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===le.getShaderPrecisionFormat&&(le.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}var Ne,Be,Ue,Fe,je,ze,Ve,He,Ge,qe,Ye,Xe,Ze,Je,Ke,$e,Qe;i();var et=null;"undefined"!=typeof navigator&&(et="xr"in navigator?new Lt(ue):new Ct(ue)),this.vr=et;var tt=new bt(ue,Ge,Be.maxTextureSize);this.shadowMap=tt,this.getContext=function(){return le},this.getContextAttributes=function(){return le.getContextAttributes()},this.forceContextLoss=function(){var e=Ne.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=Ne.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Se},this.setPixelRatio=function(e){void 0!==e&&(Se=e,this.setSize(Me,Ee,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new n),e.set(Me,Ee)},this.setSize=function(e,t,n){return et.isPresenting()?void console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(Me=e,Ee=t,V.width=e*Se,V.height=t*Se,n!==!1&&(V.style.width=e+"px",V.style.height=t+"px"),void this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new n),e.set(Me*Se,Ee*Se)},this.setDrawingBufferSize=function(e,t,n){Me=e,Ee=t,Se=n,V.width=e*n,V.height=t*n,this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new c),e.copy(be)},this.getViewport=function(e){return e.copy(Te)},this.setViewport=function(e,t,n,r){e.isVector4?Te.set(e.x,e.y,e.z,e.w):Te.set(e,t,n,r),Ue.viewport(be.copy(Te).multiplyScalar(Se))},this.getScissor=function(e){return e.copy(Pe)},this.setScissor=function(e,t,n,r){e.isVector4?Pe.set(e.x,e.y,e.z,e.w):Pe.set(e,t,n,r),Ue.scissor(_e.copy(Pe).multiplyScalar(Se))},this.getScissorTest=function(){return Ce},this.setScissorTest=function(e){Ue.setScissorTest(Ce=e)},this.getClearColor=function(){return Ze.getClearColor()},this.setClearColor=function(){Ze.setClearColor.apply(Ze,arguments)},this.getClearAlpha=function(){return Ze.getClearAlpha()},this.setClearAlpha=function(){Ze.setClearAlpha.apply(Ze,arguments)},this.clear=function(e,t,n){var r=0;(void 0===e||e)&&(r|=16384),(void 0===t||t)&&(r|=256),(void 0===n||n)&&(r|=1024),le.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){V.removeEventListener("webglcontextlost",o,!1),V.removeEventListener("webglcontextrestored",s,!1),Ye.dispose(),Xe.dispose(),je.dispose(),Ge.dispose(),et.dispose(),rt.stop()},this.renderBufferImmediate=function(e,t){Ue.initAttributes();var n=je.get(e);e.hasPositions&&!n.position&&(n.position=le.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=le.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=le.createBuffer()),e.hasColors&&!n.color&&(n.color=le.createBuffer());var r=t.getAttributes();e.hasPositions&&(le.bindBuffer(34962,n.position),le.bufferData(34962,e.positionArray,35048),Ue.enableAttribute(r.position),le.vertexAttribPointer(r.position,3,5126,!1,0,0)),e.hasNormals&&(le.bindBuffer(34962,n.normal),le.bufferData(34962,e.normalArray,35048),Ue.enableAttribute(r.normal),le.vertexAttribPointer(r.normal,3,5126,!1,0,0)),e.hasUvs&&(le.bindBuffer(34962,n.uv),le.bufferData(34962,e.uvArray,35048),Ue.enableAttribute(r.uv),le.vertexAttribPointer(r.uv,2,5126,!1,0,0)),e.hasColors&&(le.bindBuffer(34962,n.color),le.bufferData(34962,e.colorArray,35048),Ue.enableAttribute(r.color),le.vertexAttribPointer(r.color,3,5126,!1,0,0)),Ue.disableUnusedAttributes(),le.drawArrays(4,0,e.count),e.count=0},this.renderBufferDirect=function(e,n,r,i,a,o){var s=a.isMesh&&a.matrixWorld.determinant()<0;Ue.setMaterial(i,s);var c=E(e,n,i,a),l=!1;ve.geometry===r.id&&ve.program===c.id&&ve.wireframe===(i.wireframe===!0)||(ve.geometry=r.id,ve.program=c.id,ve.wireframe=i.wireframe===!0,l=!0),a.morphTargetInfluences&&(Je.update(a,r,i,c),l=!0);var u=r.index,h=r.attributes.position,p=1;i.wireframe===!0&&(u=He.getWireframeAttribute(r),p=2);var d,m=Ke;null!==u&&(d=Ve.get(u),m=$e,m.setIndex(d)),l&&(f(i,c,r),null!==u&&le.bindBuffer(34963,d.buffer));var v=1/0;null!==u?v=u.count:void 0!==h&&(v=h.count);var g=r.drawRange.start*p,y=r.drawRange.count*p,b=null!==o?o.start*p:0,_=null!==o?o.count*p:1/0,w=Math.max(g,b),x=Math.min(v,g+y,b+_)-1,M=Math.max(0,x-w+1);if(0!==M){if(a.isMesh)if(i.wireframe===!0)Ue.setLineWidth(i.wireframeLinewidth*t()),m.setMode(1);else switch(a.drawMode){case Ac:m.setMode(4);break;case kc:m.setMode(5);break;case Oc:m.setMode(6)}else if(a.isLine){var S=i.linewidth;void 0===S&&(S=1),Ue.setLineWidth(S*t()),a.isLineSegments?m.setMode(1):a.isLineLoop?m.setMode(2):m.setMode(3)}else a.isPoints?m.setMode(0):a.isSprite&&m.setMode(4);r&&r.isInstancedBufferGeometry?r.maxInstancedCount>0&&m.renderInstances(r,w,M):m.render(w,M)}},this.compile=function(e,t){ce=Xe.get(e,t),ce.init(),e.traverse(function(e){e.isLight&&(ce.pushLight(e),e.castShadow&&ce.pushShadow(e))}),ce.setupLights(t),e.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var n=0;n=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&le.readPixels(t,n,r,i,Qe.convert(l),Qe.convert(u),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&le.bindFramebuffer(36160,fe)}}},this.copyFramebufferToTexture=function(e,t,n){var r=t.image.width,i=t.image.height,a=Qe.convert(t.format);this.setTexture2D(t,0),le.copyTexImage2D(3553,n||0,a,e.x,e.y,r,i,0)},this.copyTextureToTexture=function(e,t,n,r){var i=t.image.width,a=t.image.height,o=Qe.convert(n.format),s=Qe.convert(n.type);this.setTexture2D(n,0),t.isDataTexture?le.texSubImage2D(3553,r||0,e.x,e.y,i,a,o,s,t.image.data):le.texSubImage2D(3553,r||0,e.x,e.y,o,s,t.image)}}function kt(e,t){this.name="",this.color=new b(e),this.density=void 0!==t?t:25e-5}function Ot(e,t,n){this.name="",this.color=new b(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function Dt(){S.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Rt(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function It(e,t,n,r){this.data=e,this.itemSize=t,this.offset=n,this.normalized=r===!0}function Nt(e){G.call(this),this.type="SpriteMaterial",this.color=new b(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=!0,this.lights=!1,this.transparent=!0,this.setValues(e)}function Bt(e){if(S.call(this),this.type="Sprite",void 0===Ah){Ah=new F;var t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new Rt(t,5);Ah.setIndex([0,1,2,0,2,3]),Ah.addAttribute("position",new It(r,3,0,!1)),Ah.addAttribute("uv",new It(r,2,3,!1))}this.geometry=Ah,this.material=void 0!==e?e:new Nt,this.center=new n(.5,.5)}function Ut(){S.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Ft(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),Z.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new r,this.bindMatrixInverse=new r}function jt(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n=0?(e(y-u,g,d),f.subVectors(p,d)):(e(y+u,g,d),f.subVectors(d,p)),g-u>=0?(e(y,g-u,d),m.subVectors(p,d)):(e(y,g+u,d),m.subVectors(d,p)),h.crossVectors(f,m).normalize(),c.push(h.x,h.y,h.z),l.push(y,g)}}for(r=0;r.9&&a<.1&&(t<.2&&(y[e+0]+=1),n<.2&&(y[e+2]+=1),r<.2&&(y[e+4]+=1))}}function h(e){g.push(e.x,e.y,e.z)}function p(t,n){var r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function d(){for(var e=new a,t=new a,r=new a,i=new a,o=new n,s=new n,c=new n,l=0,u=0;l0)for(a=t;a=t;a-=r)o=Vn(a,e[a],e[a+1],o);return o&&Nn(o,o.next)&&(Hn(o),o=o.next),o}function bn(e,t){if(!e)return e;t||(t=e);var n,r=e;do if(n=!1,r.steiner||!Nn(r,r.next)&&0!==In(r.prev,r,r.next))r=r.next;else{if(Hn(r),r=t=r.prev,r===r.next)break;n=!0}while(n||r!==t);return t}function _n(e,t,n,r,i,a,o){if(e){!o&&a&&Ln(e,r,i,a);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,a?xn(e,r,i,a):wn(e))t.push(s.i/n),t.push(e.i/n),t.push(c.i/n),Hn(e),e=c.next,l=c.next;else if(e=c,e===l){o?1===o?(e=Mn(e,t,n),_n(e,t,n,r,i,a,2)):2===o&&En(e,t,n,r,i,a):_n(bn(e),t,n,r,i,a,1);break}}}function wn(e){var t=e.prev,n=e,r=e.next;if(In(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(Dn(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&In(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function xn(e,t,n,r){var i=e.prev,a=e,o=e.next;if(In(i,a,o)>=0)return!1;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=kn(s,c,t,n,r),p=kn(l,u,t,n,r),d=e.nextZ;d&&d.z<=p;){if(d!==e.prev&&d!==e.next&&Dn(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&In(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=e.prevZ;d&&d.z>=h;){if(d!==e.prev&&d!==e.next&&Dn(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&In(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function Mn(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Nn(i,a)&&Bn(i,r,r.next,a)&&Fn(i,a)&&Fn(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),Hn(r),Hn(r.next),r=e=a),r=r.next}while(r!==e);return r}function En(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Rn(o,s)){var c=zn(o,s);return o=bn(o,o.next),c=bn(c,c.next),_n(o,t,n,r,i,a),void _n(c,t,n,r,i,a)}s=s.next}o=o.next}while(o!==e)}function Sn(e,t,n,r){var i,a,o,s,c,l=[];for(i=0,a=t.length;i=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x=r.x&&r.x>=u&&i!==r.x&&Dn(an.x)&&Fn(r,e)&&(n=r,p=c)),r=r.next;return n}function Ln(e,t,n,r){var i=e;do null===i.z&&(i.z=kn(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,An(i)}function An(e){var t,n,r,i,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t0||c>0&&r;)0!==s&&(0===c||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1);return e}function kn(e,t,n,r,i){return e=32767*(e-n)*i,t=32767*(t-r)*i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function On(e){var t=e,n=e;do t.x=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function Rn(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Un(e,t)&&Fn(e,t)&&Fn(t,e)&&jn(e,t)}function In(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Nn(e,t){return e.x===t.x&&e.y===t.y}function Bn(e,t,n,r){return!!(Nn(e,t)&&Nn(n,r)||Nn(e,r)&&Nn(n,t))||In(e,t,n)>0!=In(e,t,r)>0&&In(n,r,e)>0!=In(n,r,t)>0}function Un(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Bn(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Fn(e,t){return In(e.prev,e,e.next)<0?In(e,t,e.next)>=0&&In(e,e.prev,t)>=0:In(e,t,e.prev)<0||In(e,e.next,t)<0}function jn(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function zn(e,t){var n=new Gn(e.i,e.x,e.y),r=new Gn(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Vn(e,t,n,r){var i=new Gn(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Hn(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Gn(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Wn(e,t,n,r){for(var i=0,a=t,o=n-r;a2&&e[t-1].equals(e[0])&&e.pop()}function Yn(e,t){for(var n=0;nNumber.EPSILON){var d=Math.sqrt(h),f=Math.sqrt(l*l+u*u),m=t.x-c/d,v=t.y+s/d,g=r.x-u/f,y=r.y+l/f,b=((g-m)*u-(y-v)*l)/(s*u-c*l);i=m+s*b-e.x,a=v+c*b-e.y;var _=i*i+a*a;if(_<=2)return new n(i,a);o=Math.sqrt(_/2)}else{var w=!1;s>Number.EPSILON?l>Number.EPSILON&&(w=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(w=!0):Math.sign(c)===Math.sign(u)&&(w=!0),w?(i=-c,a=s,o=Math.sqrt(h)):(i=s,a=c,o=Math.sqrt(h/2))}return new n(i/o,a/o)}function l(){var e=o.length/3;if(w){var t=0,n=X*t;for(K=0;K=0;){n=K,r=K-1,r<0&&(r=e.length-1);var i=0,a=b+2*E;for(i=0;i=0;V--){for(G=V/E,W=x*Math.cos(G*Math.PI/2),H=M*Math.sin(G*Math.PI/2),K=0,$=z.length;K<$;K++)q=r(z[K],J[K],H),p(q.x,q.y,_+W);for(R=0,I=U.length;R0)&&m.push(x,M,S),(l!==n-1||u0&&h(!0),t>0&&h(!1)),this.setIndex(d),this.addAttribute("position",new I(f,3)),this.addAttribute("normal",new I(m,3)),this.addAttribute("uv",new I(v,2))}function hr(e,t,n,r,i,a,o){lr.call(this,0,e,t,n,r,i,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function pr(e,t,n,r,i,a,o){ur.call(this,0,e,t,n,r,i,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function dr(e,t,n,r){T.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new fr(e,t,n,r)),this.mergeVertices()}function fr(e,t,r,i){F.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},e=e||1,t=void 0!==t?Math.max(3,t):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var o,s,c=[],l=[],u=[],h=[],p=new a,d=new n;for(l.push(0,0,0),u.push(0,0,1),h.push(.5,.5),s=0,o=3;s<=t;s++,o+=3){var f=r+s/t*i;p.x=e*Math.cos(f),p.y=e*Math.sin(f),l.push(p.x,p.y,p.z),u.push(0,0,1),d.x=(l[o]/e+1)/2,d.y=(l[o+1]/e+1)/2,h.push(d.x,d.y)}for(o=1;o<=t;o++)c.push(o,o+1,0);this.setIndex(c),this.addAttribute("position",new I(l,3)),this.addAttribute("normal",new I(u,3)),this.addAttribute("uv",new I(h,2))}function mr(e){G.call(this),this.type="ShadowMaterial",this.color=new b(0),this.transparent=!0,this.setValues(e)}function vr(e){W.call(this,e),this.type="RawShaderMaterial"}function gr(e){G.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new b(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new b(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hc,this.normalScale=new n(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function yr(e){gr.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function br(e){G.call(this),this.type="MeshPhongMaterial",this.color=new b(16777215),this.specular=new b(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new b(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hc,this.normalScale=new n(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=as,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function _r(e){br.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function wr(e){G.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hc,this.normalScale=new n(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function xr(e){G.call(this),this.type="MeshLambertMaterial",this.color=new b(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new b(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=as,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Mr(e){G.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new b(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hc,this.normalScale=new n(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.lights=!1,this.setValues(e)}function Er(e){Vt.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}function Sr(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function Tr(e,t,n,r){Sr.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Pr(e,t,n,r){Sr.call(this,e,t,n,r)}function Cr(e,t,n,r){Sr.call(this,e,t,n,r)}function Lr(e,t,n,r){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Nh.convertArray(t,this.TimeBufferType),this.values=Nh.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function Ar(e,t,n){Lr.call(this,e,t,n)}function kr(e,t,n,r){Lr.call(this,e,t,n,r)}function Or(e,t,n,r){Lr.call(this,e,t,n,r)}function Dr(e,t,n,r){Sr.call(this,e,t,n,r)}function Rr(e,t,n,r){Lr.call(this,e,t,n,r)}function Ir(e,t,n,r){Lr.call(this,e,t,n,r)}function Nr(e,t,n,r){Lr.call(this,e,t,n,r)}function Br(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=Wc.generateUUID(),this.duration<0&&this.resetDuration()}function Ur(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Or;case"vector":case"vector2":case"vector3":case"vector4":return Nr;case"color":return kr;case"quaternion":return Rr;case"bool":case"boolean":return Ar;case"string":return Ir}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function Fr(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=Ur(e.type);if(void 0===e.times){var n=[],r=[];Nh.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}function jr(e,t,n){var r=this,i=!1,a=0,o=0,s=void 0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,i===!1&&void 0!==r.onStart&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,void 0!==r.onProgress&&r.onProgress(e,a,o),a===o&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this}}function zr(e){this.manager=void 0!==e?e:Uh}function Vr(e){this.manager=void 0!==e?e:Uh}function Hr(e){this.manager=void 0!==e?e:Uh,this._parser=null}function Gr(e){this.manager=void 0!==e?e:Uh,this._parser=null}function Wr(e){this.manager=void 0!==e?e:Uh}function qr(e){this.manager=void 0!==e?e:Uh}function Yr(e){this.manager=void 0!==e?e:Uh}function Xr(){this.type="Curve",this.arcLengthDivisions=200}function Zr(e,t,n,r,i,a,o,s){Xr.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function Jr(e,t,n,r,i,a){Zr.call(this,e,t,n,n,r,i,a),this.type="ArcCurve"}function Kr(){function e(e,a,o,s){t=e,n=o,r=-3*e+3*a-2*o-s,i=2*e-2*a+o+s}var t=0,n=0,r=0,i=0;return{initCatmullRom:function(t,n,r,i,a){e(n,r,a*(r-t),a*(i-n))},initNonuniformCatmullRom:function(t,n,r,i,a,o,s){var c=(n-t)/a-(r-t)/(a+o)+(r-n)/o,l=(r-n)/o-(i-n)/(o+s)+(i-r)/s;c*=o,l*=o,e(n,r,c,l)},calc:function(e){var a=e*e,o=a*e;return t+n*e+r*a+i*o}}}function $r(e,t,n,r){Xr.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=r||.5}function Qr(e,t,n,r,i){var a=.5*(r-t),o=.5*(i-n),s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function ei(e,t){var n=1-e;return n*n*t}function ti(e,t){return 2*(1-e)*e*t; }function ni(e,t){return e*e*t}function ri(e,t,n,r){return ei(e,t)+ti(e,n)+ni(e,r)}function ii(e,t){var n=1-e;return n*n*n*t}function ai(e,t){var n=1-e;return 3*n*n*e*t}function oi(e,t){return 3*(1-e)*e*e*t}function si(e,t){return e*e*e*t}function ci(e,t,n,r,i){return ii(e,t)+ai(e,n)+oi(e,r)+si(e,i)}function li(e,t,r,i){Xr.call(this),this.type="CubicBezierCurve",this.v0=e||new n,this.v1=t||new n,this.v2=r||new n,this.v3=i||new n}function ui(e,t,n,r){Xr.call(this),this.type="CubicBezierCurve3",this.v0=e||new a,this.v1=t||new a,this.v2=n||new a,this.v3=r||new a}function hi(e,t){Xr.call(this),this.type="LineCurve",this.v1=e||new n,this.v2=t||new n}function pi(e,t){Xr.call(this),this.type="LineCurve3",this.v1=e||new a,this.v2=t||new a}function di(e,t,r){Xr.call(this),this.type="QuadraticBezierCurve",this.v0=e||new n,this.v1=t||new n,this.v2=r||new n}function fi(e,t,n){Xr.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new a,this.v1=t||new a,this.v2=n||new a}function mi(e){Xr.call(this),this.type="SplineCurve",this.points=e||[]}function vi(){Xr.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function gi(e){vi.call(this),this.type="Path",this.currentPoint=new n,e&&this.setFromPoints(e)}function yi(e){gi.call(this,e),this.uuid=Wc.generateUUID(),this.type="Shape",this.holes=[]}function bi(e,t){S.call(this),this.type="Light",this.color=new b(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function _i(e,t,n){bi.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(S.DefaultUp),this.updateMatrix(),this.groundColor=new b(t)}function wi(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new n(512,512),this.map=null,this.matrix=new r}function xi(){wi.call(this,new St(50,1,.5,500))}function Mi(e,t,n,r,i,a){bi.call(this,e,t),this.type="SpotLight",this.position.copy(S.DefaultUp),this.updateMatrix(),this.target=new S,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==a?a:1,this.shadow=new xi}function Ei(e,t,n,r){bi.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new wi(new St(90,1,.5,500))}function Si(e,t,n,r,i,a){Et.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==n?n:1,this.bottom=void 0!==r?r:-1,this.near=void 0!==i?i:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function Ti(){wi.call(this,new Si(-5,5,5,-5,.5,500))}function Pi(e,t){bi.call(this,e,t),this.type="DirectionalLight",this.position.copy(S.DefaultUp),this.updateMatrix(),this.target=new S,this.shadow=new Ti}function Ci(e,t){bi.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function Li(e,t,n,r){bi.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}function Ai(e){this.manager=void 0!==e?e:Uh,this.textures={}}function ki(e){this.manager=void 0!==e?e:Uh}function Oi(e){this.manager=void 0!==e?e:Uh,this.resourcePath=""}function Di(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.manager=void 0!==e?e:Uh,this.options=void 0}function Ri(){this.type="ShapePath",this.color=new b,this.subPaths=[],this.currentPath=null}function Ii(e){this.type="Font",this.data=e}function Ni(e,t,n){for(var r=Array.from?Array.from(e):String(e).split(""),i=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,c=0,l=0;l0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&!function(){Object.assign=function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n>8&255]+e[t>>16&255]+e[t>>24&255]+"-"+e[255&n]+e[n>>8&255]+"-"+e[n>>16&15|64]+e[n>>24&255]+"-"+e[63&r|128]+e[r>>8&255]+"-"+e[r>>16&255]+e[r>>24&255]+e[255&i]+e[i>>8&255]+e[i>>16&255]+e[i>>24&255];return a.toUpperCase()}}(),clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(6*e-15)+10))},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Wc.DEG2RAD},radToDeg:function(e){return e*Wc.RAD2DEG},isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}};Object.defineProperties(n.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(n.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(){var e=new n,t=new n;return function(n,r){return e.set(n,n),t.set(r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}}),Object.assign(r.prototype,{isMatrix4:!0,set:function(e,t,n,r,i,a,o,s,c,l,u,h,p,d,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=r,v[1]=i,v[5]=a,v[9]=o,v[13]=s,v[2]=c,v[6]=l,v[10]=u,v[14]=h,v[3]=p,v[7]=d,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new r).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(){var e=new a;return function(t){var n=this.elements,r=t.elements,i=1/e.setFromMatrixColumn(t,0).length(),a=1/e.setFromMatrixColumn(t,1).length(),o=1/e.setFromMatrixColumn(t,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*a,n[5]=r[5]*a,n[6]=r[6]*a,n[7]=0,n[8]=r[8]*o,n[9]=r[9]*o,n[10]=r[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}}(),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i); if("XYZ"===e.order){var h=a*l,p=a*u,d=o*l,f=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=p+d*c,t[5]=h-f*c,t[9]=-o*s,t[2]=f-h*c,t[6]=d+p*c,t[10]=a*s}else if("YXZ"===e.order){var m=s*l,v=s*u,g=c*l,y=c*u;t[0]=m+y*o,t[4]=g*o-v,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=v*o-g,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){var m=s*l,v=s*u,g=c*l,y=c*u;t[0]=m-y*o,t[4]=-a*u,t[8]=g+v*o,t[1]=v+g*o,t[5]=a*l,t[9]=y-m*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var h=a*l,p=a*u,d=o*l,f=o*u;t[0]=s*l,t[4]=d*c-p,t[8]=h*c+f,t[1]=s*u,t[5]=f*c+h,t[9]=p*c-d,t[2]=-c,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var b=a*s,_=a*c,w=o*s,x=o*c;t[0]=s*l,t[4]=x-b*u,t[8]=w*u+_,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=_*u+w,t[10]=b-x*u}else if("XZY"===e.order){var b=a*s,_=a*c,w=o*s,x=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=b*u+x,t[5]=a*l,t[9]=_*u-w,t[2]=w*u-_,t[6]=o*l,t[10]=x*u+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(){var e=new a(0,0,0),t=new a(1,1,1);return function(n){return this.compose(e,n,t)}}(),lookAt:function(){var e=new a,t=new a,n=new a;return function(r,i,a){var o=this.elements;return n.subVectors(r,i),0===n.lengthSq()&&(n.z=1),n.normalize(),e.crossVectors(a,n),0===e.lengthSq()&&(1===Math.abs(a.z)?n.x+=1e-4:n.z+=1e-4,n.normalize(),e.crossVectors(a,n)),e.normalize(),t.crossVectors(n,e),o[0]=e.x,o[4]=t.x,o[8]=n.x,o[1]=e.y,o[5]=t.y,o[9]=n.y,o[2]=e.z,o[6]=t.z,o[10]=n.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],h=n[9],p=n[13],d=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],b=n[11],_=n[15],w=r[0],x=r[4],M=r[8],E=r[12],S=r[1],T=r[5],P=r[9],C=r[13],L=r[2],A=r[6],k=r[10],O=r[14],D=r[3],R=r[7],I=r[11],N=r[15];return i[0]=a*w+o*S+s*L+c*D,i[4]=a*x+o*T+s*A+c*R,i[8]=a*M+o*P+s*k+c*I,i[12]=a*E+o*C+s*O+c*N,i[1]=l*w+u*S+h*L+p*D,i[5]=l*x+u*T+h*A+p*R,i[9]=l*M+u*P+h*k+p*I,i[13]=l*E+u*C+h*O+p*N,i[2]=d*w+f*S+m*L+v*D,i[6]=d*x+f*T+m*A+v*R,i[10]=d*M+f*P+m*k+v*I,i[14]=d*E+f*C+m*O+v*N,i[3]=g*w+y*S+b*L+_*D,i[7]=g*x+y*T+b*A+_*R,i[11]=g*M+y*P+b*k+_*I,i[15]=g*E+y*C+b*O+_*N,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(){var e=new a;return function(t){for(var n=0,r=t.count;n=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var b=Math.sqrt(y),_=Math.atan2(b,v*g);m=Math.sin(m*_)/b,o=Math.sin(o*_)/b}var w=o*g;if(s=s*m+h*w,c=c*m+p*w,l=l*m+d*w,u=u*m+f*w,m===1-o){var x=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=x,c*=x,l*=x,u*=x}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}}),Object.defineProperties(i.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(i.prototype,{isQuaternion:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,r=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),h=s(n/2),p=s(r/2),d=s(i/2);return"XYZ"===a?(this._x=h*l*u+c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u-h*p*d):"YXZ"===a?(this._x=h*l*u+c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u+h*p*d):"ZXY"===a?(this._x=h*l*u-c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u-h*p*d):"ZYX"===a?(this._x=h*l*u-c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u+h*p*d):"YZX"===a?(this._x=h*l*u+c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u-h*p*d):"XZY"===a&&(this._x=h*l*u-c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u+h*p*d),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,r=n[0],i=n[4],a=n[8],o=n[1],s=n[5],c=n[9],l=n[2],u=n[6],h=n[10],p=r+s+h;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(u-c)*t,this._y=(a-l)*t,this._z=(o-i)*t):r>s&&r>h?(t=2*Math.sqrt(1+r-s-h),this._w=(u-c)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(a+l)/t):s>h?(t=2*Math.sqrt(1+s-r-h),this._w=(a-l)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(c+u)/t):(t=2*Math.sqrt(1+h-r-s),this._w=(o-i)/t,this._x=(a+l)/t,this._y=(c+u)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t=new a,n=1e-6;return function(r,i){return void 0===t&&(t=new a),e=r.dot(i)+1,eMath.abs(r.z)?t.set(-r.y,r.x,0):t.set(0,-r.z,r.y)):t.crossVectors(r,i),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),angleTo:function(e){return 2*Math.acos(Math.abs(Wc.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*n+t*this._x,this._y=c*r+t*this._y,this._z=c*i+t*this._z,this.normalize()}var l=Math.sqrt(s),u=Math.atan2(l,o),h=Math.sin((1-t)*u)/l,p=Math.sin(t*u)/l;return this._w=a*h+this._w*p,this._x=n*h+this._x*p,this._y=r*h+this._y*p,this._z=i*h+this._z*p,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(a.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e=new i;return function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(e.setFromEuler(t))}}(),applyAxisAngle:function(){var e=new i;return function(t,n){return this.applyQuaternion(e.setFromAxisAngle(t,n))}}(),applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*r-o*n,l=s*n+o*t-i*r,u=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=c*s+h*-i+l*-o-u*-a,this.y=l*s+h*-a+u*-i-c*-o,this.z=u*s+h*-o+c*-a-l*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(){var e=new r;return function(t){return this.applyMatrix4(e.getInverse(t.projectionMatrix)).applyMatrix4(t.matrixWorld)}}(),transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e=new a,t=new a;return function(n,r){return e.set(n,n,n),t.set(r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e=new a;return function(t){return e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e=new a;return function(t){return this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(Wc.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}}),Object.assign(o.prototype,{isMatrix3:!0,set:function(e,t,n,r,i,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var e=new a;return function(t){for(var n=0,r=t.count;n2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},Xc=0;s.DEFAULT_IMAGE=void 0,s.DEFAULT_MAPPING=fs,s.prototype=Object.assign(Object.create(t.prototype),{constructor:s,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=Wc.generateUUID()),!t&&void 0===e.images[r.uuid]){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a1)switch(this.wrapS){case xs:e.x=e.x-Math.floor(e.x);break;case Ms:e.x=e.x<0?0:1;break;case Es:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case xs:e.y=e.y-Math.floor(e.y);break;case Ms:e.y=e.y<0?0:1;break;case Es:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(s.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}}),Object.assign(c.prototype,{isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],h=s[1],p=s[5],d=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(l-h)y&&g>b?gb?yi&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=+(1/0),n=+(1/0),r=+(1/0),i=-(1/0),a=-(1/0),o=-(1/0),s=0,c=e.count;si&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new a),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(){var e=new a;return function(t){return this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(){function e(e){var i,a;for(i=0,a=e.length-3;i<=a;i+=3){c.fromArray(e,i);var o=u.x*Math.abs(c.x)+u.y*Math.abs(c.y)+u.z*Math.abs(c.z),s=t.dot(c),l=n.dot(c),h=r.dot(c);if(Math.max(-Math.max(s,l,h),Math.min(s,l,h))>o)return!1}return!0}var t=new a,n=new a,r=new a,i=new a,o=new a,s=new a,c=new a,l=new a,u=new a,h=new a;return function(a){if(this.isEmpty())return!1;this.getCenter(l),u.subVectors(this.max,l),t.subVectors(a.a,l),n.subVectors(a.b,l),r.subVectors(a.c,l),i.subVectors(n,t),o.subVectors(r,n),s.subVectors(t,r);var c=[0,-i.z,i.y,0,-o.z,o.y,0,-s.z,s.y,i.z,0,-i.x,o.z,0,-o.x,s.z,0,-s.x,-i.y,i.x,0,-o.y,o.x,0,-s.y,s.x,0];return!!e(c)&&(c=[1,0,0,0,1,0,0,0,1],!!e(c)&&(h.crossVectors(i,o),c=[h.x,h.y,h.z],e(c)))}}(),clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new a),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new a;return function(t){var n=e.copy(t).clamp(this.min,this.max);return n.sub(t).length()}}(),getBoundingSphere:function(){var e=new a;return function(t){return void 0===t&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),t=new f),this.getCenter(t.center),t.radius=.5*this.getSize(e).length(),t}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new a,new a,new a,new a,new a,new a,new a,new a];return function(t){return this.isEmpty()?this:(e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(e),this)}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(f.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new d;return function(t,n){var r=this.center;void 0!==n?r.copy(n):e.setFromPoints(t).getCenter(r);for(var i=0,a=0,o=t.length;athis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new d),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),Object.assign(m.prototype,{set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new a,t=new a;return function(n,r,i){var a=e.subVectors(i,r).cross(t.subVectors(n,r)).normalize();return this.setFromNormalAndCoplanarPoint(a,n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new a),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(){var e=new a;return function(t,n){void 0===n&&(console.warn("THREE.Plane: .intersectLine() target is now required"),n=new a);var r=t.delta(e),i=this.normal.dot(r);if(0!==i){var o=-(t.start.dot(this.normal)+this.constant)/i;if(!(o<0||o>1))return n.copy(r).multiplyScalar(o).add(t.start)}else if(0===this.distanceToPoint(t.start))return n.copy(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new a),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new a,t=new o;return function(n,r){var i=r||t.getNormalMatrix(n),a=this.coplanarPoint(e).applyMatrix4(n),o=this.normal.applyMatrix3(i).normalize();return this.constant=-a.dot(o),this}}(),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),Object.assign(v.prototype,{set:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],h=n[8],p=n[9],d=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(o-r,u-s,f-h,y-m).normalize(),t[1].setComponents(o+r,u+s,f+h,y+m).normalize(),t[2].setComponents(o+i,u+c,f+p,y+v).normalize(),t[3].setComponents(o-i,u-c,f-p,y-v).normalize(),t[4].setComponents(o-a,u-l,f-d,y-g).normalize(),t[5].setComponents(o+a,u+l,f+d,y+g).normalize(),this},intersectsObject:function(){var e=new f;return function(t){var n=t.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),e.copy(n.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSprite:function(){var e=new f;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){var a=t[i].distanceToPoint(n);if(a0?t.max.x:t.min.x,e.y=i.normal.y>0?t.max.y:t.min.y,e.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(e)<0)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var Zc="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",Jc="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",Kc="#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",$c="#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",Qc="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",el="vec3 transformed = vec3( position );",tl="vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",nl="vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick( specularColor, dotNV );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}",rl="#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",il="#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",al="#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",ol="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",sl="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif",cl="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",ll="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",ul="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",hl="#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",pl="#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}",dl="#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif",fl="vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = normalMatrix * objectTangent;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",ml="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",vl="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif",gl="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",yl="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",bl="gl_FragColor = linearToOutputTexel( gl_FragColor );",_l="\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",wl="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",xl="#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",Ml="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",El="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",Sl="#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",Tl="#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",Pl="#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",Cl="#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",Ll="#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif",Al="#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif",kl="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",Ol="vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif",Dl="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",Rl="#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent ));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",Il="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",Nl="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",Bl="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif",Ul="struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#endif\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\tfloat clearCoatInv = 1.0 - clearCoatDHR;\n\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec3 singleScattering = vec3( 0.0 );\n\t\tvec3 multiScattering = vec3( 0.0 );\n\t\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\t\tvec3 diffuse = material.diffuseColor;\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering;\n\t\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\t\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#else\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#endif\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",Fl="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif",jl="#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif",zl="#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, irradiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif",Vl="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",Hl="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif",Gl="#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",Wl="#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif",ql="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",Yl="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",Xl="#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif",Zl="#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif",Jl="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",Kl="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",$l="#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif",Ql="#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",eu="#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",tu="#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t#endif\n#endif",nu="#ifdef USE_NORMALMAP\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t#ifdef FLIP_SIDED\n\t\t\tnormal = - normal;\n\t\t#endif\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tnormal = normalize( normalMatrix * normal );\n\t#else\n\t\t#ifdef USE_TANGENT\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy = normalScale * mapN.xy;\n\t\t\tnormal = normalize( vTBN * mapN );\n\t\t#else\n\t\t\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\t\t#endif\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",ru="#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tuniform mat3 normalMatrix;\n\t#else\n\t\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\t\tvec2 st0 = dFdx( vUv.st );\n\t\t\tvec2 st1 = dFdy( vUv.st );\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\t\tvec3 N = normalize( surf_norm );\n\t\t\tmat3 tsn = mat3( S, T, N );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy *= normalScale;\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\treturn normalize( tsn * mapN );\n\t\t}\n\t#endif\n#endif",iu="vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",au="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",ou="vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;",su="#if defined( DITHERING )\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",cu="#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",lu="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",uu="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",hu="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",pu="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif",du="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",fu="float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}",mu="#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",vu="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",gu="#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",yu="#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",bu="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",_u="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",wu="#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",xu="#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",Mu="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",Eu="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",Su="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",Tu="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",Pu="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",Cu="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",Lu="#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif",Au="uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",ku="varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",Ou="uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",Du="varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",Ru="#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}",Iu="#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",Nu="#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",Bu="#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",Uu="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",Fu="varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",ju="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",zu="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",Vu="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",Hu="#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",Gu="uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",Wu="#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",qu="#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",Yu="#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",Xu="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",Zu="#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",Ju="#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",Ku="#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",$u="#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",Qu="#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",eh="uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",th="uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",nh="uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}",rh="#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",ih="uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}",ah="uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",oh={ alphamap_fragment:Zc,alphamap_pars_fragment:Jc,alphatest_fragment:Kc,aomap_fragment:$c,aomap_pars_fragment:Qc,begin_vertex:el,beginnormal_vertex:tl,bsdfs:nl,bumpmap_pars_fragment:rl,clipping_planes_fragment:il,clipping_planes_pars_fragment:al,clipping_planes_pars_vertex:ol,clipping_planes_vertex:sl,color_fragment:cl,color_pars_fragment:ll,color_pars_vertex:ul,color_vertex:hl,common:pl,cube_uv_reflection_fragment:dl,defaultnormal_vertex:fl,displacementmap_pars_vertex:ml,displacementmap_vertex:vl,emissivemap_fragment:gl,emissivemap_pars_fragment:yl,encodings_fragment:bl,encodings_pars_fragment:_l,envmap_fragment:wl,envmap_pars_fragment:xl,envmap_pars_vertex:Ml,envmap_physical_pars_fragment:Rl,envmap_vertex:El,fog_vertex:Sl,fog_pars_vertex:Tl,fog_fragment:Pl,fog_pars_fragment:Cl,gradientmap_pars_fragment:Ll,lightmap_fragment:Al,lightmap_pars_fragment:kl,lights_lambert_vertex:Ol,lights_pars_begin:Dl,lights_phong_fragment:Il,lights_phong_pars_fragment:Nl,lights_physical_fragment:Bl,lights_physical_pars_fragment:Ul,lights_fragment_begin:Fl,lights_fragment_maps:jl,lights_fragment_end:zl,logdepthbuf_fragment:Vl,logdepthbuf_pars_fragment:Hl,logdepthbuf_pars_vertex:Gl,logdepthbuf_vertex:Wl,map_fragment:ql,map_pars_fragment:Yl,map_particle_fragment:Xl,map_particle_pars_fragment:Zl,metalnessmap_fragment:Jl,metalnessmap_pars_fragment:Kl,morphnormal_vertex:$l,morphtarget_pars_vertex:Ql,morphtarget_vertex:eu,normal_fragment_begin:tu,normal_fragment_maps:nu,normalmap_pars_fragment:ru,packing:iu,premultiplied_alpha_fragment:au,project_vertex:ou,dithering_fragment:su,dithering_pars_fragment:cu,roughnessmap_fragment:lu,roughnessmap_pars_fragment:uu,shadowmap_pars_fragment:hu,shadowmap_pars_vertex:pu,shadowmap_vertex:du,shadowmask_pars_fragment:fu,skinbase_vertex:mu,skinning_pars_vertex:vu,skinning_vertex:gu,skinnormal_vertex:yu,specularmap_fragment:bu,specularmap_pars_fragment:_u,tonemapping_fragment:wu,tonemapping_pars_fragment:xu,uv_pars_fragment:Mu,uv_pars_vertex:Eu,uv_vertex:Su,uv2_pars_fragment:Tu,uv2_pars_vertex:Pu,uv2_vertex:Cu,worldpos_vertex:Lu,background_frag:Au,background_vert:ku,cube_frag:Ou,cube_vert:Du,depth_frag:Ru,depth_vert:Iu,distanceRGBA_frag:Nu,distanceRGBA_vert:Bu,equirect_frag:Uu,equirect_vert:Fu,linedashed_frag:ju,linedashed_vert:zu,meshbasic_frag:Vu,meshbasic_vert:Hu,meshlambert_frag:Gu,meshlambert_vert:Wu,meshmatcap_frag:qu,meshmatcap_vert:Yu,meshphong_frag:Xu,meshphong_vert:Zu,meshphysical_frag:Ju,meshphysical_vert:Ku,normal_frag:$u,normal_vert:Qu,points_frag:eh,points_vert:th,shadow_frag:nh,shadow_vert:rh,sprite_frag:ih,sprite_vert:ah},sh={clone:g,merge:y},ch={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(b.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(){function e(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}return function(t,n,r){if(t=Wc.euclideanModulo(t,1),n=Wc.clamp(n,0,1),r=Wc.clamp(r,0,1),0===n)this.r=this.g=this.b=r;else{var i=r<=.5?r*(1+n):r+n-r*n,a=2*r-i;this.r=e(a,i,t+1/3),this.g=e(a,i,t),this.b=e(a,i,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r,i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(o,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=n[1],u=l.length;if(3===u)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}if(e&&e.length>0){var l=ch[e];void 0!==l?this.setHex(l):console.warn("THREE.Color: Unknown color "+e)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(){function e(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}return function(t){return this.r=e(t.r),this.g=e(t.g),this.b=e(t.b),this}}(),copyLinearToSRGB:function(){function e(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}return function(t){return this.r=e(t.r),this.g=e(t.g),this.b=e(t.b),this}}(),convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,r=this.r,i=this.g,a=this.b,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(s+o)/2;if(s===o)t=0,n=0;else{var l=o-s;switch(n=c<=.5?l/(o+s):l/(2-o-s),o){case r:t=(i-a)/l+(i1){for(var t=0;t1){for(var t=0;t0){a.children=[];for(var c=0;c0&&(i.geometries=p),d.length>0&&(i.materials=d),f.length>0&&(i.textures=f),m.length>0&&(i.images=m),s.length>0&&(i.shapes=s)}return i.object=a,i},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var n=0;n0)for(var p=0;p0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n=0;n--){var m=d[n];for(this.faces.splice(m,1),o=0,s=this.faceVertexUvs.length;o0,x=g.vertexNormals.length>0,M=1!==g.color.r||1!==g.color.g||1!==g.color.b,E=g.vertexColors.length>0,S=0;if(S=e(S,0,0),S=e(S,1,y),S=e(S,2,b),S=e(S,3,_),S=e(S,4,w),S=e(S,5,x),S=e(S,6,M),S=e(S,7,E),u.push(S),u.push(g.a,g.b,g.c),u.push(g.materialIndex),_){var T=this.faceVertexUvs[0][c];u.push(r(T[0]),r(T[1]),r(T[2]))}if(w&&u.push(t(g.normal)),x){var P=g.vertexNormals;u.push(t(P[0]),t(P[1]),t(P[2]))}if(M&&u.push(n(g.color)),E){var C=g.vertexColors;u.push(n(C[0]),n(C[1]),n(C[2]))}}return i.data={},i.data.vertices=s,i.data.normals=h,d.length>0&&(i.data.colors=d),m.length>0&&(i.data.uvs=[m]),i.data.faces=u,i},clone:function(){return(new T).copy(this)},copy:function(e){var t,n,r,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t0,s=a[1]&&a[1].length>0,c=e.morphTargets,l=c.length;if(l>0){t=[];for(var u=0;u0){h=[];for(var u=0;u0&&0===r.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var u=0;u65535?R:O)(e,1):this.index=e},addAttribute:function(e,t){return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):(this.attributes[e]=t,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(e,new P(arguments[1],arguments[2])))},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new o).getNormalMatrix(e);r.applyToBufferAttribute(n),n.needsUpdate=!0}var i=this.attributes.tangent;if(void 0!==i){var r=(new o).getNormalMatrix(e);r.applyToBufferAttribute(i),i.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e=new r;return function(t){return e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e=new r;return function(t){return e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e=new r;return function(t){return e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e=new r;return function(t,n,r){return e.makeTranslation(t,n,r),this.applyMatrix(e),this}}(),scale:function(){var e=new r;return function(t,n,r){return e.makeScale(t,n,r),this.applyMatrix(e),this}}(),lookAt:function(){var e=new S;return function(t){e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){var e=new a;return function(){return this.computeBoundingBox(),this.boundingBox.getCenter(e).negate(),this.translate(e.x,e.y,e.z),this}}(),setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new I(3*t.vertices.length,3),r=new I(3*t.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new I(t.lineDistances.length,1);this.addAttribute("lineDistance",i.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,r=e.length;n0){var n=new Float32Array(3*e.normals.length);this.addAttribute("normal",new P(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(3*e.colors.length);this.addAttribute("color",new P(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new P(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new P(a,2).copyVector2sArray(e.uvs2))}this.groups=e.groups;for(var o in e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,u=c.length;l0){var d=new I(4*e.skinIndices.length,4);this.addAttribute("skinIndex",d.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new I(4*e.skinWeights.length,4);this.addAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new d);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var e=new d,t=new a;return function(){null===this.boundingSphere&&(this.boundingSphere=new f);var n=this.attributes.position;if(n){var r=this.boundingSphere.center;e.setFromBufferAttribute(n),e.getCenter(r);for(var i=0,a=0,o=n.count;a0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var n in i){var a=i[n],o={itemSize:a.itemSize,type:a.array.constructor.name,array:Array.prototype.slice.call(a.array),normalized:a.normalized};""!==a.name&&(o.name=a.name),e.data.attributes[n]=o}var s={},c=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],u=[],h=0,p=l.length;h0&&(s[n]=u,c=!0)}c&&(e.data.morphAttributes=s);var d=this.groups;d.length>0&&(e.data.groups=JSON.parse(JSON.stringify(d)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new F).copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;null!==i&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.addAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,r=l.length;n0&&(r.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),this.morphTargets===!0&&(r.morphTargets=!0),this.skinning===!0&&(r.skinning=!0),this.visible===!1&&(r.visible=!1),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),n){var i=t(e.textures),a=t(e.images);i.length>0&&(r.textures=i),a.length>0&&(r.images=a)}return r},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.shadowSide=e.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var mh="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",vh="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";W.prototype=Object.create(G.prototype),W.prototype.constructor=W,W.prototype.isShaderMaterial=!0,W.prototype.copy=function(e){return G.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=g(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},W.prototype.toJSON=function(e){var t=G.prototype.toJSON.call(this,e);t.uniforms={};for(var n in this.uniforms){var r=this.uniforms[n],i=r.value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var a={};for(var o in this.extensions)this.extensions[o]===!0&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t},Object.assign(q.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new a),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new a;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new a),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new a;return function(t){var n=e.subVectors(t,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(n).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new a,t=new a,n=new a;return function(r,i,a,o){e.copy(r).add(i).multiplyScalar(.5), t.copy(i).sub(r).normalize(),n.copy(this.origin).sub(e);var s,c,l,u,h=.5*r.distanceTo(i),p=-this.direction.dot(t),d=n.dot(this.direction),f=-n.dot(t),m=n.lengthSq(),v=Math.abs(1-p*p);if(v>0)if(s=p*f-d,c=p*d-f,u=h*v,s>=0)if(c>=-u)if(c<=u){var g=1/v;s*=g,c*=g,l=s*(s+p*c+2*d)+c*(p*s+c+2*f)+m}else c=h,s=Math.max(0,-(p*c+d)),l=-s*s+c*(c+2*f)+m;else c=-h,s=Math.max(0,-(p*c+d)),l=-s*s+c*(c+2*f)+m;else c<=-u?(s=Math.max(0,-(-p*h+d)),c=s>0?-h:Math.min(Math.max(-h,-f),h),l=-s*s+c*(c+2*f)+m):c<=u?(s=0,c=Math.min(Math.max(-h,-f),h),l=c*(c+2*f)+m):(s=Math.max(0,-(p*h+d)),c=s>0?h:Math.min(Math.max(-h,-f),h),l=-s*s+c*(c+2*f)+m);else c=p>0?-h:h,s=Math.max(0,-(p*c+d)),l=-s*s+c*(c+2*f)+m;return a&&a.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(t).multiplyScalar(c).add(e),l}}(),intersectSphere:function(){var e=new a;return function(t,n){e.subVectors(t.center,this.origin);var r=e.dot(this.direction),i=e.dot(e)-r*r,a=t.radius*t.radius;if(i>a)return null;var o=Math.sqrt(a-i),s=r-o,c=r+o;return s<0&&c<0?null:s<0?this.at(c,n):this.at(s,n)}}(),intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var n=e.normal.dot(this.direction);return n*t<0},intersectBox:function(e,t){var n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),l>=0?(i=(e.min.y-h.y)*l,a=(e.max.y-h.y)*l):(i=(e.max.y-h.y)*l,a=(e.min.y-h.y)*l),n>a||i>r?null:((i>n||n!==n)&&(n=i),(a=0?(o=(e.min.z-h.z)*u,s=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,s=(e.min.z-h.z)*u),n>s||o>r?null:((o>n||n!==n)&&(n=o),(s=0?n:r,t)))},intersectsBox:function(){var e=new a;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new a,t=new a,n=new a,r=new a;return function(i,a,o,s,c){t.subVectors(a,i),n.subVectors(o,i),r.crossVectors(t,n);var l,u=this.direction.dot(r);if(u>0){if(s)return null;l=1}else{if(!(u<0))return null;l=-1,u=-u}e.subVectors(this.origin,i);var h=l*this.direction.dot(n.crossVectors(e,n));if(h<0)return null;var p=l*this.direction.dot(t.cross(e));if(p<0)return null;if(h+p>u)return null;var d=-l*e.dot(r);return d<0?null:this.at(d/u,c)}}(),applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),Object.assign(Y,{getNormal:function(){var e=new a;return function(t,n,r,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new a),i.subVectors(r,n),e.subVectors(t,n),i.cross(e);var o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}}(),getBarycoord:function(){var e=new a,t=new a,n=new a;return function(r,i,o,s,c){e.subVectors(s,i),t.subVectors(o,i),n.subVectors(r,i);var l=e.dot(e),u=e.dot(t),h=e.dot(n),p=t.dot(t),d=t.dot(n),f=l*p-u*u;if(void 0===c&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),c=new a),0===f)return c.set(-2,-1,-1);var m=1/f,v=(p*h-u*d)*m,g=(l*d-u*h)*m;return c.set(1-v-g,g,v)}}(),containsPoint:function(){var e=new a;return function(t,n,r,i){return Y.getBarycoord(t,n,r,i,e),e.x>=0&&e.y>=0&&e.x+e.y<=1}}(),getUV:function(){var e=new a;return function(t,n,r,i,a,o,s,c){return this.getBarycoord(t,n,r,i,e),c.set(0,0),c.addScaledVector(a,e.x),c.addScaledVector(o,e.y),c.addScaledVector(s,e.z),c}}()}),Object.assign(Y.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){var e=new a,t=new a;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new a),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return Y.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new a),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return Y.getBarycoord(e,this.a,this.b,this.c,t)},containsPoint:function(e){return Y.containsPoint(e,this.a,this.b,this.c)},getUV:function(e,t,n,r,i){return Y.getUV(e,this.a,this.b,this.c,t,n,r,i)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(){var e=new a,t=new a,n=new a,r=new a,i=new a,o=new a;return function(s,c){void 0===c&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),c=new a);var l,u,h=this.a,p=this.b,d=this.c;e.subVectors(p,h),t.subVectors(d,h),r.subVectors(s,h);var f=e.dot(r),m=t.dot(r);if(f<=0&&m<=0)return c.copy(h);i.subVectors(s,p);var v=e.dot(i),g=t.dot(i);if(v>=0&&g<=v)return c.copy(p);var y=f*g-v*m;if(y<=0&&f>=0&&v<=0)return l=f/(f-v),c.copy(h).addScaledVector(e,l);o.subVectors(s,d);var b=e.dot(o),_=t.dot(o);if(_>=0&&b<=_)return c.copy(d);var w=b*m-f*_;if(w<=0&&m>=0&&_<=0)return u=m/(m-_),c.copy(h).addScaledVector(t,u);var x=v*_-b*g;if(x<=0&&g-v>=0&&b-_>=0)return n.subVectors(d,p),u=(g-v)/(g-v+(b-_)),c.copy(p).addScaledVector(n,u);var M=1/(x+w+y);return l=w*M,u=y*M,c.copy(h).addScaledVector(e,l).addScaledVector(t,u)}}(),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}),X.prototype=Object.create(G.prototype),X.prototype.constructor=X,X.prototype.isMeshBasicMaterial=!0,X.prototype.copy=function(e){return G.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},Z.prototype=Object.assign(Object.create(S.prototype),{constructor:Z,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e){return S.prototype.copy.call(this,e),this.drawMode=e.drawMode,void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,n,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(){function e(e,t,n,r,i,a,o,s){var c;if(c=t.side===xo?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side!==Mo,s),null===c)return null;b.copy(s),b.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(b);return ln.far?null:{distance:l,point:b.clone(),object:e}}function t(t,r,i,a,o,s,h,p,d){c.fromBufferAttribute(o,h),l.fromBufferAttribute(o,p),u.fromBufferAttribute(o,d);var f=e(t,r,i,a,c,l,u,y);if(f){s&&(m.fromBufferAttribute(s,h),v.fromBufferAttribute(s,p),g.fromBufferAttribute(s,d),f.uv=Y.getUV(y,c,l,u,m,v,g,new n));var b=new x(h,p,d);Y.getNormal(c,l,u,b.normal),f.face=b}return f}var i=new r,o=new q,s=new f,c=new a,l=new a,u=new a,h=new a,p=new a,d=new a,m=new n,v=new n,g=new n,y=new a,b=new a;return function(r,a){var f=this.geometry,b=this.material,_=this.matrixWorld;if(void 0!==b&&(null===f.boundingSphere&&f.computeBoundingSphere(),s.copy(f.boundingSphere),s.applyMatrix4(_),r.ray.intersectsSphere(s)!==!1&&(i.getInverse(_),o.copy(r.ray).applyMatrix4(i),null===f.boundingBox||o.intersectsBox(f.boundingBox)!==!1))){var w;if(f.isBufferGeometry){var x,M,E,S,T,P,C,L,A,k,O,D=f.index,R=f.attributes.position,I=f.attributes.uv,N=f.groups,B=f.drawRange;if(null!==D)if(Array.isArray(b))for(S=0,P=N.length;S0&&(z=W);for(var q=0,X=G.length;qr.far||a.push({distance:b,point:t.clone(),uv:Y.getUV(t,u,h,p,d,f,m,new n),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return S.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}}),Ut.prototype=Object.assign(Object.create(S.prototype),{constructor:Ut,copy:function(e){S.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n1){e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var i=e.distanceTo(t);r[0].object.visible=!0;for(var a=1,o=r.length;a=r[a].distance;a++)r[a-1].object.visible=!1,r[a].object.visible=!0;for(;au)){f.applyMatrix4(this.matrixWorld);var S=r.ray.origin.distanceTo(f);Sr.far||i.push({distance:S,point:d.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else for(var _=0,w=y.length/3-1;_u)){f.applyMatrix4(this.matrixWorld);var S=r.ray.origin.distanceTo(f);Sr.far||i.push({distance:S,point:d.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else if(s.isGeometry)for(var T=s.vertices,P=T.length,_=0;_u)){f.applyMatrix4(this.matrixWorld);var S=r.ray.origin.distanceTo(f);Sr.far||i.push({distance:S,point:d.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}}}(),copy:function(e){return S.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),Gt.prototype=Object.assign(Object.create(Ht.prototype),{constructor:Gt,isLineSegments:!0,computeLineDistances:function(){var e=new a,t=new a;return function(){var n=this.geometry;if(n.isBufferGeometry)if(null===n.index){for(var r=n.attributes.position,i=[],a=0,o=r.count;ar.far)return;i.push({distance:o,distanceToRay:Math.sqrt(a),point:f.clone(),index:n,face:null,object:s})}}var s=this,c=this.geometry,l=this.matrixWorld,u=r.params.Points.threshold;if(null===c.boundingSphere&&c.computeBoundingSphere(),n.copy(c.boundingSphere),n.applyMatrix4(l),n.radius+=u,r.ray.intersectsSphere(n)!==!1){e.getInverse(l),t.copy(r.ray).applyMatrix4(e);var h=u/((this.scale.x+this.scale.y+this.scale.z)/3),p=h*h,d=new a,f=new a;if(c.isBufferGeometry){var m=c.index,v=c.attributes,g=v.position.array;if(null!==m)for(var y=m.array,b=0,_=y.length;b<_;b++){var w=y[b];d.fromArray(g,3*w),o(d,w)}else for(var b=0,x=g.length/3;b=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Zt.prototype=Object.create(s.prototype),Zt.prototype.constructor=Zt,Zt.prototype.isCompressedTexture=!0,Jt.prototype=Object.create(s.prototype),Jt.prototype.constructor=Jt,Jt.prototype.isCanvasTexture=!0,Kt.prototype=Object.create(s.prototype),Kt.prototype.constructor=Kt,Kt.prototype.isDepthTexture=!0,$t.prototype=Object.create(F.prototype),$t.prototype.constructor=$t,Qt.prototype=Object.create(T.prototype),Qt.prototype.constructor=Qt,en.prototype=Object.create(F.prototype),en.prototype.constructor=en,tn.prototype=Object.create(T.prototype),tn.prototype.constructor=tn,nn.prototype=Object.create(F.prototype),nn.prototype.constructor=nn,rn.prototype=Object.create(T.prototype),rn.prototype.constructor=rn,an.prototype=Object.create(nn.prototype),an.prototype.constructor=an,on.prototype=Object.create(T.prototype),on.prototype.constructor=on,sn.prototype=Object.create(nn.prototype),sn.prototype.constructor=sn,cn.prototype=Object.create(T.prototype),cn.prototype.constructor=cn,ln.prototype=Object.create(nn.prototype),ln.prototype.constructor=ln,un.prototype=Object.create(T.prototype),un.prototype.constructor=un,hn.prototype=Object.create(nn.prototype),hn.prototype.constructor=hn,pn.prototype=Object.create(T.prototype),pn.prototype.constructor=pn,dn.prototype=Object.create(F.prototype),dn.prototype.constructor=dn,dn.prototype.toJSON=function(){var e=F.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},fn.prototype=Object.create(T.prototype),fn.prototype.constructor=fn,mn.prototype=Object.create(F.prototype),mn.prototype.constructor=mn,vn.prototype=Object.create(T.prototype),vn.prototype.constructor=vn,gn.prototype=Object.create(F.prototype),gn.prototype.constructor=gn;var kh={triangulate:function(e,t,n){n=n||2;var r=t&&t.length,i=r?t[0]*n:e.length,a=yn(e,0,i,n,!0),o=[];if(!a)return o;var s,c,l,u,h,p,d;if(r&&(a=Sn(e,t,a,n)),e.length>80*n){s=l=e[0],c=u=e[1];for(var f=n;fl&&(l=h),p>u&&(u=p);d=Math.max(l-s,u-c),d=0!==d?1/d:0}return _n(a,o,n,s,c,d),o}},Oh={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;i=i)break e;var s=t[1];e=i)break t}a=n,n=0}}for(;n>>1;et;)--a;if(++a,0!==i||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);var o=this.getValueSize();this.times=Nh.arraySlice(n,i,a),this.values=Nh.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==r&&Nh.isTypedArray(r))for(var o=0,c=r.length;o!==c;++o){var l=r[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),r=this.getInterpolation()===Tc,i=1,a=e.length-1,o=1;o0){e[i]=e[a];for(var m=a*n,v=i*n,d=0;d!==n;++d)t[v+d]=t[m+d];++i}return i!==e.length&&(this.times=Nh.arraySlice(e,0,i),this.values=Nh.arraySlice(t,0,i*n)),this},clone:function(){var e=Nh.arraySlice(this.times,0),t=Nh.arraySlice(this.values,0),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}),Ar.prototype=Object.assign(Object.create(Lr.prototype),{constructor:Ar,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Ec,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),kr.prototype=Object.assign(Object.create(Lr.prototype),{constructor:kr,ValueTypeName:"color"}),Or.prototype=Object.assign(Object.create(Lr.prototype),{constructor:Or,ValueTypeName:"number"}),Dr.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Dr,interpolate_:function(e,t,n,r){for(var a=this.resultBuffer,o=this.sampleValues,s=this.valueSize,c=e*s,l=(n-t)/(r-t),u=c+s;c!==u;c+=4)i.slerpFlat(a,0,o,c-s,o,c,l);return a}}),Rr.prototype=Object.assign(Object.create(Lr.prototype),{constructor:Rr,ValueTypeName:"quaternion",DefaultInterpolation:Sc,InterpolantFactoryMethodLinear:function(e){return new Dr(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Ir.prototype=Object.assign(Object.create(Lr.prototype),{constructor:Ir,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Ec,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Nr.prototype=Object.assign(Object.create(Lr.prototype),{constructor:Nr,ValueTypeName:"vector"}),Object.assign(Br,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Fr(n[i]).scale(r));return new Br(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},i=0,a=n.length;i!==a;++i)t.push(Lr.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,a=[],o=0;o1){var l=c[1],u=r[l];u||(r[l]=u=[]),u.push(s)}}var h=[];for(var l in r)h.push(Br.CreateFromMorphTargetSequence(l,r[l],t,n));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var a=[],o=[];Nh.flattenJSON(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],c=0;c0||0===e.search(/^data\:image\/jpeg/);i.format=r?Gs:Ws,i.needsUpdate=!0,void 0!==t&&t(i)},n,r),i},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Xr.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,r=[],i=this.getPoint(0),a=0;for(r.push(0),n=1;n<=e;n++)t=this.getPoint(n/e),a+=t.distanceTo(i),r.push(a),i=t;return this.cacheArcLengths=r,r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,r=this.getLengths(),i=0,a=r.length;n=t?t:e*r[a-1];for(var o,s=0,c=a-1;s<=c;)if(i=Math.floor(s+(c-s)/2),o=r[i]-n,o<0)s=i+1;else{if(!(o>0)){c=i;break}c=i-1}if(i=c,r[i]===n)return i/(a-1);var l=r[i],u=r[i+1],h=u-l,p=(n-l)/h,d=(i+p)/(a-1);return d},getTangent:function(e){var t=1e-4,n=e-t,r=e+t;n<0&&(n=0),r>1&&(r=1);var i=this.getPoint(n),a=this.getPoint(r),o=a.clone().sub(i);return o.normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,i,o,s=new a,c=[],l=[],u=[],h=new a,p=new r;for(n=0;n<=e;n++)i=n/e,c[n]=this.getTangentAt(i),c[n].normalize();l[0]=new a,u[0]=new a;var d=Number.MAX_VALUE,f=Math.abs(c[0].x),m=Math.abs(c[0].y),v=Math.abs(c[0].z);for(f<=d&&(d=f,s.set(1,0,0)),m<=d&&(d=m,s.set(0,1,0)),v<=d&&s.set(0,0,1),h.crossVectors(c[0],s).normalize(),l[0].crossVectors(c[0],h),u[0].crossVectors(c[0],l[0]),n=1;n<=e;n++)l[n]=l[n-1].clone(),u[n]=u[n-1].clone(),h.crossVectors(c[n-1],c[n]),h.length()>Number.EPSILON&&(h.normalize(),o=Math.acos(Wc.clamp(c[n-1].dot(c[n]),-1,1)),l[n].applyMatrix4(p.makeRotationAxis(h,o))),u[n].crossVectors(c[n],l[n]);if(t===!0)for(o=Math.acos(Wc.clamp(l[0].dot(l[e]),-1,1)),o/=e,c[0].dot(h.crossVectors(l[0],l[e]))>0&&(o=-o),n=1;n<=e;n++)l[n].applyMatrix4(p.makeRotationAxis(c[n],o*n)),u[n].crossVectors(c[n],l[n]);return{tangents:c,normals:l,binormals:u}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),Zr.prototype=Object.create(Xr.prototype),Zr.prototype.constructor=Zr,Zr.prototype.isEllipseCurve=!0,Zr.prototype.getPoint=function(e,t){for(var r=t||new n,i=2*Math.PI,a=this.aEndAngle-this.aStartAngle,o=Math.abs(a)i;)a-=i;a0?0:(Math.floor(Math.abs(s)/i)+1)*i:0===c&&s===i-1&&(s=i-2,c=1);var l,u,h,p;if(this.closed||s>0?l=r[(s-1)%i]:(jh.subVectors(r[0],r[1]).add(r[0]),l=jh),u=r[s%i],h=r[(s+1)%i],this.closed||s+2i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return r.set(Qr(s,c.x,l.x,u.x,h.x),Qr(s,c.y,l.y,u.y,h.y)),r},mi.prototype.copy=function(e){Xr.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t=t){var i=n[r]-t,a=this.curves[r],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){Xr.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);this.currentPoint.copy(u)},copy:function(e){return vi.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=vi.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return vi.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),yi.prototype=Object.assign(Object.create(gi.prototype),{constructor:yi,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n0){var a=new jr(t),o=new Wr(a);o.setCrossOrigin(this.crossOrigin);for(var s=0,c=e.length;s0?new Ft(o,s):new Z(o,s),void 0!==e.drawMode&&a.setDrawMode(e.drawMode);break;case"LOD":a=new Ut;break;case"Line":a=new Ht(r(e.geometry),i(e.material),e.mode);break;case"LineLoop":a=new Wt(r(e.geometry),i(e.material));break;case"LineSegments":a=new Gt(r(e.geometry),i(e.material));break;case"PointCloud":case"Points":a=new Yt(r(e.geometry),i(e.material));break;case"Sprite":a=new Bt(i(e.material));break;case"Group":a=new Mt;break;default:a=new S}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(a.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.frustumCulled&&(a.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(a.renderOrder=e.renderOrder),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.layers&&(a.layers.mask=e.layers),void 0!==e.children)for(var c=e.children,l=0;lNumber.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[i],l=-l),e.ys.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var u=l*(e.x-o.x)-c*(e.y-o.y);if(0===u)return!0;if(u<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var i=Oh.isClockWise,a=this.subPaths;if(0===a.length)return[];if(t===!0)return n(a);var o,s,c,l=[];if(1===a.length)return s=a[0],c=new yi,c.curves=s.curves,l.push(c),l;var u=!i(a[0].getPoints());u=e?!u:u;var h,p=[],d=[],f=[],m=0;d[m]=void 0,f[m]=[];for(var v=0,g=a.length;v1){for(var y=!1,b=[],_=0,w=d.length;_0&&(y||(f=p))}for(var P,v=0,C=d.length;v0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,r){i.slerpFlat(e,t,e,t,e,n,r)},_lerp:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}}});var $h="\\[\\]\\.:\\/";Object.assign(Zi.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(Ji,{Composite:Zi,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Ji.Composite(e,t,n):new Ji(e,t,n)},sanitizeNodeName:function(){var e=new RegExp("["+$h+"]","g");return function(t){return t.replace(/\s/g,"_").replace(e,"")}}(),parseTrackName:function(){var e="[^"+$h+"]",t="[^"+$h.replace("\\.","")+"]",n=/((?:WC+[\/:])*)/.source.replace("WC",e),r=/(WCOD+)?/.source.replace("WCOD",t),i=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",e),a=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",e),o=new RegExp("^"+n+r+i+a+"$"),s=["material","materials","bones"];return function(e){var t=o.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&r!==-1){var i=n.nodeName.substring(r+1);s.indexOf(i)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}}(),findNode:function(e,t){if(!t||""===t||"root"===t||"."===t||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var r=function(e){for(var n=0;n=t){var u=t++,h=e[u];n[h.uuid]=l,e[l]=h,n[c]=u,e[u]=s;for(var p=0,d=i;p!==d;++p){var f=r[p],m=f[u],v=f[l];f[l]=m,f[u]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],l=c.uuid,u=r[l];if(void 0!==u)if(delete r[l],u0)for(var c=this._interpolants,l=this._propertyBindings,u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(r,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,r=this.loop,i=this._loopCount,a=r===Mc;if(0===e)return i===-1?t:a&&1===(1&i)?n-t:t;if(r===wc){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(i===-1&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&1===(1&i))return this.time=t,n-t}return this.time=t,t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=Cc,r.endingEnd=Cc):(e?r.endingStart=this.zeroSlopeAtStart?Cc:Pc:r.endingStart=Lc,t?r.endingEnd=this.zeroSlopeAtEnd?Cc:Pc:r.endingEnd=Lc)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}),Qi.prototype=Object.assign(Object.create(t.prototype),{constructor:Qi,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var u=0;u!==i;++u){var h=r[u],p=h.name,d=l[p];if(void 0!==d)a[u]=d;else{if(d=a[u],void 0!==d){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[u].binding.parsedPath;d=new Xi(Ji.create(n,p,f),h.ValueTypeName,h.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,s,p),a[u]=d}o[u].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0===--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length; },get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&tthis.max.x||e.ythis.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new n),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new n),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new n;return function(t){var n=e.copy(t).clamp(this.min,this.max);return n.sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(ua.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new a),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new a),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new a),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new a,t=new a;return function(n,r){e.subVectors(n,this.start),t.subVectors(this.end,this.start);var i=t.dot(t),a=t.dot(e),o=a/i;return r&&(o=Wc.clamp(o,0,1)),o}}(),closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new a),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),ha.prototype=Object.create(S.prototype),ha.prototype.constructor=ha,ha.prototype.isImmediateRenderObject=!0,pa.prototype=Object.create(Gt.prototype),pa.prototype.constructor=pa,pa.prototype.update=function(){var e=new a,t=new a,n=new o;return function(){var r=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var i=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry;if(o&&o.isGeometry)for(var s=o.vertices,c=o.faces,l=0,u=0,h=c.length;u1&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}},ga.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()},ya.prototype=Object.create(S.prototype),ya.prototype.constructor=ya,ya.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},ya.prototype.update=function(){var e=new a,t=new b,n=new b;return function(){var r=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var i=r.geometry.getAttribute("color");t.copy(this.light.color),n.copy(this.light.groundColor);for(var a=0,o=i.count;a.99999?this.quaternion.set(0,0,0,1):n.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(n.z,0,-n.x).normalize(),e=Math.acos(n.y),this.quaternion.setFromAxisAngle(t,e))}}(),Ca.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},Ca.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},Ca.prototype.copy=function(e){return S.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},Ca.prototype.clone=function(){return(new this.constructor).copy(this)},La.prototype=Object.create(Gt.prototype),La.prototype.constructor=La;var tp=0,np=1;Xr.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Xr.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(vi.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new T,n=0,r=e.length;nZ)throw new RangeError("Invalid typed array length");var n=new Uint8Array(t);return n.__proto__=e.prototype,n}function e(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return c(e)}return a(e,t,n)}function a(e,t,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return W(e)||e&&W(e.buffer)?h(e,t,n):"string"==typeof e?l(e,t):p(e)}function o(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('"size" argument must not be negative')}function s(e,t,n){return o(e),e<=0?i(e):void 0!==t?"string"==typeof n?i(e).fill(t,n):i(e).fill(t):i(e)}function c(e){return o(e),i(e<0?0:0|d(e))}function l(t,n){if("string"==typeof n&&""!==n||(n="utf8"),!e.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var r=0|m(t,n),a=i(r),o=a.write(t,n);return o!==r&&(a=a.slice(0,o)),a}function u(e){for(var t=e.length<0?0:0|d(e.length),n=i(t),r=0;r=Z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z.toString(16)+" bytes");return 0|e}function f(t){return+t!=t&&(t=0),e.alloc(+t)}function m(t,n){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(n){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(i)return j(t).length;n=(""+n).toLowerCase(),i=!0}}function v(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,n);case"utf8":case"utf-8":return P(this,t,n);case"ascii":return L(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(t,n,r,i,a){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,q(r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof n&&(n=e.from(n,i)),e.isBuffer(n))return 0===n.length?-1:b(t,n,r,i,a);if("number"==typeof n)return n&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,n,r):Uint8Array.prototype.lastIndexOf.call(t,n,r):b(t,[n],r,i,a);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){function a(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,s=e.length,c=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,n/=2}var l;if(i){var u=-1;for(l=n;ls&&(n=s-c),l=n;l>=0;l--){for(var h=!0,p=0;pi&&(r=i)):r=i;var a=t.length;r>a/2&&(r=a/2);for(var o=0;o239?4:a>223?3:a>191?2:1;if(i+s<=n){var c,l,u,h;switch(s){case 1:a<128&&(o=a);break;case 2:c=e[i+1],128===(192&c)&&(h=(31&a)<<6|63&c,h>127&&(o=h));break;case 3:c=e[i+1],l=e[i+2],128===(192&c)&&128===(192&l)&&(h=(15&a)<<12|(63&c)<<6|63&l,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:c=e[i+1],l=e[i+2],u=e[i+3],128===(192&c)&&128===(192&l)&&128===(192&u)&&(h=(15&a)<<18|(63&c)<<12|(63&l)<<6|63&u,h>65535&&h<1114112&&(o=h))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return C(r)}function C(e){var t=e.length;if(t<=J)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",a=t;an)throw new RangeError("Trying to access beyond buffer length")}function R(t,n,r,i,a,o){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance'); if(n>a||nt.length)throw new RangeError("Index out of range")}function I(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(e,t,n,r,i){return t=+t,n>>>=0,i||I(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,i){return t=+t,n>>>=0,i||I(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(e,t,n,r,52,8),n+8}function U(e){if(e=e.split("=")[0],e=e.trim().replace(K,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function F(e){return e<16?"0"+e.toString(16):e.toString(16)}function j(e,t){t=t||1/0;for(var n,r=e.length,i=null,a=[],o=0;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function z(e){for(var t=[],n=0;n>8,i=n%256,a.push(i),a.push(r);return a}function H(e){return Y.toByteArray(U(e))}function G(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function W(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function q(e){return e!==e}var Y=n(208),X=n(209);t.Buffer=e,t.SlowBuffer=f,t.INSPECT_MAX_BYTES=50;var Z=2147483647;t.kMaxLength=Z,e.TYPED_ARRAY_SUPPORT=r(),e.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(e.prototype,"parent",{get:function(){if(this instanceof e)return this.buffer}}),Object.defineProperty(e.prototype,"offset",{get:function(){if(this instanceof e)return this.byteOffset}}),"undefined"!=typeof Symbol&&Symbol.species&&e[Symbol.species]===e&&Object.defineProperty(e,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),e.poolSize=8192,e.from=function(e,t,n){return a(e,t,n)},e.prototype.__proto__=Uint8Array.prototype,e.__proto__=Uint8Array,e.alloc=function(e,t,n){return s(e,t,n)},e.allocUnsafe=function(e){return c(e)},e.allocUnsafeSlow=function(e){return c(e)},e.isBuffer=function(e){return null!=e&&e._isBuffer===!0},e.compare=function(t,n){if(!e.isBuffer(t)||!e.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(t===n)return 0;for(var r=t.length,i=n.length,a=0,o=Math.min(r,i);a0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},e.prototype.compare=function(t,n,r,i,a){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===a&&(a=this.length),n<0||r>t.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&n>=r)return 0;if(i>=a)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,a>>>=0,this===t)return 0;for(var o=a-i,s=r-n,c=Math.min(o,s),l=this.slice(i,a),u=t.slice(n,r),h=0;h>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return _(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return x(this,e,t,n);case"latin1":case"binary":return M(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var J=4096;e.prototype.slice=function(t,n){var r=this.length;t=~~t,n=void 0===n?r:~~n,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n>>=0,t>>>=0,n||D(e,t,this.length);for(var r=this[e],i=1,a=0;++a>>=0,t>>>=0,n||D(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},e.prototype.readUInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),this[e]},e.prototype.readUInt16LE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]|this[e+1]<<8},e.prototype.readUInt16BE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]<<8|this[e+1]},e.prototype.readUInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},e.prototype.readUInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},e.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||D(e,t,this.length);for(var r=this[e],i=1,a=0;++a=i&&(r-=Math.pow(2,8*t)),r},e.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||D(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},e.prototype.readInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},e.prototype.readInt16LE=function(e,t){e>>>=0,t||D(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},e.prototype.readInt16BE=function(e,t){e>>>=0,t||D(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},e.prototype.readInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},e.prototype.readInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},e.prototype.readFloatLE=function(e,t){return e>>>=0,t||D(e,4,this.length),X.read(this,e,!0,23,4)},e.prototype.readFloatBE=function(e,t){return e>>>=0,t||D(e,4,this.length),X.read(this,e,!1,23,4)},e.prototype.readDoubleLE=function(e,t){return e>>>=0,t||D(e,8,this.length),X.read(this,e,!0,52,8)},e.prototype.readDoubleBE=function(e,t){return e>>>=0,t||D(e,8,this.length),X.read(this,e,!1,52,8)},e.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;R(this,e,t,n,i,0)}var a=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;R(this,e,t,n,i,0)}var a=n-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+n},e.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},e.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},e.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},e.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},e.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},e.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a>0)-s&255;return t+n},e.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},e.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},e.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},e.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},e.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},e.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},e.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},e.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)},e.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},e.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},e.prototype.copy=function(t,n,r,i){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),n>=t.length&&(n=t.length),n||(n=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-n=0;--o)t[o+n]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,i),n);return a},e.prototype.fill=function(t,n,r,i){if("string"==typeof t){if("string"==typeof n?(i=n,n=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!e.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var a=t.charCodeAt(0);("utf8"===i&&a<128||"latin1"===i)&&(t=a)}}else"number"==typeof t&&(t&=255);if(n<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=n;o=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),o.alloc(+e)}function g(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return X(e).length;default:if(r)return W(e).length;t=(""+t).toLowerCase(),r=!0}}function y(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return D(this,t,n);case"utf8":case"utf-8":return L(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function _(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,i);if("number"==typeof t)return t&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,i){function a(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,s=e.length,c=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,n/=2}var l;if(i){var u=-1;for(l=n;ls&&(n=s-c),l=n;l>=0;l--){for(var h=!0,p=0;pi&&(r=i)):r=i;var a=t.length;if(a%2!==0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o239?4:a>223?3:a>191?2:1;if(i+s<=n){var c,l,u,h;switch(s){case 1:a<128&&(o=a);break;case 2:c=e[i+1],128===(192&c)&&(h=(31&a)<<6|63&c,h>127&&(o=h));break;case 3:c=e[i+1],l=e[i+2],128===(192&c)&&128===(192&l)&&(h=(15&a)<<12|(63&c)<<6|63&l,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:c=e[i+1],l=e[i+2],u=e[i+3],128===(192&c)&&128===(192&l)&&128===(192&u)&&(h=(15&a)<<18|(63&c)<<12|(63&l)<<6|63&u,h>65535&&h<1114112&&(o=h))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return A(r)}function A(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",a=t;an)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function B(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function U(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function F(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(e,t,n,r,i){return i||F(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(e,t,n,r,23,4),n+4}function z(e,t,n,r,i){return i||F(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(e,t,n,r,52,8),n+8}function V(e){if(e=H(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function H(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function G(e){return e<16?"0"+e.toString(16):e.toString(16)}function W(e,t){t=t||1/0;for(var n,r=e.length,i=null,a=[],o=0;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function q(e){for(var t=[],n=0;n>8,i=n%256,a.push(i),a.push(r);return a}function X(e){return K.toByteArray(V(e))}function Z(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function J(e){return e!==e}var K=n(208),$=n(209),Q=n(210);t.Buffer=o,t.SlowBuffer=v,t.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:r(),t.kMaxLength=i(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,n){return s(null,e,t,n)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,n){return l(null,e,t,n)},o.allocUnsafe=function(e){return u(null,e)},o.allocUnsafeSlow=function(e){return u(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},o.prototype.compare=function(e,t,n,r,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,s=n-t,c=Math.min(a,s),l=this.slice(r,i),u=e.slice(t,n),h=0;hi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return M(this,e,t,n);case"ascii":return E(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return T(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;o.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],i=1,a=0;++a=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},o.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),$.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),$.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),$.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),$.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var i=Math.pow(2,8*n)-1;N(this,e,t,n,i,0)}var a=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+a]=e/o&255;return t+n},o.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):B(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):B(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a>0)-s&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):B(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):B(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,n){return j(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return j(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return z(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return z(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length), e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function r(e){var t=n(e),r=t[0],i=t[1];return 3*(r+i)/4-i}function i(e,t,n){return 3*(t+n)/4-n}function a(e){for(var t,r=n(e),a=r[0],o=r[1],s=new h(i(e,a,o)),c=0,l=o>0?a-4:a,p=0;p>16&255,s[c++]=t>>8&255,s[c++]=255&t;return 2===o&&(t=u[e.charCodeAt(p)]<<2|u[e.charCodeAt(p+1)]>>4,s[c++]=255&t),1===o&&(t=u[e.charCodeAt(p)]<<10|u[e.charCodeAt(p+1)]<<4|u[e.charCodeAt(p+2)]>>2,s[c++]=t>>8&255,s[c++]=255&t),s}function o(e){return l[e>>18&63]+l[e>>12&63]+l[e>>6&63]+l[63&e]}function s(e,t,n){for(var r,i=[],a=t;ac?c:o+a));return 1===r?(t=e[n-1],i.push(l[t>>2]+l[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(l[t>>10]+l[t>>4&63]+l[t<<2&63]+"=")),i.join("")}t.byteLength=r,t.toByteArray=a,t.fromByteArray=c;for(var l=[],u=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,f=p.length;d>1,u=-7,h=n?i-1:0,p=n?-1:1,d=e[t+h];for(h+=p,a=d&(1<<-u)-1,d>>=-u,u+=s;u>0;a=256*a+e[t+h],h+=p,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=256*o+e[t+h],h+=p,u-=8);if(0===a)a=1-l;else{if(a===c)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,r),a-=l}return(d?-1:1)*o*Math.pow(2,a-r)},t.write=function(e,t,n,r,i,a){var o,s,c,l=8*a-i-1,u=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:a-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),t+=o+h>=1?p/c:p*Math.pow(2,1-h),t*c>=2&&(o++,c/=2),o+h>=u?(s=0,o=u):o+h>=1?(s=(t*c-1)*Math.pow(2,i),o+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[n+d]=255&s,d+=f,s/=256,i-=8);for(o=o<0;e[n+d]=255&o,d+=f,o/=256,l-=8);e[n+d-f]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var r=n(212).assign,i=n(213),a=n(221),o=n(225),s={};r(s,i,a,o),e.exports=s},function(e,t){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)n(r,i)&&(e[i]=r[i])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)return void e.set(t.subarray(n,n+r),i);for(var a=0;a0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var n=s.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==m)throw new Error(u[n]);if(t.header&&s.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(i="string"==typeof t.dictionary?l.string2buf(t.dictionary):"[object ArrayBuffer]"===p.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=s.deflateSetDictionary(this.strm,i),n!==m)throw new Error(u[n]);this._dict_set=!0}}function i(e,t){var n=new r(t);if(n.push(e,!0),n.err)throw n.msg||u[n.err];return n.result}function a(e,t){return t=t||{},t.raw=!0,i(e,t)}function o(e,t){return t=t||{},t.gzip=!0,i(e,t)}var s=n(214),c=n(212),l=n(219),u=n(218),h=n(220),p=Object.prototype.toString,d=0,f=4,m=0,v=1,g=2,y=-1,b=0,_=8;r.prototype.push=function(e,t){var n,r,i=this.strm,a=this.options.chunkSize;if(this.ended)return!1;r=t===~~t?t:t===!0?f:d,"string"==typeof e?i.input=l.string2buf(e):"[object ArrayBuffer]"===p.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new c.Buf8(a),i.next_out=0,i.avail_out=a),n=s.deflate(i,r),n!==v&&n!==m)return this.onEnd(n),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||r!==f&&r!==g)||("string"===this.options.to?this.onData(l.buf2binstring(c.shrinkBuf(i.output,i.next_out))):this.onData(c.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&n!==v);return r===f?(n=s.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===m):r!==g||(this.onEnd(m),i.avail_out=0,!0)},r.prototype.onData=function(e){this.chunks.push(e)},r.prototype.onEnd=function(e){e===m&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=c.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=r,t.deflate=i,t.deflateRaw=a,t.gzip=o},function(e,t,n){"use strict";function r(e,t){return e.msg=R[t],t}function i(e){return(e<<1)-(e>4?9:0)}function a(e){for(var t=e.length;--t>=0;)e[t]=0}function o(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(A.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function s(e,t){k._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,o(e.strm)}function c(e,t){e.pending_buf[e.pending++]=t}function l(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function u(e,t,n,r){var i=e.avail_in;return i>r&&(i=r),0===i?0:(e.avail_in-=i,A.arraySet(t,e.input,e.next_in,i,n),1===e.state.wrap?e.adler=O(e.adler,t,i,n):2===e.state.wrap&&(e.adler=D(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)}function h(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-he?e.strstart-(e.w_size-he):0,l=e.window,u=e.w_mask,h=e.prev,p=e.strstart+ue,d=l[a+o-1],f=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do if(n=t,l[n+o]===f&&l[n+o-1]===d&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do;while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ao){if(e.match_start=t,o=r,r>=s)break;d=l[a+o-1],f=l[a+o]}}while((t=h[t&u])>c&&0!==--i);return o<=e.lookahead?o:e.lookahead}function p(e){var t,n,r,i,a,o=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=o+(o-he)){A.arraySet(e.window,e.window,o,o,0),e.match_start-=o,e.strstart-=o,e.block_start-=o,n=e.hash_size,t=n;do r=e.head[--t],e.head[t]=r>=o?r-o:0;while(--n);n=o,t=n;do r=e.prev[--t],e.prev[t]=r>=o?r-o:0;while(--n);i+=o}if(0===e.strm.avail_in)break;if(n=u(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=n,e.lookahead+e.insert>=le)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(p(e),0===e.lookahead&&t===I)return _e;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,s(e,!1),0===e.strm.avail_out))return _e;if(e.strstart-e.block_start>=e.w_size-he&&(s(e,!1),0===e.strm.avail_out))return _e}return e.insert=0,t===U?(s(e,!0),0===e.strm.avail_out?xe:Me):e.strstart>e.block_start&&(s(e,!1),0===e.strm.avail_out)?_e:_e}function f(e,t){for(var n,r;;){if(e.lookahead=le&&(e.ins_h=(e.ins_h<=le)if(r=k._tr_tally(e,e.strstart-e.match_start,e.match_length-le),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=le){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<=le&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=le-1)),e.prev_length>=le&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-le,r=k._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-le),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<=le&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+ue;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=le?(n=k._tr_tally(e,1,e.match_length-le),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=k._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(s(e,!1),0===e.strm.avail_out))return _e}return e.insert=0,t===U?(s(e,!0),0===e.strm.avail_out?xe:Me):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?_e:we}function g(e,t){for(var n;;){if(0===e.lookahead&&(p(e),0===e.lookahead)){if(t===I)return _e;break}if(e.match_length=0,n=k._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(s(e,!1),0===e.strm.avail_out))return _e}return e.insert=0,t===U?(s(e,!0),0===e.strm.avail_out?xe:Me):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?_e:we}function y(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}function b(e){e.window_size=2*e.w_size,a(e.head),e.max_lazy_match=L[e.level].max_lazy,e.good_match=L[e.level].good_length,e.nice_match=L[e.level].nice_length,e.max_chain_length=L[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=le-1,e.match_available=0,e.ins_h=0}function _(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=$,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new A.Buf16(2*se),this.dyn_dtree=new A.Buf16(2*(2*ae+1)),this.bl_tree=new A.Buf16(2*(2*oe+1)),a(this.dyn_ltree),a(this.dyn_dtree),a(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new A.Buf16(ce+1),this.heap=new A.Buf16(2*ie+1),a(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new A.Buf16(2*ie+1),a(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function w(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=K,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?de:ye,e.adler=2===t.wrap?0:1,t.last_flush=I,k._tr_init(t),j):r(e,V)}function x(e){var t=w(e);return t===j&&b(e.state),t}function M(e,t){return e&&e.state?2!==e.state.wrap?V:(e.state.gzhead=t,j):V}function E(e,t,n,i,a,o){if(!e)return V;var s=1;if(t===W&&(t=6),i<0?(s=0,i=-i):i>15&&(s=2,i-=16),a<1||a>Q||n!==$||i<8||i>15||t<0||t>9||o<0||o>Z)return r(e,V);8===i&&(i=9);var c=new _;return e.state=c,c.strm=e,c.wrap=s,c.gzhead=null,c.w_bits=i,c.w_size=1<F||t<0)return e?r(e,V):V;if(s=e.state,!e.output||!e.input&&0!==e.avail_in||s.status===be&&t!==U)return r(e,0===e.avail_out?G:V);if(s.strm=e,n=s.last_flush,s.last_flush=t,s.status===de)if(2===s.wrap)e.adler=0,c(s,31),c(s,139),c(s,8),s.gzhead?(c(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(s.gzhead.extra?4:0)+(s.gzhead.name?8:0)+(s.gzhead.comment?16:0)),c(s,255&s.gzhead.time),c(s,s.gzhead.time>>8&255),c(s,s.gzhead.time>>16&255),c(s,s.gzhead.time>>24&255),c(s,9===s.level?2:s.strategy>=Y||s.level<2?4:0),c(s,255&s.gzhead.os),s.gzhead.extra&&s.gzhead.extra.length&&(c(s,255&s.gzhead.extra.length),c(s,s.gzhead.extra.length>>8&255)),s.gzhead.hcrc&&(e.adler=D(e.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=fe):(c(s,0),c(s,0),c(s,0),c(s,0),c(s,0),c(s,9===s.level?2:s.strategy>=Y||s.level<2?4:0),c(s,Ee),s.status=ye);else{var p=$+(s.w_bits-8<<4)<<8,d=-1;d=s.strategy>=Y||s.level<2?0:s.level<6?1:6===s.level?2:3,p|=d<<6,0!==s.strstart&&(p|=pe),p+=31-p%31,s.status=ye,l(s,p),0!==s.strstart&&(l(s,e.adler>>>16),l(s,65535&e.adler)),e.adler=1}if(s.status===fe)if(s.gzhead.extra){for(u=s.pending;s.gzindex<(65535&s.gzhead.extra.length)&&(s.pending!==s.pending_buf_size||(s.gzhead.hcrc&&s.pending>u&&(e.adler=D(e.adler,s.pending_buf,s.pending-u,u)),o(e),u=s.pending,s.pending!==s.pending_buf_size));)c(s,255&s.gzhead.extra[s.gzindex]),s.gzindex++;s.gzhead.hcrc&&s.pending>u&&(e.adler=D(e.adler,s.pending_buf,s.pending-u,u)),s.gzindex===s.gzhead.extra.length&&(s.gzindex=0,s.status=me)}else s.status=me;if(s.status===me)if(s.gzhead.name){u=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>u&&(e.adler=D(e.adler,s.pending_buf,s.pending-u,u)),o(e),u=s.pending,s.pending===s.pending_buf_size)){h=1;break}h=s.gzindexu&&(e.adler=D(e.adler,s.pending_buf,s.pending-u,u)),0===h&&(s.gzindex=0,s.status=ve)}else s.status=ve;if(s.status===ve)if(s.gzhead.comment){u=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>u&&(e.adler=D(e.adler,s.pending_buf,s.pending-u,u)),o(e),u=s.pending,s.pending===s.pending_buf_size)){h=1;break}h=s.gzindexu&&(e.adler=D(e.adler,s.pending_buf,s.pending-u,u)),0===h&&(s.status=ge)}else s.status=ge;if(s.status===ge&&(s.gzhead.hcrc?(s.pending+2>s.pending_buf_size&&o(e),s.pending+2<=s.pending_buf_size&&(c(s,255&e.adler),c(s,e.adler>>8&255),e.adler=0,s.status=ye)):s.status=ye),0!==s.pending){if(o(e),0===e.avail_out)return s.last_flush=-1,j}else if(0===e.avail_in&&i(t)<=i(n)&&t!==U)return r(e,G);if(s.status===be&&0!==e.avail_in)return r(e,G);if(0!==e.avail_in||0!==s.lookahead||t!==I&&s.status!==be){var f=s.strategy===Y?g(s,t):s.strategy===X?v(s,t):L[s.level].func(s,t);if(f!==xe&&f!==Me||(s.status=be),f===_e||f===xe)return 0===e.avail_out&&(s.last_flush=-1),j;if(f===we&&(t===N?k._tr_align(s):t!==F&&(k._tr_stored_block(s,0,0,!1),t===B&&(a(s.head),0===s.lookahead&&(s.strstart=0,s.block_start=0,s.insert=0))),o(e),0===e.avail_out))return s.last_flush=-1,j}return t!==U?j:s.wrap<=0?z:(2===s.wrap?(c(s,255&e.adler),c(s,e.adler>>8&255),c(s,e.adler>>16&255),c(s,e.adler>>24&255),c(s,255&e.total_in),c(s,e.total_in>>8&255),c(s,e.total_in>>16&255),c(s,e.total_in>>24&255)):(l(s,e.adler>>>16),l(s,65535&e.adler)),o(e),s.wrap>0&&(s.wrap=-s.wrap),0!==s.pending?j:z)}function P(e){var t;return e&&e.state?(t=e.state.status,t!==de&&t!==fe&&t!==me&&t!==ve&&t!==ge&&t!==ye&&t!==be?r(e,V):(e.state=null,t===ye?r(e,H):j)):V}function C(e,t){var n,r,i,o,s,c,l,u,h=t.length;if(!e||!e.state)return V;if(n=e.state,o=n.wrap,2===o||1===o&&n.status!==de||n.lookahead)return V;for(1===o&&(e.adler=O(e.adler,t,h,0)),n.wrap=0,h>=n.w_size&&(0===o&&(a(n.head),n.strstart=0,n.block_start=0,n.insert=0),u=new A.Buf8(n.w_size),A.arraySet(u,t,h-n.w_size,n.w_size,0),t=u,h=n.w_size),s=e.avail_in,c=e.next_in,l=e.input,e.avail_in=h,e.next_in=0,e.input=t,p(n);n.lookahead>=le;){r=n.strstart,i=n.lookahead-(le-1);do n.ins_h=(n.ins_h<=0;)e[t]=0}function i(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}function a(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function o(e){return e<256?ce[e]:ce[256+(e>>>7)]}function s(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function c(e,t,n){e.bi_valid>Z-n?(e.bi_buf|=t<>Z-e.bi_valid,e.bi_valid+=n-Z):(e.bi_buf|=t<>>=1,n<<=1;while(--t>0);return n>>>1}function h(e){16===e.bi_valid?(s(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}function p(e,t){var n,r,i,a,o,s,c=t.dyn_tree,l=t.max_code,u=t.stat_desc.static_tree,h=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,f=t.stat_desc.max_length,m=0;for(a=0;a<=X;a++)e.bl_count[a]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;nf&&(a=f,m++),c[2*r+1]=a,r>l||(e.bl_count[a]++,o=0,r>=d&&(o=p[r-d]),s=c[2*r],e.opt_len+=s*(a+o),h&&(e.static_len+=s*(u[2*r+1]+o)));if(0!==m){do{for(a=f-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[f]--,m-=2}while(m>0);for(a=f;0!==a;a--)for(r=e.bl_count[a];0!==r;)i=e.heap[--n],i>l||(c[2*i+1]!==a&&(e.opt_len+=(a-c[2*i+1])*c[2*i],c[2*i+1]=a),r--)}}function d(e,t,n){var r,i,a=new Array(X+1),o=0;for(r=1;r<=X;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=u(a[s]++,s))}}function f(){var e,t,n,r,a,o=new Array(X+1);for(n=0,r=0;r>=7;r8?s(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function g(e,t,n,r){v(e),r&&(s(e,n),s(e,~n)),O.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}function y(e,t,n,r){var i=2*t,a=2*n;return e[i]>1;n>=1;n--)b(e,a,n);i=c;do n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],b(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,b(e,a,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],p(e,t),d(a,l,e.bl_count)}function x(e,t,n){var r,i,a=-1,o=t[1],s=0,c=7,l=4;for(0===o&&(c=138,l=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=t[2*(r+1)+1],++s=3&&0===e.bl_tree[2*ie[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}function S(e,t,n,r){var i;for(c(e,t-257,5),c(e,n-1,5),c(e,r-4,4),i=0;i>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return R;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return I;for(t=32;t0?(e.strm.data_type===N&&(e.strm.data_type=T(e)),w(e,e.l_desc),w(e,e.d_desc),o=E(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=n+5,n+4<=i&&t!==-1?C(e,t,n,r):e.strategy===D||a===i?(c(e,(U<<1)+(r?1:0),3),_(e,oe,se)):(c(e,(F<<1)+(r?1:0),3),S(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),_(e,e.dyn_ltree,e.dyn_dtree)),m(e),r&&v(e)}function k(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(le[n]+H+1)]++,e.dyn_dtree[2*o(t)]++),e.last_lit===e.lit_bufsize-1}var O=n(212),D=4,R=0,I=1,N=2,B=0,U=1,F=2,j=3,z=258,V=29,H=256,G=H+1+V,W=30,q=19,Y=2*G+1,X=15,Z=16,J=7,K=256,$=16,Q=17,ee=18,te=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ne=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],re=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ie=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ae=512,oe=new Array(2*(G+2));r(oe);var se=new Array(2*W);r(se);var ce=new Array(ae);r(ce);var le=new Array(z-j+1);r(le);var ue=new Array(V);r(ue);var he=new Array(W);r(he);var pe,de,fe,me=!1;t._tr_init=P,t._tr_stored_block=C,t._tr_flush_block=A,t._tr_tally=k,t._tr_align=L},function(e,t){"use strict";function n(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;0!==n;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0}e.exports=n},function(e,t){"use strict";function n(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}function r(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t[s])];return e^-1}var i=n();e.exports=r},function(e,t){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(e,t,n){"use strict";function r(e,t){if(t<65537&&(e.subarray&&o||!e.subarray&&a))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var n="",r=0;r=252?6:c>=248?5:c>=240?4:c>=224?3:c>=192?2:1;s[254]=s[254]=1,t.string2buf=function(e){var t,n,r,a,o,s=e.length,c=0;for(a=0;a>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},t.buf2binstring=function(e){return r(e,e.length)},t.binstring2buf=function(e){for(var t=new i.Buf8(e.length),n=0,r=t.length;n4)l[i++]=65533,n+=o-1;else{for(a&=2===o?31:3===o?15:7;o>1&&n1?l[i++]=65533:a<65536?l[i++]=a:(a-=65536,l[i++]=55296|a>>10&1023,l[i++]=56320|1023&a)}return r(l,i)},t.utf8border=function(e,t){var n;for(t=t||e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&128===(192&e[n]);)n--;return n<0?t:0===n?t:n+s[e[n]]>t?n:t}},function(e,t){"use strict";function n(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}e.exports=n},function(e,t,n){"use strict";function r(e){if(!(this instanceof r))return new r(e);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0===(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var n=o.inflateInit2(this.strm,t.windowBits);if(n!==l.Z_OK)throw new Error(u[n]);this.header=new p,o.inflateGetHeader(this.strm,this.header)}function i(e,t){var n=new r(t);if(n.push(e,!0),n.err)throw n.msg||u[n.err];return n.result}function a(e,t){return t=t||{},t.raw=!0,i(e,t)}var o=n(222),s=n(212),c=n(219),l=n(225),u=n(218),h=n(220),p=n(226),d=Object.prototype.toString;r.prototype.push=function(e,t){var n,r,i,a,u,h,p=this.strm,f=this.options.chunkSize,m=this.options.dictionary,v=!1;if(this.ended)return!1;r=t===~~t?t:t===!0?l.Z_FINISH:l.Z_NO_FLUSH,"string"==typeof e?p.input=c.binstring2buf(e):"[object ArrayBuffer]"===d.call(e)?p.input=new Uint8Array(e):p.input=e,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new s.Buf8(f),p.next_out=0,p.avail_out=f),n=o.inflate(p,l.Z_NO_FLUSH),n===l.Z_NEED_DICT&&m&&(h="string"==typeof m?c.string2buf(m):"[object ArrayBuffer]"===d.call(m)?new Uint8Array(m):m,n=o.inflateSetDictionary(this.strm,h)),n===l.Z_BUF_ERROR&&v===!0&&(n=l.Z_OK, v=!1),n!==l.Z_STREAM_END&&n!==l.Z_OK)return this.onEnd(n),this.ended=!0,!1;p.next_out&&(0!==p.avail_out&&n!==l.Z_STREAM_END&&(0!==p.avail_in||r!==l.Z_FINISH&&r!==l.Z_SYNC_FLUSH)||("string"===this.options.to?(i=c.utf8border(p.output,p.next_out),a=p.next_out-i,u=c.buf2string(p.output,i),p.next_out=a,p.avail_out=f-a,a&&s.arraySet(p.output,p.output,i,a,0),this.onData(u)):this.onData(s.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(v=!0)}while((p.avail_in>0||0===p.avail_out)&&n!==l.Z_STREAM_END);return n===l.Z_STREAM_END&&(r=l.Z_FINISH),r===l.Z_FINISH?(n=o.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===l.Z_OK):r!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),p.avail_out=0,!0)},r.prototype.onData=function(e){this.chunks.push(e)},r.prototype.onEnd=function(e){e===l.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=r,t.inflate=i,t.inflateRaw=a,t.ungzip=i},function(e,t,n){"use strict";function r(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function i(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new y.Buf16(320),this.work=new y.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=B,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new y.Buf32(me),t.distcode=t.distdyn=new y.Buf32(ve),t.sane=1,t.back=-1,L):O}function o(e){var t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,a(e)):O}function s(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15)?O:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,o(e))):O}function c(e,t){var n,r;return e?(r=new i,e.state=r,r.window=null,n=s(e,t),n!==L&&(e.state=null),n):O}function l(e){return c(e,ye)}function u(e){if(be){var t;for(v=new y.Buf32(512),g=new y.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(x(E,e.lens,0,288,v,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;x(S,e.lens,0,32,g,0,e.work,{bits:5}),be=!1}e.lencode=v,e.lenbits=9,e.distcode=g,e.distbits=5}function h(e,t,n,r){var i,a=e.state;return null===a.window&&(a.wsize=1<=a.wsize?(y.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),y.arraySet(a.window,t,n-r,i,a.wnext),r-=i,r?(y.arraySet(a.window,t,n-r,r,0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,n.check=_(n.check,Pe,2,0),p=0,d=0,n.mode=U;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&p)<<8)+(p>>8))%31){e.msg="incorrect header check",n.mode=pe;break}if((15&p)!==N){e.msg="unknown compression method",n.mode=pe;break}if(p>>>=4,d-=4,xe=(15&p)+8,0===n.wbits)n.wbits=xe;else if(xe>n.wbits){e.msg="invalid window size",n.mode=pe;break}n.dmax=1<>8&1),512&n.flags&&(Pe[0]=255&p,Pe[1]=p>>>8&255,n.check=_(n.check,Pe,2,0)),p=0,d=0,n.mode=F;case F:for(;d<32;){if(0===c)break e;c--,p+=i[o++]<>>8&255,Pe[2]=p>>>16&255,Pe[3]=p>>>24&255,n.check=_(n.check,Pe,4,0)),p=0,d=0,n.mode=j;case j:for(;d<16;){if(0===c)break e;c--,p+=i[o++]<>8),512&n.flags&&(Pe[0]=255&p,Pe[1]=p>>>8&255,n.check=_(n.check,Pe,2,0)),p=0,d=0,n.mode=z;case z:if(1024&n.flags){for(;d<16;){if(0===c)break e;c--,p+=i[o++]<>>8&255,n.check=_(n.check,Pe,2,0)),p=0,d=0}else n.head&&(n.head.extra=null);n.mode=V;case V:if(1024&n.flags&&(v=n.length,v>c&&(v=c),v&&(n.head&&(xe=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),y.arraySet(n.head.extra,i,o,v,xe)),512&n.flags&&(n.check=_(n.check,i,v,o)),c-=v,o+=v,n.length-=v),n.length))break e;n.length=0,n.mode=H;case H:if(2048&n.flags){if(0===c)break e;v=0;do xe=i[o+v++],n.head&&xe&&n.length<65536&&(n.head.name+=String.fromCharCode(xe));while(xe&&v>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=X;break;case q:for(;d<32;){if(0===c)break e;c--,p+=i[o++]<>>=7&d,d-=7&d,n.mode=le;break}for(;d<3;){if(0===c)break e;c--,p+=i[o++]<>>=1,d-=1,3&p){case 0:n.mode=J;break;case 1:if(u(n),n.mode=ne,t===C){p>>>=2,d-=2;break e}break;case 2:n.mode=Q;break;case 3:e.msg="invalid block type",n.mode=pe}p>>>=2,d-=2;break;case J:for(p>>>=7&d,d-=7&d;d<32;){if(0===c)break e;c--,p+=i[o++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=pe;break}if(n.length=65535&p,p=0,d=0,n.mode=K,t===C)break e;case K:n.mode=$;case $:if(v=n.length){if(v>c&&(v=c),v>l&&(v=l),0===v)break e;y.arraySet(a,i,o,v,s),c-=v,o+=v,l-=v,s+=v,n.length-=v;break}n.mode=X;break;case Q:for(;d<14;){if(0===c)break e;c--,p+=i[o++]<>>=5,d-=5,n.ndist=(31&p)+1,p>>>=5,d-=5,n.ncode=(15&p)+4,p>>>=4,d-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=pe;break}n.have=0,n.mode=ee;case ee:for(;n.have>>=3,d-=3}for(;n.have<19;)n.lens[Ce[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Ee={bits:n.lenbits},Me=x(M,n.lens,0,19,n.lencode,0,n.work,Ee),n.lenbits=Ee.bits,Me){e.msg="invalid code lengths set",n.mode=pe;break}n.have=0,n.mode=te;case te:for(;n.have>>24,ge=Te>>>16&255,ye=65535&Te,!(ve<=d);){if(0===c)break e;c--,p+=i[o++]<>>=ve,d-=ve,n.lens[n.have++]=ye;else{if(16===ye){for(Se=ve+2;d>>=ve,d-=ve,0===n.have){e.msg="invalid bit length repeat",n.mode=pe;break}xe=n.lens[n.have-1],v=3+(3&p),p>>>=2,d-=2}else if(17===ye){for(Se=ve+3;d>>=ve,d-=ve,xe=0,v=3+(7&p),p>>>=3,d-=3}else{for(Se=ve+7;d>>=ve,d-=ve,xe=0,v=11+(127&p),p>>>=7,d-=7}if(n.have+v>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=pe;break}for(;v--;)n.lens[n.have++]=xe}}if(n.mode===pe)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=pe;break}if(n.lenbits=9,Ee={bits:n.lenbits},Me=x(E,n.lens,0,n.nlen,n.lencode,0,n.work,Ee),n.lenbits=Ee.bits,Me){e.msg="invalid literal/lengths set",n.mode=pe;break}if(n.distbits=6,n.distcode=n.distdyn,Ee={bits:n.distbits},Me=x(S,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Ee),n.distbits=Ee.bits,Me){e.msg="invalid distances set",n.mode=pe;break}if(n.mode=ne,t===C)break e;case ne:n.mode=re;case re:if(c>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=c,n.hold=p,n.bits=d,w(e,m),s=e.next_out,a=e.output,l=e.avail_out,o=e.next_in,i=e.input,c=e.avail_in,p=n.hold,d=n.bits,n.mode===X&&(n.back=-1);break}for(n.back=0;Te=n.lencode[p&(1<>>24,ge=Te>>>16&255,ye=65535&Te,!(ve<=d);){if(0===c)break e;c--,p+=i[o++]<>be)],ve=Te>>>24,ge=Te>>>16&255,ye=65535&Te,!(be+ve<=d);){if(0===c)break e;c--,p+=i[o++]<>>=be,d-=be,n.back+=be}if(p>>>=ve,d-=ve,n.back+=ve,n.length=ye,0===ge){n.mode=ce;break}if(32&ge){n.back=-1,n.mode=X;break}if(64&ge){e.msg="invalid literal/length code",n.mode=pe;break}n.extra=15&ge,n.mode=ie;case ie:if(n.extra){for(Se=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ae;case ae:for(;Te=n.distcode[p&(1<>>24,ge=Te>>>16&255,ye=65535&Te,!(ve<=d);){if(0===c)break e;c--,p+=i[o++]<>be)],ve=Te>>>24,ge=Te>>>16&255,ye=65535&Te,!(be+ve<=d);){if(0===c)break e;c--,p+=i[o++]<>>=be,d-=be,n.back+=be}if(p>>>=ve,d-=ve,n.back+=ve,64&ge){e.msg="invalid distance code",n.mode=pe;break}n.offset=ye,n.extra=15&ge,n.mode=oe;case oe:if(n.extra){for(Se=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=pe;break}n.mode=se;case se:if(0===l)break e;if(v=m-l,n.offset>v){if(v=n.offset-v,v>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=pe;break}v>n.wnext?(v-=n.wnext,g=n.wsize-v):g=n.wnext-v,v>n.length&&(v=n.length),me=n.window}else me=a,g=s-n.offset,v=n.length;v>l&&(v=l),l-=v,n.length-=v;do a[s++]=me[g++];while(--v);0===n.length&&(n.mode=re);break;case ce:if(0===l)break e;a[s++]=n.length,l--,n.mode=re;break;case le:if(n.wrap){for(;d<32;){if(0===c)break e;c--,p|=i[o++]<>>24,m>>>=x,v-=x,x=w>>>16&255,0===x)C[s++]=65535&w;else{if(!(16&x)){if(0===(64&x)){w=g[(65535&w)+(m&(1<>>=x,v-=x),v<15&&(m+=P[a++]<>>24,m>>>=x,v-=x,x=w>>>16&255,!(16&x)){if(0===(64&x)){w=y[(65535&w)+(m&(1<u){e.msg="invalid distance too far back",i.mode=n;break e}if(m>>>=x,v-=x,x=s-c,E>x){if(x=E-x,x>p&&i.sane){e.msg="invalid distance too far back",i.mode=n;break e}if(S=0,T=f,0===d){if(S+=h-x,x2;)C[s++]=T[S++],C[s++]=T[S++],C[s++]=T[S++],M-=3;M&&(C[s++]=T[S++],M>1&&(C[s++]=T[S++]))}else{S=s-E;do C[s++]=C[S++],C[s++]=C[S++],C[s++]=C[S++],M-=3;while(M>2);M&&(C[s++]=C[S++],M>1&&(C[s++]=C[S++]))}break}}break}}while(a>3,a-=M,v-=M<<3,m&=(1<=1&&0===z[O];O--);if(D>O&&(D=O),0===O)return m[v++]=20971520,m[v++]=20971520,y.bits=1,0;for(k=1;k0&&(e===s||1!==O))return-1;for(V[1]=0,L=1;La||e===l&&B>o)return 1;for(;;){S=L-I,g[A]E?(T=H[G+g[A]],P=F[j+g[A]]):(T=96,P=0),b=1<>I)+_]=S<<24|T<<16|P|0;while(0!==_);for(b=1<>=1;if(0!==b?(U&=b-1,U+=b):U=0,A++,0===--z[L]){if(L===O)break;L=t[n+g[A]]}if(L>D&&(U&x)!==w){for(0===I&&(I=D),M+=k,R=L-I,N=1<a||e===l&&B>o)return 1;w=U&x,m[w]=D<<24|R<<16|M-v|0}}return 0!==U&&(m[M+U]=L-I<<24|64<<16|0),y.bits=D,0}},function(e,t){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(e,t){"use strict";function n(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}e.exports=n},function(e,t,n){(function(t){"use strict";var n=function(){this._tweens={},this._tweensAddedDuringUpdate={}};n.prototype={getAll:function(){return Object.keys(this._tweens).map(function(e){return this._tweens[e]}.bind(this))},removeAll:function(){this._tweens={}},add:function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},remove:function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},update:function(e,t){var n=Object.keys(this._tweens);if(0===n.length)return!1;for(e=void 0!==e?e:r.now();n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i1?1:n,r=this._easingFunction(n);for(t in this._valuesEnd)if(void 0!==this._valuesStart[t]){var i=this._valuesStart[t]||0,a=this._valuesEnd[t];a instanceof Array?this._object[t]=this._interpolationFunction(a,r):("string"==typeof a&&(a="+"===a.charAt(0)||"-"===a.charAt(0)?i+parseFloat(a):parseFloat(a)),"number"==typeof a&&(this._object[t]=i+(a-i)*r))}if(null!==this._onUpdateCallback&&this._onUpdateCallback(this._object,n),1===n){if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(t in this._valuesStartRepeat){if("string"==typeof this._valuesEnd[t]&&(this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(this._valuesEnd[t])),this._yoyo){var o=this._valuesStartRepeat[t];this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=o}this._valuesStart[t]=this._valuesStartRepeat[t]}return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,null!==this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}null!==this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var s=0,c=this._chainedTweens.length;s1?o(e[n],e[n-1],n-i):o(e[a],e[a+1>n?n:a+1],i-a)},Bezier:function(e,t){for(var n=0,i=e.length-1,a=Math.pow,o=r.Interpolation.Utils.Bernstein,s=0;s<=i;s++)n+=a(1-t,i-s)*a(t,s)*e[s]*o(i,s);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,a=Math.floor(i),o=r.Interpolation.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(a=Math.floor(i=n*(1+t))),o(e[(a-1+n)%n],e[a],e[(a+1)%n],e[(a+2)%n],i-a)):t<0?e[0]-(o(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(o(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):o(e[a?a-1:0],e[a],e[n1;r--)n*=r;return e[t]=n,n}}(),CatmullRom:function(e,t,n,r,i){var a=.5*(n-e),o=.5*(r-t),s=i*i,c=i*s;return(2*t-2*n+a+o)*c+(-3*t+3*n-2*a-o)*s+a*i+t}}},e.exports=r}).call(t,n(114))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s,c=function(){function e(e,t){for(var n=0;nr.clientHeight)&&r.scrollTo(0,r.scrollTop+h)}}),t.signals.setCompVisiable.add(function(e,t){var r=e.join(","),i=n.querySelector('li[data-path="'+r+'"]'),a=i.getElementsByTagName("input")[0];a.checked=t;var o=new Event("click",{bubbles:!0});a.dispatchEvent(o)}),t.signals.setAllCompsVisiable.add(function(e){var t=n.querySelector("li"),r=t.getElementsByTagName("input")[0];if(r){r.checked=!!e;var i=new Event("click",{bubbles:!0});r.dispatchEvent(i)}})}},{key:"closeTree",value:function(e){for(var t=document.getElementById("compTree"),n=t.children,r=0;r0&&r.render()}},{key:"clearHiObj",value:function(){for(var e=document.getElementById("compTree"),t=e.getElementsByTagName("li"),n=0;n';for(var i=0;i"+e[i].label+"",r+=this.loadCompsData(e[i].children,t+1)):r+=0!=t?"
  • '+e[i].label+"
  • ":"
  • '+e[i].label+"
  • ";r+=""}return r}},{key:"loadDimsData",value:function(e,t,n){if(!e.length)return"";if(!e[0].children||0==e[0].children.length)return"";var r=20*n,i=this.mdlStore.isUpdTree?"active":"",a='
      ';a+='
    • \n \n "+t+" Dimensions\n
    • ";var o=e[0].children,s=o.length;r=20*(n+1),a+='
        ';for(var c=0;c\n \n "+d.default[c]+"\n "),a+='
          ';for(var u=0;u'+("\n \n ")+d.default[c]+"#"+o[c][u].label+"";a+="
        "}return a+="
      ",a+="
    "}},{key:"componentDidUpdate",value:function(){for(var e in this.hideList)if(0==this.hideList[e]){var t=document.querySelector("li[data-path='"+e+"']");t.children[0].checked=!1}}},{key:"loadAniData",value:function(e,t,n){if(!e.length)return"";var r=20*n,i='
      ',a="Explode"==t?"exptree-icon":"anitree-icon";i+='
    • \n \n \n "+t+" Animation\n
    • ",r=20*(n+1),i+='
        ';var o=!0,s=!1,c=void 0;try{for(var l,u=e[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){var h=l.value;i+='
      • \n \n \n "+h.label+"\n \n \n
      • "}}catch(e){s=!0,c=e}finally{try{!o&&u.return&&u.return()}finally{if(s)throw c}}return i+="
      ",i+="
    "}},{key:"render",value:function(){var e=this.loadCompsData(this.mdlStore.compsData,0),t=this.loadDimsData(this.mdlStore.dimsData,"",0),n=this.loadDimsData(this.mdlStore.toolsDimsData,"Tools",0),r=this.loadAniData(this.mdlStore.animsData,"",0),i=this.loadAniData(this.mdlStore.expviewsData,"Explode",0);return u.default.createElement("div",{className:"comptree"},u.default.createElement("div",{id:"compTree",className:"comps"},u.default.createElement("div",{dangerouslySetInnerHTML:{__html:e}}),u.default.createElement("div",{dangerouslySetInnerHTML:{__html:t}}),u.default.createElement("div",{dangerouslySetInnerHTML:{__html:n}}),u.default.createElement("div",{dangerouslySetInnerHTML:{__html:r}}),u.default.createElement("div",{dangerouslySetInnerHTML:{__html:i}})))}}]),t}(l.Component))||s;t.default=m},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=["Linear","Angular","Diameter","Radius","Coordinate label","Leader label","Dimension"];t.default=n},function(e,t){"use strict";function n(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;rn?n-r.offsetWidth:t.clientX;r.style.left=o+"px",r.style.top=t.clientY+"px",setTimeout(function(){r.classList.add("opacity")},1),i.setState({show:e})};if(e)a(!0);else if(t){if(this.lock)return void setTimeout(function(){n.lock=!1});a(!1)}else r.classList.remove("show"),r.classList.remove("opacity")}},{key:"lockCxt",value:function(){this.lock=!0}},{key:"render",value:function(){return l.default.createElement("div",{id:"jqContextMenu",ref:"ctx"},l.default.createElement("ul",null,h.opt.tree?l.default.createElement("li",{id:"c1",style:{display:this.state.show?"block":"none"}},l.default.createElement("a",{className:"mdl-handler"}," ",this.name.Is," "),l.default.createElement("a",{className:"icon-container"}," ",l.default.createElement("span",{className:"sel-icon mini-icon"})," ")):null,h.opt.tree?l.default.createElement("li",{id:"c2",style:{display:this.state.show?"block":"none"}},l.default.createElement("a",{className:"mdl-handler"}," ",this.name.Hi," "),l.default.createElement("a",{className:"icon-container"}," ",l.default.createElement("span",{className:"sel-icon mini-icon"})," ")):null,l.default.createElement("li",{id:"c3"},l.default.createElement("a",{className:"mdl-handler"}," ",this.name.ShA," "),l.default.createElement("a",{className:"icon-container"}," ",l.default.createElement("span",{className:"sel-icon mini-icon"})," ")),l.default.createElement("li",{id:"c4",style:{display:this.state.show?"block":"none"}},l.default.createElement("a",{className:"mdl-handler"}," ",this.name.FO," "),l.default.createElement("a",{className:"icon-container"}," ",l.default.createElement("span",{className:"sel-icon mini-icon"})," ")),l.default.createElement("li",{id:"c5"},l.default.createElement("a",{className:"mdl-handler"}," ",this.name.RA," "),l.default.createElement("a",{className:"icon-container"}," ",l.default.createElement("span",{className:"sel-icon mini-icon"})," "))))}}]),t}(c.Component);t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.opt=void 0;var r=n(230),i=(0,r.getCookie)("opts")||Math.pow(2,14)-1,a={};a.view=1&i,a.disp=i>>1&1,a.tree=i>>2&1,a.exp=i>>3&1,a.sect=i>>4&1,a.pmi=!1,a.meas=i>>6&1,a.drag=i>>7&1,a.ani=i>>8&1,a.post=!1,t.opt=a},function(e,t,n){function r(e){return n(i(e))}function i(e){return a[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var a={"./en-us":236,"./en-us.js":236,"./ko-kr":237,"./ko-kr.js":237,"./zh-cn":238,"./zh-cn.js":238};r.keys=function(){return Object.keys(a)},r.resolve=i,e.exports=r,r.id=235},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={AddDim:"Add dimension ON",Ang:"Angle",Ar:"Arrow",Bkv:"Back View",Btv:"Bottom View",ChPnt:"Characteristic Points",Ci:"Circle",Cl:"Cloud",Cnt:"Center",CrIfo:"Check Curve Information",Cv:"Section Curve ON",Del:"Delete",Dis:"Distance",Dm:"Display modes",DMd:"Dim modes",DMod:"Diameter mode",Ed:"End",Et1:"1st entity",Et2:"2nd entity",Exp:"Explode",FO:"Focus on",Fv:"Front View",Gi:"Get info",Hi:"Hide",Is:"Isolate",Iv:"Iso View",L1s:"1st line start",L1e:"1st line end",L2s:"1st line start",L2e:"1st line end",Len:"Length",Li:"Line",Lv:"Left View",Md:"Measure Distances",Me:"Measure",Mp:"Move",OC:"Orthographic projection",PC:"Perspective projection",PSE:"Please select an element",RA:"Reset All",Re:"Rectangle",Rad:"Radius",RMod:"Radius mode",Rp:"Repick",Rt:"Restore",Rv:"Right View",Sd:"Auto Save Dim ON",Sdl:"Shaded with line",SEr:"Object selection error",ShA:"Show All",Shd:"Shaded without line",So:"SSAO ON",Sct:"Section",St:"Start",SU:"Set unit",Sw:"Shadow on",Tp:"Type",Tv:"Top View",Vi:"View",Wf:"Wireframe",Pt:"Comment"};t.default=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={AddDim:"치수 추가 켜기",Ang:"각도",Bkv:"뒤쪽 뷰",Btv:"아래쪽 뷰",ChPnt:"특성점",Cnt:"가운데",CrIfo:"곡선 정보 확인",Cv:"단면 곡선 켜기",Del:"삭제",Dis:"거리",Dm:"표시 모드",DMd:"치수 모드",DMod:"직경 모드",Ed:"끝",Et1:"1st 개체",Et2:"2nd 개체",Exp:"분해",FO:"포커스",Fv:"앞쪽 뷰",Gi:"정보 가져오기",Hi:"숨기기",Is:"분리",Iv:"등각 뷰",L1s:"1st 선 시작",L1e:"1st 선 끝",L2s:"1st 선 시작",L2e:"1st 선 끝",Len:"길이",Lv:"왼쪽 뷰",Md:"거리 측정",Me:"측정",Mp:"이동",OC:"직교 투영",PC:"원근 투영",PSE:"요소를 선택하세요",RA:"모두 초기화",Rad:"반경",RMod:"반경 모드",Rp:"다시 선택",Rt:"복원",Rv:"오른쪽 뷰",Sd:"치수 자동 저장 켜기",Sdl:"선 있는 음영",SEr:"객체 선택 오류",ShA:"모두 표시",Shd:"선 없는 음영",So:"SSAO 켜기",Sct:"단면",St:"시작",SU:"단위 설정",Sw:"그림자 켜기",Tp:"유형",Tv:"위쪽 뷰",Vi:"보기",Wf:"와이어프레임",Pt:"우편"};t.default=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={AddDim:"开启添加标注",Ang:"角度",Ar:"箭头",Bkv:"后视图",Btv:"底视图",ChPnt:"特征点",Ci:"圆形",Cl:"云线",Cnt:"中心",CrIfo:"查看曲线信息",Cv:"显示剖切轮廓线",Del:"删除",Dis:"距离",Dm:"显示模式",DMd:"标注模式",DMod:"直径模式",Ed:"终点",Et1:"实体1",Et2:"实体2",Exp:"爆炸",FO:"聚焦",Fv:"前视图",Gi:"查看信息",Hi:"隐藏",Is:"独立",Iv:"Iso视图",L1s:"直线1起点",L1e:"直线1终点",L2s:"直线2起点",L2e:"直线2终点",Len:"长度",Li:"直线",Lv:"左视图",Md:"测量距离",Me:"测量",Mp:"拖动",OC:"正交",PC:"透视",PSE:"请选择实体",Rad:"半径",RMod:"半径模式",RA:"重置模型",Re:"方形",Rp:"重选",Rt:"复位",Rv:"右视图",Sd:"自动保存标注",Sdl:"着色模式显示边",SEr:"对象选择错误",ShA:"显示全部",Shd:"着色模式隐藏边",So:"开启SSAO渲染",Sct:"剖切",St:"起点",SU:"单位设置",Sw:"开启阴影",Tp:"类型",Tv:"顶视图",Vi:"视图",Wf:"线框模式",Pt:"批注"};t.default=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(this.resetOp(t),t==-1)return void this.stopCrtOpr();this.state.post&&this.setState({post:!1}),2==e?0==this.flags[2]?(this.props.closeSwitch(!0),this.viewer.createClipBox(!0),this.tglMovePart(!0)):1==this.flags[2]&&(this.props.closeSwitch(!1),this.viewer.createClipBox(!1)):1==e?(this.closeClipState(),this.props.clearHiObj()):5==e&&(this.closeClipState(),this.resetExplode());var n=e+1,r=document.getElementsByClassName("m"+n);if(this.flags[e]&&1!=t){if(5==e&&this.beginInfo(!0),4==e&&this.calDistBetLines(!0),2!=e)for(var i=0;i