aptechka 0.5.32 → 0.5.34

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/lib/en3/index.cjs CHANGED
@@ -194,7 +194,7 @@ void main(){
194
194
  v = v - gradP * dt;
195
195
  gl_FragColor = vec4(v, 0.0, 1.0);
196
196
  }
197
- `;class Zn extends fe{constructor(A){super({material:{vertexShader:de,fragmentShader:jn,uniforms:{boundarySpace:A.boundarySpace,pressure:A.srcP.texture,velocity:A.srcV.texture,px:A.cellScale,dt:A.dt}},output:A.dst}),this.init()}update(A){this.uniforms.velocity.value=A.vel.texture,this.uniforms.pressure.value=A.pressure.texture,super.update()}}var m,S,BA,P,aA,Be,Pe,ae,Ce,Ie,ge,Ye,St,ot,us,rt,ds;class zn{constructor(){d(this,Ye);d(this,ot);d(this,rt);d(this,m,{isViscous:new J.Store(!1,{passport:{name:"Fluid.Вязкость.Активна",manager:{type:"boolean"}}}),viscous:new J.Store(30,{passport:{name:"Fluid.Вязкость.Величина",manager:{type:"range",min:0,max:500}}}),iterationsViscous:new J.Store(16,{passport:{name:"Fluid.Вязкость.Количество итераций",manager:{type:"range",min:1,max:32,step:1}}}),pointerForce:new J.Store(20,{passport:{name:"Fluid.Курсор.Сила",manager:{type:"range",min:1,max:200,step:1}}}),pointerSize:new J.Store(100,{passport:{name:"Fluid.Курсор.Размер",manager:{type:"range",min:10,max:200,step:1}}}),dt:new J.Store(.014,{passport:{name:"Fluid.Скорость",manager:{type:"range",min:.001,max:.1,step:.001}}}),iterationsPoisson:new J.Store(16,{passport:{name:"Fluid.Poisson",manager:{type:"range",min:1,max:32,step:1}}}),resolution:new J.Store(.5,{passport:{name:"Fluid.Разрешение",manager:{type:"range",min:.1,max:1}}}),isBounce:new J.Store(!1,{passport:{name:"Fluid.Bounce",manager:{type:"boolean"}}}),BFECC:new J.Store(!0,{passport:{name:"Fluid.BFECC",manager:{type:"boolean"}}})});d(this,S,{vel0:null,vel1:null,velViscous0:null,velViscous1:null,div:null,pressure0:null,pressure1:null});d(this,BA,new B.Vector2);d(this,P,new B.Vector2);d(this,aA,new B.Vector2);d(this,Be,null);d(this,Pe,null);d(this,ae,null);d(this,Ce,null);d(this,Ie,null);d(this,ge,null);this.init()}get parameters(){return o(this,m)}get fbos(){return o(this,S)}resize(){tA(this,Ye,St).call(this);for(let A in this.fbos)o(this,S)[A].setSize(o(this,BA).x,o(this,BA).y)}update(){o(this,m).isBounce.current?o(this,aA).set(0,0):o(this,aA).copy(o(this,P)),o(this,Be).update({BFECC:o(this,m).BFECC.current,dt:o(this,m).dt.current,isBounce:o(this,m).isBounce.current}),o(this,Pe).update({pointerSize:o(this,m).pointerSize.current,pointerForce:o(this,m).pointerForce.current,cellScale:o(this,P)});let A=o(this,S).vel1;o(this,m).isViscous.current&&(A=o(this,ae).update({viscous:o(this,m).viscous.current,iterations:o(this,m).iterationsViscous.current,dt:o(this,m).dt.current})),o(this,Ce).update({vel:A});const e=o(this,Ie).update({iterations:o(this,m).iterationsPoisson.current});o(this,ge).update({vel:A,pressure:e})}dispose(){o(this,Be).dispose(),o(this,ae).dispose(),o(this,Ce).dispose(),o(this,Ie).dispose(),o(this,ge).dispose();for(const A in o(this,S))o(this,S)[A].dispose();for(const A in o(this,m))o(this,m)[A].close()}init(){tA(this,Ye,St).call(this),tA(this,ot,us).call(this),tA(this,rt,ds).call(this),setTimeout(()=>{o(this,m).isViscous.subscribe(()=>{}),o(this,m).viscous.subscribe(()=>{}),o(this,m).iterationsViscous.subscribe(()=>{}),o(this,m).pointerSize.subscribe(()=>{}),o(this,m).pointerForce.subscribe(()=>{}),o(this,m).dt.subscribe(()=>{}),o(this,m).resolution.subscribe(()=>{this.resize()}),o(this,m).iterationsPoisson.subscribe(()=>{}),o(this,m).isBounce.subscribe(()=>{}),o(this,m).BFECC.subscribe(()=>{})})}}m=new WeakMap,S=new WeakMap,BA=new WeakMap,P=new WeakMap,aA=new WeakMap,Be=new WeakMap,Pe=new WeakMap,ae=new WeakMap,Ce=new WeakMap,Ie=new WeakMap,ge=new WeakMap,Ye=new WeakSet,St=function(){const A=Math.round(o(this,m).resolution.current*w.width),e=Math.round(o(this,m).resolution.current*w.height),s=1/A,t=1/e;o(this,P).set(s,t),o(this,BA).set(A,e)},ot=new WeakSet,us=function(){const A=Ts.device.isApple?B.HalfFloatType:B.FloatType;for(let e in o(this,S))o(this,S)[e]=new B.WebGLRenderTarget(o(this,BA).x,o(this,BA).y,{type:A})},rt=new WeakSet,ds=function(){D(this,Be,new kn({cellScale:o(this,P),fboSize:o(this,BA),dt:o(this,m).dt.current,src:o(this,S).vel0,dst:o(this,S).vel1,BFECC:o(this,m).BFECC.current})),D(this,Pe,new vn({cellScale:o(this,P),pointerSize:o(this,m).pointerSize.current,dst:o(this,S).vel1})),D(this,ae,new Yn({cellScale:o(this,P),boundarySpace:o(this,aA),viscous:o(this,m).viscous.current,src:o(this,S).vel1,dst:o(this,S).velViscous1,dst_:o(this,S).velViscous0,dt:o(this,m).dt.current})),D(this,Ce,new Xn({cellScale:o(this,P),boundarySpace:o(this,aA),src:o(this,S).velViscous0,dst:o(this,S).div,dt:o(this,m).dt.current})),D(this,Ie,new Wn({cellScale:o(this,P),boundarySpace:o(this,aA),src:o(this,S).div,dst:o(this,S).pressure1,dst_:o(this,S).pressure0})),D(this,ge,new Zn({cellScale:o(this,P),boundarySpace:o(this,aA),srcP:o(this,S).pressure0,srcV:o(this,S).velViscous0,dst:o(this,S).vel0,dt:o(this,m).dt.current}))};var DA,NA,kA,pA,KA,FA,OA,ce,Ee,Qe,le,he;class fs extends B.Mesh{constructor(){super();d(this,DA,void 0);d(this,NA,void 0);d(this,kA,void 0);d(this,pA,void 0);d(this,KA,void 0);d(this,FA,void 0);d(this,OA,void 0);d(this,ce,void 0);d(this,Ee,void 0);d(this,Qe,void 0);d(this,le,void 0);d(this,he,void 0);this.colorTweenDuration=1e3,D(this,NA,new J.Store("#000000",{passport:{name:"Fluid.Цвета.Фон.Цвет",manager:{type:"color"}}})),D(this,kA,new J.Store(1,{passport:{name:"Fluid.Цвета.Фон.Порог",manager:{type:"range"}}})),D(this,pA,new J.Store(1,{passport:{name:"Fluid.Цвета.Фон.Прозрачность",manager:{type:"range"}}})),D(this,KA,new J.Store("#ffffff",{passport:{name:"Fluid.Цвета.Жидкость.Цвет",manager:{type:"color"}}})),D(this,FA,new J.Store(1,{passport:{name:"Fluid.Цвета.Жидкость.Прозрачность",manager:{type:"range"}}})),D(this,OA,new Ls.Tweened(0,{easing:Ms.easeInOutCubic,min:0,max:1,duration:this.colorTweenDuration})),D(this,ce,new B.Color),D(this,Ee,new B.Color),D(this,Qe,new B.Color),D(this,le,new B.Color),D(this,he,Ss.debounce(()=>{o(this,OA).reset(),o(this,OA).set(1)},0)),D(this,DA,new zn),RA.init(),this.geometry=new B.PlaneGeometry(2,2),this.material=new B.RawShaderMaterial({vertexShader:de,fragmentShader:bn,transparent:!0,uniforms:{velocity:{value:o(this,DA).fbos.vel0.texture},backgroundColor:{value:o(this,Ee)},backgroundOpacity:{value:o(this,pA).current},fluidColor:{value:o(this,ce)},fluidOpacity:{value:o(this,FA).current},backgroundMixThreshold:{value:0},opacity:{value:1},boundarySpace:{value:new B.Vector2(0,0)}}}),o(this,NA).subscribe(e=>{D(this,le,new B.Color(e.current)),o(this,he).call(this)}),o(this,KA).subscribe(e=>{D(this,Qe,new B.Color(e.current)),o(this,he).call(this)}),o(this,pA).subscribe(e=>{this.material.uniforms.backgroundOpacity.value=e.current}),o(this,FA).subscribe(e=>{this.material.uniforms.fluidOpacity.value=e.current}),o(this,kA).subscribe(e=>{this.material.uniforms.backgroundMixThreshold.value=e.current}),o(this,OA).subscribe(e=>{o(this,Ee).lerp(o(this,le),e.current),o(this,ce).lerp(o(this,Qe),e.current)})}get backgroundColor(){return o(this,NA)}get backgroundMixThreshold(){return o(this,kA)}get backgroundOpacity(){return o(this,pA)}get fluidColor(){return o(this,KA)}get fluidOpacity(){return o(this,FA)}resize(){o(this,DA).resize()}update(){RA.update(),o(this,DA).update()}dispose(){RA.dispose(),o(this,DA).dispose(),o(this,NA).close(),o(this,pA).close(),o(this,KA).close(),o(this,FA).close(),o(this,kA).close()}}DA=new WeakMap,NA=new WeakMap,kA=new WeakMap,pA=new WeakMap,KA=new WeakMap,FA=new WeakMap,OA=new WeakMap,ce=new WeakMap,Ee=new WeakMap,Qe=new WeakMap,le=new WeakMap,he=new WeakMap;var $n=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,ei=(C,A,e,s)=>{for(var t=s>1?void 0:s?Ai(A,e):A,n=C.length-1,i;n>=0;n--)(i=C[n])&&(t=(s?i(A,e,t):i(t))||t);return s&&t&&$n(A,e,t),t},Ds=(C,A,e)=>{if(!A.has(C))throw TypeError("Cannot "+e)},W=(C,A,e)=>(Ds(C,A,"read from private field"),e?e.call(C):A.get(C)),Ft=(C,A,e)=>{if(A.has(C))throw TypeError("Cannot add the same private member more than once");A instanceof WeakSet?A.add(C):A.set(C,e)},ti=(C,A,e,s)=>(Ds(C,A,"write to private field"),s?s.call(C,e):A.set(C,e),e),nA,tt,st;exports.En3FluidElement=class extends zt.CustomElement{constructor(){super(...arguments),Ft(this,nA,null),Ft(this,tt,()=>{W(this,nA).resize()}),Ft(this,st,()=>{w.width&&W(this,nA).update()})}get fluid(){return W(this,nA)}connectedCallback(){ti(this,nA,new fs),w.view.add(W(this,nA)),wA.windowResizer.subscribe(W(this,tt)),yA.ticker.subscribe(W(this,st))}disconnectedCallback(){w.view.remove(W(this,nA)),W(this,nA).dispose(),wA.windowResizer.unsubscribe(W(this,tt)),yA.ticker.unsubscribe(W(this,st))}};nA=new WeakMap;tt=new WeakMap;st=new WeakMap;exports.En3FluidElement=ei([zt.define("en3-fluid")],exports.En3FluidElement);function Ht(C,A,e){const s=A.x,t=A.y,n=e||C.image.width/C.image.height;let i=0,a=0,r=C.offset.x,I=C.offset.y,c=C.rotation,g=C.center.x,Q=C.center.y;s/t>n?(i=1,a=t/s*n):(a=1,i=s/t/n),C.matrix.setUvTransform(r,I,i,a,c,g,Q)}const Re=new B.Vector3;function _(C,A,e,s,t,n){const i=2*Math.PI*t/4,a=Math.max(n-2*t,0),r=Math.PI/4;Re.copy(A),Re[s]=0,Re.normalize();const I=.5*i/(i+a),c=1-Re.angleTo(C)/r;return Math.sign(Re[e])===1?c*I:a/(i+a)+I+I*(1-c)}class si extends B.BoxGeometry{constructor(A=1,e=1,s=1,t=2,n=.1){if(t=t*2+1,n=Math.min(A/2,e/2,s/2,n),super(1,1,1,t,t,t),t===1)return;const i=this.toNonIndexed();this.index=null,this.attributes.position=i.attributes.position,this.attributes.normal=i.attributes.normal,this.attributes.uv=i.attributes.uv;const a=new B.Vector3,r=new B.Vector3,I=new B.Vector3(A,e,s).divideScalar(2).subScalar(n),c=this.attributes.position.array,g=this.attributes.normal.array,Q=this.attributes.uv.array,l=c.length/6,u=new B.Vector3,h=.5/t;for(let E=0,f=0;E<c.length;E+=3,f+=2)switch(a.fromArray(c,E),r.copy(a),r.x-=Math.sign(r.x)*h,r.y-=Math.sign(r.y)*h,r.z-=Math.sign(r.z)*h,r.normalize(),c[E+0]=I.x*Math.sign(a.x)+r.x*n,c[E+1]=I.y*Math.sign(a.y)+r.y*n,c[E+2]=I.z*Math.sign(a.z)+r.z*n,g[E+0]=r.x,g[E+1]=r.y,g[E+2]=r.z,Math.floor(E/l)){case 0:u.set(1,0,0),Q[f+0]=_(u,r,"z","y",n,s),Q[f+1]=1-_(u,r,"y","z",n,e);break;case 1:u.set(-1,0,0),Q[f+0]=1-_(u,r,"z","y",n,s),Q[f+1]=1-_(u,r,"y","z",n,e);break;case 2:u.set(0,1,0),Q[f+0]=1-_(u,r,"x","z",n,A),Q[f+1]=_(u,r,"z","x",n,s);break;case 3:u.set(0,-1,0),Q[f+0]=1-_(u,r,"x","z",n,A),Q[f+1]=1-_(u,r,"z","x",n,s);break;case 4:u.set(0,0,1),Q[f+0]=1-_(u,r,"x","y",n,A),Q[f+1]=1-_(u,r,"y","x",n,e);break;case 5:u.set(0,0,-1),Q[f+0]=_(u,r,"x","y",n,A),Q[f+1]=1-_(u,r,"y","x",n,e);break}}}const Wt=new B.Vector3,ni=new B.Quaternion,jt=new B.Vector3;class ii extends B.Object3D{constructor(A=document.createElement("div")){super(),this.isCSS3DObject=!0,this.element=A,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(e){e.element instanceof Element&&e.element.parentNode!==null&&e.element.parentNode.removeChild(e.element)})})}copy(A,e){return super.copy(A,e),this.element=A.element.cloneNode(!0),this}}const j=new B.Matrix4,oi=new B.Matrix4;class ri{constructor(A={}){const e=this;let s,t,n,i;const a={camera:{style:""},objects:new WeakMap},r=A.element!==void 0?A.element:document.createElement("div");r.style.overflow="hidden",this.domElement=r;const I=document.createElement("div");I.style.transformOrigin="0 0",I.style.pointerEvents="none",r.appendChild(I);const c=document.createElement("div");c.style.transformStyle="preserve-3d",I.appendChild(c),this.getSize=function(){return{width:s,height:t}},this.render=function(h,E){const f=E.projectionMatrix.elements[5]*i;E.view&&E.view.enabled?(I.style.transform=`translate( ${-E.view.offsetX*(s/E.view.width)}px, ${-E.view.offsetY*(t/E.view.height)}px )`,I.style.transform+=`scale( ${E.view.fullWidth/E.view.width}, ${E.view.fullHeight/E.view.height} )`):I.style.transform="",h.matrixWorldAutoUpdate===!0&&h.updateMatrixWorld(),E.parent===null&&E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld();let p,F;E.isOrthographicCamera&&(p=-(E.right+E.left)/2,F=(E.top+E.bottom)/2);const G=E.view&&E.view.enabled?E.view.height/E.view.fullHeight:1,y=E.isOrthographicCamera?`scale( ${G} )scale(`+f+")translate("+g(p)+"px,"+g(F)+"px)"+Q(E.matrixWorldInverse):`scale( ${G} )translateZ(`+f+"px)"+Q(E.matrixWorldInverse),L=(E.isPerspectiveCamera?"perspective("+f+"px) ":"")+y+"translate("+n+"px,"+i+"px)";a.camera.style!==L&&(c.style.transform=L,a.camera.style=L),u(h,h,E)},this.setSize=function(h,E){s=h,t=E,n=s/2,i=t/2,r.style.width=h+"px",r.style.height=E+"px",I.style.width=h+"px",I.style.height=E+"px",c.style.width=h+"px",c.style.height=E+"px"};function g(h){return Math.abs(h)<1e-10?0:h}function Q(h){const E=h.elements;return"matrix3d("+g(E[0])+","+g(-E[1])+","+g(E[2])+","+g(E[3])+","+g(E[4])+","+g(-E[5])+","+g(E[6])+","+g(E[7])+","+g(E[8])+","+g(-E[9])+","+g(E[10])+","+g(E[11])+","+g(E[12])+","+g(-E[13])+","+g(E[14])+","+g(E[15])+")"}function l(h){const E=h.elements;return"translate(-50%,-50%)"+("matrix3d("+g(E[0])+","+g(E[1])+","+g(E[2])+","+g(E[3])+","+g(-E[4])+","+g(-E[5])+","+g(-E[6])+","+g(-E[7])+","+g(E[8])+","+g(E[9])+","+g(E[10])+","+g(E[11])+","+g(E[12])+","+g(E[13])+","+g(E[14])+","+g(E[15])+")")}function u(h,E,f,p){if(h.isCSS3DObject){const F=h.visible===!0&&h.layers.test(f.layers)===!0;if(h.element.style.display=F===!0?"":"none",F===!0){h.onBeforeRender(e,E,f);let G;h.isCSS3DSprite?(j.copy(f.matrixWorldInverse),j.transpose(),h.rotation2D!==0&&j.multiply(oi.makeRotationZ(h.rotation2D)),h.matrixWorld.decompose(Wt,ni,jt),j.setPosition(Wt),j.scale(jt),j.elements[3]=0,j.elements[7]=0,j.elements[11]=0,j.elements[15]=1,G=l(j)):G=l(h.matrixWorld);const y=h.element,M=a.objects.get(h);if(M===void 0||M.style!==G){y.style.transform=G;const L={style:G};a.objects.set(h,L)}y.parentNode!==c&&c.appendChild(y),h.onAfterRender(e,E,f)}}for(let F=0,G=h.children.length;F<G;F++)u(h.children[F],E,f)}}}var CA,ue,_A;class Jt extends B.Mesh{constructor(e){super(new si(e.width,e.height,1,e.segments,e.round||0),e.material);d(this,CA,void 0);d(this,ue,void 0);d(this,_A,()=>{o(this,CA).data.current&&o(this,ue)==="cover"&&this.onCoverResize(o(this,CA).data.current)});D(this,CA,new xt(eA({consumer:this},e))),D(this,ue,e.fit),this.addEventListener("added",()=>{wA.windowResizer.subscribe(o(this,_A))}),this.addEventListener("removed",()=>{wA.windowResizer.unsubscribe(o(this,_A))}),o(this,CA).processData=s=>w.cacheAssets?s.clone():s,o(this,CA).data.subscribe(s=>{!s.current&&s.previous?s.previous.dispose():s.current&&this.material&&(o(this,ue)&&(s.current.matrixAutoUpdate=!1),s.current.colorSpace=B.SRGBColorSpace,s.current.center.set(.5,.5),this.material.map=s.current,this.material.needsUpdate=!0,o(this,_A).call(this))})}get sourceManager(){return o(this,CA)}updateTexture(){o(this,_A).call(this)}onCoverResize(e){Ht(e,{x:this.scale.x,y:this.scale.y})}}CA=new WeakMap,ue=new WeakMap,_A=new WeakMap;class Bi extends Jt{constructor(A){super(Fe(eA({},A),{loader:MA}))}}class ai{load(...A){const e=A[0],s=A[1],t=A[3],n=document.createElement("video");n.src=e,n.onloadeddata=()=>{s(new B.VideoTexture(n)),n.onerror=null,n.onloadeddata=null},n.onerror=()=>{t==null||t(e),n.onerror=null,n.onloadeddata=null}}}var qe,Xe,Ve;class Ci extends Jt{constructor(e){super(Fe(eA({},e),{loader:new ai}));d(this,qe,void 0);d(this,Xe,void 0);d(this,Ve,void 0);D(this,qe,e.autoplay||!1),D(this,Xe,e.muted||!1),D(this,Ve,e.loop||!1),this.sourceManager.data.subscribe(s=>{if(s.current){const t=s.current.image;o(this,Xe)&&(t.muted=!0),o(this,Ve)&&(t.loop=!0),o(this,qe)&&t.play()}})}onCoverResize(e){const s=e.image;Ht(e,{x:this.scale.x,y:this.scale.y},s.videoWidth/s.videoHeight)}}qe=new WeakMap,Xe=new WeakMap,Ve=new WeakMap;function Ii(C,A){C.traverse(e=>{e instanceof B.Mesh&&A(e)})}function gi(C,A){C.traverse(e=>{e instanceof B.Mesh&&e.material&&(Array.isArray(e.material)?e.material:[e.material]).forEach(A)})}const Gt=new B.Vector3,ci=new B.Vector3;function Ei(C,A="default"){const e=w.getView(A),{width:s,height:t}=w,n=s/t;C instanceof B.Vector3?Gt.copy(C):Gt.set(...C);const i=e.camera.getWorldPosition(ci).distanceTo(Gt);if(e.camera instanceof B.OrthographicCamera)return{width:s/e.camera.zoom,height:t/e.camera.zoom,factor:1,distance:i,aspect:n};{const a=e.camera.fov*Math.PI/180,r=2*Math.tan(a/2)*i,I=r*(s/t);return{width:I,height:r,factor:s/I,distance:i,aspect:n}}}var Z,Bt,ps,We,je;const O=class O extends ii{static destroy(){wA.windowResizer.unsubscribe(o(this,je)),yA.ticker.unsubscribe(o(this,We)),D(this,Z,null)}constructor(A){var e;super(A.element),o(O,Z)||tA(e=O,Bt,ps).call(e)}};Z=new WeakMap,Bt=new WeakSet,ps=function(){D(O,Z,new ri),o(O,Z).domElement.style.cssText=`
197
+ `;class Zn extends fe{constructor(A){super({material:{vertexShader:de,fragmentShader:jn,uniforms:{boundarySpace:A.boundarySpace,pressure:A.srcP.texture,velocity:A.srcV.texture,px:A.cellScale,dt:A.dt}},output:A.dst}),this.init()}update(A){this.uniforms.velocity.value=A.vel.texture,this.uniforms.pressure.value=A.pressure.texture,super.update()}}var m,S,BA,P,aA,Be,Pe,ae,Ce,Ie,ge,Ye,St,ot,us,rt,ds;class zn{constructor(){d(this,Ye);d(this,ot);d(this,rt);d(this,m,{isViscous:new J.Store(!1,{passport:{name:"Fluid.Вязкость.Активна",manager:{type:"boolean"}}}),viscous:new J.Store(30,{passport:{name:"Fluid.Вязкость.Величина",manager:{type:"range",min:0,max:500}}}),iterationsViscous:new J.Store(16,{passport:{name:"Fluid.Вязкость.Количество итераций",manager:{type:"range",min:1,max:32,step:1}}}),pointerForce:new J.Store(20,{passport:{name:"Fluid.Курсор.Сила",manager:{type:"range",min:1,max:200,step:1}}}),pointerSize:new J.Store(100,{passport:{name:"Fluid.Курсор.Размер",manager:{type:"range",min:10,max:200,step:1}}}),dt:new J.Store(.014,{passport:{name:"Fluid.Скорость",manager:{type:"range",min:.001,max:.1,step:.001}}}),iterationsPoisson:new J.Store(16,{passport:{name:"Fluid.Poisson",manager:{type:"range",min:1,max:32,step:1}}}),resolution:new J.Store(.5,{passport:{name:"Fluid.Разрешение",manager:{type:"range",min:.1,max:1}}}),isBounce:new J.Store(!1,{passport:{name:"Fluid.Bounce",manager:{type:"boolean"}}}),BFECC:new J.Store(!0,{passport:{name:"Fluid.BFECC",manager:{type:"boolean"}}})});d(this,S,{vel0:null,vel1:null,velViscous0:null,velViscous1:null,div:null,pressure0:null,pressure1:null});d(this,BA,new B.Vector2);d(this,P,new B.Vector2);d(this,aA,new B.Vector2);d(this,Be,null);d(this,Pe,null);d(this,ae,null);d(this,Ce,null);d(this,Ie,null);d(this,ge,null);this.init()}get parameters(){return o(this,m)}get fbos(){return o(this,S)}resize(){tA(this,Ye,St).call(this);for(let A in this.fbos)o(this,S)[A].setSize(o(this,BA).x,o(this,BA).y)}update(){o(this,m).isBounce.current?o(this,aA).set(0,0):o(this,aA).copy(o(this,P)),o(this,Be).update({BFECC:o(this,m).BFECC.current,dt:o(this,m).dt.current,isBounce:o(this,m).isBounce.current}),o(this,Pe).update({pointerSize:o(this,m).pointerSize.current,pointerForce:o(this,m).pointerForce.current,cellScale:o(this,P)});let A=o(this,S).vel1;o(this,m).isViscous.current&&(A=o(this,ae).update({viscous:o(this,m).viscous.current,iterations:o(this,m).iterationsViscous.current,dt:o(this,m).dt.current})),o(this,Ce).update({vel:A});const e=o(this,Ie).update({iterations:o(this,m).iterationsPoisson.current});o(this,ge).update({vel:A,pressure:e})}dispose(){o(this,Be).dispose(),o(this,ae).dispose(),o(this,Ce).dispose(),o(this,Ie).dispose(),o(this,ge).dispose();for(const A in o(this,S))o(this,S)[A].dispose();for(const A in o(this,m))o(this,m)[A].close()}init(){tA(this,Ye,St).call(this),tA(this,ot,us).call(this),tA(this,rt,ds).call(this),setTimeout(()=>{o(this,m).isViscous.subscribe(()=>{}),o(this,m).viscous.subscribe(()=>{}),o(this,m).iterationsViscous.subscribe(()=>{}),o(this,m).pointerSize.subscribe(()=>{}),o(this,m).pointerForce.subscribe(()=>{}),o(this,m).dt.subscribe(()=>{}),o(this,m).resolution.subscribe(()=>{this.resize()}),o(this,m).iterationsPoisson.subscribe(()=>{}),o(this,m).isBounce.subscribe(()=>{}),o(this,m).BFECC.subscribe(()=>{})})}}m=new WeakMap,S=new WeakMap,BA=new WeakMap,P=new WeakMap,aA=new WeakMap,Be=new WeakMap,Pe=new WeakMap,ae=new WeakMap,Ce=new WeakMap,Ie=new WeakMap,ge=new WeakMap,Ye=new WeakSet,St=function(){const A=Math.round(o(this,m).resolution.current*w.width),e=Math.round(o(this,m).resolution.current*w.height),s=1/A,t=1/e;o(this,P).set(s,t),o(this,BA).set(A,e)},ot=new WeakSet,us=function(){const A=Ts.device.isApple?B.HalfFloatType:B.FloatType;for(let e in o(this,S))o(this,S)[e]=new B.WebGLRenderTarget(o(this,BA).x,o(this,BA).y,{type:A})},rt=new WeakSet,ds=function(){D(this,Be,new kn({cellScale:o(this,P),fboSize:o(this,BA),dt:o(this,m).dt.current,src:o(this,S).vel0,dst:o(this,S).vel1,BFECC:o(this,m).BFECC.current})),D(this,Pe,new vn({cellScale:o(this,P),pointerSize:o(this,m).pointerSize.current,dst:o(this,S).vel1})),D(this,ae,new Yn({cellScale:o(this,P),boundarySpace:o(this,aA),viscous:o(this,m).viscous.current,src:o(this,S).vel1,dst:o(this,S).velViscous1,dst_:o(this,S).velViscous0,dt:o(this,m).dt.current})),D(this,Ce,new Xn({cellScale:o(this,P),boundarySpace:o(this,aA),src:o(this,S).velViscous0,dst:o(this,S).div,dt:o(this,m).dt.current})),D(this,Ie,new Wn({cellScale:o(this,P),boundarySpace:o(this,aA),src:o(this,S).div,dst:o(this,S).pressure1,dst_:o(this,S).pressure0})),D(this,ge,new Zn({cellScale:o(this,P),boundarySpace:o(this,aA),srcP:o(this,S).pressure0,srcV:o(this,S).velViscous0,dst:o(this,S).vel0,dt:o(this,m).dt.current}))};var DA,NA,kA,pA,KA,FA,OA,ce,Ee,Qe,le,he;class fs extends B.Mesh{constructor(){super();d(this,DA,void 0);d(this,NA,void 0);d(this,kA,void 0);d(this,pA,void 0);d(this,KA,void 0);d(this,FA,void 0);d(this,OA,void 0);d(this,ce,void 0);d(this,Ee,void 0);d(this,Qe,void 0);d(this,le,void 0);d(this,he,void 0);this.colorTweenDuration=1e3,D(this,NA,new J.Store("#000000",{passport:{name:"Fluid.Цвета.Фон.Цвет",manager:{type:"color"}}})),D(this,kA,new J.Store(1,{passport:{name:"Fluid.Цвета.Фон.Порог",manager:{type:"range"}}})),D(this,pA,new J.Store(1,{passport:{name:"Fluid.Цвета.Фон.Прозрачность",manager:{type:"range"}}})),D(this,KA,new J.Store("#ffffff",{passport:{name:"Fluid.Цвета.Жидкость.Цвет",manager:{type:"color"}}})),D(this,FA,new J.Store(1,{passport:{name:"Fluid.Цвета.Жидкость.Прозрачность",manager:{type:"range"}}})),D(this,OA,new Ls.Tweened(0,{easing:Ms.easeInOutCubic,min:0,max:1,duration:this.colorTweenDuration})),D(this,ce,new B.Color),D(this,Ee,new B.Color),D(this,Qe,new B.Color),D(this,le,new B.Color),D(this,he,Ss.debounce(()=>{o(this,OA).reset(),o(this,OA).set(1)},0)),D(this,DA,new zn),RA.init(),this.geometry=new B.PlaneGeometry(2,2),this.material=new B.RawShaderMaterial({vertexShader:de,fragmentShader:bn,transparent:!0,uniforms:{velocity:{value:o(this,DA).fbos.vel0.texture},backgroundColor:{value:o(this,Ee)},backgroundOpacity:{value:o(this,pA).current},fluidColor:{value:o(this,ce)},fluidOpacity:{value:o(this,FA).current},backgroundMixThreshold:{value:0},opacity:{value:1},boundarySpace:{value:new B.Vector2(0,0)}}}),o(this,NA).subscribe(e=>{D(this,le,new B.Color(e.current)),o(this,he).call(this)}),o(this,KA).subscribe(e=>{D(this,Qe,new B.Color(e.current)),o(this,he).call(this)}),o(this,pA).subscribe(e=>{this.material.uniforms.backgroundOpacity.value=e.current}),o(this,FA).subscribe(e=>{this.material.uniforms.fluidOpacity.value=e.current}),o(this,kA).subscribe(e=>{this.material.uniforms.backgroundMixThreshold.value=e.current}),o(this,OA).subscribe(e=>{o(this,Ee).lerp(o(this,le),e.current),o(this,ce).lerp(o(this,Qe),e.current)})}get backgroundColor(){return o(this,NA)}get backgroundMixThreshold(){return o(this,kA)}get backgroundOpacity(){return o(this,pA)}get fluidColor(){return o(this,KA)}get fluidOpacity(){return o(this,FA)}resize(){o(this,DA).resize()}update(){RA.update(),o(this,DA).update()}dispose(){RA.dispose(),o(this,DA).dispose(),o(this,NA).close(),o(this,pA).close(),o(this,KA).close(),o(this,FA).close(),o(this,kA).close()}}DA=new WeakMap,NA=new WeakMap,kA=new WeakMap,pA=new WeakMap,KA=new WeakMap,FA=new WeakMap,OA=new WeakMap,ce=new WeakMap,Ee=new WeakMap,Qe=new WeakMap,le=new WeakMap,he=new WeakMap;var $n=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,ei=(C,A,e,s)=>{for(var t=s>1?void 0:s?Ai(A,e):A,n=C.length-1,i;n>=0;n--)(i=C[n])&&(t=(s?i(A,e,t):i(t))||t);return s&&t&&$n(A,e,t),t},Ds=(C,A,e)=>{if(!A.has(C))throw TypeError("Cannot "+e)},W=(C,A,e)=>(Ds(C,A,"read from private field"),e?e.call(C):A.get(C)),Ft=(C,A,e)=>{if(A.has(C))throw TypeError("Cannot add the same private member more than once");A instanceof WeakSet?A.add(C):A.set(C,e)},ti=(C,A,e,s)=>(Ds(C,A,"write to private field"),s?s.call(C,e):A.set(C,e),e),nA,tt,st;exports.En3FluidElement=class extends zt.CustomElement{constructor(){super(...arguments),Ft(this,nA,null),Ft(this,tt,()=>{W(this,nA).resize()}),Ft(this,st,()=>{w.width&&W(this,nA).update()})}get fluid(){return W(this,nA)}connectedCallback(){ti(this,nA,new fs),w.view.add(W(this,nA)),wA.windowResizer.subscribe(W(this,tt)),yA.ticker.subscribe(W(this,st))}disconnectedCallback(){w.view.remove(W(this,nA)),W(this,nA).dispose(),wA.windowResizer.unsubscribe(W(this,tt)),yA.ticker.unsubscribe(W(this,st))}};nA=new WeakMap;tt=new WeakMap;st=new WeakMap;exports.En3FluidElement=ei([zt.define("en3-fluid")],exports.En3FluidElement);function Ht(C,A,e){const s=A.x,t=A.y,n=e||C.image.width/C.image.height;let i=0,a=0,r=C.offset.x,I=C.offset.y,c=C.rotation,g=C.center.x,Q=C.center.y;s/t>n?(i=1,a=t/s*n):(a=1,i=s/t/n),C.matrix.setUvTransform(r,I,i,a,c,g,Q)}const Re=new B.Vector3;function _(C,A,e,s,t,n){const i=2*Math.PI*t/4,a=Math.max(n-2*t,0),r=Math.PI/4;Re.copy(A),Re[s]=0,Re.normalize();const I=.5*i/(i+a),c=1-Re.angleTo(C)/r;return Math.sign(Re[e])===1?c*I:a/(i+a)+I+I*(1-c)}class si extends B.BoxGeometry{constructor(A=1,e=1,s=1,t=2,n=.1){if(t=t*2+1,n=Math.min(A/2,e/2,s/2,n),super(1,1,1,t,t,t),t===1)return;const i=this.toNonIndexed();this.index=null,this.attributes.position=i.attributes.position,this.attributes.normal=i.attributes.normal,this.attributes.uv=i.attributes.uv;const a=new B.Vector3,r=new B.Vector3,I=new B.Vector3(A,e,s).divideScalar(2).subScalar(n),c=this.attributes.position.array,g=this.attributes.normal.array,Q=this.attributes.uv.array,l=c.length/6,u=new B.Vector3,h=.5/t;for(let E=0,f=0;E<c.length;E+=3,f+=2)switch(a.fromArray(c,E),r.copy(a),r.x-=Math.sign(r.x)*h,r.y-=Math.sign(r.y)*h,r.z-=Math.sign(r.z)*h,r.normalize(),c[E+0]=I.x*Math.sign(a.x)+r.x*n,c[E+1]=I.y*Math.sign(a.y)+r.y*n,c[E+2]=I.z*Math.sign(a.z)+r.z*n,g[E+0]=r.x,g[E+1]=r.y,g[E+2]=r.z,Math.floor(E/l)){case 0:u.set(1,0,0),Q[f+0]=_(u,r,"z","y",n,s),Q[f+1]=1-_(u,r,"y","z",n,e);break;case 1:u.set(-1,0,0),Q[f+0]=1-_(u,r,"z","y",n,s),Q[f+1]=1-_(u,r,"y","z",n,e);break;case 2:u.set(0,1,0),Q[f+0]=1-_(u,r,"x","z",n,A),Q[f+1]=_(u,r,"z","x",n,s);break;case 3:u.set(0,-1,0),Q[f+0]=1-_(u,r,"x","z",n,A),Q[f+1]=1-_(u,r,"z","x",n,s);break;case 4:u.set(0,0,1),Q[f+0]=1-_(u,r,"x","y",n,A),Q[f+1]=1-_(u,r,"y","x",n,e);break;case 5:u.set(0,0,-1),Q[f+0]=_(u,r,"x","y",n,A),Q[f+1]=1-_(u,r,"y","x",n,e);break}}}var CA,ue,_A;class Jt extends B.Mesh{constructor(e){super(e.round?new si(e.width,e.height,1,e.segments,e.round):new B.PlaneGeometry(e.width,e.height,e.segments,e.segments),e.material);d(this,CA,void 0);d(this,ue,void 0);d(this,_A,()=>{o(this,CA).data.current&&o(this,ue)==="cover"&&this.onCoverResize(o(this,CA).data.current)});D(this,CA,new xt(eA({consumer:this},e))),D(this,ue,e.fit),this.addEventListener("added",()=>{wA.windowResizer.subscribe(o(this,_A))}),this.addEventListener("removed",()=>{wA.windowResizer.unsubscribe(o(this,_A))}),o(this,CA).processData=s=>w.cacheAssets?s.clone():s,o(this,CA).data.subscribe(s=>{!s.current&&s.previous?s.previous.dispose():s.current&&this.material&&(o(this,ue)&&(s.current.matrixAutoUpdate=!1),s.current.colorSpace=B.SRGBColorSpace,s.current.center.set(.5,.5),this.material.map=s.current,this.material.needsUpdate=!0,o(this,_A).call(this))})}get sourceManager(){return o(this,CA)}updateTexture(){o(this,_A).call(this)}onCoverResize(e){Ht(e,{x:this.scale.x,y:this.scale.y})}}CA=new WeakMap,ue=new WeakMap,_A=new WeakMap;class ni extends Jt{constructor(A){super(Fe(eA({},A),{loader:MA}))}}class ii{load(...A){const e=A[0],s=A[1],t=A[3],n=document.createElement("video");n.src=e,n.onloadeddata=()=>{s(new B.VideoTexture(n)),n.onerror=null,n.onloadeddata=null},n.onerror=()=>{t==null||t(e),n.onerror=null,n.onloadeddata=null}}}var qe,Xe,Ve;class oi extends Jt{constructor(e){super(Fe(eA({},e),{loader:new ii}));d(this,qe,void 0);d(this,Xe,void 0);d(this,Ve,void 0);D(this,qe,e.autoplay||!1),D(this,Xe,e.muted||!1),D(this,Ve,e.loop||!1),this.sourceManager.data.subscribe(s=>{if(s.current){const t=s.current.image;o(this,Xe)&&(t.muted=!0),o(this,Ve)&&(t.loop=!0),o(this,qe)&&t.play()}})}onCoverResize(e){const s=e.image;Ht(e,{x:this.scale.x,y:this.scale.y},s.videoWidth/s.videoHeight)}}qe=new WeakMap,Xe=new WeakMap,Ve=new WeakMap;function ri(C,A){C.traverse(e=>{e instanceof B.Mesh&&A(e)})}function Bi(C,A){C.traverse(e=>{e instanceof B.Mesh&&e.material&&(Array.isArray(e.material)?e.material:[e.material]).forEach(A)})}const Gt=new B.Vector3,ai=new B.Vector3;function Ci(C,A="default"){const e=w.getView(A),{width:s,height:t}=w,n=s/t;C instanceof B.Vector3?Gt.copy(C):Gt.set(...C);const i=e.camera.getWorldPosition(ai).distanceTo(Gt);if(e.camera instanceof B.OrthographicCamera)return{width:s/e.camera.zoom,height:t/e.camera.zoom,factor:1,distance:i,aspect:n};{const a=e.camera.fov*Math.PI/180,r=2*Math.tan(a/2)*i,I=r*(s/t);return{width:I,height:r,factor:s/I,distance:i,aspect:n}}}const Wt=new B.Vector3,Ii=new B.Quaternion,jt=new B.Vector3;class gi extends B.Object3D{constructor(A=document.createElement("div")){super(),this.isCSS3DObject=!0,this.element=A,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(e){e.element instanceof Element&&e.element.parentNode!==null&&e.element.parentNode.removeChild(e.element)})})}copy(A,e){return super.copy(A,e),this.element=A.element.cloneNode(!0),this}}const j=new B.Matrix4,ci=new B.Matrix4;class Ei{constructor(A={}){const e=this;let s,t,n,i;const a={camera:{style:""},objects:new WeakMap},r=A.element!==void 0?A.element:document.createElement("div");r.style.overflow="hidden",this.domElement=r;const I=document.createElement("div");I.style.transformOrigin="0 0",I.style.pointerEvents="none",r.appendChild(I);const c=document.createElement("div");c.style.transformStyle="preserve-3d",I.appendChild(c),this.getSize=function(){return{width:s,height:t}},this.render=function(h,E){const f=E.projectionMatrix.elements[5]*i;E.view&&E.view.enabled?(I.style.transform=`translate( ${-E.view.offsetX*(s/E.view.width)}px, ${-E.view.offsetY*(t/E.view.height)}px )`,I.style.transform+=`scale( ${E.view.fullWidth/E.view.width}, ${E.view.fullHeight/E.view.height} )`):I.style.transform="",h.matrixWorldAutoUpdate===!0&&h.updateMatrixWorld(),E.parent===null&&E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld();let p,F;E.isOrthographicCamera&&(p=-(E.right+E.left)/2,F=(E.top+E.bottom)/2);const G=E.view&&E.view.enabled?E.view.height/E.view.fullHeight:1,y=E.isOrthographicCamera?`scale( ${G} )scale(`+f+")translate("+g(p)+"px,"+g(F)+"px)"+Q(E.matrixWorldInverse):`scale( ${G} )translateZ(`+f+"px)"+Q(E.matrixWorldInverse),L=(E.isPerspectiveCamera?"perspective("+f+"px) ":"")+y+"translate("+n+"px,"+i+"px)";a.camera.style!==L&&(c.style.transform=L,a.camera.style=L),u(h,h,E)},this.setSize=function(h,E){s=h,t=E,n=s/2,i=t/2,r.style.width=h+"px",r.style.height=E+"px",I.style.width=h+"px",I.style.height=E+"px",c.style.width=h+"px",c.style.height=E+"px"};function g(h){return Math.abs(h)<1e-10?0:h}function Q(h){const E=h.elements;return"matrix3d("+g(E[0])+","+g(-E[1])+","+g(E[2])+","+g(E[3])+","+g(E[4])+","+g(-E[5])+","+g(E[6])+","+g(E[7])+","+g(E[8])+","+g(-E[9])+","+g(E[10])+","+g(E[11])+","+g(E[12])+","+g(-E[13])+","+g(E[14])+","+g(E[15])+")"}function l(h){const E=h.elements;return"translate(-50%,-50%)"+("matrix3d("+g(E[0])+","+g(E[1])+","+g(E[2])+","+g(E[3])+","+g(-E[4])+","+g(-E[5])+","+g(-E[6])+","+g(-E[7])+","+g(E[8])+","+g(E[9])+","+g(E[10])+","+g(E[11])+","+g(E[12])+","+g(E[13])+","+g(E[14])+","+g(E[15])+")")}function u(h,E,f,p){if(h.isCSS3DObject){const F=h.visible===!0&&h.layers.test(f.layers)===!0;if(h.element.style.display=F===!0?"":"none",F===!0){h.onBeforeRender(e,E,f);let G;h.isCSS3DSprite?(j.copy(f.matrixWorldInverse),j.transpose(),h.rotation2D!==0&&j.multiply(ci.makeRotationZ(h.rotation2D)),h.matrixWorld.decompose(Wt,Ii,jt),j.setPosition(Wt),j.scale(jt),j.elements[3]=0,j.elements[7]=0,j.elements[11]=0,j.elements[15]=1,G=l(j)):G=l(h.matrixWorld);const y=h.element,M=a.objects.get(h);if(M===void 0||M.style!==G){y.style.transform=G;const L={style:G};a.objects.set(h,L)}y.parentNode!==c&&c.appendChild(y),h.onAfterRender(e,E,f)}}for(let F=0,G=h.children.length;F<G;F++)u(h.children[F],E,f)}}}var Z,Bt,ps,We,je;const O=class O extends gi{static destroy(){wA.windowResizer.unsubscribe(o(this,je)),yA.ticker.unsubscribe(o(this,We)),D(this,Z,null)}constructor(A){var e;super(A.element),o(O,Z)||tA(e=O,Bt,ps).call(e)}};Z=new WeakMap,Bt=new WeakSet,ps=function(){D(O,Z,new Ei),o(O,Z).domElement.style.cssText=`
198
198
  position: fixed;
199
199
  left: 0;
200
200
  top: 0;
@@ -212,4 +212,4 @@ void main(){
212
212
  `),tA(this,Ze,Tt).call(this,t,"vertex",A),tA(this,Ze,Tt).call(this,t,"fragment",A),e=(n=A.onReady)==null?void 0:n.call(A,this),A.log&&(console.log("VERTEX SHADER: ",t.vertexShader),console.log("FRAGMENT SHADER: ",t.fragmentShader))}}get material(){return o(this,GA)}get uniforms(){return o(this,mA)}}GA=new WeakMap,mA=new WeakMap,Ze=new WeakSet,Tt=function(A,e,s){const t=e==="vertex"?"vertexChunk":"fragmentChunk",n=e==="vertex"?"vertexShader":"fragmentShader";s[t]&&(s[t].replace?A[n]=A[n].replace(`#include <${s[t].replace}>`,s[t].content):s[t].update&&(A[n]=A[n].replace(`#include <${s[t].update}>`,`
213
213
  #include <${s[t].update}>
214
214
  ${s[t].content}
215
- `)))};exports.En3Clip=Hn;exports.En3ClipHelpers=Jn;exports.En3Fluid=fs;exports.En3GLTF=Un;exports.En3HTML=Lt;exports.En3Image=Bi;exports.En3ImageLike=Jt;exports.En3ModifiedMaterial=Qi;exports.En3SourceManager=xt;exports.En3Video=Ci;exports.En3View=Rt;exports.coverTexture=Ht;exports.dispose=vA;exports.en3=w;exports.en3Cache=Y;exports.en3FluidPointer=RA;exports.en3GLTFLoader=ls;exports.en3TextureLoader=MA;exports.getCurrentViewport=Ei;exports.traverseMaterials=gi;exports.traverseMeshes=Ii;
215
+ `)))};exports.En3Clip=Hn;exports.En3ClipHelpers=Jn;exports.En3Fluid=fs;exports.En3GLTF=Un;exports.En3HTML=Lt;exports.En3Image=ni;exports.En3ImageLike=Jt;exports.En3ModifiedMaterial=Qi;exports.En3SourceManager=xt;exports.En3Video=oi;exports.En3View=Rt;exports.coverTexture=Ht;exports.dispose=vA;exports.en3=w;exports.en3Cache=Y;exports.en3FluidPointer=RA;exports.en3GLTFLoader=ls;exports.en3TextureLoader=MA;exports.getCurrentViewport=Ci;exports.traverseMaterials=Bi;exports.traverseMeshes=ri;