@realsee/five 6.7.1 → 6.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/gltf-loader.DDSLoader.html +1 -1
- package/docs/classes/gltf-loader.DRACOLoader.html +1 -1
- package/docs/classes/gltf-loader.GLTFObject.html +1 -1
- package/docs/classes/gltf-loader.THREEGLTFLoader.html +1 -1
- package/docs/classes/line.LineGeometry.html +1 -1
- package/docs/classes/line.LineMaterial.html +1 -1
- package/docs/classes/line.LineSegmentsGeometry.html +1 -1
- package/docs/classes/line.THREE_Line2.html +1 -1
- package/docs/classes/line.THREE_LineSegments2.html +1 -1
- package/docs/classes/vfx.Airflow.html +1 -1
- package/docs/classes/vfx.Flame.html +1 -1
- package/docs/classes/vfx.Particle.html +1 -1
- package/docs/classes/vfx.ParticleGPU.html +1 -1
- package/docs/classes/vfx.SpotLight.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginController.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginType.State.html +1 -1
- package/docs/interfaces/plugins.PanoAnimeController.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.State.html +1 -1
- package/docs/interfaces/plugins.TrajectoryController.html +25 -8
- package/docs/interfaces/react.FiveInjectionTypes.html +1 -1
- package/five/index.js +3 -3
- package/five/index.mjs +4 -4
- package/gltf-loader/index.js +3 -3
- package/gltf-loader/index.mjs +3 -3
- package/line/index.js +3 -3
- package/line/index.mjs +3 -3
- package/package.json +1 -1
- package/plugins/index.d.ts +26 -0
- package/plugins/index.js +17 -17
- package/plugins/index.mjs +1518 -1370
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/shader-lib/index.js +2 -2
- package/shader-lib/index.mjs +2 -2
- package/sticker/index.js +3 -3
- package/sticker/index.mjs +3 -3
- package/umd/five-gltf-loader.js +3 -3
- package/umd/five-line.js +3 -3
- package/umd/five-plugins.js +16 -16
- package/umd/five-react.js +2 -2
- package/umd/five-shader-lib.js +2 -2
- package/umd/five-sticker.js +3 -3
- package/umd/five-vfx.js +2 -2
- package/umd/five-vue.js +2 -2
- package/umd/five.js +3 -3
- package/vfx/index.js +2 -2
- package/vfx/index.mjs +2 -2
- package/vue/index.js +2 -2
- package/vue/index.mjs +2 -2
- package/work-downloader/index.js +2 -2
- package/work-downloader/index.mjs +2 -2
package/umd/five-plugins.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated: 2026/1/
|
|
5
|
-
* Version: 6.7.
|
|
4
|
+
* Generated: 2026/1/12
|
|
5
|
+
* Version: 6.7.2
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
253
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
254
|
* Agreement and all related documents shall be drafted in English.
|
|
255
|
-
*/(function(
|
|
255
|
+
*/(function(re,fe){typeof exports=="object"&&typeof module!="undefined"?fe(exports,require("@realsee/five"),require("three"),require("@realsee/five/plugins")):typeof define=="function"&&define.amd?define(["exports","@realsee/five","three","@realsee/five/plugins"],fe):(re=typeof globalThis!="undefined"?globalThis:re||self,fe(re.FiveSDK_Plugins={},re.FiveSDK,re.THREE,re.FiveSDK_Plugins))})(this,(function(re,fe,D,lt){"use strict";function Jt(v){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(v){for(const e in v)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(v,e);Object.defineProperty(s,e,n.get?n:{enumerable:!0,get:()=>v[e]})}}return s.default=v,Object.freeze(s)}const p=Jt(D);function $t(v){return/^https?:\/\/|^\/\//.test(v)||/^data:/.test(v)}function en(v,s){return $t(s)?s:"".concat(v).concat(s)}re.BasePlugin=void 0,(function(v){var s=(function(){function e(n,t){this.hooks=new fe.Subscribe,this.staticPrefix="//vr-image-4.realsee-cdn.cn",this.five=n,t!=null&&t.staticPrefix&&(this.staticPrefix=t.staticPrefix)}return e.prototype.getCurrentState=function(){return this.state},e.prototype.absoluteUrl=function(n){return en(this.staticPrefix,n)},e})();v.Controller=s})(re.BasePlugin||(re.BasePlugin={}));var ut=function(v,s){return ut=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])},ut(v,s)};function de(v,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");ut(v,s);function e(){this.constructor=v}v.prototype=s===null?Object.create(s):(e.prototype=s.prototype,new e)}var N=function(){return N=Object.assign||function(s){for(var e,n=1,t=arguments.length;n<t;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(s[r]=e[r])}return s},N.apply(this,arguments)};function Ce(v,s,e,n){function t(r){return r instanceof e?r:new e(function(l){l(r)})}return new(e||(e=Promise))(function(r,l){function i(d){try{c(n.next(d))}catch(y){l(y)}}function h(d){try{c(n.throw(d))}catch(y){l(y)}}function c(d){d.done?r(d.value):t(d.value).then(i,h)}c((n=n.apply(v,s||[])).next())})}function Oe(v,s){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,t,r,l=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return l.next=i(0),l.throw=i(1),l.return=i(2),typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function i(c){return function(d){return h([c,d])}}function h(c){if(n)throw new TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(e=0)),e;)try{if(n=1,t&&(r=c[0]&2?t.return:c[0]?t.throw||((r=t.return)&&r.call(t),0):t.next)&&!(r=r.call(t,c[1])).done)return r;switch(t=0,r&&(c=[c[0]&2,r.value]),c[0]){case 0:case 1:r=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,t=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(r=e.trys,!(r=r.length>0&&r[r.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!r||c[1]>r[0]&&c[1]<r[3])){e.label=c[1];break}if(c[0]===6&&e.label<r[1]){e.label=r[1],r=c;break}if(r&&e.label<r[2]){e.label=r[2],e.ops.push(c);break}r[2]&&e.ops.pop(),e.trys.pop();continue}c=s.call(v,e)}catch(d){c=[6,d],t=0}finally{n=r=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Ot(v,s,e){if(e||arguments.length===2)for(var n=0,t=s.length,r;n<t;n++)(r||!(n in s))&&(r||(r=Array.prototype.slice.call(s,0,n)),r[n]=s[n]);return v.concat(r||Array.prototype.slice.call(s))}typeof SuppressedError=="function"&&SuppressedError;function tn(v){return new Promise(function(s,e){var n=new Image;n.onload=function(){n.onload=n.onerror=function(){},s(n)},n.onerror=function(t){n.onload=n.onerror=function(){},e(t)},n.crossOrigin="",n.src=v})}var nn=typeof performance!="undefined"&&typeof performance.timing!="undefined"?performance.timing.navigationStart:Date.now(),ct=typeof performance!="undefined"?(function(){return nn+performance.now()}):(function(){return Date.now()});function Xe(v,s,e){return v+(s-v)*e}function rn(v,s,e,n){var t=(s*e+2*v)/Math.pow(e,3),r=-(2*s*e+3*v)/Math.pow(e,2),l=s,i=v;return t*Math.pow(n,3)+r*Math.pow(n,2)+l*n+i}function an(v,s,e,n){var t=(s*e+2*v)/Math.pow(e,3),r=-(2*s*e+3*v)/Math.pow(e,2),l=s;return 3*t*Math.pow(n,2)+2*r*n+l}function on(v,s,e,n){var t=n[1]-n[0];return v=He(v,n),s=He(s,n),s-v>t/2?Xe(v+t,s,e):v-s>t/2?Xe(v-t,s,e):Xe(v,s,e)}function He(v,s){var e=s[1]-s[0];return v<s[0]?He(v+e,s):v>=s[1]?He(v-e,s):v}function sn(v,s,e,n){return n?on(v,s,e,n):Xe(v,s,e)}var _t=(function(){function v(s){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=ct(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(var e in s){var n=s[e];typeof n=="number"?(this.value[e]=n,this.config[e]={circle:!1}):(this.value[e]=n.value,this.config[e]={circle:n.circle})}this.keyframes=[{progress:0,value:N({},this.value)},{progress:1,value:N({},this.value)}]}return v.prototype.getProgress=function(s){var e=s-this.startTime;return e<0?0:e>=this.duration?1:1-rn(1,this.startVelocity,this.duration,e)},v.prototype.getValue=function(s){for(var e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>s){var n=this.keyframes[e-1],t=this.keyframes[e],r={};for(var l in this.config){var i=(s-n.progress)/(t.progress-n.progress);r[l]=sn(n.value[l],t.value[l],i,this.config[l].circle)}return r}return N({},this.keyframes[this.keyframes.length-1].value)},v.prototype.getProgressVelocity=function(s){var e=s-this.startTime;return e>=this.duration?0:an(1,this.startVelocity,this.duration,e)},v.prototype.update=function(s){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(s))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},v.prototype.getKeyFrameSegment=function(s){for(var e=this.getProgress(s),n=1;n<this.keyframes.length;n++)if(this.keyframes[n].progress>e)return[this.keyframes[n-1],this.keyframes[n]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},v.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},v.prototype.set=function(s,e,n,t){var r;n===void 0&&(n=0),isNaN(e)&&(e=0),isNaN(n)&&(n=0),t=t!=null?t:ct();var l=this.getProgress(t),i=this.getValue(l),h={};for(var c in this.config)h[c]=(r=s[c])!==null&&r!==void 0?r:i[c];var d=[{progress:0,value:i},{progress:1,value:h}];return this.setKeyframes(d,e,n,t)},v.prototype.setKeyframes=function(s,e,n,t){var r=this;if(n===void 0&&(n=0),s.length<2)throw new Error("keyframes invalid.");return isNaN(e)&&(e=0),isNaN(n)&&(n=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise(function(l,i){t=t!=null?t:ct(),r.progress=0,r.ended=!1,r.startTime=t,r.startVelocity=n,r.keyframes=s,r.duration=e,e===0?(r.progress=1,r.value=N({},s[s.length-1].value)):r.value=N({},s[0].value),r.callbacks=[l,i]})},v.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},v})(),ln=[{progress:0,value:{scale:0,opacity:0,shadow:2}},{progress:.2,value:{scale:.5,opacity:1,shadow:1}},{progress:.8,value:{scale:2,opacity:0,shadow:.5}},{progress:1,value:{scale:2,opacity:0,shadow:.5}}],un=[{progress:0,value:{scale:0,opacity:0,shadow:2}},{progress:.2,value:{scale:.4,opacity:1,shadow:2}},{progress:.8,value:{scale:1.6,opacity:.4,shadow:.5}},{progress:1,value:{scale:2,opacity:0,shadow:.5}}],cn=`
|
|
256
256
|
varying vec2 vUv;
|
|
257
257
|
void main() {
|
|
258
258
|
vUv = uv;
|
|
@@ -304,7 +304,7 @@ void main() {
|
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
`,hn=(function(
|
|
307
|
+
`,hn=(function(v){de(s,v);function s(e,n){var t=v.call(this,e)||this;t.canvas=document.createElement("canvas"),t.group=new p.Group,t.wrapper=document.createElement("div"),t.style=document.createElement("style"),t.itemMaskMesh=(function(){var i=new p.Mesh(new p.SphereBufferGeometry(1,60,40),new p.ShaderMaterial({vertexShader:cn,fragmentShader:fn,uniforms:{map:{value:new p.Texture},color:{value:new p.Vector4}},depthWrite:!1,depthTest:!1,transparent:!0}));return i.renderOrder=-3,i.geometry.rotateY(-Math.PI/2),i.geometry.scale(-1,1,1),i})(),t.onFivePanoArrived=function(i){t.state.mode==="mask"&&t.loadPanoMask(i)},t.onFiveWantsMoveToPano=function(i){t.state.mode==="box"&&t.select()},t.loadPanoMask=function(i){return Ce(t,void 0,void 0,function(){var h,c,d,y,S,w,M,E,O,A;return Oe(this,function(b){switch(b.label){case 0:return h=this,c=h.five,d=h.canvas,y=h.itemMaskMesh,S=h.data,w=d.getContext("2d"),M=c.observers[i],E=(A=S==null?void 0:S.object_mask_list.find(function(T){return T.derived_id===String(M.derivedId)}))===null||A===void 0?void 0:A.object_mask_url,E?[4,tn(E)]:[2];case 1:return O=b.sent(),d.width=O.width,d.height=O.height,w==null||w.drawImage(O,0,0,O.width,O.height),y.material.uniforms.map.value.image=O,y.material.uniforms.map.value.minFilter=p.LinearFilter,y.material.uniforms.map.value.needsUpdate=!0,y.position.copy(M.position),y.quaternion.copy(M.quaternion),c.scene.add(y),c.needsRender=!0,[2]}})})},t.onFiveMouseMove=function(i){var h;if(t.state.mode==="mask"&&t.five.state.mode==="Panorama"){var c=t,d=c.five,y=c.itemMaskMesh,S=d.observers[d.state.panoIndex],w=(h=i.pointers[0])===null||h===void 0?void 0:h.raycaster;if(w){var M=w.intersectObjects(t.group.children.filter(function(E){return E.userData.visible_viewpoint.includes(String(S.derivedId))}),!0)[0];M?y.material.uniforms.color.value=M.object.userData.color:y.material.uniforms.color.value=new p.Vector4(0,0,0,1)}}},t.onFiveTapGesture=function(i){var h=t.five,c=h.observers[h.state.panoIndex];if(i){var d=i.intersectObjects(t.group.children.filter(function(w){return w.userData.visible_viewpoint.includes(String(c.derivedId))}),!0)[0];if(d){t.select(d.object.name),t.stopAnimation&&t.stopAnimation(),t.tapPosition=d.point,t.changeTapScreenPosition();var y=new _t({opacity:0,scale:0,shadow:2}),S=new _t({opacity:0,scale:0,shadow:2});return y.setKeyframes(ln,1e3),S.setKeyframes(un,1e3),t.stopAnimation=fe.AnimationFrameLoop.shared.add(function(w,M){var E,O=y.update(w),A=S.update(w);t.wrapper.firstChild.style.opacity="".concat(y.value.opacity),t.wrapper.firstChild.style.transform="scale(".concat(y.value.scale,")"),t.wrapper.firstChild.style.boxShadow="0 0 0 ".concat(y.value.shadow,"px #fff"),t.wrapper.lastChild.style.opacity="".concat(S.value.opacity),t.wrapper.lastChild.style.transform="scale(".concat(S.value.scale,")"),t.wrapper.lastChild.style.boxShadow="0 0 0 ".concat(S.value.shadow,"px #fff"),O&&A&&((E=t.stopAnimation)===null||E===void 0||E.call(t),t.stopAnimation=void 0,h.getElement().parentElement.removeChild(t.wrapper))},!1,0,10),h.getElement().parentElement.appendChild(t.wrapper),!1}}},t.changeTapScreenPosition=function(){if(t.tapPosition){var i=t.tapPosition.clone().project(t.five.camera),h=(i.x+1)/2,c=-(i.y-1)/2;t.wrapper.style.opacity=i.z>0&&i.z<1?"1":"0",t.wrapper.style.transform="translate(".concat(h*100,"%, ").concat(c*100,"%)")}},t.onFiveCameraUpdate=function(i){t.changeTapScreenPosition()},t.dispose=function(){t.disable()},t.five=e;var r={enabled:!0,visible:!0,mode:"box",selectedId:null,selectAll:!1};t.state=Object.assign(r,n==null?void 0:n.initialState);var l=N({},n==null?void 0:n.config);return t._config=l,t.group.rotateX(Math.PI),t.wrapper.className="ItemMaskPlugin",t.wrapper.innerHTML='<span class="ItemMaskPluginCircle"></span><span class="ItemMaskPluginCircle"></span>',t.style.innerHTML=`
|
|
308
308
|
.ItemMaskPlugin {
|
|
309
309
|
position: absolute;
|
|
310
310
|
top: 0;
|
|
@@ -322,7 +322,7 @@ void main() {
|
|
|
322
322
|
border-radius: 50%;
|
|
323
323
|
box-shadow: 0px 0px 0px 2px #fff;
|
|
324
324
|
}
|
|
325
|
-
`,t.state.enabled&&t._enable({userAction:!1}),t}return Object.defineProperty(
|
|
325
|
+
`,t.state.enabled&&t._enable({userAction:!1}),t}return Object.defineProperty(s.prototype,"config",{get:function(){return N({},this._config)},enumerable:!1,configurable:!0}),s.prototype.updateState=function(e,n){var t=this.state;this.state=N(N({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},s.prototype.load=function(e){return Ce(this,void 0,void 0,function(){var n,t,r=this;return Oe(this,function(l){return this.data=e,n=e.data_list.map(function(i){var h,c=i.position.end.map(function(C){return Number(C)}),d=i.position.start.map(function(C){return Number(C)}),y=Math.abs(c[0]-d[0]),S=Math.abs(c[1]-d[1]),w=Math.abs(c[2]-d[2]),M=c[0]/2+d[0]/2,E=c[1]/2+d[1]/2,O=c[2]/2+d[2]/2,A=new p.Vector3(M,E,O),b=new p.BoxBufferGeometry(y,S,w),T=new p.ShaderMaterial({vertexShader:`
|
|
326
326
|
varying vec2 vUv;
|
|
327
327
|
void main() {
|
|
328
328
|
vUv = uv;
|
|
@@ -347,13 +347,13 @@ void main() {
|
|
|
347
347
|
gl_FragColor = vec4(1.0, 1.0, 1.0, alpha / 4.0 * opacity);
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
`,side:p.DoubleSide,visible:r.state.selectedId==="".concat(
|
|
350
|
+
`,side:p.DoubleSide,visible:r.state.selectedId==="".concat(i.category_name).concat(i.index),uniforms:{opacity:{value:r.state.mode==="box"?1:0}},depthWrite:!1,depthTest:!1,transparent:!0}),f=new p.Mesh(b,T);return f.position.copy(A),f.name="".concat(i.category_name).concat(i.index),f.userData.color=new((h=p.Vector4).bind.apply(h,Ot(Ot([void 0],i.mask_color.map(function(C){return C/255}).reverse(),!1),[1],!1))),f.userData.visible_viewpoint=Object.keys(i.visible_viewpoint),f}),(t=this.group).add.apply(t,n),[2]})})},s.prototype.setState=function(e,n){n===void 0&&(n={});var t=this.state,r=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,r),e.enabled!==void 0&&t.enabled!==e.enabled){var l={userAction:r};e.enabled?this._enable(l):this._disable(l)}},s.prototype.setMode=function(e){this.updateState({mode:e},!1),e==="mask"?(this.group.children.forEach(function(n){n.material.uniforms.opacity.value=0}),this.loadPanoMask(this.five.state.panoIndex)):e==="box"&&(this.itemMaskMesh.material.uniforms.color.value=new p.Vector4(0,0,0,1),this.group.children.forEach(function(n){n.material.uniforms.opacity.value=1}),this.five.needsRender=!0)},s.prototype.select=function(e,n){var t=this,r;this.updateState({selectedId:e!=null?e:null},(r=n==null?void 0:n.userAction)!==null&&r!==void 0?r:!1),this.group.children.forEach(function(l){l.material.visible=t.state.selectAll||l.name===e}),this.five.needsRender=!0},s.prototype.selectAll=function(e){e===void 0&&(e=!0),this.updateState({selectAll:!!e},!1),this.select()},s.prototype._enable=function(e){this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.on("gesture.mousemove",this.onFiveMouseMove),this.five.on("wantsTapGesture",this.onFiveTapGesture),this.five.on("cameraUpdate",this.onFiveCameraUpdate),this.five.scene.add(this.group),document.head.appendChild(this.style)},s.prototype._disable=function(e){this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.off("gesture.mousemove",this.onFiveMouseMove),this.five.off("wantsTapGesture",this.onFiveTapGesture),this.five.off("cameraUpdate",this.onFiveCameraUpdate),this.five.scene.remove(this.group),document.head.removeChild(this.style)},s.prototype.enable=function(e){var n;if(!this.state.enabled){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!0},t),this._enable({userAction:t})}},s.prototype.disable=function(e){var n;if(this.state.enabled!==!1){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!1},t),this._disable({userAction:t})}},s})(re.BasePlugin.Controller),vn=function(v,s){return new hn(v,s)};/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
351
351
|
* http://hammerjs.github.io/
|
|
352
352
|
*
|
|
353
353
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
354
|
-
* Licensed under the MIT license */var ft=(function(
|
|
354
|
+
* Licensed under the MIT license */var ft=(function(v,s,e,n){var t=["","webkit","Moz","MS","ms","o"],r=s.createElement?s.createElement("div"):n,l="function",i=Math.round,h=Math.abs,c=Date.now;function d(a,o,u){return setTimeout(b(a,u),o)}function y(a,o,u){return Array.isArray(a)?(S(a,u[o],u),!0):!1}function S(a,o,u){var g;if(a)if(a.forEach)a.forEach(o,u);else if(a.length!==n)for(g=0;g<a.length;)o.call(u,a[g],g,a),g++;else for(g in a)a.hasOwnProperty(g)&&o.call(u,a[g],g,a)}function w(a,o,u){var g="DEPRECATED METHOD: "+o+`
|
|
355
355
|
`+u+` AT
|
|
356
|
-
`;return function(){var T=new Error("get-stack-trace"),O=T&&T.stack?T.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",B=h.console&&(h.console.warn||h.console.log);return B&&B.call(h.console,g,O),a.apply(this,arguments)}}var E;typeof Object.assign!="function"?E=function(i){if(i===n||i===null)throw new TypeError("Cannot convert undefined or null to object");for(var u=Object(i),g=1;g<arguments.length;g++){var T=arguments[g];if(T!==n&&T!==null)for(var O in T)T.hasOwnProperty(O)&&(u[O]=T[O])}return u}:E=Object.assign;var S=w(function(i,u,g){for(var T=Object.keys(u),O=0;O<T.length;)(!g||g&&i[T[O]]===n)&&(i[T[O]]=u[T[O]]),O++;return i},"extend","Use `assign`."),C=w(function(i,u){return S(i,u,!0)},"merge","Use `assign`.");function P(a,i,u){var g=i.prototype,T;T=a.prototype=Object.create(g),T.constructor=a,T._super=g,u&&E(T,u)}function b(a,i){return function(){return a.apply(i,arguments)}}function M(a,i){return typeof a==l?a.apply(i&&i[0]||n,i):a}function f(a,i){return a===n?i:a}function _(a,i,u){A(X(i),function(g){a.addEventListener(g,u,!1)})}function x(a,i,u){A(X(i),function(g){a.removeEventListener(g,u,!1)})}function D(a,i){for(;a;){if(a==i)return!0;a=a.parentNode}return!1}function H(a,i){return a.indexOf(i)>-1}function X(a){return a.trim().split(/\s+/g)}function q(a,i,u){if(a.indexOf&&!u)return a.indexOf(i);for(var g=0;g<a.length;){if(u&&a[g][u]==i||!u&&a[g]===i)return g;g++}return-1}function te(a){return Array.prototype.slice.call(a,0)}function oe(a,i,u){for(var g=[],T=[],O=0;O<a.length;){var B=a[O][i];q(T,B)<0&&g.push(a[O]),T[O]=B,O++}return g=g.sort(function(he,ne){return he[i]>ne[i]}),g}function G(a,i){for(var u,g,T=i[0].toUpperCase()+i.slice(1),O=0;O<t.length;){if(u=t[O],g=u?u+T:i,g in a)return g;O++}return n}var K=1;function I(){return K++}function F(a){var i=a.ownerDocument||a;return i.defaultView||i.parentWindow||h}var L=/mobile|tablet|ip(ad|hone|od)|android/i,k="ontouchstart"in h,R=G(h,"PointerEvent")!==n,ae=k&&L.test(navigator.userAgent),Z="touch",V="pen",re="mouse",W="kinect",Y=25,U=1,ue=2,Q=4,J=8,Ce=1,Ee=2,Fe=4,Le=8,Se=16,fe=Ee|Fe,me=Le|Se,ze=fe|me,Ge=["x","y"],Ie=["clientX","clientY"];function ce(a,i){var u=this;this.manager=a,this.callback=i,this.element=a.element,this.target=a.options.inputTarget,this.domHandler=function(g){M(a.options.enable,[a])&&u.handler(g)},this.init()}ce.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(F(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(F(this.element),this.evWin,this.domHandler)}};function Je(a){var i,u=a.options.inputClass;return u?i=u:R?i=wt:ae?i=nt:k?i=Pt:i=tt,new i(a,$e)}function $e(a,i,u){var g=u.pointers.length,T=u.changedPointers.length,O=i&U&&g-T===0,B=i&(Q|J)&&g-T===0;u.isFirst=!!O,u.isFinal=!!B,O&&(a.session={}),u.eventType=i,v(a,u),a.emit("hammer.input",u),a.recognize(u),a.session.prevInput=u}function v(a,i){var u=a.session,g=i.pointers,T=g.length;u.firstInput||(u.firstInput=ie(i)),T>1&&!u.firstMultiple?u.firstMultiple=ie(i):T===1&&(u.firstMultiple=!1);var O=u.firstInput,B=u.firstMultiple,se=B?B.center:O.center,he=i.center=ye(g);i.timeStamp=c(),i.deltaTime=i.timeStamp-O.timeStamp,i.angle=bt(se,he),i.distance=et(se,he),j(u,i),i.offsetDirection=Me(i.deltaX,i.deltaY);var ne=Re(i.deltaTime,i.deltaX,i.deltaY);i.overallVelocityX=ne.x,i.overallVelocityY=ne.y,i.overallVelocity=d(ne.x)>d(ne.y)?ne.x:ne.y,i.scale=B?_n(B.pointers,g):1,i.rotation=B?On(B.pointers,g):0,i.maxPointers=u.prevInput?i.pointers.length>u.prevInput.maxPointers?i.pointers.length:u.prevInput.maxPointers:i.pointers.length,$(u,i);var we=a.element;D(i.srcEvent.target,we)&&(we=i.srcEvent.target),i.target=we}function j(a,i){var u=i.center,g=a.offsetDelta||{},T=a.prevDelta||{},O=a.prevInput||{};(i.eventType===U||O.eventType===Q)&&(T=a.prevDelta={x:O.deltaX||0,y:O.deltaY||0},g=a.offsetDelta={x:u.x,y:u.y}),i.deltaX=T.x+(u.x-g.x),i.deltaY=T.y+(u.y-g.y)}function $(a,i){var u=a.lastInterval||i,g=i.timeStamp-u.timeStamp,T,O,B,se;if(i.eventType!=J&&(g>Y||u.velocity===n)){var he=i.deltaX-u.deltaX,ne=i.deltaY-u.deltaY,we=Re(g,he,ne);O=we.x,B=we.y,T=d(we.x)>d(we.y)?we.x:we.y,se=Me(he,ne),a.lastInterval=i}else T=u.velocity,O=u.velocityX,B=u.velocityY,se=u.direction;i.velocity=T,i.velocityX=O,i.velocityY=B,i.direction=se}function ie(a){for(var i=[],u=0;u<a.pointers.length;)i[u]={clientX:s(a.pointers[u].clientX),clientY:s(a.pointers[u].clientY)},u++;return{timeStamp:c(),pointers:i,center:ye(i),deltaX:a.deltaX,deltaY:a.deltaY}}function ye(a){var i=a.length;if(i===1)return{x:s(a[0].clientX),y:s(a[0].clientY)};for(var u=0,g=0,T=0;T<i;)u+=a[T].clientX,g+=a[T].clientY,T++;return{x:s(u/i),y:s(g/i)}}function Re(a,i,u){return{x:i/a||0,y:u/a||0}}function Me(a,i){return a===i?Ce:d(a)>=d(i)?a<0?Ee:Fe:i<0?Le:Se}function et(a,i,u){u||(u=Ge);var g=i[u[0]]-a[u[0]],T=i[u[1]]-a[u[1]];return Math.sqrt(g*g+T*T)}function bt(a,i,u){u||(u=Ge);var g=i[u[0]]-a[u[0]],T=i[u[1]]-a[u[1]];return Math.atan2(T,g)*180/Math.PI}function On(a,i){return bt(i[1],i[0],Ie)+bt(a[1],a[0],Ie)}function _n(a,i){return et(i[0],i[1],Ie)/et(a[0],a[1],Ie)}var Cn={mousedown:U,mousemove:ue,mouseup:Q},Fn="mousedown",Ln="mousemove mouseup";function tt(){this.evEl=Fn,this.evWin=Ln,this.pressed=!1,ce.apply(this,arguments)}P(tt,ce,{handler:function(i){var u=Cn[i.type];u&U&&(i.button===0||i.button===2)&&(this.pressed=!0),u&ue&&i.which!==1&&(u=Q),this.pressed&&(u&Q&&(this.pressed=!1),this.callback(this.manager,u,{pointers:[i],changedPointers:[i],pointerType:re,srcEvent:i}))}});var Ut={pointerdown:U,pointermove:ue,pointerup:Q,pointercancel:J,pointerout:J},In={2:Z,3:V,4:re,5:W},Vt="pointerdown",jt="pointermove pointerup pointercancel";h.MSPointerEvent&&!h.PointerEvent&&(Vt="MSPointerDown",jt="MSPointerMove MSPointerUp MSPointerCancel");function wt(){this.evEl=Vt,this.evWin=jt,ce.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}P(wt,ce,{handler:function(i){var u=this.store,g=!1,T=!1,O=i.type.toLowerCase().replace("ms",""),B=Ut[O],se=In[i.pointerType]||i.pointerType,he=se==Z,ne=q(u,i.pointerId,"pointerId");B&U&&(i.button===0||i.button===2||he)?ne<0&&(u.push(i),ne=u.length-1):B&(Q|J)?g=!0:!he&&i.buttons===0&&(g=!0,T=!0,B=Ut.pointerup),!(ne<0)&&(T||(u[ne]=i),this.callback(this.manager,B,{pointers:u,changedPointers:[i],pointerType:se,srcEvent:u[ne]}),g&&u.splice(ne,1))}});var Dn={touchstart:U,touchmove:ue,touchend:Q,touchcancel:J},Nn="touchstart",kn="touchstart touchmove touchend touchcancel";function zt(){this.evTarget=Nn,this.evWin=kn,this.started=!1,ce.apply(this,arguments)}P(zt,ce,{handler:function(i){var u=Dn[i.type];if(u===U&&(this.started=!0),!!this.started){var g=Bn.call(this,i,u);u&(Q|J)&&g[0].length-g[1].length===0&&(this.started=!1),this.callback(this.manager,u,{pointers:g[0],changedPointers:g[1],pointerType:Z,srcEvent:i})}}});function Bn(a,i){var u=te(a.touches),g=te(a.changedTouches);return i&(Q|J)&&(u=oe(u.concat(g),"identifier")),[u,g]}var Un={touchstart:U,touchmove:ue,touchend:Q,touchcancel:J},Vn="touchstart touchmove touchend touchcancel";function nt(){this.evTarget=Vn,this.targetIds={},ce.apply(this,arguments)}P(nt,ce,{handler:function(i){var u=Un[i.type],g=jn.call(this,i,u);g&&this.callback(this.manager,u,{pointers:g[0],changedPointers:g[1],pointerType:Z,srcEvent:i})}});function jn(a,i){var u=te(a.touches),g=this.targetIds;if(i&(U|ue)&&u.length===1)return g[u[0].identifier]=!0,[u,u];var T,O,B=te(a.changedTouches),se=[],he=this.target;if(O=u.filter(function(ne){return D(ne.target,he)}),i===U)for(T=0;T<O.length;)g[O[T].identifier]=!0,T++;for(T=0;T<B.length;)g[B[T].identifier]&&se.push(B[T]),i&(Q|J)&&delete g[B[T].identifier],T++;if(se.length)return[oe(O.concat(se),"identifier"),se]}var zn=2500,Gt=25;function Pt(){ce.apply(this,arguments);var a=b(this.handler,this);this.touch=new nt(this.manager,a),this.mouse=new tt(this.manager,a),this.primaryTouch=null,this.lastTouches=[]}P(Pt,ce,{handler:function(i,u,g){var T=g.pointerType==Z,O=g.pointerType==re;if(!(O&&g.sourceCapabilities&&g.sourceCapabilities.firesTouchEvents)){if(T)Gn.call(this,u,g);else if(O&&Rn.call(this,g))return;this.callback(i,u,g)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Gn(a,i){a&U?(this.primaryTouch=i.changedPointers[0].identifier,Rt.call(this,i)):a&(Q|J)&&Rt.call(this,i)}function Rt(a){var i=a.changedPointers[0];if(i.identifier===this.primaryTouch){var u={x:i.clientX,y:i.clientY};this.lastTouches.push(u);var g=this.lastTouches,T=function(){var O=g.indexOf(u);O>-1&&g.splice(O,1)};setTimeout(T,zn)}}function Rn(a){for(var i=a.srcEvent.clientX,u=a.srcEvent.clientY,g=0;g<this.lastTouches.length;g++){var T=this.lastTouches[g],O=Math.abs(i-T.x),B=Math.abs(u-T.y);if(O<=Gt&&B<=Gt)return!0}return!1}var Yt=r?G(r.style,"touchAction"):n,Wt=Yt!==n,Xt="compute",Ht="auto",Mt="manipulation",De="none",Ye="pan-x",We="pan-y",rt=Wn();function Tt(a,i){this.manager=a,this.set(i)}Tt.prototype={set:function(a){a==Xt&&(a=this.compute()),Wt&&this.manager.element.style&&rt[a]&&(this.manager.element.style[Yt]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return A(this.manager.recognizers,function(i){M(i.options.enable,[i])&&(a=a.concat(i.getTouchAction()))}),Yn(a.join(" "))},preventDefaults:function(a){var i=a.srcEvent,u=a.offsetDirection;if(this.manager.session.prevented){i.preventDefault();return}var g=this.actions,T=H(g,De)&&!rt[De],O=H(g,We)&&!rt[We],B=H(g,Ye)&&!rt[Ye];if(T){var se=a.pointers.length===1,he=a.distance<2,ne=a.deltaTime<250;if(se&&he&&ne)return}if(!(B&&O)&&(T||O&&u&fe||B&&u&me))return this.preventSrc(i)},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};function Yn(a){if(H(a,De))return De;var i=H(a,Ye),u=H(a,We);return i&&u?De:i||u?i?Ye:We:H(a,Mt)?Mt:Ht}function Wn(){if(!Wt)return!1;var a={},i=h.CSS&&h.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(u){a[u]=i?h.CSS.supports("touch-action",u):!0}),a}var at=1,pe=2,ke=4,xe=8,Te=xe,Xe=16,be=32;function Ae(a){this.options=E({},this.defaults,a||{}),this.id=I(),this.manager=null,this.options.enable=f(this.options.enable,!0),this.state=at,this.simultaneous={},this.requireFail=[]}Ae.prototype={defaults:{},set:function(a){return E(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(y(a,"recognizeWith",this))return this;var i=this.simultaneous;return a=it(a,this),i[a.id]||(i[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return y(a,"dropRecognizeWith",this)?this:(a=it(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(y(a,"requireFailure",this))return this;var i=this.requireFail;return a=it(a,this),q(i,a)===-1&&(i.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(y(a,"dropRequireFailure",this))return this;a=it(a,this);var i=q(this.requireFail,a);return i>-1&&this.requireFail.splice(i,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){var i=this,u=this.state;function g(T){i.manager.emit(T,a)}u<xe&&g(i.options.event+qt(u)),g(i.options.event),a.additionalEvent&&g(a.additionalEvent),u>=xe&&g(i.options.event+qt(u))},tryEmit:function(a){if(this.canEmit())return this.emit(a);this.state=be},canEmit:function(){for(var a=0;a<this.requireFail.length;){if(!(this.requireFail[a].state&(be|at)))return!1;a++}return!0},recognize:function(a){var i=E({},a);if(!M(this.options.enable,[this,i])){this.reset(),this.state=be;return}this.state&(Te|Xe|be)&&(this.state=at),this.state=this.process(i),this.state&(pe|ke|xe|Xe)&&this.tryEmit(i)},process:function(a){},getTouchAction:function(){},reset:function(){}};function qt(a){return a&Xe?"cancel":a&xe?"end":a&ke?"move":a&pe?"start":""}function Kt(a){return a==Se?"down":a==Le?"up":a==Ee?"left":a==Fe?"right":""}function it(a,i){var u=i.manager;return u?u.get(a):a}function ge(){Ae.apply(this,arguments)}P(ge,Ae,{defaults:{pointers:1},attrTest:function(a){var i=this.options.pointers;return i===0||a.pointers.length===i},process:function(a){var i=this.state,u=a.eventType,g=i&(pe|ke),T=this.attrTest(a);return g&&(u&J||!T)?i|Xe:g||T?u&Q?i|xe:i&pe?i|ke:pe:be}});function ot(){ge.apply(this,arguments),this.pX=null,this.pY=null}P(ot,ge,{defaults:{event:"pan",threshold:10,pointers:1,direction:ze},getTouchAction:function(){var a=this.options.direction,i=[];return a&fe&&i.push(We),a&me&&i.push(Ye),i},directionTest:function(a){var i=this.options,u=!0,g=a.distance,T=a.direction,O=a.deltaX,B=a.deltaY;return T&i.direction||(i.direction&fe?(T=O===0?Ce:O<0?Ee:Fe,u=O!=this.pX,g=Math.abs(a.deltaX)):(T=B===0?Ce:B<0?Le:Se,u=B!=this.pY,g=Math.abs(a.deltaY))),a.direction=T,u&&g>i.threshold&&T&i.direction},attrTest:function(a){return ge.prototype.attrTest.call(this,a)&&(this.state&pe||!(this.state&pe)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var i=Kt(a.direction);i&&(a.additionalEvent=this.options.event+i),this._super.emit.call(this,a)}});function At(){ge.apply(this,arguments)}P(At,ge,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[De]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&pe)},emit:function(a){if(a.scale!==1){var i=a.scale<1?"in":"out";a.additionalEvent=this.options.event+i}this._super.emit.call(this,a)}});function Et(){Ae.apply(this,arguments),this._timer=null,this._input=null}P(Et,Ae,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ht]},process:function(a){var i=this.options,u=a.pointers.length===i.pointers,g=a.distance<i.threshold,T=a.deltaTime>i.time;if(this._input=a,!g||!u||a.eventType&(Q|J)&&!T)this.reset();else if(a.eventType&U)this.reset(),this._timer=m(function(){this.state=Te,this.tryEmit()},i.time,this);else if(a.eventType&Q)return Te;return be},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===Te&&(a&&a.eventType&Q?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=c(),this.manager.emit(this.options.event,this._input)))}});function St(){ge.apply(this,arguments)}P(St,ge,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[De]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&pe)}});function xt(){ge.apply(this,arguments)}P(xt,ge,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:fe|me,pointers:1},getTouchAction:function(){return ot.prototype.getTouchAction.call(this)},attrTest:function(a){var i=this.options.direction,u;return i&(fe|me)?u=a.overallVelocity:i&fe?u=a.overallVelocityX:i&me&&(u=a.overallVelocityY),this._super.attrTest.call(this,a)&&i&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&d(u)>this.options.velocity&&a.eventType&Q},emit:function(a){var i=Kt(a.offsetDirection);i&&this.manager.emit(this.options.event+i,a),this.manager.emit(this.options.event,a)}});function st(){Ae.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}P(st,Ae,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Mt]},process:function(a){var i=this.options,u=a.pointers.length===i.pointers,g=a.distance<i.threshold,T=a.deltaTime<i.time;if(this.reset(),a.eventType&U&&this.count===0)return this.failTimeout();if(g&&T&&u){if(a.eventType!=Q)return this.failTimeout();var O=this.pTime?a.timeStamp-this.pTime<i.interval:!0,B=!this.pCenter||et(this.pCenter,a.center)<i.posThreshold;this.pTime=a.timeStamp,this.pCenter=a.center,!B||!O?this.count=1:this.count+=1,this._input=a;var se=this.count%i.taps;if(se===0)return this.hasRequireFailures()?(this._timer=m(function(){this.state=Te,this.tryEmit()},i.interval,this),pe):Te}return be},failTimeout:function(){return this._timer=m(function(){this.state=be},this.options.interval,this),be},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Te&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Be(a,i){return i=i||{},i.recognizers=f(i.recognizers,Be.defaults.preset),new Ot(a,i)}Be.VERSION="2.0.7",Be.defaults={domEvents:!1,touchAction:Xt,enable:!0,inputTarget:null,inputClass:null,preset:[[St,{enable:!1}],[At,{enable:!1},["rotate"]],[xt,{direction:fe}],[ot,{direction:fe},["swipe"]],[st],[st,{event:"doubletap",taps:2},["tap"]],[Et]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Xn=1,Zt=2;function Ot(a,i){this.options=E({},Be.defaults,i||{}),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=a,this.input=Je(this),this.touchAction=new Tt(this,this.options.touchAction),Qt(this,!0),A(this.options.recognizers,function(u){var g=this.add(new u[0](u[1]));u[2]&&g.recognizeWith(u[2]),u[3]&&g.requireFailure(u[3])},this)}Ot.prototype={set:function(a){return E(this.options,a),a.touchAction&&this.touchAction.update(),a.inputTarget&&(this.input.destroy(),this.input.target=a.inputTarget,this.input.init()),this},stop:function(a){this.session.stopped=a?Zt:Xn},recognize:function(a){var i=this.session;if(!i.stopped){this.touchAction.preventDefaults(a);var u,g=this.recognizers,T=i.curRecognizer;(!T||T&&T.state&Te)&&(T=i.curRecognizer=null);for(var O=0;O<g.length;)u=g[O],i.stopped!==Zt&&(!T||u==T||u.canRecognizeWith(T))?u.recognize(a):u.reset(),!T&&u.state&(pe|ke|xe)&&(T=i.curRecognizer=u),O++}},get:function(a){if(a instanceof Ae)return a;for(var i=this.recognizers,u=0;u<i.length;u++)if(i[u].options.event==a)return i[u];return null},add:function(a){if(y(a,"add",this))return this;var i=this.get(a.options.event);return i&&this.remove(i),this.recognizers.push(a),a.manager=this,this.touchAction.update(),a},remove:function(a){if(y(a,"remove",this))return this;if(a=this.get(a),a){var i=this.recognizers,u=q(i,a);u!==-1&&(i.splice(u,1),this.touchAction.update())}return this},on:function(a,i){if(a!==n&&i!==n){var u=this.handlers;return A(X(a),function(g){u[g]=u[g]||[],u[g].push(i)}),this}},off:function(a,i){if(a!==n){var u=this.handlers;return A(X(a),function(g){i?u[g]&&u[g].splice(q(u[g],i),1):delete u[g]}),this}},emit:function(a,i){this.options.domEvents&&Hn(a,i);var u=this.handlers[a]&&this.handlers[a].slice();if(!(!u||!u.length)){i.type=a,i.preventDefault=function(){i.srcEvent.preventDefault()};for(var g=0;g<u.length;)u[g](i),g++}},destroy:function(){this.element&&Qt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Qt(a,i){var u=a.element;if(u.style){var g;A(a.options.cssProps,function(T,O){g=G(u.style,O),i?(a.oldCssProps[g]=u.style[g],u.style[g]=T):u.style[g]=a.oldCssProps[g]||""}),i||(a.oldCssProps={})}}function Hn(a,i){var u=o.createEvent("Event");u.initEvent(a,!0,!0),u.gesture=i,i.target.dispatchEvent(u)}return E(Be,{INPUT_START:U,INPUT_MOVE:ue,INPUT_END:Q,INPUT_CANCEL:J,STATE_POSSIBLE:at,STATE_BEGAN:pe,STATE_CHANGED:ke,STATE_ENDED:xe,STATE_RECOGNIZED:Te,STATE_CANCELLED:Xe,STATE_FAILED:be,DIRECTION_NONE:Ce,DIRECTION_LEFT:Ee,DIRECTION_RIGHT:Fe,DIRECTION_UP:Le,DIRECTION_DOWN:Se,DIRECTION_HORIZONTAL:fe,DIRECTION_VERTICAL:me,DIRECTION_ALL:ze,Manager:Ot,Input:ce,TouchAction:Tt,TouchInput:nt,MouseInput:tt,PointerEventInput:wt,TouchMouseInput:Pt,SingleTouchInput:zt,Recognizer:Ae,AttrRecognizer:ge,Tap:st,Pan:ot,Swipe:xt,Pinch:At,Rotate:St,Press:Et,on:_,off:x,each:A,merge:C,extend:S,assign:E,inherit:P,bindFn:b,prefixed:G}),Be})(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{}),Ne=function(h,o){o===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),o===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=h,this.domElement=o,this.enabled=!0,this.target=new N.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:N.MOUSE.ROTATE,MIDDLE:N.MOUSE.DOLLY,RIGHT:N.MOUSE.PAN},this.touches={ONE:N.TOUCH.ROTATE,TWO:N.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return c.phi},this.getAzimuthalAngle=function(){return c.theta},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(n),e.update(),s=l.NONE},this.update=(function(){var v=new N.Vector3,j=new N.Quaternion().setFromUnitVectors(h.up,new N.Vector3(0,1,0)),$=j.clone().inverse(),ie=new N.Vector3,ye=new N.Quaternion;return function(){var Me=e.object.position;return v.copy(Me).sub(e.target),v.applyQuaternion(j),c.setFromVector3(v),e.autoRotate&&s===l.NONE&&X(D()),e.enableDamping?(c.theta+=m.theta*e.dampingFactor,c.phi+=m.phi*e.dampingFactor):(c.theta+=m.theta,c.phi+=m.phi),c.theta=Math.max(e.minAzimuthAngle,Math.min(e.maxAzimuthAngle,c.theta)),c.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,c.phi)),c.makeSafe(),c.radius*=y,c.radius=Math.max(e.minDistance,Math.min(e.maxDistance,c.radius)),e.enableDamping===!0?e.target.addScaledVector(A,e.dampingFactor):e.target.add(A),v.setFromSpherical(c),v.applyQuaternion($),Me.copy(e.target).add(v),e.object.lookAt(e.target),e.enableDamping===!0?(m.theta*=1-e.dampingFactor,m.phi*=1-e.dampingFactor,A.multiplyScalar(1-e.dampingFactor)):(m.set(0,0,0),A.set(0,0,0)),y=1,w||ie.distanceToSquared(e.object.position)>d||8*(1-ye.dot(e.object.quaternion))>d?(e.dispatchEvent(n),ie.copy(e.object.position),ye.copy(e.object.quaternion),w=!1,!0):!1}})(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",$e,!1),e.domElement.removeEventListener("mousedown",Se,!1),e.domElement.removeEventListener("wheel",ze,!1),e.domElement.removeEventListener("touchstart",Ie,!1),e.domElement.removeEventListener("touchend",Je,!1),e.domElement.removeEventListener("touchmove",ce,!1),document.removeEventListener("mousemove",fe,!1),document.removeEventListener("mouseup",me,!1),e.domElement.removeEventListener("keydown",Ge,!1)};var e=this,n={type:"change"},t={type:"start"},r={type:"end"},l={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},s=l.NONE,d=1e-6,c=new N.Spherical,m=new N.Spherical,y=1,A=new N.Vector3,w=!1,E=new N.Vector2,S=new N.Vector2,C=new N.Vector2,P=new N.Vector2,b=new N.Vector2,M=new N.Vector2,f=new N.Vector2,_=new N.Vector2,x=new N.Vector2;function D(){return 2*Math.PI/60/60*e.autoRotateSpeed}function H(){return Math.pow(.95,e.zoomSpeed)}function X(v){m.theta-=v}function q(v){m.phi-=v}var te=(function(){var v=new N.Vector3;return function($,ie){v.setFromMatrixColumn(ie,0),v.multiplyScalar(-$),A.add(v)}})(),oe=(function(){var v=new N.Vector3;return function($,ie){e.screenSpacePanning===!0?v.setFromMatrixColumn(ie,1):(v.setFromMatrixColumn(ie,0),v.crossVectors(e.object.up,v)),v.multiplyScalar($),A.add(v)}})(),G=(function(){var v=new N.Vector3;return function($,ie){var ye=e.domElement;if(e.object.isPerspectiveCamera){var Re=e.object.position;v.copy(Re).sub(e.target);var Me=v.length();Me*=Math.tan(e.object.fov/2*Math.PI/180),te(2*$*Me/ye.clientHeight,e.object.matrix),oe(2*ie*Me/ye.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(te($*(e.object.right-e.object.left)/e.object.zoom/ye.clientWidth,e.object.matrix),oe(ie*(e.object.top-e.object.bottom)/e.object.zoom/ye.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}})();function K(v){e.object.isPerspectiveCamera?y/=v:e.object.isOrthographicCamera?(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom*v)),e.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function I(v){e.object.isPerspectiveCamera?y*=v:e.object.isOrthographicCamera?(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/v)),e.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function F(v){E.set(v.clientX,v.clientY)}function L(v){f.set(v.clientX,v.clientY)}function k(v){P.set(v.clientX,v.clientY)}function R(v){S.set(v.clientX,v.clientY),C.subVectors(S,E).multiplyScalar(e.rotateSpeed);var j=e.domElement;X(2*Math.PI*C.x/j.clientHeight),q(2*Math.PI*C.y/j.clientHeight),E.copy(S),e.update()}function ae(v){_.set(v.clientX,v.clientY),x.subVectors(_,f),x.y>0?K(H()):x.y<0&&I(H()),f.copy(_),e.update()}function Z(v){b.set(v.clientX,v.clientY),M.subVectors(b,P).multiplyScalar(e.panSpeed),G(M.x,M.y),P.copy(b),e.update()}function V(v){v.deltaY<0?I(H()):v.deltaY>0&&K(H()),e.update()}function re(v){var j=!1;switch(v.keyCode){case e.keys.UP:G(0,e.keyPanSpeed),j=!0;break;case e.keys.BOTTOM:G(0,-e.keyPanSpeed),j=!0;break;case e.keys.LEFT:G(e.keyPanSpeed,0),j=!0;break;case e.keys.RIGHT:G(-e.keyPanSpeed,0),j=!0;break}j&&(v.preventDefault(),e.update())}function W(v){if(v.touches.length==1)E.set(v.touches[0].pageX,v.touches[0].pageY);else{var j=.5*(v.touches[0].pageX+v.touches[1].pageX),$=.5*(v.touches[0].pageY+v.touches[1].pageY);E.set(j,$)}}function Y(v){if(v.touches.length==1)P.set(v.touches[0].pageX,v.touches[0].pageY);else{var j=.5*(v.touches[0].pageX+v.touches[1].pageX),$=.5*(v.touches[0].pageY+v.touches[1].pageY);P.set(j,$)}}function U(v){var j=v.touches[0].pageX-v.touches[1].pageX,$=v.touches[0].pageY-v.touches[1].pageY,ie=Math.sqrt(j*j+$*$);f.set(0,ie)}function ue(v){e.enableZoom&&U(v),e.enablePan&&Y(v)}function Q(v){e.enableZoom&&U(v),e.enableRotate&&W(v)}function J(v){if(v.touches.length==1)S.set(v.touches[0].pageX,v.touches[0].pageY);else{var j=.5*(v.touches[0].pageX+v.touches[1].pageX),$=.5*(v.touches[0].pageY+v.touches[1].pageY);S.set(j,$)}C.subVectors(S,E).multiplyScalar(e.rotateSpeed);var ie=e.domElement;X(2*Math.PI*C.x/ie.clientHeight),q(2*Math.PI*C.y/ie.clientHeight),E.copy(S)}function Ce(v){if(v.touches.length==1)b.set(v.touches[0].pageX,v.touches[0].pageY);else{var j=.5*(v.touches[0].pageX+v.touches[1].pageX),$=.5*(v.touches[0].pageY+v.touches[1].pageY);b.set(j,$)}M.subVectors(b,P).multiplyScalar(e.panSpeed),G(M.x,M.y),P.copy(b)}function Ee(v){var j=v.touches[0].pageX-v.touches[1].pageX,$=v.touches[0].pageY-v.touches[1].pageY,ie=Math.sqrt(j*j+$*$);_.set(0,ie),x.set(0,Math.pow(_.y/f.y,e.zoomSpeed)),K(x.y),f.copy(_)}function Fe(v){e.enableZoom&&Ee(v),e.enablePan&&Ce(v)}function Le(v){e.enableZoom&&Ee(v),e.enableRotate&&J(v)}function Se(v){if(e.enabled!==!1){v.preventDefault(),e.domElement.focus?e.domElement.focus():window.focus();var j;switch(v.button){case 0:j=e.mouseButtons.LEFT;break;case 1:j=e.mouseButtons.MIDDLE;break;case 2:j=e.mouseButtons.RIGHT;break;default:j=-1}switch(j){case N.MOUSE.DOLLY:if(e.enableZoom===!1)return;L(v),s=l.DOLLY;break;case N.MOUSE.ROTATE:if(v.ctrlKey||v.metaKey||v.shiftKey){if(e.enablePan===!1)return;k(v),s=l.PAN}else{if(e.enableRotate===!1)return;F(v),s=l.ROTATE}break;case N.MOUSE.PAN:if(v.ctrlKey||v.metaKey||v.shiftKey){if(e.enableRotate===!1)return;F(v),s=l.ROTATE}else{if(e.enablePan===!1)return;k(v),s=l.PAN}break;default:s=l.NONE}s!==l.NONE&&(document.addEventListener("mousemove",fe,!1),document.addEventListener("mouseup",me,!1),e.dispatchEvent(t))}}function fe(v){if(e.enabled!==!1)switch(v.preventDefault(),s){case l.ROTATE:if(e.enableRotate===!1)return;R(v);break;case l.DOLLY:if(e.enableZoom===!1)return;ae(v);break;case l.PAN:if(e.enablePan===!1)return;Z(v);break}}function me(v){e.enabled!==!1&&(document.removeEventListener("mousemove",fe,!1),document.removeEventListener("mouseup",me,!1),e.dispatchEvent(r),s=l.NONE)}function ze(v){e.enabled===!1||e.enableZoom===!1||s!==l.NONE&&s!==l.ROTATE||(v.preventDefault(),v.stopPropagation(),e.dispatchEvent(t),V(v),e.dispatchEvent(r))}function Ge(v){e.enabled===!1||e.enableKeys===!1||e.enablePan===!1||re(v)}function Ie(v){if(e.enabled!==!1){switch(v.preventDefault(),v.touches.length){case 1:switch(e.touches.ONE){case N.TOUCH.ROTATE:if(e.enableRotate===!1)return;W(v),s=l.TOUCH_ROTATE;break;case N.TOUCH.PAN:if(e.enablePan===!1)return;Y(v),s=l.TOUCH_PAN;break;default:s=l.NONE}break;case 2:switch(e.touches.TWO){case N.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;ue(v),s=l.TOUCH_DOLLY_PAN;break;case N.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Q(v),s=l.TOUCH_DOLLY_ROTATE;break;default:s=l.NONE}break;default:s=l.NONE}s!==l.NONE&&e.dispatchEvent(t)}}function ce(v){if(e.enabled!==!1)switch(v.preventDefault(),v.stopPropagation(),s){case l.TOUCH_ROTATE:if(e.enableRotate===!1)return;J(v),e.update();break;case l.TOUCH_PAN:if(e.enablePan===!1)return;Ce(v),e.update();break;case l.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Fe(v),e.update();break;case l.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Le(v),e.update();break;default:s=l.NONE}}function Je(v){e.enabled!==!1&&(e.dispatchEvent(r),s=l.NONE)}function $e(v){e.enabled!==!1&&v.preventDefault()}e.domElement.addEventListener("contextmenu",$e,!1),e.domElement.addEventListener("mousedown",Se,!1),e.domElement.addEventListener("wheel",ze,!1),e.domElement.addEventListener("touchstart",Ie,!1),e.domElement.addEventListener("touchend",Je,!1),e.domElement.addEventListener("touchmove",ce,!1),e.domElement.addEventListener("keydown",Ge,!1),e.domElement.tabIndex===-1&&(e.domElement.tabIndex=0),this.update()};Ne.prototype=Object.create(N.EventDispatcher.prototype),Ne.prototype.constructor=Ne;var ht=function(h,o){Ne.call(this,h,o),this.mouseButtons.LEFT=N.MOUSE.PAN,this.mouseButtons.RIGHT=N.MOUSE.ROTATE,this.touches.ONE=N.TOUCH.PAN,this.touches.TWO=N.TOUCH.DOLLY_ROTATE};ht.prototype=Object.create(N.EventDispatcher.prototype),ht.prototype.constructor=ht;var Pe=function(h){N.Object3D.call(this),this.element=h,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.addEventListener("removed",function(){this.traverse(function(o){o.element instanceof Element&&o.element.parentNode!==null&&o.element.parentNode.removeChild(o.element)})})};Pe.prototype=Object.create(N.Object3D.prototype),Pe.prototype.constructor=Pe;var Ke=function(h){Pe.call(this,h)};Ke.prototype=Object.create(Pe.prototype),Ke.prototype.constructor=Ke;var Ft=function(){var h=this,o,e,n,t,r=new N.Matrix4,l={camera:{fov:0,style:""},objects:new WeakMap},s=document.createElement("div");s.style.overflow="hidden",this.domElement=s;var d=document.createElement("div");d.style.WebkitTransformStyle="preserve-3d",d.style.transformStyle="preserve-3d",d.style.pointerEvents="none",s.appendChild(d);var c=/Trident/i.test(navigator.userAgent);this.getSize=function(){return{width:o,height:e}},this.setSize=function(P,b){o=P,e=b,n=o/2,t=e/2,s.style.width=P+"px",s.style.height=b+"px",d.style.width=P+"px",d.style.height=b+"px"};function m(P){return Math.abs(P)<1e-10?0:P}function y(P){var b=P.elements;return"matrix3d("+m(b[0])+","+m(-b[1])+","+m(b[2])+","+m(b[3])+","+m(b[4])+","+m(-b[5])+","+m(b[6])+","+m(b[7])+","+m(b[8])+","+m(-b[9])+","+m(b[10])+","+m(b[11])+","+m(b[12])+","+m(-b[13])+","+m(b[14])+","+m(b[15])+")"}function A(P,b){var M=P.elements,f="matrix3d("+m(M[0])+","+m(M[1])+","+m(M[2])+","+m(M[3])+","+m(-M[4])+","+m(-M[5])+","+m(-M[6])+","+m(-M[7])+","+m(M[8])+","+m(M[9])+","+m(M[10])+","+m(M[11])+","+m(M[12])+","+m(M[13])+","+m(M[14])+","+m(M[15])+")";return c?"translate(-50%,-50%)translate("+n+"px,"+t+"px)"+b+f:"translate(-50%,-50%)"+f}function w(P,b,M,f){if(P instanceof Pe){P.onBeforeRender(h,b,M);var _;P instanceof Ke?(r.copy(M.matrixWorldInverse),r.transpose(),r.copyPosition(P.matrixWorld),r.scale(P.scale),r.elements[3]=0,r.elements[7]=0,r.elements[11]=0,r.elements[15]=1,_=A(r,f)):_=A(P.matrixWorld,f);var x=P.element,D=l.objects.get(P);if(D===void 0||D.style!==_){x.style.WebkitTransform=_,x.style.transform=_;var H={style:_};c&&(H.distanceToCameraSquared=E(M,P)),l.objects.set(P,H)}x.style.display=P.visible?"":"none",x.parentNode!==d&&d.appendChild(x),P.onAfterRender(h,b,M)}for(var X=0,q=P.children.length;X<q;X++)w(P.children[X],b,M,f)}var E=(function(){var P=new N.Vector3,b=new N.Vector3;return function(M,f){return P.setFromMatrixPosition(M.matrixWorld),b.setFromMatrixPosition(f.matrixWorld),P.distanceToSquared(b)}})();function S(P){var b=[];return P.traverse(function(M){M instanceof Pe&&b.push(M)}),b}function C(P){for(var b=S(P).sort(function(x,D){var H=l.objects.get(x).distanceToCameraSquared,X=l.objects.get(D).distanceToCameraSquared;return H-X}),M=b.length,f=0,_=b.length;f<_;f++)b[f].element.style.zIndex=M-f}this.render=function(P,b){var M=b.projectionMatrix.elements[5]*t;if(l.camera.fov!==M&&(b.isPerspectiveCamera?(s.style.WebkitPerspective=M+"px",s.style.perspective=M+"px"):(s.style.WebkitPerspective="",s.style.perspective=""),l.camera.fov=M),P.autoUpdate===!0&&P.updateMatrixWorld(),b.parent===null&&b.updateMatrixWorld(),b.isOrthographicCamera)var f=-(b.right+b.left)/2,_=(b.top+b.bottom)/2;var x=b.isOrthographicCamera?"scale("+M+")translate("+m(f)+"px,"+m(_)+"px)"+y(b.matrixWorldInverse):"translateZ("+M+"px)"+y(b.matrixWorldInverse),D=x+"translate("+n+"px,"+t+"px)";l.camera.style!==D&&!c&&(d.style.WebkitTransform=D,d.style.transform=D,l.camera.style=D),w(P,P,b,x),c&&C(P)}};function Lt(h,o,e){var n=o.getBoundingClientRect(),t=n.top,r=n.left,l=n.width,s=n.height;return new p.Vector2((h.x-r)/l*2-1,-(h.y-t)/s*2+1)}var It=(function(h){ve(o,h);function o(e,n,t,r,l){var s=h.call(this)||this;s.type="RoundedBoxGeometry",l=isNaN(l)?1:Math.max(1,Math.floor(l)),e=isNaN(e)?1:e,n=isNaN(n)?1:n,t=isNaN(t)?1:t,r=isNaN(r)?.15:r,r=Math.min(r,Math.min(e,Math.min(n,Math.min(t)))/2);var d=e/2-r,c=n/2-r,m=t/2-r;s.parameters={width:e,height:n,depth:t,radius:r,radiusSegments:l};var y=l+1,A=y*l+1<<3,w=new p.BufferAttribute(new Float32Array(A*3),3),E=new p.BufferAttribute(new Float32Array(A*3),3),S=[],C=[];new p.Vector3;var P=new p.Vector3,b=[],M=[],f=[],_=y*l,x=y*l+1;D(),X(),H(),q(),oe(),te();function D(){for(var I=[new p.Vector3(1,1,1),new p.Vector3(1,1,-1),new p.Vector3(-1,1,-1),new p.Vector3(-1,1,1),new p.Vector3(1,-1,1),new p.Vector3(1,-1,-1),new p.Vector3(-1,-1,-1),new p.Vector3(-1,-1,1)],F=0;F<8;F++)S.push([]),C.push([]);for(var L=Math.PI/2,k=new p.Vector3(d,c,m),R=0;R<=l;R++){var ae=R/l,Z=ae*L,V=Math.cos(Z),re=Math.sin(Z);if(R==l){P.set(0,1,0);var W=P.clone().multiplyScalar(r).add(k);S[0].push(W),b.push(W);var Y=P.clone();C[0].push(Y),M.push(Y);continue}for(var U=0;U<=l;U++){var ue=U/l,Q=ue*L;P.x=V*Math.cos(Q),P.y=re,P.z=V*Math.sin(Q);var W=P.clone().multiplyScalar(r).add(k);S[0].push(W),b.push(W);var Y=P.clone().normalize();C[0].push(Y),M.push(Y)}}for(var J=1;J<8;J++)for(var F=0;F<S[0].length;F++){var W=S[0][F].clone().multiply(I[J]);S[J].push(W),b.push(W);var Y=C[0][F].clone().multiply(I[J]);C[J].push(Y),M.push(Y)}}function H(){for(var I=[!0,!1,!0,!1,!1,!0,!1,!0],F=y*(l-1),L=0;L<8;L++){for(var k=x*L,R=0;R<l-1;R++)for(var ae=R*y,Z=(R+1)*y,V=0;V<l;V++){var re=V+1,W=k+ae+V,Y=k+ae+re,U=k+Z+V,ue=k+Z+re;I[L]?(f.push(W),f.push(U),f.push(Y),f.push(Y),f.push(U),f.push(ue)):(f.push(W),f.push(Y),f.push(U),f.push(Y),f.push(ue),f.push(U))}for(var V=0;V<l;V++){var W=k+F+V,Y=k+F+V+1,U=k+_;I[L]?(f.push(W),f.push(U),f.push(Y)):(f.push(W),f.push(Y),f.push(U))}}}function X(){var I=_,F=_+x,L=_+x*2,k=_+x*3;f.push(I),f.push(F),f.push(L),f.push(I),f.push(L),f.push(k),I=_+x*4,F=_+x*5,L=_+x*6,k=_+x*7,f.push(I),f.push(L),f.push(F),f.push(I),f.push(k),f.push(L),I=0,F=x,L=x*4,k=x*5,f.push(I),f.push(L),f.push(F),f.push(F),f.push(L),f.push(k),I=x*2,F=x*3,L=x*6,k=x*7,f.push(I),f.push(L),f.push(F),f.push(F),f.push(L),f.push(k),I=l,F=l+x*3,L=l+x*4,k=l+x*7,f.push(I),f.push(F),f.push(L),f.push(F),f.push(k),f.push(L),I=l+x,F=l+x*2,L=l+x*5,k=l+x*6,f.push(I),f.push(L),f.push(F),f.push(F),f.push(L),f.push(k)}function q(){for(var I=0;I<4;I++)for(var F=I*x,L=4*x+F,k=(I&1)===1,R=0;R<l;R++){var ae=R+1,Z=F+R,V=F+ae,re=L+R,W=L+ae;k?(f.push(Z),f.push(re),f.push(V),f.push(V),f.push(re),f.push(W)):(f.push(Z),f.push(V),f.push(re),f.push(V),f.push(W),f.push(re))}}function te(){for(var I=[0,2,4,6],F=[1,3,5,7],L=0;L<4;L++)for(var k=x*I[L],R=x*F[L],ae=1>=L,Z=0;Z<l;Z++){var V=Z*y,re=(Z+1)*y,W=k+V,Y=k+re,U=R+V,ue=R+re;ae?(f.push(W),f.push(U),f.push(Y),f.push(Y),f.push(U),f.push(ue)):(f.push(W),f.push(Y),f.push(U),f.push(Y),f.push(ue),f.push(U))}}function oe(){for(var I=l-1,F=[0,1,4,5],L=[3,2,7,6],k=[0,1,1,0],R=0;R<4;R++)for(var ae=F[R]*x,Z=L[R]*x,V=0;V<=I;V++){var re=ae+l+V*y,W=ae+(V!=I?l+(V+1)*y:x-1),Y=Z+l+V*y,U=Z+(V!=I?l+(V+1)*y:x-1);k[R]?(f.push(re),f.push(Y),f.push(W),f.push(W),f.push(Y),f.push(U)):(f.push(re),f.push(W),f.push(Y),f.push(W),f.push(U),f.push(Y))}}for(var G=0,K=0;K<b.length;K++)w.setXYZ(G,b[K].x,b[K].y,b[K].z),E.setXYZ(G,M[K].x,M[K].y,M[K].z),G++;return s.setIndex(new p.BufferAttribute(new Uint16Array(f),1)),s.setAttribute("position",w),s.setAttribute("normal",E),s}return o})(p.BufferGeometry);function Ue(h,o){return typeof h!="number"||typeof o!="number"?!1:Math.abs(h-o)<.001}function Ve(h,o,e,n){n===void 0&&(n=function(r){return r});var t=n(e);return h*(1-t)+o*t}var le=Number((Math.PI/2).toFixed(5));function vn(h,o,e){var n=new p.Shape;return n.moveTo(e,0),n.lineTo(h-e,0),n.absarc(h-e,e,e,-le,0,!1),n.lineTo(h,o-e),n.absarc(h-e,o-e,e,0,le,!1),n.lineTo(e,o),n.absarc(e,o-e,e,le,Math.PI,!1),n.lineTo(0,e),n.absarc(e,e,e,Math.PI,Math.PI*1.5,!1),n}var je=function(h){var o=document.createElement("div");o.innerText=h;var e=new Pe(o);return e.name=h,e.scale.set(.3,.3,.3),o.style.pointerEvents="none",o.style.backfaceVisibility="hidden",e},Ze=function(h){var o=new p.PlaneGeometry(5,5),e=new p.MeshBasicMaterial({transparent:!0,opacity:0}),n=new p.Mesh(o,e),t=document.createElement("div");t.innerText=h;var r=new Pe(t);return r.name=h,r.scale.set(.3,.3,.3),t.style.color="#ffffff",t.style.opacity="0.5",t.style.pointerEvents="none",t.style.backfaceVisibility="hidden",n.rotateX(-le),n.add(r),n},pn=(function(h){ve(o,h);function o(e,n){var t=h.call(this,e)||this;t.camera=new de.Camera(90),t.scene=new p.Scene,t.renderer=new p.WebGLRenderer({antialias:!0,alpha:!0}),t.css3drenderer=new Ft,t.ambientLight=new p.AmbientLight(16777215,.7),t.wrapper=document.createElement("div"),t.arrows=document.createElement("div"),t.arrowLeft=document.createElement("div"),t.arrowRight=document.createElement("div"),t.arrowFront=document.createElement("div"),t.arrowBack=document.createElement("div"),t.arrowTop=document.createElement("div"),t.arrowBottom=document.createElement("div"),t.spherical=null,t.dragging=!1,t.style=document.createElement("style"),t.directionalLight=new p.DirectionalLight(16777215,.2),t.box=new p.Mesh(new It(8,8,8,.5,20),new p.MeshPhongMaterial({color:16777215})),t.faces=new p.Group,t.orient=function(s){var d=s.longitude,c=s.latitude;t.dragging=!1,t.spherical=null,t.controls.enableDamping=!1,t.five.setState(Object.assign({latitude:c},d!==void 0?{longitude:d+t.config.fixedLongitude}:{})),t.five.ready().then(function(){t.controls.enableDamping=!0,t.setState({arrowsVisible:!0})})},t.onRenderFrame=function(){var s,d,c,m,y;if(t.renderer.render(t.scene,t.camera),t.css3drenderer.render(t.scene,t.camera),t.directionalLight.position.copy(t.camera.position),(s=t.controls)===null||s===void 0||s.update(),t.dragging){t.camera.computePose(),t.updateByCamera();var A=t.camera.pose,w=A.longitude,E=A.latitude;t.five.setState({longitude:w,latitude:E},!0),t.updateArrows({longitude:w,latitude:E})}else if(t.spherical&&(!Ue(t.spherical.pi,(d=t.controls)===null||d===void 0?void 0:d.getPolarAngle())||!Ue(t.spherical.theta,(c=t.controls)===null||c===void 0?void 0:c.getAzimuthalAngle()))){t.spherical={pi:(m=t.controls)===null||m===void 0?void 0:m.getPolarAngle(),theta:(y=t.controls)===null||y===void 0?void 0:y.getAzimuthalAngle()},t.camera.computePose(),t.updateByCamera();var S=t.camera.pose,w=S.longitude,E=S.latitude;t.five.setState({longitude:w,latitude:E},!0),t.updateArrows({longitude:w,latitude:E})}else t.spherical=null},t.onTapGesture=function(s){var d=s.pointers[0].clientX,c=s.pointers[0].clientY,m=Lt({x:d,y:c},t.wrapper),y=new p.Raycaster;y.setFromCamera(m,t.camera);var A=y.intersectObjects(t.faces.children,!1)[0];if(A){var w=A.object.userData,E=w.longitude,S=w.latitude;t.orient({longitude:E,latitude:S})}},t.onFiveWantsGesture=function(){if(t.spherical)return!1},t.onFiveModeChange=function(s){t.controls&&(t.controls.maxPolarAngle=s==="Topview"?0:le)},t.onCameraUpdate=function(s){var d=s.state;if(!t.dragging&&!t.spherical){var c=d.longitude,m=d.latitude;t.camera.pose.longitude===c&&t.camera.pose.latitude===m||(t.camera.setFromPose({longitude:c,latitude:m,distance:20,offset:new p.Vector3(0,0,0)}),t.updateByCamera(),t.updateArrows({longitude:c,latitude:m}))}},t.onPanStart=function(s){t.dragging=!0,t.spherical={}},t.onMouseMove=function(s){if(!t.dragging){var d=Lt({x:s.clientX,y:s.clientY},t.wrapper),c=new p.Raycaster;c.setFromCamera(d,t.camera);var m=c.intersectObjects(t.faces.children,!1)[0];t.faces.children.forEach(function(y){y.material.opacity=0,y.children[0].element.style.color=""}),m&&(m.object.material.opacity=.3,m.object.children[0].element.style.color="#336dff")}},t.onPanEnd=function(s){t.dragging=!1,t.spherical={pi:t.controls.getPolarAngle(),theta:t.controls.getAzimuthalAngle()}},t.dispose=function(){t.disable()},t.five=e;var r={enabled:!1,visible:!0,arrowsVisible:!1};t.state=Object.assign(r,n==null?void 0:n.initialState);var l=z({fixedLongitude:0,orthoView:!0},n==null?void 0:n.config);return t._config=l,t.state.enabled&&t._enable({userAction:!1}),t.mc=new ft.Manager(t.wrapper),t.mc.add(new ft.Tap({interval:410})),t.mc.add(new ft.Pan({threshold:10,pointers:0})),t.camera.setFromPose({distance:20,offset:new p.Vector3(0,0,0),longitude:e.camera.pose.latitude,latitude:e.camera.pose.latitude}),t.cylinder=new p.Mesh(new p.CylinderGeometry(13.2,14,.01,50,1,!0),new p.ShaderMaterial({uniforms:{radiusTop:{value:13.2},radiusBottom:{value:14},opacity:{value:1}},vertexShader:`
|
|
356
|
+
`;return function(){var P=new Error("get-stack-trace"),_=P&&P.stack?P.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",V=v.console&&(v.console.warn||v.console.log);return V&&V.call(v.console,g,_),a.apply(this,arguments)}}var M;typeof Object.assign!="function"?M=function(o){if(o===n||o===null)throw new TypeError("Cannot convert undefined or null to object");for(var u=Object(o),g=1;g<arguments.length;g++){var P=arguments[g];if(P!==n&&P!==null)for(var _ in P)P.hasOwnProperty(_)&&(u[_]=P[_])}return u}:M=Object.assign;var E=w(function(o,u,g){for(var P=Object.keys(u),_=0;_<P.length;)(!g||g&&o[P[_]]===n)&&(o[P[_]]=u[P[_]]),_++;return o},"extend","Use `assign`."),O=w(function(o,u){return E(o,u,!0)},"merge","Use `assign`.");function A(a,o,u){var g=o.prototype,P;P=a.prototype=Object.create(g),P.constructor=a,P._super=g,u&&M(P,u)}function b(a,o){return function(){return a.apply(o,arguments)}}function T(a,o){return typeof a==l?a.apply(o&&o[0]||n,o):a}function f(a,o){return a===n?o:a}function C(a,o,u){S(W(o),function(g){a.addEventListener(g,u,!1)})}function x(a,o,u){S(W(o),function(g){a.removeEventListener(g,u,!1)})}function F(a,o){for(;a;){if(a==o)return!0;a=a.parentNode}return!1}function G(a,o){return a.indexOf(o)>-1}function W(a){return a.trim().split(/\s+/g)}function Y(a,o,u){if(a.indexOf&&!u)return a.indexOf(o);for(var g=0;g<a.length;){if(u&&a[g][u]==o||!u&&a[g]===o)return g;g++}return-1}function Z(a){return Array.prototype.slice.call(a,0)}function J(a,o,u){for(var g=[],P=[],_=0;_<a.length;){var V=a[_][o];Y(P,V)<0&&g.push(a[_]),P[_]=V,_++}return g=g.sort(function(ve,ie){return ve[o]>ie[o]}),g}function j(a,o){for(var u,g,P=o[0].toUpperCase()+o.slice(1),_=0;_<t.length;){if(u=t[_],g=u?u+P:o,g in a)return g;_++}return n}var X=1;function L(){return X++}function k(a){var o=a.ownerDocument||a;return o.defaultView||o.parentWindow||v}var I=/mobile|tablet|ip(ad|hone|od)|android/i,B="ontouchstart"in v,K=j(v,"PointerEvent")!==n,ee=B&&I.test(navigator.userAgent),Q="touch",U="pen",ae="mouse",q="kinect",H=25,z=1,ue=2,$=4,te=8,_e=1,Se=2,ke=4,Fe=8,Ee=16,he=Se|ke,me=Fe|Ee,ze=he|me,Ge=["x","y"],Le=["clientX","clientY"];function ce(a,o){var u=this;this.manager=a,this.callback=o,this.element=a.element,this.target=a.options.inputTarget,this.domHandler=function(g){T(a.options.enable,[a])&&u.handler(g)},this.init()}ce.prototype={handler:function(){},init:function(){this.evEl&&C(this.element,this.evEl,this.domHandler),this.evTarget&&C(this.target,this.evTarget,this.domHandler),this.evWin&&C(k(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(k(this.element),this.evWin,this.domHandler)}};function Je(a){var o,u=a.options.inputClass;return u?o=u:K?o=wt:ee?o=nt:B?o=At:o=tt,new o(a,$e)}function $e(a,o,u){var g=u.pointers.length,P=u.changedPointers.length,_=o&z&&g-P===0,V=o&($|te)&&g-P===0;u.isFirst=!!_,u.isFinal=!!V,_&&(a.session={}),u.eventType=o,m(a,u),a.emit("hammer.input",u),a.recognize(u),a.session.prevInput=u}function m(a,o){var u=a.session,g=o.pointers,P=g.length;u.firstInput||(u.firstInput=oe(o)),P>1&&!u.firstMultiple?u.firstMultiple=oe(o):P===1&&(u.firstMultiple=!1);var _=u.firstInput,V=u.firstMultiple,se=V?V.center:_.center,ve=o.center=ye(g);o.timeStamp=c(),o.deltaTime=o.timeStamp-_.timeStamp,o.angle=bt(se,ve),o.distance=et(se,ve),R(u,o),o.offsetDirection=Te(o.deltaX,o.deltaY);var ie=Re(o.deltaTime,o.deltaX,o.deltaY);o.overallVelocityX=ie.x,o.overallVelocityY=ie.y,o.overallVelocity=h(ie.x)>h(ie.y)?ie.x:ie.y,o.scale=V?On(V.pointers,g):1,o.rotation=V?Cn(V.pointers,g):0,o.maxPointers=u.prevInput?o.pointers.length>u.prevInput.maxPointers?o.pointers.length:u.prevInput.maxPointers:o.pointers.length,ne(u,o);var we=a.element;F(o.srcEvent.target,we)&&(we=o.srcEvent.target),o.target=we}function R(a,o){var u=o.center,g=a.offsetDelta||{},P=a.prevDelta||{},_=a.prevInput||{};(o.eventType===z||_.eventType===$)&&(P=a.prevDelta={x:_.deltaX||0,y:_.deltaY||0},g=a.offsetDelta={x:u.x,y:u.y}),o.deltaX=P.x+(u.x-g.x),o.deltaY=P.y+(u.y-g.y)}function ne(a,o){var u=a.lastInterval||o,g=o.timeStamp-u.timeStamp,P,_,V,se;if(o.eventType!=te&&(g>H||u.velocity===n)){var ve=o.deltaX-u.deltaX,ie=o.deltaY-u.deltaY,we=Re(g,ve,ie);_=we.x,V=we.y,P=h(we.x)>h(we.y)?we.x:we.y,se=Te(ve,ie),a.lastInterval=o}else P=u.velocity,_=u.velocityX,V=u.velocityY,se=u.direction;o.velocity=P,o.velocityX=_,o.velocityY=V,o.direction=se}function oe(a){for(var o=[],u=0;u<a.pointers.length;)o[u]={clientX:i(a.pointers[u].clientX),clientY:i(a.pointers[u].clientY)},u++;return{timeStamp:c(),pointers:o,center:ye(o),deltaX:a.deltaX,deltaY:a.deltaY}}function ye(a){var o=a.length;if(o===1)return{x:i(a[0].clientX),y:i(a[0].clientY)};for(var u=0,g=0,P=0;P<o;)u+=a[P].clientX,g+=a[P].clientY,P++;return{x:i(u/o),y:i(g/o)}}function Re(a,o,u){return{x:o/a||0,y:u/a||0}}function Te(a,o){return a===o?_e:h(a)>=h(o)?a<0?Se:ke:o<0?Fe:Ee}function et(a,o,u){u||(u=Ge);var g=o[u[0]]-a[u[0]],P=o[u[1]]-a[u[1]];return Math.sqrt(g*g+P*P)}function bt(a,o,u){u||(u=Ge);var g=o[u[0]]-a[u[0]],P=o[u[1]]-a[u[1]];return Math.atan2(P,g)*180/Math.PI}function Cn(a,o){return bt(o[1],o[0],Le)+bt(a[1],a[0],Le)}function On(a,o){return et(o[0],o[1],Le)/et(a[0],a[1],Le)}var _n={mousedown:z,mousemove:ue,mouseup:$},kn="mousedown",Fn="mousemove mouseup";function tt(){this.evEl=kn,this.evWin=Fn,this.pressed=!1,ce.apply(this,arguments)}A(tt,ce,{handler:function(o){var u=_n[o.type];u&z&&(o.button===0||o.button===2)&&(this.pressed=!0),u&ue&&o.which!==1&&(u=$),this.pressed&&(u&$&&(this.pressed=!1),this.callback(this.manager,u,{pointers:[o],changedPointers:[o],pointerType:ae,srcEvent:o}))}});var Ut={pointerdown:z,pointermove:ue,pointerup:$,pointercancel:te,pointerout:te},Ln={2:Q,3:U,4:ae,5:q},Vt="pointerdown",jt="pointermove pointerup pointercancel";v.MSPointerEvent&&!v.PointerEvent&&(Vt="MSPointerDown",jt="MSPointerMove MSPointerUp MSPointerCancel");function wt(){this.evEl=Vt,this.evWin=jt,ce.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}A(wt,ce,{handler:function(o){var u=this.store,g=!1,P=!1,_=o.type.toLowerCase().replace("ms",""),V=Ut[_],se=Ln[o.pointerType]||o.pointerType,ve=se==Q,ie=Y(u,o.pointerId,"pointerId");V&z&&(o.button===0||o.button===2||ve)?ie<0&&(u.push(o),ie=u.length-1):V&($|te)?g=!0:!ve&&o.buttons===0&&(g=!0,P=!0,V=Ut.pointerup),!(ie<0)&&(P||(u[ie]=o),this.callback(this.manager,V,{pointers:u,changedPointers:[o],pointerType:se,srcEvent:u[ie]}),g&&u.splice(ie,1))}});var In={touchstart:z,touchmove:ue,touchend:$,touchcancel:te},Dn="touchstart",Nn="touchstart touchmove touchend touchcancel";function zt(){this.evTarget=Dn,this.evWin=Nn,this.started=!1,ce.apply(this,arguments)}A(zt,ce,{handler:function(o){var u=In[o.type];if(u===z&&(this.started=!0),!!this.started){var g=Bn.call(this,o,u);u&($|te)&&g[0].length-g[1].length===0&&(this.started=!1),this.callback(this.manager,u,{pointers:g[0],changedPointers:g[1],pointerType:Q,srcEvent:o})}}});function Bn(a,o){var u=Z(a.touches),g=Z(a.changedTouches);return o&($|te)&&(u=J(u.concat(g),"identifier")),[u,g]}var Un={touchstart:z,touchmove:ue,touchend:$,touchcancel:te},Vn="touchstart touchmove touchend touchcancel";function nt(){this.evTarget=Vn,this.targetIds={},ce.apply(this,arguments)}A(nt,ce,{handler:function(o){var u=Un[o.type],g=jn.call(this,o,u);g&&this.callback(this.manager,u,{pointers:g[0],changedPointers:g[1],pointerType:Q,srcEvent:o})}});function jn(a,o){var u=Z(a.touches),g=this.targetIds;if(o&(z|ue)&&u.length===1)return g[u[0].identifier]=!0,[u,u];var P,_,V=Z(a.changedTouches),se=[],ve=this.target;if(_=u.filter(function(ie){return F(ie.target,ve)}),o===z)for(P=0;P<_.length;)g[_[P].identifier]=!0,P++;for(P=0;P<V.length;)g[V[P].identifier]&&se.push(V[P]),o&($|te)&&delete g[V[P].identifier],P++;if(se.length)return[J(_.concat(se),"identifier"),se]}var zn=2500,Gt=25;function At(){ce.apply(this,arguments);var a=b(this.handler,this);this.touch=new nt(this.manager,a),this.mouse=new tt(this.manager,a),this.primaryTouch=null,this.lastTouches=[]}A(At,ce,{handler:function(o,u,g){var P=g.pointerType==Q,_=g.pointerType==ae;if(!(_&&g.sourceCapabilities&&g.sourceCapabilities.firesTouchEvents)){if(P)Gn.call(this,u,g);else if(_&&Rn.call(this,g))return;this.callback(o,u,g)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Gn(a,o){a&z?(this.primaryTouch=o.changedPointers[0].identifier,Rt.call(this,o)):a&($|te)&&Rt.call(this,o)}function Rt(a){var o=a.changedPointers[0];if(o.identifier===this.primaryTouch){var u={x:o.clientX,y:o.clientY};this.lastTouches.push(u);var g=this.lastTouches,P=function(){var _=g.indexOf(u);_>-1&&g.splice(_,1)};setTimeout(P,zn)}}function Rn(a){for(var o=a.srcEvent.clientX,u=a.srcEvent.clientY,g=0;g<this.lastTouches.length;g++){var P=this.lastTouches[g],_=Math.abs(o-P.x),V=Math.abs(u-P.y);if(_<=Gt&&V<=Gt)return!0}return!1}var Yt=r?j(r.style,"touchAction"):n,Wt=Yt!==n,Kt="compute",Xt="auto",Tt="manipulation",Ie="none",Ye="pan-x",We="pan-y",rt=Wn();function Pt(a,o){this.manager=a,this.set(o)}Pt.prototype={set:function(a){a==Kt&&(a=this.compute()),Wt&&this.manager.element.style&&rt[a]&&(this.manager.element.style[Yt]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return S(this.manager.recognizers,function(o){T(o.options.enable,[o])&&(a=a.concat(o.getTouchAction()))}),Yn(a.join(" "))},preventDefaults:function(a){var o=a.srcEvent,u=a.offsetDirection;if(this.manager.session.prevented){o.preventDefault();return}var g=this.actions,P=G(g,Ie)&&!rt[Ie],_=G(g,We)&&!rt[We],V=G(g,Ye)&&!rt[Ye];if(P){var se=a.pointers.length===1,ve=a.distance<2,ie=a.deltaTime<250;if(se&&ve&&ie)return}if(!(V&&_)&&(P||_&&u&he||V&&u&me))return this.preventSrc(o)},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};function Yn(a){if(G(a,Ie))return Ie;var o=G(a,Ye),u=G(a,We);return o&&u?Ie:o||u?o?Ye:We:G(a,Tt)?Tt:Xt}function Wn(){if(!Wt)return!1;var a={},o=v.CSS&&v.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(u){a[u]=o?v.CSS.supports("touch-action",u):!0}),a}var at=1,pe=2,Ne=4,xe=8,Pe=xe,Ke=16,be=32;function Me(a){this.options=M({},this.defaults,a||{}),this.id=L(),this.manager=null,this.options.enable=f(this.options.enable,!0),this.state=at,this.simultaneous={},this.requireFail=[]}Me.prototype={defaults:{},set:function(a){return M(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(y(a,"recognizeWith",this))return this;var o=this.simultaneous;return a=it(a,this),o[a.id]||(o[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return y(a,"dropRecognizeWith",this)?this:(a=it(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(y(a,"requireFailure",this))return this;var o=this.requireFail;return a=it(a,this),Y(o,a)===-1&&(o.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(y(a,"dropRequireFailure",this))return this;a=it(a,this);var o=Y(this.requireFail,a);return o>-1&&this.requireFail.splice(o,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){var o=this,u=this.state;function g(P){o.manager.emit(P,a)}u<xe&&g(o.options.event+Ht(u)),g(o.options.event),a.additionalEvent&&g(a.additionalEvent),u>=xe&&g(o.options.event+Ht(u))},tryEmit:function(a){if(this.canEmit())return this.emit(a);this.state=be},canEmit:function(){for(var a=0;a<this.requireFail.length;){if(!(this.requireFail[a].state&(be|at)))return!1;a++}return!0},recognize:function(a){var o=M({},a);if(!T(this.options.enable,[this,o])){this.reset(),this.state=be;return}this.state&(Pe|Ke|be)&&(this.state=at),this.state=this.process(o),this.state&(pe|Ne|xe|Ke)&&this.tryEmit(o)},process:function(a){},getTouchAction:function(){},reset:function(){}};function Ht(a){return a&Ke?"cancel":a&xe?"end":a&Ne?"move":a&pe?"start":""}function qt(a){return a==Ee?"down":a==Fe?"up":a==Se?"left":a==ke?"right":""}function it(a,o){var u=o.manager;return u?u.get(a):a}function ge(){Me.apply(this,arguments)}A(ge,Me,{defaults:{pointers:1},attrTest:function(a){var o=this.options.pointers;return o===0||a.pointers.length===o},process:function(a){var o=this.state,u=a.eventType,g=o&(pe|Ne),P=this.attrTest(a);return g&&(u&te||!P)?o|Ke:g||P?u&$?o|xe:o&pe?o|Ne:pe:be}});function ot(){ge.apply(this,arguments),this.pX=null,this.pY=null}A(ot,ge,{defaults:{event:"pan",threshold:10,pointers:1,direction:ze},getTouchAction:function(){var a=this.options.direction,o=[];return a&he&&o.push(We),a&me&&o.push(Ye),o},directionTest:function(a){var o=this.options,u=!0,g=a.distance,P=a.direction,_=a.deltaX,V=a.deltaY;return P&o.direction||(o.direction&he?(P=_===0?_e:_<0?Se:ke,u=_!=this.pX,g=Math.abs(a.deltaX)):(P=V===0?_e:V<0?Fe:Ee,u=V!=this.pY,g=Math.abs(a.deltaY))),a.direction=P,u&&g>o.threshold&&P&o.direction},attrTest:function(a){return ge.prototype.attrTest.call(this,a)&&(this.state&pe||!(this.state&pe)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var o=qt(a.direction);o&&(a.additionalEvent=this.options.event+o),this._super.emit.call(this,a)}});function Mt(){ge.apply(this,arguments)}A(Mt,ge,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Ie]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&pe)},emit:function(a){if(a.scale!==1){var o=a.scale<1?"in":"out";a.additionalEvent=this.options.event+o}this._super.emit.call(this,a)}});function St(){Me.apply(this,arguments),this._timer=null,this._input=null}A(St,Me,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Xt]},process:function(a){var o=this.options,u=a.pointers.length===o.pointers,g=a.distance<o.threshold,P=a.deltaTime>o.time;if(this._input=a,!g||!u||a.eventType&($|te)&&!P)this.reset();else if(a.eventType&z)this.reset(),this._timer=d(function(){this.state=Pe,this.tryEmit()},o.time,this);else if(a.eventType&$)return Pe;return be},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===Pe&&(a&&a.eventType&$?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=c(),this.manager.emit(this.options.event,this._input)))}});function Et(){ge.apply(this,arguments)}A(Et,ge,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Ie]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&pe)}});function xt(){ge.apply(this,arguments)}A(xt,ge,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:he|me,pointers:1},getTouchAction:function(){return ot.prototype.getTouchAction.call(this)},attrTest:function(a){var o=this.options.direction,u;return o&(he|me)?u=a.overallVelocity:o&he?u=a.overallVelocityX:o&me&&(u=a.overallVelocityY),this._super.attrTest.call(this,a)&&o&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&h(u)>this.options.velocity&&a.eventType&$},emit:function(a){var o=qt(a.offsetDirection);o&&this.manager.emit(this.options.event+o,a),this.manager.emit(this.options.event,a)}});function st(){Me.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}A(st,Me,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Tt]},process:function(a){var o=this.options,u=a.pointers.length===o.pointers,g=a.distance<o.threshold,P=a.deltaTime<o.time;if(this.reset(),a.eventType&z&&this.count===0)return this.failTimeout();if(g&&P&&u){if(a.eventType!=$)return this.failTimeout();var _=this.pTime?a.timeStamp-this.pTime<o.interval:!0,V=!this.pCenter||et(this.pCenter,a.center)<o.posThreshold;this.pTime=a.timeStamp,this.pCenter=a.center,!V||!_?this.count=1:this.count+=1,this._input=a;var se=this.count%o.taps;if(se===0)return this.hasRequireFailures()?(this._timer=d(function(){this.state=Pe,this.tryEmit()},o.interval,this),pe):Pe}return be},failTimeout:function(){return this._timer=d(function(){this.state=be},this.options.interval,this),be},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Pe&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Be(a,o){return o=o||{},o.recognizers=f(o.recognizers,Be.defaults.preset),new Ct(a,o)}Be.VERSION="2.0.7",Be.defaults={domEvents:!1,touchAction:Kt,enable:!0,inputTarget:null,inputClass:null,preset:[[Et,{enable:!1}],[Mt,{enable:!1},["rotate"]],[xt,{direction:he}],[ot,{direction:he},["swipe"]],[st],[st,{event:"doubletap",taps:2},["tap"]],[St]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Kn=1,Zt=2;function Ct(a,o){this.options=M({},Be.defaults,o||{}),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=a,this.input=Je(this),this.touchAction=new Pt(this,this.options.touchAction),Qt(this,!0),S(this.options.recognizers,function(u){var g=this.add(new u[0](u[1]));u[2]&&g.recognizeWith(u[2]),u[3]&&g.requireFailure(u[3])},this)}Ct.prototype={set:function(a){return M(this.options,a),a.touchAction&&this.touchAction.update(),a.inputTarget&&(this.input.destroy(),this.input.target=a.inputTarget,this.input.init()),this},stop:function(a){this.session.stopped=a?Zt:Kn},recognize:function(a){var o=this.session;if(!o.stopped){this.touchAction.preventDefaults(a);var u,g=this.recognizers,P=o.curRecognizer;(!P||P&&P.state&Pe)&&(P=o.curRecognizer=null);for(var _=0;_<g.length;)u=g[_],o.stopped!==Zt&&(!P||u==P||u.canRecognizeWith(P))?u.recognize(a):u.reset(),!P&&u.state&(pe|Ne|xe)&&(P=o.curRecognizer=u),_++}},get:function(a){if(a instanceof Me)return a;for(var o=this.recognizers,u=0;u<o.length;u++)if(o[u].options.event==a)return o[u];return null},add:function(a){if(y(a,"add",this))return this;var o=this.get(a.options.event);return o&&this.remove(o),this.recognizers.push(a),a.manager=this,this.touchAction.update(),a},remove:function(a){if(y(a,"remove",this))return this;if(a=this.get(a),a){var o=this.recognizers,u=Y(o,a);u!==-1&&(o.splice(u,1),this.touchAction.update())}return this},on:function(a,o){if(a!==n&&o!==n){var u=this.handlers;return S(W(a),function(g){u[g]=u[g]||[],u[g].push(o)}),this}},off:function(a,o){if(a!==n){var u=this.handlers;return S(W(a),function(g){o?u[g]&&u[g].splice(Y(u[g],o),1):delete u[g]}),this}},emit:function(a,o){this.options.domEvents&&Xn(a,o);var u=this.handlers[a]&&this.handlers[a].slice();if(!(!u||!u.length)){o.type=a,o.preventDefault=function(){o.srcEvent.preventDefault()};for(var g=0;g<u.length;)u[g](o),g++}},destroy:function(){this.element&&Qt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Qt(a,o){var u=a.element;if(u.style){var g;S(a.options.cssProps,function(P,_){g=j(u.style,_),o?(a.oldCssProps[g]=u.style[g],u.style[g]=P):u.style[g]=a.oldCssProps[g]||""}),o||(a.oldCssProps={})}}function Xn(a,o){var u=s.createEvent("Event");u.initEvent(a,!0,!0),u.gesture=o,o.target.dispatchEvent(u)}return M(Be,{INPUT_START:z,INPUT_MOVE:ue,INPUT_END:$,INPUT_CANCEL:te,STATE_POSSIBLE:at,STATE_BEGAN:pe,STATE_CHANGED:Ne,STATE_ENDED:xe,STATE_RECOGNIZED:Pe,STATE_CANCELLED:Ke,STATE_FAILED:be,DIRECTION_NONE:_e,DIRECTION_LEFT:Se,DIRECTION_RIGHT:ke,DIRECTION_UP:Fe,DIRECTION_DOWN:Ee,DIRECTION_HORIZONTAL:he,DIRECTION_VERTICAL:me,DIRECTION_ALL:ze,Manager:Ct,Input:ce,TouchAction:Pt,TouchInput:nt,MouseInput:tt,PointerEventInput:wt,TouchMouseInput:At,SingleTouchInput:zt,Recognizer:Me,AttrRecognizer:ge,Tap:st,Pan:ot,Swipe:xt,Pinch:Mt,Rotate:Et,Press:St,on:C,off:x,each:S,merge:O,extend:E,assign:M,inherit:A,bindFn:b,prefixed:j}),Be})(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{}),De=function(v,s){s===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),s===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=v,this.domElement=s,this.enabled=!0,this.target=new D.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:D.MOUSE.ROTATE,MIDDLE:D.MOUSE.DOLLY,RIGHT:D.MOUSE.PAN},this.touches={ONE:D.TOUCH.ROTATE,TWO:D.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return c.phi},this.getAzimuthalAngle=function(){return c.theta},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(n),e.update(),i=l.NONE},this.update=(function(){var m=new D.Vector3,R=new D.Quaternion().setFromUnitVectors(v.up,new D.Vector3(0,1,0)),ne=R.clone().inverse(),oe=new D.Vector3,ye=new D.Quaternion;return function(){var Te=e.object.position;return m.copy(Te).sub(e.target),m.applyQuaternion(R),c.setFromVector3(m),e.autoRotate&&i===l.NONE&&W(F()),e.enableDamping?(c.theta+=d.theta*e.dampingFactor,c.phi+=d.phi*e.dampingFactor):(c.theta+=d.theta,c.phi+=d.phi),c.theta=Math.max(e.minAzimuthAngle,Math.min(e.maxAzimuthAngle,c.theta)),c.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,c.phi)),c.makeSafe(),c.radius*=y,c.radius=Math.max(e.minDistance,Math.min(e.maxDistance,c.radius)),e.enableDamping===!0?e.target.addScaledVector(S,e.dampingFactor):e.target.add(S),m.setFromSpherical(c),m.applyQuaternion(ne),Te.copy(e.target).add(m),e.object.lookAt(e.target),e.enableDamping===!0?(d.theta*=1-e.dampingFactor,d.phi*=1-e.dampingFactor,S.multiplyScalar(1-e.dampingFactor)):(d.set(0,0,0),S.set(0,0,0)),y=1,w||oe.distanceToSquared(e.object.position)>h||8*(1-ye.dot(e.object.quaternion))>h?(e.dispatchEvent(n),oe.copy(e.object.position),ye.copy(e.object.quaternion),w=!1,!0):!1}})(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",$e,!1),e.domElement.removeEventListener("mousedown",Ee,!1),e.domElement.removeEventListener("wheel",ze,!1),e.domElement.removeEventListener("touchstart",Le,!1),e.domElement.removeEventListener("touchend",Je,!1),e.domElement.removeEventListener("touchmove",ce,!1),document.removeEventListener("mousemove",he,!1),document.removeEventListener("mouseup",me,!1),e.domElement.removeEventListener("keydown",Ge,!1)};var e=this,n={type:"change"},t={type:"start"},r={type:"end"},l={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},i=l.NONE,h=1e-6,c=new D.Spherical,d=new D.Spherical,y=1,S=new D.Vector3,w=!1,M=new D.Vector2,E=new D.Vector2,O=new D.Vector2,A=new D.Vector2,b=new D.Vector2,T=new D.Vector2,f=new D.Vector2,C=new D.Vector2,x=new D.Vector2;function F(){return 2*Math.PI/60/60*e.autoRotateSpeed}function G(){return Math.pow(.95,e.zoomSpeed)}function W(m){d.theta-=m}function Y(m){d.phi-=m}var Z=(function(){var m=new D.Vector3;return function(ne,oe){m.setFromMatrixColumn(oe,0),m.multiplyScalar(-ne),S.add(m)}})(),J=(function(){var m=new D.Vector3;return function(ne,oe){e.screenSpacePanning===!0?m.setFromMatrixColumn(oe,1):(m.setFromMatrixColumn(oe,0),m.crossVectors(e.object.up,m)),m.multiplyScalar(ne),S.add(m)}})(),j=(function(){var m=new D.Vector3;return function(ne,oe){var ye=e.domElement;if(e.object.isPerspectiveCamera){var Re=e.object.position;m.copy(Re).sub(e.target);var Te=m.length();Te*=Math.tan(e.object.fov/2*Math.PI/180),Z(2*ne*Te/ye.clientHeight,e.object.matrix),J(2*oe*Te/ye.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(Z(ne*(e.object.right-e.object.left)/e.object.zoom/ye.clientWidth,e.object.matrix),J(oe*(e.object.top-e.object.bottom)/e.object.zoom/ye.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}})();function X(m){e.object.isPerspectiveCamera?y/=m:e.object.isOrthographicCamera?(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom*m)),e.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function L(m){e.object.isPerspectiveCamera?y*=m:e.object.isOrthographicCamera?(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/m)),e.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function k(m){M.set(m.clientX,m.clientY)}function I(m){f.set(m.clientX,m.clientY)}function B(m){A.set(m.clientX,m.clientY)}function K(m){E.set(m.clientX,m.clientY),O.subVectors(E,M).multiplyScalar(e.rotateSpeed);var R=e.domElement;W(2*Math.PI*O.x/R.clientHeight),Y(2*Math.PI*O.y/R.clientHeight),M.copy(E),e.update()}function ee(m){C.set(m.clientX,m.clientY),x.subVectors(C,f),x.y>0?X(G()):x.y<0&&L(G()),f.copy(C),e.update()}function Q(m){b.set(m.clientX,m.clientY),T.subVectors(b,A).multiplyScalar(e.panSpeed),j(T.x,T.y),A.copy(b),e.update()}function U(m){m.deltaY<0?L(G()):m.deltaY>0&&X(G()),e.update()}function ae(m){var R=!1;switch(m.keyCode){case e.keys.UP:j(0,e.keyPanSpeed),R=!0;break;case e.keys.BOTTOM:j(0,-e.keyPanSpeed),R=!0;break;case e.keys.LEFT:j(e.keyPanSpeed,0),R=!0;break;case e.keys.RIGHT:j(-e.keyPanSpeed,0),R=!0;break}R&&(m.preventDefault(),e.update())}function q(m){if(m.touches.length==1)M.set(m.touches[0].pageX,m.touches[0].pageY);else{var R=.5*(m.touches[0].pageX+m.touches[1].pageX),ne=.5*(m.touches[0].pageY+m.touches[1].pageY);M.set(R,ne)}}function H(m){if(m.touches.length==1)A.set(m.touches[0].pageX,m.touches[0].pageY);else{var R=.5*(m.touches[0].pageX+m.touches[1].pageX),ne=.5*(m.touches[0].pageY+m.touches[1].pageY);A.set(R,ne)}}function z(m){var R=m.touches[0].pageX-m.touches[1].pageX,ne=m.touches[0].pageY-m.touches[1].pageY,oe=Math.sqrt(R*R+ne*ne);f.set(0,oe)}function ue(m){e.enableZoom&&z(m),e.enablePan&&H(m)}function $(m){e.enableZoom&&z(m),e.enableRotate&&q(m)}function te(m){if(m.touches.length==1)E.set(m.touches[0].pageX,m.touches[0].pageY);else{var R=.5*(m.touches[0].pageX+m.touches[1].pageX),ne=.5*(m.touches[0].pageY+m.touches[1].pageY);E.set(R,ne)}O.subVectors(E,M).multiplyScalar(e.rotateSpeed);var oe=e.domElement;W(2*Math.PI*O.x/oe.clientHeight),Y(2*Math.PI*O.y/oe.clientHeight),M.copy(E)}function _e(m){if(m.touches.length==1)b.set(m.touches[0].pageX,m.touches[0].pageY);else{var R=.5*(m.touches[0].pageX+m.touches[1].pageX),ne=.5*(m.touches[0].pageY+m.touches[1].pageY);b.set(R,ne)}T.subVectors(b,A).multiplyScalar(e.panSpeed),j(T.x,T.y),A.copy(b)}function Se(m){var R=m.touches[0].pageX-m.touches[1].pageX,ne=m.touches[0].pageY-m.touches[1].pageY,oe=Math.sqrt(R*R+ne*ne);C.set(0,oe),x.set(0,Math.pow(C.y/f.y,e.zoomSpeed)),X(x.y),f.copy(C)}function ke(m){e.enableZoom&&Se(m),e.enablePan&&_e(m)}function Fe(m){e.enableZoom&&Se(m),e.enableRotate&&te(m)}function Ee(m){if(e.enabled!==!1){m.preventDefault(),e.domElement.focus?e.domElement.focus():window.focus();var R;switch(m.button){case 0:R=e.mouseButtons.LEFT;break;case 1:R=e.mouseButtons.MIDDLE;break;case 2:R=e.mouseButtons.RIGHT;break;default:R=-1}switch(R){case D.MOUSE.DOLLY:if(e.enableZoom===!1)return;I(m),i=l.DOLLY;break;case D.MOUSE.ROTATE:if(m.ctrlKey||m.metaKey||m.shiftKey){if(e.enablePan===!1)return;B(m),i=l.PAN}else{if(e.enableRotate===!1)return;k(m),i=l.ROTATE}break;case D.MOUSE.PAN:if(m.ctrlKey||m.metaKey||m.shiftKey){if(e.enableRotate===!1)return;k(m),i=l.ROTATE}else{if(e.enablePan===!1)return;B(m),i=l.PAN}break;default:i=l.NONE}i!==l.NONE&&(document.addEventListener("mousemove",he,!1),document.addEventListener("mouseup",me,!1),e.dispatchEvent(t))}}function he(m){if(e.enabled!==!1)switch(m.preventDefault(),i){case l.ROTATE:if(e.enableRotate===!1)return;K(m);break;case l.DOLLY:if(e.enableZoom===!1)return;ee(m);break;case l.PAN:if(e.enablePan===!1)return;Q(m);break}}function me(m){e.enabled!==!1&&(document.removeEventListener("mousemove",he,!1),document.removeEventListener("mouseup",me,!1),e.dispatchEvent(r),i=l.NONE)}function ze(m){e.enabled===!1||e.enableZoom===!1||i!==l.NONE&&i!==l.ROTATE||(m.preventDefault(),m.stopPropagation(),e.dispatchEvent(t),U(m),e.dispatchEvent(r))}function Ge(m){e.enabled===!1||e.enableKeys===!1||e.enablePan===!1||ae(m)}function Le(m){if(e.enabled!==!1){switch(m.preventDefault(),m.touches.length){case 1:switch(e.touches.ONE){case D.TOUCH.ROTATE:if(e.enableRotate===!1)return;q(m),i=l.TOUCH_ROTATE;break;case D.TOUCH.PAN:if(e.enablePan===!1)return;H(m),i=l.TOUCH_PAN;break;default:i=l.NONE}break;case 2:switch(e.touches.TWO){case D.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;ue(m),i=l.TOUCH_DOLLY_PAN;break;case D.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;$(m),i=l.TOUCH_DOLLY_ROTATE;break;default:i=l.NONE}break;default:i=l.NONE}i!==l.NONE&&e.dispatchEvent(t)}}function ce(m){if(e.enabled!==!1)switch(m.preventDefault(),m.stopPropagation(),i){case l.TOUCH_ROTATE:if(e.enableRotate===!1)return;te(m),e.update();break;case l.TOUCH_PAN:if(e.enablePan===!1)return;_e(m),e.update();break;case l.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;ke(m),e.update();break;case l.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Fe(m),e.update();break;default:i=l.NONE}}function Je(m){e.enabled!==!1&&(e.dispatchEvent(r),i=l.NONE)}function $e(m){e.enabled!==!1&&m.preventDefault()}e.domElement.addEventListener("contextmenu",$e,!1),e.domElement.addEventListener("mousedown",Ee,!1),e.domElement.addEventListener("wheel",ze,!1),e.domElement.addEventListener("touchstart",Le,!1),e.domElement.addEventListener("touchend",Je,!1),e.domElement.addEventListener("touchmove",ce,!1),e.domElement.addEventListener("keydown",Ge,!1),e.domElement.tabIndex===-1&&(e.domElement.tabIndex=0),this.update()};De.prototype=Object.create(D.EventDispatcher.prototype),De.prototype.constructor=De;var ht=function(v,s){De.call(this,v,s),this.mouseButtons.LEFT=D.MOUSE.PAN,this.mouseButtons.RIGHT=D.MOUSE.ROTATE,this.touches.ONE=D.TOUCH.PAN,this.touches.TWO=D.TOUCH.DOLLY_ROTATE};ht.prototype=Object.create(D.EventDispatcher.prototype),ht.prototype.constructor=ht;var Ae=function(v){D.Object3D.call(this),this.element=v,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.addEventListener("removed",function(){this.traverse(function(s){s.element instanceof Element&&s.element.parentNode!==null&&s.element.parentNode.removeChild(s.element)})})};Ae.prototype=Object.create(D.Object3D.prototype),Ae.prototype.constructor=Ae;var qe=function(v){Ae.call(this,v)};qe.prototype=Object.create(Ae.prototype),qe.prototype.constructor=qe;var kt=function(){var v=this,s,e,n,t,r=new D.Matrix4,l={camera:{fov:0,style:""},objects:new WeakMap},i=document.createElement("div");i.style.overflow="hidden",this.domElement=i;var h=document.createElement("div");h.style.WebkitTransformStyle="preserve-3d",h.style.transformStyle="preserve-3d",h.style.pointerEvents="none",i.appendChild(h);var c=/Trident/i.test(navigator.userAgent);this.getSize=function(){return{width:s,height:e}},this.setSize=function(A,b){s=A,e=b,n=s/2,t=e/2,i.style.width=A+"px",i.style.height=b+"px",h.style.width=A+"px",h.style.height=b+"px"};function d(A){return Math.abs(A)<1e-10?0:A}function y(A){var b=A.elements;return"matrix3d("+d(b[0])+","+d(-b[1])+","+d(b[2])+","+d(b[3])+","+d(b[4])+","+d(-b[5])+","+d(b[6])+","+d(b[7])+","+d(b[8])+","+d(-b[9])+","+d(b[10])+","+d(b[11])+","+d(b[12])+","+d(-b[13])+","+d(b[14])+","+d(b[15])+")"}function S(A,b){var T=A.elements,f="matrix3d("+d(T[0])+","+d(T[1])+","+d(T[2])+","+d(T[3])+","+d(-T[4])+","+d(-T[5])+","+d(-T[6])+","+d(-T[7])+","+d(T[8])+","+d(T[9])+","+d(T[10])+","+d(T[11])+","+d(T[12])+","+d(T[13])+","+d(T[14])+","+d(T[15])+")";return c?"translate(-50%,-50%)translate("+n+"px,"+t+"px)"+b+f:"translate(-50%,-50%)"+f}function w(A,b,T,f){if(A instanceof Ae){A.onBeforeRender(v,b,T);var C;A instanceof qe?(r.copy(T.matrixWorldInverse),r.transpose(),r.copyPosition(A.matrixWorld),r.scale(A.scale),r.elements[3]=0,r.elements[7]=0,r.elements[11]=0,r.elements[15]=1,C=S(r,f)):C=S(A.matrixWorld,f);var x=A.element,F=l.objects.get(A);if(F===void 0||F.style!==C){x.style.WebkitTransform=C,x.style.transform=C;var G={style:C};c&&(G.distanceToCameraSquared=M(T,A)),l.objects.set(A,G)}x.style.display=A.visible?"":"none",x.parentNode!==h&&h.appendChild(x),A.onAfterRender(v,b,T)}for(var W=0,Y=A.children.length;W<Y;W++)w(A.children[W],b,T,f)}var M=(function(){var A=new D.Vector3,b=new D.Vector3;return function(T,f){return A.setFromMatrixPosition(T.matrixWorld),b.setFromMatrixPosition(f.matrixWorld),A.distanceToSquared(b)}})();function E(A){var b=[];return A.traverse(function(T){T instanceof Ae&&b.push(T)}),b}function O(A){for(var b=E(A).sort(function(x,F){var G=l.objects.get(x).distanceToCameraSquared,W=l.objects.get(F).distanceToCameraSquared;return G-W}),T=b.length,f=0,C=b.length;f<C;f++)b[f].element.style.zIndex=T-f}this.render=function(A,b){var T=b.projectionMatrix.elements[5]*t;if(l.camera.fov!==T&&(b.isPerspectiveCamera?(i.style.WebkitPerspective=T+"px",i.style.perspective=T+"px"):(i.style.WebkitPerspective="",i.style.perspective=""),l.camera.fov=T),A.autoUpdate===!0&&A.updateMatrixWorld(),b.parent===null&&b.updateMatrixWorld(),b.isOrthographicCamera)var f=-(b.right+b.left)/2,C=(b.top+b.bottom)/2;var x=b.isOrthographicCamera?"scale("+T+")translate("+d(f)+"px,"+d(C)+"px)"+y(b.matrixWorldInverse):"translateZ("+T+"px)"+y(b.matrixWorldInverse),F=x+"translate("+n+"px,"+t+"px)";l.camera.style!==F&&!c&&(h.style.WebkitTransform=F,h.style.transform=F,l.camera.style=F),w(A,A,b,x),c&&O(A)}};function Ft(v,s,e){var n=s.getBoundingClientRect(),t=n.top,r=n.left,l=n.width,i=n.height;return new p.Vector2((v.x-r)/l*2-1,-(v.y-t)/i*2+1)}var Lt=(function(v){de(s,v);function s(e,n,t,r,l){var i=v.call(this)||this;i.type="RoundedBoxGeometry",l=isNaN(l)?1:Math.max(1,Math.floor(l)),e=isNaN(e)?1:e,n=isNaN(n)?1:n,t=isNaN(t)?1:t,r=isNaN(r)?.15:r,r=Math.min(r,Math.min(e,Math.min(n,Math.min(t)))/2);var h=e/2-r,c=n/2-r,d=t/2-r;i.parameters={width:e,height:n,depth:t,radius:r,radiusSegments:l};var y=l+1,S=y*l+1<<3,w=new p.BufferAttribute(new Float32Array(S*3),3),M=new p.BufferAttribute(new Float32Array(S*3),3),E=[],O=[];new p.Vector3;var A=new p.Vector3,b=[],T=[],f=[],C=y*l,x=y*l+1;F(),W(),G(),Y(),J(),Z();function F(){for(var L=[new p.Vector3(1,1,1),new p.Vector3(1,1,-1),new p.Vector3(-1,1,-1),new p.Vector3(-1,1,1),new p.Vector3(1,-1,1),new p.Vector3(1,-1,-1),new p.Vector3(-1,-1,-1),new p.Vector3(-1,-1,1)],k=0;k<8;k++)E.push([]),O.push([]);for(var I=Math.PI/2,B=new p.Vector3(h,c,d),K=0;K<=l;K++){var ee=K/l,Q=ee*I,U=Math.cos(Q),ae=Math.sin(Q);if(K==l){A.set(0,1,0);var q=A.clone().multiplyScalar(r).add(B);E[0].push(q),b.push(q);var H=A.clone();O[0].push(H),T.push(H);continue}for(var z=0;z<=l;z++){var ue=z/l,$=ue*I;A.x=U*Math.cos($),A.y=ae,A.z=U*Math.sin($);var q=A.clone().multiplyScalar(r).add(B);E[0].push(q),b.push(q);var H=A.clone().normalize();O[0].push(H),T.push(H)}}for(var te=1;te<8;te++)for(var k=0;k<E[0].length;k++){var q=E[0][k].clone().multiply(L[te]);E[te].push(q),b.push(q);var H=O[0][k].clone().multiply(L[te]);O[te].push(H),T.push(H)}}function G(){for(var L=[!0,!1,!0,!1,!1,!0,!1,!0],k=y*(l-1),I=0;I<8;I++){for(var B=x*I,K=0;K<l-1;K++)for(var ee=K*y,Q=(K+1)*y,U=0;U<l;U++){var ae=U+1,q=B+ee+U,H=B+ee+ae,z=B+Q+U,ue=B+Q+ae;L[I]?(f.push(q),f.push(z),f.push(H),f.push(H),f.push(z),f.push(ue)):(f.push(q),f.push(H),f.push(z),f.push(H),f.push(ue),f.push(z))}for(var U=0;U<l;U++){var q=B+k+U,H=B+k+U+1,z=B+C;L[I]?(f.push(q),f.push(z),f.push(H)):(f.push(q),f.push(H),f.push(z))}}}function W(){var L=C,k=C+x,I=C+x*2,B=C+x*3;f.push(L),f.push(k),f.push(I),f.push(L),f.push(I),f.push(B),L=C+x*4,k=C+x*5,I=C+x*6,B=C+x*7,f.push(L),f.push(I),f.push(k),f.push(L),f.push(B),f.push(I),L=0,k=x,I=x*4,B=x*5,f.push(L),f.push(I),f.push(k),f.push(k),f.push(I),f.push(B),L=x*2,k=x*3,I=x*6,B=x*7,f.push(L),f.push(I),f.push(k),f.push(k),f.push(I),f.push(B),L=l,k=l+x*3,I=l+x*4,B=l+x*7,f.push(L),f.push(k),f.push(I),f.push(k),f.push(B),f.push(I),L=l+x,k=l+x*2,I=l+x*5,B=l+x*6,f.push(L),f.push(I),f.push(k),f.push(k),f.push(I),f.push(B)}function Y(){for(var L=0;L<4;L++)for(var k=L*x,I=4*x+k,B=(L&1)===1,K=0;K<l;K++){var ee=K+1,Q=k+K,U=k+ee,ae=I+K,q=I+ee;B?(f.push(Q),f.push(ae),f.push(U),f.push(U),f.push(ae),f.push(q)):(f.push(Q),f.push(U),f.push(ae),f.push(U),f.push(q),f.push(ae))}}function Z(){for(var L=[0,2,4,6],k=[1,3,5,7],I=0;I<4;I++)for(var B=x*L[I],K=x*k[I],ee=1>=I,Q=0;Q<l;Q++){var U=Q*y,ae=(Q+1)*y,q=B+U,H=B+ae,z=K+U,ue=K+ae;ee?(f.push(q),f.push(z),f.push(H),f.push(H),f.push(z),f.push(ue)):(f.push(q),f.push(H),f.push(z),f.push(H),f.push(ue),f.push(z))}}function J(){for(var L=l-1,k=[0,1,4,5],I=[3,2,7,6],B=[0,1,1,0],K=0;K<4;K++)for(var ee=k[K]*x,Q=I[K]*x,U=0;U<=L;U++){var ae=ee+l+U*y,q=ee+(U!=L?l+(U+1)*y:x-1),H=Q+l+U*y,z=Q+(U!=L?l+(U+1)*y:x-1);B[K]?(f.push(ae),f.push(H),f.push(q),f.push(q),f.push(H),f.push(z)):(f.push(ae),f.push(q),f.push(H),f.push(q),f.push(z),f.push(H))}}for(var j=0,X=0;X<b.length;X++)w.setXYZ(j,b[X].x,b[X].y,b[X].z),M.setXYZ(j,T[X].x,T[X].y,T[X].z),j++;return i.setIndex(new p.BufferAttribute(new Uint16Array(f),1)),i.setAttribute("position",w),i.setAttribute("normal",M),i}return s})(p.BufferGeometry);function Ue(v,s){return typeof v!="number"||typeof s!="number"?!1:Math.abs(v-s)<.001}function Ve(v,s,e,n){n===void 0&&(n=function(r){return r});var t=n(e);return v*(1-t)+s*t}var le=Number((Math.PI/2).toFixed(5));function dn(v,s,e){var n=new p.Shape;return n.moveTo(e,0),n.lineTo(v-e,0),n.absarc(v-e,e,e,-le,0,!1),n.lineTo(v,s-e),n.absarc(v-e,s-e,e,0,le,!1),n.lineTo(e,s),n.absarc(e,s-e,e,le,Math.PI,!1),n.lineTo(0,e),n.absarc(e,e,e,Math.PI,Math.PI*1.5,!1),n}var je=function(v){var s=document.createElement("div");s.innerText=v;var e=new Ae(s);return e.name=v,e.scale.set(.3,.3,.3),s.style.pointerEvents="none",s.style.backfaceVisibility="hidden",e},Ze=function(v){var s=new p.PlaneGeometry(5,5),e=new p.MeshBasicMaterial({transparent:!0,opacity:0}),n=new p.Mesh(s,e),t=document.createElement("div");t.innerText=v;var r=new Ae(t);return r.name=v,r.scale.set(.3,.3,.3),t.style.color="#ffffff",t.style.opacity="0.5",t.style.pointerEvents="none",t.style.backfaceVisibility="hidden",n.rotateX(-le),n.add(r),n},pn=(function(v){de(s,v);function s(e,n){var t=v.call(this,e)||this;t.camera=new fe.Camera(90),t.scene=new p.Scene,t.renderer=new p.WebGLRenderer({antialias:!0,alpha:!0}),t.css3drenderer=new kt,t.ambientLight=new p.AmbientLight(16777215,.7),t.wrapper=document.createElement("div"),t.arrows=document.createElement("div"),t.arrowLeft=document.createElement("div"),t.arrowRight=document.createElement("div"),t.arrowFront=document.createElement("div"),t.arrowBack=document.createElement("div"),t.arrowTop=document.createElement("div"),t.arrowBottom=document.createElement("div"),t.spherical=null,t.dragging=!1,t.style=document.createElement("style"),t.directionalLight=new p.DirectionalLight(16777215,.2),t.box=new p.Mesh(new Lt(8,8,8,.5,20),new p.MeshPhongMaterial({color:16777215})),t.faces=new p.Group,t.orient=function(i){var h=i.longitude,c=i.latitude;t.dragging=!1,t.spherical=null,t.controls.enableDamping=!1,t.five.setState(Object.assign({latitude:c},h!==void 0?{longitude:h+t.config.fixedLongitude}:{})),t.five.ready().then(function(){t.controls.enableDamping=!0,t.setState({arrowsVisible:!0})})},t.onRenderFrame=function(){var i,h,c,d,y;if(t.renderer.render(t.scene,t.camera),t.css3drenderer.render(t.scene,t.camera),t.directionalLight.position.copy(t.camera.position),(i=t.controls)===null||i===void 0||i.update(),t.dragging){t.camera.computePose(),t.updateByCamera();var S=t.camera.pose,w=S.longitude,M=S.latitude;t.five.setState({longitude:w,latitude:M},!0),t.updateArrows({longitude:w,latitude:M})}else if(t.spherical&&(!Ue(t.spherical.pi,(h=t.controls)===null||h===void 0?void 0:h.getPolarAngle())||!Ue(t.spherical.theta,(c=t.controls)===null||c===void 0?void 0:c.getAzimuthalAngle()))){t.spherical={pi:(d=t.controls)===null||d===void 0?void 0:d.getPolarAngle(),theta:(y=t.controls)===null||y===void 0?void 0:y.getAzimuthalAngle()},t.camera.computePose(),t.updateByCamera();var E=t.camera.pose,w=E.longitude,M=E.latitude;t.five.setState({longitude:w,latitude:M},!0),t.updateArrows({longitude:w,latitude:M})}else t.spherical=null},t.onTapGesture=function(i){var h=i.pointers[0].clientX,c=i.pointers[0].clientY,d=Ft({x:h,y:c},t.wrapper),y=new p.Raycaster;y.setFromCamera(d,t.camera);var S=y.intersectObjects(t.faces.children,!1)[0];if(S){var w=S.object.userData,M=w.longitude,E=w.latitude;t.orient({longitude:M,latitude:E})}},t.onFiveWantsGesture=function(){if(t.spherical)return!1},t.onFiveModeChange=function(i){t.controls&&(t.controls.maxPolarAngle=i==="Topview"?0:le)},t.onCameraUpdate=function(i){var h=i.state;if(!t.dragging&&!t.spherical){var c=h.longitude,d=h.latitude;t.camera.pose.longitude===c&&t.camera.pose.latitude===d||(t.camera.setFromPose({longitude:c,latitude:d,distance:20,offset:new p.Vector3(0,0,0)}),t.updateByCamera(),t.updateArrows({longitude:c,latitude:d}))}},t.onPanStart=function(i){t.dragging=!0,t.spherical={}},t.onMouseMove=function(i){if(!t.dragging){var h=Ft({x:i.clientX,y:i.clientY},t.wrapper),c=new p.Raycaster;c.setFromCamera(h,t.camera);var d=c.intersectObjects(t.faces.children,!1)[0];t.faces.children.forEach(function(y){y.material.opacity=0,y.children[0].element.style.color=""}),d&&(d.object.material.opacity=.3,d.object.children[0].element.style.color="#336dff")}},t.onPanEnd=function(i){t.dragging=!1,t.spherical={pi:t.controls.getPolarAngle(),theta:t.controls.getAzimuthalAngle()}},t.dispose=function(){t.disable()},t.five=e;var r={enabled:!1,visible:!0,arrowsVisible:!1};t.state=Object.assign(r,n==null?void 0:n.initialState);var l=N({fixedLongitude:0,orthoView:!0},n==null?void 0:n.config);return t._config=l,t.state.enabled&&t._enable({userAction:!1}),t.mc=new ft.Manager(t.wrapper),t.mc.add(new ft.Tap({interval:410})),t.mc.add(new ft.Pan({threshold:10,pointers:0})),t.camera.setFromPose({distance:20,offset:new p.Vector3(0,0,0),longitude:e.camera.pose.latitude,latitude:e.camera.pose.latitude}),t.cylinder=new p.Mesh(new p.CylinderGeometry(13.2,14,.01,50,1,!0),new p.ShaderMaterial({uniforms:{radiusTop:{value:13.2},radiusBottom:{value:14},opacity:{value:1}},vertexShader:`
|
|
357
357
|
varying vec3 pos;
|
|
358
358
|
varying mat4 vViewMatrix;
|
|
359
359
|
void main() {
|
|
@@ -383,7 +383,7 @@ void main() {
|
|
|
383
383
|
vec4 color = mix(color1, color2, z);
|
|
384
384
|
gl_FragColor = color;
|
|
385
385
|
}
|
|
386
|
-
`,transparent:!0})),t.init(),t}return Object.defineProperty(
|
|
386
|
+
`,transparent:!0})),t.init(),t}return Object.defineProperty(s.prototype,"config",{get:function(){return N({},this._config)},enumerable:!1,configurable:!0}),s.prototype.updateState=function(e,n){var t=this.state;this.state=N(N({},this.state),e),typeof e.arrowsVisible=="boolean"&&this.handleArrowsVisible(e.arrowsVisible),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},s.prototype.appendTo=function(e){if(e){e.appendChild(this.wrapper);var n=this.wrapper.getBoundingClientRect(),t=n.width,r=n.height;this.renderer.setSize(t,r),this.css3drenderer.setSize(t,r)}},s.prototype.init=function(){this.renderer.setClearAlpha(0),this.renderer.domElement.style.outline="none",this.initDom(),this.initFaces(),this.initControls(),this.initLights();var e=this.cylinder;e.position.y=-3;var n=Ze("西");n.position.set(-19,0,0),e.add(n);var t=Ze("东");t.position.set(19,0,0),e.add(t);var r=Ze("北");r.position.set(0,0,-19),e.add(r);var l=Ze("南");l.position.set(0,0,19),e.add(l),this.updateByCamera(),this.scene.add(e,this.box,this.faces),this.scene.rotation.y=this.config.fixedLongitude},s.prototype.initDom=function(){this.style.innerHTML=`
|
|
387
387
|
.OrientationPlugin .OrientationArrows {
|
|
388
388
|
position: absolute;
|
|
389
389
|
top: 0;
|
|
@@ -483,7 +483,7 @@ void main() {
|
|
|
483
483
|
border-color: transparent transparent var(--color) transparent;
|
|
484
484
|
transform: translate(0, -15px);
|
|
485
485
|
}
|
|
486
|
-
`,this.wrapper.className="OrientationPlugin",this.arrows.className="OrientationArrows",this.wrapper.style.cssText="position: relative; width: 100%; height: 100%",this.wrapper.appendChild(this.arrows),this.arrowLeft.className=this.arrowRight.className=this.arrowTop.className=this.arrowBack.className=this.arrowFront.className="OrientationArrow",this.arrowBottom.className="OrientationArrow disabled",this.arrowBack.innerText="后",this.arrowFront.innerText="前",this.arrowLeft.innerText="左",this.arrowRight.innerText="右",this.arrowTop.innerText="上",this.arrowBottom.innerText="下",this.css3drenderer.domElement.style.cssText="position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;"},
|
|
486
|
+
`,this.wrapper.className="OrientationPlugin",this.arrows.className="OrientationArrows",this.wrapper.style.cssText="position: relative; width: 100%; height: 100%",this.wrapper.appendChild(this.arrows),this.arrowLeft.className=this.arrowRight.className=this.arrowTop.className=this.arrowBack.className=this.arrowFront.className="OrientationArrow",this.arrowBottom.className="OrientationArrow disabled",this.arrowBack.innerText="后",this.arrowFront.innerText="前",this.arrowLeft.innerText="左",this.arrowRight.innerText="右",this.arrowTop.innerText="上",this.arrowBottom.innerText="下",this.css3drenderer.domElement.style.cssText="position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;"},s.prototype.bindEvents=function(){var e=this;this.five.on("renderFrame",this.onRenderFrame),this.five.on("camera.update",this.onCameraUpdate),this.five.on("wantsGesture",this.onFiveWantsGesture),this.five.on("modeChange",this.onFiveModeChange),this.mc.on("tap",this.onTapGesture),this.mc.on("panstart",this.onPanStart),this.mc.on("panend",this.onPanEnd),this.wrapper.addEventListener("mousemove",this.onMouseMove),this.arrowTop.onclick=function(){return e.orient({longitude:0,latitude:le})},this.arrowLeft.onclick=function(){return e.orient({longitude:-le,latitude:0})},this.arrowRight.onclick=function(){return e.orient({longitude:le,latitude:0})},this.arrowFront.onclick=function(){return e.orient({longitude:0,latitude:0})},this.arrowBack.onclick=function(){return e.orient({longitude:Math.PI,latitude:0})}},s.prototype.unbindEvents=function(){this.five.off("renderFrame",this.onRenderFrame),this.five.off("camera.update",this.onCameraUpdate),this.five.off("wantsGesture",this.onFiveWantsGesture),this.five.off("modeChange",this.onFiveModeChange),this.mc.off("tap",this.onTapGesture),this.mc.off("panstart",this.onPanStart),this.mc.off("panend",this.onPanEnd),this.wrapper.removeEventListener("mousemove",this.onMouseMove),this.arrowTop.onclick=null,this.arrowLeft.onclick=null,this.arrowRight.onclick=null,this.arrowFront.onclick=null,this.arrowBack.onclick=null},s.prototype.updateByCamera=function(){var e=Ve(.2,1,this.camera.pose.latitude/Math.PI*2,function(i){return i*i}),n=Ve(11,13,this.camera.pose.latitude/Math.PI*2,function(i){return i*i}),t=Ve(12,15,this.camera.pose.latitude/Math.PI*2,function(i){return i*i}),r=Ve(13,19,this.camera.pose.latitude/Math.PI*2,function(i){return i*i}),l=Ve(-.2,.5,this.camera.pose.latitude/Math.PI*2,function(i){return i*i});this.cylinder.geometry=new p.CylinderGeometry(n,t,.01,50,1,!0),this.cylinder.material.uniforms.radiusTop.value=n,this.cylinder.material.uniforms.radiusBottom.value=t,this.cylinder.material.needsUpdate=!0,this.cylinder.children.forEach(function(i){i.position.normalize().multiplyScalar(r),i.scale.set(e,e,e);var h=i.children[0];h&&(h.element.style.opacity=l.toString())})},s.prototype.updateArrows=function(e){e.longitude;var n=e.latitude,t=le-n<.02;this.setState({arrowsVisible:t})},s.prototype.handleArrowsVisible=function(e){var n=this;if(this.state.enabled)if(this.cylinder.material.uniforms.opacity.value=e?.4:1,this.cylinder.material.needsUpdate=!0,e){var t=this.five.getCurrentState(),r=t.longitude,l=t.latitude;if(le-l<.03)this.five.state.mode==="Topview"||this.five.state.mode==="Mapview"?(this.faces.getObjectByName("上").element.className="active",this.arrows.innerHTML="",this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowFront),this.arrows.style.transform="rotate(".concat((r-this.config.fixedLongitude)/Math.PI*180,"deg)")):(this.arrows.innerHTML="",this.faces.getObjectByName("上").element.className="");else{switch(this.arrows.innerHTML="",this.arrows.appendChild(this.arrowTop),this.config.orthoView&&this.five.ready().then(function(){n.five.controller.cameraType="orthographic",n.five.ready().then(function(){return n.five.controller.cameraMotion.ended=!1})}),!0){case Ue(0,r-this.config.fixedLongitude):this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("前").element.className="active";break;case Ue(le,r-this.config.fixedLongitude):this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("右").element.className="active";break;case Ue(Math.PI,r-this.config.fixedLongitude):this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("后").element.className="active";break;default:this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("左").element.className="active";break}this.arrows.style.transform=""}this.arrows.style.display="block"}else this.config.orthoView&&(this.five.controller.cameraType="auto",this.five.ready().then(function(){return n.five.controller.cameraMotion.ended=!1})),this.arrows.style.display="none",this.faces.children.forEach(function(i){i.children[0].element.className=""})},s.prototype.setState=function(e,n){n===void 0&&(n={});var t=this.state,r=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,r),e.enabled!==void 0&&t.enabled!==e.enabled){var l={userAction:r};e.enabled?this._enable(l):this._disable(l)}},s.prototype.initLights=function(){this.directionalLight.target=this.box,this.scene.add(this.ambientLight,this.directionalLight)},s.prototype.initFaces=function(){var e=dn(7,7,.5),n=new p.ShapeGeometry(e);n.translate(-3.5,-3.5,0);var t=new p.Mesh(n,new p.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));t.userData={longitude:0,latitude:0},t.position.z=4.1,t.add(je("前"));var r=new p.Mesh(n,new p.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));r.rotateY(Math.PI),r.position.z=-4.1,r.add(je("后")),r.userData={longitude:Math.PI,latitude:0};var l=new p.Mesh(n,new p.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));l.rotateY(le),l.position.x=4.1,l.add(je("右")),l.userData={longitude:le,latitude:0};var i=new p.Mesh(n,new p.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));i.rotateY(-le),i.position.x=-4.1,i.add(je("左")),i.userData={longitude:-le,latitude:0};var h=new p.Mesh(n,new p.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));h.rotateX(-le),h.position.y=4.1,h.add(je("上")),h.userData={longitude:0,latitude:le},this.faces.add(t,r,i,l,h)},s.prototype.initControls=function(){var e=this.controls=new De(this.camera,this.renderer.domElement);e.enableZoom=!1,e.enableDamping=!0,e.enablePan=!1,e.maxPolarAngle=le,e.dampingFactor=.15,e.rotateSpeed=.25},s.prototype.load=function(e){return Ce(this,void 0,void 0,function(){return Oe(this,function(n){return[2]})})},s.prototype._enable=function(e){var n=this.five.getCurrentState(),t=n.longitude,r=n.latitude;this.camera.setFromPose({longitude:t,latitude:r,distance:20,offset:new p.Vector3(0,0,0)}),this.updateByCamera(),this.wrapper.appendChild(this.renderer.domElement),this.wrapper.appendChild(this.css3drenderer.domElement),this.bindEvents()},s.prototype._disable=function(e){this.wrapper.removeChild(this.renderer.domElement),this.wrapper.removeChild(this.css3drenderer.domElement),this.unbindEvents()},s.prototype.enable=function(e){var n;if(!this.state.enabled){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!0},t),this._enable({userAction:t}),document.head.appendChild(this.style)}},s.prototype.disable=function(e){var n;if(this.state.enabled!==!1){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!1},t),this._disable({userAction:t}),document.head.removeChild(this.style)}},s})(re.BasePlugin.Controller),mn=function(v,s){return new pn(v,s)},gn=(function(v){de(s,v);function s(e,n){var t=v.call(this,e)||this;return t.data={},t.pluginName="BackgroundPlugin",t._onFiveCameraUpdate=function(r){var l=(Math.PI/2-Math.max(r.latitude,0))/(Math.PI/2),i=Math.max(.2-l,0)*10;t.gradientBg&&(t.gradientBg.style.transform="translateY(-".concat((1-l)*50,"%)")),t.groundBg&&(t.groundBg.style.backgroundImage="radial-gradient(circle, #2E303350 ".concat(i*100,"%, transparent ").concat(i*120,"%)"))},t._addEventListener=function(){t.five.on("cameraUpdate",t._onFiveCameraUpdate)},t._removeEventListener=function(){t.five.off("cameraUpdate",t._onFiveCameraUpdate)},t.load=function(){return Ce(t,void 0,void 0,function(){return Oe(this,function(r){return[2]})})},t.setState=function(r,l){},t.enable=function(){var r,l=(r=t.five.getElement())===null||r===void 0?void 0:r.parentNode;if(!l){t.five.ready().then(function(){return t.enable()});return}t.state.enabled||(t._onFiveCameraUpdate(t.five.getPose(),!1),t.gradientBg&&l.appendChild(t.gradientBg),t.groundBg&&l.appendChild(t.groundBg),t.style&&document.head.appendChild(t.style),t._addEventListener(),t.hooks.emit("enable",{userAction:!0}),t.state.enabled=!0)},t.disable=function(r){var l,i,h,c;t.state.enabled&&((i=(l=t.gradientBg)===null||l===void 0?void 0:l.parentNode)===null||i===void 0||i.removeChild(t.gradientBg),(c=(h=t.groundBg)===null||h===void 0?void 0:h.parentNode)===null||c===void 0||c.removeChild(t.groundBg),t.style&&document.head.removeChild(t.style),t._removeEventListener(),t.hooks.emit("disable",{userAction:!0}),t.state.enabled=!1)},t.dispose=function(){t._removeEventListener(),t.hooks.emit("disable",{userAction:!0}),t.state.enabled=!1},t.state={enabled:!1},typeof document=="undefined"||(t.gradientBg=document.createElement("div"),t.groundBg=document.createElement("div"),t.style=document.createElement("style"),t.gradientBg.className="BackgroundPluginBg",t.groundBg.className="BackgroundPluginGroundBg",t.style.innerHTML=`
|
|
487
487
|
.BackgroundPluginBg {
|
|
488
488
|
position: absolute;
|
|
489
489
|
top: 0;
|
|
@@ -504,7 +504,7 @@ void main() {
|
|
|
504
504
|
z-index: -1;
|
|
505
505
|
pointerEvents: none;
|
|
506
506
|
}
|
|
507
|
-
`,t.enable()),t}return o})(lt.BasePlugin.Controller),yn=function(h,o){return new gn(h,o)};new p.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);var dt=(function(){function h(o,e,n,t,r){this.R=o,this.Q=e,this.A=n,this.B=t,this.C=r,this.cov=NaN,this.x=NaN}return h.prototype.filter=function(o,e){if(e===void 0&&(e=0),isNaN(this.x))this.x=1/this.C*o,this.cov=1/this.C*this.Q*(1/this.C);else{var n=this.A*this.x+this.B*e,t=this.A*this.cov*this.A+this.R,r=t*this.C*(1/(this.C*t*this.C+this.Q));this.x=n+r*(o-this.C*n),this.cov=t-r*this.C*t}return this.x},h})(),bn=(function(h){ve(o,h);function o(e,n){var t=h.call(this,e)||this;t.dispose=function(){t.disable()},t.five=e;var r={enabled:!0,visible:!0};t.state=Object.assign(r,n==null?void 0:n.initialState);var l=z({},n==null?void 0:n.config);return t._config=l,t.state.enabled&&t._enable({userAction:!1}),t.cancelAnimation=null,t.skipStart=0,t.skipEnd=0,t.location=0,t.totalDistance=0,t.trajectory=null,t.currentKeyFrame=null,t.nextKeyframe=null,t.nextButOneKeyframe=null,t.keyframes=[],t.rate=t.config.rate||1,t.virualCamera=t.five.camera.clone(),t.playingState={keyframeIndex:null,progress:null},Object.defineProperties(t,{currentDistance:{get:function(){return this._currentDistance},set:function(s){this._currentDistance=s}}}),t}return Object.defineProperty(o.prototype,"config",{get:function(){return z({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(e,n){var t=this.state;this.state=z(z({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},o.prototype.load=function(e){return Oe(this,void 0,void 0,function(){return _e(this,function(n){return[2]})})},o.prototype.loadTrajectory=function(e){this.trajectory=e,this.cancelAnimation&&this.cancelAnimation(),this.playingState.keyframeIndex=null,this.playingState.progress=null;var n=.01,t=.1,r=1,l=0,s=1,d=new dt(n,t,r,l,s),c=new dt(n,t,r,l,s),m=new dt(n,t,r,l,s);if(this.trajectory&&this.trajectory.content.loadState==="READY"){for(var y=this.trajectory.content.data.positionArray,A=new Float32Array(y.length/3),w=0;w<A.length;w++)if(w===0)A[w]=0;else{var E=new p.Vector3(y[w-3],y[w-2],y[w-1]),S=new p.Vector3(y[w],y[w+1],y[w+2]);A[w]=S.distanceTo(E)+A[w-1]}this.totalDistance=A[A.length-1];for(var w=0;w<A.length;w++){for(var C=new p.Vector3(0,0,0),P=0,b=w-5;b<w+6;b++)b>=0&&b<A.length&&(C.add(new p.Vector3(y[b*3],y[b*3+1],y[b*3+2])),P++);C.divideScalar(P).applyMatrix4(e.transform);var M=d.filter(C.x),f=c.filter(C.y),_=m.filter(C.z),x={position:new p.Vector3(M,f,_),location:A[w]};this.keyframes.push(x)}}else throw new Error("trajectory content is not ready")},o.prototype.setPlayingState=function(e){(e.keyframeIndex!==null||e.progress!==null)&&(this.cancelAnimation&&this.cancelAnimation(),this.playingState.keyframeIndex=e.keyframeIndex?e.keyframeIndex:this.playingState.keyframeIndex,this.playingState.progress=e.progress?e.progress:this.playingState.progress,this.play())},o.prototype._enable=function(e){},o.prototype.play=function(){var e=this,n=this.keyframes.length;if(n<2)throw new Error("keyframes length must be greater than 2");var t={keyframeIndex:null,progress:null};this.playingState.keyframeIndex!==null&&this.playingState.progress!==null?(t.keyframeIndex=this.playingState.keyframeIndex,t.progress=this.playingState.progress):this.playingState.keyframeIndex===null&&this.playingState.progress===null&&(this.playingState.keyframeIndex=this.skipStart,this.playingState.progress=0,this.virualCamera.position.copy(this.keyframes[this.playingState.keyframeIndex].position.clone()),this.virualCamera.lookAt(this.keyframes[1].position.clone()),this.virualCamera.computePose(),this.five.setState(z({},this.virualCamera.pose)));var r=this.playingState.keyframeIndex,l=0;this.cancelAnimation=de.AnimationFrameLoop.shared.add(function(s,d){if(r===n-1-e.skipEnd&&e.cancelAnimation){e.cancelAnimation();return}e.currentKeyFrame=e.keyframes[r],e.nextKeyframe=e.keyframes[r+1],r+2<=n-1?e.nextButOneKeyframe=e.keyframes[r+2]:e.nextButOneKeyframe=null;var c=e.currentKeyFrame.position.clone(),m=e.nextKeyframe.position.clone(),y=e.nextKeyframe.position.clone().sub(e.currentKeyFrame.position.clone()).normalize(),A=c.clone().add(y.clone().multiplyScalar(.01)),w=new p.Vector3;e.nextButOneKeyframe!==null?w=e.nextButOneKeyframe.position.clone().sub(e.nextKeyframe.position.clone()).normalize():w.copy(y);var E=m.clone().add(w.clone().multiplyScalar(.01));l+=d/1e3*e.rate;var S=l/c.distanceTo(m);S=S>=1?1:S,t.keyframeIndex!==null&&t.progress!==null&&(S=t.progress,t.keyframeIndex=null,t.progress=null);var C=c.clone().lerp(m,S),P=A.clone().lerp(E,S);e.virualCamera.position.copy(C),e.virualCamera.lookAt(P),e.virualCamera.updateMatrixWorld(),e.virualCamera.updateMatrix(),e.virualCamera.computePose(),e.five.setState(z({},e.virualCamera.pose)),e.location=e.keyframes[r].location+c.clone().distanceTo(C),S===1?(l=0,r++,e.playingState.keyframeIndex=r,e.playingState.progress=0):(e.playingState.keyframeIndex=r,e.playingState.progress=S)})},o.prototype.pause=function(){this.cancelAnimation&&this.cancelAnimation()},o.prototype.findKeyFrameByLocation=function(e){if(this.keyframes.length!==0){for(var n=0,t=this.keyframes.length-1;n<=t;){var r=Math.floor((n+t)/2);if(this.keyframes[r].location===e)return r;this.keyframes[r].location<e?n=r+1:t=r-1}return{keyframeIndex:n-1,progress:0}}},o.prototype.resetPlayingState=function(){this.playingState.keyframeIndex=null,this.playingState.progress=null},o.prototype._disable=function(e){},o.prototype.enable=function(e){var n;if(!this.state.enabled){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!0},t),this._enable({userAction:t})}},o.prototype.disable=function(e){var n;if(this.state.enabled!==!1){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!1},t),this._disable({userAction:t})}},o})(ee.BasePlugin.Controller),wn=function(h,o){return new bn(h,o)};function Dt(h,o,e){return h<o?o:h>e?e:h}var Pn=`
|
|
507
|
+
`,t.enable()),t}return s})(lt.BasePlugin.Controller),yn=function(v,s){return new gn(v,s)};new p.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);var vt=(function(){function v(s,e,n,t,r){this.R=s,this.Q=e,this.A=n,this.B=t,this.C=r,this.cov=NaN,this.x=NaN}return v.prototype.filter=function(s,e){if(e===void 0&&(e=0),isNaN(this.x))this.x=1/this.C*s,this.cov=1/this.C*this.Q*(1/this.C);else{var n=this.A*this.x+this.B*e,t=this.A*this.cov*this.A+this.R,r=t*this.C*(1/(this.C*t*this.C+this.Q));this.x=n+r*(s-this.C*n),this.cov=t-r*this.C*t}return this.x},v})(),bn=(function(v){de(s,v);function s(e,n){var t=v.call(this,e)||this;t.dispose=function(){t.disable()},t.five=e;var r={enabled:!0,visible:!0};t.state=Object.assign(r,n==null?void 0:n.initialState);var l=N({},n==null?void 0:n.config);return t._config=l,t.state.enabled&&t._enable({userAction:!1}),t.cancelAnimation=null,t.skipStart=0,t.skipEnd=0,t.location=0,t.totalDistance=0,t.trajectory=null,t.currentKeyFrame=null,t.nextKeyframe=null,t.nextButOneKeyframe=null,t.keyframes=[],t.rate=t.config.rate||1,t.virualCamera=t.five.camera.clone(),t.playingState={keyframeIndex:null,progress:null},t.timeArray=null,t.startTimestamp=null,t.playbackStartTime=null,t.playbackEndTime=null,Object.defineProperties(t,{currentDistance:{get:function(){return this._currentDistance},set:function(i){this._currentDistance=i}}}),t}return Object.defineProperty(s.prototype,"config",{get:function(){return N({},this._config)},enumerable:!1,configurable:!0}),s.prototype.updateState=function(e,n){var t=this.state;this.state=N(N({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},s.prototype.load=function(e){return Ce(this,void 0,void 0,function(){return Oe(this,function(n){return[2]})})},s.prototype.loadTrajectory=function(e){this.trajectory=e,this.cancelAnimation&&this.cancelAnimation(),this.playingState.keyframeIndex=null,this.playingState.progress=null;var n=.01,t=.1,r=1,l=0,i=1,h=new vt(n,t,r,l,i),c=new vt(n,t,r,l,i),d=new vt(n,t,r,l,i);if(this.trajectory&&this.trajectory.content.loadState==="READY"){var y=this.trajectory.content.data.positionArray;this.timeArray=this.trajectory.content.data.timeArray;for(var S=new Float32Array(y.length/3),w=0;w<S.length;w++)if(w===0)S[w]=0;else{var M=new p.Vector3(y[w-3],y[w-2],y[w-1]),E=new p.Vector3(y[w],y[w+1],y[w+2]);S[w]=E.distanceTo(M)+S[w-1]}this.totalDistance=S[S.length-1];for(var w=0;w<S.length;w++){for(var O=new p.Vector3(0,0,0),A=0,b=w-5;b<w+6;b++)b>=0&&b<S.length&&(O.add(new p.Vector3(y[b*3],y[b*3+1],y[b*3+2])),A++);O.divideScalar(A).applyMatrix4(e.transform);var T=h.filter(O.x),f=c.filter(O.y),C=d.filter(O.z),x={position:new p.Vector3(T,f,C),location:S[w]};this.keyframes.push(x)}}else throw new Error("trajectory content is not ready")},s.prototype.setPlayingState=function(e){(e.keyframeIndex!==null||e.progress!==null)&&(this.cancelAnimation&&this.cancelAnimation(),this.playingState.keyframeIndex=e.keyframeIndex?e.keyframeIndex:this.playingState.keyframeIndex,this.playingState.progress=e.progress?e.progress:this.playingState.progress,this.play())},s.prototype._enable=function(e){},s.prototype.play=function(){var e=this,n=this.keyframes.length;if(n<2)throw new Error("keyframes length must be greater than 2");var t={keyframeIndex:null,progress:null};this.playingState.keyframeIndex!==null&&this.playingState.progress!==null?(t.keyframeIndex=this.playingState.keyframeIndex,t.progress=this.playingState.progress):this.playingState.keyframeIndex===null&&this.playingState.progress===null&&(this.playingState.keyframeIndex=this.skipStart,this.playingState.progress=0,this.virualCamera.position.copy(this.keyframes[this.playingState.keyframeIndex].position.clone()),this.virualCamera.lookAt(this.keyframes[1].position.clone()),this.virualCamera.computePose(),this.five.setState(N({},this.virualCamera.pose)));var r=this.playingState.keyframeIndex,l=0;this.cancelAnimation=fe.AnimationFrameLoop.shared.add(function(i,h){if(r===n-1-e.skipEnd&&e.cancelAnimation){e.cancelAnimation();return}e.currentKeyFrame=e.keyframes[r],e.nextKeyframe=e.keyframes[r+1],r+2<=n-1?e.nextButOneKeyframe=e.keyframes[r+2]:e.nextButOneKeyframe=null;var c=e.currentKeyFrame.position.clone(),d=e.nextKeyframe.position.clone(),y=e.nextKeyframe.position.clone().sub(e.currentKeyFrame.position.clone()).normalize(),S=c.clone().add(y.clone().multiplyScalar(.01)),w=new p.Vector3;e.nextButOneKeyframe!==null?w=e.nextButOneKeyframe.position.clone().sub(e.nextKeyframe.position.clone()).normalize():w.copy(y);var M=d.clone().add(w.clone().multiplyScalar(.01));l+=h/1e3*e.rate;var E=l/c.distanceTo(d);E=E>=1?1:E,t.keyframeIndex!==null&&t.progress!==null&&(E=t.progress,t.keyframeIndex=null,t.progress=null);var O=c.clone().lerp(d,E),A=S.clone().lerp(M,E);e.virualCamera.position.copy(O),e.virualCamera.lookAt(A),e.virualCamera.updateMatrixWorld(),e.virualCamera.updateMatrix(),e.virualCamera.computePose(),e.five.setState(N({},e.virualCamera.pose)),e.location=e.keyframes[r].location+c.clone().distanceTo(O),E===1?(l=0,r++,e.playingState.keyframeIndex=r,e.playingState.progress=0):(e.playingState.keyframeIndex=r,e.playingState.progress=E)})},s.prototype.pause=function(){var e;if(this.cancelAnimation){if(this.playingState.keyframeIndex!==null&&this.playingState.keyframeIndex>=0&&this.playingState.keyframeIndex<this.keyframes.length){var n=this.playingState.keyframeIndex,t=(e=this.playingState.progress)!==null&&e!==void 0?e:0,r=this.keyframes[n],l=n+1<this.keyframes.length?this.keyframes[n+1]:r,i=r.position.clone(),h=l.position.clone(),c=i.clone().lerp(h,t),d=h.clone().sub(i).normalize(),y=c.clone().add(d.multiplyScalar(.01));this.virualCamera.position.copy(c),this.virualCamera.lookAt(y),this.virualCamera.updateMatrixWorld(),this.virualCamera.updateMatrix(),this.virualCamera.computePose(),this.five.setState(N({},this.virualCamera.pose))}else if(this.currentKeyFrame&&this.nextKeyframe){var i=this.currentKeyFrame.position.clone(),h=this.nextKeyframe.position.clone(),c=i.clone(),d=h.clone().sub(i).normalize(),y=c.clone().add(d.multiplyScalar(.01));this.virualCamera.position.copy(c),this.virualCamera.lookAt(y),this.virualCamera.updateMatrixWorld(),this.virualCamera.updateMatrix(),this.virualCamera.computePose(),this.five.setState(N({},this.virualCamera.pose))}this.cancelAnimation()}this.startTimestamp=null},s.prototype.playByTimestamp=function(){var e=this,n;if(!this.trajectory||!this.timeArray||this.timeArray.length===0)throw new Error("Trajectory or timeArray is not available");var t=this.keyframes.length;if(t<2)throw new Error("keyframes length must be greater than 2");this.cancelAnimation&&this.cancelAnimation();var r=this.skipStart,l=this.timeArray.length-1-this.skipEnd;if(r>=l||r<0||l>=this.timeArray.length)throw new Error("Invalid skipStart or skipEnd values");this.playbackStartTime=this.timeArray[r],this.playbackEndTime=this.timeArray[l],this.playbackEndTime-this.playbackStartTime;var i,h=0,c=null;if(this.playingState.keyframeIndex!==null&&this.playingState.keyframeIndex>=r&&this.playingState.keyframeIndex<t-this.skipEnd){i=this.playingState.keyframeIndex,h=(n=this.playingState.progress)!==null&&n!==void 0?n:0;var d=this.timeArray[i],y=i+1<this.timeArray.length?this.timeArray[i+1]:d,S=y-d;c=d+S*h}else i=this.skipStart,i>=t-1-this.skipEnd&&(i=t-1-this.skipEnd-1),i<0&&(i=0),c=null;var w=this.playbackStartTime;if(c!==null){var M=c-w;this.startTimestamp=Date.now()-M/this.rate}else this.startTimestamp=Date.now();if(h>0&&i+1<t){var E=this.keyframes[i].position.clone(),O=this.keyframes[i+1].position.clone(),A=E.clone().lerp(O,h),b=O.clone().sub(E).normalize(),T=A.clone().add(b.multiplyScalar(.01));this.virualCamera.position.copy(A),this.virualCamera.lookAt(T)}else this.virualCamera.position.copy(this.keyframes[i].position.clone()),i+1<t&&this.virualCamera.lookAt(this.keyframes[i+1].position.clone());this.virualCamera.computePose(),this.five.setState(N({},this.virualCamera.pose)),this.cancelAnimation=fe.AnimationFrameLoop.shared.add(function(f,C){if(e.startTimestamp){var x=Date.now()-e.startTimestamp,F=w+x*e.rate;if(e.playbackEndTime&&F>=e.playbackEndTime){var G=t-1-e.skipEnd;if(G>0&&G<t){if(e.currentKeyFrame=e.keyframes[G-1],e.nextKeyframe=e.keyframes[G],e.virualCamera.position.copy(e.nextKeyframe.position.clone()),G+1<t)e.virualCamera.lookAt(e.keyframes[G+1].position.clone());else{var W=e.nextKeyframe.position.clone().sub(e.currentKeyFrame.position.clone()).normalize();e.virualCamera.lookAt(e.nextKeyframe.position.clone().add(W.multiplyScalar(.01)))}e.virualCamera.computePose(),e.five.setState(N({},e.virualCamera.pose))}e.cancelAnimation&&(e.cancelAnimation(),e.startTimestamp=null);return}var Y=e.findKeyFrameByTimestamp(F);if(!(Y===void 0||Y>=t-1-e.skipEnd)&&(Y!==i&&(i=Y),!(i>=t-1-e.skipEnd)&&(e.currentKeyFrame=e.keyframes[i],e.nextKeyframe=e.keyframes[i+1],i+2<=t-1?e.nextButOneKeyframe=e.keyframes[i+2]:e.nextButOneKeyframe=null,!!e.timeArray))){var Z=e.timeArray[i],J=e.timeArray[i+1],j=J-Z,X=j>0?(F-Z)/j:0,L=Math.max(0,Math.min(1,X)),k=e.currentKeyFrame.position.clone(),I=e.nextKeyframe.position.clone(),B=e.nextKeyframe.position.clone().sub(e.currentKeyFrame.position.clone()).normalize(),K=k.clone().add(B.clone().multiplyScalar(.01)),ee=new p.Vector3;e.nextButOneKeyframe!==null?ee=e.nextButOneKeyframe.position.clone().sub(e.nextKeyframe.position.clone()).normalize():ee.copy(B);var Q=I.clone().add(ee.clone().multiplyScalar(.01)),U=k.clone().lerp(I,L),ae=K.clone().lerp(Q,L);e.virualCamera.position.copy(U),e.virualCamera.lookAt(ae),e.virualCamera.updateMatrixWorld(),e.virualCamera.updateMatrix(),e.virualCamera.computePose(),e.five.setState(N({},e.virualCamera.pose)),e.playingState.keyframeIndex=i,e.playingState.progress=L,e.location=e.keyframes[i].location+k.clone().distanceTo(U),e.playingState.keyframeIndex=i,e.playingState.progress=L}}})},s.prototype.findKeyFrameByLocation=function(e){if(this.keyframes.length!==0){for(var n=0,t=this.keyframes.length-1;n<=t;){var r=Math.floor((n+t)/2);if(this.keyframes[r].location===e)return r;this.keyframes[r].location<e?n=r+1:t=r-1}return{keyframeIndex:n-1,progress:0}}},s.prototype.findKeyFrameByTimestamp=function(e){if(!(!this.timeArray||this.timeArray.length===0||this.keyframes.length===0)){for(var n=0,t=this.timeArray.length-1,r=0,l=Math.abs(this.timeArray[0]-e);n<=t;){var i=Math.floor((n+t)/2),h=this.timeArray[i],c=Math.abs(h-e);if(c<l&&(l=c,r=i),h===e)return i;h<e?n=i+1:t=i-1}if(r>0){var d=Math.abs(this.timeArray[r-1]-e);d<l&&(r=r-1)}if(r<this.timeArray.length-1){var y=Math.abs(this.timeArray[r+1]-e);y<l&&(r=r+1)}return r}},s.prototype.resetPlayingState=function(){this.playingState.keyframeIndex=null,this.playingState.progress=null},s.prototype.getTotalTime=function(){if(!this.timeArray||this.timeArray.length===0)return null;var e=this.skipStart,n=this.timeArray.length-1-this.skipEnd;if(e>=n||e<0||n>=this.timeArray.length)return null;var t=this.timeArray[e],r=this.timeArray[n];return r-t},s.prototype.setPlayingStateByTimestamp=function(e){var n=this;if(!this.trajectory||!this.timeArray||this.timeArray.length===0)throw new Error("Trajectory or timeArray is not available");var t=this.keyframes.length;if(e<0||e>=t)throw new Error("Invalid keyframeIndex");this.cancelAnimation&&this.cancelAnimation();var r=this.skipStart,l=this.timeArray.length-1-this.skipEnd;if(r>=l||r<0||l>=this.timeArray.length)throw new Error("Invalid skipStart or skipEnd values");this.playbackStartTime=this.timeArray[r],this.playbackEndTime=this.timeArray[l];var i=this.timeArray[e],h=i-this.playbackStartTime;if(this.startTimestamp=Date.now()-h/this.rate,this.playingState.keyframeIndex=e,this.playingState.progress=0,this.virualCamera.position.copy(this.keyframes[e].position.clone()),e+1<t)this.virualCamera.lookAt(this.keyframes[e+1].position.clone());else if(e>0){var c=this.keyframes[e].position.clone().sub(this.keyframes[e-1].position.clone()).normalize();this.virualCamera.lookAt(this.keyframes[e].position.clone().add(c.multiplyScalar(.01)))}this.virualCamera.computePose(),this.five.setState(N({},this.virualCamera.pose));var d=this.playbackStartTime,y=e;this.cancelAnimation=fe.AnimationFrameLoop.shared.add(function(S,w){if(!(n.timeArray===null||n.timeArray.length===0)&&n.startTimestamp){var M=Date.now()-n.startTimestamp,E=d+M*n.rate;if(n.playbackEndTime&&E>=n.playbackEndTime){var O=t-1-n.skipEnd;if(O>0&&O<t){if(n.currentKeyFrame=n.keyframes[O-1],n.nextKeyframe=n.keyframes[O],n.virualCamera.position.copy(n.nextKeyframe.position.clone()),O+1<t)n.virualCamera.lookAt(n.keyframes[O+1].position.clone());else{var A=n.nextKeyframe.position.clone().sub(n.currentKeyFrame.position.clone()).normalize();n.virualCamera.lookAt(n.nextKeyframe.position.clone().add(A.multiplyScalar(.01)))}n.virualCamera.computePose(),n.five.setState(N({},n.virualCamera.pose))}n.cancelAnimation&&(n.cancelAnimation(),n.startTimestamp=null);return}var b=n.findKeyFrameByTimestamp(E);if(!(b===void 0||b>=t-1-n.skipEnd)&&(b!==y&&(y=b),!(y>=t-1-n.skipEnd))){n.currentKeyFrame=n.keyframes[y],n.nextKeyframe=n.keyframes[y+1],y+2<=t-1?n.nextButOneKeyframe=n.keyframes[y+2]:n.nextButOneKeyframe=null;var T=n.currentKeyFrame.position.clone(),f=n.nextKeyframe.position.clone(),C=n.nextKeyframe.position.clone().sub(n.currentKeyFrame.position.clone()).normalize(),x=T.clone().add(C.clone().multiplyScalar(.01)),F=new p.Vector3;n.nextButOneKeyframe!==null?F=n.nextButOneKeyframe.position.clone().sub(n.nextKeyframe.position.clone()).normalize():F.copy(C);var G=f.clone().add(F.clone().multiplyScalar(.01)),W=n.timeArray[y],Y=n.timeArray[y+1],Z=Y-W,J=0;if(Z>0){var j=E-W;J=Math.max(0,Math.min(1,j/Z))}var X=J*J*(3-2*J),L=T.clone().lerp(f,X),k=x.clone().lerp(G,X);n.virualCamera.position.copy(L),n.virualCamera.lookAt(k),n.virualCamera.computePose(),n.five.setState(N({},n.virualCamera.pose))}}})},s.prototype._disable=function(e){},s.prototype.enable=function(e){var n;if(!this.state.enabled){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!0},t),this._enable({userAction:t})}},s.prototype.disable=function(e){var n;if(this.state.enabled!==!1){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!1},t),this._disable({userAction:t})}},s})(re.BasePlugin.Controller),wn=function(v,s){return new bn(v,s)};function It(v,s,e){return v<s?s:v>e?e:v}var An=`
|
|
508
508
|
varying vec2 vUv;
|
|
509
509
|
varying vec3 vPosition;
|
|
510
510
|
void main() {
|
|
@@ -512,7 +512,7 @@ void main() {
|
|
|
512
512
|
vPosition = position;
|
|
513
513
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
514
514
|
}
|
|
515
|
-
`,
|
|
515
|
+
`,Tn=`
|
|
516
516
|
varying vec2 vUv;
|
|
517
517
|
uniform sampler2D map;
|
|
518
518
|
uniform float progress;
|
|
@@ -531,7 +531,7 @@ void main() {
|
|
|
531
531
|
}
|
|
532
532
|
gl_FragColor.a = gl_FragColor.a * opacity;
|
|
533
533
|
}
|
|
534
|
-
`,
|
|
534
|
+
`,Pn=[1,5,2,6,3,7,4,8,9,13,10,14,11,15,12,16],dt=512,pt=512,Qe=128,Mn=(function(v){de(s,v);function s(e,n){var t=v.call(this,e)||this;t.group=new p.Group,t.mesh=(function(){var i=new p.CylinderGeometry(.12,.12,1,32,1,!0);i.translate(0,.5,0);var h=new p.ShaderMaterial({vertexShader:An,fragmentShader:Tn,uniforms:{map:{value:new p.Texture},progress:{value:0},opacity:{value:0}},transparent:!0,depthTest:!1}),c=new p.Mesh(i,h);return c})(),t.panoMesh=new fe.PanoCircleMesh({scale:1.5}),t.stop=function(){},t.drawLine=function(i,h){if(t.ctx){var c=(function(){var S,w=dt/16|0;return w*((S=Pn[i])!==null&&S!==void 0?S:0)})(),d=(1-(h+i*150)%1200/1200)*(pt+Qe),y=t.ctx.createLinearGradient(0,d-Qe,0,d);y.addColorStop(0,"rgba(255,255,255,0)"),y.addColorStop(.5,"rgba(255,255,255,1)"),y.addColorStop(1,"rgba(255,255,255,0)"),t.ctx.fillStyle=y,t.ctx.fillRect(c,d-Qe,3,Qe)}},t.anime=function(i){if(t.ctx&&t.startTime){t.ctx.clearRect(0,0,dt,pt);for(var h=0;h<16;h++)t.drawLine(h,i-t.startTime);var c=It((i-t.startTime)/1e3,0,1),d=It((i-t.startTime)/300,0,t.config.maxOpacity);t.panoMesh.setOpacity(d),t.mesh.material.uniforms.progress.value=c,t.mesh.material.uniforms.opacity.value=d,t.mesh.material.uniforms.map.value.needsUpdate=!0,t.five.needsRender=!0}},t.dispose=function(){t.disable()},t.five=e;var r={enabled:!1,visible:!0};t.state=Object.assign(r,n==null?void 0:n.initialState);var l=N(N({},n==null?void 0:n.config),{maxOpacity:1});return t._config=l,typeof document=="undefined"||(t.canvas=document.createElement("canvas"),t.ctx=t.canvas.getContext("2d"),t.canvas.width=dt,t.canvas.height=pt,t.ctx.shadowColor="rgba(255,255,255,0.5)",t.ctx.shadowBlur=6,t.ctx.shadowOffsetX=0,t.ctx.shadowOffsetY=0,t.mesh.material.uniforms.map.value=new p.CanvasTexture(t.canvas),t.group.add(t.mesh),t.panoMesh.setProgress(1),t.panoMesh.setOpacity(0),t.group.add(t.panoMesh),t.state.enabled&&t._enable({userAction:!1})),t}return Object.defineProperty(s.prototype,"config",{get:function(){return N({},this._config)},enumerable:!1,configurable:!0}),s.prototype.updateState=function(e,n){var t=this.state;this.state=N(N({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},s.prototype.updateConfig=function(e,n){var t;n===void 0&&(n={});var r=this.config,l=N(N({},r),e);this._config=l,this.hooks.emit("configChange",{prevConfig:r,config:l,userAction:(t=n.userAction)!==null&&t!==void 0?t:!0})},s.prototype.load=function(e){return Ce(this,void 0,void 0,function(){return Oe(this,function(n){return[2]})})},s.prototype._enable=function(e){var n=this;this.mesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition),this.panoMesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition),this.five.ready().then(function(){n.five.scene.add(n.group),n.stop=fe.AnimationFrameLoop.shared.add(function(t,r){n.startTime||(n.startTime=t),n.panoMesh.updateTime(t,r),n.anime(t)})})},s.prototype._disable=function(e){this.five.scene.remove(this.group),this.panoMesh.setOpacity(0),this.startTime=void 0,this.stop(),this.five.needsRender=!0},s.prototype.enable=function(e){var n;if(this.ctx&&!this.state.enabled&&this.five.observers[this.five.state.panoIndex]){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!0},t),this._enable({userAction:t})}},s.prototype.disable=function(e){var n;if(this.state.enabled!==!1){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!1},t),this._disable({userAction:t})}},s.prototype.setState=function(e,n){n===void 0&&(n={});var t=this.state,r=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,r),e.enabled!==void 0&&t.enabled!==e.enabled){var l={userAction:r};e.enabled?this._enable(l):this._disable(l)}},s})(lt.BasePlugin.Controller),Sn=function(v,s){return new Mn(v,s)},mt=(function(v){de(s,v);function s(){var e=v.call(this)||this;e.type="LineSegmentsGeometry";var n=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],r=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(r),e.setAttribute("position",new p.Float32BufferAttribute(n,3)),e.setAttribute("uv",new p.Float32BufferAttribute(t,2)),e}return s.prototype.applyMatrix4=function(e){var n=this.attributes.instanceStart,t=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),t.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},s.prototype.setPositions=function(e){var n;e instanceof Float32Array?n=e:Array.isArray(e)?n=new Float32Array(e):n=new Float32Array;var t=new p.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceStart",new p.InterleavedBufferAttribute(t,3,0)),this.setAttribute("instanceEnd",new p.InterleavedBufferAttribute(t,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},s.prototype.setColors=function(e){var n;e instanceof Float32Array?n=e:Array.isArray(e)?n=new Float32Array(e):n=new Float32Array;var t=new p.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceColorStart",new p.InterleavedBufferAttribute(t,3,0)),this.setAttribute("instanceColorEnd",new p.InterleavedBufferAttribute(t,3,3)),this},s.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},s.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},s.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new p.WireframeGeometry(e.geometry)),this},s.prototype.fromLineSegments=function(e){var n=e.geometry;if(n instanceof p.Geometry){var t=new p.BufferGeometry().fromGeometry(n);this.setPositions(t.attributes.position.array)}else n instanceof p.BufferGeometry&&this.setPositions(n.attributes.position.array);return this},s.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new p.Box3);var e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){var t=new p.Box3;this.boundingBox.setFromBufferAttribute(e),t.setFromBufferAttribute(n),this.boundingBox.union(t)}},s.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new p.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){var t=this.boundingSphere.center;this.boundingBox.getCenter(t);for(var r=0,l=new p.Vector3,i=0,h=e.count;i<h;i++)l.fromBufferAttribute(e,i),r=Math.max(r,t.distanceToSquared(l)),l.fromBufferAttribute(n,i),r=Math.max(r,t.distanceToSquared(l));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},s.prototype.toJSON=function(){},s})(p.InstancedBufferGeometry);Object.assign(mt.prototype,{isLineSegmentsGeometry:!0});var gt={uniforms:p.UniformsUtils.merge([p.UniformsLib.common,p.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new p.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1},totalLength:{value:1},animationProgress:{value:0},time:{value:0},waveAmp:{value:.15},waveFreq:{value:5},waveDir:{value:2},startOffset:{value:0},endOffset:{value:0},range:{value:.3}}]),vertexShader:`
|
|
535
535
|
#include <common>
|
|
536
536
|
#include <color_pars_vertex>
|
|
537
537
|
#include <fog_pars_vertex>
|
|
@@ -728,7 +728,7 @@ void main() {
|
|
|
728
728
|
#include <fog_fragment>
|
|
729
729
|
#include <premultiplied_alpha_fragment>
|
|
730
730
|
}
|
|
731
|
-
`},yt=(function(h){ve(o,h);function o(e){var n=h.call(this,{uniforms:p.UniformsUtils.clone(gt.uniforms),vertexShader:gt.vertexShader,fragmentShader:gt.fragmentShader,clipping:!0})||this;return n.type="LineMaterial",n.dashed=!1,Object.defineProperties(n,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(t){this.uniforms.time.value=t}},waveAmp:{enumerable:!0,get:function(){return this.uniforms.waveAmp.value},set:function(t){this.uniforms.waveAmp.value=t}},waveFreq:{enumerable:!0,get:function(){return this.uniforms.waveFreq.value},set:function(t){this.uniforms.waveFreq.value=t}},waveDir:{enumerable:!0,get:function(){return this.uniforms.waveDir.value},set:function(t){this.uniforms.waveDir.value=t}},startOffset:{enumerable:!0,get:function(){return this.uniforms.startOffset.value},set:function(t){this.uniforms.startOffset.value=t}},endOffset:{enumerable:!0,get:function(){return this.uniforms.endOffset.value},set:function(t){this.uniforms.endOffset.value=t}},range:{enumerable:!0,get:function(){return this.uniforms.range.value},set:function(t){this.uniforms.range.value=t}},animationProgress:{enumerable:!0,get:function(){return this.uniforms.animationProgress.value},set:function(t){this.uniforms.animationProgress.value=t}}}),n.setValues(e),n}return o})(p.ShaderMaterial);Object.assign(yt.prototype,{isLineMaterial:!0});var Nt=(function(h){ve(o,h);function o(e,n){var t=h.call(this)||this;return t.type="LineSegments2",t.geometry=e!==void 0?e:new mt,t.material=n!==void 0?n:new yt({color:Math.random()*16777215}),t}return o.prototype.computeLineDistances=function(){for(var e=this.geometry,n=e.attributes.instanceStart,t=e.attributes.instanceEnd,r=new Float32Array(2*n.count),l=new p.Vector3,s=new p.Vector3,d=0,c=0,m=n.count;c<m;c++)l.fromBufferAttribute(n,c),s.fromBufferAttribute(t,c),d+=l.distanceTo(s);this.material.uniforms.totalLength.value=d;for(var c=0,y=0,m=n.count;c<m;c++,y+=2){l.fromBufferAttribute(n,c),s.fromBufferAttribute(t,c);var A=l.distanceTo(s);r[y]=y===0?0:r[y-1],r[y+1]=r[y]+A}var w=new p.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new p.InterleavedBufferAttribute(w,1,0)),e.setAttribute("instanceDistanceEnd",new p.InterleavedBufferAttribute(w,1,1)),this},o.prototype.raycast=function(e,n){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var t=e.ray,r=e.camera,l=r.projectionMatrix,s=this.geometry,d=this.material,c=d.resolution,m=d.linewidth,y=s.attributes.instanceStart,A=s.attributes.instanceEnd,w=new p.Vector4,E=new p.Vector4,S=new p.Vector4,C=new p.Vector3,P=new p.Matrix4,b=new p.Line3,M=new p.Vector3;t.at(1,S),S.w=1,S.applyMatrix4(r.matrixWorldInverse),S.applyMatrix4(l),S.multiplyScalar(1/S.w),S.x*=c.x/2,S.y*=c.y/2,S.z=0,C.copy(S);var f=this.matrixWorld;P.multiplyMatrices(r.matrixWorldInverse,f);for(var _=0,x=y.count;_<x;_++){w.fromBufferAttribute(y,_),E.fromBufferAttribute(A,_),w.w=1,E.w=1,w.applyMatrix4(P),E.applyMatrix4(P),w.applyMatrix4(l),E.applyMatrix4(l),w.multiplyScalar(1/w.w),E.multiplyScalar(1/E.w);var D=w.z<-1&&E.z<-1,H=w.z>1&&E.z>1;if(!(D||H)){w.x*=c.x/2,w.y*=c.y/2,E.x*=c.x/2,E.y*=c.y/2,b.start.copy(w),b.start.z=0,b.end.copy(E),b.end.z=0;var X=b.closestPointToPointParameter(C,!0);b.at(X,M);var q=p.MathUtils.lerp(w.z,E.z,X),te=q>=-1&&q<=1,oe=C.distanceTo(M)<m*.5;if(te&&oe){b.start.fromBufferAttribute(y,_),b.end.fromBufferAttribute(A,_),b.start.applyMatrix4(f),b.end.applyMatrix4(f);var G=new p.Vector3,K=new p.Vector3;t.distanceSqToSegment(b.start,b.end,K,G),n.push({point:K,pointOnLine:G,distance:t.origin.distanceTo(K),object:this,faceIndex:_})}}}},o})(p.Mesh);Object.assign(Nt.prototype,{isLineSegments2:!0});var kt=(function(h){ve(o,h);function o(e,n){var t=h.call(this,e,n)||this;return t.type="Line2",t}return o})(Nt);Object.assign(kt.prototype,{isLine2:!0});var Bt=(function(h){ve(o,h);function o(){var e=h.call(this)||this;return e.type="LineGeometry",e}return o.prototype.setPositions=function(e){for(var n=e.length-3,t=new Float32Array(2*n),r=0;r<n;r+=3)t[2*r]=e[r],t[2*r+1]=e[r+1],t[2*r+2]=e[r+2],t[2*r+3]=e[r+3],t[2*r+4]=e[r+4],t[2*r+5]=e[r+5];return h.prototype.setPositions.call(this,t),this},o.prototype.setColors=function(e){for(var n=e.length-3,t=new Float32Array(2*n),r=0;r<n;r+=3)t[2*r]=e[r],t[2*r+1]=e[r+1],t[2*r+2]=e[r+2],t[2*r+3]=e[r+3],t[2*r+4]=e[r+4],t[2*r+5]=e[r+5];return h.prototype.setColors.call(this,t),this},o.prototype.fromLine=function(e){var n=e.geometry;if(n instanceof p.Geometry){var t=new p.BufferGeometry().fromGeometry(n);this.setPositions(t.attributes.position.array)}else n instanceof p.BufferGeometry&&this.setPositions(n.attributes.position.array);return this},o.prototype.copy=function(){return this},o})(mt);Object.assign(Bt.prototype,{isLineGeometry:!0});var Sn=(function(h){ve(o,h);function o(e,n){var t=h.call(this,e)||this;t.paths=new Map,t.up=new p.Vector3(0,1,0);var r={enabled:!0,visible:!0,playing:!1};t.state=Object.assign(r,n==null?void 0:n.initialState);var l={lineCount:6,spacing:.02,lineWidth:2,color:16777215,speed:2,range:.3,waveAmp:.05,waveFreq:20,particleCount:50,maxDistance:.1,lineYOffset:.1,subMeshWidth:.3,subMeshColor:65535,subMeshOpacity:.3,subMeshMaxOpacity:.5,subMeshSegmentInterval:3,subMeshHighlightWidth:1};return t._config=z(z({},l),n==null?void 0:n.config),n!=null&&n.paths&&n.paths.length>0&&n.paths.forEach(function(s){t.addPath(s)}),t.state.enabled&&t._enable({userAction:!1}),t}return Object.defineProperty(o.prototype,"config",{get:function(){return z({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(e,n){var t=this.state;this.state=z(z({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},o.prototype.load=function(e,n){return Oe(this,void 0,void 0,function(){var t,r=this;return _e(this,function(l){return this.clearAllPaths(),e.paths.forEach(function(s){var d,c,m=s.points.map(function(y){return new p.Vector3(y.x,y.y,y.z)});r.addPath({id:s.id,points:m,enabled:(d=s.enabled)!==null&&d!==void 0?d:!0,visible:(c=s.visible)!==null&&c!==void 0?c:!0,color:s.color,lineWidth:s.lineWidth,speed:s.speed})}),t=new Map,this.paths.forEach(function(s,d){t.set(d,s.config)}),this.data={paths:t},this.hooks.emit("dataLoaded",this.data),n&&this.setState(n),[2]})})},o.prototype.addPath=function(e){var n,t,r,l,s,d,c,m;if(e.points.length<2)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e.id," 至少需要2个点")),!1;if(this.paths.has(e.id))return console.warn("DynamicPathLinePlugin: 路径 ".concat(e.id," 已存在")),!1;var y=new p.CatmullRomCurve3(e.points),A=(n=e.subMeshColor)!==null&&n!==void 0?n:this._config.subMeshColor,w=(t=e.subMeshWidth)!==null&&t!==void 0?t:this._config.subMeshWidth,E=(r=e.subMeshOpacity)!==null&&r!==void 0?r:this._config.subMeshOpacity,S=(l=e.enableSubMesh)!==null&&l!==void 0?l:!0,C=(s=e.speed)!==null&&s!==void 0?s:this._config.speed,P=(d=e.range)!==null&&d!==void 0?d:this._config.range,b=this.createLines(e,y,P),M=this.createParticles(),f=M.particles,_=M.particleGeometry,x=M.particleMaterial,D=M.particleInfos,H=M.particlePositions,X=this.createSubMeshGeometry(e,y,w),q=y.getLength(),te=this.createSubMeshMaterial(A,E,q,P);te.uniforms.totalLength.value=q;var oe=new p.Mesh(X,te);oe.visible=S,this.five.scene.add(oe);var G={id:e.id,config:e,curve:y,lines:b,particles:f,particleGeometry:_,particleMaterial:x,particleInfos:D,particlePositions:H,enabled:(c=e.enabled)!==null&&c!==void 0?c:!0,visible:(m=e.visible)!==null&&m!==void 0?m:!0,startOffset:0,endOffset:0,lastAnimationProgress:0,cycleStartTime:performance.now()/1e3,isInitialAnimation:!0,isPathlineInitialAnimation:!0,subMeshUnfoldProgress:0,subMeshUnfoldStarted:!1,subMeshUnfoldStartTime:0,lastUpdateTime:performance.now()/1e3,subMesh:oe,subMeshGeometry:X,subMeshMaterial:te,subMeshColor:A,subMeshWidth:w,subMeshOpacity:E,speed:C,animationId:null,enableSubMesh:S,isPaused:!1,pausedProgress:0,pausedTime:0};this.paths.set(e.id,G);var K=this.data,I=new Map;return this.paths.forEach(function(F,L){I.set(L,F.config)}),this.data={paths:I},this.hooks.emit("dataChange",this.data,K),this.hooks.emit("pathAdd",e.id,e),this.state.playing&&this.startPathAnimation(e.id),!0},o.prototype.removePath=function(e){var n=this.paths.get(e);if(!n)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1;this.stopPathAnimation(e),this.disposePathResources(n),this.paths.delete(e);var t=this.data,r=new Map;return this.paths.forEach(function(l,s){r.set(s,l.config)}),this.data={paths:r},this.hooks.emit("dataChange",this.data,t),this.hooks.emit("pathRemove",e),!0},o.prototype.enablePath=function(e){var n=this.paths.get(e);return n?(n.enabled=!0,this.hooks.emit("pathEnable",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},o.prototype.disablePath=function(e){var n=this.paths.get(e);return n?(n.enabled=!1,this.hooks.emit("pathDisable",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},o.prototype.showPath=function(e){var n=this.paths.get(e);return n?(n.visible=!0,n.lines.forEach(function(t){return t.visible=!0}),n.particles.visible=!0,n.subMesh.visible=!0,this.hooks.emit("pathShow",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},o.prototype.hidePath=function(e){var n=this.paths.get(e);return n?(n.visible=!1,n.lines.forEach(function(t){return t.visible=!1}),n.particles.visible=!1,n.subMesh.visible=!1,this.hooks.emit("pathHide",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},o.prototype.getPathIds=function(){return Array.from(this.paths.keys())},o.prototype.getPathConfig=function(e){var n=this.paths.get(e);return n?z({},n.config):void 0},o.prototype.clearAllPaths=function(){var e=this;this.paths.forEach(function(r,l){e.stopPathAnimation(l),e.disposePathResources(r)}),this.paths.clear();var n=this.data,t=new Map;this.paths.forEach(function(r,l){t.set(l,r.config)}),this.data={paths:t},this.hooks.emit("dataChange",this.data,n)},o.prototype.getPositions=function(e,n){for(var t=[],r=[],l=0,s=[],d=0;d<=n;d++){var c=d/n,m=e.getPoint(c);s.push(m.clone()),d>0&&(l+=m.distanceTo(s[d-1]))}for(var y=0,d=0;d<n;d++){d>0&&(y+=s[d].distanceTo(s[d-1]));var A=y/l;t.push(s[d].x,s[d].y,s[d].z),r.push(A)}return{positions:t,distanceProgress:r}},o.prototype.createLines=function(e,n,t){for(var r=this,l,s,d=[],c=e.points.length*40,m=this._config,y=m.lineCount,A=m.spacing,w=m.waveAmp,E=m.waveFreq,S=m.lineYOffset,C=(l=e.lineWidth)!==null&&l!==void 0?l:this._config.lineWidth,P=(s=e.color)!==null&&s!==void 0?s:this._config.color,b=n.getLength(),M=t/b,f=function(D){var H=(D-(y-1)/2)*A,X=e.points.map(function(I,F){var L=F/(e.points.length-1),k=n.getTangent(L).normalize(),R=new p.Vector3().crossVectors(r.up,k).normalize(),ae=H*Math.abs((F-e.points.length/2)/e.points.length-.5)*-1;return I.clone().addScaledVector(R,H+ae).add(new p.Vector3(0,S+.02*(D%2===0?1:0),0))}),q=new p.CatmullRomCurve3(X),te=_.getPositions(q,c).positions,oe=new Bt;oe.setPositions(te);var G=new yt({color:P,linewidth:C*(D%2===0?1:.5),transparent:!0,opacity:1,depthWrite:!1});G.resolution.set(_.five.camera.resolution.x,_.five.camera.resolution.y),D===0?G.waveDir=1:D===1?G.waveDir=2:D===2?G.waveDir=0:D===3?G.waveDir=3:D===4&&(G.waveDir=1),G.waveAmp=w,G.waveFreq=E,Object.assign(G.uniforms,{time:{value:0},startOffset:{value:0},range:{value:M}});var K=new kt(oe,G);K.computeLineDistances(),d.push(K),_.five.scene.add(K)},_=this,x=0;x<y;x++)f(x);return d},o.prototype.createParticleMaterial=function(){return new p.ShaderMaterial({transparent:!0,blending:p.AdditiveBlending,depthWrite:!1,uniforms:{pointTexture:{value:new p.TextureLoader().load("https://threejs.org/examples/textures/sprites/circle.png")}},vertexShader:`
|
|
731
|
+
`},yt=(function(v){de(s,v);function s(e){var n=v.call(this,{uniforms:p.UniformsUtils.clone(gt.uniforms),vertexShader:gt.vertexShader,fragmentShader:gt.fragmentShader,clipping:!0})||this;return n.type="LineMaterial",n.dashed=!1,Object.defineProperties(n,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(t){this.uniforms.time.value=t}},waveAmp:{enumerable:!0,get:function(){return this.uniforms.waveAmp.value},set:function(t){this.uniforms.waveAmp.value=t}},waveFreq:{enumerable:!0,get:function(){return this.uniforms.waveFreq.value},set:function(t){this.uniforms.waveFreq.value=t}},waveDir:{enumerable:!0,get:function(){return this.uniforms.waveDir.value},set:function(t){this.uniforms.waveDir.value=t}},startOffset:{enumerable:!0,get:function(){return this.uniforms.startOffset.value},set:function(t){this.uniforms.startOffset.value=t}},endOffset:{enumerable:!0,get:function(){return this.uniforms.endOffset.value},set:function(t){this.uniforms.endOffset.value=t}},range:{enumerable:!0,get:function(){return this.uniforms.range.value},set:function(t){this.uniforms.range.value=t}},animationProgress:{enumerable:!0,get:function(){return this.uniforms.animationProgress.value},set:function(t){this.uniforms.animationProgress.value=t}}}),n.setValues(e),n}return s})(p.ShaderMaterial);Object.assign(yt.prototype,{isLineMaterial:!0});var Dt=(function(v){de(s,v);function s(e,n){var t=v.call(this)||this;return t.type="LineSegments2",t.geometry=e!==void 0?e:new mt,t.material=n!==void 0?n:new yt({color:Math.random()*16777215}),t}return s.prototype.computeLineDistances=function(){for(var e=this.geometry,n=e.attributes.instanceStart,t=e.attributes.instanceEnd,r=new Float32Array(2*n.count),l=new p.Vector3,i=new p.Vector3,h=0,c=0,d=n.count;c<d;c++)l.fromBufferAttribute(n,c),i.fromBufferAttribute(t,c),h+=l.distanceTo(i);this.material.uniforms.totalLength.value=h;for(var c=0,y=0,d=n.count;c<d;c++,y+=2){l.fromBufferAttribute(n,c),i.fromBufferAttribute(t,c);var S=l.distanceTo(i);r[y]=y===0?0:r[y-1],r[y+1]=r[y]+S}var w=new p.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new p.InterleavedBufferAttribute(w,1,0)),e.setAttribute("instanceDistanceEnd",new p.InterleavedBufferAttribute(w,1,1)),this},s.prototype.raycast=function(e,n){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var t=e.ray,r=e.camera,l=r.projectionMatrix,i=this.geometry,h=this.material,c=h.resolution,d=h.linewidth,y=i.attributes.instanceStart,S=i.attributes.instanceEnd,w=new p.Vector4,M=new p.Vector4,E=new p.Vector4,O=new p.Vector3,A=new p.Matrix4,b=new p.Line3,T=new p.Vector3;t.at(1,E),E.w=1,E.applyMatrix4(r.matrixWorldInverse),E.applyMatrix4(l),E.multiplyScalar(1/E.w),E.x*=c.x/2,E.y*=c.y/2,E.z=0,O.copy(E);var f=this.matrixWorld;A.multiplyMatrices(r.matrixWorldInverse,f);for(var C=0,x=y.count;C<x;C++){w.fromBufferAttribute(y,C),M.fromBufferAttribute(S,C),w.w=1,M.w=1,w.applyMatrix4(A),M.applyMatrix4(A),w.applyMatrix4(l),M.applyMatrix4(l),w.multiplyScalar(1/w.w),M.multiplyScalar(1/M.w);var F=w.z<-1&&M.z<-1,G=w.z>1&&M.z>1;if(!(F||G)){w.x*=c.x/2,w.y*=c.y/2,M.x*=c.x/2,M.y*=c.y/2,b.start.copy(w),b.start.z=0,b.end.copy(M),b.end.z=0;var W=b.closestPointToPointParameter(O,!0);b.at(W,T);var Y=p.MathUtils.lerp(w.z,M.z,W),Z=Y>=-1&&Y<=1,J=O.distanceTo(T)<d*.5;if(Z&&J){b.start.fromBufferAttribute(y,C),b.end.fromBufferAttribute(S,C),b.start.applyMatrix4(f),b.end.applyMatrix4(f);var j=new p.Vector3,X=new p.Vector3;t.distanceSqToSegment(b.start,b.end,X,j),n.push({point:X,pointOnLine:j,distance:t.origin.distanceTo(X),object:this,faceIndex:C})}}}},s})(p.Mesh);Object.assign(Dt.prototype,{isLineSegments2:!0});var Nt=(function(v){de(s,v);function s(e,n){var t=v.call(this,e,n)||this;return t.type="Line2",t}return s})(Dt);Object.assign(Nt.prototype,{isLine2:!0});var Bt=(function(v){de(s,v);function s(){var e=v.call(this)||this;return e.type="LineGeometry",e}return s.prototype.setPositions=function(e){for(var n=e.length-3,t=new Float32Array(2*n),r=0;r<n;r+=3)t[2*r]=e[r],t[2*r+1]=e[r+1],t[2*r+2]=e[r+2],t[2*r+3]=e[r+3],t[2*r+4]=e[r+4],t[2*r+5]=e[r+5];return v.prototype.setPositions.call(this,t),this},s.prototype.setColors=function(e){for(var n=e.length-3,t=new Float32Array(2*n),r=0;r<n;r+=3)t[2*r]=e[r],t[2*r+1]=e[r+1],t[2*r+2]=e[r+2],t[2*r+3]=e[r+3],t[2*r+4]=e[r+4],t[2*r+5]=e[r+5];return v.prototype.setColors.call(this,t),this},s.prototype.fromLine=function(e){var n=e.geometry;if(n instanceof p.Geometry){var t=new p.BufferGeometry().fromGeometry(n);this.setPositions(t.attributes.position.array)}else n instanceof p.BufferGeometry&&this.setPositions(n.attributes.position.array);return this},s.prototype.copy=function(){return this},s})(mt);Object.assign(Bt.prototype,{isLineGeometry:!0});var En=(function(v){de(s,v);function s(e,n){var t=v.call(this,e)||this;t.paths=new Map,t.up=new p.Vector3(0,1,0);var r={enabled:!0,visible:!0,playing:!1};t.state=Object.assign(r,n==null?void 0:n.initialState);var l={lineCount:6,spacing:.02,lineWidth:2,color:16777215,speed:2,range:.3,waveAmp:.05,waveFreq:20,particleCount:50,maxDistance:.1,lineYOffset:.1,subMeshWidth:.3,subMeshColor:65535,subMeshOpacity:.3,subMeshMaxOpacity:.5,subMeshSegmentInterval:3,subMeshHighlightWidth:1};return t._config=N(N({},l),n==null?void 0:n.config),n!=null&&n.paths&&n.paths.length>0&&n.paths.forEach(function(i){t.addPath(i)}),t.state.enabled&&t._enable({userAction:!1}),t}return Object.defineProperty(s.prototype,"config",{get:function(){return N({},this._config)},enumerable:!1,configurable:!0}),s.prototype.updateState=function(e,n){var t=this.state;this.state=N(N({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},s.prototype.load=function(e,n){return Ce(this,void 0,void 0,function(){var t,r=this;return Oe(this,function(l){return this.clearAllPaths(),e.paths.forEach(function(i){var h,c,d=i.points.map(function(y){return new p.Vector3(y.x,y.y,y.z)});r.addPath({id:i.id,points:d,enabled:(h=i.enabled)!==null&&h!==void 0?h:!0,visible:(c=i.visible)!==null&&c!==void 0?c:!0,color:i.color,lineWidth:i.lineWidth,speed:i.speed})}),t=new Map,this.paths.forEach(function(i,h){t.set(h,i.config)}),this.data={paths:t},this.hooks.emit("dataLoaded",this.data),n&&this.setState(n),[2]})})},s.prototype.addPath=function(e){var n,t,r,l,i,h,c,d;if(e.points.length<2)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e.id," 至少需要2个点")),!1;if(this.paths.has(e.id))return console.warn("DynamicPathLinePlugin: 路径 ".concat(e.id," 已存在")),!1;var y=new p.CatmullRomCurve3(e.points),S=(n=e.subMeshColor)!==null&&n!==void 0?n:this._config.subMeshColor,w=(t=e.subMeshWidth)!==null&&t!==void 0?t:this._config.subMeshWidth,M=(r=e.subMeshOpacity)!==null&&r!==void 0?r:this._config.subMeshOpacity,E=(l=e.enableSubMesh)!==null&&l!==void 0?l:!0,O=(i=e.speed)!==null&&i!==void 0?i:this._config.speed,A=(h=e.range)!==null&&h!==void 0?h:this._config.range,b=this.createLines(e,y,A),T=this.createParticles(),f=T.particles,C=T.particleGeometry,x=T.particleMaterial,F=T.particleInfos,G=T.particlePositions,W=this.createSubMeshGeometry(e,y,w),Y=y.getLength(),Z=this.createSubMeshMaterial(S,M,Y,A);Z.uniforms.totalLength.value=Y;var J=new p.Mesh(W,Z);J.visible=E,this.five.scene.add(J);var j={id:e.id,config:e,curve:y,lines:b,particles:f,particleGeometry:C,particleMaterial:x,particleInfos:F,particlePositions:G,enabled:(c=e.enabled)!==null&&c!==void 0?c:!0,visible:(d=e.visible)!==null&&d!==void 0?d:!0,startOffset:0,endOffset:0,lastAnimationProgress:0,cycleStartTime:performance.now()/1e3,isInitialAnimation:!0,isPathlineInitialAnimation:!0,subMeshUnfoldProgress:0,subMeshUnfoldStarted:!1,subMeshUnfoldStartTime:0,lastUpdateTime:performance.now()/1e3,subMesh:J,subMeshGeometry:W,subMeshMaterial:Z,subMeshColor:S,subMeshWidth:w,subMeshOpacity:M,speed:O,animationId:null,enableSubMesh:E,isPaused:!1,pausedProgress:0,pausedTime:0};this.paths.set(e.id,j);var X=this.data,L=new Map;return this.paths.forEach(function(k,I){L.set(I,k.config)}),this.data={paths:L},this.hooks.emit("dataChange",this.data,X),this.hooks.emit("pathAdd",e.id,e),this.state.playing&&this.startPathAnimation(e.id),!0},s.prototype.removePath=function(e){var n=this.paths.get(e);if(!n)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1;this.stopPathAnimation(e),this.disposePathResources(n),this.paths.delete(e);var t=this.data,r=new Map;return this.paths.forEach(function(l,i){r.set(i,l.config)}),this.data={paths:r},this.hooks.emit("dataChange",this.data,t),this.hooks.emit("pathRemove",e),!0},s.prototype.enablePath=function(e){var n=this.paths.get(e);return n?(n.enabled=!0,this.hooks.emit("pathEnable",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},s.prototype.disablePath=function(e){var n=this.paths.get(e);return n?(n.enabled=!1,this.hooks.emit("pathDisable",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},s.prototype.showPath=function(e){var n=this.paths.get(e);return n?(n.visible=!0,n.lines.forEach(function(t){return t.visible=!0}),n.particles.visible=!0,n.subMesh.visible=!0,this.hooks.emit("pathShow",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},s.prototype.hidePath=function(e){var n=this.paths.get(e);return n?(n.visible=!1,n.lines.forEach(function(t){return t.visible=!1}),n.particles.visible=!1,n.subMesh.visible=!1,this.hooks.emit("pathHide",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},s.prototype.getPathIds=function(){return Array.from(this.paths.keys())},s.prototype.getPathConfig=function(e){var n=this.paths.get(e);return n?N({},n.config):void 0},s.prototype.clearAllPaths=function(){var e=this;this.paths.forEach(function(r,l){e.stopPathAnimation(l),e.disposePathResources(r)}),this.paths.clear();var n=this.data,t=new Map;this.paths.forEach(function(r,l){t.set(l,r.config)}),this.data={paths:t},this.hooks.emit("dataChange",this.data,n)},s.prototype.getPositions=function(e,n){for(var t=[],r=[],l=0,i=[],h=0;h<=n;h++){var c=h/n,d=e.getPoint(c);i.push(d.clone()),h>0&&(l+=d.distanceTo(i[h-1]))}for(var y=0,h=0;h<n;h++){h>0&&(y+=i[h].distanceTo(i[h-1]));var S=y/l;t.push(i[h].x,i[h].y,i[h].z),r.push(S)}return{positions:t,distanceProgress:r}},s.prototype.createLines=function(e,n,t){for(var r=this,l,i,h=[],c=e.points.length*40,d=this._config,y=d.lineCount,S=d.spacing,w=d.waveAmp,M=d.waveFreq,E=d.lineYOffset,O=(l=e.lineWidth)!==null&&l!==void 0?l:this._config.lineWidth,A=(i=e.color)!==null&&i!==void 0?i:this._config.color,b=n.getLength(),T=t/b,f=function(F){var G=(F-(y-1)/2)*S,W=e.points.map(function(L,k){var I=k/(e.points.length-1),B=n.getTangent(I).normalize(),K=new p.Vector3().crossVectors(r.up,B).normalize(),ee=G*Math.abs((k-e.points.length/2)/e.points.length-.5)*-1;return L.clone().addScaledVector(K,G+ee).add(new p.Vector3(0,E+.02*(F%2===0?1:0),0))}),Y=new p.CatmullRomCurve3(W),Z=C.getPositions(Y,c).positions,J=new Bt;J.setPositions(Z);var j=new yt({color:A,linewidth:O*(F%2===0?1:.5),transparent:!0,opacity:1,depthWrite:!1});j.resolution.set(C.five.camera.resolution.x,C.five.camera.resolution.y),F===0?j.waveDir=1:F===1?j.waveDir=2:F===2?j.waveDir=0:F===3?j.waveDir=3:F===4&&(j.waveDir=1),j.waveAmp=w,j.waveFreq=M,Object.assign(j.uniforms,{time:{value:0},startOffset:{value:0},range:{value:T}});var X=new Nt(J,j);X.computeLineDistances(),h.push(X),C.five.scene.add(X)},C=this,x=0;x<y;x++)f(x);return h},s.prototype.createParticleMaterial=function(){return new p.ShaderMaterial({transparent:!0,blending:p.AdditiveBlending,depthWrite:!1,uniforms:{pointTexture:{value:new p.TextureLoader().load("https://threejs.org/examples/textures/sprites/circle.png")}},vertexShader:`
|
|
732
732
|
attribute float size;
|
|
733
733
|
varying vec2 vUv;
|
|
734
734
|
void main() {
|
|
@@ -743,7 +743,7 @@ void main() {
|
|
|
743
743
|
gl_FragColor = texture2D(pointTexture, gl_PointCoord);
|
|
744
744
|
gl_FragColor.a *= 0.15;
|
|
745
745
|
}
|
|
746
|
-
`})},
|
|
746
|
+
`})},s.prototype.createParticles=function(){for(var e=this._config.particleCount,n=new Float32Array(e*3),t=new p.BufferGeometry,r=this.createParticleMaterial(),l=new p.Points(t,r),i=new Float32Array(e),h=[],c=0;c<e;c++)n[c*3]=9999,n[c*3+1]=9999,n[c*3+2]=9999,i[c]=p.MathUtils.randFloat(3,9),h.push({velocity:new p.Vector3,life:3+Math.random()*2,age:0,active:!1,alpha:0,startPos:new p.Vector3});return t.setAttribute("position",new p.BufferAttribute(n,3)),t.setAttribute("size",new p.BufferAttribute(i,1)),l.frustumCulled=!1,this.five.scene.add(l),{particles:l,particleGeometry:t,particleMaterial:r,particleInfos:h,particlePositions:n}},s.prototype.createSubMeshGeometry=function(e,n,t){for(var r=e.points.length*40,l=new p.BufferGeometry,i=n.getPoints(r),h=[],c=[],d=[],y=[],S=0,w=[0],M=1;M<i.length;M++)S+=i[M].distanceTo(i[M-1]),w.push(S);for(var E=S,M=0;M<i.length;M++){var O=i[M],A=M/(i.length-1),b=n.getTangent(A).normalize(),T=new p.Vector3().crossVectors(this.up,b).normalize(),f=t/2,C=O.clone().addScaledVector(T,-f);h.push(C.x,C.y,C.z),c.push(0,w[M]/E),y.push(w[M]/E);var x=O.clone().addScaledVector(T,f);h.push(x.x,x.y,x.z),c.push(1,w[M]/E),y.push(w[M]/E)}for(var M=0;M<i.length-1;M++){var F=M*2;d.push(F,F+1,F+2),d.push(F+1,F+3,F+2)}return l.setAttribute("position",new p.Float32BufferAttribute(h,3)),l.setAttribute("uv",new p.Float32BufferAttribute(c,2)),l.setAttribute("distanceProgress",new p.Float32BufferAttribute(y,1)),l.setIndex(d),l.computeVertexNormals(),l},s.prototype.createAlphaMapTexture=function(e,n,t,r,l){for(var i=1024,h=1,c=i*h,d=new Uint8Array(c),y=1/e,S=t/e,w=n/S,M=w/2,E=0;E<i;E++){var O=E/i,A=Math.floor(O/y),b=(O-A*y)/y,T=0,f=b;if(f>.5&&(f=1-f),f<M){var C=1-f/M,x=C;T=r+(l-r)*x}else T=r;d[E]=Math.floor(T*255)}var F=new p.DataTexture(d,i,h,p.RedFormat);return F.needsUpdate=!0,F.wrapS=p.RepeatWrapping,F.wrapT=p.ClampToEdgeWrapping,F.minFilter=p.LinearFilter,F.magFilter=p.LinearFilter,F},s.prototype.createSubMeshMaterial=function(e,n,t,r){var l=this._config,i=l.subMeshSegmentInterval,h=l.subMeshHighlightWidth,c=l.subMeshMaxOpacity,d=Math.max(1,Math.round(t/i)),y=r/t,S=this.createAlphaMapTexture(d,h,t,n,c);return new p.ShaderMaterial({transparent:!0,side:p.BackSide,depthWrite:!1,uniforms:{baseColor:{value:new p.Color(e)},baseOpacity:{value:n},globalOpacity:{value:1},animationProgress:{value:0},range:{value:y},startOffset:{value:0},endOffset:{value:0},totalLength:{value:1},unfoldProgress:{value:0},alphaMap:{value:S}},vertexShader:`
|
|
747
747
|
attribute float distanceProgress;
|
|
748
748
|
varying vec2 vUv;
|
|
749
749
|
varying float vDistanceProgress;
|
|
@@ -812,4 +812,4 @@ void main() {
|
|
|
812
812
|
|
|
813
813
|
gl_FragColor = vec4(baseColor, sampledAlpha * globalOpacity);
|
|
814
814
|
}
|
|
815
|
-
`})},o.prototype.projectPointsToScreen=function(e,n){for(var t=[],r=0,l=0;l<e.length;l++){var s=e[l];l>0&&(r+=s.distanceTo(e[l-1]));var d=s.clone().project(n),c=d.x<-1||d.x>1||d.y<-1||d.y>1||d.z<-1||d.z>1;t.push({point:s.clone(),screenPos:new p.Vector2(d.x,d.y),distanceFromStart:r,isOffscreen:c})}return t},o.prototype.findNearestOffscreenPoint=function(e){for(var n=-1,t=0,r=-1,l=0;l<e.length;l++)if(!e[l].isOffscreen){r=l;break}if(r===-1)return null;for(var l=r-1;l>=0;l--)if(e[l].isOffscreen){n=l,t=e[l].distanceFromStart;break}return n===-1?{index:0,distance:0}:{index:n,distance:t}},o.prototype.findFarestOffscreenPoint=function(e){for(var n,t=((n=e[e.length-1])===null||n===void 0?void 0:n.distanceFromStart)||0,r=-1,l=e.length-1;l>=0;l--)if(!e[l].isOffscreen){r=l;break}if(r===-1)return null;var s=r+1;return s<e.length&&e[s].isOffscreen?{index:s,distance:e[s].distanceFromStart,totalLength:t}:{index:e.length-1,distance:t,totalLength:t}},o.prototype.updatePathAnimation=function(e){var n,t,r=this.paths.get(e);if(!(!r||!r.enabled)){var l=performance.now()/1e3,s=this._config,d=s.particleCount,c=s.maxDistance,m=((n=r.lines[0])===null||n===void 0?void 0:n.material.uniforms.totalLength.value)||1,y=Math.max(.01,m-r.startOffset-r.endOffset),A=r.speed,w=(l-r.cycleStartTime)*A/y%1;if(r.isInitialAnimation){var E=w*y;if(r.enableSubMesh&&E>=1&&!r.subMeshUnfoldStarted&&(r.subMeshUnfoldStarted=!0,r.subMeshUnfoldStartTime=l),r.enableSubMesh&&r.subMeshUnfoldStarted&&r.subMeshUnfoldProgress<1&&!r.isPaused){var S=(t=r.config.range)!==null&&t!==void 0?t:this._config.range,C=l-r.subMeshUnfoldStartTime;r.subMeshUnfoldProgress=Math.min(1,C*A/(y-2*S)),r.subMeshMaterial.uniforms.unfoldProgress.value=r.subMeshUnfoldProgress}w<r.lastAnimationProgress&&(r.isPathlineInitialAnimation=!1,(!r.enableSubMesh||r.subMeshUnfoldProgress>=1)&&(r.isInitialAnimation=!1))}else r.enableSubMesh&&(r.subMeshMaterial.uniforms.unfoldProgress.value=1);if(r.lastAnimationProgress=w,r.lastUpdateTime=l,r.isPathlineInitialAnimation&&r.lines.forEach(function(q){q.material.uniforms.time.value=l,q.material.uniforms.animationProgress.value=w}),r.isPathlineInitialAnimation){var P=null,b=1/0;if(r.lines.forEach(function(q){for(var te=q.geometry,oe=te.attributes.instanceDistanceStart,G=te.attributes.instanceDistanceEnd,K=oe.count,I=0;I<K;I++){var F=oe.getX(I)/q.material.uniforms.totalLength.value,L=G.getX(I)/q.material.uniforms.totalLength.value;if(w>=F&&w<=L){var k=(w-F)/(L-F),R=new p.Vector3().fromBufferAttribute(te.attributes.instanceStart,I),ae=new p.Vector3().fromBufferAttribute(te.attributes.instanceEnd,I),Z=new p.Vector3().lerpVectors(R,ae,k),V=Math.abs(w-(F+L)/2);V<b&&(b=V,P=Z)}}}),P)for(var M=0;M<d;M++){var f=r.particleInfos[M];!f.active&&Math.random()<.05&&(f.active=!0,f.age=0,f.life=3+Math.random()*2,f.velocity.set((Math.random()-.5)*1e-4,(Math.random()-.5)*1e-4,(Math.random()-.5)*1e-4),r.particlePositions[M*3]=P.x,r.particlePositions[M*3+1]=P.y,r.particlePositions[M*3+2]=P.z,f.startPos.copy(P),f.alpha=0)}for(var M=0;M<d;M++){var f=r.particleInfos[M];if(f.active){f.age+=.016;var _=r.particlePositions[M*3]-f.startPos.x,x=r.particlePositions[M*3+1]-f.startPos.y,D=r.particlePositions[M*3+2]-f.startPos.z,H=Math.sqrt(_*_+x*x+D*D);(H>=c||f.age>=f.life)&&(f.active=!1,r.particlePositions[M*3]=9999,r.particlePositions[M*3+1]=9999,r.particlePositions[M*3+2]=9999,f.alpha=0),f.velocity.x+=(Math.random()-.5)*1e-4,f.velocity.z+=(Math.random()-.5)*1e-4,f.velocity.y+=1e-4,f.velocity.multiplyScalar(.99),r.particlePositions[M*3]+=f.velocity.x,r.particlePositions[M*3+1]+=f.velocity.y,r.particlePositions[M*3+2]+=f.velocity.z;var X=f.age/f.life;X<.2?f.alpha=X/.2:X>.8?f.alpha=(1-X)/.2:f.alpha=1}}r.particleGeometry.attributes.position.needsUpdate=!0,r.particleMaterial.opacity=.6}r.enableSubMesh&&(r.subMeshMaterial.uniforms.animationProgress.value=w),this.five.needsRender=!0}},o.prototype.startPathAnimation=function(e,n){var t=this,r,l,s=this.paths.get(e);if(!s)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1;if(s.animationId!==null)return!1;var d=(r=n==null?void 0:n.startPointIndex)!==null&&r!==void 0?r:0,c=(l=n==null?void 0:n.fromStart)!==null&&l!==void 0?l:!1;if(!s.isPaused||c){var m=0,y=d;if(y>0){var A=s.config.points;y>=A.length&&(console.warn("DynamicPathLinePlugin: startPointIndex ".concat(y," 超出范围,路径只有 ").concat(A.length," 个点")),y=A.length-1);for(var w=0;w<y;w++)m+=A[w].distanceTo(A[w+1])}s.startOffset=m,s.lines.forEach(function(M){M.material.uniforms.startOffset.value=m}),s.enableSubMesh&&(s.subMeshMaterial.uniforms.startOffset.value=m)}var E=performance.now()/1e3;if(!c&&s.isPaused&&s.pausedProgress>0){var S=s.curve.getLength(),C=Math.max(.01,S-s.startOffset-s.endOffset),P=s.speed;if(s.cycleStartTime=E-s.pausedProgress*C/P,s.subMeshUnfoldStarted&&s.subMeshUnfoldProgress<1){var b=s.pausedTime-s.subMeshUnfoldStartTime;s.subMeshUnfoldStartTime=E-b}s.isPaused=!1}else s.cycleStartTime=E,s.isPaused=!1,s.pausedProgress=0;return s.lastUpdateTime=E,this.highlightPath(e,!0),s.animationId=de.AnimationFrameLoop.shared.add(function(){t.updatePathAnimation(e)}),!0},o.prototype.stopPathAnimation=function(e,n){n===void 0&&(n=!1);var t=this.paths.get(e);if(!t)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1;if(this.highlightPath(e,!1),t.animationId!==null){if(n){var r=performance.now()/1e3,l=t.curve.getLength(),s=Math.max(.01,l-t.startOffset-t.endOffset),d=t.speed;if(t.pausedProgress=(r-t.cycleStartTime)*d/s%1,t.pausedTime=r,t.isPaused=!0,t.subMeshUnfoldStarted&&t.subMeshUnfoldProgress<1){var c=r-t.subMeshUnfoldStartTime;t.subMeshUnfoldStartTime=r-c}}else t.isPaused=!1,t.pausedProgress=0,t.pausedTime=0;t.animationId(),t.animationId=null}return!0},o.prototype._enable=function(e){this.paths.size>0&&this.state.playing&&this.play()},o.prototype._disable=function(e){this.pause()},o.prototype.enable=function(e){var n;if(!this.state.enabled){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!0},t),this._enable({userAction:t})}},o.prototype.disable=function(e){var n;if(this.state.enabled!==!1){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!1},t),this._disable({userAction:t})}},o.prototype.show=function(e){var n,t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.paths.forEach(function(r){r.lines.forEach(function(l){return l.visible=!0}),r.particles.visible=!0,r.subMesh.visible=!0}),this.updateState({visible:!0},t)},o.prototype.hide=function(e){var n,t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.paths.forEach(function(r){r.lines.forEach(function(l){return l.visible=!1}),r.particles.visible=!1,r.subMesh.visible=!1}),this.updateState({visible:!1},t)},o.prototype.setState=function(e,n){var t;t=n==null?void 0:n.userAction,e.enabled!==void 0&&e.enabled!==this.state.enabled&&(e.enabled?this.enable(n):this.disable(n)),e.visible!==void 0&&e.visible!==this.state.visible&&(e.visible?this.show(n):this.hide(n))},o.prototype.play=function(e){var n=this;e===void 0&&(e=!1),this.paths.forEach(function(t,r){n.startPathAnimation(r,{fromStart:e})}),this.updateState({playing:!0},!1),this.hooks.emit("animationStart")},o.prototype.pause=function(){var e=this;this.paths.forEach(function(n,t){e.stopPathAnimation(t,!0)}),this.updateState({playing:!1},!1),this.hooks.emit("animationStop")},o.prototype.reset=function(){var e=this;this.paths.forEach(function(n,t){e.stopPathAnimation(t)}),this.paths.forEach(function(n){n.isInitialAnimation=!0,n.isPathlineInitialAnimation=!0,n.subMeshUnfoldProgress=0,n.subMeshUnfoldStarted=!1,n.subMeshUnfoldStartTime=0,n.lastAnimationProgress=0,n.cycleStartTime=performance.now()/1e3,n.lastUpdateTime=performance.now()/1e3,n.startOffset=0,n.endOffset=0,n.isPaused=!1,n.pausedProgress=0,n.pausedTime=0,n.lines.forEach(function(s){s.visible=!0,s.material.uniforms.time.value=0,s.material.uniforms.animationProgress.value=0,s.material.uniforms.startOffset.value=0,s.material.uniforms.endOffset.value=0}),n.particles.visible=!0;for(var t=e._config.particleCount,r=0;r<t;r++){var l=n.particleInfos[r];l.active=!1,l.age=0,l.alpha=0,n.particlePositions[r*3]=9999,n.particlePositions[r*3+1]=9999,n.particlePositions[r*3+2]=9999}n.particleGeometry.attributes.position.needsUpdate=!0,n.subMeshMaterial&&(n.subMeshMaterial.uniforms.unfoldProgress.value=0,n.subMeshMaterial.uniforms.animationProgress.value=0,n.subMeshMaterial.uniforms.startOffset.value=0,n.subMeshMaterial.uniforms.endOffset.value=0)})},o.prototype.highlightPath=function(e,n){var t=this,r=this.paths.get(e);if(r)var l=r.lines,s=0,d=250,c=de.AnimationFrameLoop.shared.add(function(m,y){s=Math.min(1,s+y/d),n?(l.forEach(function(A){A.material.uniforms.opacity.value=.3+s*.7}),r.particleMaterial.opacity=.3+s*.7,r.enableSubMesh&&(r.subMeshMaterial.uniforms.globalOpacity.value=.3+s*.7)):(l.forEach(function(A){A.material.uniforms.opacity.value=1-s*.7}),r.particleMaterial.opacity=.6*(1-s*.7),r.enableSubMesh&&(r.subMeshMaterial.uniforms.globalOpacity.value=1-s*.7)),t.five.needsRender=!0,s===1&&c()})},o.prototype.updateScreenProjection=function(e){var n=this,t=function(l){var s=n.projectPointsToScreen(l.config.points,n.five.camera),d=n.findNearestOffscreenPoint(s);d&&(l.startOffset=d.distance);var c=n.findFarestOffscreenPoint(s);c&&(l.endOffset=c.totalLength-c.distance),l.lines.forEach(function(m){m.material.uniforms.startOffset.value=l.startOffset,m.material.uniforms.endOffset.value=l.endOffset}),l.subMeshMaterial.uniforms.startOffset.value=l.startOffset,l.subMeshMaterial.uniforms.endOffset.value=l.endOffset,l.cycleStartTime=performance.now()/1e3,l.lastAnimationProgress=0};if(e){var r=this.paths.get(e);r&&t(r)}else this.paths.forEach(function(l){l.enabled&&t(l)})},o.prototype.disposePathResources=function(e){var n=this;e.lines.forEach(function(t){n.five.scene.remove(t),t.geometry.dispose(),t.material.dispose()}),this.five.scene.remove(e.particles),e.particleGeometry.dispose(),e.particleMaterial.dispose(),this.five.scene.remove(e.subMesh),e.subMeshGeometry.dispose(),e.subMeshMaterial.dispose()},o.prototype.dispose=function(){this.pause(),this.clearAllPaths(),this.hooks.emit("dispose")},o})(lt.BasePlugin.Controller),xn=function(h,o){return new Sn(h,o)};ee.BackgroundPlugin=yn,ee.CSS3DRenderer=Ft,ee.DynamicPathLinePlugin=xn,ee.ItemMaskPlugin=dn,ee.OrbitControls=Ne,ee.OrientationPlugin=mn,ee.PanoAnimePlugin=En,ee.RoundedBoxGeometry=It,ee.TrajectoryPlugin=wn,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}));
|
|
815
|
+
`})},s.prototype.projectPointsToScreen=function(e,n){for(var t=[],r=0,l=0;l<e.length;l++){var i=e[l];l>0&&(r+=i.distanceTo(e[l-1]));var h=i.clone().project(n),c=h.x<-1||h.x>1||h.y<-1||h.y>1||h.z<-1||h.z>1;t.push({point:i.clone(),screenPos:new p.Vector2(h.x,h.y),distanceFromStart:r,isOffscreen:c})}return t},s.prototype.findNearestOffscreenPoint=function(e){for(var n=-1,t=0,r=-1,l=0;l<e.length;l++)if(!e[l].isOffscreen){r=l;break}if(r===-1)return null;for(var l=r-1;l>=0;l--)if(e[l].isOffscreen){n=l,t=e[l].distanceFromStart;break}return n===-1?{index:0,distance:0}:{index:n,distance:t}},s.prototype.findFarestOffscreenPoint=function(e){for(var n,t=((n=e[e.length-1])===null||n===void 0?void 0:n.distanceFromStart)||0,r=-1,l=e.length-1;l>=0;l--)if(!e[l].isOffscreen){r=l;break}if(r===-1)return null;var i=r+1;return i<e.length&&e[i].isOffscreen?{index:i,distance:e[i].distanceFromStart,totalLength:t}:{index:e.length-1,distance:t,totalLength:t}},s.prototype.updatePathAnimation=function(e){var n,t,r=this.paths.get(e);if(!(!r||!r.enabled)){var l=performance.now()/1e3,i=this._config,h=i.particleCount,c=i.maxDistance,d=((n=r.lines[0])===null||n===void 0?void 0:n.material.uniforms.totalLength.value)||1,y=Math.max(.01,d-r.startOffset-r.endOffset),S=r.speed,w=(l-r.cycleStartTime)*S/y%1;if(r.isInitialAnimation){var M=w*y;if(r.enableSubMesh&&M>=1&&!r.subMeshUnfoldStarted&&(r.subMeshUnfoldStarted=!0,r.subMeshUnfoldStartTime=l),r.enableSubMesh&&r.subMeshUnfoldStarted&&r.subMeshUnfoldProgress<1&&!r.isPaused){var E=(t=r.config.range)!==null&&t!==void 0?t:this._config.range,O=l-r.subMeshUnfoldStartTime;r.subMeshUnfoldProgress=Math.min(1,O*S/(y-2*E)),r.subMeshMaterial.uniforms.unfoldProgress.value=r.subMeshUnfoldProgress}w<r.lastAnimationProgress&&(r.isPathlineInitialAnimation=!1,(!r.enableSubMesh||r.subMeshUnfoldProgress>=1)&&(r.isInitialAnimation=!1))}else r.enableSubMesh&&(r.subMeshMaterial.uniforms.unfoldProgress.value=1);if(r.lastAnimationProgress=w,r.lastUpdateTime=l,r.isPathlineInitialAnimation&&r.lines.forEach(function(Y){Y.material.uniforms.time.value=l,Y.material.uniforms.animationProgress.value=w}),r.isPathlineInitialAnimation){var A=null,b=1/0;if(r.lines.forEach(function(Y){for(var Z=Y.geometry,J=Z.attributes.instanceDistanceStart,j=Z.attributes.instanceDistanceEnd,X=J.count,L=0;L<X;L++){var k=J.getX(L)/Y.material.uniforms.totalLength.value,I=j.getX(L)/Y.material.uniforms.totalLength.value;if(w>=k&&w<=I){var B=(w-k)/(I-k),K=new p.Vector3().fromBufferAttribute(Z.attributes.instanceStart,L),ee=new p.Vector3().fromBufferAttribute(Z.attributes.instanceEnd,L),Q=new p.Vector3().lerpVectors(K,ee,B),U=Math.abs(w-(k+I)/2);U<b&&(b=U,A=Q)}}}),A)for(var T=0;T<h;T++){var f=r.particleInfos[T];!f.active&&Math.random()<.05&&(f.active=!0,f.age=0,f.life=3+Math.random()*2,f.velocity.set((Math.random()-.5)*1e-4,(Math.random()-.5)*1e-4,(Math.random()-.5)*1e-4),r.particlePositions[T*3]=A.x,r.particlePositions[T*3+1]=A.y,r.particlePositions[T*3+2]=A.z,f.startPos.copy(A),f.alpha=0)}for(var T=0;T<h;T++){var f=r.particleInfos[T];if(f.active){f.age+=.016;var C=r.particlePositions[T*3]-f.startPos.x,x=r.particlePositions[T*3+1]-f.startPos.y,F=r.particlePositions[T*3+2]-f.startPos.z,G=Math.sqrt(C*C+x*x+F*F);(G>=c||f.age>=f.life)&&(f.active=!1,r.particlePositions[T*3]=9999,r.particlePositions[T*3+1]=9999,r.particlePositions[T*3+2]=9999,f.alpha=0),f.velocity.x+=(Math.random()-.5)*1e-4,f.velocity.z+=(Math.random()-.5)*1e-4,f.velocity.y+=1e-4,f.velocity.multiplyScalar(.99),r.particlePositions[T*3]+=f.velocity.x,r.particlePositions[T*3+1]+=f.velocity.y,r.particlePositions[T*3+2]+=f.velocity.z;var W=f.age/f.life;W<.2?f.alpha=W/.2:W>.8?f.alpha=(1-W)/.2:f.alpha=1}}r.particleGeometry.attributes.position.needsUpdate=!0,r.particleMaterial.opacity=.6}r.enableSubMesh&&(r.subMeshMaterial.uniforms.animationProgress.value=w),this.five.needsRender=!0}},s.prototype.startPathAnimation=function(e,n){var t=this,r,l,i=this.paths.get(e);if(!i)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1;if(i.animationId!==null)return!1;var h=(r=n==null?void 0:n.startPointIndex)!==null&&r!==void 0?r:0,c=(l=n==null?void 0:n.fromStart)!==null&&l!==void 0?l:!1;if(!i.isPaused||c){var d=0,y=h;if(y>0){var S=i.config.points;y>=S.length&&(console.warn("DynamicPathLinePlugin: startPointIndex ".concat(y," 超出范围,路径只有 ").concat(S.length," 个点")),y=S.length-1);for(var w=0;w<y;w++)d+=S[w].distanceTo(S[w+1])}i.startOffset=d,i.lines.forEach(function(T){T.material.uniforms.startOffset.value=d}),i.enableSubMesh&&(i.subMeshMaterial.uniforms.startOffset.value=d)}var M=performance.now()/1e3;if(!c&&i.isPaused&&i.pausedProgress>0){var E=i.curve.getLength(),O=Math.max(.01,E-i.startOffset-i.endOffset),A=i.speed;if(i.cycleStartTime=M-i.pausedProgress*O/A,i.subMeshUnfoldStarted&&i.subMeshUnfoldProgress<1){var b=i.pausedTime-i.subMeshUnfoldStartTime;i.subMeshUnfoldStartTime=M-b}i.isPaused=!1}else i.cycleStartTime=M,i.isPaused=!1,i.pausedProgress=0;return i.lastUpdateTime=M,this.highlightPath(e,!0),i.animationId=fe.AnimationFrameLoop.shared.add(function(){t.updatePathAnimation(e)}),!0},s.prototype.stopPathAnimation=function(e,n){n===void 0&&(n=!1);var t=this.paths.get(e);if(!t)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1;if(this.highlightPath(e,!1),t.animationId!==null){if(n){var r=performance.now()/1e3,l=t.curve.getLength(),i=Math.max(.01,l-t.startOffset-t.endOffset),h=t.speed;if(t.pausedProgress=(r-t.cycleStartTime)*h/i%1,t.pausedTime=r,t.isPaused=!0,t.subMeshUnfoldStarted&&t.subMeshUnfoldProgress<1){var c=r-t.subMeshUnfoldStartTime;t.subMeshUnfoldStartTime=r-c}}else t.isPaused=!1,t.pausedProgress=0,t.pausedTime=0;t.animationId(),t.animationId=null}return!0},s.prototype._enable=function(e){this.paths.size>0&&this.state.playing&&this.play()},s.prototype._disable=function(e){this.pause()},s.prototype.enable=function(e){var n;if(!this.state.enabled){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!0},t),this._enable({userAction:t})}},s.prototype.disable=function(e){var n;if(this.state.enabled!==!1){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!1},t),this._disable({userAction:t})}},s.prototype.show=function(e){var n,t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.paths.forEach(function(r){r.lines.forEach(function(l){return l.visible=!0}),r.particles.visible=!0,r.subMesh.visible=!0}),this.updateState({visible:!0},t)},s.prototype.hide=function(e){var n,t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.paths.forEach(function(r){r.lines.forEach(function(l){return l.visible=!1}),r.particles.visible=!1,r.subMesh.visible=!1}),this.updateState({visible:!1},t)},s.prototype.setState=function(e,n){var t;t=n==null?void 0:n.userAction,e.enabled!==void 0&&e.enabled!==this.state.enabled&&(e.enabled?this.enable(n):this.disable(n)),e.visible!==void 0&&e.visible!==this.state.visible&&(e.visible?this.show(n):this.hide(n))},s.prototype.play=function(e){var n=this;e===void 0&&(e=!1),this.paths.forEach(function(t,r){n.startPathAnimation(r,{fromStart:e})}),this.updateState({playing:!0},!1),this.hooks.emit("animationStart")},s.prototype.pause=function(){var e=this;this.paths.forEach(function(n,t){e.stopPathAnimation(t,!0)}),this.updateState({playing:!1},!1),this.hooks.emit("animationStop")},s.prototype.reset=function(){var e=this;this.paths.forEach(function(n,t){e.stopPathAnimation(t)}),this.paths.forEach(function(n){n.isInitialAnimation=!0,n.isPathlineInitialAnimation=!0,n.subMeshUnfoldProgress=0,n.subMeshUnfoldStarted=!1,n.subMeshUnfoldStartTime=0,n.lastAnimationProgress=0,n.cycleStartTime=performance.now()/1e3,n.lastUpdateTime=performance.now()/1e3,n.startOffset=0,n.endOffset=0,n.isPaused=!1,n.pausedProgress=0,n.pausedTime=0,n.lines.forEach(function(i){i.visible=!0,i.material.uniforms.time.value=0,i.material.uniforms.animationProgress.value=0,i.material.uniforms.startOffset.value=0,i.material.uniforms.endOffset.value=0}),n.particles.visible=!0;for(var t=e._config.particleCount,r=0;r<t;r++){var l=n.particleInfos[r];l.active=!1,l.age=0,l.alpha=0,n.particlePositions[r*3]=9999,n.particlePositions[r*3+1]=9999,n.particlePositions[r*3+2]=9999}n.particleGeometry.attributes.position.needsUpdate=!0,n.subMeshMaterial&&(n.subMeshMaterial.uniforms.unfoldProgress.value=0,n.subMeshMaterial.uniforms.animationProgress.value=0,n.subMeshMaterial.uniforms.startOffset.value=0,n.subMeshMaterial.uniforms.endOffset.value=0)})},s.prototype.highlightPath=function(e,n){var t=this,r=this.paths.get(e);if(r)var l=r.lines,i=0,h=250,c=fe.AnimationFrameLoop.shared.add(function(d,y){i=Math.min(1,i+y/h),n?(l.forEach(function(S){S.material.uniforms.opacity.value=.3+i*.7}),r.particleMaterial.opacity=.3+i*.7,r.enableSubMesh&&(r.subMeshMaterial.uniforms.globalOpacity.value=.3+i*.7)):(l.forEach(function(S){S.material.uniforms.opacity.value=1-i*.7}),r.particleMaterial.opacity=.6*(1-i*.7),r.enableSubMesh&&(r.subMeshMaterial.uniforms.globalOpacity.value=1-i*.7)),t.five.needsRender=!0,i===1&&c()})},s.prototype.updateScreenProjection=function(e){var n=this,t=function(l){var i=n.projectPointsToScreen(l.config.points,n.five.camera),h=n.findNearestOffscreenPoint(i);h&&(l.startOffset=h.distance);var c=n.findFarestOffscreenPoint(i);c&&(l.endOffset=c.totalLength-c.distance),l.lines.forEach(function(d){d.material.uniforms.startOffset.value=l.startOffset,d.material.uniforms.endOffset.value=l.endOffset}),l.subMeshMaterial.uniforms.startOffset.value=l.startOffset,l.subMeshMaterial.uniforms.endOffset.value=l.endOffset,l.cycleStartTime=performance.now()/1e3,l.lastAnimationProgress=0};if(e){var r=this.paths.get(e);r&&t(r)}else this.paths.forEach(function(l){l.enabled&&t(l)})},s.prototype.disposePathResources=function(e){var n=this;e.lines.forEach(function(t){n.five.scene.remove(t),t.geometry.dispose(),t.material.dispose()}),this.five.scene.remove(e.particles),e.particleGeometry.dispose(),e.particleMaterial.dispose(),this.five.scene.remove(e.subMesh),e.subMeshGeometry.dispose(),e.subMeshMaterial.dispose()},s.prototype.dispose=function(){this.pause(),this.clearAllPaths(),this.hooks.emit("dispose")},s})(lt.BasePlugin.Controller),xn=function(v,s){return new En(v,s)};re.BackgroundPlugin=yn,re.CSS3DRenderer=kt,re.DynamicPathLinePlugin=xn,re.ItemMaskPlugin=vn,re.OrbitControls=De,re.OrientationPlugin=mn,re.PanoAnimePlugin=Sn,re.RoundedBoxGeometry=Lt,re.TrajectoryPlugin=wn,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})}));
|