import{h as e,toRef as t,watch as i,inject as r}from"vue";import{Vector2 as s,Vector3 as n,Plane as a,Raycaster as o,WebGLRenderer as h,OrthographicCamera as u,PerspectiveCamera as d,Group as m,Scene as c,Color as l,BoxBufferGeometry as f,CircleBufferGeometry as p,ConeBufferGeometry as g,CylinderBufferGeometry as y,DodecahedronBufferGeometry as b,IcosahedronBufferGeometry as v,LatheBufferGeometry as S,OctahedronBufferGeometry as N,PolyhedronBufferGeometry as w,RingBufferGeometry as x,SphereBufferGeometry as _,TetrahedronBufferGeometry as C,TorusBufferGeometry as M,TorusKnotBufferGeometry as G,Curve as I,TubeBufferGeometry as P,AmbientLight as z,DirectionalLight as R,PointLight as B,SpotLight as E,FrontSide as L,MeshBasicMaterial as j,MeshLambertMaterial as k,TextureLoader as T,MeshMatcapMaterial as O,MeshPhongMaterial as A,MeshStandardMaterial as F,MeshPhysicalMaterial as U,ShaderChunk as D,UniformsUtils as $,ShaderLib as H,ShaderMaterial as W,MeshToonMaterial as V,CubeTextureLoader as X,CubeRefractionMapping as q,Mesh as Z,PlaneBufferGeometry as K,FontLoader as Y,TextBufferGeometry as J,WebGLCubeRenderTarget as Q,RGBFormat as ee,LinearMipmapLinearFilter as te,CubeCamera as ie,BackSide as re,DoubleSide as se,InstancedMesh as ne,SpriteMaterial as ae,Sprite as oe}from"three";import{OrbitControls as he}from"three/examples/jsm/controls/OrbitControls.js";import{EffectComposer as ue}from"three/examples/jsm/postprocessing/EffectComposer.js";import{RenderPass as de}from"three/examples/jsm/postprocessing/RenderPass.js";import{BokehPass as me}from"three/examples/jsm/postprocessing/BokehPass.js";import{FilmPass as ce}from"three/examples/jsm/postprocessing/FilmPass.js";import{ShaderPass as le}from"three/examples/jsm/postprocessing/ShaderPass.js";import{FXAAShader as fe}from"three/examples/jsm/shaders/FXAAShader.js";import{HalftonePass as pe}from"three/examples/jsm/postprocessing/HalftonePass.js";import{SMAAPass as ge}from"three/examples/jsm/postprocessing/SMAAPass.js";import{UnrealBloomPass as ye}from"three/examples/jsm/postprocessing/UnrealBloomPass.js";function be(){var e={canvas:null,antialias:!0,alpha:!1,autoClear:!0,orbit_ctrl:!1,mouse_move:!1,mouse_raycast:!1,mouse_over:!1,click:!1,resize:!0,width:0,height:0},t={width:1,height:1,wWidth:1,wHeight:1,ratio:1},i=[],r=[],u=[],d=new s,m=new n,c=new a(new n(0,0,1),0),l=new o,f=[],p={conf:e,renderer:null,camera:null,cameraCtrl:null,materials:{},scene:null,size:t,mouse:d,mouseV3:m,init:function(t){t&&Object.entries(t).forEach((function(t){var i=t[0],r=t[1];e[i]=r}));if(!p.scene)return void console.error("Missing Scene");if(!p.camera)return void console.error("Missing Camera");p.renderer=new h({canvas:e.canvas,antialias:e.antialias,alpha:e.alpha}),p.renderer.autoClear=e.autoClear,e.orbit_ctrl&&(p.orbitCtrl=new he(p.camera,p.renderer.domElement),e.orbit_ctrl instanceof Object&&Object.entries(e.orbit_ctrl).forEach((function(e){var t=e[0],i=e[1];p.orbitCtrl[t]=i})));e.width&&e.height?w(e.width,e.height):e.resize&&(N(),window.addEventListener("resize",N));e.mouse_move=e.mouse_move||e.mouse_over,e.mouse_move&&("body"===e.mouse_move?p.mouse_move_element=document.body:p.mouse_move_element=p.renderer.domElement,p.mouse_move_element.addEventListener("mousemove",b),p.mouse_move_element.addEventListener("mouseleave",v));e.click&&p.renderer.domElement.addEventListener("click",y);return i.forEach((function(e){return e()})),!0},dispose:function(){u=[],window.removeEventListener("resize",N),p.mouse_move_element&&(p.mouse_move_element.removeEventListener("mousemove",b),p.mouse_move_element.removeEventListener("mouseleave",v));p.renderer.domElement.removeEventListener("click",y),p.orbitCtrl&&p.orbitCtrl.dispose();this.renderer.dispose()},render:function(){p.orbitCtrl&&p.orbitCtrl.update();u.forEach((function(e){return e()})),p.renderer.render(p.scene,p.camera)},renderC:function(){p.orbitCtrl&&p.orbitCtrl.update();u.forEach((function(e){return e()})),p.composer.render()},setSize:w,onAfterInit:function(e){i.push(e)},onAfterResize:function(e){r.push(e)},offAfterResize:function(e){r=r.filter((function(t){return t!==e}))},onBeforeRender:function(e){u.push(e)},offBeforeRender:function(e){u=u.filter((function(t){return t!==e}))},addIntersectObject:function(e){-1===f.indexOf(e)&&f.push(e)},removeIntersectObject:function(e){var t=f.indexOf(e);-1!==t&&f.splice(t,1)}};function g(e){var i=e.target.getBoundingClientRect();d.x=(e.clientX-i.left)/t.width*2-1,d.y=-(e.clientY-i.top)/t.height*2+1}function y(e){g(e),l.setFromCamera(d,p.camera);for(var t=l.intersectObjects(f),i=0;i1?1:i)}function xe(e,t,i){e.x=we(e.x,t.x,i),e.y=we(e.y,t.y,i)}function _e(e,t,i){e.x=we(e.x,t.x,i),e.y=we(e.y,t.y,i),e.z=we(e.z,t.z,i)}function Ce(e,t,i){return ei?i:e}function Me(e,t){return void 0===t&&(t=1024),"https://rawcdn.githack.com/emmelleppi/matcaps/9b36ccaaf0a24881a39062d05566c9e92be4aa0d/"+t+"/"+(""+e+function(e){switch(e){case 64:return"-64px";case 128:return"-128px";case 256:return"-256px";case 512:return"-512px";default:return""}}(t)+".png")}function Ge(e,r,s){if(e[r]){var n=t(e,r);Se(s,n.value),i(n,(function(){Se(s,n.value)}),{deep:!0})}}var Ie={inject:["three"],props:{left:{type:Number,default:-1},right:{type:Number,default:1},top:{type:Number,default:1},bottom:{type:Number,default:-1},near:{type:Number,default:.1},far:{type:Number,default:2e3},zoom:{type:Number,default:1},position:{type:[Object,n],default:{x:0,y:0,z:0}}},created:function(){var e=this;this.camera=new u(this.left,this.right,this.top,this.bottom,this.near,this.far),Ge(this,"position",this.camera.position),["left","right","top","bottom","near","far","zoom"].forEach((function(t){i((function(){return e[t]}),(function(){e.camera[t]=e[t],e.camera.updateProjectionMatrix()}))})),this.three.camera=this.camera},render:function(){return[]},__hmrId:"OrthographicCamera"},Pe={inject:["three"],props:{aspect:{type:Number,default:1},far:{type:Number,default:2e3},fov:{type:Number,default:50},near:{type:Number,default:.1},position:{type:[Object,n],default:{x:0,y:0,z:0}}},created:function(){var e=this;this.camera=new d(this.fov,this.aspect,this.near,this.far),Ge(this,"position",this.camera.position),["aspect","far","fov","near"].forEach((function(t){i((function(){return e[t]}),(function(){e.camera[t]=e[t],e.camera.updateProjectionMatrix()}))})),this.three.camera=this.camera},render:function(){return[]},__hmrId:"PerspectiveCamera"},ze={inject:["three","scene"],props:{position:Object,rotation:Object,scale:Object},setup:function(e){var t=r("group",r("scene")),i=new m;return Ge(e,"position",i.position),Ge(e,"rotation",i.rotation),Ge(e,"scale",i.scale),{parent:t,group:i}},provide:function(){return{group:this.group}},created:function(){this.parent.add(this.group)},unmounted:function(){this.parent.remove(this.group)},render:function(){return this.$slots.default?this.$slots.default():[]},__hmrId:"Group"},Re={inject:["three"],props:{id:String,background:[String,Number]},setup:function(e){var t=new c;return e.background&&(t.background=new l(e.background)),i((function(){return e.background}),(function(e){t.background=new l(e)})),{scene:t}},provide:function(){return{scene:this.scene}},mounted:function(){this.three.scene||(this.three.scene=this.scene)},methods:{},render:function(){return this.$slots.default?this.$slots.default():[]}},Be={emits:["ready"],inject:["mesh"],props:{rotateX:Number,rotateY:Number,rotateZ:Number},created:function(){var e=this;this.mesh||console.error("Missing parent Mesh"),this.watchProps=[],Object.entries(this.$props).forEach((function(t){return e.watchProps.push(t[0])}))},beforeMount:function(){this.createGeometry(),this.rotateGeometry(),this.mesh.setGeometry(this.geometry)},mounted:function(){this.addWatchers()},unmounted:function(){this.geometry.dispose()},methods:{rotateGeometry:function(){this.rotateX&&this.geometry.rotateX(this.rotateX),this.rotateY&&this.geometry.rotateY(this.rotateY),this.rotateZ&&this.geometry.rotateZ(this.rotateZ)},addWatchers:function(){var e=this;this.watchProps.forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},refreshGeometry:function(){var e=this.geometry;this.createGeometry(),this.rotateGeometry(),this.mesh.setGeometry(this.geometry),e.dispose()}},render:function(){return[]}},Ee={extends:Be,props:{size:Number,width:{type:Number,default:1},height:{type:Number,default:1},depth:{type:Number,default:1},widthSegments:{type:Number,default:1},heightSegments:{type:Number,default:1},depthSegments:{type:Number,default:1}},methods:{createGeometry:function(){var e=this.width,t=this.height,i=this.depth;this.size&&(e=this.size,t=this.size,i=this.size),this.geometry=new f(e,t,i,this.widthSegments,this.heightSegments,this.depthSegments)}}},Le={extends:Be,props:{radius:{type:Number,default:1},segments:{type:Number,default:8},thetaStart:{type:Number,default:0},thetaLength:{type:Number,default:2*Math.PI}},methods:{createGeometry:function(){this.geometry=new p(this.radius,this.segments,this.thetaStart,this.thetaLength)}}},je={extends:Be,props:{radius:{type:Number,default:1},height:{type:Number,default:1},radialSegments:{type:Number,default:8},heightSegments:{type:Number,default:1},openEnded:{type:Boolean,default:!1},thetaStart:{type:Number,default:0},thetaLength:{type:Number,default:2*Math.PI}},methods:{createGeometry:function(){this.geometry=new g(this.radius,this.height,this.radialSegments,this.heightSegments,this.openEnded,this.thetaStart,this.thetaLength)}}},ke={extends:Be,props:{radiusTop:{type:Number,default:1},radiusBottom:{type:Number,default:1},height:{type:Number,default:1},radialSegments:{type:Number,default:8},heightSegments:{type:Number,default:1},openEnded:{type:Boolean,default:!1},thetaStart:{type:Number,default:0},thetaLength:{type:Number,default:2*Math.PI}},methods:{createGeometry:function(){this.geometry=new y(this.radiusTop,this.radiusBottom,this.height,this.radialSegments,this.heightSegments,this.openEnded,this.thetaStart,this.thetaLength)}}},Te={extends:Be,props:{radius:{type:Number,default:1},detail:{type:Number,default:0}},methods:{createGeometry:function(){this.geometry=new b(this.radius,this.detail)}}},Oe={extends:Be,props:{radius:{type:Number,default:1},detail:{type:Number,default:0}},methods:{createGeometry:function(){this.geometry=new v(this.radius,this.detail)}}},Ae={extends:Be,props:{points:Array,segments:{type:Number,default:12},phiStart:{type:Number,default:0},phiLength:{type:Number,default:2*Math.PI}},methods:{createGeometry:function(){this.geometry=new S(this.points,this.segments,this.phiStart,this.phiLength)}}},Fe={extends:Be,props:{radius:{type:Number,default:1},detail:{type:Number,default:0}},methods:{createGeometry:function(){this.geometry=new N(this.radius,this.detail)}}},Ue={extends:Be,props:{vertices:Array,indices:Array,radius:{type:Number,default:1},detail:{type:Number,default:0}},methods:{createGeometry:function(){this.geometry=new w(this.vertices,this.indices,this.radius,this.detail)}}},De={extends:Be,props:{innerRadius:{type:Number,default:.5},outerRadius:{type:Number,default:1},thetaSegments:{type:Number,default:8},phiSegments:{type:Number,default:1},thetaStart:{type:Number,default:0},thetaLength:{type:Number,default:2*Math.PI}},methods:{createGeometry:function(){this.geometry=new x(this.innerRadius,this.outerRadius,this.thetaSegments,this.phiSegments,this.thetaStart,this.thetaLength)}}},$e={extends:Be,props:{radius:{type:Number,default:1},widthSegments:{type:Number,default:12},heightSegments:{type:Number,default:12}},methods:{createGeometry:function(){this.geometry=new _(this.radius,this.widthSegments,this.heightSegments)}}},He={extends:Be,props:{radius:{type:Number,default:1},detail:{type:Number,default:0}},methods:{createGeometry:function(){this.geometry=new C(this.radius,this.detail)}}},We={extends:Be,props:{radius:{type:Number,default:1},tube:{type:Number,default:.4},radialSegments:{type:Number,default:8},tubularSegments:{type:Number,default:6},arc:{type:Number,default:2*Math.PI}},methods:{createGeometry:function(){this.geometry=new M(this.radius,this.tube,this.radialSegments,this.tubularSegments,this.arc)}}},Ve={extends:Be,props:{radius:{type:Number,default:1},tube:{type:Number,default:.4},radialSegments:{type:Number,default:64},tubularSegments:{type:Number,default:8},p:{type:Number,default:2},q:{type:Number,default:3}},methods:{createGeometry:function(){this.geometry=new G(this.radius,this.tube,this.radialSegments,this.tubularSegments,this.p,this.q)}}},Xe={extends:Be,props:{path:I,tubularSegments:{type:Number,default:64},radius:{type:Number,default:1},radiusSegments:{type:Number,default:8},closed:{type:Boolean,default:!1}},methods:{createGeometry:function(){this.geometry=new P(this.path,this.tubularSegments,this.radius,this.radiusSegments,this.closed)}}},qe={inject:{scene:"scene",group:{default:null}},props:{color:{type:String,default:"#ffffff"},intensity:{type:Number,default:1},castShadow:{type:Boolean,default:!1},shadowMapSize:Object,position:Object},created:function(){this.parent=this.group?this.group:this.scene},mounted:function(){var e=this;Ge(this,"position",this.light.position),this.light.target&&Ge(this,"target",this.light.target.position),this.light.shadow&&(this.light.castShadow=this.castShadow,Se(this.light.shadow.mapSize,this.shadowMapSize)),["color","intensity","castShadow"].forEach((function(t){i((function(){return e[t]}),(function(){"color"===t?e.light.color=new l(e.color):e.light[t]=e[t]}))})),this.parent.add(this.light),this.light.target&&this.parent.add(this.light.target)},unmounted:function(){this.parent.remove(this.light),this.light.target&&this.parent.remove(this.light.target)},render:function(){return[]},__hmrId:"Light"},Ze={extends:qe,created:function(){this.light=new z(this.color,this.intensity)},__hmrId:"AmbientLight"},Ke={extends:qe,props:{target:Object},created:function(){this.light=new R(this.color,this.intensity)},__hmrId:"DirectionalLight"},Ye={extends:qe,props:{distance:{type:Number,default:0},decay:{type:Number,default:1}},created:function(){this.light=new B(this.color,this.intensity,this.distance,this.decay)},__hmrId:"PointLight"},Je={extends:qe,props:{angle:{type:Number,default:Math.PI/3},decay:{type:Number,default:1},distance:{type:Number,default:0},penumbra:{type:Number,default:0},target:Object},created:function(){var e=this;this.light=new E(this.color,this.intensity,this.distance,this.angle,this.penumbra,this.decay),["angle","decay","distance","penumbra"].forEach((function(t){i((function(){return e[t]}),(function(){e.light[t]=e[t]}))}))},__hmrId:"SpotLight"},Qe={inject:["three","mesh"],props:{id:String,color:{type:[String,Number],default:"#ffffff"},depthTest:{type:Boolean,default:!0},depthWrite:{type:Boolean,default:!0},flatShading:Boolean,fog:{type:Boolean,default:!0},opacity:{type:Number,default:1},side:{type:Number,default:L},transparent:Boolean,vertexColors:Boolean},provide:function(){return{material:this}},beforeMount:function(){this.createMaterial(),this.id&&(this.three.materials[this.id]=this.material),this.mesh.setMaterial(this.material)},mounted:function(){this._addWatchers(),this.addWatchers&&this.addWatchers()},unmounted:function(){this.material.dispose(),this.id&&delete this.three.materials[this.id]},methods:{setProp:function(e,t,i){void 0===i&&(i=!1),this.material[e]=t,this.material.needsUpdate=i},setTexture:function(e,t){void 0===t&&(t="map"),this.setProp(t,e,!0)},_addWatchers:function(){var e=this;["color","depthTest","depthWrite","fog","opacity","side","transparent"].forEach((function(t){i((function(){return e[t]}),(function(){"color"===t?e.material.color.set(e.color):e.material[t]=e[t]}))}))}},render:function(){return this.$slots.default?this.$slots.default():[]},__hmrId:"Material"},et={extends:Qe,methods:{createMaterial:function(){this.material=new j(Ne(this.$props,["id"]))}},__hmrId:"BasicMaterial"},tt={extends:Qe,methods:{createMaterial:function(){this.material=new k(Ne(this.$props,["id"]))}},__hmrId:"LambertMaterial"},it={extends:Qe,props:{src:String,name:String},methods:{createMaterial:function(){var e=this.name?Me(this.name):this.src,t=Ne(this.$props,["id","src","name"]);t.matcap=(new T).load(e),this.material=new O(t)}},__hmrId:"MatcapMaterial"},rt={extends:Qe,props:{emissive:{type:[Number,String],default:0},emissiveIntensity:{type:Number,default:1},reflectivity:{type:Number,default:1},shininess:{type:Number,default:30},specular:{type:[String,Number],default:1118481}},methods:{createMaterial:function(){this.material=new A(Ne(this.$props,["id"]))},addWatchers:function(){var e=this;["emissive","emissiveIntensity","reflectivity","shininess","specular"].forEach((function(t){i((function(){return e[t]}),(function(i){"emissive"===t||"specular"===t?e.material[t].set(i):e.material[t]=i}))}))}},__hmrId:"PhongMaterial"},st={aoMapIntensity:{type:Number,default:1},bumpScale:{type:Number,default:1},displacementBias:{type:Number,default:0},displacementScale:{type:Number,default:1},emissive:{type:[Number,String],default:0},emissiveIntensity:{type:Number,default:1},envMapIntensity:{type:Number,default:1},lightMapIntensity:{type:Number,default:1},metalness:{type:Number,default:0},normalScale:{type:Object,default:function(){return new s(1,1)}},roughness:{type:Number,default:1},refractionRatio:{type:Number,default:.98},wireframe:Boolean},nt={extends:Qe,props:st,methods:{createMaterial:function(){this.material=new F(Ne(this.$props,["id","normalScale"]))},addWatchers:function(){var e=this;Object.keys(st).forEach((function(t){"normalScale"!==t&&i((function(){return e[t]}),(function(i){"emissive"===t?e.material[t].set(i):e.material[t]=i}))})),Ge(this,"normalScale",this.material.normalScale)}},__hmrId:"StandardMaterial"},at={extends:nt,methods:{createMaterial:function(){this.material=new U(Ne(this.$props,["id"]))}},__hmrId:"PhysicalMaterial"};var ot,ht,ut,dt=D.meshphong_frag.slice(0,D.meshphong_frag.indexOf("void main() {")),mt=D.meshphong_frag.slice(D.meshphong_frag.indexOf("void main() {")),ct={uniforms:$.merge([H.phong.uniforms,{thicknessColor:{value:new l(6718871)},thicknessDistortion:{value:.1},thicknessAmbient:{value:0},thicknessAttenuation:{value:.1},thicknessPower:{value:2},thicknessScale:{value:10}}]),vertexShader:"\n #define USE_UV\n "+D.meshphong_vert+"\n ",fragmentShader:"\n #define USE_UV\n #define SUBSURFACE\n\n "+dt+"\n\n uniform float thicknessPower;\n uniform float thicknessScale;\n uniform float thicknessDistortion;\n uniform float thicknessAmbient;\n uniform float thicknessAttenuation;\n uniform vec3 thicknessColor;\n\n void RE_Direct_Scattering(const in IncidentLight directLight, const in vec2 uv, const in GeometricContext geometry, inout ReflectedLight reflectedLight) {\n #ifdef USE_COLOR\n vec3 thickness = vColor * thicknessColor;\n #else\n vec3 thickness = thicknessColor;\n #endif\n vec3 scatteringHalf = normalize(directLight.direction + (geometry.normal * thicknessDistortion));\n float scatteringDot = pow(saturate(dot(geometry.viewDir, -scatteringHalf)), thicknessPower) * thicknessScale;\n vec3 scatteringIllu = (scatteringDot + thicknessAmbient) * thickness;\n reflectedLight.directDiffuse += scatteringIllu * thicknessAttenuation * directLight.color;\n }\n "+mt.replace("#include ",(ot=D.lights_fragment_begin,ht="RE_Direct( directLight, geometry, material, reflectedLight );",ut="\n RE_Direct( directLight, geometry, material, reflectedLight );\n #if defined( SUBSURFACE ) && defined( USE_UV )\n RE_Direct_Scattering(directLight, vUv, geometry, reflectedLight);\n #endif\n ",ot.split(ht).join(ut)))},lt={extends:{inject:["three","mesh"],props:{id:String,uniforms:Object,vertexShader:String,fragmentShader:String},beforeMount:function(){this.createMaterial(),this.id&&(this.three.materials[this.id]=this.material),this.mesh.setMaterial(this.material)},mounted:function(){this.addWatchers&&this.addWatchers()},unmounted:function(){this.material.dispose(),this.id&&delete this.three.materials[this.id]},render:function(){return[]},__hmrId:"ShaderMaterial"},props:{color:{type:String,default:"#ffffff"},thicknessColor:{type:String,default:"#ffffff"},thicknessDistortion:{type:Number,default:.4},thicknessAmbient:{type:Number,default:.01},thicknessAttenuation:{type:Number,default:.7},thicknessPower:{type:Number,default:2},thicknessScale:{type:Number,default:4},transparent:{type:Boolean,default:!1},opacity:{type:Number,default:1},vertexColors:{type:Boolean,default:!1}},methods:{createMaterial:function(){var e=ct,t=$.clone(e.uniforms);Object.entries(this.$props).forEach((function(e){var i=e[0],r=e[1],s=i,n=r;["color","thicknessColor"].includes(i)&&("color"===i&&(s="diffuse"),n=new l(r)),["id","transparent","vertexColors"].includes(i)||(t[s].value=n)})),this.material=new W(Object.assign({},e,{uniforms:t,lights:!0,transparent:this.transparent,vertexColors:this.vertexColors}))}},__hmrId:"SubSurfaceMaterial"},ft={extends:Qe,methods:{createMaterial:function(){this.material=new V(Ne(this.$props,["id"]))}},__hmrId:"ToonMaterial"},pt={inject:["material"],emits:["loaded"],props:{src:String,onLoad:Function,onProgress:Function,onError:Function,id:{type:String,default:"map"}},created:function(){var e=this;this.refreshTexture(),i((function(){return e.src}),this.refreshTexture)},unmounted:function(){this.material.setTexture(null,this.id),this.texture.dispose()},methods:{createTexture:function(){this.texture=(new T).load(this.src,this.onLoaded,this.onProgress,this.onError)},refreshTexture:function(){this.createTexture(),this.material.setTexture(this.texture,this.id)},onLoaded:function(){this.onLoad&&this.onLoad(),this.$emit("loaded")}},render:function(){return[]}},gt={inject:["material"],emits:["loaded"],props:{path:String,urls:{type:Array,default:["px.jpg","nx.jpg","py.jpg","ny.jpg","pz.jpg","nz.jpg"]},onLoad:Function,onProgress:Function,onError:Function,id:{type:String,default:"envMap"},refraction:Boolean,refractionRatio:{type:Number,default:.98}},created:function(){var e=this;this.refreshTexture(),i((function(){return e.path}),this.refreshTexture),i((function(){return e.urls}),this.refreshTexture)},unmounted:function(){this.material.setTexture(null,this.id),this.texture.dispose()},methods:{createTexture:function(){this.texture=(new X).setPath(this.path).load(this.urls,this.onLoaded,this.onProgress,this.onError)},refreshTexture:function(){this.createTexture(),this.material.setTexture(this.texture,this.id),this.refraction&&(this.texture.mapping=q,this.material.setProp("refractionRatio",this.refractionRatio))},onLoaded:function(){this.onLoad&&this.onLoad(),this.$emit("loaded")}},render:function(){return[]}},yt={inject:{three:"three",scene:"scene",rendererComponent:"rendererComponent",group:{default:null}},emits:["ready"],props:{materialId:String,position:Object,rotation:Object,scale:Object,castShadow:Boolean,receiveShadow:Boolean,onHover:Function,onClick:Function},created:function(){this.parent=this.group?this.group:this.scene},provide:function(){return{mesh:this}},mounted:function(){this.geometry&&!this.mesh&&this.initMesh()},unmounted:function(){this.mesh&&(this.three.removeIntersectObject(this.mesh),this.parent.remove(this.mesh)),this.geometry&&this.geometry.dispose(),this.material&&!this.materialId&&this.material.dispose()},methods:{initMesh:function(){var e=this;!this.material&&this.materialId&&(this.material=this.three.materials[this.materialId]),this.mesh=new Z(this.geometry,this.material),this.onHover&&(this.mesh.onHover=function(t){e.onHover({component:e,over:t})},this.three.addIntersectObject(this.mesh)),this.onClick&&(this.mesh.onClick=function(t){e.onClick({component:e,event:t})},this.three.addIntersectObject(this.mesh)),this.bindProps(),this.parent.add(this.mesh),this.$emit("ready")},bindProps:function(){var e=this;Ge(this,"position",this.mesh.position),Ge(this,"rotation",this.mesh.rotation),Ge(this,"scale",this.mesh.scale),["castShadow","receiveShadow"].forEach((function(t){e.mesh[t]=e[t],i((function(){return e[t]}),(function(){e.mesh[t]=e[t]}))})),i((function(){return e.materialId}),(function(){e.mesh.material=e.three.materials[e.materialId]}))},setGeometry:function(e){this.geometry=e,this.mesh&&(this.mesh.geometry=e)},setMaterial:function(e){this.material=e,this.mesh&&(this.mesh.material=e)},refreshGeometry:function(){var e=this.geometry;this.createGeometry(),this.mesh.geometry=this.geometry,e.dispose()}},render:function(){return this.$slots.default?this.$slots.default():[]},__hmrId:"Mesh"},bt={extends:yt,props:{size:Number,width:{type:Number,default:1},height:{type:Number,default:1},depth:{type:Number,default:1},widthSegments:{type:Number,default:1},heightSegments:{type:Number,default:1},depthSegments:{type:Number,default:1}},created:function(){var e=this;this.createGeometry(),["size","width","height","depth","widthSegments","heightSegments","depthSegments"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.size?this.geometry=new f(this.size,this.size,this.size):this.geometry=new f(this.width,this.height,this.depth)}},__hmrId:"Box"},vt={extends:yt,props:{radius:{type:Number,default:1},segments:{type:Number,default:8},thetaStart:{type:Number,default:0},thetaLength:{type:Number,default:2*Math.PI}},created:function(){var e=this;this.createGeometry();["radius","segments","thetaStart","thetaLength"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new p(this.radius,this.segments,this.thetaStart,this.thetaLength)}},__hmrId:"Circle"},St={extends:yt,props:{radius:{type:Number,default:1},height:{type:Number,default:1},radialSegments:{type:Number,default:8},heightSegments:{type:Number,default:1},openEnded:{type:Boolean,default:!1},thetaStart:{type:Number,default:0},thetaLength:{type:Number,default:2*Math.PI}},created:function(){var e=this;this.createGeometry();["radius","height","radialSegments","heightSegments","openEnded","thetaStart","thetaLength"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new g(this.radius,this.height,this.radialSegments,this.heightSegments,this.openEnded,this.thetaStart,this.thetaLength)}},__hmrId:"Cone"},Nt={extends:yt,props:{radiusTop:{type:Number,default:1},radiusBottom:{type:Number,default:1},height:{type:Number,default:1},radialSegments:{type:Number,default:8},heightSegments:{type:Number,default:1},openEnded:{type:Boolean,default:!1},thetaStart:{type:Number,default:0},thetaLength:{type:Number,default:2*Math.PI}},created:function(){var e=this;this.createGeometry();["radiusTop","radiusBottom","height","radialSegments","heightSegments","openEnded","thetaStart","thetaLength"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new y(this.radiusTop,this.radiusBottom,this.height,this.radialSegments,this.heightSegments,this.openEnded,this.thetaStart,this.thetaLength)}},__hmrId:"Cylinder"},wt={extends:yt,props:{radius:{type:Number,default:1},detail:{type:Number,default:0}},created:function(){var e=this;this.createGeometry();["radius","detail"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new b(this.radius,this.detail)}},__hmrId:"Dodecahedron"},xt={extends:yt,props:{radius:{type:Number,default:1},detail:{type:Number,default:0}},created:function(){var e=this;this.createGeometry();["radius","detail"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new v(this.radius,this.detail)}},__hmrId:"Icosahedron"},_t={extends:yt,props:{points:Array,segments:{type:Number,default:12},phiStart:{type:Number,default:0},phiLength:{type:Number,default:2*Math.PI}},created:function(){var e=this;this.createGeometry();["points","segments","phiStart","phiLength"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new S(this.points,this.segments,this.phiStart,this.phiLength)}},__hmrId:"Lathe"},Ct={extends:yt,props:{radius:{type:Number,default:1},detail:{type:Number,default:0}},created:function(){var e=this;this.createGeometry();["radius","detail"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new N(this.radius,this.detail)}},__hmrId:"Octahedron"},Mt={extends:yt,props:{width:{type:Number,default:1},height:{type:Number,default:1},widthSegments:{type:Number,default:1},heightSegments:{type:Number,default:1}},created:function(){var e=this;this.createGeometry();["width","height","widthSegments","heightSegments"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new K(this.width,this.height,this.widthSegments,this.heightSegments)}},__hmrId:"Plane"},Gt={extends:yt,props:{vertices:Array,indices:Array,radius:{type:Number,default:1},detail:{type:Number,default:0}},created:function(){var e=this;this.createGeometry();["vertices","indices","radius","detail"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new w(this.vertices,this.indices,this.radius,this.detail)}},__hmrId:"Polyhedron"},It={extends:yt,props:{innerRadius:{type:Number,default:.5},outerRadius:{type:Number,default:1},thetaSegments:{type:Number,default:8},phiSegments:{type:Number,default:1},thetaStart:{type:Number,default:0},thetaLength:{type:Number,default:2*Math.PI}},created:function(){var e=this;this.createGeometry();["innerRadius","outerRadius","thetaSegments","phiSegments","thetaStart","thetaLength"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new x(this.innerRadius,this.outerRadius,this.thetaSegments,this.phiSegments,this.thetaStart,this.thetaLength)}},__hmrId:"Ring"},Pt={extends:yt,props:{radius:Number,widthSegments:{type:Number,default:12},heightSegments:{type:Number,default:12}},watch:{radius:function(){this.refreshGeometry()},widthSegments:function(){this.refreshGeometry()},heightSegments:function(){this.refreshGeometry()}},created:function(){this.createGeometry()},methods:{createGeometry:function(){this.geometry=new _(this.radius,this.widthSegments,this.heightSegments)}},__hmrId:"Sphere"},zt={extends:yt,props:{radius:{type:Number,default:1},detail:{type:Number,default:0}},created:function(){var e=this;this.createGeometry();["radius","detail"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new C(this.radius,this.detail)}},__hmrId:"Tetrahedron"},Rt={text:String,fontSrc:String,size:{type:Number,default:80},height:{type:Number,default:5},depth:{type:Number,default:1},curveSegments:{type:Number,default:12},bevelEnabled:{type:Boolean,default:!1},bevelThickness:{type:Number,default:10},bevelSize:{type:Number,default:8},bevelOffset:{type:Number,default:0},bevelSegments:{type:Number,default:5},align:{type:[Boolean,String],default:!1}},Bt={extends:yt,props:Object.assign({},Rt),created:function(){var e=this;["text","size","height","curveSegments","bevelEnabled","bevelThickness","bevelSize","bevelOffset","bevelSegments","align"].forEach((function(t){i((function(){return e[t]}),(function(){e.font&&e.refreshGeometry()}))})),(new Y).load(this.fontSrc,(function(t){e.font=t,e.createGeometry(),e.initMesh()}))},methods:{createGeometry:function(){this.geometry=new J(this.text,{font:this.font,size:this.size,height:this.height,depth:this.depth,curveSegments:this.curveSegments,bevelEnabled:this.bevelEnabled,bevelThickness:this.bevelThickness,bevelSize:this.bevelSize,bevelOffset:this.bevelOffset,bevelSegments:this.bevelSegments}),"center"===this.align&&this.geometry.center()}}},Et={extends:yt,props:{radius:{type:Number,default:.5},tube:{type:Number,default:.4},radialSegments:{type:Number,default:8},tubularSegments:{type:Number,default:6},arc:{type:Number,default:2*Math.PI}},created:function(){var e=this;this.createGeometry();["radius","tube","radialSegments","tubularSegments","arc"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new M(this.radius,this.tube,this.radialSegments,this.tubularSegments,this.arc)}},__hmrId:"Torus"},Lt={extends:yt,props:{radius:{type:Number,default:.5},tube:{type:Number,default:.4},tubularSegments:{type:Number,default:64},radialSegments:{type:Number,default:8},p:{type:Number,default:2},q:{type:Number,default:3}},created:function(){var e=this;this.createGeometry();["radius","tube","radialSegments","tubularSegments","p","q"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new G(this.radius,this.tube,this.tubularSegments,this.radialSegments,this.p,this.q)}},__hmrId:"TorusKnot"},jt={extends:yt,props:{path:I,tubularSegments:{type:Number,default:64},radius:{type:Number,default:1},radialSegments:{type:Number,default:8},closed:{type:Boolean,default:!1}},created:function(){var e=this;this.createGeometry();["path","tubularSegments","radius","radialSegments","closed"].forEach((function(t){i((function(){return e[t]}),(function(){e.refreshGeometry()}))}))},methods:{createGeometry:function(){this.geometry=new P(this.path,this.tubularSegments,this.radius,this.radialSegments,this.closed)}},__hmrId:"Tube"},kt={extends:yt,props:{cubeRTSize:{type:Number,default:256},cubeCameraNear:{type:Number,default:.1},cubeCameraFar:{type:Number,default:2e3},autoUpdate:Boolean},mounted:function(){this.initGem(),this.autoUpdate?this.three.onBeforeRender(this.updateCubeRT):this.rendererComponent.onMounted(this.updateCubeRT)},unmounted:function(){this.three.offBeforeRender(this.updateCubeRT),this.meshBack&&this.parent.remove(this.meshBack),this.materialBack&&this.materialBack.dispose()},methods:{initGem:function(){var e=new Q(this.cubeRTSize,{format:ee,generateMipmaps:!0,minFilter:te});this.cubeCamera=new ie(this.cubeCameraNear,this.cubeCameraFar,e),Ge(this,"position",this.cubeCamera.position),this.parent.add(this.cubeCamera),this.material.side=L,this.material.envMap=e.texture,this.material.envMapIntensity=10,this.material.metalness=0,this.material.roughness=0,this.material.opacity=.75,this.material.transparent=!0,this.material.premultipliedAlpha=!0,this.material.needsUpdate=!0,this.materialBack=this.material.clone(),this.materialBack.side=re,this.materialBack.envMapIntensity=5,this.materialBack.metalness=1,this.materialBack.roughness=0,this.materialBack.opacity=.5,this.meshBack=new Z(this.geometry,this.materialBack),Ge(this,"position",this.meshBack.position),Ge(this,"rotation",this.meshBack.rotation),Ge(this,"scale",this.meshBack.scale),this.parent.add(this.meshBack)},updateCubeRT:function(){this.mesh.visible=!1,this.meshBack.visible=!1,this.cubeCamera.update(this.three.renderer,this.scene),this.mesh.visible=!0,this.meshBack.visible=!0}},__hmrId:"Gem"},Tt={emits:["loaded"],extends:yt,props:{src:String,width:Number,height:Number,keepSize:Boolean},created:function(){var e=this;this.createGeometry(),this.createMaterial(),this.initMesh(),i((function(){return e.src}),this.refreshTexture),["width","height"].forEach((function(t){i((function(){return e[t]}),e.resize)})),this.keepSize&&this.three.onAfterResize(this.resize)},methods:{createGeometry:function(){this.geometry=new K(1,1,1,1)},createMaterial:function(){this.material=new j({side:se,map:this.loadTexture()})},loadTexture:function(){return(new T).load(this.src,this.onLoaded)},refreshTexture:function(){this.texture&&this.texture.dispose(),this.material.map=this.loadTexture(),this.material.needsUpdate=!0},onLoaded:function(e){this.texture=e,this.resize(),this.$emit("loaded")},resize:function(){if(this.texture){var e,t,i=this.three.size,r=this.texture.image.width/this.texture.image.height;this.width&&this.height?(e=this.width*i.wWidth/i.width,t=this.height*i.wHeight/i.height):this.width?t=(e=this.width*i.wWidth/i.width)/r:this.height&&(e=(t=this.height*i.wHeight/i.height)*r),this.mesh.scale.x=e,this.mesh.scale.y=t}}},__hmrId:"Image"},Ot={inject:["three","scene"],props:{materialId:String,count:Number,position:Object,castShadow:Boolean,receiveShadow:Boolean},setup:function(){return{parent:r("group",r("scene"))}},provide:function(){return{mesh:this}},beforeMount:function(){this.$slots.default||console.error("Missing Geometry")},mounted:function(){this.initMesh()},unmounted:function(){this.parent.remove(this.mesh)},methods:{initMesh:function(){var e=this;!this.material&&this.materialId&&(this.material=this.three.materials[this.materialId]),this.mesh=new ne(this.geometry,this.material,this.count),Ge(this,"position",this.mesh.position),Ge(this,"rotation",this.mesh.rotation),Ge(this,"scale",this.mesh.scale),["castShadow","receiveShadow"].forEach((function(t){e.mesh[t]=e[t],i((function(){return e[t]}),(function(){e.mesh[t]=e[t]}))})),this.parent.add(this.mesh)},setGeometry:function(e){this.geometry=e,this.mesh&&(this.mesh.geometry=e)},setMaterial:function(e){this.material=e,this.mesh&&(this.mesh.material=e)}},render:function(){return this.$slots.default()},__hmrId:"InstancedMesh"},At={extends:yt,props:{cubeRTSize:{type:Number,default:256},cubeCameraNear:{type:Number,default:.1},cubeCameraFar:{type:Number,default:2e3},autoUpdate:Boolean},mounted:function(){this.initMirrorMesh(),this.autoUpdate?this.three.onBeforeRender(this.updateCubeRT):this.rendererComponent.onMounted(this.updateCubeRT)},unmounted:function(){this.three.offBeforeRender(this.updateCubeRT),this.cubeCamera&&this.parent.remove(this.cubeCamera)},methods:{initMirrorMesh:function(){var e=new Q(this.cubeRTSize,{format:ee,generateMipmaps:!0,minFilter:te});this.cubeCamera=new ie(this.cubeCameraNear,this.cubeCameraFar,e),this.parent.add(this.cubeCamera),this.material.envMap=e.texture,this.material.needsUpdate=!0},updateCubeRT:function(){this.mesh.visible=!1,this.cubeCamera.update(this.three.renderer,this.scene),this.mesh.visible=!0}},__hmrId:"MirrorMesh"},Ft={extends:yt,props:{cubeRTSize:{type:Number,default:256},cubeCameraNear:{type:Number,default:.1},cubeCameraFar:{type:Number,default:2e3},refractionRatio:{type:Number,default:.98},autoUpdate:Boolean},mounted:function(){this.initMirrorMesh(),this.autoUpdate?this.three.onBeforeRender(this.updateCubeRT):this.rendererComponent.onMounted(this.updateCubeRT)},unmounted:function(){this.three.offBeforeRender(this.updateCubeRT),this.cubeCamera&&this.parent.remove(this.cubeCamera)},methods:{initMirrorMesh:function(){var e=new Q(this.cubeRTSize,{mapping:q,format:ee,generateMipmaps:!0,minFilter:te});this.cubeCamera=new ie(this.cubeCameraNear,this.cubeCameraFar,e),Ge(this,"position",this.cubeCamera.position),this.parent.add(this.cubeCamera),this.material.envMap=e.texture,this.material.refractionRatio=this.refractionRatio,this.material.needsUpdate=!0},updateCubeRT:function(){this.mesh.visible=!1,this.cubeCamera.update(this.three.renderer,this.scene),this.mesh.visible=!0}},__hmrId:"RefractionMesh"},Ut={emits:["ready","loaded"],inject:["three","scene"],props:{src:String,position:Object,scale:Object},setup:function(){return{parent:r("group",r("scene"))}},mounted:function(){this.texture=(new T).load(this.src,this.onLoaded),this.material=new ae({map:this.texture}),this.sprite=new oe(this.material),this.geometry=this.sprite.geometry,Ge(this,"position",this.sprite.position),Ge(this,"scale",this.sprite.scale),this.parent.add(this.sprite),this.$emit("ready")},unmounted:function(){this.texture.dispose(),this.material.dispose(),this.parent.remove(this.sprite)},methods:{onLoaded:function(){this.updateUV(),this.$emit("loaded")},updateUV:function(){this.iWidth=this.texture.image.width,this.iHeight=this.texture.image.height,this.iRatio=this.iWidth/this.iHeight;var e=.5,t=.5;this.iRatio>1?t=.5/this.iRatio:e=.5/this.iRatio;var i=this.geometry.attributes.position.array;i[0]=-e,i[1]=-t,i[5]=e,i[6]=-t,i[10]=e,i[11]=t,i[15]=-e,i[16]=t,this.geometry.attributes.position.needsUpdate=!0}},render:function(){return[]},__hmrId:"Sprite"},Dt={setup:function(){return{passes:[]}},inject:["three"],provide:function(){return{passes:this.passes}},mounted:function(){var e=this;this.three.onAfterInit((function(){e.composer=new ue(e.three.renderer),e.three.renderer.autoClear=!1,e.passes.forEach((function(t){e.composer.addPass(t)})),e.three.composer=e.composer,e.resize(),e.three.onAfterResize(e.resize)}))},unmounted:function(){this.three.offAfterResize(this.resize)},methods:{resize:function(){this.composer.setSize(this.three.size.width,this.three.size.height)}},render:function(){return this.$slots.default()},__hmrId:"EffectComposer"},$t={inject:["three","passes"],beforeMount:function(){this.passes||console.error("Missing parent EffectComposer")},unmounted:function(){this.pass.dispose&&this.pass.dispose()},render:function(){return[]},__hmrId:"EffectPass"},Ht={extends:$t,mounted:function(){this.three.scene||console.error("Missing Scene"),this.three.camera||console.error("Missing Camera");var e=new de(this.three.scene,this.three.camera);this.passes.push(e),this.pass=e},__hmrId:"RenderPass"},Wt={extends:$t,props:{focus:{type:Number,default:1},aperture:{type:Number,default:.025},maxblur:{type:Number,default:.01}},watch:{focus:function(){this.pass.uniforms.focus.value=this.focus},aperture:function(){this.pass.uniforms.aperture.value=this.aperture},maxblur:function(){this.pass.uniforms.maxblur.value=this.maxblur}},mounted:function(){this.three.scene||console.error("Missing Scene"),this.three.camera||console.error("Missing Camera");var e={focus:this.focus,aperture:this.aperture,maxblur:this.maxblur,width:this.three.size.width,height:this.three.size.height},t=new me(this.three.scene,this.three.camera,e);this.passes.push(t),this.pass=t},__hmrId:"BokehPass"},Vt={extends:$t,props:{noiseIntensity:{type:Number,default:.5},scanlinesIntensity:{type:Number,default:.05},scanlinesCount:{type:Number,default:4096},grayscale:{type:Number,default:0}},watch:{noiseIntensity:function(){this.pass.uniforms.nIntensity.value=this.noiseIntensity},scanlinesIntensity:function(){this.pass.uniforms.sIntensity.value=this.scanlinesIntensity},scanlinesCount:function(){this.pass.uniforms.sCount.value=this.scanlinesCount},grayscale:function(){this.pass.uniforms.grayscale.value=this.grayscale}},mounted:function(){var e=new ce(this.noiseIntensity,this.scanlinesIntensity,this.scanlinesCount,this.grayscale);this.passes.push(e),this.pass=e},__hmrId:"FilmPass"},Xt={extends:$t,mounted:function(){var e=new le(fe);this.passes.push(e),this.pass=e,this.three.onAfterResize(this.resize)},unmounted:function(){this.three.offAfterResize(this.resize)},methods:{resize:function(){var e=this.pass.material.uniforms.resolution;e.value.x=1/this.three.size.width,e.value.y=1/this.three.size.height}},__hmrId:"FXAAPass"},qt={extends:$t,props:{shape:{type:Number,default:1},radius:{type:Number,default:4},rotateR:{type:Number,default:Math.PI/12*1},rotateG:{type:Number,default:Math.PI/12*2},rotateB:{type:Number,default:Math.PI/12*3},scatter:{type:Number,default:0}},mounted:function(){var e=this,t=new pe(this.three.size.width,this.three.size.height,{});["shape","radius","rotateR","rotateG","rotateB","scatter"].forEach((function(r){t.uniforms[r].value=e[r],i((function(){return e[r]}),(function(){t.uniforms[r].value=e[r]}))})),this.passes.push(t),this.pass=t},__hmrId:"HalftonePass"},Zt={extends:$t,mounted:function(){var e=new ge(this.three.size.width,this.three.size.height);this.passes.push(e),this.pass=e},__hmrId:"SMAAPass"},Kt="\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",Yt={uniforms:{tDiffuse:{value:null},blurRadius:{value:0},gradientRadius:{value:0},start:{value:new s},end:{value:new s},delta:{value:new s},texSize:{value:new s}},vertexShader:Kt,fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform float blurRadius;\n uniform float gradientRadius;\n uniform vec2 start;\n uniform vec2 end;\n uniform vec2 delta;\n uniform vec2 texSize;\n varying vec2 vUv;\n\n float random(vec3 scale, float seed) {\n /* use the fragment position for a different seed per-pixel */\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n }\n\n void main() {\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vUv * texSize - start, normal)) / gradientRadius) * blurRadius;\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 texel = texture2D(tDiffuse, vUv + delta / texSize * percent * radius);\n // vec4 texel2 = texture2D(tDiffuse, vUv + vec2(-delta.y, delta.x) / texSize * percent * radius);\n\n /* switch to pre-multiplied alpha to correctly blur transparent images */\n texel.rgb *= texel.a;\n // texel2.rgb *= texel2.a;\n\n color += texel * weight;\n total += 2.0 * weight;\n }\n\n gl_FragColor = color / total;\n\n /* switch back from pre-multiplied alpha */\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n }\n "};function Jt(e,t,r,s){void 0===s&&(s="value"),e[t]&&(r[s]=e[t],i((function(){return e[t]}),(function(e){r[s]=e})))}var Qt={extends:$t,props:{blurRadius:{type:Number,default:10},gradientRadius:{type:Number,default:100},start:{type:Object,default:{x:0,y:100}},end:{type:Object,default:{x:10,y:100}}},mounted:function(){var e=this;this.pass=new le(Yt),this.passes.push(this.pass),this.pass1=new le(Yt),this.passes.push(this.pass1);var t=this.uniforms=this.pass.uniforms,r=this.uniforms1=this.pass1.uniforms;r.blurRadius=t.blurRadius,r.gradientRadius=t.gradientRadius,r.start=t.start,r.end=t.end,r.texSize=t.texSize,Jt(this,"blurRadius",t.blurRadius),Jt(this,"gradientRadius",t.gradientRadius),this.updateFocusLine(),["start","end"].forEach((function(t){i((function(){return e[t]}),e.updateFocusLine)})),this.pass.setSize=function(e,i){t.texSize.value.set(e,i)}},methods:{updateFocusLine:function(){this.uniforms.start.value.copy(this.start),this.uniforms.end.value.copy(this.end);var e=(new s).copy(this.end).sub(this.start).normalize();this.uniforms.delta.value.copy(e),this.uniforms1.delta.value.set(-e.y,e.x)}},__hmrId:"TiltShiftPass"},ei={extends:$t,props:{strength:{type:Number,default:1.5},radius:{type:Number,default:0},threshold:{type:Number,default:0}},watch:{strength:function(){this.pass.strength=this.strength},radius:function(){this.pass.radius=this.radius},threshold:function(){this.pass.threshold=this.threshold}},mounted:function(){var e=new s(this.three.size.width,this.three.size.height),t=new ye(e,this.strength,this.radius,this.threshold);this.passes.push(t),this.pass=t},__hmrId:"UnrealBloomPass"},ti={uniforms:{tDiffuse:{value:null},center:{value:new s(.5,.5)},strength:{value:0}},vertexShader:Kt,fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform vec2 center;\n uniform float strength;\n varying vec2 vUv;\n\n float random(vec3 scale, float seed) {\n /* use the fragment position for a different seed per-pixel */\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n }\n \n void main() {\n vec4 color = vec4(0.0);\n float total = 0.0;\n vec2 toCenter = center - vUv;\n \n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n \n for (float t = 0.0; t <= 40.0; t++) {\n float percent = (t + offset) / 40.0;\n float weight = 4.0 * (percent - percent * percent);\n vec4 texel = texture2D(tDiffuse, vUv + toCenter * percent * strength);\n\n /* switch to pre-multiplied alpha to correctly blur transparent images */\n texel.rgb *= texel.a;\n\n color += texel * weight;\n total += weight;\n }\n\n gl_FragColor = color / total;\n\n /* switch back from pre-multiplied alpha */\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n }\n "},ii={extends:$t,props:{center:{type:Object,default:{x:.5,y:.5}},strength:{type:Number,default:.5}},mounted:function(){this.pass=new le(ti),this.passes.push(this.pass);var e=this.uniforms=this.pass.uniforms;Ge(this,"center",e.center.value),Jt(this,"strength",e.strength)},__hmrId:"ZoomBlurPass"},ri=Object.freeze({__proto__:null,Renderer:ve,OrthographicCamera:Ie,PerspectiveCamera:Pe,Camera:Pe,Group:ze,Scene:Re,BoxGeometry:Ee,CircleGeometry:Le,ConeGeometry:je,CylinderGeometry:ke,DodecahedronGeometry:Te,IcosahedronGeometry:Oe,LatheGeometry:Ae,OctahedronGeometry:Fe,PolyhedronGeometry:Ue,RingGeometry:De,SphereGeometry:$e,TetrahedronGeometry:He,TorusGeometry:We,TorusKnotGeometry:Ve,TubeGeometry:Xe,AmbientLight:Ze,DirectionalLight:Ke,PointLight:Ye,SpotLight:Je,BasicMaterial:et,LambertMaterial:tt,MatcapMaterial:it,PhongMaterial:rt,PhysicalMaterial:at,StandardMaterial:nt,SubSurfaceMaterial:lt,ToonMaterial:ft,Texture:pt,CubeTexture:gt,Mesh:yt,Box:bt,Circle:vt,Cone:St,Cylinder:Nt,Dodecahedron:wt,Icosahedron:xt,Lathe:_t,Octahedron:Ct,Plane:Mt,Polyhedron:Gt,Ring:It,Sphere:Pt,Tetrahedron:zt,Text:Bt,Torus:Et,TorusKnot:Lt,Tube:jt,Gem:kt,Image:Tt,InstancedMesh:Ot,MirrorMesh:At,RefractionMesh:Ft,Sprite:Ut,EffectComposer:Dt,RenderPass:Ht,BokehPass:Wt,FilmPass:Vt,FXAAPass:Xt,HalftonePass:qt,SMAAPass:Zt,TiltShiftPass:Qt,UnrealBloomPass:ei,ZoomBlurPass:ii,setFromProp:Se,propsValues:Ne,lerp:we,lerpv2:xe,lerpv3:_e,limit:Ce,getMatcapUrl:Me}),si={install:function(e){["Camera","OrthographicCamera","PerspectiveCamera","Renderer","Scene","Group","BoxGeometry","CircleGeometry","ConeGeometry","CylinderGeometry","DodecahedronGeometry","IcosahedronGeometry","LatheGeometry","OctahedronGeometry","PolyhedronGeometry","RingGeometry","SphereGeometry","TetrahedronGeometry","TorusGeometry","TorusKnotGeometry","TubeGeometry","AmbientLight","DirectionalLight","PointLight","SpotLight","BasicMaterial","LambertMaterial","MatcapMaterial","PhongMaterial","PhysicalMaterial","ShaderMaterial","StandardMaterial","SubSurfaceMaterial","ToonMaterial","Texture","CubeTexture","Box","Circle","Cone","Cylinder","Dodecahedron","Icosahedron","Mesh","Lathe","Octahedron","Plane","Polyhedron","Ring","Sphere","Tetrahedron","Text","Torus","TorusKnot","Tube","Gem","Image","InstancedMesh","MirrorMesh","RefractionMesh","Sprite","BokehPass","EffectComposer","FilmPass","FXAAPass","HalftonePass","RenderPass","SAOPass","SMAAPass","TiltShiftPass","UnrealBloomPass","ZoomBlurPass","GLTFViewer"].forEach((function(t){e.component(t,ri[t])}))}};export{Ze as AmbientLight,et as BasicMaterial,Wt as BokehPass,bt as Box,Ee as BoxGeometry,Pe as Camera,vt as Circle,Le as CircleGeometry,St as Cone,je as ConeGeometry,gt as CubeTexture,Nt as Cylinder,ke as CylinderGeometry,Ke as DirectionalLight,wt as Dodecahedron,Te as DodecahedronGeometry,Dt as EffectComposer,Xt as FXAAPass,Vt as FilmPass,kt as Gem,ze as Group,qt as HalftonePass,xt as Icosahedron,Oe as IcosahedronGeometry,Tt as Image,Ot as InstancedMesh,tt as LambertMaterial,_t as Lathe,Ae as LatheGeometry,it as MatcapMaterial,yt as Mesh,At as MirrorMesh,Ct as Octahedron,Fe as OctahedronGeometry,Ie as OrthographicCamera,Pe as PerspectiveCamera,rt as PhongMaterial,at as PhysicalMaterial,Mt as Plane,Ye as PointLight,Gt as Polyhedron,Ue as PolyhedronGeometry,Ft as RefractionMesh,Ht as RenderPass,ve as Renderer,It as Ring,De as RingGeometry,Zt as SMAAPass,Re as Scene,Pt as Sphere,$e as SphereGeometry,Je as SpotLight,Ut as Sprite,nt as StandardMaterial,lt as SubSurfaceMaterial,zt as Tetrahedron,He as TetrahedronGeometry,Bt as Text,pt as Texture,Qt as TiltShiftPass,ft as ToonMaterial,Et as Torus,We as TorusGeometry,Lt as TorusKnot,Ve as TorusKnotGeometry,si as TroisJSVuePlugin,jt as Tube,Xe as TubeGeometry,ei as UnrealBloomPass,ii as ZoomBlurPass,Me as getMatcapUrl,we as lerp,xe as lerpv2,_e as lerpv3,Ce as limit,Ne as propsValues,Se as setFromProp}; //# sourceMappingURL=trois.module.min.js.map